From 6df09f5b7639747d9d36f0f54f785277974e6abe Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 24 Oct 2018 13:38:34 -0400 Subject: kernel/error: Add error code for closed sessions The kernel appears to return 0xF601 for this case. --- src/core/hle/kernel/errors.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/core/hle/kernel/errors.h') diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index 885259618..c87cdfa64 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h @@ -26,6 +26,7 @@ enum { InvalidThreadPriority = 112, InvalidProcessorId = 113, InvalidHandle = 114, + InvalidPointer = 115, InvalidCombination = 116, Timeout = 117, SynchronizationCanceled = 118, @@ -33,6 +34,7 @@ enum { InvalidEnumValue = 120, NoSuchEntry = 121, AlreadyRegistered = 122, + SessionClosed = 123, InvalidState = 125, ResourceLimitExceeded = 132, }; @@ -43,7 +45,7 @@ enum { // TODO(bunnei): Replace -1 with correct errors for Switch OS constexpr ResultCode ERR_HANDLE_TABLE_FULL(ErrorModule::Kernel, ErrCodes::HandleTableFull); -constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(-1); +constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(ErrorModule::Kernel, ErrCodes::SessionClosed); constexpr ResultCode ERR_PORT_NAME_TOO_LONG(ErrorModule::Kernel, ErrCodes::TooLarge); constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(ErrorModule::Kernel, ErrCodes::MaxConnectionsReached); -- cgit v1.2.3 From c7c346a15d622283d0dc2cfd4c7d3c88810e65c6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 24 Oct 2018 13:41:09 -0400 Subject: kernel/error: Add error code for invalid pointers The kernel appears to return 0xE601 for this situation. Particularly in svcWaitSynchronization, svcReplyAndReceive, and svcGetThreadContext --- src/core/hle/kernel/errors.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/hle/kernel/errors.h') diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index c87cdfa64..94810d68f 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h @@ -67,7 +67,7 @@ constexpr ResultCode ERR_ALREADY_REGISTERED(ErrorModule::Kernel, ErrCodes::Alrea constexpr ResultCode ERR_INVALID_STATE(ErrorModule::Kernel, ErrCodes::InvalidState); constexpr ResultCode ERR_INVALID_THREAD_PRIORITY(ErrorModule::Kernel, ErrCodes::InvalidThreadPriority); -constexpr ResultCode ERR_INVALID_POINTER(-1); +constexpr ResultCode ERR_INVALID_POINTER(ErrorModule::Kernel, ErrCodes::InvalidPointer); constexpr ResultCode ERR_INVALID_OBJECT_ADDR(-1); constexpr ResultCode ERR_NOT_AUTHORIZED(-1); /// Alternate code returned instead of ERR_INVALID_HANDLE in some code paths. -- cgit v1.2.3 From afb7e5cc05be11b98ff307157d812cf9f24616f7 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 24 Oct 2018 14:16:04 -0400 Subject: kernel/error: Remove leftover 3DS error codes These are now entirely unused and can be removed. --- src/core/hle/kernel/errors.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/core/hle/kernel/errors.h') diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index 94810d68f..01e4e4bad 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h @@ -10,11 +10,6 @@ namespace Kernel { namespace ErrCodes { enum { - // TODO(Subv): Remove these 3DS OS error codes. - SessionClosedByRemote = 26, - NoPendingSessions = 35, - InvalidBufferDescriptor = 48, - // Confirmed Switch OS error codes MaxConnectionsReached = 7, InvalidSize = 101, -- cgit v1.2.3 From b703aba622d1d34df06a294610fb2cfe23df9e63 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 24 Oct 2018 14:23:36 -0400 Subject: kernel/server_port: Change error case return value in Accept() to ERR_NOT_FOUND This is what the kernel does in this instance. --- src/core/hle/kernel/errors.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/core/hle/kernel/errors.h') diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index 01e4e4bad..92436ae6d 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h @@ -69,7 +69,5 @@ constexpr ResultCode ERR_NOT_AUTHORIZED(-1); constexpr ResultCode ERR_INVALID_HANDLE_OS(-1); constexpr ResultCode ERR_NOT_FOUND(ErrorModule::Kernel, ErrCodes::NoSuchEntry); constexpr ResultCode RESULT_TIMEOUT(ErrorModule::Kernel, ErrCodes::Timeout); -/// Returned when Accept() is called on a port with no sessions to be accepted. -constexpr ResultCode ERR_NO_PENDING_SESSIONS(-1); } // namespace Kernel -- cgit v1.2.3 From 1fb4bebb63e2824c71259bc72b809d6c2bf48ca9 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 24 Oct 2018 14:55:55 -0400 Subject: 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. --- src/core/hle/kernel/errors.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/core/hle/kernel/errors.h') diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index 92436ae6d..ee698c8a7 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h @@ -38,18 +38,14 @@ enum { // WARNING: The kernel is quite inconsistent in it's usage of errors code. Make sure to always // double check that the code matches before re-using the constant. -// TODO(bunnei): Replace -1 with correct errors for Switch OS constexpr ResultCode ERR_HANDLE_TABLE_FULL(ErrorModule::Kernel, ErrCodes::HandleTableFull); constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(ErrorModule::Kernel, ErrCodes::SessionClosed); constexpr ResultCode ERR_PORT_NAME_TOO_LONG(ErrorModule::Kernel, ErrCodes::TooLarge); constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(ErrorModule::Kernel, ErrCodes::MaxConnectionsReached); constexpr ResultCode ERR_INVALID_ENUM_VALUE(ErrorModule::Kernel, ErrCodes::InvalidEnumValue); -constexpr ResultCode ERR_INVALID_ENUM_VALUE_FND(-1); -constexpr ResultCode ERR_INVALID_COMBINATION(-1); constexpr ResultCode ERR_INVALID_COMBINATION_KERNEL(ErrorModule::Kernel, ErrCodes::InvalidCombination); -constexpr ResultCode ERR_OUT_OF_MEMORY(-1); constexpr ResultCode ERR_INVALID_ADDRESS(ErrorModule::Kernel, ErrCodes::InvalidAddress); constexpr ResultCode ERR_INVALID_ADDRESS_STATE(ErrorModule::Kernel, ErrCodes::InvalidMemoryState); constexpr ResultCode ERR_INVALID_MEMORY_PERMISSIONS(ErrorModule::Kernel, @@ -63,10 +59,6 @@ constexpr ResultCode ERR_INVALID_STATE(ErrorModule::Kernel, ErrCodes::InvalidSta constexpr ResultCode ERR_INVALID_THREAD_PRIORITY(ErrorModule::Kernel, ErrCodes::InvalidThreadPriority); constexpr ResultCode ERR_INVALID_POINTER(ErrorModule::Kernel, ErrCodes::InvalidPointer); -constexpr ResultCode ERR_INVALID_OBJECT_ADDR(-1); -constexpr ResultCode ERR_NOT_AUTHORIZED(-1); -/// Alternate code returned instead of ERR_INVALID_HANDLE in some code paths. -constexpr ResultCode ERR_INVALID_HANDLE_OS(-1); constexpr ResultCode ERR_NOT_FOUND(ErrorModule::Kernel, ErrCodes::NoSuchEntry); constexpr ResultCode RESULT_TIMEOUT(ErrorModule::Kernel, ErrCodes::Timeout); -- cgit v1.2.3