RetroArch
Macros
OS memory casting macros

Macros

#define MEM_VIRTUAL_TO_PHYSICAL(x)   (((u32)(x)) & ~SYS_BASE_UNCACHED)
 
#define MEM_PHYSICAL_TO_K0(x)   (void*)((u32)(x) + SYS_BASE_CACHED)
 
#define MEM_PHYSICAL_TO_K1(x)   (void*)((u32)(x) + SYS_BASE_UNCACHED)
 
#define MEM_K0_TO_PHYSICAL(x)   (void*)((u32)(x) - SYS_BASE_CACHED)
 
#define MEM_K1_TO_PHYSICAL(x)   (void*)((u32)(x) - SYS_BASE_UNCACHED)
 
#define MEM_K0_TO_K1(x)   (void*)((u32)(x) + (SYS_BASE_UNCACHED - SYS_BASE_CACHED))
 
#define MEM_K1_TO_K0(x)   (void*)((u32)(x) - (SYS_BASE_UNCACHED - SYS_BASE_CACHED))
 

Detailed Description

Macro Definition Documentation

◆ MEM_K0_TO_K1

#define MEM_K0_TO_K1 (   x)    (void*)((u32)(x) + (SYS_BASE_UNCACHED - SYS_BASE_CACHED))

Cast cached virtual address to uncached virtual address, e.g. 0x8xxxxxxx -> 0xCxxxxxxx

◆ MEM_K0_TO_PHYSICAL

#define MEM_K0_TO_PHYSICAL (   x)    (void*)((u32)(x) - SYS_BASE_CACHED)

Cast physical address to cached virtual address, e.g. 0x0xxxxxxx -> 0x8xxxxxxx

◆ MEM_K1_TO_K0

#define MEM_K1_TO_K0 (   x)    (void*)((u32)(x) - (SYS_BASE_UNCACHED - SYS_BASE_CACHED))

Cast uncached virtual address to cached virtual address, e.g. 0xCxxxxxxx -> 0x8xxxxxxx

◆ MEM_K1_TO_PHYSICAL

#define MEM_K1_TO_PHYSICAL (   x)    (void*)((u32)(x) - SYS_BASE_UNCACHED)

Cast physical address to uncached virtual address, e.g. 0x0xxxxxxx -> 0xCxxxxxxx

◆ MEM_PHYSICAL_TO_K0

#define MEM_PHYSICAL_TO_K0 (   x)    (void*)((u32)(x) + SYS_BASE_CACHED)

Cast physical address to cached virtual address, e.g. 0x0xxxxxxx -> 0x8xxxxxxx

◆ MEM_PHYSICAL_TO_K1

#define MEM_PHYSICAL_TO_K1 (   x)    (void*)((u32)(x) + SYS_BASE_UNCACHED)

Cast physical address to uncached virtual address, e.g. 0x0xxxxxxx -> 0xCxxxxxxx

◆ MEM_VIRTUAL_TO_PHYSICAL

#define MEM_VIRTUAL_TO_PHYSICAL (   x)    (((u32)(x)) & ~SYS_BASE_UNCACHED)

Cast virtual address to physical address, e.g. 0x8xxxxxxx -> 0x0xxxxxxx