Commit Graph

2 Commits

Author SHA1 Message Date
Elf M. Sternberg 89b58186fb BUG Fix bug in 64-bit subroutine lesson. Streamline 32-bit subroutine lesson.
There was a bug in the 64-bit subroutine lesson that popped the stack
once too many times: there were two pushes but three pops.  That this
didn't generate a stack underflow condition confuses and worries me.
I would have expected a segfault when I decremented the stack counter
once too often.  This makes me wonder if I understand this program well
enough.

The effect on the registers was, fortunately, harmless as the next step
completely repurposed the registers to initialize the exit() routine.

Once I'd figured out how to use the RSI and RAX registers correctly, I
streamlined the 32-bit version so that the products of strlen(), the
start and length of the message, were already in the registers when I
issued my syscall to WRITE().  I'm sure this is, in some ways, *bad*
assembly, but I'm not (yet) an ASM stylist.
2018-04-27 16:44:37 -07:00
Elf M. Sternberg 127e5c0b71 FEAT Added subroutines to the list of skills taught in this tutorial. 2018-04-27 13:34:02 -07:00