Commit graph

47 commits

Author SHA1 Message Date
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
Lioncash
5b9f1fed1d service/ldr: Deduplicate instruction cache clearing code in LoadNro()
We don't need to specify all of the ARM interfaces explicitly.
2018-12-05 00:33:47 -05:00
Lioncash
2e01f8fdcd service/ldr: Amend layout of the NRO header
The first word is just a padding byte, it's not an actual entry
instruction. Also renames the rest of the entries according to
SwitchBrew.
2018-12-05 00:16:49 -05:00
Lioncash
361c5982f2 service/ldr: Corrent padding within the NRR header layout
The padding after the magic signature value should be 12 bytes rather
than 28 bytes. The other 16 should be placed after the title ID pattern.
2018-12-05 00:05:04 -05:00
David Marcec
5ae0d6cba2 Changed logging to be "Log before execution", Added more error logging, all services should now log on some level 2018-11-26 17:06:13 +11:00
Lioncash
93babd2c2f ldr: Clean up error codes
The separate enum isn't particularly necessary here, and the values can
just be directly put into the ResultCode instances, given the names are
also self-documenting here.
2018-11-19 08:12:25 -05:00
Zach Hilman
f46fd39579 ldr_ro: Add error check for memory allocation failure 2018-11-17 21:40:26 -05:00
Zach Hilman
74180648c4 ldr_ro: Implement UnloadNro (command 1)
Includes actual unmapping and address error checking.
2018-11-15 12:48:09 -05:00
Zach Hilman
5780aa1101 ldr_ro: Fully Implement LoadNro (command 0)
Includes NRO and BSS error checking, maximum loaded NRO check, NRR hash check, and proper remapping of BSS data.
2018-11-15 12:48:09 -05:00
Zach Hilman
9b94cb0f89 ldr_ro: Implement UnloadNrr (command 3)
Includes initialization check, proper address check, alignment check, and actual unloading of a loaded NRR.
2018-11-15 12:48:09 -05:00
Zach Hilman
d20dafc3f2 ldr_ro: Fully implement LoadNrr (command 2)
Includes parameter error checking, hash enforcement, initialization check, and max NRR load check.
2018-11-15 12:48:09 -05:00
bunnei
c86d76d65c ldr: Partially implement LoadNro.
- This is an incomplete implementation. It was tested with Super Mario Party.
2018-10-25 18:03:54 -04:00
Lioncash
fe262212e1 service: Add ldr services
Adds the skeleton for the ldr-related services based off the information
provided on Switch Brew.
2018-07-25 23:11:03 -04:00