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:
@@ -10,8 +10,9 @@ use libkos::syscall;
|
||||
extern "C" fn main() {
|
||||
let ep = CapSlot::const_new(0);
|
||||
|
||||
let (w0, w1, w2, w3) = syscall::receive(ep);
|
||||
syscall::send(ep, w0.wrapping_add(1), w1, w2, w3);
|
||||
if let Ok(syscall::Received::Call { words: [w0, w1, w2, w3], .. }) = syscall::receive_msg(ep) {
|
||||
let _ = syscall::reply([w0.wrapping_add(1), w1, w2, w3], None);
|
||||
}
|
||||
|
||||
syscall::exit();
|
||||
}
|
||||
|
||||
@@ -18,9 +18,7 @@ const TICK_DELAY: u64 = 5_000_000;
|
||||
const MAX_RENDER_CMDS: usize = 140;
|
||||
|
||||
fn display_send(req: &DisplayRequest) {
|
||||
let words = req.encode();
|
||||
syscall::send(DISPLAY_EP, words[0], words[1], words[2], words[3]);
|
||||
syscall::receive(DISPLAY_EP);
|
||||
let _ = syscall::request(DISPLAY_EP, req.encode());
|
||||
}
|
||||
|
||||
fn draw_rect(x: u16, y: u16, w: u16, h: u16, color: u32) {
|
||||
@@ -67,8 +65,9 @@ extern "C" fn main() {
|
||||
fn handle_input(snake: &mut Snake) {
|
||||
// Drain all pending events, apply the latest direction
|
||||
loop {
|
||||
let _ = syscall::send(INPUT_EP, 0, 0, 0, 0);
|
||||
let (tag, kind, _, _) = syscall::receive(INPUT_EP);
|
||||
let Ok([tag, kind, _, _]) = syscall::request(INPUT_EP, [0; 4]) else {
|
||||
break;
|
||||
};
|
||||
if tag == 0 { break; } // NoEvent — queue drained
|
||||
if tag == 1 {
|
||||
match kind {
|
||||
|
||||
Reference in New Issue
Block a user