30 lines
857 B
C
30 lines
857 B
C
// Physical-memory declarations shared by the kernel and drivers.
|
|
// The physical layer publishes page-size constants, boot memory-map ingestion,
|
|
// and aggregate memory statistics. Frame ownership lives in the PFN database.
|
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <stdbool.h>
|
|
#include <ntlite/memory_map.h>
|
|
|
|
#define PAGE_SIZE 4096ULL
|
|
#define PAGE_MASK (~(PAGE_SIZE - 1))
|
|
|
|
typedef uint64_t PHYSICAL_ADDRESS;
|
|
|
|
typedef struct MM_PHYSICAL_STATS {
|
|
uint64_t TotalFrames;
|
|
uint64_t FreeFrames;
|
|
uint64_t UsedFrames;
|
|
uint64_t LargestFreeRun;
|
|
uint64_t FreeRunCount;
|
|
uint64_t FreeRunHistogram[8];
|
|
} MM_PHYSICAL_STATS;
|
|
|
|
bool MmInitializePhysical(const MEMORY_MAP* map, uint64_t physicalWindowBase);
|
|
size_t MmFreeFrameCount(void);
|
|
size_t MmTotalFrameCount(void);
|
|
void MmQueryPhysicalStats(MM_PHYSICAL_STATS* out);
|