incorrect register '%rbx' used with 'l' suffix
I'm trying to compile this code under linux with gcc compiler : static inline unsigned long get_current(void) { unsigned long current; asm volatile ( " movl %%esp, %%eax;" " andl %1, %%eax;" " movl (%%eax), %0;" : "=r" (current) : "i" (0xfffff000) ); return current; } But i'm getting this error : program.c: Assembler messages: program.c:455: Error: incorrect register `%rbx' used with `l' suffix what is wrong here ? Obviously, you're compiling for 64 bits. Try using gcc -m32 if it's not what you want, or use 64-bit registers (%esp makes no sense at all on x64). Whilst the above is sort of