summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/syscall.md120
1 files changed, 100 insertions, 20 deletions
diff --git a/doc/syscall.md b/doc/syscall.md
index 70f0570..10f8eb5 100644
--- a/doc/syscall.md
+++ b/doc/syscall.md
@@ -157,11 +157,11 @@ Successful retypes return 0.
### JOVE_OBJ_OBJDIR
-| Syscall | Target Permissions |
-|------------------------|--------------------------------------|
-| SYSCALL_OBJDIR_OBJTYPE | JOVE_PERM_READ |
-| SYSCALL_OBJDIR_UNTYPE | JOVE_PERM_WRITE <br>JOVE_PERM_MUTATE |
-| SYSCALL_OBJDIR_SEND | JOVE_PERM_MUTATE |
+| Syscall | Target Permissions | Subject Permissions |
+|------------------------|--------------------|-----------------------------------|
+| SYSCALL_OBJDIR_OBJTYPE | JOVE_PERM_READ | |
+| SYSCALL_OBJDIR_SWAP | JOVE_PERM_WRITE | JOVE_PERM_WRITE |
+| SYSCALL_OBJDIR_LINK | | JOVE_PERM_WRITE, JOVE_PERM_MUTATE |
#### SYSCALL_OBJDIR_OBJTYPE
@@ -175,17 +175,45 @@ If the message is too small to hold the payload, the kernel will return `-ETOOSM
If the entry index exceeds `JOVE_OBJDIR_ENTRIES`, the kernel returns `-EOOB`.
-#### SYSCALL_OBJDIR_UNTYPE
-Converts the target object to an untyped object if possible.
+#### SYSCALL_OBJDIR_SWAP
-| Data | Entry Index |
-|--------------|-------------|
-| Size (bytes) | 2 |
+Exchanges an object at the given entry index with the object at a given path.
+
+| Data | Entry Index | Other Path Length | Other Path |
+|--------------|------------------------|------------------------|-----------------------------------------|
+| Size (bytes) | sizeof(objpath_part_t) | sizeof(objpath_part_t) | other_path_len * sizeof(objpath_part_t) |
+
+If the entry index exceeds `JOVE_OBJDIR_ENTRIES`, the kernel will return `-EOOB`.
+
+If the other object does not point to an object, the kernel will return `-EBADPATH`.
+
+If the other object's parent directory does not have `JOVE_PERM_WRITE` permissions, the kernel will return `-EPERM`.
+
+Successful swaps will return 0.
+
+
+#### SYSCALL_OBJDIR_LINK
+
+Copies an existing `JOVE_OBJ_LINK` object at a given entry into the passed object path.
-If the target object does not have underlying memory, the kernel will replace the object with `JOVE_OBJ_NONE`.
+Each copy increments the refcount.
-If the target object has underlying memory, the kernel will replace the object with `JOVE_OBJ_UNTYPED`.
+Permissions are inherited from the existing link.
+
+| Data | Entry Index | Other Path Length | Other Path |
+|--------------|------------------------|------------------------|-----------------------------------------|
+| Size (bytes) | sizeof(objpath_part_t) | sizeof(objpath_part_t) | other_path_len * sizeof(objpath_part_t) |
+
+If the entry index exceeds `JOVE_OBJDIR_ENTRIES`, the kernel will return `-EOOB`.
+
+If the other object does not point to an object, the kernel will return `-EBADPATH`.
+
+If the other object is not `JOVE_OBJ_NONE`, the kernel will return `-EFULL`.
+
+If the other object does not have `JOVE_PERM_WRITE | JOVE_PERM_MUTATE`, the kernel will return `-EPERM`.
+
+Successful links return 0.
### JOVE_OBJ_PAGEDIR
@@ -341,12 +369,14 @@ Successful unmapping returns `0`.
### JOVE_OBJ_PCB
-| Syscall | Target Permissions | Subject Permissions |
-|-------------------|--------------------|---------------------|
-| SYSCALL_PCB_PID | JOVE_PERM_READ | |
-| SYSCALL_PCB_YIELD | JOVE_PERM_WRITE | |
-| SYSCALL_PCB_SEND | JOVE_PERM_MUTATE | JOVE_PERM_MUTATE |
-| SYSCALL_PCB_RECV | JOVE_PERM_MUTATE | JOVE_PERM_MUTATE |
+| Syscall | Target Permissions | Subject Permissions |
+|-------------------|-----------------------------------|-----------------------------------|
+| SYSCALL_PCB_PID | JOVE_PERM_READ | |
+| SYSCALL_PCB_YIELD | JOVE_PERM_WRITE | |
+| SYSCALL_PCB_SEND | JOVE_PERM_MUTATE | JOVE_PERM_MUTATE |
+| SYSCALL_PCB_RECV | JOVE_PERM_MUTATE | JOVE_PERM_MUTATE |
+| SYSCALL_PCB_SWAP | JOVE_PERM_MUTATE | JOVE_PERM_MUTATE |
+| SYSCALL_PCB_STACK | JOVE_PERM_WRITE, JOVE_PERM_MUTATE | JOVE_PERM_WRITE, JOVE_PERM_MUTATE |
#### SYSCALL_PCB_YIELD
@@ -358,7 +388,7 @@ Yields control to the specified process.
If the yield target = `0`, the scheduler will determine the next process.
-If the yield target does not exist, the kernel will return `-ENOPROC`.
+If the yield target does not exist, the kernel will return `-EBADPROC`.
#### SYSCALL_PCB_SEND
@@ -400,16 +430,66 @@ Destination object is locked until the timeout expires or an object is placed in
|--------------|-----------------|-------------------|------------------|-------------------|
| Size (bytes) | sizeof(pid_t) | sizeof(uintmax_t) | 2 | 2 * dest_path_len |
-If the specified pid does not correspond to a process, the kernel will return `-ENOPROC`.
+If the specified pid does not correspond to a process, the kernel will return `-EBADPROC`.
If the destination path does not correspond to a `JOVE_OBJ_NONE` object, the kernel will return `-EFULL`.
If the destination path does not have the `JOVE_PERM_MUTATE` permission, the kernel will return `-EPERM`.
+If the blocking timeout expires and an object was not received, the kernel will return `-ETIMEOUT`.
+
Recieved messages will be sent to the specified destination path.
Successful retrieval returns `0`.
+#### SYSCALL_PCB_SWAP
+
+Tries to send an object through the PCB mailbox, then tries to recieve an object back.
+
+Blocks on send until send timeout expires or returns early if mailbox is full and send timeout == 0.
+
+Blocks on recieve until recieve timeout expires or returns early if mailbox is empty and recieve timeout == 0.
+
+Destination object is locked until the timeout expires or an object is placed in the destination path.
+
+| Data | Target Process | Send Timeout | Recieve Timeout | Subject Path Length | Subject Path |
+|--------------|----------------|-------------------|--------------------|---------------------|-------------------|
+| Size (bytes) | sizeof(pid_t) | sizeof(uintmax_t) | sizeof(uintmax_t) | 2 | 2 * dest_path_len |
+
+If the specified pid does not correspond to a process, the kernel will return `-EBADPROC`.
+
+If the subject path does not have the `JOVE_PERM_MUTATE` permission, the kernel will return `-EPERM`.
+
+If the send timeout expires and the object was not sent, the kernel will retun `-ETIMEOUT`.
+
+If the receive timeout expires and an object was not recieved, the kernel will return `-ETIMEOUT`.
+
+Successful swap returns `0`.
+
+
+#### SYSCALL_PCB_STACK
+
+Marks a page-aligned untyped object as either the interrupt stack or the system stack.
+
+Only one page is allowed per stack per process. Both stacks are required for a PCB to be placed in the READY queue.
+
+| Data | Stack Type | Stack Path Length | Stack Path |
+|--------------|------------|------------------------|-------------------------------------------|
+| Size (bytes) | 1 | sizeof(objpath_part_t) | stack_path_length * sizeof(objpath_part_t |
+
+If the stack type is not present in the pcb_stack_type enum, the kernel will return `-EBADARG`.
+
+If the subject object is not a `JOVE_OBJ_UNTYPED` object, the kernel will return `-EBADOBJ`.
+
+If the untyped is not the size of a page, the kernel will return `-EBADSIZE`.
+
+If the untyped is not aligned to a page boundary, the kernel will return `-EALIGN`.
+
+If the PCB already has a stack of the specified type, the kernel will return `-EFULL`.
+
+Successful operation returns `0`.
+
+
### JOVE_OBJ_INITRD_FILE
| Syscall | Target Permissions |