Skip to contentSkip to conversation

x86/kexec: Drop compat_mode_gdt_desc

PATCH In review Andrew Cooper 2 participants 3 messages Jun 30

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/kexec: Drop compat_mode_gdt_desc

Given the need to calculate the base anyway, it's easier to do so entirely on the stack.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Teddy Astie <[email protected]>

---
 xen/arch/x86/x86_64/kexec_reloc.S | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
xen/arch/x86/x86_64/kexec_reloc.S +5 -8
index ec1e4e3550e4..62e83d60a85d 100644
@@ -114,9 +114,11 @@ FUNC(kexec_reloc)
 .L_call_32_bit:
 
         /* Load compat GDT. */
-        leaq    compat_mode_gdt(%rip), %rax
-        movq    %rax, (compat_mode_gdt_desc + 2)(%rip)
-        lgdt    compat_mode_gdt_desc(%rip)
+        lea     compat_mode_gdt(%rip), %rax
+        push    %rax
+        pushw   $.Lcompat_mode_gdt_end - 1 - compat_mode_gdt
+        lgdt    (%rsp)
+        add     $10, %rsp
 
         /* Enter compatibility mode. */
         lea     compatibility_mode(%rip), %rax
@@ -206,11 +208,6 @@ END(compatibility_mode)
         /* Separate code and data into into different cache lines */
         .balign L1_CACHE_BYTES
 
-DATA_LOCAL(compat_mode_gdt_desc, 4)
-        .word .Lcompat_mode_gdt_end - compat_mode_gdt -1
-        .quad 0x0000000000000000     /* set in call_32_bit above */
-END(compat_mode_gdt_desc)
-
 DATA_LOCAL(compat_mode_gdt, 8)
         .quad 0x0000000000000000     /* null                              */
         .quad 0x00cf93000000ffff     /* 0x0008 ring 0 data                */
Signature · 1 line
2.39.5
#2 lore raw
Quoted 10 lines · Jan Beulich
Quoted 6 lines · Andrew Cooper

Given the need to calculate the base anyway, it's easier to do so entirely on the stack.

No functional change.

Since we've started using (the somewhat odd) PUSHW, perhaps not really a problem to have another instance:

Thanks.

These are the only two where it makes sense, AFAICT.  I'm not expecting to use this trick elsewhere.

~Andrew