[Mammoth] Move thread syscalls to wrappers.

This commit is contained in:
Drew Galbraith 2024-07-28 19:48:05 -07:00
parent 612a5ac572
commit ca67da16e6
3 changed files with 51 additions and 46 deletions

View file

@ -3,11 +3,9 @@
extern crate alloc;
use alloc::boxed::Box;
use alloc::string::ToString;
use mammoth::debug;
use mammoth::define_entry;
use mammoth::syscall::debug;
use mammoth::thread;
use mammoth::zion::z_err_t;
use yellowstone::GetEndpointRequest;
@ -17,17 +15,7 @@ define_entry!();
#[no_mangle]
pub extern "C" fn main() -> z_err_t {
debug("Testing!");
let x = Box::new("Heap str");
debug(&x);
debug!("Formatted {}", "string");
let mut vmmo_cap: u64 = 0;
let obj_req = mammoth::zion::ZMemoryObjectCreateReq {
size: 0,
vmmo_cap: &mut vmmo_cap as *mut u64,
};
mammoth::syscall::syscall(mammoth::zion::kZionMemoryObjectCreate, &obj_req)
.expect("Failed to create memory object");
debug!("Testing!");
let mut yellowstone;
unsafe {
@ -45,7 +33,7 @@ pub extern "C" fn main() -> z_err_t {
let e: thread::ThreadEntry = |_| {
debug!("Testing 1 2 3");
};
let t = thread::Thread::spawn(&e, core::ptr::null());
let t = thread::Thread::spawn(&e, core::ptr::null()).expect("Failed to spawn thread");
t.join().expect("Failed to wait.");