Error moving a constant byte value into %ebx

雨燕双飞 提交于 2019-12-01 11:11:29
FahimApple

You are right that,

movb $-17, (%esp)         Immediate--Memory, 1 byte

should not be allowed. In fact the authors have posted this as a typo. Check out their errata list (Ctrl-F for "p. 183").

For 64-bit 80x86; there is nothing wrong with the instruction movb $0x0F, (%ebx). It assembles to 0x67, 0xC6, 0x03, 0x0F.

The book is wrong.

Note that all instructions can be bugs (simple example: using add when you wanted to use sub), and movb $0x0F, (%ebx) may be a bug (e.g. maybe the value was supposed to be 0xFF, maybe it was supposed to use a different register, maybe it was supposed to use rbx, maybe it was supposed to be a lea, ..). This doesn't mean that it's always a bug (e.g. 32-bit addresses are perfectly legal and sometimes desirable in 64 bit code).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!