Commit graph

5239 commits

Author SHA1 Message Date
Lioncash
1e92ba2785 kernel/vm_manager: Handle shrinking of the heap size within SetHeapSize()
One behavior that we weren't handling properly in our heap allocation
process was the ability for the heap to be shrunk down in size if a
larger size was previously requested.

This adds the basic behavior to do so and also gets rid of HeapFree, as
it's no longer necessary now that we have allocations and deallocations
going through the same API function.

While we're at it, fully document the behavior that this function
performs.
2019-03-24 17:08:30 -04:00
Lioncash
99a163478b kernel/vm_manager: Rename HeapAllocate to SetHeapSize
Makes it more obvious that this function is intending to stand in for
the actual supervisor call itself, and not acting as a general heap
allocation function.

Also the following change will merge the freeing behavior of HeapFree
into this function, so leaving it as HeapAllocate would be misleading.
2019-03-24 17:08:30 -04:00
Lioncash
abdb81ccaf kernel/vm_manager: Handle case of identical calls to HeapAllocate
In cases where HeapAllocate is called with the same size of the current
heap, we can simply do nothing and return successfully.

This avoids doing work where we otherwise don't have to. This is also
what the kernel itself does in this scenario.
2019-03-24 17:08:30 -04:00
Lioncash
9f63acac0f kernel/vm_manager: Remove unused class variables
Over time these have fallen out of use due to refactoring, so these can
be removed.
2019-03-24 17:08:30 -04:00
Lioncash
52980df1aa kernel/vm_manager: Remove unnecessary heap_used data member
This isn't required anymore, as all the kernel ever queries is the size
of the current heap, not the total usage of it.
2019-03-24 17:08:16 -04:00
Lioncash
586cab6172 kernel/vm_manager: Tidy up heap allocation code
Another holdover from citra that can be tossed out is the notion of the
heap needing to be allocated in different addresses. On the switch, the
base address of the heap will always be managed by the memory allocator
in the kernel, so this doesn't need to be specified in the function's
interface itself.

The heap on the switch is always allocated with read/write permissions,
so we don't need to add specifying the memory permissions as part of the
heap allocation itself either.

This also corrects the error code returned from within the function.
If the size of the heap is larger than the entire heap region, then the
kernel will report an out of memory condition.
2019-03-24 16:17:31 -04:00
bunnei
1665b70cc6
Merge pull request #2221 from DarkLordZach/firmware-version
set_sys: Implement GetFirmwareVersion(2) for libnx hosversion
2019-03-23 13:48:29 -04:00
bunnei
6af322a347
Merge pull request #2280 from lioncash/nso
loader/nso: Minor refactoring
2019-03-23 13:46:09 -04:00
bunnei
819dd93257
Merge pull request #2279 from lioncash/cheat-global
file_sys/cheat_engine: Remove use of global system accessors
2019-03-22 18:41:44 -04:00
bunnei
e5893db3e6
Merge pull request #2256 from bunnei/gpu-vmm
gpu: Rewrite MemoryManager based on the VMManager implementation.
2019-03-22 18:41:12 -04:00
Lioncash
f3297d8cd1 loader/nso: Place translation unit specific functions into an anonymous namespace
Makes it impossible to indirectly violate the ODR in some other
translation unit due to these existing.
2019-03-22 15:25:53 -04:00
Lioncash
733cf179b8 file_sys/cheat_engine: Silence truncation and sign-conversion warnings 2019-03-22 14:43:41 -04:00
Lioncash
540235bb05 file_sys/cheat_engine: Remove use of global system accessors
Instead, pass in the core timing instance and make the dependency
explicit in the interface.
2019-03-22 14:43:37 -04:00
Lioncash
611f4666fd loader/nso: Clean up use of magic constants
Now that the NSO header has the proper size, we can just use sizeof on
it instead of having magic constants.
2019-03-22 14:39:17 -04:00
Lioncash
1cf90f4570 file_sys/patch_manager: Deduplicate NSO header
This source file was utilizing its own version of the NSO header.
Instead of keeping this around, we can have the patch manager also use
the version of the header that we have defined in loader/nso.h
2019-03-22 14:39:10 -04:00
Lioncash
90e27ea003 loader/nso: Fix definition of the NSO header struct
The total struct itself is 0x100 (256) bytes in size, so we should be
providing that amount of data.

