yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Merge pull request #1177 from lioncash/err

kernel/error: Amend several error codes
This commit is contained in:
bunnei 2018-08-27 18:37:48 -04:00 committed by GitHub
commit a409d49bbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 12 deletions

View File

@ -11,17 +11,16 @@ namespace Kernel {
namespace ErrCodes { namespace ErrCodes {
enum { enum {
// TODO(Subv): Remove these 3DS OS error codes. // TODO(Subv): Remove these 3DS OS error codes.
OutOfHandles = 19,
SessionClosedByRemote = 26, SessionClosedByRemote = 26,
PortNameTooLong = 30,
NoPendingSessions = 35, NoPendingSessions = 35,
WrongPermission = 46,
InvalidBufferDescriptor = 48, InvalidBufferDescriptor = 48,
MaxConnectionsReached = 52,
// Confirmed Switch OS error codes // Confirmed Switch OS error codes
MaxConnectionsReached = 7,
InvalidAddress = 102, InvalidAddress = 102,
HandleTableFull = 105,
InvalidMemoryState = 106, InvalidMemoryState = 106,
InvalidMemoryPermissions = 108,
InvalidProcessorId = 113, InvalidProcessorId = 113,
InvalidHandle = 114, InvalidHandle = 114,
InvalidCombination = 116, InvalidCombination = 116,
@ -30,6 +29,7 @@ enum {
TooLarge = 119, TooLarge = 119,
InvalidEnumValue = 120, InvalidEnumValue = 120,
InvalidState = 125, InvalidState = 125,
ResourceLimitExceeded = 132,
}; };
} }
@ -37,18 +37,21 @@ enum {
// double check that the code matches before re-using the constant. // double check that the code matches before re-using the constant.
// TODO(bunnei): Replace these with correct errors for Switch OS // 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_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_WRONG_PERMISSION(-1); constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(ErrorModule::Kernel,
constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); ErrCodes::MaxConnectionsReached);
constexpr ResultCode ERR_INVALID_ENUM_VALUE(ErrorModule::Kernel, ErrCodes::InvalidEnumValue); constexpr ResultCode ERR_INVALID_ENUM_VALUE(ErrorModule::Kernel, ErrCodes::InvalidEnumValue);
constexpr ResultCode ERR_INVALID_ENUM_VALUE_FND(-1); constexpr ResultCode ERR_INVALID_ENUM_VALUE_FND(-1);
constexpr ResultCode ERR_INVALID_COMBINATION(-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_OUT_OF_MEMORY(-1);
constexpr ResultCode ERR_INVALID_ADDRESS(ErrorModule::Kernel, ErrCodes::InvalidAddress); constexpr ResultCode ERR_INVALID_ADDRESS(ErrorModule::Kernel, ErrCodes::InvalidAddress);
constexpr ResultCode ERR_INVALID_ADDRESS_STATE(ErrorModule::Kernel, ErrCodes::InvalidMemoryState); 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_HANDLE(ErrorModule::Kernel, ErrCodes::InvalidHandle);
constexpr ResultCode ERR_INVALID_STATE(ErrorModule::Kernel, ErrCodes::InvalidState); constexpr ResultCode ERR_INVALID_STATE(ErrorModule::Kernel, ErrCodes::InvalidState);
constexpr ResultCode ERR_INVALID_POINTER(-1); constexpr ResultCode ERR_INVALID_POINTER(-1);

View File

@ -26,7 +26,7 @@ ResultVal<Handle> HandleTable::Create(SharedPtr<Object> obj) {
u16 slot = next_free_slot; u16 slot = next_free_slot;
if (slot >= generations.size()) { if (slot >= generations.size()) {
LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use."); 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]; next_free_slot = generations[slot];

View File

@ -47,7 +47,7 @@ public:
/** /**
* Allocates a handle for the given object. * Allocates a handle for the given object.
* @return The created Handle or one of the following errors: * @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<Handle> Create(SharedPtr<Object> obj); ResultVal<Handle> Create(SharedPtr<Object> obj);

View File

@ -101,7 +101,7 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi
static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) { static_cast<u32>(this->permissions) & ~static_cast<u32>(other_permissions)) {
LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match", LOG_ERROR(Kernel, "cannot map id={}, address=0x{:X} name={}, permissions don't match",
GetObjectId(), address, name); GetObjectId(), address, name);
return ERR_WRONG_PERMISSION; return ERR_INVALID_MEMORY_PERMISSIONS;
} }
VAddr target_address = address; VAddr target_address = address;