feat(userspace): Call/ReplyRecv IPC, malformed-request replies, servers exit on dead endpoint; drop send/receive compat, select!, async_syscall

This commit is contained in:
2026-10-27 12:06:10 +01:00
parent 2a8a5b0c27
commit e8a2963b24
18 changed files with 96 additions and 101 deletions

View File

@@ -24,9 +24,7 @@ fn request_file(shared_buf: *mut u8, filename: &[u8]) -> usize {
core::ptr::write_volatile(shared_buf.add(i), b);
}
}
syscall::send(STORAGE_EP, CMD_READ_FILE, filename.len(), 0, 0);
let (file_size, _, _, _) = syscall::receive(STORAGE_EP);
file_size
syscall::request(STORAGE_EP, [CMD_READ_FILE, filename.len(), 0, 0]).map_or(0, |r| r[0])
}
struct LoadedProcess {
@@ -137,8 +135,11 @@ pub fn run(shared_buf_va: usize) -> ! {
libkos::print!("init: loading snake... ");
if let Some(snake) = load_binary(shared_buf, b"snake.elf") {
syscall::delegate(INPUT_EP, snake.process_cap, ipc_perms);
syscall::delegate(DISPLAY_EP, snake.process_cap, ipc_perms);
// A client only calls: Execute, never Read, so it cannot pose as
// the server and take other clients' requests.
let client = PermissionSet::empty().with(Permission::Execute);
syscall::delegate(INPUT_EP, snake.process_cap, client);
syscall::delegate(DISPLAY_EP, snake.process_cap, client);
syscall::spawn_thread_in(snake.process_cap, snake.entry_point, USER_STACK_TOP);
libkos::println!("ok");
} else {