aboutsummaryrefslogtreecommitdiff
path: root/include/apos
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-06-09 23:50:14 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-06-09 23:50:14 +0300
commitda8eeb7695a4803d1d45c8c26c05a51fb1ba1e55 (patch)
tree85323057da02893e351426c60f2c5cfd5603b428 /include/apos
parente30cd339e271b0d16dbecf6c521fa06c3a05e3f1 (diff)
downloadkmi-da8eeb7695a4803d1d45c8c26c05a51fb1ba1e55.tar.gz
kmi-da8eeb7695a4803d1d45c8c26c05a51fb1ba1e55.zip
continue documentation
Diffstat (limited to 'include/apos')
-rw-r--r--include/apos/assert.h2
-rw-r--r--include/apos/atomic.h2
-rw-r--r--include/apos/attrs.h2
-rw-r--r--include/apos/conf.h4
-rw-r--r--include/apos/dmem.h2
-rw-r--r--include/apos/mem.h6
-rw-r--r--include/apos/mem_regions.h8
-rw-r--r--include/apos/proc.h2
-rw-r--r--include/apos/sp_tree.h12
-rw-r--r--include/apos/syscalls.h5
-rw-r--r--include/apos/tcb.h20
-rw-r--r--include/apos/timer.h2
-rw-r--r--include/apos/uapi.h451
-rw-r--r--include/apos/utils.h2
14 files changed, 456 insertions, 64 deletions
diff --git a/include/apos/assert.h b/include/apos/assert.h
index 81b267b..a6ae3c8 100644
--- a/include/apos/assert.h
+++ b/include/apos/assert.h
@@ -18,7 +18,7 @@
#include <apos/debug.h>
#include <apos/utils.h>
-/* TODO: should this exit or do something explosive like that? */
+/* \todo: should this exit or do something explosive like that? */
#if !defined(DNDEBUG)
/**
diff --git a/include/apos/atomic.h b/include/apos/atomic.h
index 84e0f0f..aba7a3f 100644
--- a/include/apos/atomic.h
+++ b/include/apos/atomic.h
@@ -161,7 +161,7 @@ typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t;
/**
* Kill dependency.
- * @todo Figure out what it means.
+ * \todo Figure out what it means.
*
* @param y Value whose dependencies should be killed.
* @return \c y
diff --git a/include/apos/attrs.h b/include/apos/attrs.h
index 9729000..76ef39f 100644
--- a/include/apos/attrs.h
+++ b/include/apos/attrs.h
@@ -12,7 +12,7 @@
*
* @param x Attribute whose existence should be checked.
* @return Non-zero when available, \c 0 when not available.
- * @todo Figure out which attributes are necessary and which are good to have
+ * \todo Figure out which attributes are necessary and which are good to have
*/
#if !defined(__has_attribute)
#define __has_attribute(x) 0
diff --git a/include/apos/conf.h b/include/apos/conf.h
index 5b9bf10..3a00997 100644
--- a/include/apos/conf.h
+++ b/include/apos/conf.h
@@ -14,7 +14,7 @@
* \remark Note that runtime parameter passing is not yet implemented, and I might
* implement per-thread stack sizes as well.
* \global
- * @todo This should probably be a function instead.
+ * \todo This should probably be a function instead.
*/
extern size_t __thread_stack_size;
@@ -22,7 +22,7 @@ extern size_t __thread_stack_size;
* Provides access to the runtime global parameter.
* \see __thread_stack_size.
* \global
- * @todo This should probably also be a function instead.
+ * \todo This should probably also be a function instead.
*/
extern size_t __call_stack_size;
diff --git a/include/apos/dmem.h b/include/apos/dmem.h
index dace5f9..25976dc 100644
--- a/include/apos/dmem.h
+++ b/include/apos/dmem.h
@@ -4,7 +4,7 @@
/**
* @file dmem.h
* Device memory handling, i.e. anything outside of RAM.
- * @todo Make global parameters functions instead.
+ * \todo Make global parameters functions instead.
*/
#include <apos/types.h>
diff --git a/include/apos/mem.h b/include/apos/mem.h
index 20293db..8932a2f 100644
--- a/include/apos/mem.h
+++ b/include/apos/mem.h
@@ -159,7 +159,7 @@
*/
#define order_bit(idx) ((idx) & (MM_OINFO_WIDTH - 1))
-/** @todo Get rid of slightly ugly __* syntax, as these aren't static. */
+/** \todo Get rid of slightly ugly __* syntax, as these aren't static. */
/**
* Convert physical address to virtual address in direct mapping.
@@ -180,7 +180,7 @@
/**
* Get page number of physical address.
*
- * @todo Isn't this the same as \ref pm_to_pnum()?
+ * \todo Isn't this the same as \ref pm_to_pnum()?
*
* @param x Physical address.
* @return Corresponding page number.
@@ -281,7 +281,7 @@ typedef ssize_t pnum_t;
* @param max_order Maximum order the current system supports.
* @param shifts Offsets to start of each memory order in address.
* @param page_shift Width in bits of base page size.
- * @todo Should likely also be stat_t?
+ * \todo Should likely also be stat_t?
*/
void init_mem(size_t max_order, size_t shifts[10], size_t page_shift);
diff --git a/include/apos/mem_regions.h b/include/apos/mem_regions.h
index 2eaef8c..0651bfe 100644
--- a/include/apos/mem_regions.h
+++ b/include/apos/mem_regions.h
@@ -96,7 +96,7 @@ struct mem_region {
* @param start Start of memory arena.
* @param arena_size Size of memory arena.
* @return \ref OK on success.
- * @todo Document error codes when I actually implement them properly.
+ * \todo Document error codes when I actually implement them properly.
*/
stat_t init_region(struct mem_region_root *r, vm_t start, size_t arena_size);
@@ -156,7 +156,7 @@ stat_t free_region(struct mem_region_root *r, vm_t start);
* @param r Memory region root.
* @param m Memory region to free.
* @return \ref OK.
- * @todo Improve error checking.
+ * \todo Improve error checking.
*/
stat_t free_known_region(struct mem_region_root *r, struct mem_region *m);
@@ -231,7 +231,7 @@ typedef stat_t region_callback_t(struct vmem *vmem, pm_t *offset, vm_t vaddr,
* @param va Address that is within memory region.
* @param flags Memory region flags.
* @return \ref OK when succesful.
- * @todo Implement.
+ * \todo Implement.
*/
stat_t stat_region(struct mem_region_root *r, vm_t va, vmflags_t *flags);
@@ -242,7 +242,7 @@ stat_t stat_region(struct mem_region_root *r, vm_t va, vmflags_t *flags);
* @param va Address that is within memory region.
* @param flags New flags of region.
* @return \ref OK when succesful.
- * @todo Implement.
+ * \todo Implement.
*/
stat_t mod_region(struct mem_region_root *r, vm_t va, vmflags_t flags);
diff --git a/include/apos/proc.h b/include/apos/proc.h
index 8eaa647..c6346fc 100644
--- a/include/apos/proc.h
+++ b/include/apos/proc.h
@@ -18,7 +18,7 @@
* @param bin Address of binary to load.
* @param interp Optional interpreter, mainly for PIE ELF binaries.
* @return \ref OK on success, \ref ERR_INVAL if loading binary failed.
- * @todo Handle out of memory better?
+ * \todo Handle out of memory better?
*/
stat_t prepare_proc(struct tcb *t, vm_t bin, vm_t interp);
diff --git a/include/apos/sp_tree.h b/include/apos/sp_tree.h
index a5fa2f8..8202033 100644
--- a/include/apos/sp_tree.h
+++ b/include/apos/sp_tree.h
@@ -21,7 +21,7 @@
*
* @param n Node to read.
* @return Left node of read node.
- * @see sp_right().
+ * \see sp_right().
*/
#define sp_left(n) ((n)->left)
@@ -30,7 +30,7 @@
*
* @param n Node to read.
* @return Right node of read node.
- * @see sp_left().
+ * \see sp_left().
*/
#define sp_right(n) ((n)->right)
@@ -41,7 +41,7 @@
*
* @param n Node to read.
* @return Parent of right node of read node.
- * @see sp_lparen().
+ * \see sp_lparen().
*/
#define sp_rparen(n) (sp_right(n)->parent)
@@ -50,7 +50,7 @@
*
* @param n Node to read.
* @return Parent of left node of read node.
- * @see sp_rparen().
+ * \see sp_rparen().
*/
#define sp_lparen(n) (sp_left(n)->parent)
@@ -67,7 +67,7 @@
*
* @param n Node to read.
* @return Grandparent of read node.
- * @see sp_has_gparen().
+ * \see sp_has_gparen().
*/
#define sp_gparen(n) ((n)->parent->parent)
@@ -75,7 +75,7 @@
*
* @param n Node to read.
* @return Non-zero if node has grandparent, \c 0 otherwise.
- * @see sp_gparen().
+ * \see sp_gparen().
*/
#define sp_has_gparen(n) (sp_paren(n) && sp_gparen(n))
diff --git a/include/apos/syscalls.h b/include/apos/syscalls.h
index b0d6423..98144c7 100644
--- a/include/apos/syscalls.h
+++ b/include/apos/syscalls.h
@@ -84,7 +84,10 @@ enum {
/** @name Kernel management. */
/** @{ */
/** Configure system parameters (stack size etc.). */
- SYS_CONF,
+ SYS_CONF_SET,
+
+ /** Get system parameters. */
+ SYS_CONF_GET,
/** Shutdown, reboot, etc. */
SYS_POWEROFF,
diff --git a/include/apos/tcb.h b/include/apos/tcb.h
index 4d4b3d5..83fbffa 100644
--- a/include/apos/tcb.h
+++ b/include/apos/tcb.h
@@ -97,7 +97,7 @@ struct tcb {
/** Thread ID. */
id_t tid;
- /* TODO: implement cpu_id to hardware cpu ID translation, first in
+ /* \todo: implement cpu_id to hardware cpu ID translation, first in
* riscv. */
/** Cpu currently executing this thread. */
id_t cpu_id;
@@ -111,7 +111,7 @@ struct tcb {
/** Address of this thread's stack top. */
vm_t thread_stack_top;
- /* TODO: Check if each thread should be allowed more than just one
+ /* \todo: Check if each thread should be allowed more than just one
* region of thread local storage. */
/** Possible thread local storage. */
vm_t thread_storage;
@@ -145,7 +145,7 @@ void destroy_tcbs();
*
* Userspace stack is allocated with \ref alloc_stacks().
*
- * @todo Thread local storage?
+ * \todo Thread local storage?
*
* @param p Process context within to create the thread.
* @return Pointer to created \ref tcb.
@@ -157,9 +157,9 @@ struct tcb *create_thread(struct tcb *p);
*
* Sets up a new thread in a new process context. If there is a parent thread,
* its memory regions are copied but made COW.
- * @see create_thread().
+ * \see create_thread().
*
- * @todo COW handling.
+ * \todo COW handling.
*
* @param p Parent process.
* @return Pointer to created \ref tcb.
@@ -172,7 +172,7 @@ struct tcb *create_proc(struct tcb *p);
* Frees data associated with thread and frees up the thread ID.
* At least currently does not allow \c t to be a process thread.
*
- * @todo Other return values?
+ * \todo Other return values?
*
* @param t Thread to destroy.
* @return \ref OK on success, \ref ERR_NOINIT if called without initializing
@@ -213,7 +213,7 @@ stat_t attach_rpc(struct tcb *r, struct tcb *t);
* @param t Thread to detach.
* @return \ref OK on success, \ref ERR_INVAL if pointers are the same.
*
- * @todo Should probably check that thread exists in the process?
+ * \todo Should probably check that thread exists in the process?
*/
stat_t detach_rpc(struct tcb *r, struct tcb *t);
@@ -272,18 +272,18 @@ struct tcb *get_tcb(id_t tid);
*
* @param p Process whose memory mappings to clone.
* @return \ref OK on success, something else otherwise.
- * @todo Check up on return codes.
+ * \todo Check up on return codes.
*/
stat_t clone_proc_maps(struct tcb *p);
/**
* Clone RPC context memory mappings.
*
- * @see clone_proc_maps().
+ * \see clone_proc_maps().
*
* @param r Server whose memory mappings to clone to threads in RPC to it.
* @return \ref OK on success, something else otherwise.
- * @todo Check up on return codes.
+ * \todo Check up on return codes.
*/
stat_t clone_rpc_maps(struct tcb *r);
diff --git a/include/apos/timer.h b/include/apos/timer.h
index b21a182..98d9f36 100644
--- a/include/apos/timer.h
+++ b/include/apos/timer.h
@@ -126,7 +126,7 @@ static inline ticks_t msecs_to_ticks(tunit_t msecs)
*/
static inline ticks_t secs_to_ticks(tunit_t secs)
{
- /* TODO: likely not a problem on 64bit systems, not sure how to handle situation on
+ /* \todo: likely not a problem on 64bit systems, not sure how to handle situation on
* 32bit */
return msecs_to_ticks(secs * 1000);
}
diff --git a/include/apos/uapi.h b/include/apos/uapi.h
index f0cb9b7..9155c30 100644
--- a/include/apos/uapi.h
+++ b/include/apos/uapi.h
@@ -9,21 +9,98 @@
#include <apos/syscalls.h>
#include <apos/vmem.h>
-/* syscall function type, let's start with four arguments and see where that
- * goes */
+/**
+ * Syscall function type.
+ * Let's start with four arguments and see where that goes
+ */
typedef struct sys_ret (*sys_t)(long, long, long, long);
-/* TODO: should this be arch specific? should be the size of an integer register */
+
+/**
+ * Syscall argument type.
+ *
+ * \todo: Should this be arch specific? should be the size of an integer
+ * register.
+ */
typedef long sys_arg_t;
+/**
+ * Return structure of syscall.
+ * \note Field names are generic, and can be used for two values or two error
+ * codes, check documentation of whatever you're doing.
+ */
struct sys_ret {
+ /** Error code of syscall. */
sys_arg_t err;
+
+ /** Value returned by syscall. */
sys_arg_t val;
};
-#define SYSCALL_DECLARE(name) \
+/**
+ * Helper macro for declaring syscalls with zero arguments.
+ *
+ * The idea is that all syscalls externally have the same amount of arguments,
+ * but then by using some helper macros (see below) we can make actually
+ * implementing the syscall more intuitive and less noisy.
+ *
+ * @param name Name of syscall.
+ */
+#define SYSCALL_DECLARE0(name) \
+ struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, \
+ sys_arg_t c, \
+ sys_arg_t d);
+
+/**
+ * Helper macro for declaring syscalls with one argument.
+ *
+ * @param name Name of syscall.
+ * @param a Name of argument.
+ */
+#define SYSCALL_DECLARE1(name, a) \
+ struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \
+ sys_arg_t d);
+
+/**
+ * Helper macro for declaring syscalls with two arguments.
+ *
+ * @param name Name of syscall.
+ * @param a Name of first argument.
+ * @param b Name of second argument.
+ */
+#define SYSCALL_DECLARE2(name, a, b) \
+ struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \
+ sys_arg_t d);
+
+/**
+ * Helper macro for declaring syscalls with three arguments.
+ *
+ * @param name Name of syscall.
+ * @param a Name of first argument.
+ * @param b Name of second argument.
+ * @param c Name of third argument.
+ */
+#define SYSCALL_DECLARE3(name, a, b, c) \
+ struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \
+ sys_arg_t d);
+
+/**
+ * Helper macro for declaring syscalls with four arguments.
+ *
+ * @param name Name of syscall.
+ * @param a Name of first argument.
+ * @param b Name of second argument.
+ * @param c Name of third argument.
+ * @param d Name of fourth argument.
+ */
+#define SYSCALL_DECLARE4(name, a, b, c, d) \
struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \
sys_arg_t d);
+/**
+ * Helper macro for defining syscall with zero arguments.
+ *
+ * @param name Name of syscall.
+ */
#define SYSCALL_DEFINE0(name) \
static inline struct sys_ret __##name(); \
struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \
@@ -37,6 +114,11 @@ struct sys_ret {
} \
static struct sys_ret __##name
+/**
+ * Helper macro for defining syscall with one argument.
+ *
+ * @param name Name of syscall.
+ */
#define SYSCALL_DEFINE1(name) \
static inline struct sys_ret __##name(sys_arg_t); \
struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \
@@ -49,6 +131,11 @@ struct sys_ret {
} \
static inline struct sys_ret __##name
+/**
+ * Helper macro for defining syscall with two arguments.
+ *
+ * @param name Name of syscall.
+ */
#define SYSCALL_DEFINE2(name) \
static inline struct sys_ret __##name(sys_arg_t, sys_arg_t); \
struct sys_ret sys_##name(sys_arg_t a, sys_arg_t b, sys_arg_t c, \
@@ -60,6 +147,11 @@ struct sys_ret {
} \
static inline struct sys_ret __##name
+/**
+ * Helper macro for defining syscall with three arguments.
+ *
+ * @param name Name of syscall.
+ */
#define SYSCALL_DEFINE3(name) \
static inline struct sys_ret __##name(sys_arg_t, sys_arg_t, \
sys_arg_t); \
@@ -71,6 +163,11 @@ struct sys_ret {
} \
static inline struct sys_ret __##name
+/**
+ * Helper macro for defining syscall with four arguments.
+ *
+ * @param name Name of syscall.
+ */
#define SYSCALL_DEFINE4(name) \
static inline struct sys_ret __##name(sys_arg_t, sys_arg_t, sys_arg_t, \
sys_arg_t); \
@@ -81,40 +178,332 @@ struct sys_ret {
} \
static inline struct sys_ret __##name
-/* noop */
-SYSCALL_DECLARE(noop);
+/**
+ * Noop syscall.
+ *
+ * @param a Unused.
+ * @param b Unused.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and 0.
+ */
+SYSCALL_DECLARE0(noop);
+
+/* @name Memory handling syscalls. */
+/** @{ */
+/**
+ * Request memory syscall.
+ *
+ * Allocates at least the specified size of allocation to current effective
+ * process.
+ *
+ * @param size Size of allocation.
+ * @param flags Flags of allocation.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and start of memory allocation.
+ */
+SYSCALL_DECLARE2(req_mem, size, flags);
+
+/**
+ * Request physical memory syscall.
+ *
+ * Allocates at least the specified size of allocation which includes the
+ * physical start address somewhere in the allocation to the current effective
+ * process.
+ *
+ * @param paddr Start of physical allocation.
+ * @param size Size of physical allocation.
+ * @param flags Flags of physical allocation.
+ * @param d Unused.
+ * @return \ref OK and start of memory allocation.
+ */
+SYSCALL_DECLARE3(req_pmem, paddr, size, flags);
+
+/**
+ * Request fixed memory syscall.
+ *
+ * Allocates at least the specified size of allocation which includes the start
+ * address of allocation to the current effective process.
+ *
+ * @param start Start of allocation.
+ * @param size Size of allocation.
+ * @param flags Flags of allocation.
+ * @param d Unused.
+ * @return \ref OK and start of memory allocation.
+ */
+SYSCALL_DECLARE3(req_fixmem, start, size, flags);
+
+/**
+ * Request shared memory syscall.
+ *
+ * Allocates a region that can be shared between different processes, that is at
+ * least the specified size of allocation. When clients are freeing memory, the
+ * underlying physical allocation will not be freed unless the owning reference
+ * (server) frees it.
+ *
+ * @param size Size of allocation.
+ * @param flags Flags of allocation.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and start of memory allocation.
+ */
+SYSCALL_DECLARE2(req_sharedmem, size, flags);
+
+/**
+ * Reference shared memory syscall.
+ *
+ * \see sys_req_sharedmem().
+ *
+ * @param tid Thread ID of owner of shared memory.
+ * @param va Start address of shared memory.
+ * @param flags Flags to use for reference.
+ * @param d Unused.
+ * @return \ref OK and start of shared memory.
+ */
+SYSCALL_DECLARE3(ref_sharedmem, tid, va, flags);
+
+/**
+ * Free memory syscall.
+ *
+ * Frees the memory region pointed to.
+ *
+ * @param start Start of memory.
+ * @param b Unused.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and 0.
+ */
+SYSCALL_DECLARE1(free_mem, start);
+/** @} */
+
+/** @name Timer syscalls. */
+/** @{ */
+/**
+ * Get timer accuracy in Hertz syscall.
+ *
+ * @param a Unused.
+ * @param b Unused.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and frequency.
+ * \todo Should this be some kind of config request instead of a separate
+ * syscall?
+ */
+SYSCALL_DECLARE0(timebase);
+
+/**
+ * Request relative timer syscall.
+ *
+ * Request timer that triggers a number of ticks in the future.
+ *
+ * @param ticks Number of ticks from now.
+ * @param repeat Number of times to trigger.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and ID of timer.
+ */
+SYSCALL_DECLARE2(req_rel_timer, ticks, repeat);
+
+/**
+ * Request absolute timer syscall.
+ *
+ * Request timer that triggers at some absolute timepoint.
+ *
+ * @param ticks Timepoint.
+ * @param repeat Number of times to trigger. (What? Why is this here?).
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and ID of timer.
+ * \todo Check repeat value.
+ */
+SYSCALL_DECLARE2(req_abs_timer, ticks, repeat);
+
+/**
+ * Free timer syscall.
+ *
+ * @param cid ID of timer to free.
+ * @param b Unused.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and 0.
+ */
+SYSCALL_DECLARE1(free_timer, cid);
+/** @} */
+
+/** @name IPC syscalls. */
+/** @{ */
+/**
+ * Report process status as server syscall.
+ *
+ * @param callback Callback to request handler.
+ * @param b Unused.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and 0.
+ */
+SYSCALL_DECLARE1(ipc_server, callback);
+
+/**
+ * Request syscall.
+ *
+ * @param pid Request target process.
+ * @param d0 First request argument.
+ * @param d1 Second request argument.
+ * @param d Unused.
+ * @return \c d0 and \c d1.
+ */
+SYSCALL_DECLARE3(ipc_req, pid, d0, d1);
+
+/**
+ * Forwarding syscall.
+ *
+ * In a server request handler, do a request to some other server on behalf of
+ * whoever called us up.
+ *
+ * @param pid Forwarding target process.
+ * @param d0 First forwarding argument.
+ * @param d1 Second forwarding argument.
+ * @param d Unused.
+ * @return \c d0 and \c d1.
+ */
+SYSCALL_DECLARE3(ipc_fwd, pid, d0, d1);
+
+/**
+ * Response syscall.
+ *
+ * @param d0 First response argument.
+ * @param d1 Second response argument.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \c d0 and \c d1.
+ */
+SYSCALL_DECLARE2(ipc_resp, d0, d1);
+/** @} */
+
+/** @name Process handling syscalls. */
+/** @{ */
+/**
+ * Create thread syscall.
+ *
+ * Creates thread in current effective process context.
+ *
+ * @param a Unused.
+ * @param b Unused.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and 0.
+ * \todo Should this take stack size etc?
+ */
+SYSCALL_DECLARE0(create);
+
+/**
+ * Fork process syscall.
+ *
+ * Forks a process, much like in *nix systems.
+ *
+ * @param a Unused.
+ * @param b Unused.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and 0.
+ */
+SYSCALL_DECLARE0(fork);
+
+/**
+ * Execute binary syscall.
+ *
+ * Executes a new binary in existing process space.
+ *
+ * @param bin Address of binary.
+ * @param interp Optional address of interpreter.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and 0.
+ * \todo Check other return codes.
+ */
+SYSCALL_DECLARE2(exec, bin, interp);
-/* memory */
-SYSCALL_DECLARE(req_mem);
-SYSCALL_DECLARE(req_pmem);
-SYSCALL_DECLARE(req_fixmem);
-SYSCALL_DECLARE(req_sharedmem);
-SYSCALL_DECLARE(free_mem);
+/**
+ * Signal process syscall.
+ *
+ * @param tid Thread ID to signal.
+ * @param signal Signal to send.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and 0.
+ */
+SYSCALL_DECLARE2(signal, tid, signal);
-/* timers */
-SYSCALL_DECLARE(timebase);
-SYSCALL_DECLARE(req_rel_timer);
-SYSCALL_DECLARE(req_abs_timer);
-SYSCALL_DECLARE(free_timer);
+/**
+ * Swap syscall.
+ *
+ * Swap currently running thread.
+ *
+ * @param tid Thread to swap to.
+ * @param b Unused.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and 0.
+ */
+SYSCALL_DECLARE1(swap, tid);
+/** @} */
-/* ipc */
-SYSCALL_DECLARE(ipc_server);
-SYSCALL_DECLARE(ipc_req);
-SYSCALL_DECLARE(ipc_fwd);
-SYSCALL_DECLARE(ipc_resp);
+/** @name Configuration syscalls. */
+/** @{ */
+/**
+ * Set configuration syscall.
+ *
+ * Set some runtime parameter.
+ *
+ * @param param Parameter to set.
+ * @param val Value to set parameter to.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and 0.
+ */
+SYSCALL_DECLARE2(conf_set, param, val);
-/* proc */
-SYSCALL_DECLARE(create);
-SYSCALL_DECLARE(fork);
-SYSCALL_DECLARE(exec);
-SYSCALL_DECLARE(signal);
-SYSCALL_DECLARE(swap);
+/**
+ * Get configuration syscall.
+ *
+ * Get some runtime parameter.
+ *
+ * @param param Parameter to get.
+ * @param b Unused.
+ * @param c Unused.
+ * @param d Unused.
+ * @return \ref OK and 0.
+ */
+SYSCALL_DECLARE1(conf_get, param);
-/* conf */
-SYSCALL_DECLARE(conf);
-SYSCALL_DECLARE(poweroff);
+/**
+ * Power off syscall.
+ *
+ * Either shut down or reboot system.
+ *
+ * @param type Type of shutdown. \see poweroff_type.
+ * @param b Unused.
+ * @param c Unused.
+ * @param d Unused.
+ * @return Shouldn't return at all.
+ */
+SYSCALL_DECLARE1(poweroff, type);
+/** @} */
+/**
+ * Dispatch to correct syscall handler.
+ *
+ * @param syscall Syscall number.
+ * @param a Syscall argument 0.
+ * @param b Syscall argument 1.
+ * @param c Syscall argument 2.
+ * @param d Syscall argument 3.
+ * @return Whatever the specified syscall returns.
+ */
struct sys_ret syscall_dispatch(sys_arg_t syscall, sys_arg_t a, sys_arg_t b,
sys_arg_t c, sys_arg_t d);
+/** \todo Should I add variable names as well, to make the documentation a bit
+ * more readable? */
#endif /* APOS_UAPI_H */
diff --git a/include/apos/utils.h b/include/apos/utils.h
index c5cdaad..b75986e 100644
--- a/include/apos/utils.h
+++ b/include/apos/utils.h
@@ -512,7 +512,7 @@ DEFINE_ALIGN_DOWN(ull, unsigned long long);
/**
* Helper macro for defining type specific alignment checks.
- *
+ *
* @param name Name of type in function name.
* @param type Actual type.
*/