Update src/core/hle/kernel/svc.cpp

Co-authored-by: liamwhite <liamwhite@users.noreply.github.com>
This commit is contained in:
comex 2022-06-25 18:00:29 -07:00 committed by GitHub
parent 48737a4bb2
commit a14438d013
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -917,17 +917,25 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
*result = system.Kernel().CurrentScheduler()->GetIdleThread()->GetCpuTime(); *result = system.Kernel().CurrentScheduler()->GetIdleThread()->GetCpuTime();
return ResultSuccess; return ResultSuccess;
} }
case GetInfoType::MesosphereCurrentProcess: { // Verify the input handle is invalid.
R_UNLESS(handle == InvalidHandle, ResultInvalidHandle); R_UNLESS(handle == InvalidHandle, ResultInvalidHandle);
// Verify the sub-type is valid.
R_UNLESS(info_sub_id == 0, ResultInvalidCombination); R_UNLESS(info_sub_id == 0, ResultInvalidCombination);
KProcess* const current_process = system.Kernel().CurrentProcess(); // Get the handle table.
Handle process_handle{}; KProcess* current_process = system.Kernel().CurrentProcess();
R_TRY(current_process->GetHandleTable().Add(&process_handle, current_process)); KHandleTable& handle_table = current_process->GetHandleTable();
*result = process_handle; // Get a new handle for the current process.
Handle tmp;
R_TRY(handle_table.Add(&tmp, current_process));
// Set the output.
*result = tmp;
// We succeeded.
return ResultSuccess; return ResultSuccess;
}
default: default:
LOG_ERROR(Kernel_SVC, "Unimplemented svcGetInfo id=0x{:016X}", info_id); LOG_ERROR(Kernel_SVC, "Unimplemented svcGetInfo id=0x{:016X}", info_id);
return ResultInvalidEnumValue; return ResultInvalidEnumValue;