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;
+
+ /* get the map size */
+ status = BS->GetMemoryMap(
+ &Map.size, (efi_memory_descriptor_t*)Map.data, &Map.key, &Map.desc_size, &Map.desc_ver);
+ /* get the map for real now */
+ (void)BS->AllocatePool(
+ 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));
+}
+
/*
* crt_x86_64.c : bootstrap() and uefi_init()
*
/* perform some initialization for the kernel */
video_init();
+ memory_init();
+
+ /* exit boot services now */
+ status = BS->ExitBootServices(IM, Map.key);
+
+ /* setup global descriptor table */
+ /* setup interrupt descriptor table */
/* now jump to kernel main() */
return main();