diff options
| author | Jon Santmyer <jon@jonsantmyer.com> | 2026-09-12 22:00:09 -0400 |
|---|---|---|
| committer | Jon Santmyer <jon@jonsantmyer.com> | 2026-09-12 22:00:09 -0400 |
| commit | 53fa3cd2bfdb122d773024612d8c1d71f0dd8188 (patch) | |
| tree | 5ffe81718b400031ca9b3b68a6d152c574270af2 /api/syscall.h | |
| parent | 1d1a5cde7de28752727e3d56305a74afac8848ff (diff) | |
| download | jove-kernel-53fa3cd2bfdb122d773024612d8c1d71f0dd8188.tar.gz jove-kernel-53fa3cd2bfdb122d773024612d8c1d71f0dd8188.tar.bz2 jove-kernel-53fa3cd2bfdb122d773024612d8c1d71f0dd8188.zip | |
add paging support
Diffstat (limited to 'api/syscall.h')
| -rw-r--r-- | api/syscall.h | 74 |
1 files changed, 72 insertions, 2 deletions
diff --git a/api/syscall.h b/api/syscall.h index bdd9972..8c35270 100644 --- a/api/syscall.h +++ b/api/syscall.h @@ -6,6 +6,14 @@ #include "obj.h" +/* General syscall behavior: + * If the message passed is not a JOVE_OBJ_MESSAGE type, the kernel will return EBADOBJ. + * If the message is too small to hold the target path, the kernel will return ETOOSMALL. + * If the target path does not target a real object, the kernel will return EBADPATH. + * If the target does not support the callid, the kernel will return EBADARG. + * Otherwise, behavior depends on the syscall specified in callid. + * */ + struct syscall_header { uint16_t callid; @@ -13,28 +21,51 @@ struct syscall_header objpath_part_t path[]; }; +/* If the message is too small for data, the kernel will return ETOOSMALL. + * */ struct syscall_generic_write { size_t len; char data[]; }; +/* If the message is too small for path, the kernel will return ETOOSMALL. + * If the path does not point to an object, the kernel will return EBADPATH. + * */ struct syscall_generic_objpath { uint16_t pathlen; objpath_part_t path[]; }; -#define SYSCALL_UNTYPED_SIZE 0 -#define SYSCALL_UNTYPED_ALIGN 1 +/* 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 { uint16_t newtype; }; +/* 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 struct syscall_untyped_split { @@ -43,8 +74,47 @@ 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 +/* + * 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 + +/* 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; + uint16_t untyped_pathlen; + objpath_part_t untyped_path[]; +}; + #define SYSCALL_VTT_WRITE 0 #endif |
