hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/x86/realmode/rm/trampoline_64.S
....@@ -38,7 +38,7 @@
3838 .code16
3939
4040 .balign PAGE_SIZE
41
-ENTRY(trampoline_start)
41
+SYM_CODE_START(trampoline_start)
4242 cli # We should be safe anyway
4343 wbinvd
4444
....@@ -49,9 +49,6 @@
4949 mov %ax, %es
5050 mov %ax, %ss
5151
52
- movl $0xA5A5A5A5, trampoline_status
53
- # write marker for master knows we're running
54
-
5552 # Setup stack
5653 movl $rm_stack_end, %esp
5754
....@@ -59,6 +56,7 @@
5956 testl %eax, %eax # Check for return code
6057 jnz no_longmode
6158
59
+.Lswitch_to_protected:
6260 /*
6361 * GDT tables in non default location kernel can be beyond 16MB and
6462 * lgdt will not be able to load the address as in real mode default
....@@ -81,12 +79,33 @@
8179 no_longmode:
8280 hlt
8381 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
+
84103 #include "../kernel/verify_cpu.S"
85104
86105 .section ".text32","ax"
87106 .code32
88107 .balign 4
89
-ENTRY(startup_32)
108
+SYM_CODE_START(startup_32)
90109 movl %edx, %ss
91110 addl $pa_real_mode_base, %esp
92111 movl %edx, %ds
....@@ -140,38 +159,39 @@
140159 * the new gdt/idt that has __KERNEL_CS with CS.L = 1.
141160 */
142161 ljmpl $__KERNEL_CS, $pa_startup_64
162
+SYM_CODE_END(startup_32)
143163
144164 .section ".text64","ax"
145165 .code64
146166 .balign 4
147
-ENTRY(startup_64)
167
+SYM_CODE_START(startup_64)
148168 # Now jump into the kernel using virtual addresses
149169 jmpq *tr_start(%rip)
170
+SYM_CODE_END(startup_64)
150171
151172 .section ".rodata","a"
152173 # Duplicate the global descriptor table
153174 # so the kernel can live anywhere
154175 .balign 16
155
- .globl tr_gdt
156
-tr_gdt:
176
+SYM_DATA_START(tr_gdt)
157177 .short tr_gdt_end - tr_gdt - 1 # gdt limit
158178 .long pa_tr_gdt
159179 .short 0
160180 .quad 0x00cf9b000000ffff # __KERNEL32_CS
161181 .quad 0x00af9b000000ffff # __KERNEL_CS
162182 .quad 0x00cf93000000ffff # __KERNEL_DS
163
-tr_gdt_end:
183
+SYM_DATA_END_LABEL(tr_gdt, SYM_L_LOCAL, tr_gdt_end)
164184
165185 .bss
166186 .balign PAGE_SIZE
167
-GLOBAL(trampoline_pgd) .space PAGE_SIZE
187
+SYM_DATA(trampoline_pgd, .space PAGE_SIZE)
168188
169189 .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)
176196
177197 #include "trampoline_common.S"