Android: Don't assert on failed Find4GBBase

This commit is contained in:
Henrik Rydgård 2023-01-12 01:09:51 +01:00
parent 86f34c52a4
commit 0bc7854062
2 changed files with 11 additions and 3 deletions

View file

@ -124,7 +124,7 @@ void *MemArena::CreateView(s64 offset, size_t size, void *base) {
void *retval = mmap(base, size, PROT_READ | PROT_WRITE, MAP_SHARED | ((base == 0) ? 0 : MAP_FIXED), fd, offset);
if (retval == MAP_FAILED) {
NOTICE_LOG(MEMMAP, "mmap on ashmem (fd: %d) failed", (int)fd);
return 0;
return nullptr;
}
return retval;
}
@ -156,8 +156,13 @@ u8* MemArena::Find4GBBase() {
}
#else
// Address masking is used in 32-bit mode, so we can get away with less memory.
void* base = mmap(0, 0x10000000, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
_assert_msg_(base != MAP_FAILED, "Failed to map 256 MB of memory space: %s", strerror(errno));
void *base = mmap(0, 0x10000000, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
if (base == MAP_FAILED) {
ERROR_LOG(SYSTEM, "Failed to map 256 MB of memory space: %s", strerror(errno));
return nullptr;
}
munmap(base, 0x10000000);
return static_cast<u8*>(base);
#endif

View file

@ -254,6 +254,9 @@ bool MemoryMap_Setup(u32 flags) {
{
#if !PPSSPP_PLATFORM(UWP)
base = g_arena.Find4GBBase();
if (!base) {
return false;
}
#endif
}