From 44f9642bfc9ce9f740d508670befb569e06621a2 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Mon, 19 Oct 2026 11:06:32 -0400 Subject: add debug console. start work on userland pagedir manipulation tools --- api/init.h | 1 - api/memory.h | 28 ++++++++++++++++++++++++++++ api/syscall.h | 21 +++++++++++++++------ 3 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 api/memory.h (limited to 'api') diff --git a/api/init.h b/api/init.h index 107ebef..1d6cf4b 100644 --- a/api/init.h +++ b/api/init.h @@ -12,7 +12,6 @@ enum { INIT_ROOTDIR_HWMEMORY_I, INIT_ROOTDIR_MODULES_I, INIT_ROOTDIR_INTERRUPTS_I, - INIT_ROOTDIR_INITRD_I, INIT_ROOTDIR_MESSAGE_I, _INIT_ROOTDIR_LAST_I }; diff --git a/api/memory.h b/api/memory.h new file mode 100644 index 0000000..d4096e2 --- /dev/null +++ b/api/memory.h @@ -0,0 +1,28 @@ +#ifndef _JOVE_API_MEMORY_H +#define _JOVE_API_MEMORY_H 1 + +#include +#include + +#define JOVE_USERMEMORY_LIMIT 0x00007FFFFFFFFFFFULL + +typedef uintptr_t virtaddr_t; +typedef uintptr_t physaddr_t; + +typedef virtaddr_t virt_frame_t; +typedef physaddr_t phys_frame_t; + +struct pagedir_mapping_flags +{ + bool present; + bool writeable; + bool executable; +}; + +struct pagedir_mapping +{ + phys_frame_t pfn; + struct pagedir_mapping_flags flags; +}; + +#endif diff --git a/api/syscall.h b/api/syscall.h index 4a5d3e4..a52fa5e 100644 --- a/api/syscall.h +++ b/api/syscall.h @@ -3,9 +3,11 @@ #include #include +#include #include "process.h" #include "obj.h" +#include "memory.h" /* General syscall behavior: * If the message passed is not a JOVE_OBJ_MESSAGE type, the kernel will return EBADOBJ. @@ -106,6 +108,8 @@ struct syscall_objdir_link enum { _SYSCALL_PAGEDIR_NONE = 0, + SYSCALL_PAGEDIR_GET_MAPPING, + SYSCALL_PAGEDIR_TRANSFER, SYSCALL_PAGEDIR_MAP_FRAME, SYSCALL_PAGEDIR_MAP_TABLE, SYSCALL_PAGEDIR_MAP_SHMEM, @@ -114,6 +118,8 @@ enum SYSCALL_PAGEDIR_UNMAP_SHMEM, }; +#define SYSCALL_PERM_PAGEDIR_GET_MAPPING (JOVE_PERM_READ) +#define SYSCALL_PERM_PAGEDIR_TRANSFER (JOVE_PERM_READ | JOVE_PERM_WRITE) #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) @@ -121,17 +127,20 @@ enum #define SYSCALL_PERM_PAGEDIR_UNMAP_TABLE (JOVE_PERM_READ | JOVE_PERM_WRITE) #define SYSCALL_PERM_PAGEDIR_UNMAP_SHMEM (JOVE_PERM_READ | JOVE_PERM_WRITE) -struct syscall_pagedir_flags +#define SYSCALL_PERM_PAGEDIR_TRANSFER_TGT (SYSCALL_PERM_PAGEDIR_TRANSFER) + +struct syscall_pagedir_transfer { - uint8_t writeable : 1; - uint8_t executable : 1; - uint8_t flg_unused : 6; + virtaddr_t subject_address; + virtaddr_t target_address; + objpath_part_t target_path_length; + objpath_part_t target_path[]; }; struct syscall_pagedir_map { uintptr_t virtual_address; - struct syscall_pagedir_flags page_flags; + struct pagedir_mapping_flags flags; objpath_part_t untyped_pathlen; objpath_part_t untyped_path[]; }; @@ -140,7 +149,7 @@ struct syscall_pagedir_map_shmem { uintptr_t virtual_address; unsigned short page_offset; - struct syscall_pagedir_flags page_flags; + struct pagedir_mapping_flags flags; objpath_part_t shmem_pathlen; objpath_part_t shmem_path[]; }; -- cgit v1.2.3