I\'m quite new to x86 assembly, and I\'m trying to build off a hello world program. I\'m trying to make a subroutine, that writes a single byte to stdout, but i\'ve hit a pr
I'm in x64 mode, and like a bunch of people suggested in the comments using mov ebx, [rsp+8]
worked, because esp
are just the 4 lower bytes of the register. The stack is outside the low 4 GiB of virtual address space, so ESP != RSP and [esp]
will be an unmapped page.
Note that x86-64 calling conventions pass the first few args in register, not on the stack, so you normally don't want to do this at all (unless your function has lots of args).