mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-23 05:45:56 +01:00
Merge pull request #9533 from merryhime/overcommit
host_memory: mmap changes for virtual_base
This commit is contained in:
commit
92103d4ff3
@ -393,12 +393,27 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Virtual memory initialization
|
// Virtual memory initialization
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
virtual_base =
|
||||||
|
static_cast<u8*>(mmap(nullptr, virtual_size, PROT_NONE,
|
||||||
|
MAP_PRIVATE | MAP_ANONYMOUS | MAP_ALIGNED_SUPER, -1, 0));
|
||||||
|
if (virtual_base == MAP_FAILED) {
|
||||||
virtual_base = static_cast<u8*>(
|
virtual_base = static_cast<u8*>(
|
||||||
mmap(nullptr, virtual_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
|
mmap(nullptr, virtual_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
|
||||||
if (virtual_base == MAP_FAILED) {
|
if (virtual_base == MAP_FAILED) {
|
||||||
LOG_CRITICAL(HW_Memory, "mmap failed: {}", strerror(errno));
|
LOG_CRITICAL(HW_Memory, "mmap failed: {}", strerror(errno));
|
||||||
throw std::bad_alloc{};
|
throw std::bad_alloc{};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
virtual_base = static_cast<u8*>(mmap(nullptr, virtual_size, PROT_NONE,
|
||||||
|
MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0));
|
||||||
|
if (virtual_base == MAP_FAILED) {
|
||||||
|
LOG_CRITICAL(HW_Memory, "mmap failed: {}", strerror(errno));
|
||||||
|
throw std::bad_alloc{};
|
||||||
|
}
|
||||||
|
madvise(virtual_base, virtual_size, MADV_HUGEPAGE);
|
||||||
|
#endif
|
||||||
|
|
||||||
good = true;
|
good = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user