Moved process exit to syscall helper.

Final call moved so syscall is private now.

Also cleans up the macro a fair bit.
This commit is contained in:
Drew Galbraith 2024-07-28 21:01:00 -07:00
parent c2f9f5388b
commit d4f60f4942
2 changed files with 14 additions and 13 deletions

View file

@ -7,7 +7,7 @@ use core::ffi::c_void;
use core::panic::PanicInfo;
#[must_use]
pub fn syscall<T>(id: u64, req: &T) -> Result<(), ZError> {
fn syscall<T>(id: u64, req: &T) -> Result<(), ZError> {
unsafe {
let resp = zion::SysCall1(id, req as *const T as *const c_void);
if resp != 0 {
@ -40,6 +40,12 @@ pub fn debug(msg: &str) {
syscall(zion::kZionDebug, &req).expect("Failed to write");
}
pub fn process_exit(code: u64) -> ! {
let _ = syscall(zion::kZionProcessExit, &zion::ZProcessExitReq { code });
unreachable!()
}
pub fn thread_create(proc_cap: z_cap_t) -> Result<z_cap_t, ZError> {
let mut cap = 0;
syscall(