Commit Graph

144 Commits (9e109849ff3f61c0f1e586ebc9c16c413eb7f175)

Author SHA1 Message Date
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.
7 years ago
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.
7 years ago
fearlessTobi 63c2e32e20 Port #4182 from Citra: "Prefix all size_t with std::" 7 years ago
bunnei d647d9550c gl_renderer: Cache textures, framebuffers, and shaders based on CPU address. 7 years ago
Lioncash 45fb74d262 gpu: Make memory_manager private
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.
7 years ago
Lioncash 2665457f4a renderer_base: Make Rasterizer() return the rasterizer by reference
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().
7 years ago
Lioncash 6030c5ce41 video_core: Eliminate the g_renderer global variable
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.
7 years ago
Lioncash 59b04c0df6 memory: Remove unused GetSpecialHandlers() function
This is just unused code, so we may as well get rid of it.
7 years ago
Lioncash 26de4bb521 core/memory: Get rid of 3DS leftovers
Removes leftover code from citra that isn't needed.
7 years ago
bunnei 85421f3406
Merge pull request #690 from lioncash/move
core/memory, core/hle/kernel: Use std::move where applicable
7 years ago
Lioncash 72207577b2 core/memory: Remove unused function GetSpecialHandlers() and an unused variable in ZeroBlock() 7 years ago
Lioncash 46458e7284 core/memory, core/hle/kernel: Use std::move where applicable
Avoids pointless copies
7 years ago
James Rowe 0d46f0df12 Update clang format 7 years ago
James Rowe 638956aa81 Rename logging macro back to LOG_* 7 years ago
Michael Scire 067ac434ba Kernel/Arbiters: Fix casts, cleanup comments/magic numbers 7 years ago
bunnei a434fdcb10 core: Implement multicore support. 7 years ago
Lioncash 7c9644646f
general: Make formatting of logged hex values more straightforward
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).
7 years ago
Lioncash 8475496630
general: Convert assertion macros over to be fmt-compatible 7 years ago
bunnei 42d43ea741
Merge pull request #387 from Subv/maxwell_2d
GPU: Partially implemented the 2D surface copy engine
7 years ago
Subv 5ab597041f Memory: Added a missing shortcut for Memory::CopyBlock for the current process. 7 years ago
Lioncash 6d00780045
core/memory: Amend address widths in asserts
Addresses are 64-bit, these formatting specifiers are simply holdovers from citra. Adjust them to be the correct width.
7 years ago
Lioncash 59dae03dbe
core/memory: Move logging macros over to new fmt-capable ones
While we're at it, correct addresses to print all 64 bits where applicable, which were holdovers from citra.
7 years ago
bunnei 4415e00181 gl_rasterizer_cache: Update to be based on GPU addresses, not CPU addresses. 7 years ago
bunnei d4fb8a887c memory: Fix cast for ReadBlock/WriteBlock/ZeroBlock/CopyBlock. 7 years ago
bunnei d732142b66 memory: Add RasterizerMarkRegionCached code and cleanup. 7 years ago
bunnei a10baacf9e
Merge pull request #265 from bunnei/tegra-progress-2
Tegra progress 2
7 years ago
bunnei b5f3e7951b memory: Fix typo in RasterizerFlushVirtualRegion. 7 years ago
bunnei 1a158dfcd6 memory: RasterizerFlushVirtualRegion should also check process image region. 7 years ago
bunnei 11047d7fd5 rasterizer: Flush and invalidate regions should be 64-bit. 7 years ago
bunnei 63d3924b5b memory: Port RasterizerFlushVirtualRegion from Citra. 7 years ago
N00byKing 8afdbf6a1f Remove more N3DS References 7 years ago
bunnei 7d6653268f core: Move process creation out of global state. 7 years ago
MerryMage cc368de1a0 memory: LOG_ERROR when falling off end of page table 7 years ago
Lioncash fe0775d2f4
memory: Silence formatting sepecifier warnings 7 years ago
MerryMage 738f91a57d memory: Replace all memory hooking with Special regions 7 years ago
Rozlette de7aa3106a memory: Return false for large VAddr in IsValidVirtualAddress 7 years ago
James Rowe 389979018c Remove gpu debugger and get yuzu qt to compile 7 years ago
MerryMage f10a304ecd fix macos build 7 years ago
bunnei 93480b10ef core/video_core: Fix a bunch of u64 -> u32 warnings. 7 years ago
bunnei 97d52b9f89 memory: Print addresses as 64-bit. 8 years ago
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
8 years ago
Subv 1f2de7501b Memory: Make WriteBlock take a Process parameter on which to operate 8 years ago
Subv 811c01e5fe Memory: Make ReadBlock take a Process parameter on which to operate 8 years ago
bunnei 46297c9653 memory: Log with 64-bit values. 8 years ago
bunnei f01472a5ff core: Various changes to support 64-bit addressing. 8 years ago
Huw Pascoe a13ab958cb Fixed type conversion ambiguity 8 years ago
bunnei b07af7dda8 Merge pull request #2961 from Subv/load_titles
Loaders: Don't automatically set the current process every time we load an application.
8 years ago
James Rowe 5620327e03 Merge pull request #2954 from Subv/cache_unmapped_mem
Memory/RasterizerCache: Ignore unmapped memory regions when caching physical regions
8 years ago
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.
8 years ago
Subv 41f6c9f87f Memory/RasterizerCache: Ignore unmapped memory regions when caching physical regions.
Not all physical regions need to be mapped into the address space of every process, for example, system modules do not have a VRAM mapping.

