In my C++ / C project I want to set the stack pointer equal to the base pointer... Intuitively I would use something like this:
asm volatile(
"movl %%ebp %%esp"
);
However, when I execute this, I get this error message:
Error: bad register name `%%ebp %%esp'
I use gcc / g++ version 4.9.1 compiler.
I dont know whether I need to set specific g++ or gcc flag though... There should be a way to manipulate the esp
and ebp
registers but I just don't know the right way to do it.
Doe anybody know how to manipulate these two registers in c++? Maybe I should do it with hexed OP codes?