add rsdp addr

This commit is contained in:
mii443
2025-07-04 20:14:43 +09:00
parent 34c3d0f89b
commit 539d784bed
4 changed files with 32 additions and 0 deletions

View File

@ -126,6 +126,15 @@ fn get_frame_buffer() -> gop::FrameBuffer {
}
}
fn get_rsdp() -> u64 {
uefi::system::with_config_table(move |c| {
c.iter()
.find(|config| config.guid == uefi::table::cfg::ACPI_GUID)
.map(|config| config.address as u64)
.expect("Failed to find RSDP in config table")
})
}
#[entry]
fn main() -> Status {
uefi::helpers::init().unwrap();
@ -145,6 +154,8 @@ fn main() -> Status {
let frame_buffer = get_frame_buffer();
let rsdp = get_rsdp();
let size = uefi::boot::memory_map(MemoryType::LOADER_DATA)
.unwrap()
.len()
@ -183,6 +194,7 @@ fn main() -> Status {
entry(&nel_os_common::BootInfo {
usable_memory,
frame_buffer,
rsdp,
});
hlt_loop();

View File

@ -8,4 +8,5 @@ pub mod memory;
pub struct BootInfo {
pub usable_memory: UsableMemory,
pub frame_buffer: FrameBuffer,
pub rsdp: u64,
}

View File

@ -22,6 +22,17 @@ dependencies = [
"libm",
]
[[package]]
name = "acpi"
version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94476c7ef97af4c4d998b3f422c1b01d5211aad57c80ed200baf148d1f1efab6"
dependencies = [
"bit_field",
"bitflags 2.9.1",
"log",
]
[[package]]
name = "autocfg"
version = "1.5.0"
@ -89,6 +100,12 @@ dependencies = [
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "nel_os_common"
version = "0.1.0"
@ -98,6 +115,7 @@ name = "nel_os_kernel"
version = "0.1.0"
dependencies = [
"ab_glyph",
"acpi",
"lazy_static",
"linked_list_allocator",
"nel_os_common",

View File

@ -12,3 +12,4 @@ nel_os_common = { path = "../nel_os_common" }
linked_list_allocator = "0.9.1"
ab_glyph = { version = "0.2", features = ["libm"], default-features = false }
raw-cpuid = "11.5.0"
acpi = "5.2.0"