mikros: Send message to proc_man on exit

This commit is contained in:
pjht 2024-11-08 10:34:05 -06:00
parent 1b98ae3ecd
commit 7a029c4a0a
Signed by: pjht
GPG Key ID: CA239FC6934E6F3A

View File

@ -3,7 +3,8 @@
use crate::error::Error as StdError; use crate::error::Error as StdError;
use crate::ffi::{OsStr, OsString}; use crate::ffi::{OsStr, OsString};
use crate::marker::PhantomData; use crate::marker::PhantomData;
use crate::os::mikros::Errno; use crate::os::mikros::ipc::rpc;
use crate::os::mikros::{Errno, syscalls};
use crate::path::{self, PathBuf}; use crate::path::{self, PathBuf};
use crate::{fmt, io}; use crate::{fmt, io};
@ -251,7 +252,11 @@ pub fn home_dir() -> Option<PathBuf> {
None None
} }
pub fn exit(_code: i32) -> ! { pub fn exit(code: i32) -> ! {
if let Some(proc_man_pid) = syscalls::try_get_registered(3) {
rpc::send_call(proc_man_pid, 2, 4, &postcard::to_allocvec(&(code as u8)).unwrap())
.get_return();
};
unsafe { unsafe {
asm!("int 0x80", in("rax") 1); asm!("int 0x80", in("rax") 1);
}; };