XenevaOS
Loading...
Searching...
No Matches
pmmngr.h
Go to the documentation of this file.
1
32#ifndef __PMMNGR_H__
33#define __PMMNGR_H__
34
35#include <aurora.h>
36
37
38#define AURORA_PAGE_KERNEL (1ULL<<0)
39#define AURORA_PAGE_SHM (1ULL<<1)
40#define AURORA_PAGE_DMA (1ULL<<2)
41#define AURORA_PAGE_NORMAL (1ULL << 3)
42
43/* ---- Stage 1: per-owner page accounting ----
44 * Owner id space: 0 = kernel / untracked, >0 = proc_id, <0 = reserved
45 * for subsystem tags. Query with AuPmmOwnerPages(); check at teardown
46 * with AuPmmOwnerTeardownCheck(). Allocation passes the owner through
47 * the ForOwner variants; the classic entry points always use
48 * PMM_OWNER_KERNEL and are otherwise unchanged. */
49#define PMM_OWNER_KERNEL 0
52 uint32_t alignment_pages, uint64_t max_phys_inclusive, uint8_t page_type,
55extern void AuPmmOwnerTeardownCheck(int32_t owner, const char* tag);
56#ifdef __XENEVA_DEBUG_ALLOC__
57/* Stage 3 (debug-only): walk the frame table and print every block
58 * still tagged to the owner. Called from AuPmmOwnerTeardownCheck on
59 * failure; also usable from the debugger. */
60extern void AuPmmOwnerScan(int32_t owner);
61#endif
62extern void AuPmmngrInitialize(KERNEL_BOOT_INFO *info);
63
64#define PMM_INVALID_PHYS UINT64_MAX
65
73
74#ifdef ARCH_ARM64
77 uint32_t alignment_pages, uint64_t max_phys_inclusive, uint8_t page_type);
85extern bool AuPmmngrValidate(void);
86#else
97AU_EXTERN AU_EXPORT void AuPmmngrFreeBlocks(void* Addr, int Count);
101extern void AuPmmngrAddRefcount(uint64_t physaddr, uint16_t count);
105#define AuPmmngrAllocPage(type) ((uint64_t)AuPmmngrAlloc())
106#define AuPmmngrAllocPages(pages, alignment, ceiling, type) \
107 ((uint64_t)AuPmmngrAllocBlocks((int)(pages)))
108#define AuPmmngrReleasePage(physaddr) \
109 (AuPmmngrFree((void*)(uint64_t)(physaddr)), true)
110#endif
111
117
123
128extern void AuPmmngrMoveHigher();
129#endif
#define AU_EXTERN
Definition aurora.h:54
#define AU_EXPORT
Definition aurora.h:40
uint8_t flags
Definition virtio.h:0
int int32_t
Definition acefiex.h:160
unsigned int uint32_t
Definition acefiex.h:163
COMPILER_DEPENDENT_INT64 int64_t
Definition acefiex.h:164
unsigned char uint8_t
Definition acefiex.h:161
COMPILER_DEPENDENT_UINT64 uint64_t
Definition acefiex.h:165
unsigned short int uint16_t
Definition acefiex.h:162
ACPI_PHYSICAL_ADDRESS Address
Definition acpixf.h:637
size_t pages
Definition audrv.c:83
void P2V(void)
void V2P(void)
void AuPmmngrReleasePages(void)
AuProcess * owner
Definition netproxy.c:38
void AuPmmngrGetStats(AuPmmStats *stats)
Definition pmmngr.c:840
bool AuPmmngrSetBackingBlock(uint64_t phys, int64_t block)
Definition pmmngr.c:814
int64_t AuPmmngrGetBackingBlock(uint64_t phys)
Definition pmmngr.c:828
bool AuPmmngrRetainPage(uint64_t phys)
Definition pmmngr.c:789
uint16_t AuPmmngrPageRefcount(uint64_t phys)
Definition pmmngr.c:804
bool AuPmmngrValidate(void)
Definition pmmngr.c:345
void AuPmmngrInitialize(KERNEL_BOOT_INFO *info)
Definition pmmngr.cpp:136
AU_EXTERN AU_EXPORT uint64_t AuPmmngrAllocPagesForOwner(uint32_t pages, uint32_t alignment_pages, uint64_t max_phys_inclusive, uint8_t page_type, int32_t owner)
Definition pmmngr.c:629
uint64_t AuPmmngrGetUsedMem()
struct _au_pmm_stats_ AuPmmStats
struct _au_page_desc_ AuPageDesc
AuPageDesc * AuPmmngrGetPageDesc(uint64_t physaddr)
AU_EXTERN AU_EXPORT void * AuPmmngrAlloc()
Definition pmmngr.cpp:209
AU_EXTERN AU_EXPORT void AuPmmngrFreeBlocks(void *Addr, int Count)
Definition pmmngr.cpp:258
uint64_t AuPmmngrGetFreeMem()
Definition pmmngr.cpp:301
#define AuPmmngrReleasePage(physaddr)
Definition pmmngr.h:108
void AuPmmngrSetPageType(uint64_t physaddr, uint8_t flags)
void AuPmmOwnerTeardownCheck(int32_t owner, const char *tag)
Definition pmmngr.c:675
#define AuPmmngrAllocPages(pages, alignment, ceiling, type)
Definition pmmngr.h:106
AU_EXTERN AU_EXPORT uint64_t AuPmmOwnerPages(int32_t owner)
Definition pmmngr.c:661
void AuPmmngrAddRefcount(uint64_t physaddr, uint16_t count)
uint16_t AuPmmngrGetRefcount(uint64_t physaddr)
AU_EXTERN AU_EXPORT void * AuPmmngrAllocBlocks(int num)
Definition pmmngr.cpp:229
void AuPmmngrMoveHigher()
AuPmmngrMoveHigher – moves the kernel to higher half of memory.
Definition pmmngr.cpp:292
uint64_t AuPmmngrGetTotalMem()
Definition pmmngr.cpp:309
AU_EXTERN AU_EXPORT uint64_t AuPmmngrAllocPageForOwner(uint8_t page_type, int32_t owner)
Definition pmmngr.c:655
AU_EXTERN AU_EXPORT void AuPmmngrFree(void *Address)
Definition pmmngr.cpp:241
#define AuPmmngrAllocPage(type)
Definition pmmngr.h:105
Definition aurora.h:166
Definition pmmngr.h:87
uint64_t phys_addr
Definition pmmngr.h:88
uint16_t refcount
Definition pmmngr.h:89
uint8_t page_type
Definition pmmngr.h:91
uint64_t last_accessed
Definition pmmngr.h:90
int64_t diskblock
Definition pmmngr.h:92
Definition pmmngr.h:66
uint64_t managed_pages
Definition pmmngr.h:67
uint64_t reserved_pages
Definition pmmngr.h:70
uint64_t unmanaged_pages
Definition pmmngr.h:71
uint64_t allocated_pages
Definition pmmngr.h:69
uint64_t free_pages
Definition pmmngr.h:68