From 73674bd7cac1f224413a7ee734abc7448b198303 Mon Sep 17 00:00:00 2001 From: Eemeli Date: Sun, 18 Feb 2024 22:19:38 +0200 Subject: [PATCH] WIP fork syscall --- crates/kernel/src/syscall.rs | 8 ++++++++ crates/syscall/src/lib.rs | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/crates/kernel/src/syscall.rs b/crates/kernel/src/syscall.rs index 6eac20a94..3ddf48d00 100644 --- a/crates/kernel/src/syscall.rs +++ b/crates/kernel/src/syscall.rs @@ -102,6 +102,7 @@ pub fn syscall(args: &mut SyscallRegs) { id::SEEK => call_id(seek, args), id::SYSTEM => call_id(system, args), + id::FORK => call_id(fork, args), other => { debug!("invalid syscall ({other})"); @@ -863,3 +864,10 @@ pub fn system(args: &mut SyscallRegs) -> Result { Ok(pid.num()) } + +/// fork the current process +/// +/// [`hyperion_syscall::fork`] +pub fn fork(_args: &mut SyscallRegs) -> Result { + todo!() +} diff --git a/crates/syscall/src/lib.rs b/crates/syscall/src/lib.rs index f462949dc..7210fa788 100644 --- a/crates/syscall/src/lib.rs +++ b/crates/syscall/src/lib.rs @@ -66,6 +66,7 @@ pub mod id { pub const SEEK: usize = 32; pub const SYSTEM: usize = 33; + pub const FORK: usize = 34; } // @@ -383,3 +384,8 @@ pub fn system_with(path: &str, args: &[&str], cfg: LaunchConfig) -> Result Result { + unsafe { syscall_0(id::FORK) } +}