Commit graph

35 commits

Author SHA1 Message Date
Fernando Sahmkow
d2a2c5f57b SVC: WaitSynchronization add Termination Pending Result. 2020-06-27 11:35:36 -04:00
bunnei
6ef844fab3 kernel: errors: Add ERR_OUT_OF_RESOURCES. 2020-04-17 00:59:31 -04:00
Lioncash
d396c08b13 kernel/handle_table: Allow process capabilities to limit the handle table size
The kernel allows restricting the total size of the handle table through
the process capability descriptors. Until now, this functionality wasn't
hooked up. With this, the process handle tables become properly restricted.

In the case of metadata-less executables, the handle table will assume
the maximum size is requested, preserving the behavior that existed
before these changes.
2019-02-25 11:12:32 -05:00
bunnei
25a218248a Merge pull request #1928 from lioncash/caps
kernel: Handle kernel capability descriptors
2018-12-27 11:15:34 -05:00
Lioncash
4fbfde34a1 kernel/process_capability: Handle program capability flags 2018-12-21 07:05:34 -05:00
Lioncash
c5c8b2ffb9 kernel/process: Introduce process capability parsing skeleton
We've had the old kernel capability parser from Citra, however, this is
unused code and doesn't actually map to how the kernel on the Switch
does it. This introduces the basic functional skeleton for parsing
process capabilities.
2018-12-21 07:05:31 -05:00
Luke Street
0652d95dab svc: Implement SetThreadActivity (thread suspension) 2018-12-04 01:23:50 -05:00
Lioncash
99cdc2b5d1 kernel/errors: Clean up error codes
Similar to PR 1706, which cleans up the error codes for the filesystem
code, but done for the kernel error codes. This removes the ErrCodes
namespace and specifies the errors directly. This also fixes up any
straggling lines of code that weren't using the named error codes where
applicable.
2018-11-16 14:32:30 -05:00
Lioncash
dd17fc6213 kernel/errors: Remove now-unused, unnecessary, error codes
Now that we've gotten the innaccurate error codes out of the way, we can
finally toss away a bunch of these, trimming down the error codes to
ones that are actually used and knocking out two TODO comments.
2018-10-24 14:58:37 -04:00
Lioncash
1bec1b6e99 kernel/server_port: Change error case return value in Accept() to ERR_NOT_FOUND
This is what the kernel does in this instance.
2018-10-24 14:23:38 -04:00
Lioncash
1206987215 kernel/error: Remove leftover 3DS error codes
These are now entirely unused and can be removed.
2018-10-24 14:21:37 -04:00
Lioncash
ad85a2da06 kernel/error: Add error code for invalid pointers
The kernel appears to return 0xE601 for this situation. Particularly in
svcWaitSynchronization, svcReplyAndReceive, and svcGetThreadContext
2018-10-24 13:41:32 -04:00
Lioncash
7748fd0e43 kernel/error: Add error code for closed sessions
The kernel appears to return 0xF601 for this case.
2018-10-24 13:38:39 -04:00
Lioncash
4f85c1d36f svc: Add missing address range sanitizing checks to MapMemory/UnmapMemory
This adds the missing address range checking that the service functions
do before attempting to map or unmap memory. Given that both service
functions perform the same set of checks in the same order, we can wrap
these into a function and just call it from both functions, which
deduplicates a little bit of code.
2018-10-10 20:30:49 -04:00
Lioncash
5238113b9c kernel/svc: Implement svcGetThreadContext()
Now that we have all of the rearranging and proper structure sizes in
place, it's fairly trivial to implement svcGetThreadContext(). In the
64-bit case we can more or less just write out the context as is, minus
some minor value sanitizing. In the 32-bit case we'll need to clear out
the registers that wouldn't normally be accessible from a 32-bit
AArch32 exectuable (or process).
2018-09-30 05:29:40 -04:00
bunnei
ac108e6259 Merge pull request #1313 from lioncash/error
kernel/errors: Amend error code for ERR_NOT_FOUND
2018-09-17 12:28:40 -04:00
Lioncash
3e8e34221e kernel/svc: Sanitize heap sizes within svcSetHeapSize()
The kernel checks if the given size is a multiple of 2MB and <= to 4GB
before going ahead and attempting to allocate that much memory.
2018-09-13 21:34:48 -04:00
Lioncash
52fcbcf500 kernel/errors: Amend error code for ERR_NOT_FOUND
This is the value returned by the kernel for svcConnectToNamedPort() if
the named port cannot be found.
2018-09-13 17:12:01 -04:00
Lioncash
d5ec89c1fb kernel/errors: Correct error codes for invalid thread priority and invalid processor ID 2018-09-12 05:19:57 -04:00
Lioncash
8eb062bba4 kernel/error: Amend error code for ERR_MAX_CONNECTIONS_REACHED
We can make this error code an alias of the resource limit exceeded
error code, allowing us to get rid of the lingering 3DS error code of
the same type.
2018-08-25 09:40:42 -04:00
Lioncash
4c6743a155 kernel/error: Amend error code for ERR_PORT_NAME_TOO_LONG
We can treat this as an alias of TooLarge for documentation purposes.
This also lets us get rid of another lingering 3DS-related error code.
2018-08-25 09:40:29 -04:00
Lioncash
ce900c1cb8 kernel/error: Add error code for the handle table being full
This replaces the lingering 3DS constant with the proper one, and
utilizes it within HandleTable's Create() member function.
2018-08-25 09:40:21 -04:00
Lioncash
d97ec0683f kernel/error: Add error code for invalid memory permissions 2018-08-25 09:40:12 -04:00
Lioncash
eec7892cad kernel/error: Correct kernel error code for invalid combination 2018-08-25 09:40:00 -04:00
Michael Scire
3119b64d86 Kernel/Arbiters: Implement WaitForAddress 2018-06-21 01:40:29 -06:00
Michael Scire
6e9b11ffa0 Kernel/Arbiters: Add stubs for 4.x SignalToAddress/WaitForAddres SVCs. 2018-06-21 00:49:43 -06:00
Subv
40c82fc9c5 Kernel/SVC: Support special core values -2 and -3 in svcSetThreadCoreMask.
Also added some proper error handling.
2018-05-30 21:36:29 -05:00
Subv
4e47dd5b59 Kernel: Corrected the implementation of svcArbitrateLock and svcArbitrateUnlock.
Switch mutexes are no longer kernel objects, they are managed in userland and only use the kernel to handle the contention case.
Mutex addresses store a special flag value (0x40000000) to notify the guest code that there are still some threads waiting for the mutex to be released. This flag is updated when a thread calls ArbitrateUnlock.

TODO:
* Fix svcWaitProcessWideKey
* Fix svcSignalProcessWideKey
* Remove the Mutex class.
2018-04-20 21:04:25 -05:00
bunnei
182548ec86 yuzu: Update license text to be consistent across project. 2018-01-13 16:22:39 -05:00
Subv
607a46a662 SVC: Implemented CancelSynchronization. 2018-01-09 15:02:04 -05:00
Subv
5685c764e4 ErrorCodes: Updated the InvalidHandle and Timeout kernel error codes. 2018-01-09 12:05:10 -05:00
bunnei
10022dc332 errors: Define missing kernel error codes. 2017-12-31 15:59:00 -05:00
bunnei
714dd3da6d hle: Use Switch formatted result codes. 2017-10-31 19:26:11 -04:00
Yuri Kunde Schlesner
afa851d0a4 Kernel: Implement AcceptSession SVC 2017-06-23 11:26:37 -07:00
Yuri Kunde Schlesner
467545ed48 Kernel: Centralize error definitions in errors.h 2017-05-24 21:06:00 -07:00