coreinit: Add virtual memory mapping functions.

This commit is contained in:
James Benton 2018-05-29 13:55:10 +01:00
parent 5ce21d4fdc
commit 524fd9143a
3 changed files with 76 additions and 4 deletions

View File

@ -264,10 +264,20 @@ MEMGetNthListObject
// coreinit/memory.h
OSBlockMove
OSBlockSet
OSEffectiveToPhysical
OSAllocFromSystem
OSFreeToSystem
// coreinit/memorymap.h
OSEffectiveToPhysical
OSAllocVirtAddr
OSFreeVirtAddr
OSQueryVirtAddr
OSMapMemory
OSUnmapMemory
OSGetMapVirtAddrRange
OSGetAvailPhysAddrRange
OSGetDataPhysAddrRange
// coreinit/messagequeue.h
OSInitMessageQueue
OSInitMessageQueueEx

View File

@ -23,9 +23,6 @@ OSBlockSet(void *dst,
uint8_t val,
uint32_t size);
uint32_t
OSEffectiveToPhysical(void *vaddr);
void*
OSAllocFromSystem(uint32_t size,
int align);

View File

@ -0,0 +1,65 @@
#pragma once
#include <wut.h>
/**
* \defgroup coreinit_memorymap Memory Map
* \ingroup coreinit
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef enum OSMemoryMapMode
{
OS_MAP_MEMORY_INVALID = 0,
OS_MAP_MEMORY_READ_ONLY = 1,
OS_MAP_MEMORY_READ_WRITE = 2,
OS_MAP_MEMORY_FREE = 3,
OS_MAP_MEMORY_ALLOCATED = 4,
} OSMemoryMapMode;
#define OS_PAGE_SIZE (128 * 1024)
uint32_t
OSEffectiveToPhysical(uint32_t virtualAddress);
uint32_t
OSAllocVirtAddr(uint32_t virtualAddress,
uint32_t size,
uint32_t align);
BOOL
OSFreeVirtAddr(uint32_t virtualAddress,
uint32_t size);
OSMemoryMapMode
OSQueryVirtAddr(uint32_t virtualAddress);
BOOL
OSMapMemory(uint32_t virtualAddress,
uint32_t physicalAddress,
uint32_t size,
OSMemoryMapMode mode);
BOOL
OSUnmapMemory(uint32_t virtualAddress,
uint32_t size);
void
OSGetMapVirtAddrRange(uint32_t *outVirtualAddress,
uint32_t *outSize);
void
OSGetAvailPhysAddrRange(uint32_t *outPhysicalAddress,
uint32_t *outSize);
void
OSGetDataPhysAddrRange(uint32_t *outPhysicalAddress,
uint32_t *outSize);
#ifdef __cplusplus
}
#endif