我不明白为什么代码的输出是Ole。小字节序不应该影响push命令?
global _start
section .data
x: dd 3
section .text
_start:
mov eax, 4
mov ebx, 1
mov dword[x], 0x0a656c4f
push dword[x]
mov ecx, esp
mov edx, 4
int 0x80
mov eax,1
mov ebx, 0
int 0x80
如果我之后得到它mov 双字[x], 0x0a656c4f内存布局是:
0a (higher)
65
6c
4f (lower)
因为 x86 的小字节序,并且 x 指向其值为的字节4f.
After 压入双字[x],有相同的堆栈图片(向下增长时相反),其中esp指着0a
同样的问题与代码相关
mov dword[x], 0x0a656c4f
push dword[x]
替换为:
push dword 0x0a656c4f
Thanks.
堆栈增长downward:
推送前:
****
****
**** <--- ESP
After push DWORD 0x0a656c4f
:
****
****
**** -+
0x0A |
0x65 ^
0x6C |
0x4F <--- ESP -+- write(2) four bytes from here
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)