summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2018-11-16 20:07:55 -0800
committerGravatar GitHub2018-11-16 20:07:55 -0800
commit224fcabe46cbf4292be386afec7b6aeaceaf9479 (patch)
tree101154ea8118853d734c66c9c9475f114de15e86 /src/core/hle/kernel/svc.cpp
parentMerge pull request #1712 from FearlessTobi/port-4426 (diff)
parentkernel/errors: Clean up error codes (diff)
downloadyuzu-224fcabe46cbf4292be386afec7b6aeaceaf9479.tar.gz
yuzu-224fcabe46cbf4292be386afec7b6aeaceaf9479.tar.xz
yuzu-224fcabe46cbf4292be386afec7b6aeaceaf9479.zip
Merge pull request #1714 from lioncash/kern-err
kernel/errors: Clean up error codes
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 5f4521122..2e7c9d094 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -214,7 +214,7 @@ static ResultCode ConnectToNamedPort(Handle* out_handle, VAddr port_name_address
214 // Read 1 char beyond the max allowed port name to detect names that are too long. 214 // Read 1 char beyond the max allowed port name to detect names that are too long.
215 std::string port_name = Memory::ReadCString(port_name_address, PortNameMaxLength + 1); 215 std::string port_name = Memory::ReadCString(port_name_address, PortNameMaxLength + 1);
216 if (port_name.size() > PortNameMaxLength) { 216 if (port_name.size() > PortNameMaxLength) {
217 return ERR_PORT_NAME_TOO_LONG; 217 return ERR_OUT_OF_RANGE;
218 } 218 }
219 219
220 LOG_TRACE(Kernel_SVC, "called port_name={}", port_name); 220 LOG_TRACE(Kernel_SVC, "called port_name={}", port_name);
@@ -310,8 +310,9 @@ static ResultCode WaitSynchronization(Handle* index, VAddr handles_address, u64
310 310
311 static constexpr u64 MaxHandles = 0x40; 311 static constexpr u64 MaxHandles = 0x40;
312 312
313 if (handle_count > MaxHandles) 313 if (handle_count > MaxHandles) {
314 return ResultCode(ErrorModule::Kernel, ErrCodes::TooLarge); 314 return ERR_OUT_OF_RANGE;
315 }
315 316
316 auto* const thread = GetCurrentThread(); 317 auto* const thread = GetCurrentThread();
317 318
@@ -376,8 +377,7 @@ static ResultCode CancelSynchronization(Handle thread_handle) {
376 } 377 }
377 378
378 ASSERT(thread->GetStatus() == ThreadStatus::WaitSynchAny); 379 ASSERT(thread->GetStatus() == ThreadStatus::WaitSynchAny);
379 thread->SetWaitSynchronizationResult( 380 thread->SetWaitSynchronizationResult(ERR_SYNCHRONIZATION_CANCELED);
380 ResultCode(ErrorModule::Kernel, ErrCodes::SynchronizationCanceled));
381 thread->ResumeFromWait(); 381 thread->ResumeFromWait();
382 return RESULT_SUCCESS; 382 return RESULT_SUCCESS;
383} 383}
@@ -606,7 +606,7 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
606 } 606 }
607 607
608 if (info_sub_id >= Process::RANDOM_ENTROPY_SIZE) { 608 if (info_sub_id >= Process::RANDOM_ENTROPY_SIZE) {
609 return ERR_INVALID_COMBINATION_KERNEL; 609 return ERR_INVALID_COMBINATION;
610 } 610 }
611 611
612 *result = current_process->GetRandomEntropy(info_sub_id); 612 *result = current_process->GetRandomEntropy(info_sub_id);
@@ -643,7 +643,7 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
643 case GetInfoType::ThreadTickCount: { 643 case GetInfoType::ThreadTickCount: {
644 constexpr u64 num_cpus = 4; 644 constexpr u64 num_cpus = 4;
645 if (info_sub_id != 0xFFFFFFFFFFFFFFFF && info_sub_id >= num_cpus) { 645 if (info_sub_id != 0xFFFFFFFFFFFFFFFF && info_sub_id >= num_cpus) {
646 return ERR_INVALID_COMBINATION_KERNEL; 646 return ERR_INVALID_COMBINATION;
647 } 647 }
648 648
649 const auto thread = 649 const auto thread =
@@ -1236,7 +1236,7 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) {
1236 } 1236 }
1237 1237
1238 if (mask == 0) { 1238 if (mask == 0) {
1239 return ResultCode(ErrorModule::Kernel, ErrCodes::InvalidCombination); 1239 return ERR_INVALID_COMBINATION;
1240 } 1240 }
1241 1241
1242 /// This value is used to only change the affinity mask without changing the current ideal core. 1242 /// This value is used to only change the affinity mask without changing the current ideal core.
@@ -1245,12 +1245,12 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) {
1245 if (core == OnlyChangeMask) { 1245 if (core == OnlyChangeMask) {
1246 core = thread->GetIdealCore(); 1246 core = thread->GetIdealCore();
1247 } else if (core >= Core::NUM_CPU_CORES && core != static_cast<u32>(-1)) { 1247 } else if (core >= Core::NUM_CPU_CORES && core != static_cast<u32>(-1)) {
1248 return ResultCode(ErrorModule::Kernel, ErrCodes::InvalidProcessorId); 1248 return ERR_INVALID_PROCESSOR_ID;
1249 } 1249 }
1250 1250
1251 // Error out if the input core isn't enabled in the input mask. 1251 // Error out if the input core isn't enabled in the input mask.
1252 if (core < Core::NUM_CPU_CORES && (mask & (1ull << core)) == 0) { 1252 if (core < Core::NUM_CPU_CORES && (mask & (1ull << core)) == 0) {
1253 return ResultCode(ErrorModule::Kernel, ErrCodes::InvalidCombination); 1253 return ERR_INVALID_COMBINATION;
1254 } 1254 }
1255 1255
1256 thread->ChangeCore(core, mask); 1256 thread->ChangeCore(core, mask);