Message ID | 20230217174814.1006961-2-andrew.cooper3@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86/kexec: ASM improvements | expand |
On 17.02.2023 18:48, Andrew Cooper wrote: > ljmp is (famously?) incompatible between Intel and AMD CPUs, and while we're > using one of the compatible forms, we've got a good stack and lret is the far > more common way of doing this. > > No functional change. > > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> One question though: > --- a/xen/arch/x86/x86_64/kexec_reloc.S > +++ b/xen/arch/x86/x86_64/kexec_reloc.S > @@ -86,12 +86,11 @@ ENTRY(kexec_reloc) > movq %rax, (compat_mode_gdt_desc + 2)(%rip) > lgdt compat_mode_gdt_desc(%rip) > > - /* Relocate compatibility mode entry point address. */ > - leal compatibility_mode(%rip), %eax > - movl %eax, compatibility_mode_far(%rip) > - > /* Enter compatibility mode. */ > - ljmp *compatibility_mode_far(%rip) > + lea compatibility_mode(%rip), %rax > + push $0x10 Any thought about making this literal number a proper expression, rendering the code a little less fragile? Jan
diff --git a/xen/arch/x86/x86_64/kexec_reloc.S b/xen/arch/x86/x86_64/kexec_reloc.S index f4842025eb56..035164e96f38 100644 --- a/xen/arch/x86/x86_64/kexec_reloc.S +++ b/xen/arch/x86/x86_64/kexec_reloc.S @@ -86,12 +86,11 @@ ENTRY(kexec_reloc) movq %rax, (compat_mode_gdt_desc + 2)(%rip) lgdt compat_mode_gdt_desc(%rip) - /* Relocate compatibility mode entry point address. */ - leal compatibility_mode(%rip), %eax - movl %eax, compatibility_mode_far(%rip) - /* Enter compatibility mode. */ - ljmp *compatibility_mode_far(%rip) + lea compatibility_mode(%rip), %rax + push $0x10 + push %rax + lretq relocate_pages: /* %rdi - indirection page maddr */ @@ -171,13 +170,6 @@ compatibility_mode: ud2 .align 4 -compatibility_mode_far: - .long 0x00000000 /* set in call_32_bit above */ - .word 0x0010 - - .type compatibility_mode_far, @object - .size compatibility_mode_far, . - compatibility_mode_far - compat_mode_gdt_desc: .word .Lcompat_mode_gdt_end - compat_mode_gdt -1 .quad 0x0000000000000000 /* set in call_32_bit above */
ljmp is (famously?) incompatible between Intel and AMD CPUs, and while we're using one of the compatible forms, we've got a good stack and lret is the far more common way of doing this. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> --- CC: Jan Beulich <JBeulich@suse.com> CC: Roger Pau Monné <roger.pau@citrix.com> CC: Wei Liu <wl@xen.org> --- xen/arch/x86/x86_64/kexec_reloc.S | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)