diff options
author | Marvin Borner | 2020-05-28 23:02:51 +0200 |
---|---|---|
committer | Marvin Borner | 2020-05-28 23:02:51 +0200 |
commit | f600c79559892b73b019102478af501cf71fe6a4 (patch) | |
tree | db5bca15169c9990e3c6ab52568d526d1e25bac5 /src/kernel/lib/memory.c | |
parent | 731ea56513bd199597a905eb1937e67cbd762b32 (diff) |
Added vsprintf support for serial connections
Diffstat (limited to 'src/kernel/lib/memory.c')
-rw-r--r-- | src/kernel/lib/memory.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/kernel/lib/memory.c b/src/kernel/lib/memory.c index 0519492..40f6a1f 100644 --- a/src/kernel/lib/memory.c +++ b/src/kernel/lib/memory.c @@ -35,6 +35,7 @@ int memcmp(const void *a_ptr, const void *b_ptr, u32 size) return 0; } +// TODO: Move memory lib! u32 total = 0; struct multiboot_tag_basic_meminfo *meminfo = NULL; @@ -52,7 +53,7 @@ u32 memory_get_all() u32 memory_get_free() { - return memory_get_all() /*- paging_get_used_pages() * 4*/; + return memory_get_all() - paging_get_used_pages() * 4; } void memory_print() @@ -63,6 +64,7 @@ void memory_print() info("Mem upper: 0x%x", meminfo->mem_upper); } info("Total memory found: %dMiB", (memory_get_all() >> 10) + 1); + info("Total used memory: %dMiB", ((memory_get_all() - memory_get_free()) >> 10) + 1); info("Total free memory: %dMiB", (memory_get_free() >> 10) + 1); } @@ -116,4 +118,13 @@ int memory_init() } } return ret; +} + +void bss_clean() +{ + extern u8 bss_start, kernel_end; + u32 start = &bss_start; + u32 end = &kernel_end; + log("0x%x: 0x%x", start, end - start); + memset(start, 0, end - start); }
\ No newline at end of file |