summaryrefslogtreecommitdiffstats
path: root/api/syscall.h
diff options
context:
space:
mode:
Diffstat (limited to 'api/syscall.h')
-rw-r--r--api/syscall.h129
1 files changed, 52 insertions, 77 deletions
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