Working on a little assembly programming on Linux, I noticed that the value I was manually loading into the exit code kept coming out different from the value I was using.
So here’s the code (AT&T syntax):
mov ebx, [passes] ;first syscall argument: exit code mov eax, 1 ;system call number (sys_exit) int 0x80 ;"trap" to kernel
The C equivalent is:
exit(passes);
As you can see in the image, the value of passes is 12 but exit code is printing as 14 so what going on?
Well when it hit me, it definitely a Duh! moment:
The exit code prints out in octal!
Kind of weird way to do it honestly. I feel like hex or even decimal would have been more intuitive here.