diff options
author | Christian Cunningham <cc@localhost> | 2022-02-05 00:06:26 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-02-05 00:06:26 -0700 |
commit | 4a96615197dc8aead8a53c8c85b99496298dc86d (patch) | |
tree | e60fbc1a73deebcb87ec688637c33a62bc1ced70 | |
parent | e3eb5a92ae3991cdfbb5a5cf553eac476bc5822f (diff) |
Update to new kmem
-rw-r--r-- | include/lib/kmem.h | 3 | ||||
-rw-r--r-- | src/lib/kmem.c | 36 | ||||
-rw-r--r-- | src/sys/schedule.c | 5 | ||||
-rw-r--r-- | src/util/status.c | 2 |
4 files changed, 43 insertions, 3 deletions
diff --git a/include/lib/kmem.h b/include/lib/kmem.h index eb3eb28..67751cd 100644 --- a/include/lib/kmem.h +++ b/include/lib/kmem.h @@ -5,4 +5,7 @@ void* kmalloc(unsigned int size); void* kcalloc(unsigned int size); void kfree(void* ptr); +void kmemshow32(void* data, unsigned long length); +void kmemshow(void* data, unsigned long length); + #endif diff --git a/src/lib/kmem.c b/src/lib/kmem.c index ce2f5fe..931d5e3 100644 --- a/src/lib/kmem.c +++ b/src/lib/kmem.c @@ -1,5 +1,6 @@ -#include <lib/kmem.h> #include <globals.h> +#include <drivers/uart.h> +#include <lib/kmem.h> void* kmalloc(unsigned int size) { @@ -53,3 +54,36 @@ void kfree(void* ptr) } kmem_lookup[0x1000*exp + lookup_offset] = 0; } + +void kmemshow32(void* data, unsigned long length) +{ + unsigned long* ptr = data; + for(unsigned long i = 0; i < length; i++) { + uart_hex(*ptr); + ptr+=1; + if (i != length-1) + uart_char(' '); + } + uart_char('\n'); +} + +void kmemshow(void* data, unsigned long length) +{ + unsigned char* ptr = data; + for(unsigned long i = 0; i < length; i++) { + char tmp = *ptr>>4; + tmp += 0x30; + if (tmp > 0x39) + tmp += 0x7; + uart_char(tmp); + tmp = *ptr&0xF; + tmp += 0x30; + if (tmp > 0x39) + tmp += 0x7; + uart_char(tmp); + ptr+=1; + if (i != length-1) + uart_char(' '); + } + uart_char('\n'); +} diff --git a/src/sys/schedule.c b/src/sys/schedule.c index 7bc86c3..2764108 100644 --- a/src/sys/schedule.c +++ b/src/sys/schedule.c @@ -110,7 +110,7 @@ void uart_scheduler(void) uart_string("Scheduler Info\n==============\nCurrent\n"); uart_hex((unsigned long)scheduler.rthread); uart_char(' '); - //memshow32((void*)scheduler.rthread, 6); + kmemshow32((void*)scheduler.rthread, 6); struct ThreadQueues* tq; for(int p = 0; p < PRIORITIES; p++) { uart_string("Priority "); @@ -131,7 +131,8 @@ void uart_scheduler(void) while (roffset != trb->woffset) { uart_hex((unsigned long)trb->queue[roffset]); uart_char(' '); - //memshow32((void*)trb->queue[roffset], 6); + //kmemshow((void*)trb->queue[roffset], 4*6); + kmemshow32((void*)trb->queue[roffset], 6); roffset++; roffset %= TQUEUE_MAX; } diff --git a/src/util/status.c b/src/util/status.c index 9044b1a..8837e5d 100644 --- a/src/util/status.c +++ b/src/util/status.c @@ -179,4 +179,6 @@ void status(void) g_Drawer.x = x; g_Drawer.y = y; + + draw_stacks(); } |