Commit graph

68 commits

Author SHA1 Message Date
Weiyi Wang
8fb3d8ff38 kernel/process: move current process to kernel instance
Two functional change:
QueryProcessMemory uses the process passed from handle instead current_process
Thread::Stop() uses TLS from owner_process instead of current_process
2018-10-22 21:32:34 -04:00
B3n30
2306af3600 Handle cases when std::optional does not contain a value 2018-10-05 16:51:33 +02:00
B3n30
d37a2270d6 Replace boost::optional with std::optional where possible 2018-10-05 13:51:09 +02:00
Weiyi Wang
7d8f115185 Prefix all size_t with std::
done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
2018-09-06 16:03:28 -04:00
wwylele
0eab948728 reformat all files with clang-format 2018-06-29 16:56:12 +03:00
wwylele
7c5a76e58b log: replace all NGLOG with LOG 2018-06-29 14:18:07 +03:00
Daniel Lim Wee Soong
4d2cbf271c Fix wrongly replaced arguments 2018-06-09 16:35:37 +08:00
Daniel Lim Wee Soong
e633d744eb core/memory: Replace logging macros 2018-06-07 23:07:15 +08:00
Daniel Lim Wee Soong
20776b37be Fix wrongly converted specifiers
Sorry that was a lot in one go so some of them had some mistakes
2018-03-27 23:37:36 +08:00
Daniel Lim Wee Soong
968569aa61 Replace format specifiers for all usages of ASSERT_MSG 2018-03-27 23:28:42 +08:00
wwylele
672fbcf37d Memory: remove RasterizerCachedSpecial page type 2018-03-10 01:14:38 +02:00
Weiyi Wang
4befbddc34
Merge pull request #3281 from jroweboy/texcache-pt2
Texture Cache Rework
2018-03-05 11:57:25 +02:00
MerryMage
ab3d53131a audio_core: Remove global state 2018-02-03 15:15:17 +00:00
James Rowe
1c4d1d1ace Move trasnfer_framebuffer to a member of RasterCache. Address review comments 2017-12-23 16:10:32 -07:00
James Rowe
13606a6d0b Memory: Remove count of cached pages and add InvalidateRegion
In a future commit, the count of cached pages will be reintroduced in
the actual surface cache. Also adds an Invalidate only to the cache
which marks a region as invalid in order to try to avoid a costly flush
from 3ds memory
2017-12-23 16:10:25 -07:00
wwylele
8e4e663113 memory: add overload with process parameter for ZeroBlock and CopyBlock 2017-12-07 15:59:54 +02:00
Alexandre Paré
d65983515f Correcting word order of a comment in memory.cpp 2017-10-28 13:23:58 -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
Huw Pascoe
a13ab958cb Fixed type conversion ambiguity 2017-09-30 09:34:35 +01:00
bunnei
b07af7dda8 Merge pull request #2961 from Subv/load_titles
Loaders: Don't automatically set the current process every time we load an application.
2017-09-29 14:58:42 -04:00
James Rowe
5620327e03 Merge pull request #2954 from Subv/cache_unmapped_mem
Memory/RasterizerCache: Ignore unmapped memory regions when caching physical regions
2017-09-26 16:55:47 -06: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
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.
2017-09-25 19:37:45 -05:00
MerryMage
67a70bd9e1 ARM_Interface: Implement PageTableChanged 2017-09-24 23:08:25 +01: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
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
2017-09-15 22:41:45 +02:00
Subv
f18a176b60 Kernel/Memory: Make IsValidPhysicalAddress not go through the current process' virtual memory mapping. 2017-09-15 14:26:18 -05: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
danzel
8266064796 Use recursive_mutex instead of mutex to fix #2902 2017-08-29 20:39:55 +12:00
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).
2017-08-23 18:17:44 -06:00
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. 2017-08-22 09:30:58 -05:00
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
2017-07-22 10:15:52 +03: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
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.
2017-06-21 22:56:31 -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
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
bunnei
4798b1d04d Revert "Memory: Always flush whole pages from surface cache" 2016-12-17 19:13:33 -05:00
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.
2016-12-14 23:46:59 -08: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
wwylele
3f87d70f0e memory: fix IsValidVirtualAddress for RasterizerCachedMemory
RasterizerCachedMemory doesn't has pointer but should be considered as valid
2016-09-29 10:01:34 +08:00
Yuri Kunde Schlesner
84fbbe2629 Use negative priorities to avoid special-casing the self-include 2016-09-21 00:15:56 -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
wwylele
b2df959733 Memory: add ReadCString function 2016-08-27 21:38:06 +08:00
Subv
0aef634a54 Memory: Handle RasterizerCachedMemory and RasterizerCachedSpecial page types in the memory block manipulation functions. 2016-05-28 13:52:50 -05:00
Subv
660499ac01 Memory: Make ReadBlock and WriteBlock accept void pointers. 2016-05-28 13:52:49 -05:00