1
2
3
4
5
6 .macro ENCLU
7 .byte 0x0f, 0x01, 0xd7
8 .endm
9
10 .section ".tcs", "aw"
11 .balign 4096
12
13 .fill 1, 8, 0
14 .fill 1, 8, 0
15 .quad encl_ssa
16 .fill 1, 4, 0
17 .fill 1, 4, 1
18 .quad encl_entry
19 .fill 1, 8, 0
20 .fill 1, 8, 0
21 .fill 1, 8, 0
22 .fill 1, 4, 0xFFFFFFFF
23 .fill 1, 4, 0xFFFFFFFF
24 .fill 4024, 1, 0
25
26
27 .fill 1, 8, 0
28 .fill 1, 8, 0
29 .quad encl_ssa
30 .fill 1, 4, 0
31 .fill 1, 4, 1
32 .quad encl_entry
33 .fill 1, 8, 0
34 .fill 1, 8, 0
35 .fill 1, 8, 0
36 .fill 1, 4, 0xFFFFFFFF
37 .fill 1, 4, 0xFFFFFFFF
38 .fill 4024, 1, 0
39
40 .text
41
42encl_entry:
43
44
45
46 lea (encl_stack)(%rbx), %rax
47 xchg %rsp, %rax
48 push %rax
49
50 push %rcx
51 push %rbx
52
53 call encl_body
54
55 pop %rbx
56
57
58 xor %rcx, %rcx
59 xor %rdx, %rdx
60 xor %rdi, %rdi
61 xor %rsi, %rsi
62 xor %r8, %r8
63 xor %r9, %r9
64 xor %r10, %r10
65 xor %r11, %r11
66
67
68 add %rdx, %rdx
69
70
71
72 pop %rbx
73
74
75 pop %rax
76 mov %rax, %rsp
77
78
79 mov $4, %rax
80 enclu
81
82 .section ".data", "aw"
83
84encl_ssa:
85 .space 4096
86
87 .balign 4096
88 .space 8192
89encl_stack:
90