HLE: Revamp error handling throrough the HLE code
All service calls in the CTR OS return result codes indicating the success or failure of the call. Previous to this commit, Citra's HLE emulation of services and the kernel universally either ignored errors or returned dummy -1 error codes. This commit makes an initial effort to provide an infrastructure for error reporting and propagation which can be use going forward to make HLE calls accurately return errors as the original system. A few parts of the code have been updated to use the new system where applicable. One part of this effort is the definition of the `ResultCode` type, which provides facilities for constructing and parsing error codes in the structured format used by the CTR. The `ResultVal` type builds on `ResultCode` by providing a container for values returned by function that can report errors. It enforces that correct error checking will be done on function returns by preventing the use of the return value if the function returned an error code. Currently this change is mostly internal since errors are still suppressed on the ARM<->HLE border, as a temporary compatibility hack. As functionality is implemented and tested this hack can be eventually removed.
This commit is contained in:
parent
924bbde89b
commit
c2588403c0
23 changed files with 689 additions and 310 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
enum ThreadPriority {
|
||||
THREADPRIO_HIGHEST = 0, ///< Highest thread priority
|
||||
|
@ -55,7 +56,7 @@ Handle SetupMainThread(s32 priority, int stack_size=Kernel::DEFAULT_STACK_SIZE);
|
|||
void Reschedule();
|
||||
|
||||
/// Stops the current thread
|
||||
void StopThread(Handle thread, const char* reason);
|
||||
ResultCode StopThread(Handle thread, const char* reason);
|
||||
|
||||
/// Resumes a thread from waiting by marking it as "ready"
|
||||
void ResumeThreadFromWait(Handle handle);
|
||||
|
@ -80,10 +81,10 @@ void WaitCurrentThread(WaitType wait_type, Handle wait_handle=GetCurrentThreadHa
|
|||
void WaitThread_Synchronization();
|
||||
|
||||
/// Get the priority of the thread specified by handle
|
||||
u32 GetThreadPriority(const Handle handle);
|
||||
ResultVal<u32> GetThreadPriority(const Handle handle);
|
||||
|
||||
/// Set the priority of the thread specified by handle
|
||||
Result SetThreadPriority(Handle handle, s32 priority);
|
||||
ResultCode SetThreadPriority(Handle handle, s32 priority);
|
||||
|
||||
/// Initialize threading
|
||||
void ThreadingInit();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue