summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2026-09-26 17:11:50 -0400
committerJon Santmyer <jon@jonsantmyer.com>2026-09-26 17:11:50 -0400
commit5f813d49a08cf3c3f8cf6c422cfb6587df575f62 (patch)
treebd8872ee24580614b3eb845e1de26d465b025a09 /api
parentb6765812f7da9feccc271e8e0b06f166e8054386 (diff)
downloadjove-kernel-5f813d49a08cf3c3f8cf6c422cfb6587df575f62.tar.gz
jove-kernel-5f813d49a08cf3c3f8cf6c422cfb6587df575f62.tar.bz2
jove-kernel-5f813d49a08cf3c3f8cf6c422cfb6587df575f62.zip
add docs for syscalls. make syscall code kind-of cleaner
Diffstat (limited to 'api')
-rw-r--r--api/error.h3
-rw-r--r--api/init.h19
-rw-r--r--api/obj.h14
-rw-r--r--api/syscall.h129
4 files changed, 80 insertions, 85 deletions
diff --git a/api/error.h b/api/error.h
index 5e0e936..de7d4b2 100644
--- a/api/error.h
+++ b/api/error.h
@@ -15,5 +15,8 @@
#define EBUSY 12
#define EEMPTY 13
#define EFULL 14
+#define EOVERFLOW 15
+#define EBADCALL 16
+#define EPERM 17
#endif
diff --git a/api/init.h b/api/init.h
index 73b19e4..e92c910 100644
--- a/api/init.h
+++ b/api/init.h
@@ -4,26 +4,33 @@
#include <stdint.h>
enum {
- ROOTDIR_DIR_I = 0,
+ ROOTDIR_NULL_I = 0,
+ ROOTDIR_DIR_I,
ROOTDIR_PROCESSORS_I,
ROOTDIR_PAGEDIR_I,
ROOTDIR_UNTYPED_I,
ROOTDIR_HWMEMORY_I,
ROOTDIR_PCB_I,
- ROOTDIR_IOPB_I,
ROOTDIR_INTERRUPTS_I,
ROOTDIR_INITRD_I,
ROOTDIR_MESSAGE_I,
+ ROOTDIR_FRAMEBUFFER_I,
+ ROOTDIR_VIRTTERM_I,
+ _ROOTDIR_LAST_I
};
+#ifdef __x86_64__
+enum {
+ ROOTDIR_IOPB_I = _ROOTDIR_LAST_I,
+ ROOTDIR_SERIAL_COM_I,
+ _ROOTDIR_LAST_ARCH_I
+};
+#endif
+
struct init_payload
{
void *rsdp;
uintptr_t brk;
};
-#define ROOTDIR_SERIAL_COM_I 0x80
-#define ROOTDIR_FRAMEBUFFER_I 0x81
-#define ROOTDIR_VIRTTERM_I 0x82
-
#endif
diff --git a/api/obj.h b/api/obj.h
index 04513c1..6e9ddc6 100644
--- a/api/obj.h
+++ b/api/obj.h
@@ -10,9 +10,9 @@ enum
JOVE_OBJ_OBJDIR,
JOVE_OBJ_PAGEDIR,
JOVE_OBJ_PROCESSOR,
- JOVE_OBJ_HWMEMORY,
+ JOVE_OBJ_SHMEMORY,
JOVE_OBJ_INT_HANDLE,
- JOVE_OBJ_PROCESS,
+ JOVE_OBJ_PCB,
JOVE_OBJ_INITRD_FILE,
JOVE_OBJ_FRAMEBUFFER,
JOVE_OBJ_VIRTTERM,
@@ -20,6 +20,16 @@ enum
JOVE_OBJ_LINK,
};
+
+/*Link can read object states and map page frames as read only*/
+#define JOVE_PERM_READ 1
+/*Link can write object states and map page frames as writeable*/
+#define JOVE_PERM_WRITE 2
+/*Link can untype linked objects, split untyped memory, and retype untyped linked object.*/
+#define JOVE_PERM_MUTATE 4
+
+#define JOVE_PERM_ALL 7
+
#define OBJDIR_NUM_ENTRIES (0x1000 / sizeof(uintmax_t))
typedef uint16_t objpath_part_t;
diff --git a/api/syscall.h b/api/syscall.h
index 4bb2eb2..1cdc941 100644
--- a/api/syscall.h
+++ b/api/syscall.h
@@ -38,35 +38,21 @@ struct syscall_generic_objpath
objpath_part_t path[];
};
-/* The kernel will return the physical memory address of this untyped object. */
-#define SYSCALL_UNTYPED_ADDRESS 0
-/* The kernel will return the size of this untyped object. */
-#define SYSCALL_UNTYPED_SIZE 1
-
-/* If newtype is not a valid JOVE object, the kernel will return EBADARG.
- * If the untyped object is too small for this object, the kernel will return ETOOSMALL.
- * If the untyped object is too big for this object, the kernel will return ETOOBIG.
- * New objects will be initialized with default values.
- * */
-#define SYSCALL_UNTYPED_RETYPE 2
-struct syscall_untyped_retype
+enum
{
- uint16_t newtype;
+ _SYSCALL_UNTYPED_BADCALL = 0,
+ SYSCALL_UNTYPED_ADDRESS,
+ SYSCALL_UNTYPED_SIZE,
+ SYSCALL_UNTYPED_SPLIT,
+ SYSCALL_UNTYPED_MERGE,
+ SYSCALL_UNTYPED_RETYPE,
};
-/* Splits the tail of the untyped object into another untyped object with [bytes] length.
- * If bytes is less than JOVE_UNTYPED_MINSIZE, the kernel will return ETOOSMALL.
- * If the syscall message is too small for dest_path, the kernel will return ETOOSMALL.
- * If dest_path does not target a JOVE_OBJ_NONE object, the kernel will return EBADOBJ.
- * Destination path will be occupied by the untyped object created by the split.
- * */
-#define SYSCALL_UNTYPED_SPLIT 3
-/* Follows rules declared above syscall_generic_objpath.
- * If dest_path does not target a JOVE_OBJ_UNTYPED object, the kernel will return EBADPATH.
- * If the dest untyped object is not adjacent to the target object, the kernel will return EBADOBJ.
- * Destination path will be set to JOVE_OBJ_NONE and target untyped will grow to include the object.
- * */
-#define SYSCALL_UNTYPED_MERGE 4
+#define SYSCALL_PERM_UNTYPED_ADDRESS JOVE_PERM_READ
+#define SYSCALL_PERM_UNTYPED_SIZE JOVE_PERM_READ
+#define SYSCALL_PERM_UNTYPED_SPLIT (JOVE_PERM_WRITE | JOVE_PERM_MUTATE)
+#define SYSCALL_PERM_UNTYPED_MERGE (JOVE_PERM_WRITE | JOVE_PERM_MUTATE)
+
struct syscall_untyped_split
{
size_t bytes;
@@ -74,71 +60,56 @@ struct syscall_untyped_split
objpath_part_t dest_path[];
};
-/* Follows rules declared above syscall_generic_objpath.
- * Returns the object type at path.
- * */
-#define SYSCALL_OBJDIR_OBJTYPE 0
+enum
+{
+ _SYSCALL_OBJDIR_BADCALL = 0,
+ SYSCALL_OBJDIR_OBJTYPE,
+};
-/*
- * If virtual_address does not have a page table, the kernel will return ENOMAP.
- * If virtual_address already has a mapping, the kernel will return EEXIST.
- * Follows the rules defined above syscall_pagedir_map.
- * Maps the untyped page frame to the page table at virtual_address with the passed flags bits.
- * */
-#define SYSCALL_PAGEDIR_MAP_FRAME 0
+#define SYSCALL_PERM_OBJDIR_OBJTYPE JOVE_PERM_READ
+
+enum
+{
+ _SYSCALL_PAGEDIR_NONE = 0,
+ SYSCALL_PAGEDIR_MAP_FRAME,
+ SYSCALL_PAGEDIR_MAP_TABLE,
+ SYSCALL_PAGEDIR_MAP_SHMEM,
+ SYSCALL_PAGEDIR_UNMAP_FRAME,
+ SYSCALL_PAGEDIR_UNMAP_TABLE,
+ SYSCALL_PAGEDIR_UNMAP_SHMEM,
+};
+
+#define SYSCALL_PERM_PAGEDIR_MAP_FRAME (JOVE_PERM_READ | JOVE_PERM_WRITE)
+#define SYSCALL_PERM_PAGEDIR_MAP_TABLE (JOVE_PERM_READ | JOVE_PERM_WRITE)
+#define SYSCALL_PERM_PAGEDIR_MAP_SHMEM (JOVE_PERM_READ | JOVE_PERM_WRITE)
+#define SYSCALL_PERM_PAGEDIR_UNMAP_FRAME (JOVE_PERM_READ | JOVE_PERM_WRITE)
+#define SYSCALL_PERM_PAGEDIR_UNMAP_TABLE (JOVE_PERM_READ | JOVE_PERM_WRITE)
+#define SYSCALL_PERM_PAGEDIR_UNMAP_SHMEM (JOVE_PERM_READ | JOVE_PERM_WRITE)
-/* If virtual_address already has a page table, the kernel will return EHASMAP.
- * Follows the rules defined above syscall_pagedir_map.
- * Creates a page table using the untyped object for memory allocation at virtual_address.
- * Flags bits are always set to writeable and executable.
- * */
-#define SYSCALL_PAGEDIR_MAP_TABLE 1
-
-/* If virtual_address is above the JOVE_USER_MEMORY_LIMIT, the kernel will return EBADARG.
- * If the message is too small for untyped_path, the kernel will return ETOOSMALL.
- * If untyped_path does not point to a valid JOVE_OBJ_UNTYPED, the kernel will return EBADOBJ.
- * If the untyped object is not aligned to 0x1000, the kernel will return EALIGN.
- * If the untyped object is not sized to 0x1000, the kernel will return EBADSIZE.
- *
- * */
struct syscall_pagedir_flags
{
uint8_t writeable : 1;
uint8_t executable : 1;
uint8_t flg_unused : 6;
};
+
struct syscall_pagedir_map
{
- struct syscall_pagedir_flags flags;
- uintptr_t virtual_address;
+ struct syscall_pagedir_flags page_flags;
uint16_t untyped_pathlen;
+ uintptr_t virtual_address;
objpath_part_t untyped_path[];
};
-/**If a page frame is present at the virtual address, the kernel will:
- * mark the page frame as not present.
- * untype the page frame and move it to the none path.
- * return 0.
- * If a page frame is not present at the virtual address, the kernel will return EEMPTY.
- * Follows the rules defined by struct syscall_pagedir_unmap
- * */
-#define SYSCALL_PAGEDIR_UNMAP_FRAME 2
-
-/**If a page table is present at the virtual address, one of two things will happen:
- * If the page table has present entries, the kernel will return EBUSY.
- * Otherwise, the kernel will:
- * mark the page table as not present.
- * untype the page frame and move it to the none path.
- * return 0.
- * If a page table is not present at the virtual address, the kernel will return EEMPTY.
- * Follows the rules defined by the struct syscall_pagedir_unmap
- * */
-#define SYSCALL_PAGEDIR_UNMAP_TABLE 3
+struct syscall_pagedir_map_shmem
+{
+ struct syscall_pagedir_flags page_flags;
+ uint8_t page_offset;
+ uint16_t shmem_pathlen;
+ uintptr_t virtual_address;
+ objpath_part_t shmem_path[];
+};
-/**If the virtual address is above JOVE_USER_MEMORY_LIMIT, the kernel will return EBADARG.
- * If none_pathlen exceeds the length of the message, the kernel will return ETOOBIG.
- * If none_path does not point to a JOVE_OBJ_NONE object, the kernel will return EBADOBJ.
- * */
struct syscall_pagedir_unmap
{
uintptr_t virtual_address;
@@ -146,6 +117,10 @@ struct syscall_pagedir_unmap
objpath_part_t none_path[];
};
-#define SYSCALL_VTT_WRITE 0
+enum
+{
+ _SYSCALL_VTT_NONE = 0,
+ SYSCALL_VTT_WRITE
+};
#endif