mikros: Give kernel exit code instead of calling proc_man directly
This commit is contained in:
parent
201eaf576a
commit
c2dd19bc8f
@ -1,10 +1,8 @@
|
|||||||
use super::unsupported;
|
use super::{syscalls, unsupported};
|
||||||
use crate::arch::asm;
|
|
||||||
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::ipc::rpc;
|
use crate::os::mikros::Errno;
|
||||||
use crate::os::mikros::{Errno, syscalls};
|
|
||||||
use crate::path::{self, PathBuf};
|
use crate::path::{self, PathBuf};
|
||||||
use crate::{fmt, io};
|
use crate::{fmt, io};
|
||||||
|
|
||||||
@ -253,14 +251,7 @@ pub fn home_dir() -> Option<PathBuf> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn exit(code: i32) -> ! {
|
pub fn exit(code: i32) -> ! {
|
||||||
if let Some(proc_man_pid) = syscalls::try_get_registered(3) {
|
syscalls::exit(code as u8)
|
||||||
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!();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getpid() -> u32 {
|
pub fn getpid() -> u32 {
|
||||||
|
@ -16,8 +16,8 @@ pub(crate) fn print_char(chr: char) {
|
|||||||
syscall1(0, chr as u64);
|
syscall1(0, chr as u64);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn exit() -> ! {
|
pub fn exit(code: u8) -> ! {
|
||||||
syscall0(1);
|
syscall1(1, code as u64);
|
||||||
unreachable!();
|
unreachable!();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user