- Halt syscall: only pid 0 (init) can halt, adapter uses SBI SRST - Fault notification: kernel delivers fault info to process fault handler endpoint before killing - Supervisor: tracks restart counts, back-off up to 5 restarts - Shutdown: notifies servers, waits with timeout, calls halt - Trap handler: faults now call kernel.handle_fault instead of halting
62 lines
1.3 KiB
Rust
62 lines
1.3 KiB
Rust
use crate::arch;
|
|
use types::syscall_abi::*;
|
|
|
|
pub fn exit() -> ! {
|
|
arch::syscall0(SYS_EXIT);
|
|
loop {}
|
|
}
|
|
|
|
pub fn exit_thread() -> ! {
|
|
arch::syscall0(SYS_EXIT_THREAD);
|
|
loop {}
|
|
}
|
|
|
|
pub fn yield_now() {
|
|
arch::syscall0(SYS_YIELD);
|
|
}
|
|
|
|
pub fn get_time() -> usize {
|
|
arch::syscall0(SYS_GET_TIME)
|
|
}
|
|
|
|
pub fn get_process_id() -> usize {
|
|
arch::syscall0(SYS_GET_PROCESS_ID)
|
|
}
|
|
|
|
pub fn spawn_thread(entry: usize, stack: usize) -> usize {
|
|
arch::syscall2(SYS_SPAWN_THREAD, entry, stack)
|
|
}
|
|
|
|
pub fn request_pages(count: usize) -> usize {
|
|
arch::syscall1(SYS_REQUEST_PAGES, count)
|
|
}
|
|
|
|
pub fn create_process(create_cap: usize) -> usize {
|
|
arch::syscall1(SYS_CREATE_PROCESS, create_cap)
|
|
}
|
|
|
|
pub fn kill(process_cap: usize) -> usize {
|
|
arch::syscall1(SYS_KILL, process_cap)
|
|
}
|
|
|
|
pub fn delegate(slot: usize, to: usize, permissions: usize) -> usize {
|
|
arch::syscall2(SYS_DELEGATE, slot, to)
|
|
}
|
|
|
|
pub fn revoke(slot: usize) -> usize {
|
|
arch::syscall1(SYS_REVOKE, slot)
|
|
}
|
|
|
|
pub fn halt() -> ! {
|
|
arch::syscall0(SYS_HALT);
|
|
loop {}
|
|
}
|
|
|
|
pub fn send(endpoint: usize, w0: usize, w1: usize, w2: usize, w3: usize) -> usize {
|
|
arch::syscall5(SYS_SEND, endpoint, w0, w1, w2, w3)
|
|
}
|
|
|
|
pub fn receive(endpoint: usize) -> (usize, usize, usize, usize) {
|
|
arch::syscall_receive(SYS_RECEIVE, endpoint)
|
|
}
|