Commit graph

219 commits

Author SHA1 Message Date
Zephyron
7e58599d69 feat: downgrade fmt requirement to version 10
- Change fmt requirement from 11 to 10 in CMakeLists.txt and vcpkg.json
- Remove null pointer handling in memory operations
- Remove memory region management features
- Remove unused host shader files and code
- Simplify buffer cache and texture cache memory management
- Remove thread safety and emergency cleanup from DelayedDestructionRing
- Revert storage buffer optimizations and safety fallbacks
- Remove Citron copyright notices from multiple files

Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-05-05 18:05:39 +10:00
Zephyron
ebfc9d8347 memory: Implement enhanced memory management system
Add a flexible memory region management system that provides:
- Memory region type classification (System, Graphics, IO, Binary)
- Memory region permission management (executable, writable)
- Binary base address randomization for ASLR
- Dynamic memory mapping capabilities

Credit: boss.smc@citron-emu.org
Signed-off-by: Zephyron <zephyron@citron-emu.org>
2025-03-27 23:25:24 +10:00
Zephyron
9a65205dba revert ee3d858935
revert Follow Up Of the previous commit with the update of TLB update
2025-03-06 06:43:37 +00:00
Zephyron
af4f08be33 revert 6565055865
revert Fix: Core_Memory logging and ARM_NCE Mutex logging
2025-03-06 06:42:48 +00:00
Zephyron
4491127f52 revert 031c635095
revert arm: corrected declarations
2025-03-06 06:41:01 +00:00
CamilleLaVey
031c635095 arm: corrected declarations 2025-03-05 11:12:44 -04:00
CamilleLaVey
6565055865 Fix: Core_Memory logging and ARM_NCE Mutex logging 2025-03-05 00:25:31 -04:00
CamilleLaVey
ee3d858935 Follow Up Of the previous commit with the update of TLB update 2025-03-04 22:50:01 -04:00
Zephyron
71e652123b
memory: Improve debug logging and validation in InvalidateNCE
Add more detailed debug logging and validation to the InvalidateNCE function:

- Add entry debug log showing NCE invalidation request details
- Add upfront validation of memory region before proceeding
- Add debug logs for rasterizer and separate heap handling cases
- Add warning logs for invalid address ranges and failed invalidations
- Improve error message formatting and clarity
- Group related operations with descriptive comments

These changes make it easier to debug NCE invalidation issues by providing
more visibility into the validation steps and failure cases.
2025-02-03 16:10:34 +10:00
Zephyron
b938893599 memory: Improve null pointer and unmapped memory handling
- Update vcpkg baseline to a42af01b72c28a8e1d7b48107b33e4f286a55ef6
- Add SPIRV-Tools and SPIRV-Headers as submodules
- Update Vulkan-related submodules to latest stable versions
- Improve memory access error handling:
  - Add specific handling for null pointer accesses in ARM32 emulation
  - Return 0 for null pointer reads instead of undefined behavior
  - Silently ignore writes to null pointers
  - Add more detailed error messages distinguishing between null pointer
    access and other unmapped memory errors
  - Treat addresses below 0x1000 as potential null pointer accesses

These changes should provide more graceful handling of null pointer
accesses and improve stability when running games that attempt invalid
memory operations.
2025-01-18 15:20:13 +10:00
Zephyron
9ae0eeeb87 Revert incorrect copyright attribution for non-contributed files
- In commit b3facaa6bb, the copyright header was
  updated to include "Citron Homebrew Project" across multiple files, regardless
  of whether any contributions were made.

- This commit removes the incorrect attribution and reverts the copyright header
  to its previous state.

- Copyright attribution should only be added when meaningful contributions have
  been made to the file.

- This commit ensures proper compliance with copyright standards and maintains
  correct attribution to the respective contributors.

- Special thanks to Tachi for pointing out the need for these corrections and
  ensuring that proper attribution practices are followed.
