Backends/Kinc-HL/hl/src/jit.c
static void jit_longjump( jit_ctx *ctx ) {
	preg *buf = REG_AT(CALL_REGS[0]);
	preg *ret = REG_AT(CALL_REGS[1]);
	preg p;
	int i;
	op64(ctx,MOV,PEAX,ret); // return value
	op64(ctx,MOV,REG_AT(Edx),pmem(&p,buf->id,0x0));
	op64(ctx,MOV,REG_AT(Ebx),pmem(&p,buf->id,0x8));
	op64(ctx,MOV,REG_AT(Esp),pmem(&p,buf->id,0x10));
	op64(ctx,MOV,REG_AT(Ebp),pmem(&p,buf->id,0x18));
	op64(ctx,MOV,REG_AT(Esi),pmem(&p,buf->id,0x20));
	op64(ctx,MOV,REG_AT(Edi),pmem(&p,buf->id,0x28));
	op64(ctx,MOV,REG_AT(R12),pmem(&p,buf->id,0x30));
	op64(ctx,MOV,REG_AT(R13),pmem(&p,buf->id,0x38));
	op64(ctx,MOV,REG_AT(R14),pmem(&p,buf->id,0x40));
	op64(ctx,MOV,REG_AT(R15),pmem(&p,buf->id,0x48));
	op64(ctx,LDMXCSR,pmem(&p,buf->id,0x58), UNUSED);
	op64(ctx,FLDCW,pmem(&p,buf->id,0x5C), UNUSED);
	for(i=0;i<10;i++)
		op64(ctx,MOVSD,REG_AT(XMM(i+6)),pmem(&p,buf->id,0x60 + i * 16));
	op64(ctx,PUSH,pmem(&p,buf->id,0x50),UNUSED);
	op64(ctx,RET,UNUSED,UNUSED);
}
// Win64 debug CRT performs a Rtl stack check in debug mode, preventing from
// using longjump. This in an alternate implementation that follows the native
// setjump storage.
//
// Another more reliable way of handling this would be to use RtlAddFunctionTable
// but this would require complex creation of unwind info

Win64 debug CRT performs a Rtl stack check in debug mode, preventing from
using longjump. This in an alternate implementation that follows the native
setjump storage.

Another more reliable way of handling this would be to use RtlAddFunctionTable
but this would require complex creation of unwind info
Win64 debug CRT performs a Rtl stack check in debug mode preventing from using longjump . This in an alternate implementation that follows the native setjump storage . Another more reliable way of handling this would be to use RtlAddFunctionTable but this would require complex creation of unwind info
static void jit_longjump( jit_ctx *ctx ) {
	preg *buf = REG_AT(CALL_REGS[0]);
	preg *ret = REG_AT(CALL_REGS[1]);
	preg p;
	int i;
	op64(ctx,MOV,PEAX,ret); 
	op64(ctx,MOV,REG_AT(Edx),pmem(&p,buf->id,0x0));
	op64(ctx,MOV,REG_AT(Ebx),pmem(&p,buf->id,0x8));
	op64(ctx,MOV,REG_AT(Esp),pmem(&p,buf->id,0x10));
	op64(ctx,MOV,REG_AT(Ebp),pmem(&p,buf->id,0x18));
	op64(ctx,MOV,REG_AT(Esi),pmem(&p,buf->id,0x20));
	op64(ctx,MOV,REG_AT(Edi),pmem(&p,buf->id,0x28));
	op64(ctx,MOV,REG_AT(R12),pmem(&p,buf->id,0x30));
	op64(ctx,MOV,REG_AT(R13),pmem(&p,buf->id,0x38));
	op64(ctx,MOV,REG_AT(R14),pmem(&p,buf->id,0x40));
	op64(ctx,MOV,REG_AT(R15),pmem(&p,buf->id,0x48));
	op64(ctx,LDMXCSR,pmem(&p,buf->id,0x58), UNUSED);
	op64(ctx,FLDCW,pmem(&p,buf->id,0x5C), UNUSED);
	for(i=0;i<10;i++)
		op64(ctx,MOVSD,REG_AT(XMM(i+6)),pmem(&p,buf->id,0x60 + i * 16));
	op64(ctx,PUSH,pmem(&p,buf->id,0x50),UNUSED);
	op64(ctx,RET,UNUSED,UNUSED);
}
static void jit_longjump ( jit_ctx * ctx ) { preg * buf = REG_AT ( CALL_REGS [ 0 ] ) ; preg * ret = REG_AT ( CALL_REGS [ 1 ] ) ; preg p ; int i ; op64 ( ctx , MOV , PEAX , ret ) ; op64 ( ctx , MOV , REG_AT ( Edx ) , pmem ( & p , buf -> id , 0x0 ) ) ; op64 ( ctx , MOV , REG_AT ( Ebx ) , pmem ( & p , buf -> id , 0x8 ) ) ; op64 ( ctx , MOV , REG_AT ( Esp ) , pmem ( & p , buf -> id , 0x10 ) ) ; op64 ( ctx , MOV , REG_AT ( Ebp ) , pmem ( & p , buf -> id , 0x18 ) ) ; op64 ( ctx , MOV , REG_AT ( Esi ) , pmem ( & p , buf -> id , 0x20 ) ) ; op64 ( ctx , MOV , REG_AT ( Edi ) , pmem ( & p , buf -> id , 0x28 ) ) ; op64 ( ctx , MOV , REG_AT ( R12 ) , pmem ( & p , buf -> id , 0x30 ) ) ; op64 ( ctx , MOV , REG_AT ( R13 ) , pmem ( & p , buf -> id , 0x38 ) ) ; op64 ( ctx , MOV , REG_AT ( R14 ) , pmem ( & p , buf -> id , 0x40 ) ) ; op64 ( ctx , MOV , REG_AT ( R15 ) , pmem ( & p , buf -> id , 0x48 ) ) ; op64 ( ctx , LDMXCSR , pmem ( & p , buf -> id , 0x58 ) , UNUSED ) ; op64 ( ctx , FLDCW , pmem ( & p , buf -> id , 0x5C ) , UNUSED ) ; for ( i = 0 ; i < 10 ; i ++ ) op64 ( ctx , MOVSD , REG_AT ( XMM ( i + 6 ) ) , pmem ( & p , buf -> id , 0x60 + i * 16 ) ) ; op64 ( ctx , PUSH , pmem ( & p , buf -> id , 0x50 ) , UNUSED ) ; op64 ( ctx , RET , UNUSED , UNUSED ) ; }
Win64 debug CRT performs a Rtl stack check in debug mode, preventing from
using longjump.
Win64 debug CRT performs a Rtl stack check in debug mode preventing from using longjump .
// return value
