minix/lib/i386/misc/_cpufeature.c
Tomas Hruby 8a44a44cb9 Local APIC
- local APIC timer used as the source of time

- PIC is still used as the hw interrupt controller as we don't have
  enough info without ACPI or MPS to set up IO APICs

- remapping of APIC when switching paging on, uses the new mechanism
  to tell VM what phys areas to map in kernel's virtual space

- one more step to SMP

based on code by Arun C.
2009-11-16 21:41:44 +00:00

38 lines
819 B
C

#include <stdint.h>
#include <minix/minlib.h>
#include <minix/cpufeature.h>
#include <sys/vm_i386.h>
int _cpufeature(int cpufeature)
{
u32_t cpuid_feature_edx = 0;
int proc;
proc = getprocessor();
/* If processor supports CPUID and its CPUID supports enough
* parameters, retrieve EDX feature flags to test against.
*/
if(proc >= 586) {
u32_t params, a, b, c, d;
_cpuid(0, &params, &b, &c, &d);
if(params > 0) {
_cpuid(1, &a, &b, &c, &cpuid_feature_edx);
}
}
switch(cpufeature) {
case _CPUF_I386_PSE:
return cpuid_feature_edx & CPUID1_EDX_PSE;
case _CPUF_I386_PGE:
return cpuid_feature_edx & CPUID1_EDX_PGE;
case _CPUF_I386_APIC_ON_CHIP:
return cpuid_feature_edx & CPUID1_EDX_APIC_ON_CHIP;
case _CPUF_I386_TSC:
return cpuid_feature_edx & CPUID1_EDX_TSC;
}
return 0;
}