noxos (docs): updates sysabi specification for file syscalls

This commit is contained in:
antifallobst 2023-04-20 14:56:00 +02:00
parent 39cab6adbf
commit 0580bd7cbb
1 changed files with 47 additions and 34 deletions

View File

@ -1,10 +1,9 @@
---
title: "Sysabi"
summary: The noxos `Application Binary Interface`.
summary: "The noxos `Application Binary Interface`."
date: 2023-03-14T21:00:40+01:00
---
# Syscalls
Syscalls are a way for programms to communicate with the kernel.
To perform a syscall, you need to populate the following registers:
@ -17,46 +16,60 @@ To perform a syscall, you need to populate the following registers:
| rdx | Argument 3 |
| rcx | Argument 4 |
The following calls should be included to some degree in NoxOS 1.0.
---
## Categories
### Files
| ID | Name | Description | Arg1 | Arg2 | Arg3 | Arg4 | Result | Status |
|--------|--------------|-------------|------|--------|------|------|------------|--------|
| 0x0101 | `nx_fopen` | | path | len | | | fd | N/A |
| 0x0102 | `nx_fclose` | | fd | | | | success | N/A |
| 0x0103 | `nx_fread` | | fd | offset | mem | n | num_bytes | N/A |
| 0x0104 | `nx_fwrite` | | fd | offset | mem | n | num_bytes | N/A |
| 0x0105 | `nx_fdelete` | | fd | | | | success | N/A |
| 0x0106 | `nx_flist` | | fd | mem | | | needed_mem | N/A |
| 0x0107 | `nx_finfo` | | fd | attr | mem | | len | N/A |
The following calls should be implemented to some degree in noxos 1.0.
### Memory
| Category | ID | Name | Description | Arg1 | Arg2 | Arg3 | Arg4 | Result | Status |
|----------|-----|------|-------------|------|------|------|------|--------|--------|
| | | | | | | | | | |
# Categories
## Files
| ID | Name | Description | Arg1 | Arg2 | Arg3 | Arg4 | Result | Status |
|--------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------|--------|------|-------------|--------|-------------|
| 0x0101 | `nx_fopen` | Opens the file at the _len_ bytes long path _path_ and writes a file descriptor to the referenced file into _fd_ (which needs to be a pointer). | path | len | *fd | | status | Implemented |
| 0x0102 | `nx_fclose` | Closes the file which is indicated by descriptor _fd_. This should always be called, otherwise the OS will have to unload files without knowledge of usage. | fd | | | | status | Implemented |
| 0x0103 | `nx_fread` | Reads at most _n_ bytes from a file given as descriptor _fd_ and at a specific position _offset_ into a given memory region _mem_. | fd | offset | mem | n | status | Implemented |
| 0x0104 | `nx_fwrite` | Writes _n_ bytes from a given memory region _mem_ into the file referenced by _fd_ at the given position _offset_, not inserting but either overwriting existing content or appending to the file. | fd | offset | mem | n | status | Implemented |
| 0x0105 | `nx_fdelete` | Completely delete the file or folder at a given path _path_, which is _len_ bytes long. | path | len | | | status | N/A |
| 0x0106 | `nx_flist` | List all files and/or directories at the _len_ bytes long path _path_ and write their NULL-separated names into _mem_. When _mem_ is NULL, _needed_mem_ (which needs to be a pointer to an 32-bit integer) is filled with the appropriate value. | path | len | mem | *needed_mem | status | N/A |
| 0x0107 | `nx_finfo` | Writes the information about the files attribute _attr_ into mem. Types of attributes are described below. | fd | attr | mem | | status | N/A |
### Processes
| Category | ID | Name | Description | Arg1 | Arg2 | Arg3 | Arg4 | Result | Status |
|----------|-----|------|-------------|------|------|------|------|--------|--------|
| | | | | | | | | | |
**Note:** The _len_ argument of paths isn't used at the moment, rather than using _len_, _path_ needs to be Null-Terminated.
### Runtime / Dynamic Linker
| Category | ID | Name | Description | Arg1 | Arg2 | Arg3 | Arg4 | Result | Status |
|----------|-----|------|-------------|------|------|------|------|--------|--------|
| | | | | | | | | | |
## Memory
| ID | Name | Description | Arg1 | Arg2 | Arg3 | Arg4 | Result | Status |
|-----|------|-------------|------|------|------|------|--------|--------|
| | | | | | | | | |
### Compatibility & Safety
| Category | ID | Name | Description | Arg1 | Arg2 | Arg3 | Arg4 | Result | Status |
|----------|-----|------|-------------|------|------|------|------|--------|--------|
| | | | | | | | | | |
## Processes
| ID | Name | Description | Arg1 | Arg2 | Arg3 | Arg4 | Result | Status |
|-----|------|-------------|------|------|------|------|--------|--------|
| | | | | | | | | |
### Kernel
## Runtime / Dynamic Linker
| ID | Name | Description | Arg1 | Arg2 | Arg3 | Arg4 | Result | Status |
|-----|------|-------------|------|------|------|------|--------|--------|
| | | | | | | | | |
## Compatibility & Safety
| ID | Name | Description | Arg1 | Arg2 | Arg3 | Arg4 | Result | Status |
|-----|------|-------------|------|------|------|------|--------|--------|
| | | | | | | | | |
## Kernel
The kernel syscalls can only be called from the kernels main process [link to processing article needed].
If another process calls them, they will just return without doing anything.
| Category | ID | Name | Description | Arg1 | Arg2 | Arg3 | Arg4 | Result | Status |
|----------|-----|------|-------------|------|------|------|------|--------|--------|
| | | | | | | | | | |
| ID | Name | Description | Arg1 | Arg2 | Arg3 | Arg4 | Result | Status |
|-----|------|-------------|------|------|------|------|--------|--------|
| | | | | | | | | |
---
## Appendixes
### Types of file attributes
| ID | Name | Description | Data Type | Status |
|-----|---------------|--------------------------------------------|-----------|--------|
| 0 | `permissions` | Who has what permission to access the file | uint16_t | N/A |
| 1 | `size` | The files size in bytes | uint64_t | N/A |