aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/kern/mpu/mpu_manager.h26
-rw-r--r--include/kern/priv.h2
-rw-r--r--include/kern/syscall.h8
-rw-r--r--include/kern/syscall/syscall_tbl.inc5
-rw-r--r--include/user/syscall.h10
5 files changed, 50 insertions, 1 deletions
diff --git a/include/kern/mpu/mpu_manager.h b/include/kern/mpu/mpu_manager.h
index 7c47722..5a0904c 100644
--- a/include/kern/mpu/mpu_manager.h
+++ b/include/kern/mpu/mpu_manager.h
@@ -55,7 +55,7 @@ typedef enum {
/* Both privileged and non-privileged users can access this memory, but only
as Read-only.*/
- ACCESS_PERMS_BOTH_RO = 5,
+ ACCESS_PERMS_BOTH_RO = 6,
} access_perms_t;
typedef struct {
@@ -81,4 +81,28 @@ void mpu_set_enabled(bool enabled);
*/
void mpu_configure_region(int region_number, memory_region_opts_t* opts);
+typedef enum {
+ PRIVILEGED,
+ NOT_PRIVILEGED,
+} privilege_t;
+
+
+/** Configure a peripheral region with default peripheral attributes. */
+void configure_peripheral_region(
+ void* peripheral_base,
+ region_size_t region_size,
+ privilege_t priv);
+
+/** Configure a flash region with default flash attributes. */
+void configure_flash_region(
+ void* flash_base,
+ region_size_t region_size,
+ privilege_t priv);
+
+/** Configure a ram region with default ram attributes. */
+void configure_ram_region(
+ void* ram_base,
+ region_size_t region_size,
+ privilege_t priv);
+
#endif /* KERN_MPU_MPU_MANAGER_H_ */
diff --git a/include/kern/priv.h b/include/kern/priv.h
index 8940b23..35404f4 100644
--- a/include/kern/priv.h
+++ b/include/kern/priv.h
@@ -10,5 +10,7 @@ void set_control_register(uint32_t reg);
/* Enters user mode from privilieged mode. */
void enter_user_mode();
+void jump_to_user_mode();
+
#endif /* _KERN_PRIV_H_ */
diff --git a/include/kern/syscall.h b/include/kern/syscall.h
new file mode 100644
index 0000000..d39b620
--- /dev/null
+++ b/include/kern/syscall.h
@@ -0,0 +1,8 @@
+#ifndef KERN_SYSCALL_H_
+#define KERN_SYSCALL_H_
+
+#define SYSCALL(id, fn, kernfn, argt) void kernfn(argt arg);
+#include "kern/syscall/syscall_tbl.inc"
+#undef SYSCALL
+
+#endif
diff --git a/include/kern/syscall/syscall_tbl.inc b/include/kern/syscall/syscall_tbl.inc
new file mode 100644
index 0000000..6c4be57
--- /dev/null
+++ b/include/kern/syscall/syscall_tbl.inc
@@ -0,0 +1,5 @@
+/*
+ * Defines a table of SYSCALLS. The syscalls need to be void functions that
+ * a single 32-bit integer as their argument.
+ */
+SYSCALL(25, logs, kern_logs, const char*)
diff --git a/include/user/syscall.h b/include/user/syscall.h
new file mode 100644
index 0000000..c420a3b
--- /dev/null
+++ b/include/user/syscall.h
@@ -0,0 +1,10 @@
+#ifndef USER_SYSCALL_H_
+#define USER_SYSCALL_H_
+
+/* This defines the full set of system calls accessible from usermode. */
+
+#define SYSCALL(id, fn, kernfn, argt) void fn(argt arg);
+#include "kern/syscall/syscall_tbl.inc"
+#undef SYSCALL
+
+#endif