[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/5] x86/ELF: don't open-code read_sreg()


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 28 Sep 2020 13:57:43 +0100
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 28 Sep 2020 12:57:52 +0000
  • Ironport-sdr: CslbePiIO81BVd0Rjcrf255i0uExM9DowUiu4u/fPrYuCuNA0CspAO4lQYq31zsQpz/oINrPcR sOZ7gM3IXrGbvoozzFaOxtDITTXBBEl1HLK9pGIwX5FgHWIHZg9O9r9xHvRQfdkUO5A2TlDSmr HZ19lEV7/7yic/AlzWVMIMNp+68m/XFsJoLR3oWT8IJoHIQjOIjfEig0/ipuFueutLQQBmXIv5 CqQYe0pti52TUuYKSObWKoM2qFfvNpmaCmjw4Z67OdmVgqCc/Iot4ez0MbAM3K0AoD9u/QvNoL 0GI=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28/09/2020 13:05, Jan Beulich wrote:
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> --- a/xen/include/asm-x86/x86_64/elf.h
> +++ b/xen/include/asm-x86/x86_64/elf.h
> @@ -1,6 +1,8 @@
>  #ifndef __X86_64_ELF_H__
>  #define __X86_64_ELF_H__
>  
> +#include <asm/regs.h>
> +
>  typedef struct {
>      unsigned long r15;
>      unsigned long r14;
> @@ -53,16 +55,16 @@ static inline void elf_core_save_regs(EL
>      asm volatile("movq %%rdi,%0" : "=m"(core_regs->rdi));
>      /* orig_rax not filled in for now */
>      core_regs->rip = (unsigned long)elf_core_save_regs;
> -    asm volatile("movl %%cs, %%eax;" :"=a"(core_regs->cs));
> +    core_regs->cs = read_sreg(cs);
>      asm volatile("pushfq; popq %0" :"=m"(core_regs->rflags));
>      asm volatile("movq %%rsp,%0" : "=m"(core_regs->rsp));
>      asm volatile("movl %%ss, %%eax;" :"=a"(core_regs->ss));

Another one here.

With that fixed, Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

>      /* thread_fs not filled in for now */
>      /* thread_gs not filled in for now */
> -    asm volatile("movl %%ds, %%eax;" :"=a"(core_regs->ds));
> -    asm volatile("movl %%es, %%eax;" :"=a"(core_regs->es));
> -    asm volatile("movl %%fs, %%eax;" :"=a"(core_regs->fs));
> -    asm volatile("movl %%gs, %%eax;" :"=a"(core_regs->gs));
> +    core_regs->ds = read_sreg(ds);
> +    core_regs->es = read_sreg(es);
> +    core_regs->fs = read_sreg(fs);
> +    core_regs->gs = read_sreg(gs);
>  
>      asm volatile("mov %%cr0, %0" : "=r" (tmp) : );
>      xen_core_regs->cr0 = tmp;




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.