I wanna create a PROC, which is called with many parameters
in the beginning of my proc I just wanna do a popad and right adjustment of ebp/esp to fill all my regs with that one popad
if I invoke proc,var1,var2,var3,var4...
in what registers does these end up?
and last what values I put in ebp,esp before return adr?
The problem with this method is that the return address is pushed after the parameters. POPAD took 5 cycles on the Pentium, so I doubt that this could provide any speed advantage.
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
include \masm32\include\masm32rt.inc
popargs PROTO _edi:DWORD,_esi:DWORD,_ebp:DWORD,_esp:DWORD,
_ebx:DWORD,_edx:DWORD,_ecx:DWORD,_eax:DWORD
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
.data
.code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
invoke popargs,1,2,3,4,5,6,7,8
mov eax, input(13,10,"Press enter to exit...")
exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
OPTION PROLOGUE:NONE ; Avoid having to protect EBP
OPTION EPILOGUE:NONE
; POPAD order is EDI,ESI,EBP,ESP,EBX,EDX,ECX,EAX
; ESP value is actually discarded
popargs proc _edi:DWORD,_esi:DWORD,_ebp:DWORD,_esp:DWORD,
_ebx:DWORD,_edx:DWORD,_ecx:DWORD,_eax:DWORD
GLOBAL __ret__addr__ dd 0
pop __ret__addr__
popad
push eax
push ecx
push edx
print ustr$(edi),13,10
print ustr$(esi),13,10
print ustr$(ebp),13,10
print ustr$(esp),13,10
print ustr$(ebx),13,10
pop edx
print ustr$(edx),13,10
pop ecx
print ustr$(ecx),13,10
pop eax
print ustr$(eax),13,10
jmp __ret__addr__
popargs endp
OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start