diff mbox series

[2/3] x86/entry: Simplify expressions in compat_restore_all_guest()

Message ID 20240226125501.1233599-3-andrew.cooper3@citrix.com (mailing list archive)
State New
Headers show
Series x86/entry: More cleanup | expand

Commit Message

Andrew Cooper Feb. 26, 2024, 12:55 p.m. UTC
compat_restore_all_guest() already has SPEC_CTRL_EXIT_TO_PV with a documented
requirement for %rsp to be both regs and cpuinfo.

Use the now-normal annotations and simplify the expressions which happen to be
a subtraction of 0.

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/compat/entry.S | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Jan Beulich Feb. 26, 2024, 2:29 p.m. UTC | #1
On 26.02.2024 13:55, Andrew Cooper wrote:
> compat_restore_all_guest() already has SPEC_CTRL_EXIT_TO_PV with a documented
> requirement for %rsp to be both regs and cpuinfo.
> 
> Use the now-normal annotations and simplify the expressions which happen to be
> a subtraction of 0.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
diff mbox series

Patch

diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S
index 93fbbeb4ae18..727ab65290de 100644
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -117,19 +117,19 @@  compat_process_trap:
         jmp   compat_test_all_events
 END(compat_test_all_events)
 
-/* %rbx: struct vcpu, interrupts disabled */
+/* %rbx: struct vcpu, interrupts disabled, %rsp=regs/cpuinfo */
 FUNC(compat_restore_all_guest)
         ASSERT_INTERRUPTS_DISABLED
         mov   $~(X86_EFLAGS_IOPL | X86_EFLAGS_VM), %r11d
         and   UREGS_eflags(%rsp),%r11d
 
-.macro alt_cr4_pv32
+.macro alt_cr4_pv32 /* %rsp=regs/cpuinfo */
         testb $3,UREGS_cs(%rsp)
         jpe   2f
-        mov   CPUINFO_cr4-CPUINFO_guest_cpu_user_regs(%rsp), %rax
+        mov   CPUINFO_cr4(%rsp), %rax
         and   $~XEN_CR4_PV32_BITS, %rax
 1:
-        mov   %rax, CPUINFO_cr4-CPUINFO_guest_cpu_user_regs(%rsp)
+        mov   %rax, CPUINFO_cr4(%rsp)
         mov   %rax, %cr4
         /*
          * An NMI or MCE may have occurred between the previous two
@@ -141,7 +141,7 @@  FUNC(compat_restore_all_guest)
          * loop to cause a live lock: If NMIs/MCEs occurred at that
          * high a rate, we'd be live locked anyway.
          */
-        cmp   %rax, CPUINFO_cr4-CPUINFO_guest_cpu_user_regs(%rsp)
+        cmp   %rax, CPUINFO_cr4(%rsp)
         jne   1b
 2:
 .endm