This repository has been archived on 2023-09-28. You can view files and clone it, but cannot push or open issues or pull requests.
homepage/content/projects/noxos/docs/sysabi.md

6.2 KiB

title summary date
Sysabi The noxos `Application Binary Interface`. 2023-03-14T21:00:40+01:00

Syscalls are a way for programms to communicate with the kernel.

To perform a syscall, you need to populate the following registers:

Register Value
rax The syscalls ID
rdi Argument 1
rsi Argument 2
rdx Argument 3
rcx Argument 4

The following calls should be implemented to some degree in noxos 1.0.

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 Implemented
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 Implemented
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

Note: The len argument of paths isn't used at the moment, rather than using len, path needs to be Null-Terminated.

Memory

ID Name Description Arg1 Arg2 Arg3 Arg4 Result Status
0x0201 nx_mmap Maps n 4KB pages to address addr. You can provide a bitmap of flags with the flags argument. Which flags can be is described below. addr n flags status N/A
0x0202 nx_munmap Unmaps n 4KB pages at address addr. addr n status N/A

Processes

ID Name Description Arg1 Arg2 Arg3 Arg4 Result Status

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.

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

Memory mapping flags

Bit Name Description
0 write Enables write access to the mapped pages.
1 no_exec Prevents execution of the mapped pages.