Skip to content

Commit

Permalink
EFI READ MEMORY MAP
Browse files Browse the repository at this point in the history
  • Loading branch information
PokeyManatee4 authored Mar 9, 2022
1 parent 43c78bb commit 61f25d1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion kernel/src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,23 @@ struct BootInfo {

extern "C" void _start(BootInfo* bootInfo){

BasicRenderer newRenderer = BasicRenderer(bootInfo->framebuffer, bootInfo->psf1_Font);
BasicRenderer newRenderer = BasicRenderer(bootInfo->framebuffer, bootInfo->psf1_Font);

newRenderer.Print("© 2022 The Brick OS Team");


uint64_t mMapEntries = bootInfo->mMapSize / bootInfo->mMapDescSize;

for (int i = 0; i < mMapEntries; i++){
EFI_MEMORY_DESCRIPTOR* desc = (EFI_MEMORY_DESCRIPTOR*)((uint64_t)bootInfo->mMap + (i * bootInfo->mMapDescSize));
newRenderer.CursorPosition = {0, newRenderer.CursorPosition.Y + 16};
newRenderer.Print(EFI_MEMORY_TYPE_STRINGS[desc->type]);
newRenderer.Colour = 0xffff00ff;
newRenderer.Print(" ");
newRenderer.Print(to_string(desc->numPages * 4096 / 1024));
newRenderer.Print(" KB");
newRenderer.Colour = 0xffffffff;
}

return ;
}

0 comments on commit 61f25d1

Please sign in to comment.