Commit graph

68 commits

Author SHA1 Message Date
Lioncash 495a8d8d95 core/memory: Remove unused FlushMode enum
Recent changes to memory-related code resulted in this being unused, so
we can remove it.
2019-05-07 13:55:17 -04:00
Lioncash f2331a804a core/cpu_core_manager: Create threads separately from initialization.
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.
2019-04-11 22:11:40 -04:00
bunnei 3c1ce290d0
Merge pull request #2361 from lioncash/pagetable
core/memory: Minor simplifications to page table management
2019-04-07 17:50:31 -04:00
Lioncash 36a1e6a982 core/memory: Remove unused enum constants
These are holdovers from Citra and can be removed.
2019-04-07 03:04:55 -04:00
Lioncash abae7577d2 core/memory: Remove GetCurrentPageTable()
Now that nothing actually touches the internal page table aside from the
memory subsystem itself, we can remove the accessor to it.
2019-04-07 02:47:37 -04:00
Lioncash c221308a66 core/memory: Remove unnecessary includes
In 93da8e0abf, the page table construct
was moved to the common library (which utilized these inclusions). Since
the move, nothing requires these headers to be included within the
memory header.
2019-03-21 09:48:54 -04:00
bunnei 93da8e0abf core: Move PageTable struct into Common. 2019-03-16 22:05:40 -04:00
bunnei 10118c71e0 memory: Simplify rasterizer cache operations. 2019-03-16 00:41:08 -04:00
Lioncash 83377113bf memory: Dehardcode the use of fixed memory range constants
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.
2018-09-24 22:16:03 -04:00
Lioncash 7fd598636e memory: Dehardcode the use of a 36-bit address space
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.
2018-09-24 22:15:53 -04:00
fearlessTobi 63c2e32e20 Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
bunnei d647d9550c gl_renderer: Cache textures, framebuffers, and shaders based on CPU address. 2018-08-31 13:07:27 -04:00
Lioncash 2a7a2b739b memory: Make prototype parameter names match their definitions
Keeps the code consistent.
2018-08-05 21:39:09 -04:00
Lioncash 4aa31b0618 memory: Correct prototype of ZeroBlock
Previously, the prototype wasn't matching the definition, which has a
Processor parameter before the destination address.
2018-08-05 21:39:06 -04:00
Lioncash 2fc5c783ed memory: Remove unnecessary const qualifiers in prototypes
These aren't necessary, as value-wise const only matters in the
definition.
2018-08-05 21:38:22 -04:00
Lioncash 26de4bb521 core/memory: Get rid of 3DS leftovers
Removes leftover code from citra that isn't needed.
2018-08-03 11:22:47 -04:00
Michael Scire 067ac434ba Kernel/Arbiters: Fix casts, cleanup comments/magic numbers 2018-06-22 00:47:59 -06:00
bunnei 4415e00181 gl_rasterizer_cache: Update to be based on GPU addresses, not CPU addresses. 2018-04-24 22:31:45 -04:00
bunnei b27ab46bde memory: Fix stack region. 2018-03-31 16:06:45 -04:00
bunnei d732142b66 memory: Add RasterizerMarkRegionCached code and cleanup. 2018-03-26 21:16:57 -04:00
bunnei a10baacf9e
Merge pull request #265 from bunnei/tegra-progress-2
Tegra progress 2
2018-03-23 23:30:48 -04:00
bunnei 11047d7fd5 rasterizer: Flush and invalidate regions should be 64-bit. 2018-03-23 15:01:45 -04:00
bunnei 63d3924b5b memory: Port RasterizerFlushVirtualRegion from Citra. 2018-03-22 22:56:41 -04:00
N00byKing 8afdbf6a1f Remove more N3DS References 2018-03-22 21:25:06 +01:00
bunnei 69ee9edd8d memory: Add regions for map region, "new" map region, etc. 2018-03-16 18:32:22 -04:00
MerryMage 6085d32cf5 arm_dynarmic: Support direct page table access 2018-02-12 21:53:32 +00:00
MerryMage 738f91a57d memory: Replace all memory hooking with Special regions 2018-01-27 15:16:39 +00:00
David cb8d5328d5
Update memory.h 2018-01-16 15:27:13 -08:00
David Marcec c903372111 Increased heap size and changed tls area vaddr 2018-01-16 13:53:43 -08:00
bunnei 93480b10ef core/video_core: Fix a bunch of u64 -> u32 warnings. 2018-01-01 15:40:35 -05:00
bunnei 6e021f22b8 svc: Implement MapMemory. 2017-12-28 21:38:38 -05:00
bunnei 9ceb0d9381 memory: Support 32-bit paging, move heap address space up. 2017-10-22 23:17:59 -04:00
bunnei b1d5db1cf6 Merge remote-tracking branch 'upstream/master' into nx
# Conflicts:
#	src/core/CMakeLists.txt
#	src/core/arm/dynarmic/arm_dynarmic.cpp
#	src/core/arm/dyncom/arm_dyncom.cpp
#	src/core/hle/kernel/process.cpp
#	src/core/hle/kernel/thread.cpp
#	src/core/hle/kernel/thread.h
#	src/core/hle/kernel/vm_manager.cpp
#	src/core/loader/3dsx.cpp
#	src/core/loader/elf.cpp
#	src/core/loader/ncch.cpp
#	src/core/memory.cpp
#	src/core/memory.h
#	src/core/memory_setup.h
2017-10-09 23:56:20 -04:00
bunnei 23ce4f5afc loader: Various improvements for NSO/NRO loaders. 2017-10-09 21:39:32 -04:00
Subv 1f2de7501b Memory: Make WriteBlock take a Process parameter on which to operate 2017-10-01 14:18:36 -05:00
Subv 811c01e5fe Memory: Make ReadBlock take a Process parameter on which to operate 2017-10-01 14:18:36 -05:00
bunnei f01472a5ff core: Various changes to support 64-bit addressing. 2017-09-30 14:28:54 -04:00
Subv 35da7f57ef Memory: Allow IsValidVirtualAddress to be called with a specific process parameter.
There is still an overload of IsValidVirtualAddress that only takes the VAddr and will default to the current process.
2017-09-26 17:27:44 -05:00
MerryMage 4e5eb2044a memory: Remove GetCurrentPageTablePointers 2017-09-24 22:43:28 +01:00
MerryMage c02bbb7030 memory: Add GetCurrentPageTable/SetCurrentPageTable
Don't expose Memory::current_page_table as a global.
2017-09-24 22:42:42 +01:00
Subv 214150f00c Kernel/Memory: Changed GetPhysicalPointer so that it doesn't go through the current process' page table to obtain a pointer. 2017-09-15 14:26:13 -05:00
Subv 6d2734a074 Kernel/Memory: Give each Process its own page table.
The loader is in charge of setting the newly created process's page table as the main one during the loading process.
2017-09-10 15:13:41 -05:00
Yuri Kunde Schlesner d553135748 Memory: Add function to flush a virtual range from the rasterizer cache
This is slightly more ergonomic to use, correctly handles virtual
regions which are disjoint in physical addressing space, and checks only
regions which can be cached by the rasterizer.
2017-06-21 22:57:12 -07:00
Yuri Kunde Schlesner 6ae0086b39 Memory: Add TryVirtualToPhysicalAddress, returning a boost::optional 2017-06-21 22:55:18 -07:00
Yuri Kunde Schlesner 326e7c7020 Memory: Make PhysicalToVirtualAddress return a boost::optional
And fix a few places in the code to take advantage of that.
2017-06-21 22:55:17 -07:00
Yuri Kunde Schlesner 42b198eb0a Memory: Add enum definitions for the n3DS FCRAM size 2017-06-20 22:03:25 -07:00
Yuri Kunde Schlesner d3db770cad Memory: Add constants for the n3DS additional RAM
This is 4MB of extra, separate memory that was added on the New 3DS.
2017-05-09 21:43:59 -07:00
James Rowe bbe57a66ca Expose page table to dynarmic for optimized reads and writes to the JIT 2016-11-24 20:41:18 -07:00
Emmanuel Gil Peyrot ebdae19fd2 Remove empty newlines in #include blocks.
This makes clang-format useful on those.

Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00
Emmanuel Gil Peyrot dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00