Print this page
OS-4368 lxbrand glibc abhors CPUID limits


  24 
  25        The API for the character device consists of using the seek offset to
  26        set the function code value, and using a read(2) or pread(2) of 16
  27        bytes to fetch the four 32-bit return values of the instruction in the
  28        order %eax, %ebx, %ecx and %edx.
  29 
  30        No data can be written to the device. Like the cpuid instruction, no
  31        special privileges are required to use the device.
  32 
  33        The device is useful to enable low-level configuration information to
  34        be extracted from the CPU without having to write any assembler code to
  35        invoke the cpuid instruction directly. It also allows the kernel to
  36        attempt to correct any erroneous data returned by the instruction
  37        (prompted by occasional errors in the information exported by various
  38        processor implementations over the years).
  39 
  40        See the processor manufacturers documentation for further information
  41        about the syntax and semantics of the wide variety of information
  42        available from this instruction.
  43 





  44 EXAMPLE
  45        This example allows you to determine if the current x86 processor
  46        supports "long mode," which is a necessary (but not sufficient)
  47        condition for running the 64-bit Solaris kernel on the processor.
  48 
  49          /*
  50 
  51          #include <sys/types.h>
  52          #include <sys/stat.h>
  53          #include <fcntl.h>
  54          #include <unistd.h>
  55          #include <string.h>
  56          #include <errno.h>
  57          #include <stdio.h>
  58 
  59          static const char devname[] = "/dev/cpu/self/cpuid";
  60 
  61          /*ARGSUSED*/
  62          int
  63          main(int argc, char *argv[])




  24 
  25        The API for the character device consists of using the seek offset to
  26        set the function code value, and using a read(2) or pread(2) of 16
  27        bytes to fetch the four 32-bit return values of the instruction in the
  28        order %eax, %ebx, %ecx and %edx.
  29 
  30        No data can be written to the device. Like the cpuid instruction, no
  31        special privileges are required to use the device.
  32 
  33        The device is useful to enable low-level configuration information to
  34        be extracted from the CPU without having to write any assembler code to
  35        invoke the cpuid instruction directly. It also allows the kernel to
  36        attempt to correct any erroneous data returned by the instruction
  37        (prompted by occasional errors in the information exported by various
  38        processor implementations over the years).
  39 
  40        See the processor manufacturers documentation for further information
  41        about the syntax and semantics of the wide variety of information
  42        available from this instruction.
  43 
  44        Some systems can be configured to limit the cpuid opcodes which are
  45        accessible.  While illumos handles this condition, other software may
  46        malfunction when such limits are enabled.  Those settings are typically
  47        manipulated in the BIOS.
  48 
  49 EXAMPLE
  50        This example allows you to determine if the current x86 processor
  51        supports "long mode," which is a necessary (but not sufficient)
  52        condition for running the 64-bit Solaris kernel on the processor.
  53 
  54          /*
  55 
  56          #include <sys/types.h>
  57          #include <sys/stat.h>
  58          #include <fcntl.h>
  59          #include <unistd.h>
  60          #include <string.h>
  61          #include <errno.h>
  62          #include <stdio.h>
  63 
  64          static const char devname[] = "/dev/cpu/self/cpuid";
  65 
  66          /*ARGSUSED*/
  67          int
  68          main(int argc, char *argv[])