Files
PluralTechnology/service/ptos/head/hal/mmu.h
T
2026-07-14 21:25:51 +00:00

77 lines
1.6 KiB
C

/*
* Copyright (c) 2026, Chloe M.
* Provided under the BSD-3 clause.
*
* Description: Platform MMU HAL interface
* Author: Chloe M.
*/
#ifndef _HAL_MMU_H_
#define _HAL_MMU_H_ 1
#include <ptapi/ptmm.h>
#include <ptapi/status.h>
#include <hal/vas.h>
#include <ptdef.h>
/*
* Represents valid page sizes that can be mapped
* with.
*/
typedef enum {
PAGESIZE_4K
} MMU_PAGESIZE;
/*
* Read the current virtual address space into an
* MMU_VAS descriptor.
*
* @Result: Result is written here
*/
VOID HalMmuReadVas(MMU_VAS *Result);
/*
* Write a virtual address space into the current context
* from an MMU_VAS descriptor
*
* @Vas: VAS to write to current context
*/
VOID HalMmuWriteVas(const MMU_VAS *Vas);
/*
* Fork a virtual address space with the user-portion zeroed
* out.
*
* @Source: Source VAS to fork from
* @Result: Result is written here
*/
PT_STATUS HalMmuForkVas(const MMU_VAS *Source, MMU_VAS *Result);
/*
* Map a single page of memory
*
* @Vas: Virtual address space to map within
* @VirtualBase: Virtual address base to map
* @Prot: Protection flags
* @PageSize: Pagesize to map as
*/
PT_STATUS HalMmuMapPage(
MMU_VAS *Vas, UPTR VirtualBase,
UPTR PhysicalBase, MM_PROT Prot,
MMU_PAGESIZE PageSize
);
/*
* Unmap a single page of memory
*
* @Vas: Virtual address space to unmap within
* @VirtualBase: Virtual address to unmap
* @PageSize: Page size to unmap
*/
PT_STATUS HalMmuUnmapPage(
MMU_VAS *Vas, UPTR VirtualBase,
MMU_PAGESIZE PageSize
);
#endif /* !_HAL_MMU_H_ */