2010-04-03 20:24:33 -04:00
|
|
|
! Copyright (C) 2010 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2015-07-27 00:20:55 -04:00
|
|
|
USING: compiler.codegen.relocation compiler.constants
|
|
|
|
cpu.x86.assembler cpu.x86.assembler.operands kernel 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 ( -- )
|
|
|
|
! 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
|
|
|
|
! Exception handler address filled in by callback.cpp
|
2011-09-14 03:44:35 -04:00
|
|
|
tib-temp 0 MOV rc-absolute-cell rel-exception-handler
|
2010-04-05 19:06:51 -04:00
|
|
|
tib-temp PUSH
|
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
|