> On 2014-04-26, Miod Vallat <m...@online.fr> wrote:
> >> The question I have is can I disable the random number generator?s use of 
> >> that instruction? I?d rather be on -current than years old.
> >
> > Apart from the following hammer, I see no easy way to achieve this.
> >
> > Index: i386/machdep.c
> >===================================================================
> > RCS file: /cvs/src/sys/arch/i386/i386/machdep.c,v
> > retrieving revision 1.536
> > diff -u -p -r1.536 machdep.c
> > --- i386/machdep.c  29 Mar 2014 18:09:29 -0000      1.536
> > +++ i386/machdep.c  26 Apr 2014 19:13:14 -0000
> > @@ -1964,7 +1964,8 @@ identifycpu(struct cpu_info *ci)
> >     }
> >  
> >     if (ci->ci_flags & CPUF_PRIMARY) {
> > -           if (cpu_ecxfeature & CPUIDECX_RDRAND)
> > +           if (cpu_ecxfeature & CPUIDECX_RDRAND &&
> > +               vendor != CPUVENDOR_CYRIX)
> >                     has_rdrand = 1;
> >  #ifndef SMALL_KERNEL
> >             if (ci->ci_feature_sefflags & SEFF0EBX_SMAP)
> >
> >
> 
> Funnily enough it's handled here:

Then this ought to work as well:

Index: i386/locore.s
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/locore.s,v
retrieving revision 1.147
diff -u -p -r1.147 locore.s
--- i386/locore.s       13 Jun 2013 02:26:53 -0000      1.147
+++ i386/locore.s       26 Apr 2014 21:21:01 -0000
@@ -401,6 +401,7 @@ try586:     /* Use the `cpuid' instruction. 
        movl    $0,  RELOC(_C_LABEL(cpu_vendor))+12
 
        movl    $1,%eax
+       xorl    %ecx,%ecx
        cpuid
        movl    %eax,RELOC(_C_LABEL(cpu_id))    # store cpu_id and features
        movl    %ebx,RELOC(_C_LABEL(cpu_miscinfo))

Reply via email to