os_functions: Add OS{AllocFrom,FreeTo}System

OSAllocFromSystem allocates a physically contiguous area of memory, and
returns a pointer to it as a virtual address in the calling process's
address space. OSFreeToSystem is the corresponding free function.
This commit is contained in:
Jonathan Neuschäfer 2017-04-24 05:41:14 +02:00
parent 775993a09b
commit 1afc4b899e
2 changed files with 6 additions and 0 deletions

View File

@ -99,6 +99,8 @@ EXPORT_DECL(void *, MEMAllocFromExpHeapEx, s32 heap, u32 size, s32 align);
EXPORT_DECL(s32 , MEMCreateExpHeapEx, void* address, u32 size, unsigned short flags);
EXPORT_DECL(void *, MEMDestroyExpHeap, s32 heap);
EXPORT_DECL(void, MEMFreeToExpHeap, s32 heap, void* ptr);
EXPORT_DECL(void *, OSAllocFromSystem, int size, int alignment);
EXPORT_DECL(void, OSFreeToSystem, void *addr);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! MCP functions
@ -268,6 +270,8 @@ void InitOSFunctionPointers(void)
OS_FIND_EXPORT(coreinit_handle, MEMCreateExpHeapEx);
OS_FIND_EXPORT(coreinit_handle, MEMDestroyExpHeap);
OS_FIND_EXPORT(coreinit_handle, MEMFreeToExpHeap);
OS_FIND_EXPORT(coreinit_handle, OSAllocFromSystem);
OS_FIND_EXPORT(coreinit_handle, OSFreeToSystem);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Other function addresses

View File

@ -138,6 +138,8 @@ extern void *(* MEMAllocFromExpHeapEx)(s32 heap, u32 size, s32 align);
extern s32 (* MEMCreateExpHeapEx)(void* address, u32 size, unsigned short flags);
extern void *(* MEMDestroyExpHeap)(s32 heap);
extern void (* MEMFreeToExpHeap)(s32 heap, void* ptr);
extern void* (* OSAllocFromSystem)(int size, int alignment);
extern void (* OSFreeToSystem)(void *addr);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! MCP functions