]> xenbits.xensource.com Git - xen.git/commitdiff
x86/elf: Remove ASM_CALL_CONSTRAINT from elf_core_save_regs()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 25 Mar 2025 17:55:33 +0000 (17:55 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 26 Mar 2025 11:54:59 +0000 (11:54 +0000)
I was mistaken about when ASM_CALL_CONSTRAINT is applicable.  It is not
applicable for plain pushes/pops, so remove it from the flags logic.

Clarify the description of ASM_CALL_CONSTRAINT to be explicit about unwinding
using framepointers.

Fixes: 0754534b8a38 ("x86/elf: Improve code generation in elf_core_save_regs()")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/include/asm/asm_defns.h
xen/arch/x86/include/asm/x86_64/elf.h

index 92b4116a1564db442334b5631046665fdc3b3974..72a0082d319d686ee9bab3ef97f35851d2f34f47 100644 (file)
@@ -28,8 +28,9 @@ asm ( "\t.equ CONFIG_INDIRECT_THUNK, "
 
 /*
  * This output constraint should be used for any inline asm which has a "call"
- * instruction.  Otherwise the asm may be inserted before the frame pointer
- * gets set up by the containing function.
+ * instruction, which forces the frame pointer to be set up prior to the asm
+ * block.  This matters when unwinding using frame pointers, where the asm's
+ * function can get skipped over.
  */
 #ifdef CONFIG_FRAME_POINTER
 register unsigned long current_stack_pointer asm("rsp");
index f33be46ddec9f3ffe0d00e980fabc3cdea21f19e..e7bec7327aa29b556e9bcab298c5831ac7ab00f8 100644 (file)
@@ -56,7 +56,7 @@ static inline void elf_core_save_regs(ELF_Gregset *core_regs,
     /* orig_rax not filled in for now */
     asm ( "lea (%%rip), %0" : "=r" (core_regs->rip) );
     asm ( "mov %%cs, %0" : "=m" (core_regs->cs) );
-    asm ( "pushfq; popq %0" : "=m" (core_regs->rflags) ASM_CALL_CONSTRAINT );
+    asm ( "pushfq; popq %0" : "=m" (core_regs->rflags) );
     asm ( "movq %%rsp, %0" : "=m" (core_regs->rsp) );
     asm ( "mov %%ss, %0" : "=m" (core_regs->ss) );
     rdmsrl(MSR_FS_BASE, core_regs->thread_fs);