aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/kmem.c36
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');
+}