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