Test piece:
option casemap:none
option frame:NOAUTO
includelib c:\jwasm\wininc\lib64\kernel32.lib
ExitProcess proto :dword
.code
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
proc2 proc FRAME par1:qword, par2:qword
db 048h
push rbp
.pushreg rbp
mov rbp, rsp
.setframe rbp, 0
sub rsp, 60h
.allocstack 60h
.endprolog
mov par1, rcx
mov par2, rdx
leave
ret
proc2 endp
OPTION PROLOGUE:PROLOGUEDEF
OPTION EPILOGUE:EPILOGUEDEF
proc1 proc FRAME par1:qword, par2:qword
.endprolog
mov par1,rcx
mov par2,rdx
ret
proc1 endp
proc3 proc FRAME
db 048h
push rbp
.pushreg rbp
mov rbp, rsp
.setframe rbp, 0
.endprolog
ret
proc3 endp
proc4 proc FRAME par1:qword, par2:qword
db 048h
push rbp
.pushreg rbp
mov rbp, rsp
.setframe rbp, 0
sub rsp, 60h
.allocstack 60h
.endprolog
mov par1, rcx
mov par2, rdx
leave
ret
proc4 endp
main proc
sub rsp,20h
call mainE
;call proc1
call proc2
;call proc3
call proc4
add rsp,20h
mov ecx,0
call ExitProcess
ret
main endp
ExceptionHandler proc
ret
ExceptionHandler endp
mainE proc frame:ExceptionHandler
.endprolog
ret
mainE endp
end
From this..
1) proc1 will crash as no stack frame is setup. (I believe that should be the expected result)
2) proc2, mainE and proc4 work perfectly.
3) proc3 is a problem now however. As it has no locals and no arguments the assumption is that it should use FPO, therefor there is an extra sub rsp,8 and add rsp,8 in the proc.. which is meant to account for the lack of push rbp, which has been manually added. Given there is also no corresponding leave or pop rbp it crashes.
If we add the pop rbp everything works, however the stack is unaligned due to the sub and push combined.
I don't think there is anything I can do about that apart from having an option to disable FPO (like forceframe) or as the programmer you'd be expected to know that particular proc should be coded as FPO.