[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 1/5] x86: introduce read_sregs() to allow storing to memory directly
On 28/09/2020 15:49, Jan Beulich wrote: > On 28.09.2020 14:47, Andrew Cooper wrote: >> On 28/09/2020 13:05, Jan Beulich wrote: >>> --- a/xen/include/asm-x86/regs.h >>> +++ b/xen/include/asm-x86/regs.h >>> @@ -15,4 +15,18 @@ >>> (diff == 0); >>> \ >>> }) >>> >>> +#define read_sreg(name) ({ \ >>> + unsigned int __sel; \ >>> + asm volatile ( "mov %%" STR(name) ",%0" : "=r" (__sel) ); \ >>> + __sel; \ >>> +}) >>> + >>> +static inline void read_sregs(struct cpu_user_regs *regs) >>> +{ >>> + asm volatile ( "mov %%ds, %0" : "=m" (regs->ds) ); >>> + asm volatile ( "mov %%es, %0" : "=m" (regs->es) ); >>> + asm volatile ( "mov %%fs, %0" : "=m" (regs->fs) ); >>> + asm volatile ( "mov %%gs, %0" : "=m" (regs->gs) ); >> It occurs to me that reads don't need to be volatile. There are no side >> effects. > I'll do the same for what patches 3 and 5 alter anyway, assuming > this won't invalidate your R-b there. 3 is fine. 5 is a little more problematic, because there are serialising side effects, but I suppose we really don't care here. ~Andrew
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |