Message ID | 518a5f88-3ae4-a3ed-ab13-caaf7e8a7295@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86: introduce read_sregs() and elf_core_save_regs() adjustments | expand |
On 28/09/2020 13:06, Jan Beulich wrote: > Signed-off-by: Jan Beulich <jbeulich@suse.com> Any idea why this wasn't done before? At a minimum, I'd be tempted to put a sentence in the commit message saying "no idea why this wasn't done before". Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> > > --- a/xen/include/asm-x86/x86_64/elf.h > +++ b/xen/include/asm-x86/x86_64/elf.h > @@ -1,6 +1,7 @@ > #ifndef __X86_64_ELF_H__ > #define __X86_64_ELF_H__ > > +#include <asm/msr.h> > #include <asm/regs.h> > > typedef struct { > @@ -59,8 +60,8 @@ static inline void elf_core_save_regs(EL > 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)); > - /* thread_fs not filled in for now */ > - /* thread_gs not filled in for now */ > + rdmsrl(MSR_FS_BASE, core_regs->thread_fs); > + rdmsrl(MSR_GS_BASE, core_regs->thread_gs); > core_regs->ds = read_sreg(ds); > core_regs->es = read_sreg(es); > core_regs->fs = read_sreg(fs); >
On 28.09.2020 15:04, Andrew Cooper wrote: > On 28/09/2020 13:06, Jan Beulich wrote: >> Signed-off-by: Jan Beulich <jbeulich@suse.com> > > Any idea why this wasn't done before? No. My only guess is laziness, in the sense of "I'll do it later" and then forgetting. > At a minimum, I'd be tempted to > put a sentence in the commit message saying "no idea why this wasn't > done before". Sure, done. > Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Thanks. Jan
--- a/xen/include/asm-x86/x86_64/elf.h +++ b/xen/include/asm-x86/x86_64/elf.h @@ -1,6 +1,7 @@ #ifndef __X86_64_ELF_H__ #define __X86_64_ELF_H__ +#include <asm/msr.h> #include <asm/regs.h> typedef struct { @@ -59,8 +60,8 @@ static inline void elf_core_save_regs(EL 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)); - /* thread_fs not filled in for now */ - /* thread_gs not filled in for now */ + rdmsrl(MSR_FS_BASE, core_regs->thread_fs); + rdmsrl(MSR_GS_BASE, core_regs->thread_gs); core_regs->ds = read_sreg(ds); core_regs->es = read_sreg(es); core_regs->fs = read_sreg(fs);
Signed-off-by: Jan Beulich <jbeulich@suse.com>