This changes the calling convention to place the return address above
rather than below the arguments. This has the nice benefit of making
it possible to eliminate the parity thing for reconstructing whether
you were called in a padded stack or not. It also seems basically
required to implement tail calls since a tail called function has to
pop all of its local variables and arguments off, but previously these
had a return pointer in the middle of it all. This simplifies the
callee pop (no more saving/restoring return address), but it slightly
complicates calls, since we have to put arguments below the return
address it's not possible to use a Call instruction without
violating the property that there's nothing below rsp. The solution
is to simulate Call by labelling the returning point, pushing it,
then the args, then jumping to the function.
This changes the calling convention to place the return address above rather than below the arguments. This has the nice benefit of making it possible to eliminate the
parity
thing for reconstructing whether you were called in a padded stack or not. It also seems basically required to implement tail calls since a tail called function has to pop all of its local variables and arguments off, but previously these had a return pointer in the middle of it all. This simplifies the callee pop (no more saving/restoring return address), but it slightly complicates calls, since we have to put arguments below the return address it's not possible to use aCall
instruction without violating the property that there's nothing belowrsp
. The solution is to simulateCall
by labelling the returning point, pushing it, then the args, then jumping to the function.