acadia/rust/usr/testbed/src/main.rs
Drew Galbraith 7e68c1b641 Add a rust user-space Capability struct.
This is a thin wrapper around a capability ptr that releases the
capability when it is done and prevents copying/cloning it.

To get a copy a caller must explicitly use duplicate.
2024-08-17 17:15:33 -07:00

39 lines
849 B
Rust

#![no_std]
#![no_main]
extern crate alloc;
use alloc::string::ToString;
use mammoth::debug;
use mammoth::define_entry;
use mammoth::thread;
use mammoth::zion::z_err_t;
use yellowstone::GetEndpointRequest;
define_entry!();
#[no_mangle]
pub extern "C" fn main() -> z_err_t {
debug!("Testing!");
let yellowstone = yellowstone::from_init_endpoint();
debug!("Get endpoint");
let endpoint = yellowstone
.get_endpoint(&GetEndpointRequest {
endpoint_name: "denali".to_string(),
})
.expect("Failed to get endpoint");
debug!("Got endpoint w/ cap: {:#x}", endpoint.endpoint);
let e: thread::ThreadEntry = |_| {
debug!("Testing 1 2 3");
};
let t = thread::Thread::spawn(e, core::ptr::null()).expect("Failed to spawn thread");
t.join().expect("Failed to wait.");
0
}