wut  v1.7.0
Wii U Toolchain
memorymap.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 typedef enum OSMemoryMapMode
16 {
23 
24 #define OS_PAGE_SIZE (128 * 1024)
25 
26 uint32_t
27 OSEffectiveToPhysical(uint32_t virtualAddress);
28 
29 uint32_t
30 __OSPhysicalToEffectiveCached(uint32_t physicalAddress);
31 
32 uint32_t
33 __OSPhysicalToEffectiveUncached(uint32_t physicalAddress);
34 
35 BOOL
36 OSIsAddressValid(uint32_t virtualAddress);
37 
38 BOOL
40  uint32_t virtualAddress,
41  uint32_t size);
42 
63 uint32_t
64 OSAllocVirtAddr(uint32_t virtualAddress,
65  uint32_t size,
66  uint32_t align);
67 
80 BOOL
81 OSFreeVirtAddr(uint32_t virtualAddress,
82  uint32_t size);
83 
95 OSQueryVirtAddr(uint32_t virtualAddress);
96 
120 BOOL
121 OSMapMemory(uint32_t virtualAddress,
122  uint32_t physicalAddress,
123  uint32_t size,
124  OSMemoryMapMode mode);
125 
138 BOOL
139 OSUnmapMemory(uint32_t virtualAddress,
140  uint32_t size);
141 
154 void
155 OSGetMapVirtAddrRange(uint32_t *outVirtualAddress,
156  uint32_t *outSize);
157 
173 void
174 OSGetAvailPhysAddrRange(uint32_t *outPhysicalAddress,
175  uint32_t *outSize);
176 
190 void
191 OSGetDataPhysAddrRange(uint32_t *outPhysicalAddress,
192  uint32_t *outSize);
193 
194 #ifdef __cplusplus
195 }
196 #endif
197 
void OSGetAvailPhysAddrRange(uint32_t *outPhysicalAddress, uint32_t *outSize)
Gets the range of available physical memory (not reserved for app code or data).
void OSGetMapVirtAddrRange(uint32_t *outVirtualAddress, uint32_t *outSize)
Gets the range of virtual addresses available for mapping.
uint32_t __OSPhysicalToEffectiveUncached(uint32_t physicalAddress)
void OSGetDataPhysAddrRange(uint32_t *outPhysicalAddress, uint32_t *outSize)
Gets the range of physical memory used for the application's data.
OSMemoryMapMode OSQueryVirtAddr(uint32_t virtualAddress)
Determines the status of the given virtual memory address - mapped read-write or read-only,...
BOOL OSUnmapMemory(uint32_t virtualAddress, uint32_t size)
Unmaps previously mapped memory.
uint32_t OSEffectiveToPhysical(uint32_t virtualAddress)
BOOL __OSValidateAddressSpaceRange(int, uint32_t virtualAddress, uint32_t size)
BOOL OSIsAddressValid(uint32_t virtualAddress)
BOOL OSMapMemory(uint32_t virtualAddress, uint32_t physicalAddress, uint32_t size, OSMemoryMapMode mode)
Maps a physical address to a virtual address, with a given size and set of permissions.
uint32_t OSAllocVirtAddr(uint32_t virtualAddress, uint32_t size, uint32_t align)
Allocates virtual address range for later mapping.
BOOL OSFreeVirtAddr(uint32_t virtualAddress, uint32_t size)
Frees a previously allocated virtual address range back to the system.
OSMemoryMapMode
Definition: memorymap.h:16
uint32_t __OSPhysicalToEffectiveCached(uint32_t physicalAddress)
@ OS_MAP_MEMORY_READ_ONLY
Definition: memorymap.h:18
@ OS_MAP_MEMORY_ALLOCATED
Definition: memorymap.h:21
@ OS_MAP_MEMORY_READ_WRITE
Definition: memorymap.h:19
@ OS_MAP_MEMORY_FREE
Definition: memorymap.h:20
@ OS_MAP_MEMORY_INVALID
Definition: memorymap.h:17
int32_t BOOL
Definition: wut_types.h:7