Kernel: We don't use floating point arithemtic anymore in kernel

This commit is contained in:
Bananymous 2023-01-10 11:10:17 +02:00
parent efd8638a96
commit 979a5960e4
2 changed files with 13 additions and 8 deletions

View File

@ -3,10 +3,10 @@
#include <BAN/Formatter.h>
#include <kernel/PIT.h>
#define dprintln(...) \
do { \
BAN::Formatter::print(Serial::serial_putc, "[{5.3}] {}({}): ", (float)PIT::ms_since_boot() / 1000.0f, __FILE__, __LINE__); \
BAN::Formatter::println(Serial::serial_putc, __VA_ARGS__); \
#define dprintln(...) \
do { \
BAN::Formatter::print(Serial::serial_putc, "[{5}.{3}] {}({}): ", PIT::ms_since_boot() / 1000, PIT::ms_since_boot() % 1000, __FILE__, __LINE__); \
BAN::Formatter::println(Serial::serial_putc, __VA_ARGS__); \
} while(false)
#define dwarnln(...) \

View File

@ -60,7 +60,7 @@ void kmalloc_initialize()
{
if (mmmt->base_addr <= s_kmalloc_base && s_kmalloc_eternal_end <= mmmt->base_addr + mmmt->length)
{
dprintln("Total usable RAM: {} MB", (float)mmmt->length / MB);
dprintln("Total usable RAM: {}.{} MB", mmmt->length / MB, mmmt->length % MB);
valid = true;
break;
}
@ -70,7 +70,12 @@ void kmalloc_initialize()
}
if (!valid)
Kernel::Panic("Kmalloc: Could not find {} MB of memory", (double)(s_kmalloc_eternal_end - s_kmalloc_node_base));
{
Kernel::Panic("Kmalloc: Could not find {}.{} MB of memory",
(s_kmalloc_eternal_end - s_kmalloc_node_base) / MB,
(s_kmalloc_eternal_end - s_kmalloc_node_base) % MB
);
}
s_kmalloc_node_count = 1;
s_kmalloc_node_head = (kmalloc_node*)s_kmalloc_node_base;
@ -93,8 +98,8 @@ void kmalloc_dump_nodes()
if (!s_initialized)
Kernel::Panic("kmalloc not initialized!");
dprintln("Kmalloc memory available {} MB", (float)s_kmalloc_available / MB);
dprintln("Kmalloc memory allocated {} MB", (float)s_kmalloc_allocated / MB);
dprintln("Kmalloc memory available {}.{} MB", s_kmalloc_available / MB, s_kmalloc_available % MB);
dprintln("Kmalloc memory allocated {}.{} MB", s_kmalloc_allocated / MB, s_kmalloc_allocated % MB);
dprintln("Using {}/{} nodes", s_kmalloc_node_count, s_kmalloc_max_nodes);
for (size_t i = 0; i < s_kmalloc_node_count; i++)
{