diff options
Diffstat (limited to 'src/core/hle/kernel')
| -rw-r--r-- | src/core/hle/kernel/errors.h | 94 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 5 |
2 files changed, 22 insertions, 77 deletions
diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index 64aa61460..f8890f0e3 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h | |||
| @@ -23,81 +23,27 @@ enum { | |||
| 23 | // WARNING: The kernel is quite inconsistent in it's usage of errors code. Make sure to always | 23 | // WARNING: The kernel is quite inconsistent in it's usage of errors code. Make sure to always |
| 24 | // double check that the code matches before re-using the constant. | 24 | // double check that the code matches before re-using the constant. |
| 25 | 25 | ||
| 26 | constexpr ResultCode ERR_OUT_OF_HANDLES(ErrCodes::OutOfHandles, ErrorModule::Kernel, | 26 | // TODO(bunnei): Replace these with correct errors for Switch OS |
| 27 | ErrorSummary::OutOfResource, | 27 | constexpr ResultCode ERR_OUT_OF_HANDLES(-1); |
| 28 | ErrorLevel::Permanent); // 0xD8600413 | 28 | constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(-1); |
| 29 | constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(ErrCodes::SessionClosedByRemote, ErrorModule::OS, | 29 | constexpr ResultCode ERR_PORT_NAME_TOO_LONG(-1); |
| 30 | ErrorSummary::Canceled, | 30 | constexpr ResultCode ERR_WRONG_PERMISSION(-1); |
| 31 | ErrorLevel::Status); // 0xC920181A | 31 | constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); |
| 32 | constexpr ResultCode ERR_PORT_NAME_TOO_LONG(ErrCodes::PortNameTooLong, ErrorModule::OS, | 32 | constexpr ResultCode ERR_INVALID_ENUM_VALUE(-1); |
| 33 | ErrorSummary::InvalidArgument, | 33 | constexpr ResultCode ERR_INVALID_ENUM_VALUE_FND(-1); |
| 34 | ErrorLevel::Usage); // 0xE0E0181E | 34 | constexpr ResultCode ERR_INVALID_COMBINATION(-1); |
| 35 | constexpr ResultCode ERR_WRONG_PERMISSION(ErrCodes::WrongPermission, ErrorModule::OS, | 35 | constexpr ResultCode ERR_INVALID_COMBINATION_KERNEL(-1); |
| 36 | ErrorSummary::WrongArgument, ErrorLevel::Permanent); | 36 | constexpr ResultCode ERR_OUT_OF_MEMORY(-1); |
| 37 | constexpr ResultCode ERR_INVALID_BUFFER_DESCRIPTOR(ErrCodes::InvalidBufferDescriptor, | 37 | constexpr ResultCode ERR_INVALID_ADDRESS(-1); |
| 38 | ErrorModule::OS, ErrorSummary::WrongArgument, | 38 | constexpr ResultCode ERR_INVALID_ADDRESS_STATE(-1); |
| 39 | ErrorLevel::Permanent); | 39 | constexpr ResultCode ERR_INVALID_HANDLE(-1); |
| 40 | constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(ErrCodes::MaxConnectionsReached, ErrorModule::OS, | ||
| 41 | ErrorSummary::WouldBlock, | ||
| 42 | ErrorLevel::Temporary); // 0xD0401834 | ||
| 43 | |||
| 44 | constexpr ResultCode ERR_NOT_AUTHORIZED(ErrorDescription::NotAuthorized, ErrorModule::OS, | ||
| 45 | ErrorSummary::WrongArgument, | ||
| 46 | ErrorLevel::Permanent); // 0xD9001BEA | ||
| 47 | constexpr ResultCode ERR_INVALID_ENUM_VALUE(ErrorDescription::InvalidEnumValue, ErrorModule::Kernel, | ||
| 48 | ErrorSummary::InvalidArgument, | ||
| 49 | ErrorLevel::Permanent); // 0xD8E007ED | ||
| 50 | constexpr ResultCode ERR_INVALID_ENUM_VALUE_FND(ErrorDescription::InvalidEnumValue, | ||
| 51 | ErrorModule::FND, ErrorSummary::InvalidArgument, | ||
| 52 | ErrorLevel::Permanent); // 0xD8E093ED | ||
| 53 | constexpr ResultCode ERR_INVALID_COMBINATION(ErrorDescription::InvalidCombination, ErrorModule::OS, | ||
| 54 | ErrorSummary::InvalidArgument, | ||
| 55 | ErrorLevel::Usage); // 0xE0E01BEE | ||
| 56 | constexpr ResultCode ERR_INVALID_COMBINATION_KERNEL(ErrorDescription::InvalidCombination, | ||
| 57 | ErrorModule::Kernel, | ||
| 58 | ErrorSummary::WrongArgument, | ||
| 59 | ErrorLevel::Permanent); // 0xD90007EE | ||
| 60 | constexpr ResultCode ERR_MISALIGNED_ADDRESS(ErrorDescription::MisalignedAddress, ErrorModule::OS, | ||
| 61 | ErrorSummary::InvalidArgument, | ||
| 62 | ErrorLevel::Usage); // 0xE0E01BF1 | ||
| 63 | constexpr ResultCode ERR_MISALIGNED_SIZE(ErrorDescription::MisalignedSize, ErrorModule::OS, | ||
| 64 | ErrorSummary::InvalidArgument, | ||
| 65 | ErrorLevel::Usage); // 0xE0E01BF2 | ||
| 66 | constexpr ResultCode ERR_OUT_OF_MEMORY(ErrorDescription::OutOfMemory, ErrorModule::Kernel, | ||
| 67 | ErrorSummary::OutOfResource, | ||
| 68 | ErrorLevel::Permanent); // 0xD86007F3 | ||
| 69 | constexpr ResultCode ERR_NOT_IMPLEMENTED(ErrorDescription::NotImplemented, ErrorModule::OS, | ||
| 70 | ErrorSummary::InvalidArgument, | ||
| 71 | ErrorLevel::Usage); // 0xE0E01BF4 | ||
| 72 | constexpr ResultCode ERR_INVALID_ADDRESS(ErrorDescription::InvalidAddress, ErrorModule::OS, | ||
| 73 | ErrorSummary::InvalidArgument, | ||
| 74 | ErrorLevel::Usage); // 0xE0E01BF5 | ||
| 75 | constexpr ResultCode ERR_INVALID_ADDRESS_STATE(ErrorDescription::InvalidAddress, ErrorModule::OS, | ||
| 76 | ErrorSummary::InvalidState, | ||
| 77 | ErrorLevel::Usage); // 0xE0A01BF5 | ||
| 78 | constexpr ResultCode ERR_INVALID_POINTER(ErrorDescription::InvalidPointer, ErrorModule::Kernel, | ||
| 79 | ErrorSummary::InvalidArgument, | ||
| 80 | ErrorLevel::Permanent); // 0xD8E007F6 | ||
| 81 | constexpr ResultCode ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::Kernel, | ||
| 82 | ErrorSummary::InvalidArgument, | ||
| 83 | ErrorLevel::Permanent); // 0xD8E007F7 | ||
| 84 | /// Alternate code returned instead of ERR_INVALID_HANDLE in some code paths. | 40 | /// Alternate code returned instead of ERR_INVALID_HANDLE in some code paths. |
| 85 | constexpr ResultCode ERR_INVALID_HANDLE_OS(ErrorDescription::InvalidHandle, ErrorModule::OS, | 41 | constexpr ResultCode ERR_INVALID_HANDLE_OS(-1); |
| 86 | ErrorSummary::WrongArgument, | 42 | constexpr ResultCode ERR_NOT_FOUND(-1); |
| 87 | ErrorLevel::Permanent); // 0xD9001BF7 | 43 | constexpr ResultCode ERR_OUT_OF_RANGE(-1); |
| 88 | constexpr ResultCode ERR_NOT_FOUND(ErrorDescription::NotFound, ErrorModule::Kernel, | 44 | constexpr ResultCode ERR_OUT_OF_RANGE_KERNEL(-1); |
| 89 | ErrorSummary::NotFound, ErrorLevel::Permanent); // 0xD88007FA | 45 | constexpr ResultCode RESULT_TIMEOUT(-1); |
| 90 | constexpr ResultCode ERR_OUT_OF_RANGE(ErrorDescription::OutOfRange, ErrorModule::OS, | ||
| 91 | ErrorSummary::InvalidArgument, | ||
| 92 | ErrorLevel::Usage); // 0xE0E01BFD | ||
| 93 | constexpr ResultCode ERR_OUT_OF_RANGE_KERNEL(ErrorDescription::OutOfRange, ErrorModule::Kernel, | ||
| 94 | ErrorSummary::InvalidArgument, | ||
| 95 | ErrorLevel::Permanent); // 0xD8E007FD | ||
| 96 | constexpr ResultCode RESULT_TIMEOUT(ErrorDescription::Timeout, ErrorModule::OS, | ||
| 97 | ErrorSummary::StatusChanged, ErrorLevel::Info); | ||
| 98 | /// Returned when Accept() is called on a port with no sessions to be accepted. | 46 | /// Returned when Accept() is called on a port with no sessions to be accepted. |
| 99 | constexpr ResultCode ERR_NO_PENDING_SESSIONS(ErrCodes::NoPendingSessions, ErrorModule::OS, | 47 | constexpr ResultCode ERR_NO_PENDING_SESSIONS(-1); |
| 100 | ErrorSummary::WouldBlock, | ||
| 101 | ErrorLevel::Permanent); // 0xD8401823 | ||
| 102 | 48 | ||
| 103 | } // namespace Kernel | 49 | } // namespace Kernel |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 8b72084bf..372cafdd9 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -386,9 +386,8 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, | |||
| 386 | 386 | ||
| 387 | if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) { | 387 | if (!Memory::IsValidVirtualAddress(*owner_process, entry_point)) { |
| 388 | LOG_ERROR(Kernel_SVC, "(name=%s): invalid entry %08x", name.c_str(), entry_point); | 388 | LOG_ERROR(Kernel_SVC, "(name=%s): invalid entry %08x", name.c_str(), entry_point); |
| 389 | // TODO: Verify error | 389 | // TODO (bunnei): Find the correct error code to use here |
| 390 | return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::Kernel, | 390 | return ResultCode(-1); |
| 391 | ErrorSummary::InvalidArgument, ErrorLevel::Permanent); | ||
| 392 | } | 391 | } |
| 393 | 392 | ||
| 394 | SharedPtr<Thread> thread(new Thread); | 393 | SharedPtr<Thread> thread(new Thread); |