Without the data, this can result in omitted data from the final loaded
NSO file.
2019-03-22 14:26:58 -04:00
Lioncash
ee49e1fcb6 file_sys/patch_manager: Remove two magic values
These correspond to the NSOBuildHeader.
2019-03-22 14:17:50 -04:00
bunnei
7b6d516faa
Merge pull request #2234 from lioncash/mutex
core/hle/kernel: Make Mutex a per-process class.
2019-03-21 22:18:36 -04:00
bunnei
b78e7b3454
Merge pull request #2274 from lioncash/include
core/memory: Remove unnecessary includes
2019-03-21 22:14:27 -04:00
bunnei
4d95adcac5
Merge pull request #2275 from lioncash/memflags
kernel/vm_manager: Amend flag value for code data
2019-03-21 21:43:15 -04:00
bunnei
e703772c83
Merge pull request #2276 from lioncash/am
service/am: Add function table for IDebugFunctions
2019-03-21 21:42:17 -04:00
bunnei
639f0c524d
Merge pull request #1933 from DarkLordZach/cheat-engine
file_sys: Implement parser and interpreter for game memory cheats
2019-03-21 21:41:59 -04:00
Lioncash
76f27d1f44 service/am: Add function table for IDebugFunctions
We already have the service related stuff set up for this, however, it's
missing the function table.
2019-03-21 15:58:03 -04:00
Lioncash
18918f5f2f kernel/vm_manager: Rename CodeStatic/CodeMutable to Code and CodeData respectively
Makes it more evident that one is for actual code and one is for actual
data. Mutable and static are less than ideal terms here, because
read-only data is technically not mutable, but we were mapping it with
that label.
2019-03-21 11:43:35 -04:00
Lioncash
56c80a2a21 kernel/vm_manager: Amend flag values for CodeMutable
This should actually be using the data flags, rather than the code
flags.
2019-03-21 11:23:14 -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
3e930304fe
Merge pull request #2090 from FearlessTobi/port-4599
Port citra-emu/citra#4244 and citra-emu/citra#4599: Changes to BitField
2019-03-20 23:44:20 -04:00
bunnei
52f36ea1c7
Merge pull request #2262 from lioncash/enum
file_sys/content_archive: Amend name of Data_Unknown5 enum entry
2019-03-20 23:13:32 -04:00
bunnei
e76f442a0e
Merge pull request #2268 from lioncash/codeset
core/kernel: Migrate CodeSet to its own source files
2019-03-20 22:37:58 -04:00
bunnei
3ae0de9b53 memory: Check that core is powered on before attempting to use GPU.
- 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.
2019-03-20 22:36:03 -04:00
bunnei
22d3dfbcd4 gpu: Rewrite virtual memory manager using PageTable. 2019-03-20 22:36:02 -04:00
bunnei
241563d15c gpu: Move GPUVAddr definition to common_types. 2019-03-20 22:36:02 -04:00
bunnei
872a7bee72
Merge pull request #2267 from FernandoS27/fix-2238
Fix crash caused by #2238.
2019-03-20 21:36:55 -04:00
bunnei
723ad4512f
Merge pull request #2224 from lioncash/opus
hwopus: Leverage multistream API for decoding regular Opus packets
2019-03-20 21:33:37 -04:00
Lioncash
8f454a5c68 kernel/process: Make MapSegment lambda reference parameter const
The segment itself isn't actually modified.
2019-03-20 13:07:09 -04:00
Lioncash
1b6bd9d6df kernel: Move CodeSet structure to its own source files
Given this is utilized by the loaders, this allows avoiding inclusion of
the kernel process definitions where avoidable.

This also keeps the loading format for all executable data separate from
the kernel objects.
2019-03-20 13:07:04 -04:00
Fernando Sahmkow
8a320a6ee2 Fix crash caused by 2238. 2019-03-19 22:45:34 -04:00
Lioncash
1342c53e27 loader: Remove Linker class
Given the class is now currently unused, it can be removed.
2019-03-19 21:32:02 -04:00
Lioncash
ab00552118 loader: Remove Linker inheritance from NRO and NSO loaders
Neither the NRO or NSO loaders actually make use of the functions or
members provided by the Linker interface, so we can just remove the
inheritance altogether.
2019-03-19 21:31:59 -04:00
Lioncash
b8c7072206 file_sys/content_archive: Amend name of Data_Unknown5 enum entry
While we're at it, give each entry some documentation.
2019-03-19 15:58:38 -04:00
bunnei
746167f11a
Merge pull request #2258 from lioncash/am
service/am: Supply remaining missing IAudioController functions
2019-03-18 22:20:36 -04:00
Lioncash
9f092554c2 fsp_srv: Unstub SetCurrentProcess
This just acts as a basic setter for a given PID value and performs no
further checking, so we can just store the passed in value.
2019-03-18 10:38:01 -04:00
Lioncash
26b809549b service/am: Add basic implementation of ChangeMainAppletMasterVolume
All this does is supply a new volume level and a fade time in
nanoseconds for the volume transition to occur within.
2019-03-18 09:18:34 -04:00
Lioncash
c07ebeac19 service/am: Unstub SetTransparentVolumeRate()
Like the other volume setter, this mainly just sets a data member within
the service, nothing too special.
2019-03-18 09:18:34 -04:00
Lioncash
ecd3afdc8e service/am: Unstub SetExpectedMasterVolume()
This function passes in the desired main applet and library applet
volume levels. We can then just pass those values back within the
relevant volume getter functions, allowing us to unstub those as well.

The initial values for the library and main applet volumes differ. The
main applet volume is 0.25 by default, while the library applet volume
is initialized to 1.0 by default in the services themselves.
2019-03-18 09:18:34 -04:00
bunnei
30f228a8c9
Merge pull request #2238 from lioncash/thread
kernel/thread: Amend conditional test and assignment within UpdatePriority()
2019-03-17 22:27:33 -04:00
bunnei
57ca1e3e69
Merge pull request #2252 from bunnei/move-page-table
core: Move PageTable struct into Common.
2019-03-17 14:42:57 -04:00
bunnei
9ad3b01d30
Merge pull request #2249 from lioncash/ipc
ipc_helpers: Allow pushing and popping floating-point values
2019-03-16 22:22:03 -04:00
bunnei
ed7a1e1443
Merge pull request #2245 from lioncash/unused-def
kernel/thread: Actually remove the definition of ExitCurrentThread()
2019-03-16 22:12:40 -04:00
bunnei
93da8e0abf core: Move PageTable struct into Common. 2019-03-16 22:05:40 -04:00