The MASM Forum

Microsoft 64 bit MASM => MASM64 SDK => Topic started by: hutch-- on July 24, 2018, 10:57:06 AM

Title: Interesting effect when using a stack frame in 64 bit MASM.
Post by: hutch-- on July 24, 2018, 10:57:06 AM
With 64 bit MASM, if you use a normal argument list in a procedure with 4 or less arguments, MASM will write the data to shadow space but if you write the procedure with a stack frame but no argument list, you do not get the shadow space overhead. It means you must write the code so that the registers used to pass the first 4 arguments are in the right place in the source code but it means you can bypass the shadow space overhead if you need to.

Without the shadow space overhead, the overhead calling the procedure is reasonably low,

enter etc ...
sub rsp, whatever

; user code here

leave
ret