Skip to contentSkip to conversation

x86/head/64: Codestyle fixes for loading startup GDT

PATCH New harm-smits 1 participant 1 message Mar 28, 2022 x86

lore
Share & tools
lore

harm-smits

author
#0 lore raw

PATCH 1/1 x86/head/64: Codestyle fixes for loading startup GDT

Wrap the GDT access in fixup_pointer to avoid having to rely on the compiler optimization passes to generate %rip relative access. This also brings it in line with the rest of the code that is executed before the virtual paging is loaded (e.g. __startup_64 and startup_64_load_idt).

---
 arch/x86/kernel/head64.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/kernel/head64.c +3 -2
index 4f5ecbbaae77..33360a1b6ffc 100644
@@ -613,8 +613,9 @@ void early_setup_idt(void)
 void __head startup_64_setup_env(unsigned long physbase)
 {
 	/* Load GDT */
-	startup_gdt_descr.address = (unsigned long)fixup_pointer(startup_gdt, physbase);
-	native_load_gdt(&startup_gdt_descr);
+	struct desc_ptr *desc = fixup_pointer(&startup_gdt_descr, physbase);
+	desc->address = (unsigned long)fixup_pointer(startup_gdt, physbase);
+	native_load_gdt(desc);
 
 	/* New GDT is live - reload data segment registers */
 	asm volatile("movl %%eax, %%ds\n"
Signature · 1 line
2.25.1