x86/ELF: eliminate pointless local variable from elf_core_save_regs()

We can just as well specify the CRn structure fields directly in the
asm()s, just like done for all other ones.

Also drop the unecessary "volatile" from the asm()-s: There are no
relevant hidden side effects.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
Jan Beulich committed 2020-09-29 10:53:13 +02:00
1 parent c8b2488a81
commit 7c6084c1f3
1 file changed
+4 -13
+4 -13
View File
@@ -37,8 +37,6 @@ typedef struct {
static inline void elf_core_save_regs(ELF_Gregset *core_regs,
crash_xen_core_t *xen_core_regs)
{
unsigned long tmp;
asm volatile("movq %%r15,%0" : "=m"(core_regs->r15));
asm volatile("movq %%r14,%0" : "=m"(core_regs->r14));
asm volatile("movq %%r13,%0" : "=m"(core_regs->r13));
@@ -67,17 +65,10 @@ static inline void elf_core_save_regs(ELF_Gregset *core_regs,
core_regs->fs = read_sreg(fs);
core_regs->gs = read_sreg(gs);
asm volatile("mov %%cr0, %0" : "=r" (tmp) : );
xen_core_regs->cr0 = tmp;
asm volatile("mov %%cr2, %0" : "=r" (tmp) : );
xen_core_regs->cr2 = tmp;
asm volatile("mov %%cr3, %0" : "=r" (tmp) : );
xen_core_regs->cr3 = tmp;
asm volatile("mov %%cr4, %0" : "=r" (tmp) : );
xen_core_regs->cr4 = tmp;
asm ( "mov %%cr0, %0" : "=r" (xen_core_regs->cr0) );
asm ( "mov %%cr2, %0" : "=r" (xen_core_regs->cr2) );
asm ( "mov %%cr3, %0" : "=r" (xen_core_regs->cr3) );
asm ( "mov %%cr4, %0" : "=r" (xen_core_regs->cr4) );
}
#endif /* __X86_64_ELF_H__ */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.