1 ! Copyright (C) 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: compiler.codegen.relocation compiler.constants cpu.x86.assembler
4 cpu.x86.assembler.operands kernel kernel.private layouts parser
6 IN: bootstrap.assembler.x86
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 ! VM pointer must be in vm-reg already
15 ! Create a new exception record and store it in the TIB.
18 ESP 3 bootstrap-cells ADD
19 tib-temp EBX WIN-EXCEPTION-HANDLER vm-special-object-offset [+] MOV
20 tib-temp tib-temp alien-offset [+] MOV
25 ! This is the new exception handler
26 tib-exception-list-offset [] ESP tib-segment MOV ;
28 :: jit-update-seh ( ctx-reg -- )
29 ! Load exception record structure that jit-install-seh
30 ! created from the bottom of the callstack.
32 tib-temp ctx-reg context-callstack-bottom-offset [+] MOV
33 tib-temp bootstrap-cell ADD
34 ! Store exception record in TIB.
35 tib-exception-list-offset [] tib-temp tib-segment MOV ;
37 << "vocab:bootstrap/assembler/x86.32.factor" parse-file suffix! >> call
38 << "vocab:bootstrap/assembler/x86.factor" parse-file suffix! >> call