All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/head/64: Codestyle fixes for loading startup GDT
@ 2022-03-28 18:35 harm-smits
  0 siblings, 0 replies; only message in thread
From: harm-smits @ 2022-03-28 18:35 UTC (permalink / raw)
  Cc: harmsmitsdev, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Brijesh Singh, Joerg Roedel,
	Tom Lendacky, Marco Bonelli, linux-kernel

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`).

Signed-off-by: harm-smits <harmsmitsdev@gmail.com>
---
 arch/x86/kernel/head64.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 4f5ecbbaae77..33360a1b6ffc 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -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"
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-28 18:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 18:35 [PATCH] x86/head/64: Codestyle fixes for loading startup GDT harm-smits

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.