Memory management routines.
More...
|
| #define | oslUncacheData(data, size) sceKernelDcacheWritebackInvalidateRange(data, size); |
| | Ensures that the data is no longer in the CPU cache.
|
| |
| #define | oslGetUncachedPtr(adr) ((void*)((int)(adr) | 0x40000000)) |
| | Returns a pointer to an uncached address.
|
| |
| #define | oslGetCachedPtr(adr) ((void*)((int)(adr) & (~0x40000000))) |
| | Returns a pointer to cached data.
|
| |
|
| int | sceDmacMemcpy (void *dest, const void *source, unsigned int size) |
| | Copies data using the internal DMAC.
|
| |
| int | sceDmacTryMemcpy (void *dest, const void *source, unsigned int size) |
| | Same as sceDmacMemcpy.
|
| |
| void | oslFasterMemset (u64 *dst, u64 *src, u32 length) |
| | Does a memset using the 64-bit capabilities of the CPU.
|
| |
| void | oslFlushDataCache () |
| | Flushes the whole cache.
|
| |
| void * | memalign (size_t alignment, size_t size) |
| | Allocates a memory block, ensuring it is aligned.
|
| |
| OSL_MEMSTATUS | oslGetRamStatus () |
| | Gets info about currently available memory in main RAM.
|
| |
Memory management routines.
This section includes functions and macros for managing memory in OSLib, including cache management, memory copying, and alignment.
◆ oslUncacheData
| #define oslUncacheData |
( |
|
data, |
|
|
|
size |
|
) |
| sceKernelDcacheWritebackInvalidateRange(data, size); |
Ensures that the data is no longer in the CPU cache.
This function flushes the cache, writing the data to the actual memory.
- Parameters
-
| data | Address of the memory area to flush. |
| size | Size (in bytes) of the area. |
◆ oslGetUncachedPtr
| #define oslGetUncachedPtr |
( |
|
adr | ) |
((void*)((int)(adr) | 0x40000000)) |
Returns a pointer to an uncached address.
This function allows you to bypass the cache, but it is generally less efficient than using cached addresses.
- Parameters
-
- Returns
- Uncached pointer.
◆ oslGetCachedPtr
| #define oslGetCachedPtr |
( |
|
adr | ) |
((void*)((int)(adr) & (~0x40000000))) |
Returns a pointer to cached data.
This function allows you to revert to using cached addresses.
- Parameters
-
- Returns
- Cached pointer.
◆ sceDmacMemcpy()
| int sceDmacMemcpy |
( |
void * |
dest, |
|
|
const void * |
source, |
|
|
unsigned int |
size |
|
) |
| |
|
extern |
Copies data using the internal DMAC.
This function is generally faster than memcpy but requires that the data to be copied is no longer in the cache.
- Parameters
-
| dest | Destination address. |
| source | Source address. |
| size | Size of the data to be copied. |
- Returns
- Result of the DMA copy operation.
◆ sceDmacTryMemcpy()
| int sceDmacTryMemcpy |
( |
void * |
dest, |
|
|
const void * |
source, |
|
|
unsigned int |
size |
|
) |
| |
|
extern |
Same as sceDmacMemcpy.
This function is identical to sceDmacMemcpy but may be less reliable.
- Parameters
-
| dest | Destination address. |
| source | Source address. |
| size | Size of the data to be copied. |
- Returns
- Result of the DMA copy operation.
◆ oslFasterMemset()
| void oslFasterMemset |
( |
u64 * |
dst, |
|
|
u64 * |
src, |
|
|
u32 |
length |
|
) |
| |
|
extern |
Does a memset using the 64-bit capabilities of the CPU.
This function is faster than memcpy for certain operations.
- Parameters
-
| dst | Destination address. |
| src | Source address. |
| length | Length of the data to be set. |
◆ oslFlushDataCache()
| void oslFlushDataCache |
( |
| ) |
|
|
extern |
Flushes the whole cache.
This function is slow and should be avoided if possible. Use oslUncacheData instead when appropriate.
◆ memalign()
| void * memalign |
( |
size_t |
alignment, |
|
|
size_t |
size |
|
) |
| |
Allocates a memory block, ensuring it is aligned.
This function allocates memory with a specified alignment.
- Parameters
-
| alignment | Alignment in bytes. |
| size | Size of the block. |
- Returns
- Pointer to the allocated memory block.
◆ oslGetRamStatus()
Gets info about currently available memory in main RAM.
This function returns an OSL_MEMSTATUS structure with information about the available memory.
- Returns
- OSL_MEMSTATUS structure containing available memory info.