feat: devices via caps (BootInfo, init assigns devices, drivers map MMIO/DMA themselves, IRQ-driven input); drop boot device wiring and info pages; headless display fallback
This commit is contained in:
@@ -107,6 +107,7 @@ boot_page_table:
|
||||
);
|
||||
|
||||
const SHARED_BUF_VA: usize = 0x30000;
|
||||
const SHARED_BUF_PAGES: usize = 16;
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn kmain(hart: usize) -> ! {
|
||||
@@ -127,20 +128,33 @@ extern "C" fn kmain(hart: usize) -> ! {
|
||||
let storage = boot::loader::load_server(&uart, &mut blk, b"storage.elf", "storage");
|
||||
let display = boot::loader::load_server(&uart, &mut blk, b"display.elf", "display");
|
||||
let input = boot::loader::load_server(&uart, &mut blk, b"input.elf", "input");
|
||||
let virtio_base = blk.base();
|
||||
|
||||
let board = board::devices().unwrap_or_else(|| halt(&uart, "bad board table"));
|
||||
kern_mut()
|
||||
.register_board(init.pid, &board)
|
||||
.unwrap_or_else(|_| halt(&uart, "board registration failed"));
|
||||
devices::storage_setup::configure(&uart, init.pid, storage.pid, virtio_base);
|
||||
devices::gpu_setup::configure(&uart, display.pid);
|
||||
devices::input_setup::configure(&uart, input.pid);
|
||||
devices::shared_buffer(
|
||||
&uart,
|
||||
init.pid,
|
||||
storage.pid,
|
||||
SHARED_BUF_VA,
|
||||
SHARED_BUF_PAGES,
|
||||
);
|
||||
devices::display_quota(&uart, display.pid);
|
||||
boot::caps::grant_all(&uart, init.pid, storage.pid, display.pid, input.pid);
|
||||
// After grant_all, so the slots init already relies on stay put.
|
||||
kern_mut()
|
||||
.grant_boot_authority(init.pid, &board)
|
||||
let mut placed = [None; board::BOARD_DEVICES];
|
||||
let system_control = kern_mut()
|
||||
.grant_boot_authority(init.pid, &board, &mut placed)
|
||||
.unwrap_or_else(|_| halt(&uart, "boot authority failed"));
|
||||
devices::boot_info(
|
||||
&uart,
|
||||
init.pid,
|
||||
&board,
|
||||
&board::kinds(),
|
||||
&placed,
|
||||
system_control,
|
||||
);
|
||||
|
||||
start_other_harts(&uart, hart);
|
||||
uart.write_str("k-os: entering userspace\n");
|
||||
|
||||
Reference in New Issue
Block a user