aboutsummaryrefslogtreecommitdiff
path: root/src/lib/kmem.c
blob: 04196620881efbb9cf735d4c79361f1bb3485c3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <globals.h>
#include <drivers/uart.h>
#include <lib/kmem.h>

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');
}