Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/kexec: Merge x86_32 and x86_64 code using macros from <asm/asm.h>

Merge common x86_32 and x86_64 code in crash_setup_regs()
using macros from <asm/asm.h>.

The compiled object files before and after the patch are unchanged.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Cc: Baoquan He <bhe@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lore.kernel.org/r/20250306145227.55819-1-ubizjak@gmail.com

authored by

Uros Bizjak and committed by
Ingo Molnar
a9deda69 bd72baff

+26 -34
+26 -34
arch/x86/include/asm/kexec.h
··· 18 18 #include <linux/string.h> 19 19 #include <linux/kernel.h> 20 20 21 + #include <asm/asm.h> 21 22 #include <asm/page.h> 22 23 #include <asm/ptrace.h> 23 24 ··· 72 71 if (oldregs) { 73 72 memcpy(newregs, oldregs, sizeof(*newregs)); 74 73 } else { 75 - #ifdef CONFIG_X86_32 76 - asm volatile("movl %%ebx,%0" : "=m"(newregs->bx)); 77 - asm volatile("movl %%ecx,%0" : "=m"(newregs->cx)); 78 - asm volatile("movl %%edx,%0" : "=m"(newregs->dx)); 79 - asm volatile("movl %%esi,%0" : "=m"(newregs->si)); 80 - asm volatile("movl %%edi,%0" : "=m"(newregs->di)); 81 - asm volatile("movl %%ebp,%0" : "=m"(newregs->bp)); 82 - asm volatile("movl %%eax,%0" : "=m"(newregs->ax)); 83 - asm volatile("movl %%esp,%0" : "=m"(newregs->sp)); 84 - asm volatile("movl %%ss, %%eax;" :"=a"(newregs->ss)); 85 - asm volatile("movl %%cs, %%eax;" :"=a"(newregs->cs)); 86 - asm volatile("movl %%ds, %%eax;" :"=a"(newregs->ds)); 87 - asm volatile("movl %%es, %%eax;" :"=a"(newregs->es)); 88 - asm volatile("pushfl; popl %0" :"=m"(newregs->flags)); 89 - #else 90 - asm volatile("movq %%rbx,%0" : "=m"(newregs->bx)); 91 - asm volatile("movq %%rcx,%0" : "=m"(newregs->cx)); 92 - asm volatile("movq %%rdx,%0" : "=m"(newregs->dx)); 93 - asm volatile("movq %%rsi,%0" : "=m"(newregs->si)); 94 - asm volatile("movq %%rdi,%0" : "=m"(newregs->di)); 95 - asm volatile("movq %%rbp,%0" : "=m"(newregs->bp)); 96 - asm volatile("movq %%rax,%0" : "=m"(newregs->ax)); 97 - asm volatile("movq %%rsp,%0" : "=m"(newregs->sp)); 98 - asm volatile("movq %%r8,%0" : "=m"(newregs->r8)); 99 - asm volatile("movq %%r9,%0" : "=m"(newregs->r9)); 100 - asm volatile("movq %%r10,%0" : "=m"(newregs->r10)); 101 - asm volatile("movq %%r11,%0" : "=m"(newregs->r11)); 102 - asm volatile("movq %%r12,%0" : "=m"(newregs->r12)); 103 - asm volatile("movq %%r13,%0" : "=m"(newregs->r13)); 104 - asm volatile("movq %%r14,%0" : "=m"(newregs->r14)); 105 - asm volatile("movq %%r15,%0" : "=m"(newregs->r15)); 106 - asm volatile("movl %%ss, %%eax;" :"=a"(newregs->ss)); 107 - asm volatile("movl %%cs, %%eax;" :"=a"(newregs->cs)); 108 - asm volatile("pushfq; popq %0" :"=m"(newregs->flags)); 74 + asm volatile("mov %%" _ASM_BX ",%0" : "=m"(newregs->bx)); 75 + asm volatile("mov %%" _ASM_CX ",%0" : "=m"(newregs->cx)); 76 + asm volatile("mov %%" _ASM_DX ",%0" : "=m"(newregs->dx)); 77 + asm volatile("mov %%" _ASM_SI ",%0" : "=m"(newregs->si)); 78 + asm volatile("mov %%" _ASM_DI ",%0" : "=m"(newregs->di)); 79 + asm volatile("mov %%" _ASM_BP ",%0" : "=m"(newregs->bp)); 80 + asm volatile("mov %%" _ASM_AX ",%0" : "=m"(newregs->ax)); 81 + asm volatile("mov %%" _ASM_SP ",%0" : "=m"(newregs->sp)); 82 + #ifdef CONFIG_X86_64 83 + asm volatile("mov %%r8,%0" : "=m"(newregs->r8)); 84 + asm volatile("mov %%r9,%0" : "=m"(newregs->r9)); 85 + asm volatile("mov %%r10,%0" : "=m"(newregs->r10)); 86 + asm volatile("mov %%r11,%0" : "=m"(newregs->r11)); 87 + asm volatile("mov %%r12,%0" : "=m"(newregs->r12)); 88 + asm volatile("mov %%r13,%0" : "=m"(newregs->r13)); 89 + asm volatile("mov %%r14,%0" : "=m"(newregs->r14)); 90 + asm volatile("mov %%r15,%0" : "=m"(newregs->r15)); 109 91 #endif 92 + asm volatile("mov %%ss,%k0" : "=a"(newregs->ss)); 93 + asm volatile("mov %%cs,%k0" : "=a"(newregs->cs)); 94 + #ifdef CONFIG_X86_32 95 + asm volatile("mov %%ds,%k0" : "=a"(newregs->ds)); 96 + asm volatile("mov %%es,%k0" : "=a"(newregs->es)); 97 + #endif 98 + asm volatile("pushf\n\t" 99 + "pop %0" : "=m"(newregs->flags)); 110 100 newregs->ip = _THIS_IP_; 111 101 } 112 102 }