diff --git a/mesosphere/include/mesosphere/core/Result.hpp b/mesosphere/include/mesosphere/core/Result.hpp index ce0fee42b..b351a9afe 100644 --- a/mesosphere/include/mesosphere/core/Result.hpp +++ b/mesosphere/include/mesosphere/core/Result.hpp @@ -5,7 +5,8 @@ namespace mesosphere { -struct Result { +class Result { + public: enum class Module : uint { None = 0, Kernel = 1, @@ -44,7 +45,7 @@ struct Result { AlreadyExists = 122, ConnectionClosed = 123, UnhandledUserInterrupt = 124, - NotPermitted = 125, + InvalidState = 125, ReservedValue = 126, InvalidHwBreakpoint = 127, FatalUserException = 128, @@ -58,15 +59,21 @@ struct Result { NotDebugged = 520, }; - Module module : 9; - Description description : 23; + Result() : module{(uint)Module::None}, description{(uint)Description::None} {} + Result(Description description, Module module = Module::Kernel) : module{(uint)module}, description{(uint)description} {} - Result() : module{Module::None}, description{Description::None} {} - Result(Description description, Module module = Module::Kernel) : description{description}, module{module} {} - - constexpr bool IsSuccess() const { return module == Module::None && description == Description::None; } + constexpr bool IsSuccess() const { return module == (uint)Module::None && description == (uint)Description::None; } constexpr bool operator==(const Result &other) const { return module == other.module && description == other.description; } constexpr bool operator!=(const Result &other) const { return !(*this == other); } + + constexpr Module GetModule() const { return (Module)module; } + constexpr Description GetDescription() const { return (Description)module; } + + void SetModule(Module module) { this->module = (uint)module; } + void SetDescription(Description description) { this->description = (uint)description;} + private: + uint module : 9; + uint description : 13; }; } diff --git a/mesosphere/include/mesosphere/threading/KThread.hpp b/mesosphere/include/mesosphere/threading/KThread.hpp index 8ecb78b26..7233b1333 100644 --- a/mesosphere/include/mesosphere/threading/KThread.hpp +++ b/mesosphere/include/mesosphere/threading/KThread.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -243,7 +244,7 @@ private: size_t numKernelMutexWaiters = 0; Handle syncResultHandle{}; - Result syncResult = 0; + Result syncResult{}; u64 lastScheduledTime = 0; };