static efi_loaded_image_protocol_t *LIP = NULL;
/* platform specific globals */
-VideoConfig Video = {0};
+VideoConfig Video;
+MemoryMap Map;
+
+//#define D(base, flags, access, base, limit) \
+// (((base >> 24) << 56) | \
+// (flags << 52) | \
+// (limit << 48) | \
+// (access << 40) | \
+// (base << 16) | \
+// (limit))
+
+uint64_t GDT[] = {
+ 0u
+};
void sleep(int ms)
{
Video.height = gop->Mode->Information->VerticalResolution;
}
-extern void Term_Init(void);
-extern void Term_Print(char* s, ...);
-extern void Term_PutHex32(uint32_t);
-extern void Term_PutHex64(uint64_t);
-extern void Term_PutChar(uint8_t);
-
-MemoryMap Map;
-
static void memory_init(void)
{
efi_status_t status = 0;
EfiBootServicesData, Map.size + 2 * Map.desc_size, (void**)&Map.data);
status = BS->GetMemoryMap(
&Map.size, (efi_memory_descriptor_t*)Map.data, &Map.key, &Map.desc_size, &Map.desc_ver);
-
-// efi_memory_descriptor_t* entry = (efi_memory_descriptor_t*)Map.data;
-// Term_Init();
-// do {
-// Term_Print("%x %x %x %x %x %d\n",
-// (uint64_t)entry->Type + 1u,
-// (uint64_t)entry->Pad,
-// (uint64_t)entry->Attribute,
-// (uint64_t)entry->PhysicalStart,
-// (uint64_t)entry->VirtualStart,
-// (uint64_t)entry->NumberOfPages
-// );
-// entry = (efi_memory_descriptor_t*)((uint8_t*)entry + Map.desc_size);
-// } while((uint8_t*)entry < ((uint8_t*)Map.data + Map.size));
}
/*
/* exit boot services now */
status = BS->ExitBootServices(IM, Map.key);
- /* setup global descriptor table */
- /* setup interrupt descriptor table */
+ /* initialize the TSS */
+ /* initialize the IDT */
+ /* initialize the paging tables */
+ /* initialize the heap allocator */
+ /* initialize system calls */
+ /* initialize the realtime clock */
+ /* initialize the global timer */
/* now jump to kernel main() */
return main();