error: can't find a register in class `BREG' while reloading `asm'



Hi,

The sample C program:

#include <stdio.h>
#define WORD_EAX 0
#define WORD_EBX 1
#define WORD_ECX 2
#define WORD_EDX 3
#define WORD_NUM 4

#define INITIAL_APIC_ID_BITS 0xFF000000

int get_APICID(){

unsigned int words[WORD_NUM];
unsigned int reg = 1;
__asm__ ("pushl %%ebx \n\t" /* save %ebx */
"cpuid \n\t"
"movl %%ebx, %1 \n\t" /* save what cpuid
just put in %ebx */
"popl %%ebx \n\t" /* restore the
old %ebx */
: "=a" (words[WORD_EAX]), /* output */
"=b" (words[WORD_EBX]),
"=c" (words[WORD_ECX]),
"=d" (words[WORD_EDX])
: "a" (reg)); /*
input */

return ((words[WORD_EBX] & INITIAL_APIC_ID_BITS) >>
24);
}
found at : http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well
but still i am getting an error: error: can't find a register in class
`BREG' while reloading `asm'
Could you suggest where did i go wrong ? even though the site says its
correct program?

Thanks in advance for your help.
.



Relevant Pages