I am trying to read a value from the stack using the gcc inline assembly with the default at&t syntax. My code is
unsigned int ret_val;
__asm volatile(
"movq %%rbp %0;\n"
:"=r"(ret_val)
);
I am getting an error:
Assembler messages:
Error: junk `%eax' after register
What is the meaning of this error and how do I get rid of this. I already read through some similar questions on SO question but no help from them. I am more interested in knowing the cause behind the error and the correct way to do it.
The code is written for x86_64 ubuntu machine.
Thanks