Hello!
My name is Anton.
Firstly, thank you very much for such a great book!
Reading it right now and trying to do exercises.
Secondly, just wanted to share my finding, may be a note about this problem
will be added to the book sometime and will save some time for new readers.
When I was testing program with square function I noticed that at some input
values program's exit codes were not correct (program was returning squared
value by return code of exit system call).
Here is the listing:
.section .text
.globl _start
_start:
pushl $30
call square
addl $4, %esp
movl %eax, %ebx
movl $1, %eax
int $0x80
square:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
imull %eax, %eax
movl %ebp, %esp
popl %ebp
ret
return code was 127 (0x84), but it should be 900 (0x384). And the problem was
that it is limitation of bash (only 1 byte for exit codes - 0-255) and more
accurately described at link below:
https://unix.stackexchange.com/questions/418784/what-is-the-min-and-max-values-of-exit-codes-in-linux
Sincerely yours,
Anton
_______________________________________________
Pgubook-readers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/pgubook-readers