diff options
| author | 2016-09-18 09:38:01 +0900 | |
|---|---|---|
| committer | 2016-09-18 09:38:01 +0900 | |
| commit | dc8479928c5aee4c6ad6fe4f59006fb604cee701 (patch) | |
| tree | 569a7f13128450bbab973236615587ff00bced5f /src/core/hle/kernel/kernel.h | |
| parent | Travis: Import Dolphin’s clang-format hook. (diff) | |
| download | yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.gz yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.xz yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.zip | |
Sources: Run clang-format on everything.
Diffstat (limited to 'src/core/hle/kernel/kernel.h')
| -rw-r--r-- | src/core/hle/kernel/kernel.h | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 27ba3f912..cc39652d5 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h | |||
| @@ -23,48 +23,55 @@ class Thread; | |||
| 23 | 23 | ||
| 24 | // TODO: Verify code | 24 | // TODO: Verify code |
| 25 | const ResultCode ERR_OUT_OF_HANDLES(ErrorDescription::OutOfMemory, ErrorModule::Kernel, | 25 | const ResultCode ERR_OUT_OF_HANDLES(ErrorDescription::OutOfMemory, ErrorModule::Kernel, |
| 26 | ErrorSummary::OutOfResource, ErrorLevel::Temporary); | 26 | ErrorSummary::OutOfResource, ErrorLevel::Temporary); |
| 27 | // TOOD: Verify code | 27 | // TOOD: Verify code |
| 28 | const ResultCode ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::Kernel, | 28 | const ResultCode ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::Kernel, |
| 29 | ErrorSummary::InvalidArgument, ErrorLevel::Permanent); | 29 | ErrorSummary::InvalidArgument, ErrorLevel::Permanent); |
| 30 | 30 | ||
| 31 | enum KernelHandle : Handle { | 31 | enum KernelHandle : Handle { |
| 32 | CurrentThread = 0xFFFF8000, | 32 | CurrentThread = 0xFFFF8000, |
| 33 | CurrentProcess = 0xFFFF8001, | 33 | CurrentProcess = 0xFFFF8001, |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | enum class HandleType : u32 { | 36 | enum class HandleType : u32 { |
| 37 | Unknown = 0, | 37 | Unknown = 0, |
| 38 | 38 | ||
| 39 | Session = 2, | 39 | Session = 2, |
| 40 | Event = 3, | 40 | Event = 3, |
| 41 | Mutex = 4, | 41 | Mutex = 4, |
| 42 | SharedMemory = 5, | 42 | SharedMemory = 5, |
| 43 | Redirection = 6, | 43 | Redirection = 6, |
| 44 | Thread = 7, | 44 | Thread = 7, |
| 45 | Process = 8, | 45 | Process = 8, |
| 46 | AddressArbiter = 9, | 46 | AddressArbiter = 9, |
| 47 | Semaphore = 10, | 47 | Semaphore = 10, |
| 48 | Timer = 11, | 48 | Timer = 11, |
| 49 | ResourceLimit = 12, | 49 | ResourceLimit = 12, |
| 50 | CodeSet = 13, | 50 | CodeSet = 13, |
| 51 | ClientPort = 14, | 51 | ClientPort = 14, |
| 52 | ServerPort = 15, | 52 | ServerPort = 15, |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | enum { | 55 | enum { |
| 56 | DEFAULT_STACK_SIZE = 0x4000, | 56 | DEFAULT_STACK_SIZE = 0x4000, |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | class Object : NonCopyable { | 59 | class Object : NonCopyable { |
| 60 | public: | 60 | public: |
| 61 | virtual ~Object() {} | 61 | virtual ~Object() { |
| 62 | } | ||
| 62 | 63 | ||
| 63 | /// Returns a unique identifier for the object. For debugging purposes only. | 64 | /// Returns a unique identifier for the object. For debugging purposes only. |
| 64 | unsigned int GetObjectId() const { return object_id; } | 65 | unsigned int GetObjectId() const { |
| 66 | return object_id; | ||
| 67 | } | ||
| 65 | 68 | ||
| 66 | virtual std::string GetTypeName() const { return "[BAD KERNEL OBJECT TYPE]"; } | 69 | virtual std::string GetTypeName() const { |
| 67 | virtual std::string GetName() const { return "[UNKNOWN KERNEL OBJECT]"; } | 70 | return "[BAD KERNEL OBJECT TYPE]"; |
| 71 | } | ||
| 72 | virtual std::string GetName() const { | ||
| 73 | return "[UNKNOWN KERNEL OBJECT]"; | ||
| 74 | } | ||
| 68 | virtual Kernel::HandleType GetHandleType() const = 0; | 75 | virtual Kernel::HandleType GetHandleType() const = 0; |
| 69 | 76 | ||
| 70 | /** | 77 | /** |
| @@ -122,7 +129,6 @@ using SharedPtr = boost::intrusive_ptr<T>; | |||
| 122 | /// Class that represents a Kernel object that a thread can be waiting on | 129 | /// Class that represents a Kernel object that a thread can be waiting on |
| 123 | class WaitObject : public Object { | 130 | class WaitObject : public Object { |
| 124 | public: | 131 | public: |
| 125 | |||
| 126 | /** | 132 | /** |
| 127 | * Check if the current thread should wait until the object is available | 133 | * Check if the current thread should wait until the object is available |
| 128 | * @return True if the current thread should wait due to this object being unavailable | 134 | * @return True if the current thread should wait due to this object being unavailable |
| @@ -247,8 +253,12 @@ private: | |||
| 247 | */ | 253 | */ |
| 248 | static const size_t MAX_COUNT = 4096; | 254 | static const size_t MAX_COUNT = 4096; |
| 249 | 255 | ||
| 250 | static u16 GetSlot(Handle handle) { return handle >> 15; } | 256 | static u16 GetSlot(Handle handle) { |
| 251 | static u16 GetGeneration(Handle handle) { return handle & 0x7FFF; } | 257 | return handle >> 15; |
| 258 | } | ||
| 259 | static u16 GetGeneration(Handle handle) { | ||
| 260 | return handle & 0x7FFF; | ||
| 261 | } | ||
| 252 | 262 | ||
| 253 | /// Stores the Object referenced by the handle or null if the slot is empty. | 263 | /// Stores the Object referenced by the handle or null if the slot is empty. |
| 254 | std::array<SharedPtr<Object>, MAX_COUNT> objects; | 264 | std::array<SharedPtr<Object>, MAX_COUNT> objects; |