This fixes a crash when loading applets and system modules.
8 years ago
MerryMage 67a70bd9e1 ARM_Interface: Implement PageTableChanged 8 years ago
MerryMage 4e5eb2044a memory: Remove GetCurrentPageTablePointers 8 years ago
MerryMage c02bbb7030 memory: Add GetCurrentPageTable/SetCurrentPageTable
Don't expose Memory::current_page_table as a global.
8 years ago
B3n30 813837c5cf Merge pull request #2842 from Subv/switchable_page_table
Kernel/Memory: Give each process its own page table and allow switching the current page table upon reschedule
8 years ago
Subv f18a176b60 Kernel/Memory: Make IsValidPhysicalAddress not go through the current process' virtual memory mapping. 8 years ago
Subv 214150f00c Kernel/Memory: Changed GetPhysicalPointer so that it doesn't go through the current process' page table to obtain a pointer. 8 years ago
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.
8 years ago
danzel 8266064796 Use recursive_mutex instead of mutex to fix #2902 8 years ago
James Rowe 61442d6afb Merge pull request #2839 from Subv/global_kernel_lock
Kernel/HLE: Use a mutex  to synchronize access to the HLE kernel state between the cpu thread and any other possible threads that might touch the kernel (network thread, etc).
8 years ago
Subv f484927ed0 Kernel/Memory: Acquire the global HLE lock when a memory read/write operation falls outside of the fast path, for it might perform an MMIO operation. 8 years ago
Weiyi Wang 045d0b5bbd Merge pull request #2799 from yuriks/virtual-cached-range-flush
Add address conversion functions returning optional, Add function to flush virtual region from rasterizer cache
8 years ago
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.
8 years ago
Yuri Kunde Schlesner f2a5a77e27 Memory: Fix crash when unmapping a VMA covering cached surfaces
Unmapping pages tries to flush any cached GPU surfaces touching that
region. When a cached page is invalidated, GetPointerFromVMA() is used
to restore the original pagetable pointer. However, since that VMA has
already been deleted, this hits an UNREACHABLE case in that function.

