Frederick Virchanza Gotham
2023-03-15 15:14:44 UTC
Using the GNU compiler suite, I've built my program and given it a new entry point called 'pre_start' which does a few things before jumping into '_start'.
When 'pre_start' is finished processing and it's just about to jump into '_start', I want to be certain that pre_start hasn't left any remnants at all -- I need every register to be the way it was, and for the stack to be unaltered.
Using the NASM assembler, I've written two macroes. I subsitute the former in at the beginning of "pre_start", and I substitute the latter in just before the instruction 'jmp _start'.
Here's what I currently have. What else would you put in there? I want to make a generic way of saving and restoring everything that might change so that the function has no lasting observable effect.
%macro backup_all_registers 0
%macro restore_all_registers 0