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 /src/lib | |
parent | e3eb5a92ae3991cdfbb5a5cf553eac476bc5822f (diff) |
Update to new kmem
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/kmem.c | 36 |
1 files changed, 35 insertions, 1 deletions
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'); +} |