Commit Graph

219 Commits

Author SHA1 Message Date
lizzie
557876b222 [core] use memcpy instead of hand rolling aligned cases (#2639)
Hand rolling memcpy like this is always frowned upon because the compiler has more insight on whats going on (plus the code resolves to a worse version of itself on assembly). This removes some branches that are just straight up redundant. May save stuff especially for systems without fastmem enabled.

Signed-off-by: lizzie <lizzie@eden-emu.dev>

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2639
Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
2025-12-19 03:58:20 +01:00
lizzie
1efef85352 Partial revert "[common] remove HeapTracker (#3001)" (#3107)
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3107
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: Maufeat <sahyno1996@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
2025-11-27 15:31:34 +01:00
lizzie
ea0e5d630c [common] remove HeapTracker (#3001)
Should fix a bunch of leaks on Android? - PLEASE CHECK UE4 GAMES
Signed-off-by: lizzie lizzie@eden-emu.dev

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3001
Reviewed-by: Maufeat <sahyno1996@gmail.com>
Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
2025-11-27 03:06:11 +01:00
PavelBARABANOV
42863027e2 Revert "[core/memory] Remove defered heap allocation on Linux." (#2974)
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2974
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Co-authored-by: PavelBARABANOV <pavelbarabanov94@gmail.com>
Co-committed-by: PavelBARABANOV <pavelbarabanov94@gmail.com>
2025-11-09 22:42:09 +01:00
lizzie
dbc98f758e [core/memory] Remove defered heap allocation on Linux. (#2587)
Authored-by: weakboson <weakboson@eden-emu.dev>
Signed-off-by: lizzie <lizzie@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2587
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>
2025-10-31 17:37:21 +01:00
lizzie
9d2681ecc9 [cmake] enable clang-cl and WoA builds (#348)
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>
2025-09-09 20:47:49 +02:00
crueter
bbcd8aded6 Revert "[heap_tracker] Use ankerl map instead of rb tree (#249)" (#382)
This reverts commit c9a3baab5d.

this commit caused issues in ender magnolia or something, need to make
sure I didn't mess up the revert

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/382
Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev>
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@outlook.com>
2025-09-04 16:04:42 +02:00
lizzie
c9a3baab5d [heap_tracker] Use ankerl map instead of rb tree (#249)
Signed-off-by: lizzie <lizzie@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/249
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
2025-08-27 05:00:38 +02:00
lizzie
04e5e64538 [memory] remove "fast" memcpy and memset (not fast at all), remove slow parallel impl and just use serial (#188)
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/188
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
2025-08-03 17:07:39 +02:00
lizzie
5091759a47 [vk, opengl] defer checks to topmost call (avoid unnecessary call) (#40)
Co-authored-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/40
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
2025-07-13 03:40:48 +02:00
MrPurple666
449a2497ea Initial MMO implementation
MMO (Multithreaded Memory Operations)
2025-04-28 16:44:35 -03:00
MrPurple666
4e7f6ef694 Better FastMemcpy and FastMemset
Use 16-byte copy paths
2025-04-28 16:44:21 -03:00
MrPurple666
abc7e71ecd Replace std::memcpy/memset with intrinsics on known sizes 2025-04-28 16:27:30 -03:00
yuzubot
c280f95b1a "Merge Tagged PR 13018" 2024-03-03 13:02:50 +00:00
FearlessTobi
4d55e58ee4 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
Merry
bd45dad4f2 atomic_ops: Remove volatile qualifier 2024-01-27 21:36:39 +00:00
Fernando Sahmkow
355bbea52d SMMU: Add Android compatibility 2024-01-18 21:12:30 -05:00
Fernando Sahmkow
f11218a03e SMMU: Implement physical memory mirroring 2024-01-18 21:12:30 -05:00
Fernando Sahmkow
9db159da71 SMMU: Initial adaptation to video_core. 2024-01-18 21:12:30 -05:00
Liam
c366d8e8d9 core: track separate heap allocation for linux 2023-12-25 23:30:56 -05:00
Liam
1fdcd70bad general: properly support multiple memory instances 2023-12-22 21:52:49 -05:00
Liam
3d5c6a73cb core: refactor emulated cpu core activation 2023-12-04 10:37:16 -05:00
GPUCode
1e5a1d1702 Address more review comments 2023-11-25 00:47:43 -05:00
Liam
19619b1b14 arm: Implement native code execution backend 2023-11-25 00:46:47 -05:00
GPUCode
2590906d14 core: Respect memory permissions in Map 2023-11-25 00:46:15 -05:00
liamwhite
e5e8e11242 Merge pull request #11995 from FernandoS27/you-dont-need-the-new-iphone
Revert PR #11806 and do a proper fix to the memory handling.
2023-11-16 09:17:13 -05:00
Fernando Sahmkow
ce3c3c0038 Memory: Fix invalidation handling from the CPU/Services 2023-11-12 14:10:40 +01:00
Liam
713f292a25 kernel: add KPageTableBase
Co-authored-by: Kelebek1 <eeeedddccc@hotmail.co.uk>
2023-11-10 12:01:35 -05:00
liamwhite
fb3f5b0482 Merge pull request #11155 from liamwhite/memory3
memory: check page against address space size
2023-07-28 09:29:21 -04:00
liamwhite
a28a0c47f8 Merge pull request #10990 from comex/ubsan
Fixes and workarounds to make UBSan happier on macOS
2023-07-26 10:33:28 -04:00
Liam
32a48f0d50 memory: check page against address space size 2023-07-25 09:51:06 -04:00
Liam
7073afff3b memory: minimize dependency on process 2023-07-22 11:19:29 -04:00
comex
85d77f636c Fixes and workarounds to make UBSan happier on macOS
There are still some other issues not addressed here, but it's a start.

Workarounds for false-positive reports:

- `RasterizerAccelerated`: Put a gigantic array behind a `unique_ptr`,
  because UBSan has a [hardcoded limit](https://stackoverflow.com/questions/64531383/c-runtime-error-using-fsanitize-undefined-object-has-a-possibly-invalid-vp)
  of how big it thinks objects can be, specifically when dealing with
  offset-to-top values used with multiple inheritance.  Hopefully this
  doesn't have a performance impact.

- `QueryCacheBase::QueryCacheBase`: Avoid an operation that UBSan thinks
  is UB even though it at least arguably isn't.  See the link in the
  comment for more information.

Fixes for correct reports:

- `PageTable`, `Memory`: Use `uintptr_t` values instead of pointers to
  avoid UB from pointer overflow (when pointer arithmetic wraps around
  the address space).

- `KScheduler::Reload`: `thread->GetOwnerProcess()` can be `nullptr`;
  avoid calling methods on it in this case.  (The existing code returns
  a garbage reference to a field, which is then passed into
  `LoadWatchpointArray`, and apparently it's never used, so it's
  harmless in practice but still triggers UBSan.)

- `KAutoObject::Close`: This function calls `this->Destroy()`, which
  overwrites the beginning of the object with junk (specifically a free
  list pointer).  Then it calls `this->UnregisterWithKernel()`.  UBSan
  complains about a type mismatch because the vtable has been
  overwritten, and I believe this is indeed UB.  `UnregisterWithKernel`
  also loads `m_kernel` from the 'freed' object, which seems to be
  technically safe (the overwriting doesn't extend as far as that
  field), but seems dubious.  Switch to a `static` method and load
  `m_kernel` in advance.
2023-07-15 12:00:28 -07:00
Liam
6b6f0b21b9 k_process: PageTable -> GetPageTable 2023-07-14 21:43:15 -04:00
Kelebek1
42638691b5 Use spans over guest memory where possible instead of copying data. 2023-07-02 23:09:48 +01:00
Fernando Sahmkow
4f68a8f45a Memory Tracking: Optimize tracking to only use atomic writes when contested with the host GPU 2023-06-28 21:32:45 +02:00
Fernando Sahmkow
7ae0cdbb09 MemoryTracking: Initial setup of atomic writes. 2023-06-28 19:34:21 +02:00
Fernando Sahmkow
134c14f089 Address feedback, add CR notice, etc 2023-05-07 23:46:12 +02:00
Fernando Sahmkow
62295b5069 Settings: add option to enable / disable reactive flushing 2023-05-07 23:46:12 +02:00
Fernando Sahmkow
6bc60f78d9 GPU: Add Reactive flushing 2023-05-07 23:46:12 +02:00
Fernando Sahmkow
eeffe68b7f Accuracy Normal: reduce accuracy further for perf improvements in Project Lime 2023-04-23 22:03:44 +02:00
Liam
6eaef51cf2 memory: rename global memory references to application memory 2023-03-23 20:28:47 -04:00
Liam
156516e399 kernel: use KTypedAddress for addresses 2023-03-22 09:35:16 -04:00
Liam
c68577384a general: rename CurrentProcess to ApplicationProcess 2023-02-13 19:03:12 -05:00
Merry
6b50650633 Revert "MemoryManager: use fastmem directly."
This reverts commit 7f18e3bb89.
2023-01-25 10:12:04 +00:00
Liam
0279b94a9e memory: fix watchpoint use when fastmem is enabled 2023-01-15 10:24:31 -05:00
Fernando Sahmkow
7f18e3bb89 MemoryManager: use fastmem directly. 2023-01-05 06:06:33 -05:00
Mai
f23e20a630 Merge pull request #9415 from liamwhite/dc
memory: correct semantics of data cache management operations
2022-12-11 21:09:31 +00:00
Liam
47a89280bf memory: correct semantics of data cache management operations 2022-12-11 12:46:34 -05:00
Liam
8a5667aa70 memory: remove DEBUG_ASSERT pointer test 2022-12-10 13:02:38 -05:00