31 lines
1.1 KiB
C
31 lines
1.1 KiB
C
#pragma once
|
|
// memory_map.h - shared between bootx64.efi and kernel.exe
|
|
// Describes physical memory layout passed from bootloader to kernel.
|
|
#include <stdint.h>
|
|
|
|
#define MEMORY_MAP_MAGIC 0x4D454D4D41500000ULL /* 'MEMMAP\0\0' */
|
|
#define MEMORY_MAX_REGIONS 256
|
|
|
|
typedef enum MEMORY_TYPE {
|
|
MemoryUsable = 0, /* free RAM, available to the PMM */
|
|
MemoryReserved = 1, /* firmware-reserved, do not touch */
|
|
MemoryMappedIO = 2, /* device MMIO regions */
|
|
MemoryFramebuffer = 3, /* GOP framebuffer */
|
|
MemoryBootloader = 4, /* bootloader code/data (reclaimable) */
|
|
MemoryKernel = 5, /* kernel + HAL + drivers image pages */
|
|
} MEMORY_TYPE;
|
|
|
|
typedef struct MEMORY_REGION {
|
|
uint64_t Base;
|
|
uint64_t Length; /* in bytes, always page-aligned */
|
|
MEMORY_TYPE Type;
|
|
uint32_t _pad;
|
|
} MEMORY_REGION;
|
|
|
|
typedef struct MEMORY_MAP {
|
|
uint64_t Magic;
|
|
uint32_t RegionCount;
|
|
uint32_t _pad;
|
|
MEMORY_REGION Regions[MEMORY_MAX_REGIONS];
|
|
} MEMORY_MAP;
|