Commit graph

62 commits

Author SHA1 Message Date
Morph
41a0c088ba general: Get the current process program id directly from the system
This allows us to avoid including KProcess' header file in files that only need to get the current process' program id.
2021-11-04 16:59:39 -04:00
Morph
10508e7af2 general: Rename GetTitleID to GetProgramID 2021-11-04 16:57:16 -04:00
Morph
fddd57db61 general: Remove MakeResult helpers
This is made obsolete by the presence of implicit constructors.
2021-11-02 17:23:19 -04:00
Morph
7ebc38a6d1 general: Replace RESULT_SUCCESS with ResultSuccess
Transition to PascalCase for result names.
2021-06-02 00:39:27 -04:00
bunnei
80460d421e Merge pull request #6266 from bunnei/kautoobject-refactor
Kernel Rework: Migrate kernel objects to KAutoObject
2021-05-07 23:30:17 -07:00
Lioncash
6890201733 ldr: Simplify memory copy within LoadNro()
We can use the dedicated memory function for performing copies instead
of reading into a temporary buffer and then immediately writing it back
out to memory.

Eliminates a bit of heap memory churn.
2021-05-06 19:18:14 -04:00
bunnei
ad048de3d6 hle: kernel: Rename Process to KProcess. 2021-05-05 16:40:52 -07:00
german77
da6fd04f92 ldr: Use proper names 2021-04-08 19:40:25 -06:00
bunnei
5dbcaa2970 hle: kernel: Migrate PageHeap/PageTable to KPageHeap/KPageTable. 2021-02-18 16:16:25 -08:00
bunnei
a4c5e6d964 hle: kernel: Migrate to KMemoryBlock, KMemoryBlockManager, and others. 2021-02-18 16:16:25 -08:00
bunnei
f82b15089b hle: kernel: KSystemControl does not belong in Memory namespace. 2021-02-18 16:16:24 -08:00
Chloe
e62886ead0 kernel: Unify result codes (#5890)
* kernel: Unify result codes

Drop the usage of ERR_NAME convention in kernel for ResultName. Removed seperation between svc_results.h & errors.h as we mainly include both most of the time anyways.

* oops

* rename errors to svc_results
2021-02-12 15:43:01 -08:00
bunnei
a5b73195c9 core: arm: Implement InvalidateCacheRange for CPU cache invalidation. 2020-11-29 01:31:52 -08:00
Lioncash
346271b80b service: Eliminate usages of the global system instance
Completely removes all usages of the global system instance within the
services code by passing in the using system instance to the services.
2020-11-26 20:03:11 -05:00
Lioncash
e7fe020ace ipc_helpers: Remove usage of the global system instance
Resolves numerous deprecation warnings throughout the codebase due to
inclusion of this header. Now building core should be significantly less
noisy (and also relying on less global state).

This also uncovered quite a few modules that were relying on indirect
includes, which have also been fixed.
2020-11-08 15:58:11 -05:00
bunnei
4c09a6399c hle: service: ldr: Implement UnloadNrr.
- Used by Final Fantasy X/X-2 HD Remaster.
2020-10-31 01:22:53 -07:00
Lioncash
c7b6027f34 core: Fix clang build pt.3
Should finally resolve building with clang.
2020-10-21 22:14:23 -04:00
bunnei
deb3536936 Revert "core: Fix clang build" 2020-10-20 19:07:39 -07:00
Lioncash
18636013c9 core: Fix clang build
Recent changes to the build system that made more warnings be flagged as
errors caused building via clang to break.

Fixes #4795
2020-10-17 19:50:39 -04:00
Lioncash
78ff298d6d service/ldr: Resolve sign mismatch warnings
We were performing an int < size_t comparison. We can just correct the
type of the induction variable.
2020-08-03 11:48:16 -04:00
David Marcec
3804c6d1c0 ldr: Cleanup NRO & NRR structs 2020-06-28 20:54:37 +10:00
VolcaEM
8cd49f28a3 Move SHA256Hash to its original position
It's not needed to have it in its previous position anymore
2020-06-18 15:45:47 +02:00
VolcaEM
85a247d6cf Remove unnecessary pragmas 2020-06-16 20:28:44 +02:00
VolcaEM
1f2f16c656 Revert IsValidNRO refactor but make it more readable 2020-06-16 20:24:58 +02:00
VolcaEM
18b88119d2 Update assert string 2020-06-16 15:57:02 +02:00
VolcaEM
68a7d8fb09 Clang-format again 2020-06-14 19:41:28 +02:00
VolcaEM
26b0ef5ce0 Use consistent variable names 2020-06-14 19:37:44 +02:00
VolcaEM
a01b0de19a Clang-format 2020-06-14 19:34:58 +02:00
VolcaEM
2ae60c8949 Make assert strings consistent 2020-06-14 19:30:08 +02:00
VolcaEM
f801c273eb Attempt to fix crashes in SSBU and refactor IsValidNRO 2020-06-14 19:28:39 +02:00
VolcaEM
50bf4c70cd Address review comments 2020-06-02 17:54:10 +02:00
VolcaEM
6f126bb803 Add comment to nrr_kind
According to Atmosphére (c7026b9094/libraries/libstratosphere/include/stratosphere/ro/ro_types.hpp), nrr_kind (Atmosphére calls it "type") is 7.0.0+
2020-05-31 19:12:09 +02:00
VolcaEM
9390c0c271 ldr: Update NRR/NRO structs
This was based on Switchbrew pages:

https://switchbrew.org/wiki/NRR

https://switchbrew.org/wiki/NRO
2020-05-31 18:49:51 +02:00
Lioncash
d73e0ef309 service: Update function tables
Keeps the service function tables up to date.

Updated based off information on SwitchBrew.
2020-04-20 15:53:49 -04:00
bunnei
4cdbd44f51 core: hle: Address various feedback & code cleanup.
- Should be no functional changes.
2020-04-17 00:59:36 -04:00
bunnei
0707404f34 service: ldr: Updates for new VMM.
- Includes removing some service impls. that are untested.
2020-04-17 00:59:35 -04:00
bunnei
7ee7aa21b1 services: ldr: Fix MemoryState for read/write regions of NROs.
- Fixes #3541, used by Final Fantasy VIII Remastered.
2020-03-26 15:52:59 -04:00
Lioncash
cc3d6fdf73 core/memory: Migrate over Read{8, 16, 32, 64, Block} to the Memory class
With all of the trivial parts of the memory interface moved over, we can
get right into moving over the bits that are used.

Note that this does require the use of GetInstance from the global
system instance to be used within hle_ipc.cpp and the gdbstub. This is
fine for the time being, as they both already rely on the global system
instance in other functions. These will be removed in a change directed
at both of these respectively.

For now, it's sufficient, as it still accomplishes the goal of
de-globalizing the memory code.
2019-11-26 21:55:39 -05:00
Lioncash
4c6cd8b9e8 core: Migrate off deprecated mbedtls functions
These functions are marked for deprecation and it's recommended that the
*_ret variants be used instead.
2019-11-12 08:45:56 -05:00
Lioncash
e4e4af80e8 hle/service: Replace global system instance calls with instance-based ones
Migrates the HLE service code off the use of directly accessing the
global system instance where trivially able to do so.

This removes all usages of Core::CurrentProcess from the service code,
only 8 occurrences of this function exist elsewhere. There's still quite
a bit of "System::GetInstance()" being used, however this was able to
replace a few instances.
2019-10-06 13:42:23 -04:00
David Marcec
a2b9ed6d16 Deglobalize System: LDR 2019-09-22 16:30:31 +10:00
Michael Scire
902cad78ee Restore memory perms on svcUnmapMemory/UnloadNro
Prior to PR, Yuzu did not restore memory to RW-
on unmap of mirrored memory or unloading of NRO.

(In fact, in the NRO case, the memory was unmapped
instead of reprotected to --- on Load, so it was
actually lost entirely...)

This PR addresses that, and restores memory to RW-
as it should.

This fixes a crash in Super Smash Bros when creating
a World of Light save for the first time, and possibly
other games/circumstances.
2019-07-11 01:38:28 -07:00
Lioncash
59d55c8137 common/hex_util: Combine HexVectorToString() and HexArrayToString()
These can be generified together by using a concept type to designate
them. This also has the benefit of not making copies of potentially very
large arrays.
2019-06-12 17:54:05 -04:00
bunnei
d41d65dd10 Merge pull request #2382 from lioncash/table
service: Update service function tables
2019-04-15 21:46:15 -04:00
Lioncash
14ead4ceb0 service: Update service function tables
Updates function tables based off information from SwitchBrew.
2019-04-11 02:47:00 -04:00
Lioncash
d0484bc83d ldr: Mark IsValidNROHash() as a const member function
This doesn't modify instance state, so it can be made const.
2019-04-10 15:57:02 -04:00
Lioncash
5e0b8ed169 ldr: Amend parameters for LoadNro/UnloadNro LoadNrr/UnloadNrr
The initial two words indicate a process ID. Also UnloadNro only
specifies one address, not two.
2019-04-10 15:56:43 -04:00
Lioncash
60a98211a2 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
e835034c17 kernel/process: Remove most allocation functions from Process' interface
In all cases that these functions are needed, the VMManager can just be
retrieved and used instead of providing the same functions in Process'
interface.

This also makes it a little nicer dependency-wise, since it gets rid of
cases where the VMManager interface was being used, and then switched
over to using the interface for a Process instance. Instead, it makes
all accesses uniform and uses the VMManager instance for all necessary
tasks.

All the basic memory mapping functions did was forward to the Process'
VMManager instance anyways.
2018-12-27 19:08:47 -05:00
bunnei
60a2d6f613 Merge pull request #1864 from lioncash/nrr
service/ldr: Amend layouts of NRO and NRR headers
2018-12-07 22:26:31 -05:00