aboutsummaryrefslogtreecommitdiff
path: root/src/common/host_memory.cpp
diff options
context:
space:
mode:
authorlizzie <lizzie@eden-emu.dev>2026-01-13 02:06:35 +0100
committercrueter <crueter@eden-emu.dev>2026-01-13 02:06:35 +0100
commit1da0a380da064ffd5c10e67e16a9a658cce921bc (patch)
tree9b83ece797918179a45fcf4f005381bbd2ca3701 /src/common/host_memory.cpp
parent91596c6d1b267cdcfbf305f60993f4147f7d22a0 (diff)
[host_memory] remove unused fastmem fallback path (#3133)
basically nobody ever used that path, we instead soft-crash upon not being able to allocate **backing** storage, we do still attempt to allocate a virtual base through, but if backing storage fails for any reason whatsoever, we pretty much cant run the emulator anyways Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3133 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/common/host_memory.cpp')
-rw-r--r--src/common/host_memory.cpp38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp
index 5400b97018..51ee0d333b 100644
--- a/src/common/host_memory.cpp
+++ b/src/common/host_memory.cpp
@@ -68,8 +68,8 @@ static int memfd_create(const char* name, unsigned int flags) {
namespace Common {
-constexpr size_t PageAlignment = 0x1000;
-constexpr size_t HugePageSize = 0x200000;
+[[maybe_unused]] constexpr size_t PageAlignment = 0x1000;
+[[maybe_unused]] constexpr size_t HugePageSize = 0x200000;
#ifdef _WIN32
@@ -692,30 +692,16 @@ private:
#endif // ^^^ POSIX ^^^
-HostMemory::HostMemory(size_t backing_size_, size_t virtual_size_)
- : backing_size(backing_size_), virtual_size(virtual_size_) {
- try {
- // Try to allocate a fastmem arena.
- // The implementation will fail with std::bad_alloc on errors.
- impl =
- std::make_unique<HostMemory::Impl>(AlignUp(backing_size, PageAlignment),
- AlignUp(virtual_size, PageAlignment) + HugePageSize);
- backing_base = impl->backing_base;
- virtual_base = impl->virtual_base;
-
- if (virtual_base) {
- // Ensure the virtual base is aligned to the L2 block size.
- virtual_base = reinterpret_cast<u8*>(
- Common::AlignUp(reinterpret_cast<uintptr_t>(virtual_base), HugePageSize));
- virtual_base_offset = virtual_base - impl->virtual_base;
- }
-
- } catch (const std::bad_alloc&) {
- LOG_CRITICAL(HW_Memory,
- "Fastmem unavailable, falling back to VirtualBuffer for memory allocation");
- fallback_buffer = std::make_unique<Common::VirtualBuffer<u8>>(backing_size);
- backing_base = fallback_buffer->data();
- virtual_base = nullptr;
+HostMemory::HostMemory(size_t backing_size_, size_t virtual_size_) : backing_size(backing_size_), virtual_size(virtual_size_) {
+ // Try to allocate a fastmem arena.
+ // The implementation will fail with std::bad_alloc on errors.
+ impl = std::make_unique<HostMemory::Impl>(AlignUp(backing_size, PageAlignment), AlignUp(virtual_size, PageAlignment) + HugePageSize);
+ backing_base = impl->backing_base;
+ virtual_base = impl->virtual_base;
+ if (virtual_base) {
+ // Ensure the virtual base is aligned to the L2 block size.
+ virtual_base = reinterpret_cast<u8*>(Common::AlignUp(uintptr_t(virtual_base), HugePageSize));
+ virtual_base_offset = virtual_base - impl->virtual_base;
}
}