Basic block allocation for physical memory allocation.

- 1 block = 4096 bytes : because this will make page fault handling possibly
somewhat easier

- 1 byte in the bitmap = 8 blocks of physical memory

unsure if the allocation is perfect ... guess i'll find out some day if this is actually correct.

The bitmap needs 16kb to keep track of 2gb of physical memory. Seems a decent percentage to me.
This commit is contained in:
2022-02-26 20:44:16 +01:00
parent 7330b81a10
commit b4cff3e667
24 changed files with 472 additions and 426 deletions

View File

@ -1,6 +1,6 @@
#include "superVisorTerminal.h"
void startSuperVisorTerminal(){
void startSuperVisorTerminal(BootInfo* bootinfo){
while (true){
printf("SUPERVISOR:>$ " );
@ -40,7 +40,16 @@ void startSuperVisorTerminal(){
printf("========= Memory ==========\n");
printf("Kernel MemoryMap:\n");
printf("kernel: 0x%x - 0x%x\n", &kernel_begin , &kernel_end);
printf("Frames used: 0x%x blocks of 4 KiB\n", used_blocks);
printf("Frames used: 0x%x blocks of 4 KiB\n", 0);
const int bytesInGiB = 1073741824;
int64_t bytesLeft = (bootinfo->memory->TotalMemory % bytesInGiB) / bytesInGiB;
int64_t effectiveNumberOfGib = bootinfo->memory->TotalMemory / bytesInGiB;
int64_t GiBs = effectiveNumberOfGib + bytesLeft;
printf("Available Memory: %d bytes, %d GiB\n", bootinfo->memory->TotalMemory, GiBs );
printf("Reserved Memory: %d bytes\n", bootinfo->memory->ReservedMemory);
//printf("\n\n");
//PrintPhysicalMemoryAllocation( );

View File

@ -3,6 +3,7 @@
#include "../time.h"
#include "../pit.h"
#include "../keyboard/keyboard.h"
#include "../memory/physical/PhysicalMemoryManager.h"
#include "../memory/memory.h"
#include "../bootinfo.h"
void startSuperVisorTerminal();
void startSuperVisorTerminal(BootInfo * );