Download Pelles C here: http://www.pellesc.se
main PROC a1:QWORD,a2:QWORD,a3:QWORD,a4:QWORD,a5:QWORD PARMAREA=4*SIZEOF QWORD
LOCAL temp1:QWORD
LOCAL temp2:QWORD
LOCAL temp3:QWORD
.
. sub rsp, 72 main PROC a1:QWORD,a2:QWORD,a3:QWORD,a4:QWORD,a5:QWORD PARMAREA=4*SIZEOF QWORD
LOCAL temp1:QWORD
LOCAL temp2:QWORD
LOCAL temp3:QWORD
.
. mov rax,@StackRes
mov temp3,rax
mov QWORD PTR [rsp+rax+8],rcx
mov QWORD PTR [rsp+rax+16],rdx
.
.
include RegsToShadSpace.inc
.data
msg db 'Hello!',0
msg2 db 'rcx,rdx,r8 and r9 are saved.',0
title db 'MsgBox',0
title2 db 'Macro test',0
.data?
mainRsp dq ?
.code
start PROC PARMAREA=5*SIZEOF QWORD
invoke main,ADDR msg2,ADDR title2,10,20,30
invoke ExitProcess,0
ret
start ENDP
main PROC a1:QWORD,a2:QWORD,a3:QWORD,a4:QWORD,a5:QWORD PARMAREA=4*SIZEOF QWORD
LOCAL temp1:QWORD
LOCAL temp2:QWORD
LOCAL temp3:QWORD
mov temp1,1
mov temp2,2
mov rax,-1
; How the stack release instructions are encoded?
; Example :
; add rsp, 88 ; 48: 83. C4, 58
; add rsp, 136 ; 48: 81. C4, 00000088
mov r10,OFFSET StackReservation
cmp WORD PTR [r10],08348h
jne l1
movzx rax,BYTE PTR [r10+3]
jmp l3
l1:
mov eax,DWORD PTR [r10+3]
l3:
lea rax,[rsp+rax+8]
mov temp3,rax
mov QWORD PTR [rax],a1
mov QWORD PTR [rax+8],a2
mov QWORD PTR [rax+16],a3
mov QWORD PTR [rax+24],a4
; MessageBox destroying parameters a1,a2,a3 and a4
invoke MessageBox,0,ADDR msg,ADDR title,0
; Retrieve the volatile registers from the shadow space
mov r10,temp3
invoke MessageBox,0,[r10],[r10+8],0
StackReservation:
ret
main ENDP
END start
Page created in 0.049 seconds with 15 queries.