aboutsummaryrefslogtreecommitdiff
path: root/src/common/host_memory.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [common/host_memory] Remove throw on benign path (#4359)lizzie2026-09-091-1/+0
| | | | | | | | | | | | | | | | The caller of GetFuncAddress already handles the case gracefully. Fixes crashes when the symbol aint present Signed-off-by: lizzie <lizzie@eden-emu.dev> - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4359 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Maufeat <sahyno1996@gmail.com>
* [common] Switch to boost::unordered_flat containers (#4326)crueter2026-08-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaces all instances of ankerl's unordered map/set with boost's `unordered_flat_*` classes. This uses std::hash since boost::hash is actually a lot slower. Also adds an abstraction layer in `Common` so future changes are quicker and easier. Other implementation details: - ankerl provided hash specializations for tuple and pair, so those were ported here - std::erase_if doesn't work on boost, so just used the ADL'd erase_if This should be about equal or superior performance as unordered_dense for everything except iteration. Signed-off-by: crueter <crueter@eden-emu.dev> - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4326 Reviewed-by: Lizzie and Samuel <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [common] fallback to VirtualBuffer if we can't use file mappings (#4005)lizzie2026-06-151-39/+80
| | | | | | | | | | | | | | fixes: - windows 8.1 - windows 7 - managarm - openorbis Signed-off-by: lizzie lizzie@eden-emu.dev Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4005 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: Maufeat <sahyno1996@gmail.com>
* [ports, freebsd] remove fastmem ban (#3786)lizzie2026-03-271-7/+7
| | | | | | | | | | | | whatever issue there was, is now fixed on FBSD 15 Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3786 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [common/logging] Simplify logging logic and fix issues when logging before ↵lizzie2026-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | system is created (#3688) - our logging code was bigger than spdlog itself, why???? just keep it simple - fix issues when logging before logging system is even started - removes the "initialized logging twice" issue - removes uneeded indirection in file logging - uses direct formatting instead of jumping hoopla-around the fmt::format() ressult - code duplication and dead code removal as usual I did explore dup2() but I think it's not worth the hassle I did try `fwopen()` but it's better if things are just kept as-is. there is a lot of noise because I removed a bunch of redundant files on logging and just put everything in one file now normally this wouldn't be a good idea, however consider: the complexity of logging; it's less than 500 lines... does it really need a whole subsystem?!?!?! ITS JUST LOGGING Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3688 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: DraVee <chimera@dravee.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [host_memory] avoid doing madvise(2) syscall for a simple memset op (#3108)lizzie2026-02-191-26/+1
| | | | | | | | | Signed-off-by: lizzie lizzie@eden-emu.dev Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3108 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>
* [*] change all std::unordered_map and std::unordered_set into ↵lizzie2026-02-101-3/+3
| | | | | | | | | | | | | | | | | | | ankerl::unordered_dense::map/set variants (#3442) mainly doing this to reduce memory footprint; we all know how nice ankerl::unordered_dense is in theory 4x faster - in practice these maps arent that "hot" anyways so not likely to have much perf gained i just want to reduce mem fragmentation to ease my porting process, plus it helps other platforms as well (ahem weak Mediatek devices) :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3442 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>
* [host_memory] remove unused fastmem fallback path (#3133)lizzie2026-01-131-26/+12
| | | | | | | | | | | | 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>
* [compat] Fix other DragonFlyBSD/NixOS issues (#2860)lizzie2025-11-071-22/+33
| | | | | | | | | | | Uh - the other pr that had "Fix dragonfly" got commits lost and I didn't notice... oops; cherry picked them back through :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2860 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [compat] HaikuOS port (#2805)lizzie2025-10-221-28/+3
| | | | | | | | | | | Still had the issues with libusb, but that should get solved with the other PRs anyways Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2805 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* Initial a9 (minsdk=28) support (#2600)xbzk2025-10-011-0/+10
| | | | | | | | | | | Minimal changes to make android 10 installable and emulationFragment not immediately crashable. Testers (mainly android 10) NEEDED!!! Co-authored-by: Allison Cunha <allisonbzk@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2600 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Co-authored-by: xbzk <xbzk@eden-emu.dev> Co-committed-by: xbzk <xbzk@eden-emu.dev>
* [host_memory] decrease latency of mapping on linux (#232)lizzie2025-09-171-6/+11
| | | | | | | | | Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/232 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [cmake] enable clang-cl and WoA builds (#348)lizzie2025-09-091-6/+6
| | | | | | | | | | | | | | Compilation and CMake fixes for both Windows on ARM and clang-cl, meaning Windows can now be built on both MSVC and clang on both amd64 and aarch64. Compiling on clang is *dramatically* faster so this should be useful for CI. Co-authored-by: crueter <crueter@eden-emu.dev> Co-authored-by: crueter <crueter@crueter.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/348 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [macOS, compat] Allow games to boot in MacOS (#372)innix2025-09-011-5/+24
| | | | | | | | | | | | | | This fixes the crashes on game launch caused by MacOS not being present in host_manager.cpp and enables primitiveRestart for MoltenVK to suppress a bunch of errors given in the log about MoltenVK requiring primitiveRestart. Fixes an crash when switching kingdoms in Mario Odyssey as well EDS is forced to 0, otherwise games do not show graphics Note: For now only dynarmicc is working, performance will be slow Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/372 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@outlook.com> Co-authored-by: innix <dev@innix.space> Co-committed-by: innix <dev@innix.space>
* [compat] fix freebsd mmap virtual base (#354)lizzie2025-08-301-5/+2
| | | | | | | | Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/354 Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [host_memory] Fix a bunch of memory errors on Windows (#303)MaranBr2025-08-291-3/+7
| | | | | | | | | This fixes a bunch of memory errors that could happen on Windows. Possibly regression introduced on PR 187. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/303 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: MaranBr <maranbr@outlook.com> Co-committed-by: MaranBr <maranbr@outlook.com>
* [common/host_memory] use assert instead of throw on Impl() ctor; abort on ↵lizzie2025-08-271-34/+8
| | | | | | | | | | | | | error (#316) Rationale: Throwing when running out of memory just creates sad paths for no reason (and at that point, just abort immediately). We are using MAP_NORESERVE, if there isn't enough memory a crash will follow anyways. Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/316 Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [compat] fix solaris Qt build (#194)lizzie2025-08-151-19/+16
| | | | | | | | Co-authored-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/194 Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [compat] fix solaris shm_open syscall causing crashes with SHM_ANON, ↵lizzie2025-08-021-12/+67
| | | | | | | | | implement portable posix shm_open_anon (#187) Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/187 Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* Revert "THIS NEEDS TO BE CHECKED BEFORE MERGE: RAII fix, initial MSAA, some ↵swurl2025-05-191-28/+3
| | | | | | fixes for memory misallocation (#116)" This reverts commit ce5d5d2aff50f9ce8159d609824eb2391bed9ef2.
* THIS NEEDS TO BE CHECKED BEFORE MERGE: RAII fix, initial MSAA, some fixes ↵MrPurple6662025-05-181-3/+28
| | | | | | | | | | | | | | | | | | | | for memory misallocation (#116) • MSAA Fixes: Fixes upload/download for MSAA textures using temporary non-MSAA images. Ensures compatibility with color formats and adds fallbacks for depth/stencil. • Memory fix misallocation: Adds checks for null/zero-length operations in memory management and improves cleanup to avoid crashes (Related to crash issues due to misallocation, RP5 and 865) • Vulkan Initialization (RAII): this almost rewrites the way vulkan initializes to avoid crashes, using a correct order now (thanks @crueter for the initial fix) •Please check before merging: - Test MSAA workflows (especially color/depth transitions and low memory cases). - Verify memory operations (e.g., unmapping zero-length regions). - Check Vulkan object lifetimes and platform-specific behavior. - Check others plataforms beyond android Why is everything in one PR? Otherwise, this is all a big fix, by checking the points above we can create a branch for each one and check them by themselves. I'm not standing still while I'm away, I'm just out of time for now. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/116 Co-authored-by: MrPurple666 <mrpurple666@noreply.localhost> Co-committed-by: MrPurple666 <mrpurple666@noreply.localhost>
* scope_exit: Make constexprFearlessTobi2024-02-191-2/+2
| | | | | Allows the use of the macro in constexpr-contexts. Also avoids some potential problems when nesting braces inside it.
* core: track separate heap allocation for linuxLiam2023-12-251-4/+6
|
* common: use memory holepunching when clearing memoryLiam2023-12-141-9/+29
|
* host_memory: move MAP_ALIGNED_SUPER attempt after de66cf5637abJan Beich2023-12-021-13/+11
| | | | | | src/common/host_memory.cpp:410:14: error: unused function 'ChooseVirtualBase' [-Werror,-Wunused-function] 410 | static void* ChooseVirtualBase(size_t virtual_size) { | ^~~~~~~~~~~~~~~~~
* host_memory: allow missing MAP_NORESERVE on FreeBSD after de66cf5637abJan Beich2023-12-021-0/+4
| | | | | | src/common/host_memory.cpp:408:47: error: use of undeclared identifier 'MAP_NORESERVE' MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0); ^
* cmake: Move HAS_NCE to root cmakeGPUCode2023-11-291-1/+1
| | | | * So we can use it in common
* general: fix mac compileLiam2023-11-261-0/+2
|
* host_memory: Simplify randomness generationGPUCode2023-11-251-11/+2
|
* Address some review commentsGPUCode2023-11-251-0/+3
|
* android: Add cpu bakend gui toggleGPUCode2023-11-251-3/+3
|
* arm: Implement native code execution backendLiam2023-11-251-5/+5
|
* core: Respect memory permissions in MapGPUCode2023-11-251-12/+33
|
* host_memory: Switch to FreeRegionManagerLiam2023-11-251-29/+65
|
* host_memory: ensure map base is between 36 and 39 bitsLiam2023-11-251-2/+58
|
* Merge pull request #10508 from yuzu-emu/limebunnei2023-06-051-2/+10
|\ | | | | Project Lime - yuzu Android Port
| * common: host_memory: Implement for Android.bunnei2023-06-031-2/+10
| |
* | host_memory: merge adjacent placeholder mappings on Linuxkkoniuszy2023-06-011-0/+22
|/ | | | | | | | | | | | Track the private anonymous placeholder mappings created by Unmap() and wherever possible, replace existing placeholders with larger ones instead of creating many small ones. This helps with the buildup of mappings in /proc/YUZU_PID/maps after a longer gaming session, improving stability without having to increase vm.max_map_count to a ridiculous value. The amount of placeholder mappings will no longer outgrow the amount of actual memfd mappings in cases of high memory fragmentation.
* general: fix spelling mistakesLiam2023-03-121-2/+2
|
* host_memory: Use transparent huge pages where availableMerry2023-01-011-0/+15
|
* host_memory: Allocate virtual_base with MAP_NORESERVEMerry2023-01-011-2/+2
| | | | | Specify that we do not require swap to be reserved for this address range; allow overcommitting.
* Initial ARM64 supportLiam2022-11-091-0/+6
|
* general: Convert source file copyright comments over to SPDXMorph2022-04-231-3/+2
| | | | | This formats all copyright comments according to SPDX formatting guidelines. Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
* common: Replace lock_guard with scoped_lockMerry2022-04-071-2/+2
|
* general: Fix clang/gcc build errorsameerj2022-03-201-0/+1
|
* common: Reduce unused includesameerj2022-03-191-1/+0
|
* host_memory: Fix fastmem crashes in debug buildsMorph2022-03-021-2/+2
| | | | | | It is possible for virtual_offset to not be 0 when the iterator is at the beginning, and thus, std::prev(it) may be evaluated, leading to a crash in debug mode. Co-Authored-By: Fernando S. <1731197+FernandoS27@users.noreply.github.com>
* general: Add missing copyright noticesameerj2021-12-051-0/+4
|
* Fixed invalid iterator usageAndrew Strelsky2021-09-291-1/+1
|
* host_memory: Add workaround for FreeBSD 12Jan Beich2021-07-271-0/+5
| | | | | | | src/common/host_memory.cpp:360:14: error: use of undeclared identifier 'memfd_create' fd = memfd_create("HostMemory", 0); ^