I\'ve been having the strangest problem. In x86 assembly, the 32 bit registers (eax, ebx, etc.) have been overflowing at 256, suggesting that they\'re actually 8 bit, for so
It's not the register wrapping around, it's the exit system call, which only uses the lower eight bits of ebx for the return code.
From the exit man-page:
The
exit()function causes normal process termination and the value ofstatus & 0377is returned to the parent (seewait(2)).
That 0377 is the octal equivalent of 0xff (binary 1111 1111), meaning that only the lower eight bits are used. The other bits in what you get back from wait() (in the parent) are used for things such as whether the child process was terminated, what signal was used if so, whether a core dump occurred, and so on.