aboutsummaryrefslogtreecommitdiff
path: root/src/user/syscall.c
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2020-11-25 15:47:02 -0700
committerJosh Rahm <joshuarahm@gmail.com>2020-11-25 15:47:02 -0700
commit6d22b0dfc7761a605758552d5824f8039ac5a00f (patch)
treede0cd4848c02b787d45b41afaca244606eceab5d /src/user/syscall.c
parentb07c6f6a9d926d4eac726b94963e479839382675 (diff)
downloadstm32l4-6d22b0dfc7761a605758552d5824f8039ac5a00f.tar.gz
stm32l4-6d22b0dfc7761a605758552d5824f8039ac5a00f.tar.bz2
stm32l4-6d22b0dfc7761a605758552d5824f8039ac5a00f.zip
Primitive ability to call kernel code from userspace.
Diffstat (limited to 'src/user/syscall.c')
-rw-r--r--src/user/syscall.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/user/syscall.c b/src/user/syscall.c
new file mode 100644
index 0000000..3aa0707
--- /dev/null
+++ b/src/user/syscall.c
@@ -0,0 +1,17 @@
+#include "user/syscall.h"
+
+#include <stdint.h>
+
+void __attribute__ ((noinline)) do_syscall(
+ volatile uint32_t id,
+ volatile uint32_t arg)
+{
+ asm volatile("svc #0x04");
+}
+
+#define SYSCALL(id, fn, kernfn, argt) \
+ void fn(argt arg) \
+{ \
+ do_syscall(id, (uint32_t) arg); \
+}
+#include "kern/syscall/syscall_tbl.inc"