Hi Roland,
msvcrt _setjmp appears to be busted in 64bit mode, so here is my version that works in both 32bit and 64bit. It also allows you to set the jump-point anywhere in main().
But I do not recomment this strategy for catching recoverable errors where local garbage collection is involved.
'19:16 14/11/2019
'jumping back to main
'
$filename "o.exe"
'uses rtl64
sys buf[3] 'must be in global space
macro setjmp(label,buf)
=======================
addr rsi,buf
mov [rsi],rbp
mov [rsi+8],rsp
addr rcx,label
mov [rsi+16],rcx
end macro
macro longjmp(buf,value)
========================
addr rsi,buf
mov rbp,[rsi]
mov rsp,[rsi+8]
mov rax,value
jmp [rsi+16]
end macro
function xx()
=============
longjmp(buf,0x42)
print "not ok 1"
end function
function main()
===============
int a=0x12
setjmp(here,buf)
xx()
print "not ok 2"
'
here:
mov a,rax
print hex a '42
end function
'
main()