forked from koniifer/ableos
X86: cpuid changes
This commit is contained in:
parent
340d76fd13
commit
c264865d49
|
@ -1,5 +1,7 @@
|
||||||
use core::{arch::asm, fmt, ops::Deref, slice, str};
|
use {
|
||||||
|
alloc::vec::Vec,
|
||||||
|
core::{arch::asm, fmt, ops::Deref, slice, str},
|
||||||
|
};
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
pub enum RequestType {
|
pub enum RequestType {
|
||||||
BasicInformation = 0x0000_0000,
|
BasicInformation = 0x0000_0000,
|
||||||
|
@ -767,6 +769,27 @@ impl Master {
|
||||||
physical_address_size: pas,
|
physical_address_size: pas,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO: Macroify this and also include all of the cpu features from self
|
||||||
|
pub fn features(&self) -> Vec<(&str, bool)> {
|
||||||
|
let mut fv = Vec::new();
|
||||||
|
let apic = self.apic();
|
||||||
|
let avx = self.avx();
|
||||||
|
let avx2 = self.avx2();
|
||||||
|
let x2 = self.x2apic();
|
||||||
|
|
||||||
|
let gb_pages = self.gigabyte_pages();
|
||||||
|
let rdseed = self.rdseed();
|
||||||
|
let rdrand = self.rdrand();
|
||||||
|
|
||||||
|
fv.push(("apic", apic));
|
||||||
|
fv.push(("avx", avx));
|
||||||
|
fv.push(("avx2", avx2));
|
||||||
|
fv.push(("gigabyte pages", gb_pages));
|
||||||
|
fv.push(("rdrand", rdrand));
|
||||||
|
fv.push(("rdseed", rdseed));
|
||||||
|
fv.push(("x2apic", x2));
|
||||||
|
fv
|
||||||
|
}
|
||||||
|
|
||||||
master_attr_reader!(version_information, VersionInformation);
|
master_attr_reader!(version_information, VersionInformation);
|
||||||
master_attr_reader!(
|
master_attr_reader!(
|
||||||
|
|
|
@ -102,6 +102,7 @@ unsafe extern "C" fn _kernel_start() -> ! {
|
||||||
|
|
||||||
let mut cpu_features = xml::XMLElement::new("CPU Features");
|
let mut cpu_features = xml::XMLElement::new("CPU Features");
|
||||||
{
|
{
|
||||||
|
cpuinfo.version_information().unwrap();
|
||||||
let apic = cpuinfo.apic();
|
let apic = cpuinfo.apic();
|
||||||
let avx = cpuinfo.avx();
|
let avx = cpuinfo.avx();
|
||||||
let avx2 = cpuinfo.avx2();
|
let avx2 = cpuinfo.avx2();
|
||||||
|
|
Loading…
Reference in a new issue