diff options
author | Christian Cunningham <cc@localhost> | 2022-01-06 23:20:04 -0800 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-01-06 23:20:04 -0800 |
commit | aa8d179b2df2ce031a84172a70be88697dfda7c4 (patch) | |
tree | 3130a3c0e2bb43759fbfd219e7d71031a94b43fe /src/sys/core.c | |
parent | 159ba190d626f049512c3ebda70772c03e6737a7 (diff) |
Rewrote scheduler in Assembly
Diffstat (limited to 'src/sys/core.c')
-rw-r--r-- | src/sys/core.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/sys/core.c b/src/sys/core.c index 204eb55..302e629 100644 --- a/src/sys/core.c +++ b/src/sys/core.c @@ -62,21 +62,41 @@ void sysinit(void) add_thread(testlocal, 0); add_thread(testlocal, 5); add_thread(testlocal, 8); - delay(0x80000000); + delay(0x20000000); schedule(); } struct Mutex testm = {.addr = (void*)0xDEADBEEF, .pid = NULL_PID}; +void testlocal1(void) +{ + unsigned long a = 5; + struct Thread* t = scheduler.rthread_ll->data; + uart_string("vRan Thread "); + uart_10(t->data.pid); + uart_string(" Pri. "); + uart_10(t->data.priority); + uart_string(" ...\n"); + add_thread(testlocal, 0); + schedule(); + a += t->data.pid; + uart_10(a); + uart_string(" Done!\n"); +} void testlocal(void) { - unsigned char testd = 0xDE; struct Thread* t = scheduler.rthread_ll->data; - delay(0x04000000); - testd -= 50; uart_string("Ran Thread "); - delay(0x04000000); uart_10(t->data.pid); - uart_char(' '); - uart_10(testd); - uart_char('\n'); + uart_string(" Pri. "); + uart_10(t->data.priority); + uart_string(" ...\n"); + //delay(0x80000000); + if (t->data.pid == 6) { + add_thread(testlocal, 0); + } else if (t->data.pid == 5) { + add_thread(testlocal1, 1); + schedule(); + sched_info(); + } + uart_string("Done!\n"); } |