feat(userspace): log server sole console holder; init boots from manifest; adapter loads only init+storage
This commit is contained in:
@@ -12,10 +12,8 @@ const USER_VA_BASE: usize = 0x10000;
|
||||
const USER_STACK_PAGES: usize = USER_VA_BASE / PAGE_SIZE - 1;
|
||||
const MAX_FILE_SIZE: usize = 64 * 1024;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct LoadedProcess {
|
||||
pub pid: ProcessId,
|
||||
pub tid: ThreadId,
|
||||
}
|
||||
|
||||
fn kern() -> &'static mut kernel::Kernel<crate::platform::RiscVPlatform> {
|
||||
@@ -50,30 +48,17 @@ pub fn load_init(uart: &Uart, blk: &mut VirtioBlk) -> LoadedProcess {
|
||||
setup_thread(tid, entry);
|
||||
uart.write_str("k-os: init loaded\n");
|
||||
|
||||
LoadedProcess { pid, tid }
|
||||
LoadedProcess { pid }
|
||||
}
|
||||
|
||||
/// The servers boot loads, their budgets carved from init's.
|
||||
pub const STORAGE: Limits = Limits {
|
||||
/// Storage's budget, carved from init's.
|
||||
const STORAGE: Limits = Limits {
|
||||
pages: 256,
|
||||
endpoints: 2,
|
||||
notifications: 2,
|
||||
// A buffer per client (8) and the disk's DMA.
|
||||
regions: 12,
|
||||
};
|
||||
/// The framebuffer alone is ~1000 pages at 1280x800.
|
||||
pub const DISPLAY: Limits = Limits {
|
||||
pages: 1280,
|
||||
endpoints: 2,
|
||||
notifications: 2,
|
||||
regions: 4,
|
||||
};
|
||||
pub const INPUT: Limits = Limits {
|
||||
pages: 64,
|
||||
endpoints: 2,
|
||||
notifications: 2,
|
||||
regions: 4,
|
||||
};
|
||||
|
||||
pub fn load_server(
|
||||
uart: &Uart,
|
||||
@@ -81,10 +66,9 @@ pub fn load_server(
|
||||
init: ProcessId,
|
||||
filename: &[u8],
|
||||
label: &str,
|
||||
limits: Limits,
|
||||
) -> LoadedProcess {
|
||||
let pid = kern()
|
||||
.create_process_internal(init, limits)
|
||||
.create_process_internal(init, STORAGE)
|
||||
.unwrap_or_else(|| crate::halt(uart, "process create failed"));
|
||||
let entry = load_elf(uart, blk, pid, filename);
|
||||
let tid = kern()
|
||||
@@ -95,7 +79,7 @@ pub fn load_server(
|
||||
uart.write_str(label);
|
||||
uart.write_str(" loaded\n");
|
||||
|
||||
LoadedProcess { pid, tid }
|
||||
LoadedProcess { pid }
|
||||
}
|
||||
|
||||
fn setup_thread(tid: ThreadId, entry: usize) {
|
||||
|
||||
Reference in New Issue
Block a user