【发布时间】:2014-11-18 09:00:15
【问题描述】:
我遇到了最奇怪的问题。在 x86 汇编中,32 位寄存器(eax、ebx 等)在 256 处溢出,这表明它们实际上是 8 位的,出于某种原因。例如:
test.s:
section .data
section .text
global _start
_start:
mov eax, 1
mov ebx, 256
int 80h
如果我随后使用nasm -felf32 -g test.s && ld -m elf_i386 -s -o test test.s 编译此代码并运行生成的可执行文件,它会返回 0。同样的问题发生在 eax、ecx、edx 等。
为什么 32 位寄存器在任何情况下都会像 8 位寄存器一样工作?
【问题讨论】: