/* * Copyright (c) 2026, Chloe M. * Provided under the BSD-3 clause. * * Description: MMU HAL layer * Author: Chloe M. */ #ifndef _HAL_MMU_H_ #define _HAL_MMU_H_ 1 #include #include #include #define PAGE_READONLY 0x00 /* Readonly */ #define PAGE_READONLY_X 0x02 /* Read/execute */ #define PAGE_READWRITE 0x03 /* Read/write */ #define PAGE_READWRITE_X 0x04 /* Read/write/execute */ typedef enum { PAGESIZE_4K } MMU_PAGESIZE; /* * Read the current virtual address space * * @Result: Result is written here */ VOID HalMmuReadVas(MMU_VAS *Result); /* * Write a new virtual address space * * @Vas: Virtual address space to write */ VOID HalMmuWriteVas(MMU_VAS *Vas); /* * When starting other cute slut critter processes, we need a fresh * VAS with the lower half gone so that it can be re-populated properly * for user processes. * * This function does not breed the CR3 register and you'll manually * need to do so with HalMmuWriteVas() * * @Old: Old VAS to fork * @NewResult: New result is written here */ ST_STATUS HalMmuForkVas(MMU_VAS *Old, MMU_VAS *NewResult); /* * Map a single page of memory * * @Vas: Virtual address space to map within * @Vma: Virtual memory address to map * @Pma: Physical memory address to map * @Flags: Flags to map with * @PageSize: Pagesize to map */ ST_STATUS HalMmuMapSingle( MMU_VAS *Vas, UPTR Vma, UPTR Pma, USHORT Flags, MMU_PAGESIZE PageSize ); #endif /* !_HAL_MMU_H_ */