On Thu, Oct 16, 2014 at 4:29 AM, Borislav Petkov <[email protected]> wrote: > On Thu, Oct 16, 2014 at 01:18:58PM +0200, Borislav Petkov wrote: >> On Thu, Oct 16, 2014 at 10:16:33AM +0200, Peter Zijlstra wrote: >> > On Tue, Oct 14, 2014 at 03:57:35PM -0700, Andy Lutomirski wrote: >> > > +/* Set in this cpu's CR4. */ >> > > +static inline void cr4_set(unsigned long mask) >> > > +{ >> > > + unsigned long cr4; >> > > + >> > > + cr4 = read_cr4(); >> > > + cr4 |= mask; >> > > + write_cr4(cr4); >> > > +} >> > > + >> > > +/* Clear in this cpu's CR4. */ >> > > +static inline void cr4_clear(unsigned long mask) >> > > +{ >> > > + unsigned long cr4; >> > > + >> > > + cr4 = read_cr4(); >> > > + cr4 &= ~mask; >> > > + write_cr4(cr4); >> > > +} > > Btw, on a related note, we probably should check whether the bits we > want to set/clear are already set/cleared and then save us the CR4 > write. > > It probably won't be the case all that much but still...
That's in patch 2. I can move it here, though. > > -- > Regards/Gruss, > Boris. > -- -- Andy Lutomirski AMA Capital Management, LLC -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

