From 2b0734bdc362d5f453e5bfe833b534298072a56a Mon Sep 17 00:00:00 2001 From: Ada Christine Date: Sun, 26 Dec 2021 01:12:31 +0000 Subject: everything builds, probably doesn't work. commit in preparation for a merge --- kc/core/kc_main.c | 52 ++-------------------------------------------------- 1 file changed, 2 insertions(+), 50 deletions(-) (limited to 'kc/core/kc_main.c') diff --git a/kc/core/kc_main.c b/kc/core/kc_main.c index 5eecaf2..8242227 100644 --- a/kc/core/kc_main.c +++ b/kc/core/kc_main.c @@ -4,66 +4,18 @@ #include "memory.h" #include "panic.h" -#include - #include #include #include #include -#include -static void efi_memory_init(struct efi_memory_map_data *map) -{ - // FIXME: bad girl shit: overwriting on aliased pointers. - // this is a temporary solution to shortcomings with - // loader boot data. it's sort-of OK because the memory_range struct - // is smaller than EFI_MEMORY_DESCRIPTOR. it's still not good. - struct memory_range *ranges = (struct memory_range *)map->data; - int entries = map->size / map->descsize; - - for (int i = 0; i < entries; i++) - { - EFI_MEMORY_DESCRIPTOR *desc; - desc = (EFI_MEMORY_DESCRIPTOR *)((char *)map->data + i * map->descsize); - - enum memory_range_type type; - phys_addr_t base; - size_t size; - - base = desc->PhysicalStart; - size = desc->NumberOfPages * EFI_PAGE_SIZE; - - switch (desc->Type) - { - case EfiConventionalMemory: - case EfiBootServicesData: - case EfiBootServicesCode: - case EfiLoaderData: - case EfiLoaderCode: - type = AVAILABLE_MEMORY; - break; - case SystemMemoryType: - type = SYSTEM_MEMORY; - break; - default: - type = RESERVED_MEMORY; - } - - ranges[i].type = type; - ranges[i].base = base; - ranges[i].size = size; - } - - memory_init(ranges, entries); -} - -noreturn void kernel_entry(struct efi_boot_data *data) +unsigned long kc_main(void *data) { (void)data; cpu_init(); serial_init(); kputs(" i'm in\r\n"); - efi_memory_init(data->memory_map); halt(); } + -- cgit v1.3.1-1-g115d