diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-01-10 17:45:09 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-01-10 17:45:09 +0200 |
| commit | a5cfead3bd0761ba22a07a4e168670dfb7c9fb84 (patch) | |
| tree | 8081f1ba46f93b6788b94c167e16cba700b9fbb1 /include | |
| parent | 23207f0393be1776fdcc224248b7e7d88c1bf622 (diff) | |
| download | kmi-a5cfead3bd0761ba22a07a4e168670dfb7c9fb84.tar.gz kmi-a5cfead3bd0761ba22a07a4e168670dfb7c9fb84.zip | |
some kmx alleviations
Diffstat (limited to 'include')
| -rw-r--r-- | include/arch/proc.h | 3 | ||||
| -rw-r--r-- | include/kmi/syscalls.h | 41 | ||||
| -rw-r--r-- | include/kmi/types.h | 6 | ||||
| -rw-r--r-- | include/kmi/uapi.h | 34 |
4 files changed, 49 insertions, 35 deletions
diff --git a/include/arch/proc.h b/include/arch/proc.h index 341a2f4..345f812 100644 --- a/include/arch/proc.h +++ b/include/arch/proc.h @@ -112,8 +112,9 @@ void adjust_syscall(struct tcb *t); * * @param t Thread that \c init is attached to. * @param fdt Pointer to FDT that is passed to \c init. + * @param initrd Pointer to initrd that is passed to \c init. */ -__noreturn void run_init(struct tcb *t, void *fdt); +__noreturn void run_init(struct tcb *t, void *fdt, void *initrd); /** * Return to userspace fast. diff --git a/include/kmi/syscalls.h b/include/kmi/syscalls.h index 79cd692..1de4fb2 100644 --- a/include/kmi/syscalls.h +++ b/include/kmi/syscalls.h @@ -9,6 +9,13 @@ * Table of system calls. */ +/* pass VM_X etc. to userspace */ +#if defined(riscv64) +#include "../../arch/riscv64/include/vmem.h" +#elif defined(riscv32) +#include "../../arch/riscv32/include/vmem.h" +#endif + /** enum for now, possibly macros in the future once I get an approximate idea of * which syscalls are necessary etc. */ enum { @@ -146,4 +153,38 @@ enum { /* function declarations should be somewhere else, this file could be used in * userspace applications as well */ +/** + * 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 whatever, + * check documentation of whatever you're doing. + * @todo should this be placed into syscalls.h? + */ +struct sys_ret { + /** Status. */ + sys_arg_t s; + + /** First argument. */ + sys_arg_t ar0; + + /** Second argument. */ + sys_arg_t ar1; + + /** Third argument. */ + sys_arg_t ar2; + + /** Fourth argument. */ + sys_arg_t ar3; + + /** Fifth argument. */ + sys_arg_t ar4; +}; + #endif /* KMI_SYSCALLS_H */ diff --git a/include/kmi/types.h b/include/kmi/types.h index 5d7225e..2443f89 100644 --- a/include/kmi/types.h +++ b/include/kmi/types.h @@ -127,6 +127,12 @@ typedef uint32_t size_t; typedef int32_t ssize_t; #endif +/** Maximum alignment. Works for most platforms, I think. */ +typedef union { + intmax_t ll; + long double ld; +} max_align_t; + /** Expands to integer constant of type \ref int8_t. */ #define INT8_C __INT8_C diff --git a/include/kmi/uapi.h b/include/kmi/uapi.h index 891b5f9..39ba79f 100644 --- a/include/kmi/uapi.h +++ b/include/kmi/uapi.h @@ -18,40 +18,6 @@ */ typedef void (*sys_t)(struct tcb *t, long, long, long, long, long); -/** - * 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 whatever, - * check documentation of whatever you're doing. - * @todo should this be placed into syscalls.h? - */ -struct sys_ret { - /** Status. */ - sys_arg_t s; - - /** First argument. */ - sys_arg_t ar0; - - /** Second argument. */ - sys_arg_t ar1; - - /** Third argument. */ - sys_arg_t ar2; - - /** Fourth argument. */ - sys_arg_t ar3; - - /** Fifth argument. */ - sys_arg_t ar4; -}; - /** Helper for returning sys_ret with 0 arguments. */ #define SYS_RET0() (struct sys_ret){0, 0, 0, 0, 0, 0} |
