aboutsummaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-01-22 22:06:42 -0700
committerChristian Cunningham <cc@localhost>2022-01-22 22:06:42 -0700
commit523e704b4fead2a0b286480d27510e3912d54b79 (patch)
treec6c4e52c9925b211dfb1fa37e7c61defa9ba0358 /src/sys
parent0d551d712c098d6ebb75512340d7503da98361b4 (diff)
Allow calls to scheduler in middle of execution
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/core.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/sys/core.c b/src/sys/core.c
index aa10bdf..4a44e96 100644
--- a/src/sys/core.c
+++ b/src/sys/core.c
@@ -16,7 +16,8 @@
#include <util/time.h>
void testlocal(void);
-void longlocal(void);
+void testnew(void);
+void __attribute__((naked)) usr_schedule(void);
// Initialize IRQs
void sysinit(void)
@@ -69,7 +70,7 @@ void sysinit(void)
add_thread(testlocal, 0, 1);
add_thread(testlocal, 0, 3);
add_thread(testlocal, 0, 5);
- add_thread(longlocal, 0, 5);
+ add_thread(testnew, 0, 4);
uart_scheduler();
}
@@ -83,3 +84,16 @@ void testlocal(void)
uart_hexn((unsigned long)getsp());
uart_string("Exiting thread!\n");
}
+
+void testnew(void)
+{
+ uart_string("Ran special\n");
+ add_thread(testlocal, 0, 0);
+ usr_schedule();
+ uart_string("Finish special!\n");
+}
+
+void __attribute__((naked)) usr_schedule(void)
+{
+ asm volatile ("svc #2");
+}