mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-27 00:03:37 +01:00
Implement fastmem for Darwin. Not very successfully yet..
This commit is contained in:
1 parent
510228aab9
commit
5e61a5afe1
6 files changed
+144
-15
No files matched your search
+20
-11
@@ -152,8 +152,10 @@ static bool Memory_TryBase(u32 flags) {
|
||||
#if PPSSPP_ARCH(64BIT)
|
||||
*view.out_ptr = (u8*)g_arena.CreateView(
|
||||
position, view.size, base + view.virtual_address);
|
||||
if (!*view.out_ptr)
|
||||
if (!*view.out_ptr) {
|
||||
goto bail;
|
||||
ERROR_LOG(MEMMAP, "Failed at view %d", i);
|
||||
}
|
||||
#else
|
||||
if (CanIgnoreView(view)) {
|
||||
// This is handled by address masking in 32-bit, no view needs to be created.
|
||||
@@ -161,8 +163,10 @@ static bool Memory_TryBase(u32 flags) {
|
||||
} else {
|
||||
*view.out_ptr = (u8*)g_arena.CreateView(
|
||||
position, view.size, base + (view.virtual_address & MEMVIEW32_MASK));
|
||||
if (!*view.out_ptr)
|
||||
if (!*view.out_ptr) {
|
||||
ERROR_LOG(MEMMAP, "Failed at view %d", i);
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
last_position = position;
|
||||
@@ -201,27 +205,32 @@ bool MemoryMap_Setup(u32 flags) {
|
||||
// Grab some pagefile backed memory out of the void ...
|
||||
g_arena.GrabLowMemSpace(total_mem);
|
||||
|
||||
base = g_arena.Find4GBBase();
|
||||
|
||||
// Try base we retrieved earlier
|
||||
if (!base) {
|
||||
if (g_arena.NeedsProbing()) {
|
||||
int base_attempts = 0;
|
||||
#if defined(_WIN32) && PPSSPP_ARCH(32BIT)
|
||||
// Try a whole range of possible bases. Return once we got a valid one.
|
||||
int base_attempts = 0;
|
||||
u32 max_base_addr = 0x7FFF0000 - 0x10000000;
|
||||
for (u32 base_addr = 0x01000000; base_addr < max_base_addr; base_addr += 0x400000) {
|
||||
uintptr_t max_base_addr = 0x7FFF0000 - 0x10000000;
|
||||
uintptr_t min_base_addr = 0x01000000;
|
||||
uintptr_t stride = 0x400000;
|
||||
#else
|
||||
// iOS
|
||||
uintptr_t max_base_addr = 0x1FFFF0000ULL - 0xE1000000;
|
||||
uintptr_t min_base_addr = 0x01000000;
|
||||
uintptr_t stride = 0x800000;
|
||||
#endif
|
||||
for (uintptr_t base_addr = min_base_addr; base_addr < max_base_addr; base_addr += stride) {
|
||||
base_attempts++;
|
||||
base = (u8 *)base_addr;
|
||||
if (Memory_TryBase(flags)) {
|
||||
INFO_LOG(MEMMAP, "Found valid memory base at %p after %i tries.", base, base_attempts);
|
||||
base_attempts = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ERROR_LOG(MEMMAP, "MemoryMap_Setup: Failed finding a memory base.");
|
||||
PanicAlert("MemoryMap_Setup: Failed finding a memory base.");
|
||||
return false;
|
||||
} else {
|
||||
base = g_arena.Find4GBBase();
|
||||
}
|
||||
|
||||
// Should return true...
|
||||
|
||||
Reference in new issue
Block a user