Add Result.hpp

This commit is contained in:
TuxSH 2018-11-02 22:25:30 +01:00 committed by Michael Scire
parent cfeebbd1c9
commit b492096aed
2 changed files with 72 additions and 2 deletions

View file

@ -0,0 +1,72 @@
#pragma once
#include <mesosphere/core/types.hpp>
namespace mesosphere
{
struct Result {
enum class Module : uint {
None = 0,
Kernel = 1,
/* Other modules not included. */
};
enum class Description : uint {
None = 0,
InvalidCapabilityDescriptor = 14,
NotImplemented = 33,
ThreadTerminated = 59,
OutOfDebugEvents = 70,
InvalidSize = 101,
InvalidAddress = 102,
AllocatorDepleted = 103,
OutOfMemory = 104,
OutOfHandles = 105,
InvalidMemoryState = 106,
InvalidMemoryPermissions = 108,
InvalidMemoryRange = 110,
InvalidPriority = 112,
InvalidCoreId = 113,
InvalidHandle = 114,
InvalidUserBuffer = 115,
InvalidCombination = 116,
TimedOut = 117,
Cancelled = 118,
OutOfRange = 119,
InvalidEnumValue = 120,
NotFound = 121,
AlreadyExists = 122,
ConnectionClosed = 123,
UnhandledUserInterrupt = 124,
NotPermitted = 125,
ReservedValue = 126,
InvalidHwBreakpoint = 127,
FatalUserException = 128,
OwnedByAnotherProcess = 129,
ConnectionRefused = 131,
OutOfResource = 132,
IpcMapFailed = 259,
IpcCmdbufTooSmall = 260,
NotDebugged = 520,
};
Module module : 9;
Description description : 23;
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 operator==(const Result &other) const { return module == other.module && description == other.description; }
constexpr bool operator!=(const Result &other) const { return !(*this == other); }
};
}

View file

@ -39,8 +39,6 @@ using vs16 = volatile int16_t;
using vs32 = volatile int32_t;
using vs64 = volatile int64_t;
using Result = uint;
template <typename T>
using SharedPtr = boost::intrusive_ptr<T>;