.. | .. |
---|
38 | 38 | .code16 |
---|
39 | 39 | |
---|
40 | 40 | .balign PAGE_SIZE |
---|
41 | | -ENTRY(trampoline_start) |
---|
| 41 | +SYM_CODE_START(trampoline_start) |
---|
42 | 42 | cli # We should be safe anyway |
---|
43 | 43 | wbinvd |
---|
44 | 44 | |
---|
.. | .. |
---|
49 | 49 | mov %ax, %es |
---|
50 | 50 | mov %ax, %ss |
---|
51 | 51 | |
---|
52 | | - movl $0xA5A5A5A5, trampoline_status |
---|
53 | | - # write marker for master knows we're running |
---|
54 | | - |
---|
55 | 52 | # Setup stack |
---|
56 | 53 | movl $rm_stack_end, %esp |
---|
57 | 54 | |
---|
.. | .. |
---|
59 | 56 | testl %eax, %eax # Check for return code |
---|
60 | 57 | jnz no_longmode |
---|
61 | 58 | |
---|
| 59 | +.Lswitch_to_protected: |
---|
62 | 60 | /* |
---|
63 | 61 | * GDT tables in non default location kernel can be beyond 16MB and |
---|
64 | 62 | * lgdt will not be able to load the address as in real mode default |
---|
.. | .. |
---|
81 | 79 | no_longmode: |
---|
82 | 80 | hlt |
---|
83 | 81 | jmp no_longmode |
---|
| 82 | +SYM_CODE_END(trampoline_start) |
---|
| 83 | + |
---|
| 84 | +#ifdef CONFIG_AMD_MEM_ENCRYPT |
---|
| 85 | +/* SEV-ES supports non-zero IP for entry points - no alignment needed */ |
---|
| 86 | +SYM_CODE_START(sev_es_trampoline_start) |
---|
| 87 | + cli # We should be safe anyway |
---|
| 88 | + |
---|
| 89 | + LJMPW_RM(1f) |
---|
| 90 | +1: |
---|
| 91 | + mov %cs, %ax # Code and data in the same place |
---|
| 92 | + mov %ax, %ds |
---|
| 93 | + mov %ax, %es |
---|
| 94 | + mov %ax, %ss |
---|
| 95 | + |
---|
| 96 | + # Setup stack |
---|
| 97 | + movl $rm_stack_end, %esp |
---|
| 98 | + |
---|
| 99 | + jmp .Lswitch_to_protected |
---|
| 100 | +SYM_CODE_END(sev_es_trampoline_start) |
---|
| 101 | +#endif /* CONFIG_AMD_MEM_ENCRYPT */ |
---|
| 102 | + |
---|
84 | 103 | #include "../kernel/verify_cpu.S" |
---|
85 | 104 | |
---|
86 | 105 | .section ".text32","ax" |
---|
87 | 106 | .code32 |
---|
88 | 107 | .balign 4 |
---|
89 | | -ENTRY(startup_32) |
---|
| 108 | +SYM_CODE_START(startup_32) |
---|
90 | 109 | movl %edx, %ss |
---|
91 | 110 | addl $pa_real_mode_base, %esp |
---|
92 | 111 | movl %edx, %ds |
---|
.. | .. |
---|
140 | 159 | * the new gdt/idt that has __KERNEL_CS with CS.L = 1. |
---|
141 | 160 | */ |
---|
142 | 161 | ljmpl $__KERNEL_CS, $pa_startup_64 |
---|
| 162 | +SYM_CODE_END(startup_32) |
---|
143 | 163 | |
---|
144 | 164 | .section ".text64","ax" |
---|
145 | 165 | .code64 |
---|
146 | 166 | .balign 4 |
---|
147 | | -ENTRY(startup_64) |
---|
| 167 | +SYM_CODE_START(startup_64) |
---|
148 | 168 | # Now jump into the kernel using virtual addresses |
---|
149 | 169 | jmpq *tr_start(%rip) |
---|
| 170 | +SYM_CODE_END(startup_64) |
---|
150 | 171 | |
---|
151 | 172 | .section ".rodata","a" |
---|
152 | 173 | # Duplicate the global descriptor table |
---|
153 | 174 | # so the kernel can live anywhere |
---|
154 | 175 | .balign 16 |
---|
155 | | - .globl tr_gdt |
---|
156 | | -tr_gdt: |
---|
| 176 | +SYM_DATA_START(tr_gdt) |
---|
157 | 177 | .short tr_gdt_end - tr_gdt - 1 # gdt limit |
---|
158 | 178 | .long pa_tr_gdt |
---|
159 | 179 | .short 0 |
---|
160 | 180 | .quad 0x00cf9b000000ffff # __KERNEL32_CS |
---|
161 | 181 | .quad 0x00af9b000000ffff # __KERNEL_CS |
---|
162 | 182 | .quad 0x00cf93000000ffff # __KERNEL_DS |
---|
163 | | -tr_gdt_end: |
---|
| 183 | +SYM_DATA_END_LABEL(tr_gdt, SYM_L_LOCAL, tr_gdt_end) |
---|
164 | 184 | |
---|
165 | 185 | .bss |
---|
166 | 186 | .balign PAGE_SIZE |
---|
167 | | -GLOBAL(trampoline_pgd) .space PAGE_SIZE |
---|
| 187 | +SYM_DATA(trampoline_pgd, .space PAGE_SIZE) |
---|
168 | 188 | |
---|
169 | 189 | .balign 8 |
---|
170 | | -GLOBAL(trampoline_header) |
---|
171 | | - tr_start: .space 8 |
---|
172 | | - GLOBAL(tr_efer) .space 8 |
---|
173 | | - GLOBAL(tr_cr4) .space 4 |
---|
174 | | - GLOBAL(tr_flags) .space 4 |
---|
175 | | -END(trampoline_header) |
---|
| 190 | +SYM_DATA_START(trampoline_header) |
---|
| 191 | + SYM_DATA_LOCAL(tr_start, .space 8) |
---|
| 192 | + SYM_DATA(tr_efer, .space 8) |
---|
| 193 | + SYM_DATA(tr_cr4, .space 4) |
---|
| 194 | + SYM_DATA(tr_flags, .space 4) |
---|
| 195 | +SYM_DATA_END(trampoline_header) |
---|
176 | 196 | |
---|
177 | 197 | #include "trampoline_common.S" |
---|