1 ! Copyright (C) 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: compiler.codegen.relocation compiler.constants
4 cpu.x86.assembler cpu.x86.assembler.operands kernel layouts
5 locals parser sequences ;
8 : tib-segment ( -- ) FS ;
9 : tib-temp ( -- reg ) EAX ;
11 << "vocab:bootstrap/assembler/x86.windows.factor" parse-file suffix! >> call
13 : jit-install-seh ( -- )
14 ! Create a new exception record and store it in the TIB.
17 ESP 3 bootstrap-cells ADD
18 ! Exception handler address filled in by callback.cpp
19 tib-temp 0 MOV rc-absolute-cell rel-exception-handler
23 ! This is the new exception handler
24 tib-exception-list-offset [] ESP tib-segment MOV ;
26 :: jit-update-seh ( ctx-reg -- )
27 ! Load exception record structure that jit-install-seh
28 ! created from the bottom of the callstack.
30 tib-temp ctx-reg context-callstack-bottom-offset [+] MOV
31 tib-temp bootstrap-cell ADD
32 ! Store exception record in TIB.
33 tib-exception-list-offset [] tib-temp tib-segment MOV ;
35 << "vocab:bootstrap/assembler/x86.32.factor" parse-file suffix! >> call
36 << "vocab:bootstrap/assembler/x86.factor" parse-file suffix! >> call