aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-01-23 16:23:56 -0700
committerChristian Cunningham <cc@localhost>2022-01-23 16:23:56 -0700
commit741e7431d013c7fda4a1b8b34bcc2dfa1ecda039 (patch)
tree0301b7de87c34e13b3028e80fbf34bb93c2d58c6 /src/lib
parent1b005b885a713199106587f3e6d8f53f0ecfdfcd (diff)
Visual view of memory map
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/mem.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/mem.c b/src/lib/mem.c
index 82f7f45..2f50d3d 100644
--- a/src/lib/mem.c
+++ b/src/lib/mem.c
@@ -1,6 +1,8 @@
#include <drivers/uart.h>
#include <globals.h>
+#include <graphics/lfb.h>
#include <lib/mem.h>
+#include <sys/schedule.h>
void memcpyrot(unsigned char* src, struct RotBuffer* rb, unsigned int n)
{
@@ -246,6 +248,28 @@ void* heap_top(void)
return rpi_heap_top;
}
+void vheap_info(void)
+{
+ unsigned char* base = rpi_heap;
+ unsigned long ioff = STACK_DRAW_WIDTH*STACK_DRAW_SIZE;
+ unsigned long yoff = STACK_DRAW_YOFF;
+ draw_cbox(ioff, yoff, STACK_DRAW_SIZE*STACK_DRAW_WIDTH, STACK_DRAW_SIZE * 8, 0x0);
+ while ((void*)base < rpi_heap_top) {
+ unsigned char size = base[MEM_SIZE_OFFSET];
+ if(base[MEM_USE_OFFSET] == 0) {
+ draw_cbox(ioff, yoff, STACK_DRAW_SIZE, STACK_DRAW_SIZE, 0x00FF00);
+ } else {
+ draw_cbox(ioff, yoff, STACK_DRAW_SIZE, STACK_DRAW_SIZE, 0xFF0000);
+ }
+ ioff += STACK_DRAW_SIZE;
+ if(ioff % STACK_DRAW_WIDTH == 0) {
+ yoff += STACK_DRAW_SIZE;
+ ioff = STACK_DRAW_WIDTH*STACK_DRAW_SIZE;
+ }
+ base += size + MEM_META_SIZE;
+ }
+}
+
void heap_info(void)
{
unsigned char* base = rpi_heap;
@@ -254,6 +278,7 @@ void heap_info(void)
if(base[MEM_USE_OFFSET] == 0) {
uart_char('F');
uart_char(' ');
+ } else {
}
uart_hex((unsigned long)(base + MEM_BASE_SIZE));
uart_string(" Size: ");