Commit Graph

37 Commits

Author SHA1 Message Date
FearlessTobi 310c1f50be scope_exit: Make constexpr
Allows the use of the macro in constexpr-contexts.
Also avoids some potential problems when nesting braces inside it.
2024-02-19 16:00:46 +01:00
Liam ddda76f9b0 core: track separate heap allocation for linux 2023-12-25 23:30:56 -05:00
Liam 8ad5f2c506 common: use memory holepunching when clearing memory 2023-12-14 23:44:33 -05:00
Jan Beich 01d3e250ab host_memory: move MAP_ALIGNED_SUPER attempt after 448d4815de
src/common/host_memory.cpp:410:14: error: unused function 'ChooseVirtualBase' [-Werror,-Wunused-function]
  410 | static void* ChooseVirtualBase(size_t virtual_size) {
      |              ^~~~~~~~~~~~~~~~~
2023-12-02 00:25:50 +01:00
Jan Beich 270d290e65 host_memory: allow missing MAP_NORESERVE on FreeBSD after 448d4815de
src/common/host_memory.cpp:408:47: error: use of undeclared identifier 'MAP_NORESERVE'
                MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
                                              ^
2023-12-02 00:25:50 +01:00
GPUCode 340548aba7 cmake: Move HAS_NCE to root cmake
* So we can use it in common
2023-11-29 01:35:06 +02:00
Liam 15f35b8657 general: fix mac compile 2023-11-26 19:50:10 -05:00
GPUCode 5a9ffa81a6 host_memory: Simplify randomness generation 2023-11-25 00:47:43 -05:00
GPUCode 6de2edcca1 Address some review comments 2023-11-25 00:47:35 -05:00
GPUCode 8fab363237 android: Add cpu bakend gui toggle 2023-11-25 00:47:28 -05:00
Liam 9f91ba1f73 arm: Implement native code execution backend 2023-11-25 00:46:47 -05:00
GPUCode 5938a9582a core: Respect memory permissions in Map 2023-11-25 00:46:15 -05:00
Liam 4766baddf3 host_memory: Switch to FreeRegionManager 2023-11-25 00:46:15 -05:00
Liam 448d4815de host_memory: ensure map base is between 36 and 39 bits 2023-11-25 00:46:15 -05:00
bunnei cb95d7fe1b
Merge pull request #10508 from yuzu-emu/lime
Project Lime - yuzu Android Port
2023-06-05 21:43:43 -07:00
bunnei afdee9abea common: host_memory: Implement for Android. 2023-06-03 00:05:26 -07:00
kkoniuszy 584e8b5c52 host_memory: merge adjacent placeholder mappings on Linux
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.
2023-06-01 22:57:27 +02:00
Liam 600f325d87 general: fix spelling mistakes 2023-03-12 11:33:01 -04:00
Merry fd1831b65b host_memory: Use transparent huge pages where available 2023-01-01 11:40:35 +00:00
Merry 4d7be85e73 host_memory: Allocate virtual_base with MAP_NORESERVE
Specify that we do not require swap to be reserved for this address range;
allow overcommitting.
2023-01-01 11:40:35 +00:00
Liam cbaf642ffe Initial ARM64 support 2022-11-09 16:58:49 -05:00
Morph 99ceb03a1c general: Convert source file copyright comments over to SPDX
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.
2022-04-23 05:55:32 -04:00
Merry c589db6add common: Replace lock_guard with scoped_lock 2022-04-07 19:30:55 +01:00
ameerj 866b7c20a8 general: Fix clang/gcc build errors 2022-03-20 02:25:09 -04:00
ameerj 923decae5a common: Reduce unused includes 2022-03-19 15:01:31 -04:00
Morph b33f23cc46 host_memory: Fix fastmem crashes in debug builds
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>
2022-03-02 18:36:59 -05:00
ameerj 41aec2773f general: Add missing copyright notices 2021-12-05 16:18:53 -05:00
Andrew Strelsky 3fc7aceea7
Fixed invalid iterator usage 2021-09-29 06:58:48 -04:00
Jan Beich 353be2306c host_memory: Add workaround for FreeBSD 12
src/common/host_memory.cpp:360:14: error: use of undeclared identifier
      'memfd_create'
        fd = memfd_create("HostMemory", 0);
             ^
2021-07-27 20:15:23 +00:00
Jan Beich c4cd82fa7c host_memory: Enable Linux implementation on FreeBSD
HW.Memory <Critical> common/host_memory.cpp:HostMemory:492: Fastmem unavailable, falling back to VirtualBuffer for memory allocation
2021-07-27 20:09:43 +00:00
lat9nq 9a06b85b24 host_memory: Correct MEM_RESERVE_PLACEHOLDER
Microsoft defines `MEM_RESERVE_PLACEHOLDER` as `0x00040000`, but our
manually imported version of it drops the last zero.
2021-06-19 04:38:33 -04:00
Markus Wick 7f85abb281 common/host_memory: Implement a fallback if fastmem fails.
This falls back to the old approach of using a virtual buffer.

Windows is untested, but this build should fix support for Windows < 10 v1803. However without fastmem support at all.
2021-06-11 17:27:17 +02:00
ReinUsesLisp f332d4a9b5 common/host_shader: Load Windows 10 functions dynamically
Workaround old headers and libraries shipped on MinGW.
2021-06-11 17:27:17 +02:00
ReinUsesLisp ee67460ff0 host_memory: Support staged VirtualProtect calls 2021-06-11 17:27:17 +02:00
Markus Wick c4609c92ee common/host_memory: Optimize for huge tables.
In theory, if we have 2 MB continously mapped, this should save one layer of TLB.
Let's make it at least more likely by aligning the memory.
2021-06-11 17:27:06 +02:00
Markus Wick 5105318bbc common/host_memory: Add Linux implementation 2021-06-11 17:27:06 +02:00
ReinUsesLisp a7837a3791 common/host_memory: Add interface and Windows implementation 2021-06-11 17:27:06 +02:00