Skip to content

Commit

Permalink
Remove faulty implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Paweł Łukasik committed Oct 22, 2024
1 parent 2395599 commit f1debfc
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
2 changes: 1 addition & 1 deletion src/impl/kernel/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ASMCALL void kernel_main(boot_info* boot_info, void* l4_page_table) {
Framebuffer::get_instance()->Clear(255,0,0);
}
else if (memcmp(cmd, map_cmd, sizeof(map_cmd))) {
vmm.map_address(0xdeadbeef);
// TODO: implement map command
}
else if (memcmp(cmd, vmm_cmd, sizeof(vmm_cmd))) {
auto *pageTableL3 = reinterpret_cast<int *>(vmm.GetPageTableL3());
Expand Down
9 changes: 0 additions & 9 deletions src/impl/x86_64/virtual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,3 @@ void VMM::kfree(void *address)
combineFreeSegments(currentMemorySegment, currentMemorySegment->prevChunk);
}
}

void VMM::map_address(const pt::uintptr_t addr){
auto pageDirectoryIndex = addr >> 22;
auto pageTableIndex = addr >> 12 & 0x03ff;
if (pageTables->l3_pages[pageDirectoryIndex] == nullptr) {
auto l3Page = pageTables->l3_pages[pageTableIndex];
l3Page->l2PageTable[pageDirectoryIndex].address = (addr & 0xfff) | 0b11;
}
}
2 changes: 0 additions & 2 deletions src/intf/virtual.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ struct PageTableL4 {

class VMM
{
private:
kMemoryRegion* firstFreeMemoryRegion;
PageTableL4* pageTables;

public:
void *kmalloc(pt::size_t size);
void *kcalloc(pt::size_t size);
void kfree(void *);
void map_address(pt::uintptr_t addr);

pt::size_t memsize();

Expand Down

0 comments on commit f1debfc

Please sign in to comment.