Skip to content

Commit 68a123e

Browse files
Pass the UEFI runtime services table address to the BootInfo if running on UEFI
1 parent 299a670 commit 68a123e

File tree

4 files changed

+59
-4
lines changed

4 files changed

+59
-4
lines changed

Cargo.lock

Lines changed: 46 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bios/stage-4/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ pub extern "C" fn _start(info: &mut BiosInfo) -> ! {
164164
_ => Some(info.ramdisk.start),
165165
},
166166
ramdisk_len: info.ramdisk.len,
167+
rt_table_addr: None,
167168
};
168169

169170
load_and_switch_to_kernel(kernel, config, frame_allocator, page_tables, system_info);

common/src/lib.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use crate::legacy_memory_region::{LegacyFrameAllocator, LegacyMemoryRegion};
66
use bootloader_api::{
77
config::Mapping,
8-
info::{FrameBuffer, FrameBufferInfo, MemoryRegion, TlsTemplate},
8+
info::{FrameBuffer, FrameBufferInfo, MemoryRegion, TlsTemplate, Optional},
99
BootInfo, BootloaderConfig,
1010
};
1111
use bootloader_boot_config::{BootConfig, LevelFilter};
@@ -72,14 +72,18 @@ fn convert_level(level: LevelFilter) -> log::LevelFilter {
7272
}
7373

7474
/// Required system information that should be queried from the BIOS or UEFI firmware.
75-
#[derive(Debug, Copy, Clone)]
75+
#[derive(Debug)]
7676
pub struct SystemInfo {
7777
/// Information about the (still unmapped) framebuffer.
7878
pub framebuffer: Option<RawFrameBufferInfo>,
7979
/// Address of the _Root System Description Pointer_ structure of the ACPI standard.
8080
pub rsdp_addr: Option<PhysAddr>,
8181
pub ramdisk_addr: Option<u64>,
8282
pub ramdisk_len: u64,
83+
84+
/// UEFI runtime table address (on a UEFI system)
85+
// #[cfg(target_os = "uefi")]
86+
pub rt_table_addr: Option<u64>,
8387
}
8488

8589
/// The physical address of the framebuffer and information about the framebuffer.
@@ -551,6 +555,11 @@ where
551555
info.kernel_len = mappings.kernel_slice_len as _;
552556
info.kernel_image_offset = mappings.kernel_image_offset.as_u64();
553557
info._test_sentinel = boot_config._test_sentinel;
558+
info.rt_table_addr = if let Some(addr) = system_info.rt_table_addr {
559+
Optional::Some(addr)
560+
} else {
561+
Optional::None
562+
};
554563
info
555564
});
556565

uefi/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ fn main_inner(image: Handle, mut st: SystemTable<Boot>) -> Status {
166166
},
167167
ramdisk_addr,
168168
ramdisk_len,
169+
rt_table_addr: Some(system_table.get_current_system_table_addr()),
169170
};
170171

171172
bootloader_x86_64_common::load_and_switch_to_kernel(

0 commit comments

Comments
 (0)