summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.h
diff options
context:
space:
mode:
authorGravatar Emmanuel Gil Peyrot2016-09-18 09:38:01 +0900
committerGravatar Emmanuel Gil Peyrot2016-09-18 09:38:01 +0900
commitdc8479928c5aee4c6ad6fe4f59006fb604cee701 (patch)
tree569a7f13128450bbab973236615587ff00bced5f /src/core/hle/kernel/kernel.h
parentTravis: Import Dolphin’s clang-format hook. (diff)
downloadyuzu-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.h66
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
25const ResultCode ERR_OUT_OF_HANDLES(ErrorDescription::OutOfMemory, ErrorModule::Kernel, 25const 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
28const ResultCode ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::Kernel, 28const ResultCode ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::Kernel,
29 ErrorSummary::InvalidArgument, ErrorLevel::Permanent); 29 ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
30 30
31enum KernelHandle : Handle { 31enum KernelHandle : Handle {
32 CurrentThread = 0xFFFF8000, 32 CurrentThread = 0xFFFF8000,
33 CurrentProcess = 0xFFFF8001, 33 CurrentProcess = 0xFFFF8001,
34}; 34};
35 35
36enum class HandleType : u32 { 36enum 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
55enum { 55enum {
56 DEFAULT_STACK_SIZE = 0x4000, 56 DEFAULT_STACK_SIZE = 0x4000,
57}; 57};
58 58
59class Object : NonCopyable { 59class Object : NonCopyable {
60public: 60public:
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
123class WaitObject : public Object { 130class WaitObject : public Object {
124public: 131public:
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;