aboutsummaryrefslogtreecommitdiff
path: root/src/core/memory.cpp
Commit message (Collapse)AuthorAgeFilesLines
* core/cpu_core_manager: Create threads separately from initialization.Lioncash2019-04-111-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our initialization process is a little wonky than one would expect when it comes to code flow. We initialize the CPU last, as opposed to hardware, where the CPU obviously needs to be first, otherwise nothing else would work, and we have code that adds checks to get around this. For example, in the page table setting code, we check to see if the system is turned on before we even notify the CPU instances of a page table switch. This results in dead code (at the moment), because the only time a page table switch will occur is when the system is *not* running, preventing the emulated CPU instances from being notified of a page table switch in a convenient manner (technically the code path could be taken, but we don't emulate the process creation svc handlers yet). This moves the threads creation into its own member function of the core manager and restores a little order (and predictability) to our initialization process. Previously, in the multi-threaded cases, we'd kick off several threads before even the main kernel process was created and ready to execute (gross!). Now the initialization process is like so: Initialization: 1. Timers 2. CPU 3. Kernel 4. Filesystem stuff (kind of gross, but can be amended trivially) 5. Applet stuff (ditto in terms of being kind of gross) 6. Main process (will be moved into the loading step in a following change) 7. Telemetry (this should be initialized last in the future). 8. Services (4 and 5 should ideally be alongside this). 9. GDB (gross. Uses namespace scope state. Needs to be refactored into a class or booted altogether). 10. Renderer 11. GPU (will also have its threads created in a separate step in a following change). Which... isn't *ideal* per-se, however getting rid of the wonky intertwining of CPU state initialization out of this mix gets rid of most of the footguns when it comes to our initialization process.
* core/memory: Remove GetCurrentPageTable()Lioncash2019-04-071-4/+0
| | | | | Now that nothing actually touches the internal page table aside from the memory subsystem itself, we can remove the accessor to it.
* memory: Check that core is powered on before attempting to use GPU.bunnei2019-03-201-1/+1
| | | | | - GPU will be released on shutdown, before pages are unmapped. - On subsequent runs, current_page_table will be not nullptr, but GPU might not be valid yet.
* core: Move PageTable struct into Common.bunnei2019-03-161-74/+60
|
* memory: Simplify rasterizer cache operations.bunnei2019-03-161-60/+21
|
* gpu: Use host address for caching instead of guest address.bunnei2019-03-141-5/+8
|
* gpu: Move command processing to another thread.bunnei2019-03-061-4/+4
|
* Memory: don't lock hle mutex in memory read/writeWeiyi Wang2019-03-021-6/+0
| | | | The comment already invalidates itself: neither MMIO nor rasterizer cache belongsHLE kernel state. This mutex has a too large scope if MMIO or cache is included, which is prone to dead lock when multiple thread acquires these resource at the same time. If necessary, each MMIO component or rasterizer should have their own lock.
* Speed up memory page mapping (#2141)Annomatg2019-02-271-6/+11
| | | | - Memory::MapPages total samplecount was reduced from 4.6% to 1.06%. - From main menu into the game from 1.03% to 0.35%
* Fixed uninitialized memory due to missing returns in canaryDavid Marcec2018-12-191-0/+1
| | | | Functions which are suppose to crash on non canary builds usually don't return anything which lead to uninitialized memory being used.
* memory: Convert ASSERT into a DEBUG_ASSERT within GetPointerFromVMA()Lioncash2018-12-061-1/+1
| | | | | | Given memory should always be expected to be valid during normal execution, this should be a debug assertion, rather than a check in regular builds.
* vm_manager: Make vma_map privateLioncash2018-12-061-6/+5
| | | | | | | | | | | This was only ever public so that code could check whether or not a handle was valid or not. Instead of exposing the object directly and allowing external code to potentially mess with the map contents, we just provide a member function that allows checking whether or not a handle is valid. This makes all member variables of the VMManager class private except for the page table.
* Call shrink_to_fit after page-table vector resizing to cause crt to actually ↵heapo2018-12-051-0/+8
| | | | lower vector capacity. For 36-bit titles saves 800MB of commit.
* global: Use std::optional instead of boost::optional (#1578)Frederic L2018-10-301-1/+1
| | | | | | | | | | | | | | | | * get rid of boost::optional * Remove optional references * Use std::reference_wrapper for optional references * Fix clang format * Fix clang format part 2 * Adressed feedback * Fix clang format and MacOS build
* kernel/process: Make data member variables privateLioncash2018-09-301-7/+7
| | | | | | | Makes the public interface consistent in terms of how accesses are done on a process object. It also makes it slightly nicer to reason about the logic of the process class, as we don't want to expose everything to external code.
* memory: Dehardcode the use of fixed memory range constantsLioncash2018-09-241-5/+7
| | | | | | | | The locations of these can actually vary depending on the address space layout, so we shouldn't be using these when determining where to map memory or be using them as offsets for calculations. This keeps all the memory ranges flexible and malleable based off of the virtual memory manager instance state.
* memory: Dehardcode the use of a 36-bit address spaceLioncash2018-09-241-2/+16
| | | | | Given games can also request a 32-bit or 39-bit address space, we shouldn't be hardcoding the address space range as 36-bit.
* Port #4182 from Citra: "Prefix all size_t with std::"fearlessTobi2018-09-151-27/+28
|
* gl_renderer: Cache textures, framebuffers, and shaders based on CPU address.bunnei2018-08-311-36/+15
|
* gpu: Make memory_manager privateLioncash2018-08-281-2/+2
| | | | | | | | | | Makes the class interface consistent and provides accessors for obtaining a reference to the memory manager instance. Given we also return references, this makes our more flimsy uses of const apparent, given const doesn't propagate through pointers in the way one would typically expect. This makes our mutable state more apparent in some places.
* renderer_base: Make Rasterizer() return the rasterizer by referenceLioncash2018-08-041-4/+4
| | | | | | | All calling code assumes that the rasterizer will be in a valid state, which is a totally fine assumption. The only way the rasterizer wouldn't be is if initialization is done incorrectly or fails, which is checked against in System::Init().
* video_core: Eliminate the g_renderer global variableLioncash2018-08-041-8/+10
| | | | | | | | | | | | | | We move the initialization of the renderer to the core class, while keeping the creation of it and any other specifics in video_core. This way we can ensure that the renderer is initialized and doesn't give unfettered access to the renderer. This also makes dependencies on types more explicit. For example, the GPU class doesn't need to depend on the existence of a renderer, it only needs to care about whether or not it has a rasterizer, but since it was accessing the global variable, it was also making the renderer a part of its dependency chain. By adjusting the interface, we can get rid of this dependency.
* memory: Remove unused GetSpecialHandlers() functionLioncash2018-08-031-16/+0
| | | | This is just unused code, so we may as well get rid of it.
* core/memory: Get rid of 3DS leftoversLioncash2018-08-031-106/+0
| | | | Removes leftover code from citra that isn't needed.
* Merge pull request #690 from lioncash/movebunnei2018-07-181-3/+5
|\ | | | | core/memory, core/hle/kernel: Use std::move where applicable
| * core/memory, core/hle/kernel: Use std::move where applicableLioncash2018-07-181-3/+5
| | | | | | | | Avoids pointless copies
* | core/memory: Remove unused function GetSpecialHandlers() and an unused ↵Lioncash2018-07-181-7/+0
|/ | | | variable in ZeroBlock()
* Update clang formatJames Rowe2018-07-021-12/+12
|
* Rename logging macro back to LOG_*James Rowe2018-07-021-12/+12
|
* Kernel/Arbiters: Fix casts, cleanup comments/magic numbersMichael Scire2018-06-221-0/+4
|
* core: Implement multicore support.bunnei2018-05-101-2/+7
|
* general: Make formatting of logged hex values more straightforwardLioncash2018-05-021-11/+11
| | | | | | This makes the formatting expectations more obvious (e.g. any zero padding specified is padding that's entirely dedicated to the value being printed, not any pretty-printing that also gets tacked on).
* general: Convert assertion macros over to be fmt-compatibleLioncash2018-04-271-10/+9
|
* Merge pull request #387 from Subv/maxwell_2dbunnei2018-04-251-0/+4
|\ | | | | GPU: Partially implemented the 2D surface copy engine
| * Memory: Added a missing shortcut for Memory::CopyBlock for the current process.Subv2018-04-251-0/+4
| |
* | core/memory: Amend address widths in assertsLioncash2018-04-251-2/+2
| | | | | | | | Addresses are 64-bit, these formatting specifiers are simply holdovers from citra. Adjust them to be the correct width.
* | core/memory: Move logging macros over to new fmt-capable onesLioncash2018-04-251-22/+24
|/ | | | While we're at it, correct addresses to print all 64 bits where applicable, which were holdovers from citra.
* gl_rasterizer_cache: Update to be based on GPU addresses, not CPU addresses.bunnei2018-04-241-16/+48
|
* memory: Fix cast for ReadBlock/WriteBlock/ZeroBlock/CopyBlock.bunnei2018-03-261-4/+8
|
* memory: Add RasterizerMarkRegionCached code and cleanup.bunnei2018-03-261-200/+190
|
* Merge pull request #265 from bunnei/tegra-progress-2bunnei2018-03-231-0/+40
|\ | | | | Tegra progress 2
| * memory: Fix typo in RasterizerFlushVirtualRegion.bunnei2018-03-231-3/+3
| |
| * memory: RasterizerFlushVirtualRegion should also check process image region.bunnei2018-03-231-0/+1
| |
| * rasterizer: Flush and invalidate regions should be 64-bit.bunnei2018-03-231-2/+2
| |
| * memory: Port RasterizerFlushVirtualRegion from Citra.bunnei2018-03-221-0/+39
| |
* | Remove more N3DS ReferencesN00byKing2018-03-221-9/+0
|/
* core: Move process creation out of global state.bunnei2018-03-141-15/+15
|
* memory: LOG_ERROR when falling off end of page tableMerryMage2018-02-211-0/+11
|
* memory: Silence formatting sepecifier warningsLioncash2018-02-141-21/+30
|
* memory: Replace all memory hooking with Special regionsMerryMage2018-01-271-317/+163
|