aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/cpu.h7
-rw-r--r--src/sys/core.c9
2 files changed, 9 insertions, 7 deletions
diff --git a/include/cpu.h b/include/cpu.h
index 68638a5..52d016b 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -76,4 +76,11 @@ static inline void* getirqstack(void)
return sp;
}
+#define syscall_h_quote(text) #text
+#define syscall_h_expand_and_quote(text) syscall_h_quote(text)
+
+#define sys0(sys_n) asm volatile("svc #" syscall_h_expand_and_quote(sys_n) ::: "r0", "r1", "r2", "r3", "lr");
+
+#define SYS_SCHED 2
+
#endif
diff --git a/src/sys/core.c b/src/sys/core.c
index 1b71d3d..83cd563 100644
--- a/src/sys/core.c
+++ b/src/sys/core.c
@@ -1,4 +1,5 @@
#include <cpu/irq.h>
+#include <cpu.h>
#include <drivers/uart.h>
#include <globals.h>
#include <graphics/drawer.h>
@@ -16,7 +17,6 @@
void testlocal(void);
void testnew(void);
-void __attribute__((naked)) usr_schedule(void);
// Initialize IRQs
void sysinit(void)
@@ -80,10 +80,5 @@ void testlocal(void)
void testnew(void)
{
add_thread(testlocal, 0, 0);
- usr_schedule();
-}
-
-void __attribute__((naked)) usr_schedule(void)
-{
- asm volatile ("svc #2");
+ sys0(SYS_SCHED);
}