please work please

This commit is contained in:
apio 2022-09-11 08:23:32 +02:00
parent d418842a48
commit 0cb59ee17f
4 changed files with 28 additions and 3 deletions

View File

@ -84,8 +84,16 @@ void InitRD::for_each(void (*callback)(File& f))
{ {
TarHeader* hdr = (TarHeader*)KernelMemoryManager::get_unaligned_mapping(get_block(block)); TarHeader* hdr = (TarHeader*)KernelMemoryManager::get_unaligned_mapping(get_block(block));
block++; block++;
if (hdr->typeflag == 53) { continue; } // Directory if (hdr->typeflag == 53)
if (!is_valid_header(hdr)) { continue; } {
KernelMemoryManager::release_unaligned_mapping(hdr);
continue;
} // Directory
if (!is_valid_header(hdr))
{
KernelMemoryManager::release_unaligned_mapping(hdr);
continue;
}
auto f = get_file(hdr); auto f = get_file(hdr);
block += get_file_size_in_blocks(f); block += get_file_size_in_blocks(f);
KernelMemoryManager::release_unaligned_mapping(hdr); KernelMemoryManager::release_unaligned_mapping(hdr);

View File

@ -13,7 +13,13 @@ extern "C" void common_handler(SavedContext* context)
} }
if (context->number == 14) if (context->number == 14)
{ {
printf("Page fault (RIP 0x%lx), while trying to access %lx\n", context->rip, context->cr2); printf("Page fault (RIP 0x%lx), while trying to access %lx, error code %lx\n", context->rip, context->cr2,
context->error_code);
hang();
}
if (context->number == 8)
{
printf("Double fault");
hang(); hang();
} }
if (context->number >= 0x20 && context->number < 0x30) { IRQ::interrupt_handler(context); } if (context->number >= 0x20 && context->number < 0x30) { IRQ::interrupt_handler(context); }

View File

@ -1,6 +1,7 @@
#define MODULE "main" #define MODULE "main"
#include "acpi/RSDT.h" #include "acpi/RSDT.h"
#include "assert.h"
#include "config.h" #include "config.h"
#include "cpu/CPU.h" #include "cpu/CPU.h"
#include "gdt/GDT.h" #include "gdt/GDT.h"
@ -17,6 +18,7 @@
#include "panic/hang.h" #include "panic/hang.h"
#include "power/reboot.h" #include "power/reboot.h"
#include "render/Framebuffer.h" #include "render/Framebuffer.h"
#include "render/TextRenderer.h"
#include "scheduling/PIT.h" #include "scheduling/PIT.h"
#include "std/stdio.h" #include "std/stdio.h"
#include "std/stdlib.h" #include "std/stdlib.h"
@ -63,6 +65,8 @@ extern "C" void _start()
kinfoln("Interrupts enabled"); kinfoln("Interrupts enabled");
ASSERT(TextRenderer::try_initialize());
ACPI::SDTHeader* rootSDT = ACPI::GetRSDTOrXSDT(); ACPI::SDTHeader* rootSDT = ACPI::GetRSDTOrXSDT();
bool isXSDT = ACPI::IsXSDT(); bool isXSDT = ACPI::IsXSDT();
if (!ACPI::ValidateRSDTOrXSDT(rootSDT)) kerrorln("Invalid %s", isXSDT ? "XSDT" : "RSDT"); if (!ACPI::ValidateRSDTOrXSDT(rootSDT)) kerrorln("Invalid %s", isXSDT ? "XSDT" : "RSDT");

View File

@ -1,3 +1,5 @@
#define MODULE "mem"
#include "memory/RangeAllocator.h" #include "memory/RangeAllocator.h"
#include "assert.h" #include "assert.h"
#include "bootboot.h" #include "bootboot.h"
@ -19,6 +21,11 @@ void RangeAllocator::init_from_mmap()
uint64_t mmap_entries = (bootboot.size - 128) / 16; uint64_t mmap_entries = (bootboot.size - 128) / 16;
for (uint64_t i = 0; i < mmap_entries; i++) for (uint64_t i = 0; i < mmap_entries; i++)
{ {
if (!MMapEnt_IsFree(ptr))
{
ptr++;
continue;
}
if (MMapEnt_Size(ptr) > biggest_chunk_size) if (MMapEnt_Size(ptr) > biggest_chunk_size)
{ {
biggest_chunk = (void*)MMapEnt_Ptr(ptr); biggest_chunk = (void*)MMapEnt_Ptr(ptr);