]> gitweb.factorcode.org Git - factor.git/blob - basis/cpu/x86/32/winnt/bootstrap.factor
fuel.eval: some minor cleanup.
[factor.git] / basis / cpu / x86 / 32 / winnt / bootstrap.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 cpu.x86.assembler cpu.x86.assembler.operands kernel layouts
5 locals parser sequences ;
6 IN: bootstrap.x86
7
8 : tib-segment ( -- ) FS ;
9 : tib-temp ( -- reg ) EAX ;
10
11 << "vocab:cpu/x86/winnt/bootstrap.factor" parse-file suffix! >> call
12
13 : jit-install-seh ( -- )
14     ! Create a new exception record and store it in the TIB.
15     ! Clobbers tib-temp.
16     ! Align stack
17     ESP 3 bootstrap-cells ADD
18     ! Exception handler address filled in by callback.cpp
19     tib-temp 0 MOV rc-absolute-cell rt-exception-handler jit-rel
20     tib-temp PUSH
21     ! No next handler
22     0 PUSH
23     ! This is the new exception handler
24     tib-exception-list-offset [] ESP tib-segment MOV ;
25
26 :: jit-update-seh ( ctx-reg -- )
27     ! Load exception record structure that jit-install-seh
28     ! created from the bottom of the callstack.
29     ! Clobbers tib-temp.
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 ;
34
35 << "vocab:cpu/x86/32/bootstrap.factor" parse-file suffix! >> call
36 << "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >> call