forked from AbleOS/ableos
CPU: Added more cpu feature detection
This commit is contained in:
parent
b9bfd99335
commit
bb3c1b6120
|
@ -78,11 +78,17 @@ unsafe extern "C" fn _kernel_start() -> ! {
|
||||||
let mut cpu = XMLElement::new("cpu");
|
let mut cpu = XMLElement::new("cpu");
|
||||||
let core_count = smp.cpu_count.to_string();
|
let core_count = smp.cpu_count.to_string();
|
||||||
cpu.set_attribute("core count", core_count);
|
cpu.set_attribute("core count", core_count);
|
||||||
|
for x in 0..smp.cpu_count {
|
||||||
|
let core_name = alloc::format!("core_{}", x);
|
||||||
|
let core = XMLElement::new(core_name);
|
||||||
|
cpu.set_child(core);
|
||||||
|
}
|
||||||
|
|
||||||
cpu.set_attribute("brand string", brand_string);
|
cpu.set_attribute("brand string", brand_string);
|
||||||
|
|
||||||
let _cpu_speed = 0;
|
let _cpu_speed = 0;
|
||||||
|
|
||||||
cpu.set_attribute("speed", "Unknown");
|
cpu.set_attribute("speed", "unknown");
|
||||||
|
|
||||||
if false {
|
if false {
|
||||||
// disable() // disable interrupts (if still not done)
|
// disable() // disable interrupts (if still not done)
|
||||||
|
@ -96,14 +102,29 @@ unsafe extern "C" fn _kernel_start() -> ! {
|
||||||
|
|
||||||
let mut cpu_features = xml::XMLElement::new("CPU Features");
|
let mut cpu_features = xml::XMLElement::new("CPU Features");
|
||||||
{
|
{
|
||||||
let x2 = cpuinfo.x2apic();
|
|
||||||
let apic = cpuinfo.apic();
|
let apic = cpuinfo.apic();
|
||||||
let _avx = cpuinfo.avx();
|
let avx = cpuinfo.avx();
|
||||||
|
let avx2 = cpuinfo.avx2();
|
||||||
|
let x2 = cpuinfo.x2apic();
|
||||||
|
|
||||||
|
let gb_pages = cpuinfo.gigabyte_pages();
|
||||||
|
let rdseed = cpuinfo.rdseed();
|
||||||
|
let rdrand = cpuinfo.rdrand();
|
||||||
|
|
||||||
cpu_features.set_attribute("apic", apic.to_string());
|
cpu_features.set_attribute("apic", apic.to_string());
|
||||||
cpu_features.set_attribute("avx", apic.to_string());
|
cpu_features.set_attribute("avx", avx.to_string());
|
||||||
|
cpu_features.set_attribute("avx2", avx2.to_string());
|
||||||
|
cpu_features.set_attribute("gigabyte pages", gb_pages.to_string());
|
||||||
|
cpu_features.set_attribute("rdrand", rdrand.to_string());
|
||||||
|
cpu_features.set_attribute("rdseed", rdseed.to_string());
|
||||||
cpu_features.set_attribute("x2apic", x2.to_string());
|
cpu_features.set_attribute("x2apic", x2.to_string());
|
||||||
}
|
}
|
||||||
|
if cpuinfo.digital_temperature_sensor() {
|
||||||
|
let mut temperature_child = XMLElement::new("Temperature");
|
||||||
|
|
||||||
|
temperature_child.set_attribute("degrees", "Unknown");
|
||||||
|
cpu.set_child(temperature_child);
|
||||||
|
}
|
||||||
|
|
||||||
cpu.set_child(cpu_features);
|
cpu.set_child(cpu_features);
|
||||||
cpus.push(cpu);
|
cpus.push(cpu);
|
||||||
|
@ -156,6 +177,7 @@ unsafe extern "C" fn _kernel_start() -> ! {
|
||||||
dis.swap_buffers();
|
dis.swap_buffers();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: Add in rdseed and rdrand as sources for randomness
|
||||||
let _rand = xml::XMLElement::new("Random");
|
let _rand = xml::XMLElement::new("Random");
|
||||||
|
|
||||||
crate::kmain::kmain(
|
crate::kmain::kmain(
|
||||||
|
|
Loading…
Reference in a new issue