Port-amd64 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Weird assembly code behavior
Emmanuel Dreyfus wrote:
> Here rsp = 0x18001a4
[...]
> 0xe85d5f <memcpy+15>: lea -0x8(%rdi,%rdx,1),%r9
> That instruction changed rsp to 0x18001a3
>
> 0xe85d60 <memcpy+16>: lea -0x8(%rdi,%rdx,1),%ecx
This looks like the processor is in a 32-bit mode but executing code
that was generated for 64-bit mode, and the debugger is disassembling
the code assuming a 64-bit mode.
Would the byte at 0xe85d5f by 0x4C by any chance? This means "dec SP"
in 32-bit mode, which would explain why the stack pointer is decremented
and why the program counter increases only by 1 (since it's a one-byte
instruction), but in 64-bit mode it's a REX register prefix that's part
of a longer instruction.
--
Andreas Gustafsson, gson%gson.org@localhost
Home |
Main Index |
Thread Index |
Old Index