[ccan] [PATCH 6/6] cpuid: Minor improvements

Rusty Russell rusty at rustcorp.com.au
Wed Oct 16 20:38:54 EST 2013


Ahmed Samy <f.fallen45 at gmail.com> writes:
> On Fri, Oct 4, 2013 at 4:08 PM, Emilio G. Cota <cota at braap.org> wrote:
>
>> On Fri, Oct 04, 2013 at 02:47:52 +0200, Ahmed Samy wrote:
>> > Oops, my bad.
>> > This one should fix it.
>>
>> Applying this patch on top of the previous one fixed it
>> for me.
>>
>>   Tested-by: Emilio G. Cota <cota at braap.org>
>>
>> I have noticed that there are unrelated changes in these patches.
>> Before pushing the changes, you should try to break unrelated changes
>> into separate, meaningful commits -- this not only helps reviewers to
>> evaluate your work, it also helps when problems arise and reverts need
>> to be applied.
>>
>> Thanks,
>>
>>                 Emilio
>>
> Yeah, I was just trying to get the problem fixed because I had no test
> environment :P

Hmm, the actual patch you applied (with Emilio's Tested-by) was NOT the
same as this.  In fact, it was fatally broken on both 32 and 64 bit.

That broke my full build, please don't do that again.

This fixes it for 32 bit, at least!

diff --git a/ccan/cpuid/cpuid.c b/ccan/cpuid/cpuid.c
index 153f52d..35e0b7a 100644
--- a/ccan/cpuid/cpuid.c
+++ b/ccan/cpuid/cpuid.c
@@ -115,13 +115,13 @@ bool cpuid_is_supported(void)
 #define ASM_POPF	"popfq\n\t"
 #define ASM_PUSHEAX 	"pushq %%rax\n\t"
 #define ASM_POPEAX 	"popq %%rax\n\t"
-#define ASM_PUSHECX 	"popq %%rcx\n\t"
+#define ASM_PUSHECX 	"pushq %%rcx\n\t"
 #elif UINTPTR_MAX == 0xffffffff
 #define ASM_PUSHF 	"pushfl\n\t"
 #define ASM_POPF	"popfl\n\t"
 #define ASM_PUSHEAX 	"pushl %%eax\n\t"
 #define ASM_POPEAX 	"popl %%eax\n\t"
-#define ASM_PUSHECX 	"popl %%ecx\n\t"
+#define ASM_PUSHECX 	"pushl %%ecx\n\t"
 #endif
 
 	int ret = 0;


More information about the ccan mailing list