r205751 - intrin.h: Implement __readmsr, __readcr3, and __writecr3

PaX Team pageexec at freemail.hu
Tue Apr 8 12:48:29 PDT 2014


On 8 Apr 2014 at 10:52, Reid Kleckner wrote:

> > > +  unsigned long __edx;
> > > +  unsigned long __eax;
> > > +  __asm__ ("rdmsr"
> > > +          : "=d"(__edx), "=a"(__eax)
> > > +          : "c"(__register)
> > > +          : "%ecx", "%edx", "%eax");
> > > +  return (((unsigned __int64)__edx) << 32) | (unsigned __int64)__eax;
> > > +}
> >
> > i don't think this is correct, input/output registers should not appear on
> > the clobbered list. gcc itself doesn't accept this code and complains with:
> >
> >   error: 'asm' operand has impossible constraints
> 
> 
> Yeah, that's wrong. I'll fix it. I suspected it was wrong, but it compiled
> fine.

perhaps clang should also detect and refuse such constructs in the future ;).




More information about the cfe-commits mailing list