lkml.org 
[lkml]   [2014]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] x86 msr: msr goto extension support
On Thu, Jul 31, 2014 at 02:05:48PM -0700, Andy Lutomirski wrote:
> On 07/31/2014 02:41 AM, kan.liang@intel.com wrote:
> > +/*
> > + * The _goto version is rdmsrl/wrmsrl with exception handling
> > + * The advantage (than _safe) is that it can directly jump in the
> > + * exception handling code, and never test in the "fast" path.
> > + *
> > + * Since _goto doesn't support output, try to protect the output
> > + * registers by clobbers, and process the registers immediately.
> > + */
> > +#define rdmsrl_goto(msr, result, fail_label) \
> > +do { \
> > + DECLARE_ARGS(val, low, high); \
> > + asm_volatile_goto("2: rdmsr\n" \
> > + "1:\n\t" \
> > + _ASM_EXTABLE(2b, %l[fail_label]) \
> > + : /* No outputs. */ \
> > + : "c" (msr) \
> > + : "%rax", "%rdx" \
> > + : fail_label); \
> > + asm volatile ("" \
> > + : EAX_EDX_RET(val, low, high) \
> > + : ); \
>
> This is scary -- the compiler is free to optimize this incorrectly, and
> it doesn't even seem very farfetched to me.

Quite so, lets add Jakub.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-08-01 10:41    [W:0.120 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site