diff options
author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2024-01-09 22:00:10 +0100 |
---|---|---|
committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2024-01-09 22:00:10 +0100 |
commit | 0d9286a860ff888dbb35fa6b92703496af3abecf (patch) | |
tree | a40596ae85efee3ee8b33fb9241200932f933290 /stage3/shell.c | |
parent | d8d31c16138a4d6dc1ff3d33b3172c151c221767 (diff) | |
download | cuddles-0d9286a860ff888dbb35fa6b92703496af3abecf.tar.xz |
refactor heap code and add heap debugging
Diffstat (limited to 'stage3/shell.c')
-rw-r--r-- | stage3/shell.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/stage3/shell.c b/stage3/shell.c index 0d24859..7930130 100644 --- a/stage3/shell.c +++ b/stage3/shell.c @@ -317,6 +317,24 @@ static void cmd_choose(str arg) } } +static void cmd_heapdbg(str arg) +{ + (void) arg; + heap_header *free_ptr = heap_get_free_ptr(); + + heap_header *h = free_ptr; + for (;;) { + print_hex((u64) h); + print(S(" ")); + print_hex(h->size); + print(S("\n")); + + h = h->next; + if (h == free_ptr) + break; + } +} + typedef struct { str name; void (*fn)(str arg); @@ -340,6 +358,7 @@ static command registry[] = { { S("watchdog"), &cmd_watchdog }, { S("clocktest"), &cmd_clocktest }, { S("choose"), &cmd_choose }, + { S("heapdbg"), &cmd_heapdbg }, }; void shell_run_cmd(str cmd) |