summaryrefslogtreecommitdiff
path: root/src/core/memory.cpp
AgeCommit message (Collapse)Author
2025-05-12memory: Implement enhanced memory management systemZephyron
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-05-11memory: Improve debug logging and validation in InvalidateNCEZephyron
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-05-11memory: Improve null pointer and unmapped memory handlingZephyron
- 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.
2024-12-20Port changes from Early Accessniansa
2024-02-19scope_exit: Make constexprFearlessTobi
Allows the use of the macro in constexpr-contexts. Also avoids some potential problems when nesting braces inside it.
2024-01-27atomic_ops: Remove volatile qualifierMerry
2024-01-18SMMU: Add Android compatibilityFernando Sahmkow
2024-01-18SMMU: Implement physical memory mirroringFernando Sahmkow
2024-01-18SMMU: Initial adaptation to video_core.Fernando Sahmkow
2023-12-25core: track separate heap allocation for linuxLiam
2023-12-22general: properly support multiple memory instancesLiam
2023-12-04core: refactor emulated cpu core activationLiam
2023-11-25Address more review commentsGPUCode
2023-11-25arm: Implement native code execution backendLiam
2023-11-25core: Respect memory permissions in MapGPUCode
2023-11-16Merge pull request #11995 from FernandoS27/you-dont-need-the-new-iphoneliamwhite
Revert PR #11806 and do a proper fix to the memory handling.
2023-11-12Memory: Fix invalidation handling from the CPU/ServicesFernando Sahmkow
2023-11-10kernel: add KPageTableBaseLiam
Co-authored-by: Kelebek1 <eeeedddccc@hotmail.co.uk>
2023-07-28Merge pull request #11155 from liamwhite/memory3liamwhite
memory: check page against address space size
2023-07-26Merge pull request #10990 from comex/ubsanliamwhite
Fixes and workarounds to make UBSan happier on macOS
2023-07-25memory: check page against address space sizeLiam
2023-07-22memory: minimize dependency on processLiam
2023-07-15Fixes and workarounds to make UBSan happier on macOScomex
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-14k_process: PageTable -> GetPageTableLiam
2023-07-02Use spans over guest memory where possible instead of copying data.Kelebek1
2023-06-28Memory Tracking: Optimize tracking to only use atomic writes when contested ↵Fernando Sahmkow
with the host GPU
2023-06-28MemoryTracking: Initial setup of atomic writes.Fernando Sahmkow
2023-05-07Address feedback, add CR notice, etcFernando Sahmkow
2023-05-07Settings: add option to enable / disable reactive flushingFernando Sahmkow
2023-05-07GPU: Add Reactive flushingFernando Sahmkow
2023-04-23Accuracy Normal: reduce accuracy further for perf improvements in Project LimeFernando Sahmkow
2023-03-23memory: rename global memory references to application memoryLiam
2023-03-22kernel: use KTypedAddress for addressesLiam
2023-02-13general: rename CurrentProcess to ApplicationProcessLiam
2023-01-25Revert "MemoryManager: use fastmem directly."Merry
This reverts commit af5ecb0b15d4449f58434e70eed835cf71fc5527.
2023-01-15memory: fix watchpoint use when fastmem is enabledLiam
2023-01-05MemoryManager: use fastmem directly.Fernando Sahmkow
2022-12-11Merge pull request #9415 from liamwhite/dcMai
memory: correct semantics of data cache management operations
2022-12-11memory: correct semantics of data cache management operationsLiam
2022-12-10memory: remove DEBUG_ASSERT pointer testLiam
2022-11-12kernel: implement FlushProcessDataCacheLiam
2022-10-22general: Resolve -Wunused-lambda-capture and C5233Morph
2022-10-18core: device_memory: Templatize GetPointer(..).bunnei
2022-10-06MemoryManager: Fix errors popping out.Fernando Sahmkow
2022-08-19code: dodge PAGE_SIZE #defineKyle Kienapfel
Some header files, specifically for OSX and Musl libc define PAGE_SIZE to be a number This is great except in yuzu we're using PAGE_SIZE as a variable Specific example `static constexpr u64 PAGE_SIZE = u64(1) << PAGE_BITS;` PAGE_SIZE PAGE_BITS PAGE_MASK are all similar variables. Simply deleted the underscores, and then added YUZU_ prefix Might be worth noting that there are multiple uses in different classes/namespaces This list may not be exhaustive Core::Memory 12 bits (4096) QueryCacheBase 12 bits ShaderCache 14 bits (16384) TextureCache 20 bits (1048576, or 1MB) Fixes #8779
2022-07-27chore: make yuzu REUSE compliantAndrea Pappacoda
[REUSE] is a specification that aims at making file copyright information consistent, so that it can be both human and machine readable. It basically requires that all files have a header containing copyright and licensing information. When this isn't possible, like when dealing with binary assets, generated files or embedded third-party dependencies, it is permitted to insert copyright information in the `.reuse/dep5` file. Oh, and it also requires that all the licenses used in the project are present in the `LICENSES` folder, that's why the diff is so huge. This can be done automatically with `reuse download --all`. The `reuse` tool also contains a handy subcommand that analyzes the project and tells whether or not the project is (still) compliant, `reuse lint`. Following REUSE has a few advantages over the current approach: - Copyright information is easy to access for users / downstream - Files like `dist/license.md` do not need to exist anymore, as `.reuse/dep5` is used instead - `reuse lint` makes it easy to ensure that copyright information of files like binary assets / images is always accurate and up to date To add copyright information of files that didn't have it I looked up who committed what and when, for each file. As yuzu contributors do not have to sign a CLA or similar I couldn't assume that copyright ownership was of the "yuzu Emulator Project", so I used the name and/or email of the commit author instead. [REUSE]: https://reuse.software Follow-up to 01cf05bc75b1e47beb08937439f3ed9339e7b254
2022-07-22Project AndioKelebek1
2022-06-16core/debugger: memory breakpoint supportLiam
2022-06-01core/debugger: Implement new GDB stub debuggerLiam
2022-03-26Revert "Memory GPU <-> CPU: reduce infighting in the texture cache by adding ↵bunnei
CPU Cached memory."