]> gitweb.factorcode.org Git - factor.git/blob - basis/cpu/x86/winnt/bootstrap.factor
fuel.eval: some minor cleanup.
[factor.git] / basis / cpu / x86 / 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-exception-list-offset ( -- n ) 0 bootstrap-cells ;
9 : tib-stack-base-offset ( -- n ) 1 bootstrap-cells ;
10 : tib-stack-limit-offset ( -- n ) 2 bootstrap-cells ;
11
12 : jit-save-tib ( -- )
13     tib-exception-list-offset [] tib-segment PUSH
14     tib-stack-base-offset [] tib-segment PUSH
15     tib-stack-limit-offset [] tib-segment PUSH ;
16
17 : jit-restore-tib ( -- )
18     tib-stack-limit-offset [] tib-segment POP
19     tib-stack-base-offset [] tib-segment POP
20     tib-exception-list-offset [] tib-segment POP ;
21
22 :: jit-update-tib ( ctx-reg -- )
23     ! There's a redundant load here because we're not allowed
24     ! to clobber ctx-reg. Clobbers tib-temp.
25     ! Save callstack base in TIB
26     tib-temp ctx-reg context-callstack-seg-offset [+] MOV
27     tib-temp tib-temp segment-end-offset [+] MOV
28     tib-stack-base-offset [] tib-temp tib-segment MOV
29     ! Save callstack limit in TIB
30     tib-temp ctx-reg context-callstack-seg-offset [+] MOV
31     tib-temp tib-temp segment-start-offset [+] MOV
32     tib-stack-limit-offset [] tib-temp tib-segment MOV ;