#ifndef _JOVE_API_SYSCALL_H #define _JOVE_API_SYSCALL_H 1 #include #include #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; uint16_t pathlen; 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[]; }; enum { _SYSCALL_UNTYPED_BADCALL = 0, SYSCALL_UNTYPED_ADDRESS, SYSCALL_UNTYPED_SIZE, SYSCALL_UNTYPED_SPLIT, SYSCALL_UNTYPED_MERGE, SYSCALL_UNTYPED_RETYPE, }; #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; uint16_t dest_pathlen; objpath_part_t dest_path[]; }; enum { _SYSCALL_OBJDIR_BADCALL = 0, SYSCALL_OBJDIR_OBJTYPE, }; #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) 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 page_flags; uint16_t untyped_pathlen; uintptr_t virtual_address; objpath_part_t untyped_path[]; }; 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[]; }; struct syscall_pagedir_unmap { uintptr_t virtual_address; uint16_t none_pathlen; objpath_part_t none_path[]; }; enum { _SYSCALL_VTT_NONE = 0, SYSCALL_VTT_WRITE }; #endif