LF OS
Hobby operating system for amd64 with high ambitions
|
Go to the source code of this file.
Functions | |
static | __attribute__ ((artificial)) void sc_do_scheduler_exit(uint8_t exit_code) |
asm ("syscall":"=a"(rax):"D"(rdi), "a"(rax), "d"(rdx):"rbx", "rcx", "r11", "memory") | |
Variables | |
static void * | entry |
static void pid_t * | pid |
uint64_t | rax = (uint64_t)(share_memory & 1) |
uint64_t | rdx = ((0 & 0xFF) << 24) | (1 & 0xFFFFFF) |
static void ** | data_end |
static uint16_t * | width = (rdi & 65535) |
static uint16_t uint16_t * | height = ((rdi >> 16) & 65535) |
static uint16_t uint16_t uint16_t * | stride = ((rdi >> 32) & 65535) |
static uint16_t uint16_t uint16_t uint16_t * | colorFormat |
uint64_t | rdi = (uint64_t)(queue) |
* | framebuffer = (uint32_t*)(rax) |
static uint16_t | num |
static uint16_t bool | turn_on |
static uint16_t bool uint64_t * | error |
static bool | notify |
static bool uint64_t | queue |
* | mutex = (rax) |
static bool | trylock |
* | condvar = (rax) |
static uint64_t | amount |
static uint64_t | timeout |
static bool | global_write |
static bool size_t | message_limit |
static bool size_t size_t | data_limit |
static bool size_t size_t uint64_t * | mq = (rax) |
static bool | wait |
static bool struct Message * | message |
static uint64_t | process |
uint64_t | rsi = (uint64_t)(message) |
|
inlinestatic |
Syscall exit (group 0, call 0)
Exit the process, free all memory and deliver exit code to parent process. This syscall will never return.
[in] | exit_code | Code returned from the calling process to the parent process |
Syscall clone (group 0, call 1)
Clone the process into a new process while optionally sharing all memory (which is commonly called a thread then).
[in] | share_memory | Share memory with original process |
[in] | entry | Entrypoint of the child. Special case: NULL, will continue at the same code location (only valid if share_memory == 1) |
[out] | pid | PID of the new process in the old process, 0 in the new process, -1 denotes an error |
Syscall sleep (group 0, call 2)
Sleep for the given time or yield CPU time to another process, if given time is 0
[in] | nanoseconds | Nanoseconds until first normally scheduling the process again |
Syscall get_pid (group 0, call 3)
Return own or parent PID
[in] | parent | If true, returns parent PID. Own PID otherwise |
[out] | pid | Own or parent PID |
Syscall sbrk (group 1, call 0)
Increment the data segment by inc bytes and return the new end of the data segment.
[in] | inc | Minimum number of bytes to add the data segment |
[out] | data_end | Pointer to the last byte in the data segment |
Syscall framebuffer (group 2, call 0)
Take control of the framebuffer (if still in control by kernel)
[out] | framebuffer | Pointer to the framebuffer |
[out] | width | Width of the framebuffer |
[out] | height | Height of the framebuffer |
[out] | stride | Stride (number of bytes per pixel row) of the framebuffer |
[out] | colorFormat | TBD |
Syscall ioperm (group 2, call 1)
Request access to I/O ports, this is i386 and amd64 only
[in] | from | First port for which access is requested |
[in] | num | Number of ports for which access is requested |
[in] | turn_on | Request (true) or drop (false) access to port |
[out] | error | Error code, zero on success |
Syscall interrupt_notify (group 2, call 2)
Request to be notified of hardware interrupts or cancel notifications
[in] | interrupt | Number of the interrupt to be notified for |
[in] | notify | Add notification (true) or cancel (false) |
[in] | queue | Message queue to send notifications to |
[out] | error | Error code, 0 if success |
Syscall create_mutex (group 3, call 0)
This syscall creates a new mutex
[out] | mutex | pthread_mutex_t value for the new mutex |
[out] | error | error code, zero if success |
Syscall destroy_mutex (group 3, call 1)
destroys the given mutex, returns an error if locked
[in] | mutex | mutex to destroy as pthread_mutex_t |
[out] | error | error code, zero if success |
Syscall lock_mutex (group 3, call 2)
Waits for the mutex to be free and locks it or tries to lock it without blocking
[in] | mutex | mutex to lock as pthread_mutex_t |
[in] | trylock | Try to lock instead of block |
[out] | error | error of this operation, zero if success |
Syscall unlock_mutex (group 3, call 3)
Unlocks a mutex
[in] | mutex | mutex to lock as pthread_mutex_t |
[out] | error | error of this operation, zero if success |
Syscall create_condvar (group 3, call 4)
Create a new condvar processes can wait on
[out] | condvar | pthread_cond_t value for the new condvar |
[out] | error | error code, zero if success |
Syscall destroy_condvar (group 3, call 5)
Destroys a given condvar. Errors if processes are waiting on it
[in] | condvar | pthread_cond_t value to destroy |
[out] | error | error code, zero if success |
Syscall signal_condvar (group 3, call 6)
Signals a condvar to unlock up to amount processes
[in] | condvar | condvar to signal |
[in] | amount | maximum amount of processes to unlock |
[out] | error | error code, zero if success |
Syscall wait_condvar (group 3, call 7)
Makes the calling process blocking wait on the condvar
[in] | condvar | condvar to wait on |
[in] | timeout | Wait timeout, not yet implemented |
[out] | error | error code, zero if success |
Syscall mq_create (group 4, call 0)
create a new message queue
[in] | global_read | Allow other processes to read from this queue |
[in] | global_write | Allow other processes to write to this queue |
[in] | message_limit | Max count of messages to store in the queue |
[in] | data_limit | Max amount of data to store in the queue |
[out] | mq | Unique identifier for the new queue |
[out] | error | error code, zero if success |
Syscall mq_destroy (group 4, call 1)
Destroy a given message queue
[in] | mq | ID of the message queue to destroy |
[out] | error | error code, zero if success |
Syscall mq_poll (group 4, call 2)
Retrieve message from given queue
[in] | queue | Message queue ID, 0 is process queue |
[in] | wait | Wait for a message to be available |
[in] | message | Pointer where to store the message, has to be allocated with enough storage |
[out] | error | Error code, 0 on success |
Syscall mq_send (group 4, call 3)
Send message to given queue
[in] | queue | Message queue ID, 0 is process queue |
[in] | process | Recipient process, to send messages to other processes process queue |
[in] | message | Pointer to message from queue |
[out] | error | Error code, 0 if success |
Syscall service_register (group 4, call 4)
Register as implementation of the given service
[in] | uuid | UUID of the service to register for |
[in] | queue | Message queue ID, 0 is process queue |
[out] | error | Error code, 0 if success |
Syscall service_discover (group 4, call 5)
Send message to implementations of given service
[in] | uuid | UUID of the service to discover |
[in] | queue | Message queue ID, 0 is process queue |
[in] | message | Message to send, UUID will be filled in automatically, has to be of type ServiceDiscover |
[out] | error | Error code, 0 if success |
Syscall read (group 5, call 0)
Read nanoseconds since system start
[out] | nanoseconds | Nanoseconds since system start (or rather, since timer initialization) |
Syscall print (group 255, call 0)
Print a message to the screen at a location defined by the kernel
[in] | str | Message to print |
Definition at line 18 of file syscalls.h.
asm | ( | ) |
uint64_t amount |
Definition at line 263 of file syscalls.h.
* colorFormat |
Definition at line 104 of file syscalls.h.
* condvar = (rax) |
Definition at line 237 of file syscalls.h.
* data_end |
Definition at line 82 of file syscalls.h.
Definition at line 303 of file syscalls.h.
void* entry |
Definition at line 34 of file syscalls.h.
* error |
Definition at line 115 of file syscalls.h.
bool global_write |
Definition at line 303 of file syscalls.h.
* height = ((rdi >> 16) & 65535) |
Definition at line 104 of file syscalls.h.
Definition at line 338 of file syscalls.h.
Definition at line 303 of file syscalls.h.
* mq = (rax) |
Definition at line 303 of file syscalls.h.
* mutex = (rax) |
Definition at line 171 of file syscalls.h.
bool notify |
Definition at line 143 of file syscalls.h.
uint16_t num |
Definition at line 126 of file syscalls.h.
* pid |
Definition at line 34 of file syscalls.h.
uint64_t process |
Definition at line 357 of file syscalls.h.
static uint64_t queue |
Definition at line 143 of file syscalls.h.
Definition at line 36 of file syscalls.h.
Definition at line 106 of file syscalls.h.
uint64_t rdx = ((0 & 0xFF) << 24) | (1 & 0xFFFFFF) |
Definition at line 37 of file syscalls.h.
Definition at line 396 of file syscalls.h.
* stride = ((rdi >> 32) & 65535) |
Definition at line 104 of file syscalls.h.
uint64_t timeout |
Definition at line 280 of file syscalls.h.
bool trylock |
Definition at line 197 of file syscalls.h.
Definition at line 126 of file syscalls.h.
bool wait |
Definition at line 338 of file syscalls.h.
* width = (rdi & 65535) |
Definition at line 104 of file syscalls.h.