2025-01-14 15:33:24 +10:00
Zephyron
468ace6b0b
core: Update copyright headers
- Update copyright headers to include Citron Homebrew Project
- Add 2025 to copyright years
2024-12-31 17:36:08 +10:00
Zephyron
b3facaa6bb
chore: update project references and add Citron copyright
- Replaced all references to the old project name with Citron.
- Added Citron copyright information alongside existing notices in all files.
2024-12-31 17:07:49 +10:00
yuzubot
537296095a "Merge Tagged PR 13018" 2024-03-04 13:02:54 +00:00
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
Merry
9f91d310c6 atomic_ops: Remove volatile qualifier 2024-01-27 21:36:39 +00:00
Fernando Sahmkow
303cd31162 SMMU: Add Android compatibility 2024-01-18 21:12:30 -05:00
Fernando Sahmkow
34a8d0cc8e SMMU: Implement physical memory mirroring 2024-01-18 21:12:30 -05:00
Fernando Sahmkow
0a2536a0df SMMU: Initial adaptation to video_core. 2024-01-18 21:12:30 -05:00
Liam
ddda76f9b0 core: track separate heap allocation for linux 2023-12-25 23:30:56 -05:00
Liam
31bf57a310 general: properly support multiple memory instances 2023-12-22 21:52:49 -05:00
Liam
45c87c7e6e core: refactor emulated cpu core activation 2023-12-04 10:37:16 -05:00
GPUCode
9ff8d0f3e6 Address more review comments 2023-11-25 00:47:43 -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
liamwhite
d86e88a622
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
f1806d237f Memory: Fix invalidation handling from the CPU/Services 2023-11-12 14:10:40 +01:00
Liam
2a255b2d61 kernel: add KPageTableBase
Co-authored-by: Kelebek1 <eeeedddccc@hotmail.co.uk>
2023-11-10 12:01:35 -05:00
liamwhite
689dc4a17b
Merge pull request #11155 from liamwhite/memory3
memory: check page against address space size
2023-07-28 09:29:21 -04:00
liamwhite
d3da1e6517
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
07f71e2620 memory: check page against address space size 2023-07-25 09:51:06 -04:00
Liam
d144168442 memory: minimize dependency on process 2023-07-22 11:19:29 -04:00
comex
d7c532d889 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
a85ce8ea56 k_process: PageTable -> GetPageTable 2023-07-14 21:43:15 -04:00
Kelebek1
6f7cb69c94 Use spans over guest memory where possible instead of copying data. 2023-07-02 23:09:48 +01:00
Fernando Sahmkow
da440da9f5 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
47d0d292d5 MemoryTracking: Initial setup of atomic writes. 2023-06-28 19:34:21 +02:00
Fernando Sahmkow
6f90dff293 Address feedback, add CR notice, etc 2023-05-07 23:46:12 +02:00
Fernando Sahmkow
92da86290c Settings: add option to enable / disable reactive flushing 2023-05-07 23:46:12 +02:00
Fernando Sahmkow
c6cac2ffaa GPU: Add Reactive flushing 2023-05-07 23:46:12 +02:00
Fernando Sahmkow
7e76c1642c Accuracy Normal: reduce accuracy further for perf improvements in Project Lime 2023-04-23 22:03:44 +02:00
Liam
41d99aa89d memory: rename global memory references to application memory 2023-03-23 20:28:47 -04:00
Liam
fb49ec19c1 kernel: use KTypedAddress for addresses 2023-03-22 09:35:16 -04:00
Liam
ceda2d280e general: rename CurrentProcess to ApplicationProcess 2023-02-13 19:03:12 -05:00
Merry
dc7ab4c5d6 Revert "MemoryManager: use fastmem directly."
This reverts commit af5ecb0b15.
2023-01-25 10:12:04 +00:00
Liam
f1a0ce0e70 memory: fix watchpoint use when fastmem is enabled 2023-01-15 10:24:31 -05:00
Fernando Sahmkow
af5ecb0b15 MemoryManager: use fastmem directly. 2023-01-05 06:06:33 -05:00
Mai
d5684dbe7d
Merge pull request #9415 from liamwhite/dc
memory: correct semantics of data cache management operations
2022-12-11 21:09:31 +00:00
Liam
ed37192441 memory: correct semantics of data cache management operations 2022-12-11 12:46:34 -05:00
Liam
985ed1e160 memory: remove DEBUG_ASSERT pointer test 2022-12-10 13:02:38 -05:00