From b30ee14270a44e48167934b9b3923b4280bdc855 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 1 Oct 2021 20:36:15 +0300 Subject: First jump to virtual memory! + Lots of bughunting to do, probably lots of off-by-one and so on errors, and I make a lot of naive and possibly dangerous assumptions. But cool start nonetheless. Should also come up with some method of exchanging data between the init and actual kernel, probably some struct of some sort. TODO --- common/mem.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 common/mem.c (limited to 'common/mem.c') diff --git a/common/mem.c b/common/mem.c new file mode 100644 index 0000000..420f6f4 --- /dev/null +++ b/common/mem.c @@ -0,0 +1,40 @@ +#include +#include + +const size_t mm_shifts[10] = { + MM_O0_SHIFT, + MM_O1_SHIFT, + MM_O2_SHIFT, + MM_O3_SHIFT, + MM_O4_SHIFT, + MM_O6_SHIFT, + MM_O7_SHIFT, + MM_O8_SHIFT, + MM_O9_SHIFT, +}; + +const size_t mm_widths[10] = { + MM_O0_WIDTH, + MM_O1_WIDTH, + MM_O2_WIDTH, + MM_O3_WIDTH, + MM_O4_WIDTH, + MM_O5_WIDTH, + MM_O6_WIDTH, + MM_O7_WIDTH, + MM_O8_WIDTH, + MM_O9_WIDTH, +}; + +const size_t mm_sizes[10] = { + MM_O0_SIZE, + MM_O1_SIZE, + MM_O2_SIZE, + MM_O3_SIZE, + MM_O4_SIZE, + MM_O5_SIZE, + MM_O6_SIZE, + MM_O7_SIZE, + MM_O8_SIZE, + MM_O9_SIZE, +}; -- cgit v1.3