Now when this happens, just set the page type to Unmapped and continue,
which arrives at the correct end result.
8 years ago
Yuri Kunde Schlesner 6ae0086b39 Memory: Add TryVirtualToPhysicalAddress, returning a boost::optional 8 years ago
Yuri Kunde Schlesner 326e7c7020 Memory: Make PhysicalToVirtualAddress return a boost::optional
And fix a few places in the code to take advantage of that.
8 years ago
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.
8 years ago
bunnei 4798b1d04d Revert "Memory: Always flush whole pages from surface cache" 8 years ago
Yuri Kunde Schlesner f2b9be9bd3 Memory: Always flush whole pages from surface cache
This prevents individual writes touching a cached page, but which don't
overlap the surface, from constantly hitting the surface cache lookup.
8 years ago
James Rowe bbe57a66ca Expose page table to dynarmic for optimized reads and writes to the JIT 9 years ago
wwylele 3f87d70f0e memory: fix IsValidVirtualAddress for RasterizerCachedMemory
RasterizerCachedMemory doesn't has pointer but should be considered as valid
9 years ago
Yuri Kunde Schlesner 84fbbe2629 Use negative priorities to avoid special-casing the self-include 9 years ago
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.
9 years ago
Emmanuel Gil Peyrot dc8479928c Sources: Run clang-format on everything. 9 years ago
wwylele b2df959733 Memory: add ReadCString function 9 years ago
Subv 0aef634a54 Memory: Handle RasterizerCachedMemory and RasterizerCachedSpecial page types in the memory block manipulation functions. 9 years ago
Subv 660499ac01 Memory: Make ReadBlock and WriteBlock accept void pointers. 9 years ago
MerryMage 31d49e0109 Memory: CopyBlock 9 years ago
MerryMage ca17df5757 Memory: ZeroBlock 9 years ago
MerryMage 3873b36db3 Memory: ReadBlock/WriteBlock 9 years ago
MerryMage c084fc824c Memory: IsValidVirtualAddress/IsValidPhysicalAddress 9 years ago
tfarley 22f3a7e94c HWRasterizer: Texture forwarding 9 years ago
Yuri Kunde Schlesner 6aa90e13f9 Memory: Do correct Phys->Virt address translation for non-APP linheap 9 years ago
MerryMage 2b93313348 Memory: Implement MMIO 9 years ago
Gareth Poole be217bca70 Fixed spelling errors 10 years ago
Lioncash 9cf1cfe3fd memory: Get rid of pointer casts 10 years ago
Yuri Kunde Schlesner 74d4bc0af1 Kernel: Add more infrastructure to support different memory layouts
This adds some structures necessary to support multiple memory regions
in the future. It also adds support for different system memory types
and the new linear heap mapping at 0x30000000.
10 years ago
Yuri Kunde Schlesner e2c7954be5 Memory: Move address type conversion routines to memory.cpp/h
These helpers aren't really part of the kernel, and mem_map.cpp/h is
going to be moved there next.
10 years ago
Yuri Kunde Schlesner 51820691e7 Memory: Fix unmapping of pages 10 years ago
Emmanuel Gil Peyrot 2d044a67c9 Common: Cleanup memory and misc includes. 10 years ago
Yuri Kunde Schlesner 0a60aa75c2 Kernel: Add VMManager to manage process address spaces
This enables more dynamic management of the process address space,
compared to just directly configuring the page table for major areas.

This will serve as the foundation upon which the rest of the Kernel
memory management functions will be built.
10 years ago
Yuri Kunde Schlesner dd4430609a Memory: Use a table based lookup scheme to read from memory regions 10 years ago
Yuri Kunde Schlesner 52158c1b8d Memory: Read SharedPage directly from Memory::Read 10 years ago
Yuri Kunde Schlesner ec514b16a6 Memory: Read ConfigMem directly from Memory::Read 10 years ago
Yuri Kunde Schlesner 7ada357b2d Memmap: Re-organize memory function in two files
memory.cpp/h contains definitions related to acessing memory and
configuring the address space
mem_map.cpp/h contains higher-level definitions related to configuring
the address space accoording to the kernel and allocating memory.
10 years ago