paging finally works

This commit is contained in:
Justin C. Miller
2018-04-25 19:53:22 -07:00
parent 2404b22c1f
commit 25b9625635
5 changed files with 18 additions and 12 deletions

View File

@@ -50,10 +50,10 @@ acpi_table_header::validate(uint32_t expected_type) const
}
device_manager::device_manager(const void *root_table) :
m_local_apic(nullptr)
m_local_apic(nullptr),
m_io_apic(nullptr),
m_global_interrupt_base(0)
{
console *cons = console::get();
kassert(root_table != 0, "ACPI root table pointer is null.");
const acpi1_rsdp *acpi1 =

View File

@@ -163,8 +163,12 @@ isr_handler(registers regs)
cons->puts("received ISR interrupt:\n");
uint64_t cr2 = 0;
__asm__ __volatile__ ("mov %%cr2, %0" : "=r"(cr2));
print_reg("ISR", regs.interrupt);
print_reg("ERR", regs.errorcode);
print_reg("CR2", cr2);
console::get()->puts("\n");
print_reg(" ds", regs.ds);

View File

@@ -1,6 +1,7 @@
#include <stddef.h>
#include <stdint.h>
#include "kutil/memory.h"
#include "console.h"
#include "device_manager.h"
#include "font.h"
@@ -15,8 +16,6 @@ extern "C" {
void kernel_main(popcorn_data *header);
}
inline void * operator new (size_t, void *p) throw() { return p; }
/*
console
load_console(const popcorn_data *header)

View File

@@ -243,7 +243,12 @@ gather_block_lists(
break;
case efi_memory_type::acpi_reclaim:
block->flags = page_block_flags::used | page_block_flags::acpi_wait;
block->flags =
page_block_flags::used |
page_block_flags::mapped |
page_block_flags::acpi_wait;
block->virtual_address = block->physical_address;
break;
case efi_memory_type::persistent:
@@ -441,9 +446,6 @@ memory_initialize_managers(const void *memory_map, size_t map_length, size_t des
free_next, memory_map, map_length, desc_length,
&free_head, &used_head);
page_block::dump(used_head, "original used", true);
page_block::dump(free_head, "original free", true);
// Unused page_block structs go here - finish out the current page with them
page_block *cache_head = fill_page_with_blocks(free_next);
free_next = page_align(free_next);
@@ -526,9 +528,6 @@ memory_initialize_managers(const void *memory_map, size_t map_length, size_t des
page_block::dump(used_head, "used", true);
page_block::dump(free_head, "free", true);
cons->printf("free_region_start: %lx [%3d]\n", free_region_start_virt, used_pages);
pml4->dump();
// Put our new PML4 into CR3 to start using it
page_manager::set_pml4(pml4);