Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 99 lines (84 sloc) 2.042 kb
11c1f63 @nelhage Move some sketchy inline assembly into an external file, and make
authored
1 .text
9d2aa9a @nelhage Check for interrupts in the fragment prologue
authored
2
c1ab95f @nelhage Statically allocate registers for BP and SP.
authored
3 #define SP 29
4 #define BP 27
5
9a8d06f @nelhage bt_helper.S: Prepend _ to symbols on OS X.
authored
6 #ifdef __APPLE__
7 #define _(x) _##x
8 #else
9 #define _(x) x
10 #endif
11
a4b2150 @nelhage Simplify bt_translate_interp.
authored
12 .globl _(bt_interp_one)
9a8d06f @nelhage bt_helper.S: Prepend _ to symbols on OS X.
authored
13 .globl _(bt_continue)
14 .globl _(bt_continue_chain)
3f18e50 @nelhage Skip the (PC == %eax) check in most frags.
authored
15 .globl _(bt_continue_ic)
9a8d06f @nelhage bt_helper.S: Prepend _ to symbols on OS X.
authored
16 .globl _(bt_enter)
17 .globl _(bt_interrupt)
18
a4b2150 @nelhage Simplify bt_translate_interp.
authored
19 .macro LOAD_CPU pc=1
20 .if \pc
bb0b3f5 @nelhage Split bt_helper into 32- and 64-bit versions.
authored
21 mov 128(%rbp), %eax
a4b2150 @nelhage Simplify bt_translate_interp.
authored
22 .endif
bb0b3f5 @nelhage Split bt_helper into 32- and 64-bit versions.
authored
23 mov (4*SP)(%rbp), %ebx
24 mov (4*BP)(%rbp), %edx
25 mov (4*0)(%rbp), %esi
1f46955 @nelhage Use a dedicated register to hold the memory base on amd64.
authored
26 mov (32*4 + 8)(%rbp), %rdi
27 // mov (4*1)(%rbp), %edi
a4b2150 @nelhage Simplify bt_translate_interp.
authored
28 .endm
29
30 .macro SAVE_CPU pc=1
31 .if \pc
bb0b3f5 @nelhage Split bt_helper into 32- and 64-bit versions.
authored
32 mov %eax, 128(%rbp)
a4b2150 @nelhage Simplify bt_translate_interp.
authored
33 .endif
bb0b3f5 @nelhage Split bt_helper into 32- and 64-bit versions.
authored
34 mov %ebx, (4*SP)(%rbp)
35 mov %edx, (4*BP)(%rbp)
36 mov %esi, (4*0)(%rbp)
1f46955 @nelhage Use a dedicated register to hold the memory base on amd64.
authored
37 // mov %edi, (4*1)(%rbp)
c1ab95f @nelhage Statically allocate registers for BP and SP.
authored
38 .endm
39
a4b2150 @nelhage Simplify bt_translate_interp.
authored
40 _(bt_interp_one):
41 SAVE_CPU 0
bb0b3f5 @nelhage Split bt_helper into 32- and 64-bit versions.
authored
42 movq %rbp, %rdi
d52384c @nelhage OS X support for amd64.
authored
43 pushq $0 // fix stack alignment
a4b2150 @nelhage Simplify bt_translate_interp.
authored
44 call _(bt_step_one)
d52384c @nelhage OS X support for amd64.
authored
45 popq %rax
a4b2150 @nelhage Simplify bt_translate_interp.
authored
46 LOAD_CPU
47 ret
48
c1ab95f @nelhage Statically allocate registers for BP and SP.
authored
49 _(bt_interrupt):
a4b2150 @nelhage Simplify bt_translate_interp.
authored
50 SAVE_CPU
d52384c @nelhage OS X support for amd64.
authored
51 movq _(bt_stack_base)(%rip), %rsp
bb0b3f5 @nelhage Split bt_helper into 32- and 64-bit versions.
authored
52 movq %rbp, %rdi
2420b45 @nelhage Convert beta_cpu into a C++ class.
authored
53 call _(bt_process_interrupt)
d8087c1 @nelhage Make bt_translate_and_run use regparm(3).
authored
54 xorl %edx, %edx
55 xorl %ecx, %ecx
56 movl %ebp, %eax
9a8d06f @nelhage bt_helper.S: Prepend _ to symbols on OS X.
authored
57 call _(bt_translate_and_run)
11c1f63 @nelhage Move some sketchy inline assembly into an external file, and make
authored
58
9a8d06f @nelhage bt_helper.S: Prepend _ to symbols on OS X.
authored
59 _(bt_continue):
40a6f9d @nelhage Add a fast-path frag hash lookup in bt_continue.
authored
60 mov %eax, %ecx
61
62 /* Try a fast-path lookup of PC in the frag hash table. */
d52384c @nelhage OS X support for amd64.
authored
63 andl $0x3fb, %ecx
64 leaq _(bt_frag_hash)(%rip), %r10
65 movq (%r10, %rcx, 1), %rcx
66 testq %rcx, %rcx /* non-NULL frag */
40a6f9d @nelhage Add a fast-path frag hash lookup in bt_continue.
authored
67 jz miss
d52384c @nelhage OS X support for amd64.
authored
68 cmpl %eax, (%rcx) /* Compare PC */
40a6f9d @nelhage Add a fast-path frag hash lookup in bt_continue.
authored
69 jne miss
d52384c @nelhage OS X support for amd64.
authored
70 movq 16(%rcx), %rcx
40a6f9d @nelhage Add a fast-path frag hash lookup in bt_continue.
authored
71
d52384c @nelhage OS X support for amd64.
authored
72 cmpl $0, 132(%ebp) /* Check CPU.halt */
40a6f9d @nelhage Add a fast-path frag hash lookup in bt_continue.
authored
73 jnz miss
74
bb0b3f5 @nelhage Split bt_helper into 32- and 64-bit versions.
authored
75 jmp *%rcx
40a6f9d @nelhage Add a fast-path frag hash lookup in bt_continue.
authored
76
77 miss:
bb0b3f5 @nelhage Split bt_helper into 32- and 64-bit versions.
authored
78 pushq $0
9a8d06f @nelhage bt_helper.S: Prepend _ to symbols on OS X.
authored
79 _(bt_continue_chain):
a4b2150 @nelhage Simplify bt_translate_interp.
authored
80 SAVE_CPU
bb0b3f5 @nelhage Split bt_helper into 32- and 64-bit versions.
authored
81 popq %rdx
82 movl $1, %esi
83 movq %rbp, %rdi
3f18e50 @nelhage Skip the (PC == %eax) check in most frags.
authored
84 call _(bt_translate_and_run)
85
86 _(bt_continue_ic):
a4b2150 @nelhage Simplify bt_translate_interp.
authored
87 SAVE_CPU
bb0b3f5 @nelhage Split bt_helper into 32- and 64-bit versions.
authored
88 popq %rdx
89 xorl %esi, %esi
90 movq %rbp, %rdi
9a8d06f @nelhage bt_helper.S: Prepend _ to symbols on OS X.
authored
91 call _(bt_translate_and_run)
11c1f63 @nelhage Move some sketchy inline assembly into an external file, and make
authored
92
9a8d06f @nelhage bt_helper.S: Prepend _ to symbols on OS X.
authored
93 _(bt_enter):
bb0b3f5 @nelhage Split bt_helper into 32- and 64-bit versions.
authored
94 mov %rdi, %rcx
d52384c @nelhage OS X support for amd64.
authored
95 movq _(bt_stack_base)(%rip), %rsp
96 leaq _(CPU)(%rip), %rbp
a4b2150 @nelhage Simplify bt_translate_interp.
authored
97 LOAD_CPU
bb0b3f5 @nelhage Split bt_helper into 32- and 64-bit versions.
authored
98 jmp *%rcx
Something went wrong with that request. Please try again.