diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/kernel/errors.h | 8 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 4 |
3 files changed, 11 insertions, 9 deletions
diff --git a/src/core/hle/kernel/errors.h b/src/core/hle/kernel/errors.h index 4054d5db6..ad39c8271 100644 --- a/src/core/hle/kernel/errors.h +++ b/src/core/hle/kernel/errors.h | |||
| @@ -21,6 +21,7 @@ enum { | |||
| 21 | HandleTableFull = 105, | 21 | HandleTableFull = 105, |
| 22 | InvalidMemoryState = 106, | 22 | InvalidMemoryState = 106, |
| 23 | InvalidMemoryPermissions = 108, | 23 | InvalidMemoryPermissions = 108, |
| 24 | InvalidThreadPriority = 112, | ||
| 24 | InvalidProcessorId = 113, | 25 | InvalidProcessorId = 113, |
| 25 | InvalidHandle = 114, | 26 | InvalidHandle = 114, |
| 26 | InvalidCombination = 116, | 27 | InvalidCombination = 116, |
| @@ -36,7 +37,7 @@ enum { | |||
| 36 | // WARNING: The kernel is quite inconsistent in it's usage of errors code. Make sure to always | 37 | // WARNING: The kernel is quite inconsistent in it's usage of errors code. Make sure to always |
| 37 | // double check that the code matches before re-using the constant. | 38 | // double check that the code matches before re-using the constant. |
| 38 | 39 | ||
| 39 | // TODO(bunnei): Replace these with correct errors for Switch OS | 40 | // TODO(bunnei): Replace -1 with correct errors for Switch OS |
| 40 | constexpr ResultCode ERR_HANDLE_TABLE_FULL(ErrorModule::Kernel, ErrCodes::HandleTableFull); | 41 | constexpr ResultCode ERR_HANDLE_TABLE_FULL(ErrorModule::Kernel, ErrCodes::HandleTableFull); |
| 41 | constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(-1); | 42 | constexpr ResultCode ERR_SESSION_CLOSED_BY_REMOTE(-1); |
| 42 | constexpr ResultCode ERR_PORT_NAME_TOO_LONG(ErrorModule::Kernel, ErrCodes::TooLarge); | 43 | constexpr ResultCode ERR_PORT_NAME_TOO_LONG(ErrorModule::Kernel, ErrCodes::TooLarge); |
| @@ -53,15 +54,16 @@ constexpr ResultCode ERR_INVALID_ADDRESS_STATE(ErrorModule::Kernel, ErrCodes::In | |||
| 53 | constexpr ResultCode ERR_INVALID_MEMORY_PERMISSIONS(ErrorModule::Kernel, | 54 | constexpr ResultCode ERR_INVALID_MEMORY_PERMISSIONS(ErrorModule::Kernel, |
| 54 | ErrCodes::InvalidMemoryPermissions); | 55 | ErrCodes::InvalidMemoryPermissions); |
| 55 | constexpr ResultCode ERR_INVALID_HANDLE(ErrorModule::Kernel, ErrCodes::InvalidHandle); | 56 | constexpr ResultCode ERR_INVALID_HANDLE(ErrorModule::Kernel, ErrCodes::InvalidHandle); |
| 57 | constexpr ResultCode ERR_INVALID_PROCESSOR_ID(ErrorModule::Kernel, ErrCodes::InvalidProcessorId); | ||
| 56 | constexpr ResultCode ERR_INVALID_STATE(ErrorModule::Kernel, ErrCodes::InvalidState); | 58 | constexpr ResultCode ERR_INVALID_STATE(ErrorModule::Kernel, ErrCodes::InvalidState); |
| 59 | constexpr ResultCode ERR_INVALID_THREAD_PRIORITY(ErrorModule::Kernel, | ||
| 60 | ErrCodes::InvalidThreadPriority); | ||
| 57 | constexpr ResultCode ERR_INVALID_POINTER(-1); | 61 | constexpr ResultCode ERR_INVALID_POINTER(-1); |
| 58 | constexpr ResultCode ERR_INVALID_OBJECT_ADDR(-1); | 62 | constexpr ResultCode ERR_INVALID_OBJECT_ADDR(-1); |
| 59 | constexpr ResultCode ERR_NOT_AUTHORIZED(-1); | 63 | constexpr ResultCode ERR_NOT_AUTHORIZED(-1); |
| 60 | /// Alternate code returned instead of ERR_INVALID_HANDLE in some code paths. | 64 | /// Alternate code returned instead of ERR_INVALID_HANDLE in some code paths. |
| 61 | constexpr ResultCode ERR_INVALID_HANDLE_OS(-1); | 65 | constexpr ResultCode ERR_INVALID_HANDLE_OS(-1); |
| 62 | constexpr ResultCode ERR_NOT_FOUND(-1); | 66 | constexpr ResultCode ERR_NOT_FOUND(-1); |
| 63 | constexpr ResultCode ERR_OUT_OF_RANGE(-1); | ||
| 64 | constexpr ResultCode ERR_OUT_OF_RANGE_KERNEL(-1); | ||
| 65 | constexpr ResultCode RESULT_TIMEOUT(ErrorModule::Kernel, ErrCodes::Timeout); | 67 | constexpr ResultCode RESULT_TIMEOUT(ErrorModule::Kernel, ErrCodes::Timeout); |
| 66 | /// Returned when Accept() is called on a port with no sessions to be accepted. | 68 | /// Returned when Accept() is called on a port with no sessions to be accepted. |
| 67 | constexpr ResultCode ERR_NO_PENDING_SESSIONS(-1); | 69 | constexpr ResultCode ERR_NO_PENDING_SESSIONS(-1); |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 0b2a7e3cb..f500fd2e7 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -382,7 +382,7 @@ static ResultCode GetThreadPriority(u32* priority, Handle handle) { | |||
| 382 | /// Sets the priority for the specified thread | 382 | /// Sets the priority for the specified thread |
| 383 | static ResultCode SetThreadPriority(Handle handle, u32 priority) { | 383 | static ResultCode SetThreadPriority(Handle handle, u32 priority) { |
| 384 | if (priority > THREADPRIO_LOWEST) { | 384 | if (priority > THREADPRIO_LOWEST) { |
| 385 | return ERR_OUT_OF_RANGE; | 385 | return ERR_INVALID_THREAD_PRIORITY; |
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | auto& kernel = Core::System::GetInstance().Kernel(); | 388 | auto& kernel = Core::System::GetInstance().Kernel(); |
| @@ -527,7 +527,7 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V | |||
| 527 | std::string name = fmt::format("unknown-{:X}", entry_point); | 527 | std::string name = fmt::format("unknown-{:X}", entry_point); |
| 528 | 528 | ||
| 529 | if (priority > THREADPRIO_LOWEST) { | 529 | if (priority > THREADPRIO_LOWEST) { |
| 530 | return ERR_OUT_OF_RANGE; | 530 | return ERR_INVALID_THREAD_PRIORITY; |
| 531 | } | 531 | } |
| 532 | 532 | ||
| 533 | SharedPtr<ResourceLimit>& resource_limit = Core::CurrentProcess()->resource_limit; | 533 | SharedPtr<ResourceLimit>& resource_limit = Core::CurrentProcess()->resource_limit; |
| @@ -548,8 +548,8 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V | |||
| 548 | case THREADPROCESSORID_3: | 548 | case THREADPROCESSORID_3: |
| 549 | break; | 549 | break; |
| 550 | default: | 550 | default: |
| 551 | ASSERT_MSG(false, "Unsupported thread processor ID: {}", processor_id); | 551 | LOG_ERROR(Kernel_SVC, "Invalid thread processor ID: {}", processor_id); |
| 552 | break; | 552 | return ERR_INVALID_PROCESSOR_ID; |
| 553 | } | 553 | } |
| 554 | 554 | ||
| 555 | auto& kernel = Core::System::GetInstance().Kernel(); | 555 | auto& kernel = Core::System::GetInstance().Kernel(); |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 3d10d9af2..3f12a84dc 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -227,12 +227,12 @@ ResultVal<SharedPtr<Thread>> Thread::Create(KernelCore& kernel, std::string name | |||
| 227 | // Check if priority is in ranged. Lowest priority -> highest priority id. | 227 | // Check if priority is in ranged. Lowest priority -> highest priority id. |
| 228 | if (priority > THREADPRIO_LOWEST) { | 228 | if (priority > THREADPRIO_LOWEST) { |
| 229 | LOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority); | 229 | LOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority); |
| 230 | return ERR_OUT_OF_RANGE; | 230 | return ERR_INVALID_THREAD_PRIORITY; |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | if (processor_id > THREADPROCESSORID_MAX) { | 233 | if (processor_id > THREADPROCESSORID_MAX) { |
| 234 | LOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id); | 234 | LOG_ERROR(Kernel_SVC, "Invalid processor id: {}", processor_id); |
| 235 | return ERR_OUT_OF_RANGE_KERNEL; | 235 | return ERR_INVALID_PROCESSOR_ID; |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | // TODO(yuriks): Other checks, returning 0xD9001BEA | 238 | // TODO(yuriks): Other checks, returning 0xD9001BEA |