From 548506392b789f58b1556a6ffca917441e1d89fd Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Tue, 13 Oct 2026 22:31:43 -0400 Subject: ipc functions. work on process spawning --- api/obj.h | 9 +++++---- api/process.h | 6 ++++++ api/syscall.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 59 insertions(+), 7 deletions(-) (limited to 'api') diff --git a/api/obj.h b/api/obj.h index 29238c1..2ac0b51 100644 --- a/api/obj.h +++ b/api/obj.h @@ -1,9 +1,8 @@ #ifndef _JOVE_API_OBJ_H #define _JOVE_API_OBJ_H 1 -#include - typedef unsigned char objtype_t; +typedef unsigned short objpath_part_t; enum { @@ -33,8 +32,10 @@ enum #define JOVE_PERM_ALL 7 -#define OBJDIR_NUM_ENTRIES (0x1000 / sizeof(uintmax_t)) +#define OBJDIR_SIZE 0x1000 +#define OBJDIR_ENTRIES (OBJDIR_SIZE / sizeof(uintmax_t)) -typedef uint16_t objpath_part_t; +#define MESSAGE_ALIGN 0x1000 +#define MESSAGE_SIZE 0x1000 #endif diff --git a/api/process.h b/api/process.h index 5ccf69d..05b7632 100644 --- a/api/process.h +++ b/api/process.h @@ -23,4 +23,10 @@ enum pcb_rootdir_entries PCB_ROOTDIR_PAGEDIR_I, }; +enum pcb_stack_type +{ + PCB_STACK_SYSTEM = 0, + PCB_STACK_INTERRUPT +}; + #endif diff --git a/api/syscall.h b/api/syscall.h index 54ff267..40fedd4 100644 --- a/api/syscall.h +++ b/api/syscall.h @@ -74,9 +74,31 @@ enum { _SYSCALL_OBJDIR_BADCALL = 0, SYSCALL_OBJDIR_OBJTYPE, + SYSCALL_OBJDIR_SWAP, + SYSCALL_OBJDIR_LINK, + SYSCALL_OBJDIR_ISLINK }; -#define SYSCALL_PERM_OBJDIR_OBJTYPE JOVE_PERM_READ +#define SYSCALL_PERM_OBJDIR_OBJTYPE (JOVE_PERM_READ) +#define SYSCALL_PERM_OBJDIR_SWAP (JOVE_PERM_WRITE) +#define SYSCALL_PERM_OBJDIR_LINK (JOVE_PERM_WRITE) + +#define SYSCALL_PERM_OBJDIR_SWAP_TGT (JOVE_PERM_WRITE) +#define SYSCALL_PERM_OBJDIR_LINK_TGT (JOVE_PERM_WRITE | JOVE_PERM_MUTATE) + +struct syscall_objdir_swap +{ + objpath_part_t index; + objpath_part_t other_path_length; + objpath_part_t other_path[]; +}; + +struct syscall_objdir_link +{ + objpath_part_t index; + objpath_part_t other_path_length; + objpath_part_t other_path[]; +}; /* JOVE_OBJ_PAGEDIR syscalls * */ @@ -183,17 +205,23 @@ enum SYSCALL_PCB_YIELD, SYSCALL_PCB_SEND, SYSCALL_PCB_RECV, + SYSCALL_PCB_SWAP, + SYSCALL_PCB_STACK, SYSCALL_PCB_READY, }; #define SYSCALL_PERM_PCB_PID (JOVE_PERM_READ) #define SYSCALL_PERM_PCB_YIELD (JOVE_PERM_WRITE) #define SYSCALL_PERM_PCB_SEND (JOVE_PERM_WRITE) -#define SYSCALL_PERM_PCB_RECV (JOVE_PERM_WRITE) -#define SYSCALL_PERM_PCB_READY (JOVE_PERM_WRITE | JOVE_PERM_MUTATE) +#define SYSCALL_PERM_PCB_RECV (JOVE_PERM_READ | JOVE_PERM_WRITE) +#define SYSCALL_PERM_PCB_SWAP (SYSCALL_PERM_PCB_SEND | SYSCALL_PERM_PCB_RECV) +#define SYSCALL_PERM_PCB_STACK (JOVE_PERM_WRITE | JOVE_PERM_MUTATE) +#define SYSCALL_PERM_PCB_READY (JOVE_PERM_ALL) #define SYSCALL_PERM_PCB_SEND_OBJDIR (JOVE_PERM_WRITE) #define SYSCALL_PERM_PCB_RECV_DST (JOVE_PERM_MUTATE) +#define SYSCALL_PERM_PCB_SWAP_OBJ (JOVE_PERM_MUTATE) +#define SYSCALL_PERM_PCB_STACK_OBJ (JOVE_PERM_WRITE | JOVE_PERM_MUTATE) struct syscall_pcb_yield { @@ -216,6 +244,23 @@ struct syscall_pcb_recv objpath_part_t recv_path[]; }; +struct syscall_pcb_swap +{ + pid_t swap_target; + uintmax_t send_timeout; + uintmax_t recv_timeout; + + objpath_part_t swap_path_length; + objpath_part_t swap_path[]; +}; + +struct syscall_pcb_stack +{ + char type; + objpath_part_t stack_path_length; + objpath_part_t stack_path[]; +}; + /**JOVE_OBJ_INITRD_FILE syscalls * */ -- cgit v1.2.3