From 523e704b4fead2a0b286480d27510e3912d54b79 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sat, 22 Jan 2022 22:06:42 -0700 Subject: Allow calls to scheduler in middle of execution --- src/sys/core.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/sys') 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 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"); +} -- cgit v1.2.1