Kernel: kmalloc_eternal now updates the used/free values
I also improved the kmalloc_dump_info() formatting. We format the values as 8-digit hex numbers since (atleast for now) the kmalloc will always be under 4 GiB address and size :)
This commit is contained in:
parent
e00d18029d
commit
f0093ed2fd
|
@ -90,13 +90,13 @@ void kmalloc_initialize()
|
||||||
|
|
||||||
void kmalloc_dump_info()
|
void kmalloc_dump_info()
|
||||||
{
|
{
|
||||||
kprintln("kmalloc: {}->{}", (void*)s_kmalloc_base, (void*)s_kmalloc_end);
|
kprintln("kmalloc: 0x{8H}->0x{8H}", s_kmalloc_base, s_kmalloc_end);
|
||||||
kprintln(" used: {}", s_kmalloc_used);
|
kprintln(" used: 0x{8H}", s_kmalloc_used);
|
||||||
kprintln(" free: {}", s_kmalloc_free);
|
kprintln(" free: 0x{8H}", s_kmalloc_free);
|
||||||
|
|
||||||
kprintln("kmalloc eternal: {}->{}", (void*)s_kmalloc_eternal_base, (void*)s_kmalloc_eternal_end);
|
kprintln("kmalloc eternal: 0x{8H}->0x{8H}", s_kmalloc_eternal_base, s_kmalloc_eternal_end);
|
||||||
kprintln(" used: {}", s_kmalloc_eternal_used);
|
kprintln(" used: 0x{8H}", s_kmalloc_eternal_used);
|
||||||
kprintln(" free: {}", s_kmalloc_eternal_free);
|
kprintln(" free: 0x{8H}", s_kmalloc_eternal_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* kmalloc_eternal(size_t size)
|
void* kmalloc_eternal(size_t size)
|
||||||
|
@ -106,6 +106,8 @@ void* kmalloc_eternal(size_t size)
|
||||||
ASSERT(s_kmalloc_eternal_ptr + size < s_kmalloc_eternal_end);
|
ASSERT(s_kmalloc_eternal_ptr + size < s_kmalloc_eternal_end);
|
||||||
void* result = (void*)s_kmalloc_eternal_ptr;
|
void* result = (void*)s_kmalloc_eternal_ptr;
|
||||||
s_kmalloc_eternal_ptr += size;
|
s_kmalloc_eternal_ptr += size;
|
||||||
|
s_kmalloc_eternal_used += size;
|
||||||
|
s_kmalloc_eternal_free -= size;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue