From ddc4fbc15223e362896a9f42beca73f05f48e664 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Thu, 18 Sep 2025 13:52:58 -0400 Subject: move usermode-critical info to include/api --- include/api/error.h | 21 ++++++++++++++++++ include/api/object.h | 29 ++++++++++++++++++++++++ include/api/syscall.h | 45 ++++++++++++++++++++++++++++++++++++++ include/arch/x86_64/api/syscall.h | 16 ++++++++++++++ include/arch/x86_64/syscall.h | 16 -------------- include/error.h | 25 --------------------- include/object.h | 27 +++-------------------- include/syscall.h | 46 --------------------------------------- 8 files changed, 114 insertions(+), 111 deletions(-) create mode 100644 include/api/error.h create mode 100644 include/api/object.h create mode 100644 include/api/syscall.h create mode 100644 include/arch/x86_64/api/syscall.h delete mode 100644 include/arch/x86_64/syscall.h delete mode 100644 include/error.h delete mode 100644 include/syscall.h (limited to 'include') diff --git a/include/api/error.h b/include/api/error.h new file mode 100644 index 0000000..da8093c --- /dev/null +++ b/include/api/error.h @@ -0,0 +1,21 @@ +#ifndef _JOVE_ERROR_H +#define _JOVE_ERROR_H 1 + +enum +{ + KE_OK = 0, + KE_BADOBJ, + KE_BADFUNC, + KE_BADTYPE, + KE_BADMSG, + KE_BADCALL, + KE_FULL, + KE_TOOSMALL, + KE_OOB, + KE_DNE, + KE_ALIGN, + KE_BADSIZE, + KE_OCCUPIED +}; + +#endif diff --git a/include/api/object.h b/include/api/object.h new file mode 100644 index 0000000..58a54b9 --- /dev/null +++ b/include/api/object.h @@ -0,0 +1,29 @@ +#ifndef _JOVE_API_OBJECT_H +#define _JOVE_API_OBJECT_H 1 + +#include + +typedef uint16_t obj_type_t; + +enum +{ + /* Generic objects */ + KO_NONE = 0, + KO_OBJECT_DIRECTORY, + KO_MEMORY_UNTYPED, + KO_MEMORY_MAPPING, //4KiB aligned fixed width + KO_INITRD_FILE, + KO_TCB, + KO_MESSAGE, + /* Device objects*/ + KO_DEV_INVALID = 0x100, + KO_DEV_PROCESSOR, + KO_DEV_UART +}; + +#define KO_MESSAGE_BYTES 4096 +#define KO_MESSAGE_ALIGN 0x1000 + +#define OBJECT_DIRECTORY_MAX_ENTRIES 256 + +#endif diff --git a/include/api/syscall.h b/include/api/syscall.h new file mode 100644 index 0000000..3ce5886 --- /dev/null +++ b/include/api/syscall.h @@ -0,0 +1,45 @@ +#ifndef _JOVE_API_SYSCALL_H +#define _JOVE_API_SYSCALL_H 1 + +enum +{ + SYSCALL_NONE = 0, + SYSCALL_INVOKE, + SYSCALL_SEND, + SYSCALL_RECV, + + SYSCALL_DEBUG_PUTC +}; + +/* Generic payload of SYSCALL_INVOKE: + * [size_t n][ n bytes ][ uint8_t ][ payload ] + * target entry funcid + * */ + +/**@ENUM objdir invokes*/ +enum +{ + /*[target path][u8 funcid][u8 memb]*/ + INVOKE_OBJDIR_GETMEMB, + /*[target path][u8 funcid]*/ + INVOKE_OBJDIR_LASTMEMB, + /*[target path][u8 funcid][u8 memb]*/ + INVOKE_OBJDIR_MOVE +}; +/**@ENUM untyped invokes*/ +enum +{ + /*[target path][u8 funcid][size_t ret]*/ + INVOKE_UNTYPED_SIZE = 0, + /*[target path][u8 funcid][dest path][dest bytes]*/ + INVOKE_UNTYPED_SPLIT, + /*[first path][u8 funcid][second path]*/ + INVOKE_UNTYPED_MERGE, + /*[target path][u8 funcid][size_t ret]*/ + INVOKE_UNTYPED_ALIGNMENT, + /*[target path][u8 funcid][u16 type]*/ + INVOKE_UNTYPED_RETYPE, +}; + + +#endif diff --git a/include/arch/x86_64/api/syscall.h b/include/arch/x86_64/api/syscall.h new file mode 100644 index 0000000..e470537 --- /dev/null +++ b/include/arch/x86_64/api/syscall.h @@ -0,0 +1,16 @@ +#ifndef _JOVE_ARCH_x86_64_SYSCALL_H +#define _JOVE_ARCH_x86_64_SYSCALL_H 1 + +/**@ENUM mapping invokes*/ +enum +{ + /*[target path][u8 funcid][u8 depth][u16*depth pmli]*/ + INVOKE_MAPPING_EXISTS = 0, + /*[target path][u8 funcid][u8 depth][u16*depth pmli][untyped path][u64 flags]*/ + INVOKE_MAPPING_MAP, + /*[target path][u8 funcid][u8 depth][u16*depth pmli][dest path]*/ + INVOKE_MAPPING_UNMAP +}; + + +#endif diff --git a/include/arch/x86_64/syscall.h b/include/arch/x86_64/syscall.h deleted file mode 100644 index e470537..0000000 --- a/include/arch/x86_64/syscall.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _JOVE_ARCH_x86_64_SYSCALL_H -#define _JOVE_ARCH_x86_64_SYSCALL_H 1 - -/**@ENUM mapping invokes*/ -enum -{ - /*[target path][u8 funcid][u8 depth][u16*depth pmli]*/ - INVOKE_MAPPING_EXISTS = 0, - /*[target path][u8 funcid][u8 depth][u16*depth pmli][untyped path][u64 flags]*/ - INVOKE_MAPPING_MAP, - /*[target path][u8 funcid][u8 depth][u16*depth pmli][dest path]*/ - INVOKE_MAPPING_UNMAP -}; - - -#endif diff --git a/include/error.h b/include/error.h deleted file mode 100644 index 40a39e2..0000000 --- a/include/error.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _JOVE_ERROR_H -#define _JOVE_ERROR_H 1 - -#define E_OK 0 -#define E_BADOBJ 1 -#define E_ARGUMENT 2 - -enum -{ - KE_OK = 0, - KE_BADOBJ, - KE_BADFUNC, - KE_BADTYPE, - KE_BADMSG, - KE_BADCALL, - KE_FULL, - KE_TOOSMALL, - KE_OOB, - KE_DNE, - KE_ALIGN, - KE_BADSIZE, - KE_OCCUPIED -}; - -#endif diff --git a/include/object.h b/include/object.h index 4cf5159..255cf98 100644 --- a/include/object.h +++ b/include/object.h @@ -3,30 +3,9 @@ #include #include - -enum -{ - /* Generic objects */ - KO_NONE = 0, - KO_OBJECT_DIRECTORY, - KO_MEMORY_UNTYPED, - KO_MEMORY_MAPPING, //4KiB aligned fixed width - KO_INITRD_FILE, - KO_TCB, - KO_MESSAGE, - /* Device objects*/ - KO_DEV_INVALID = 0x100, - KO_DEV_PROCESSOR, - KO_DEV_UART -}; - -#define KO_MESSAGE_BYTES 4096 -#define KO_MESSAGE_ALIGN 0x1000 - -#define KODE_EX_MESSAGE_MAPPED 0b1 +#include "api/object.h" typedef uint8_t path_byte_t; -typedef uint16_t obj_type_t; typedef struct jove_ObjectDirectoryEntry { @@ -41,8 +20,6 @@ typedef struct jove_ObjectDirectoryEntry uintmax_t data; } objdir_entry_t; -#define OBJECT_DIRECTORY_MAX_ENTRIES 256 - typedef struct jove_ObjectDirectory { union { @@ -51,6 +28,8 @@ typedef struct jove_ObjectDirectory }; } objdir_t; +#define KODE_EX_MESSAGE_MAPPED 0b1 + objdir_entry_t *objdir_seek(objdir_t *dir, uint8_t *path, unsigned long pathw); unsigned long objdir_pathw(objdir_t *dir, uint8_t *path); diff --git a/include/syscall.h b/include/syscall.h deleted file mode 100644 index e04ff85..0000000 --- a/include/syscall.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _JOVE_SYSCALL_H -#define _JOVE_SYSCALL_H 1 - -#include - -enum -{ - SYSCALL_NONE = 0, - SYSCALL_INVOKE, - SYSCALL_SEND, - SYSCALL_RECV, - - SYSCALL_DEBUG_PUTC -}; - -/* Generic payload of SYSCALL_INVOKE: - * [ n bytes ][ uint8_t ][ payload ] - * target entry funcid - * */ - -/**@ENUM objdir invokes*/ -enum -{ - /*[target path][u8 funcid][u8 memb][u16 ret]*/ - INVOKE_OBJDIR_GETMEMB, - /*[target path][u8 funcid][u8 ret]*/ - INVOKE_OBJDIR_LASTMEMB, - /*[target path][u8 funcid][u8 memb][dest path]*/ - INVOKE_OBJDIR_MOVE -}; -/**@ENUM untyped invokes*/ -enum -{ - /*[target path][u8 funcid][size_t ret]*/ - INVOKE_UNTYPED_SIZE = 0, - /*[target path][u8 funcid][dest path][dest bytes]*/ - INVOKE_UNTYPED_SPLIT, - /*[first path][u8 funcid][second path]*/ - INVOKE_UNTYPED_MERGE, - /*[target path][u8 funcid][size_t ret]*/ - INVOKE_UNTYPED_ALIGNMENT, - /*[target path][u8 funcid][u16 type]*/ - INVOKE_UNTYPED_RETYPE, -}; - -#endif -- cgit v1.2.1