1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use crate::structures::smpinfo::SMPInfo;
#[repr(C)]
#[derive(Debug)]
pub struct SMPResponse {
pub revision: u64,
pub flags: u32,
pub bsp_lapic_id: u32,
pub cpu_count: u64,
pub cpus: *const *const SMPInfo,
}
impl SMPResponse {
pub unsafe fn get_cpu_info(&self) -> Option<&[&SMPInfo]> {
if self.cpus.is_null() {
return None;
}
Some(core::slice::from_raw_parts(
self.cpus as *const &SMPInfo,
self.cpu_count as usize,
))
}
}