i386/75049: dev/random/probe.c use cpuid instruction that not availible on i486

Boris Bliznioukov blib at dsi.ru
Tue Dec 14 02:40:20 PST 2004


>Number:         75049
>Category:       i386
>Synopsis:       dev/random/probe.c use cpuid instruction that not availible on i486
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 14 10:40:19 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Boris Bliznioukov
>Release:        RELLENG_5_3
>Organization:
>Environment:
RELENG_5_3 on MachZ x86 CPU

>Description:
I have MachZ x86 CPU, which is i486.
When I try to boot GENERIC kernel it traps on illegal instruction cpuid in dev/random/probe.c:58
i486 does not have cpuid instruction dev/random should do more checks before calling do_cpuid


http://www.paradicesoftware.com/specs/cpuid/note_cpuidtroubles.htm
>How-To-Repeat:
boot GENERIC kernel on any i486 (except Cyrix i486, most of the Cyrix CPUs have cpuid instruction)
>Fix:
*** dev/random/probe.c.orig     Tue Dec 14 13:02:59 2004
--- dev/random/probe.c  Tue Dec 14 13:05:15 2004
***************
*** 37,42 ****
--- 37,43 ----

  #if defined(__i386__) && !defined(PC98)
  #include <machine/cpufunc.h>
+ #include "cputypes.h"
  #endif

  #include <dev/random/randomdev.h>
***************
*** 55,67 ****

        /* Then go looking for hardware */
  #if defined(__i386__) && !defined(PC98)
!       do_cpuid(1, regs);
!       if ((regs[0] & 0xf) >= 3) {
!               do_cpuid(0xc0000000, regs);
!               if (regs[0] == 0xc0000001) {
!                       do_cpuid(0xc0000001, regs);
!                       if ((regs[3] & 0x0c) == 0x0c)
!                               *systat = random_nehemiah;
                }
        }
  #endif
--- 56,70 ----

        /* Then go looking for hardware */
  #if defined(__i386__) && !defined(PC98)
!       if(cpu_class != CPUCLASS_486 ) {
!               do_cpuid(1, regs);
!               if ((regs[0] & 0xf) >= 3) {
!                       do_cpuid(0xc0000000, regs);
!                       if (regs[0] == 0xc0000001) {
!                               do_cpuid(0xc0000001, regs);
!                               if ((regs[3] & 0x0c) == 0x0c)
!                                       *systat = random_nehemiah;
!                       }
                }
        }
  #endif

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-i386 mailing list