From 2fd45093f21ca32272d51771025418eda3914d7f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 25 Aug 2018 05:37:37 -0400 Subject: kernel/error: Correct kernel error code for invalid combination --- src/core/hle/kernel/errors.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index 221cb1bb5..c4d9e8ea9 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h @@ -45,7 +45,8 @@ constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); 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(-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); -- cgit v1.2.3 From b8be5524bc3fd9c1d31a4a56cb321840c42ef0bb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 25 Aug 2018 05:40:42 -0400 Subject: kernel/error: Add error code for invalid memory permissions --- src/core/hle/kernel/errors.h | 5 +++-- src/core/hle/kernel/shared_memory.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index c4d9e8ea9..8b4e05191 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h @@ -15,13 +15,13 @@ enum { SessionClosedByRemote = 26, PortNameTooLong = 30, NoPendingSessions = 35, - WrongPermission = 46, InvalidBufferDescriptor = 48, MaxConnectionsReached = 52, // Confirmed Switch OS error codes InvalidAddress = 102, InvalidMemoryState = 106, + InvalidMemoryPermissions = 108, InvalidProcessorId = 113, InvalidHandle = 114, InvalidCombination = 116, @@ -40,7 +40,6 @@ enum { constexpr ResultCode ERR_OUT_OF_HANDLES(-1); constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(-1); constexpr ResultCode ERR_PORT_NAME_TOO_LONG(-1); -constexpr ResultCode ERR_WRONG_PERMISSION(-1); constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); constexpr ResultCode ERR_INVALID_ENUM_VALUE(ErrorModule::Kernel, ErrCodes::InvalidEnumValue); constexpr ResultCode ERR_INVALID_ENUM_VALUE_FND(-1); @@ -50,6 +49,8 @@ constexpr ResultCode ERR_INVALID_COMBINATION_KERNEL(ErrorModule::Kernel, 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, + ErrCodes::InvalidMemoryPermissions); constexpr ResultCode ERR_INVALID_HANDLE(ErrorModule::Kernel, ErrCodes::InvalidHandle); constexpr ResultCode ERR_INVALID_STATE(ErrorModule::Kernel, ErrCodes::InvalidState); constexpr ResultCode ERR_INVALID_POINTER(-1); diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 21ddc2f7d..fc168d2b5 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -101,7 +101,7 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi static_cast(this->permissions) & ~static_cast(other_permissions)) { LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", GetObjectId(), address, name); - return ERR_WRONG_PERMISSION; + return ERR_INVALID_MEMORY_PERMISSIONS; } VAddr target_address = address; -- cgit v1.2.3 From 81ca46dd17dafa2a474a6f8eed748d604516034d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 25 Aug 2018 05:44:51 -0400 Subject: 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. --- src/core/hle/kernel/errors.h | 4 ++-- src/core/hle/kernel/handle_table.cpp | 2 +- src/core/hle/kernel/handle_table.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core') diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index 8b4e05191..59c5c2a67 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h @@ -11,7 +11,6 @@ namespace Kernel { namespace ErrCodes { enum { // TODO(Subv): Remove these 3DS OS error codes. - OutOfHandles = 19, SessionClosedByRemote = 26, PortNameTooLong = 30, NoPendingSessions = 35, @@ -20,6 +19,7 @@ enum { // Confirmed Switch OS error codes InvalidAddress = 102, + HandleTableFull = 105, InvalidMemoryState = 106, InvalidMemoryPermissions = 108, InvalidProcessorId = 113, @@ -37,7 +37,7 @@ enum { // double check that the code matches before re-using the constant. // TODO(bunnei): Replace these with correct errors for Switch OS -constexpr ResultCode ERR_OUT_OF_HANDLES(-1); +constexpr ResultCode ERR_HANDLE_TABLE_FULL(ErrorModule::Kernel, ErrCodes::HandleTableFull); constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(-1); constexpr ResultCode ERR_PORT_NAME_TOO_LONG(-1); constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp index 28e21428a..6d9f7a02b 100644 --- a/src/core/hle/kernel/handle_table.cpp +++ b/src/core/hle/kernel/handle_table.cpp @@ -26,7 +26,7 @@ ResultVal HandleTable::Create(SharedPtr obj) { u16 slot = next_free_slot; if (slot >= generations.size()) { LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use."); - return ERR_OUT_OF_HANDLES; + return ERR_HANDLE_TABLE_FULL; } next_free_slot = generations[slot]; diff --git a/src/core/hle/kernel/handle_table.h b/src/core/hle/kernel/handle_table.h index 22ddda630..aee3583e8 100644 --- a/src/core/hle/kernel/handle_table.h +++ b/src/core/hle/kernel/handle_table.h @@ -47,7 +47,7 @@ public: /** * Allocates a handle for the given object. * @return The created Handle or one of the following errors: - * - `ERR_OUT_OF_HANDLES`: the maximum number of handles has been exceeded. + * - `ERR_HANDLE_TABLE_FULL`: the maximum number of handles has been exceeded. */ ResultVal Create(SharedPtr obj); -- cgit v1.2.3 From bfb0c87b7be3adc6b40247819e99f5071deee647 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 25 Aug 2018 05:52:57 -0400 Subject: 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. --- src/core/hle/kernel/errors.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index 59c5c2a67..a2df8e2e8 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h @@ -12,7 +12,6 @@ namespace ErrCodes { enum { // TODO(Subv): Remove these 3DS OS error codes. SessionClosedByRemote = 26, - PortNameTooLong = 30, NoPendingSessions = 35, InvalidBufferDescriptor = 48, MaxConnectionsReached = 52, @@ -39,7 +38,7 @@ enum { // TODO(bunnei): Replace these 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_PORT_NAME_TOO_LONG(-1); +constexpr ResultCode ERR_PORT_NAME_TOO_LONG(ErrorModule::Kernel, ErrCodes::TooLarge); constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); constexpr ResultCode ERR_INVALID_ENUM_VALUE(ErrorModule::Kernel, ErrCodes::InvalidEnumValue); constexpr ResultCode ERR_INVALID_ENUM_VALUE_FND(-1); -- cgit v1.2.3 From f708207ae6209229de0bde1c5c6a43d7345575d0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 25 Aug 2018 06:15:58 -0400 Subject: 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. --- src/core/hle/kernel/errors.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index a2df8e2e8..4054d5db6 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h @@ -14,9 +14,9 @@ enum { SessionClosedByRemote = 26, NoPendingSessions = 35, InvalidBufferDescriptor = 48, - MaxConnectionsReached = 52, // Confirmed Switch OS error codes + MaxConnectionsReached = 7, InvalidAddress = 102, HandleTableFull = 105, InvalidMemoryState = 106, @@ -29,6 +29,7 @@ enum { TooLarge = 119, InvalidEnumValue = 120, InvalidState = 125, + ResourceLimitExceeded = 132, }; } @@ -39,7 +40,8 @@ enum { constexpr ResultCode ERR_HANDLE_TABLE_FULL(ErrorModule::Kernel, ErrCodes::HandleTableFull); constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(-1); constexpr ResultCode ERR_PORT_NAME_TOO_LONG(ErrorModule::Kernel, ErrCodes::TooLarge); -constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); +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); -- cgit v1.2.3