cpu.h 1.1 KB

123456789101112131415161718192021222324252627
  1. /* CPU feature detection for the optional fast paths.
  2. *
  3. * The kernel targets i586, so SSE/SSE2 must never be assumed: CPUID itself
  4. * may not exist (early Pentium and below), which is why the ID bit in EFLAGS
  5. * is toggled first. Detected features are cached after the first call. */
  6. #ifndef CPU_H
  7. #define CPU_H
  8. /* 1 when CPUID is available (has the ID bit in EFLAGS). */
  9. int cpu_has_cpuid(void);
  10. /* (display family << 8) | display model from CPUID leaf 1 (extended
  11. * family/model folded in the Intel way), or 0 without CPUID. Used as a
  12. * platform allowlist for probes that poke fixed MMIO addresses. */
  13. unsigned int cpu_family_model(void);
  14. /* 1 when the CPU supports SSE2 (the ION does, the Pentium targets do not). */
  15. int cpu_has_sse2(void);
  16. /* Enable CR4.OSFXSR/OSXMMEXCPT on the calling CPU when it has FXSR. The BSP
  17. * does this lazily in cpu_has_sse2(); an AP starts with firmware CR4 and must
  18. * call this before it can run the SSE2 drawing fast paths. */
  19. void cpu_enable_sse(void);
  20. /* Native x87 error reporting and a clean FPU on this CPU (BSP and APs). */
  21. void cpu_init_fpu(void);
  22. #endif