2010-04-03 20:24:33 -04:00
|
|
|
! Copyright (C) 2010 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2015-08-30 06:44:33 -04:00
|
|
|
USING: compiler.codegen.relocation compiler.constants cpu.x86.assembler
|
|
|
|
cpu.x86.assembler.operands kernel kernel.private layouts locals parser
|
|
|
|
sequences ;
|
2010-04-03 20:24:33 -04:00
|
|
|
IN: bootstrap.x86
|
|
|
|
|
2010-04-05 19:06:51 -04:00
|
|
|
: tib-segment ( -- ) FS ;
|
|
|
|
: tib-temp ( -- reg ) EAX ;
|
2010-04-03 20:24:33 -04:00
|
|
|
|
2015-05-17 04:11:48 -04:00
|
|
|
<< "vocab:bootstrap/assembler/x86.windows.factor" parse-file suffix! >> call
|
2010-04-03 20:24:33 -04:00
|
|
|
|
|
|
|
: jit-install-seh ( -- )
|
2015-08-30 06:21:20 -04:00
|
|
|
! VM pointer must be in vm-reg already
|
2010-04-03 20:24:33 -04:00
|
|
|
! Create a new exception record and store it in the TIB.
|
2010-04-05 19:06:51 -04:00
|
|
|
! Clobbers tib-temp.
|
2010-04-03 20:24:33 -04:00
|
|
|
! Align stack
|
|
|
|
ESP 3 bootstrap-cells ADD
|
2015-08-30 06:44:33 -04:00
|
|
|
tib-temp EBX WIN-EXCEPTION-HANDLER vm-special-object-offset [+] MOV
|
2015-08-30 06:21:20 -04:00
|
|
|
tib-temp tib-temp alien-offset [+] MOV
|
2010-04-05 19:06:51 -04:00
|
|
|
tib-temp PUSH
|
2015-08-30 06:21:20 -04:00
|
|
|
|
2010-04-03 20:24:33 -04:00
|
|
|
! No next handler
|
|
|
|
0 PUSH
|
|
|
|
! This is the new exception handler
|
2010-04-05 19:06:51 -04:00
|
|
|
tib-exception-list-offset [] ESP tib-segment MOV ;
|
2010-04-03 20:24:33 -04:00
|
|
|
|
|
|
|
:: jit-update-seh ( ctx-reg -- )
|
|
|
|
! Load exception record structure that jit-install-seh
|
2010-04-05 19:06:51 -04:00
|
|
|
! created from the bottom of the callstack.
|
|
|
|
! Clobbers tib-temp.
|
|
|
|
tib-temp ctx-reg context-callstack-bottom-offset [+] MOV
|
|
|
|
tib-temp bootstrap-cell ADD
|
2010-04-03 20:24:33 -04:00
|
|
|
! Store exception record in TIB.
|
2010-04-05 19:06:51 -04:00
|
|
|
tib-exception-list-offset [] tib-temp tib-segment MOV ;
|
2010-04-03 20:24:33 -04:00
|
|
|
|
2015-05-17 04:11:48 -04:00
|
|
|
<< "vocab:bootstrap/assembler/x86.32.factor" parse-file suffix! >> call
|
|
|
|
<< "vocab:bootstrap/assembler/x86.factor" parse-file suffix! >> call
|