aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/arch/proc.h3
-rw-r--r--include/kmi/syscalls.h41
-rw-r--r--include/kmi/types.h6
-rw-r--r--include/kmi/uapi.h34
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}