Commit graph

55 commits

Author SHA1 Message Date
Weiyi Wang
6992f76acf Memory: create MemorySystem class 2018-12-05 20:16:42 -05:00
Weiyi Wang
7e90abec78
Merge pull request #4442 from wwylele/memory-no-kernel
Memory: decouple from Kernel
2018-11-28 11:24:41 -05:00
BreadFish64
f4472a10e6 core: undef PAGE_SIZE and PAGE_MASK
these are defined a system header which causes complications when building for android
2018-11-20 14:24:19 -05:00
Weiyi Wang
679dfd7cdf Memory: remove CopyBlock with current process 2018-11-19 11:16:55 -05:00
Weiyi Wang
185a83f06d Memory: remove ZeroBlock with current process 2018-11-19 11:16:55 -05:00
Weiyi Wang
4e99641a3b Memory: remove WriteBlock with current process 2018-11-19 11:16:55 -05:00
Weiyi Wang
8871f5a4ac Memory: remove ReadBlock with current process 2018-11-19 11:16:55 -05:00
Weiyi Wang
7308b8d294 Memory: remove IsValidVirtualAddress with current process 2018-11-19 11:16:55 -05:00
Weiyi Wang
9e8d149ca7 Memory: remove unused VirtualToPhysical 2018-11-13 11:56:05 -05:00
Weiyi Wang
b1f55c9cab
Merge pull request #4429 from wwylele/io-size
Memory: IO area is at most 4MB
2018-11-13 11:09:14 -05:00
Weiyi Wang
194118011a Memory: IO area is at most 4MB 2018-11-12 15:12:12 -05:00
Weiyi Wang
2654a679b3 Memory: replace PhysicalToVirtualAddress with a more dedicated function
There is no external use of PhysicalToVirtualAddress any more, so it there is no need to have a generic function that handles all physical regions. Also, the previous APT change makes it possible that linear heap has some regions mapped to old and new VAddr regions at the same time, so we need to check both region and mark cached for the mapped one. RasterizerMarkRegionCached would skip the unmapped one in its loop
2018-11-08 00:19:57 -05:00
Weiyi Wang
2067946f59
Kernel: reimplement memory management on physical FCRAM (#4392)
* Kernel: reimplement memory management on physical FCRAM

* Kernel/Process: Unmap does not care the source memory permission

What game usually does is after mapping the memory, they reprotect the source memory as no permission to avoid modification there

* Kernel/SharedMemory: zero initialize new-allocated memory

* Process/Thread: zero new TLS entry

* Kernel: fix a bug where code segments memory usage are accumulated twice

It is added to both misc and heap (done inside HeapAlloc), which results a doubled number reported by svcGetProcessInfo. While we are on it, we just merge the three number misc, heap and linear heap usage together, as there is no where they are distinguished.

Question: is TLS page also added to this number?

* Kernel/SharedMemory: add more object info on mapping error

* Process: lower log level; SharedMemory: store phys offset

* VMManager: add helper function to retrieve backing block list for a range
2018-11-06 15:00:47 -05:00
Weiyi Wang
a753b9c6cc
Merge pull request #4228 from NarcolepticK/lle-mapped-buffer
LLE Mapped Buffer: Add unmapping of write buffer, zero-size, and multiple page handling
2018-10-30 19:18:11 -04:00
B3n30
d37a2270d6 Replace boost::optional with std::optional where possible 2018-10-05 13:51:09 +02:00
NarcolepticK
51d53a6281 LLE Mapped Buffer: addressed comments 2018-09-30 23:23:21 -04: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
Lioncash
8fa861c2c6 memory: Make prototype parameter names match their definitions
Keeps the code consistent.
2018-08-31 00:33:20 +02:00
Lioncash
379b8c65b9 memory: Remove unnecessary const qualifiers in prototypes
These aren't necessary, as value-wise const only matters in the
definition.
2018-08-31 00:22:55 +02:00
wwylele
672fbcf37d Memory: remove RasterizerCachedSpecial page type 2018-03-10 01:14:38 +02: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
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
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
wwylele
b2df959733 Memory: add ReadCString function 2016-08-27 21:38:06 +08:00
Subv
660499ac01 Memory: Make ReadBlock and WriteBlock accept void pointers. 2016-05-28 13:52:49 -05:00
MerryMage
31d49e0109 Memory: CopyBlock 2016-05-28 13:44:49 -05:00
MerryMage
ca17df5757 Memory: ZeroBlock 2016-05-21 11:14:09 -05:00
MerryMage
3873b36db3 Memory: ReadBlock/WriteBlock 2016-05-21 11:12:36 -05:00
MerryMage
c084fc824c Memory: IsValidVirtualAddress/IsValidPhysicalAddress 2016-05-21 11:12:35 -05:00
bunnei
0d8bd3ba36 Merge pull request #1695 from Subv/tls_alloc
Kernel/Threads: Dynamically allocate the TLS region for threads.
2016-05-12 21:51:35 -04:00
Subv
d192fb066d Kernel/Threads: Dynamically allocate the TLS region for threads in the BASE region of the linear heap.
Each thread gets a 0x200-byte area from the 0x1000-sized page, when all 8 thread slots in a single page are used up, the kernel allocates a new page to hold another 8 entries.

This is consistent with what the real kernel does.
2016-05-07 10:18:47 -05:00
tfarley
22f3a7e94c HWRasterizer: Texture forwarding 2016-04-21 17:27:56 -04:00
Yuri Kunde Schlesner
78735e2ada Fix broken boot introduced by last-minute change in #1025 2015-08-22 18:12:23 -03:00
Yuri Kunde Schlesner
14eca982f4 Kernel: Implement svcGetProcessInfo in a basic way
This also adds some basic memory usage accounting. These two types are
used by Super Smash Bros. during startup.
2015-08-16 01:03:48 -03:00
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.
2015-08-16 01:03:47 -03:00
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.
2015-08-16 01:03:46 -03:00