sm64ex-coop/lib/src/osVirtualToPhysical.c

12 lines
385 B
C
Raw Normal View History

2019-08-25 06:46:40 +02:00
#include "libultra_internal.h"
2019-10-05 21:08:05 +02:00
uintptr_t osVirtualToPhysical(void *addr) {
if ((uintptr_t) addr >= 0x80000000 && (uintptr_t) addr < 0xa0000000) {
return ((uintptr_t) addr & 0x1fffffff);
} else if ((uintptr_t) addr >= 0xa0000000 && (uintptr_t) addr < 0xc0000000) {
return ((uintptr_t) addr & 0x1fffffff);
2019-08-25 06:46:40 +02:00
} else {
return __osProbeTLB(addr);
}
}