feat: userspace program loading and task spawning
This commit is contained in:
@@ -7,15 +7,18 @@ use dusk_sys::{println, sys_exit, sys_recv, sys_send};
|
||||
pub extern "C" fn _start() -> ! {
|
||||
let msg = "Hello from client!";
|
||||
println!("[client] Sent: {}", msg);
|
||||
sys_send(0, msg.as_ptr() as usize, msg.len()).unwrap();
|
||||
// TODO: we assume the echo server is task 1 (spawned by omega3)
|
||||
sys_send(1, msg.as_ptr() as usize, msg.len()).unwrap();
|
||||
|
||||
let out = [0u8; 128];
|
||||
let out_ptr = out.as_ptr() as usize;
|
||||
let max_len = out.len();
|
||||
let (actual_len, sender) = sys_recv(out_ptr, max_len).unwrap();
|
||||
let (actual_len, _) = sys_recv(out_ptr, max_len).unwrap();
|
||||
println!(
|
||||
"[client] Received: {}",
|
||||
core::str::from_utf8(&out[..actual_len]).unwrap()
|
||||
);
|
||||
|
||||
sys_exit(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user