x86/kexec: store segment registers directly to memory in crash_setup_regs()
PATCH 1/1 x86/kexec: store segment registers directly to memory in crash_setup_regs()
crash_setup_regs() currently moves segment registers (ss, cs, ds, es) into pt_regs via a general purpose register (%eax). Update the code to avoid the intermediate register and store segment registers directly to their destination fields. This reduces the generated code from:
131: 8c d0 mov %ss,%eax
133: 66 89 84 24 a0 00 00 mov %ax,0xa0(%rsp)
13a: 00
13b: 8c c8 mov %cs,%eax
13d: 66 89 84 24 88 00 00 mov %ax,0x88(%rsp)
144: 00
to:
131: 8c 94 24 a0 00 00 00 mov %ss,0xa0(%rsp)
138: 8c 8c 24 88 00 00 00 mov %cs,0x88(%rsp)
No functional change intended.
Signed-off-by Uros Bizjak <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
--- arch/x86/include/asm/kexec.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/include/asm/kexec.h +4 -4
@@ -106,11 +106,11 @@ static inline void crash_setup_regs(struct pt_regs *newregs, asmvolatile ("mov %%r14,%0" :"=m" (newregs->r14)); asmvolatile ("mov %%r15,%0" :"=m" (newregs->r15));#endif - asmvolatile ("mov %%ss,%k0" :"=a" (newregs->ss)); - asmvolatile ("mov %%cs,%k0" :"=a" (newregs->cs)); + asmvolatile ("mov %%ss,%0" :"=m" (newregs->ss)); + asmvolatile ("mov %%cs,%0" :"=m" (newregs->cs));#ifdef CONFIG_X86_32 - asmvolatile ("mov %%ds,%k0" :"=a" (newregs->ds)); - asmvolatile ("mov %%es,%k0" :"=a" (newregs->es)); + asmvolatile ("mov %%ds,%0" :"=m" (newregs->ds)); + asmvolatile ("mov %%es,%0" :"=m" (newregs->es));#endif asmvolatile ("pushf\n\t" "pop %0" :"=m" (newregs->flags));
Signature · 1 line
2.53.0