From c2dd19bc8f469bf872ff3718af74aff45212c534 Mon Sep 17 00:00:00 2001 From: pjht Date: Fri, 8 Nov 2024 14:52:24 -0600 Subject: [PATCH] mikros: Give kernel exit code instead of calling proc_man directly --- library/std/src/sys/pal/mikros/os.rs | 15 +++------------ library/std/src/sys/pal/mikros/syscalls.rs | 4 ++-- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/library/std/src/sys/pal/mikros/os.rs b/library/std/src/sys/pal/mikros/os.rs index 088cfb7b474..39fcd337da5 100644 --- a/library/std/src/sys/pal/mikros/os.rs +++ b/library/std/src/sys/pal/mikros/os.rs @@ -1,10 +1,8 @@ -use super::unsupported; -use crate::arch::asm; +use super::{syscalls, unsupported}; use crate::error::Error as StdError; use crate::ffi::{OsStr, OsString}; use crate::marker::PhantomData; -use crate::os::mikros::ipc::rpc; -use crate::os::mikros::{Errno, syscalls}; +use crate::os::mikros::Errno; use crate::path::{self, PathBuf}; use crate::{fmt, io}; @@ -253,14 +251,7 @@ pub fn home_dir() -> Option { } pub fn exit(code: i32) -> ! { - if let Some(proc_man_pid) = syscalls::try_get_registered(3) { - rpc::send_call(proc_man_pid, 8, 4, &postcard::to_allocvec(&(code as u8)).unwrap()) - .get_return(); - }; - unsafe { - asm!("int 0x80", in("rax") 1); - }; - unreachable!(); + syscalls::exit(code as u8) } pub fn getpid() -> u32 { diff --git a/library/std/src/sys/pal/mikros/syscalls.rs b/library/std/src/sys/pal/mikros/syscalls.rs index 44402276da6..a509b53d6fa 100644 --- a/library/std/src/sys/pal/mikros/syscalls.rs +++ b/library/std/src/sys/pal/mikros/syscalls.rs @@ -16,8 +16,8 @@ pub(crate) fn print_char(chr: char) { syscall1(0, chr as u64); } -pub fn exit() -> ! { - syscall0(1); +pub fn exit(code: u8) -> ! { + syscall1(1, code as u64); unreachable!(); }