summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.h
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2016-09-21 11:29:48 -0700
committerGravatar GitHub2016-09-21 11:29:48 -0700
commitd5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a (patch)
tree8a22ca73ff838f3f0090b29a548ae81087fc90ed /src/core/hle/kernel/kernel.h
parentREADME: Specify master branch for Travis CI badge (diff)
parentFix Travis clang-format check (diff)
downloadyuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.gz
yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.xz
yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.zip
Merge pull request #2086 from linkmauve/clang-format
Add clang-format as part of our {commit,travis}-time checks
Diffstat (limited to 'src/core/hle/kernel/kernel.h')
-rw-r--r--src/core/hle/kernel/kernel.h68
1 files changed, 37 insertions, 31 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 27ba3f912..0e95f7ff0 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -4,16 +4,13 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <boost/smart_ptr/intrusive_ptr.hpp>
8
9#include <algorithm> 7#include <algorithm>
10#include <array> 8#include <array>
11#include <cstddef> 9#include <cstddef>
12#include <string> 10#include <string>
13#include <vector> 11#include <vector>
14 12#include <boost/smart_ptr/intrusive_ptr.hpp>
15#include "common/common_types.h" 13#include "common/common_types.h"
16
17#include "core/hle/hle.h" 14#include "core/hle/hle.h"
18#include "core/hle/result.h" 15#include "core/hle/result.h"
19 16
@@ -23,37 +20,37 @@ class Thread;
23 20
24// TODO: Verify code 21// TODO: Verify code
25const ResultCode ERR_OUT_OF_HANDLES(ErrorDescription::OutOfMemory, ErrorModule::Kernel, 22const ResultCode ERR_OUT_OF_HANDLES(ErrorDescription::OutOfMemory, ErrorModule::Kernel,
26 ErrorSummary::OutOfResource, ErrorLevel::Temporary); 23 ErrorSummary::OutOfResource, ErrorLevel::Temporary);
27// TOOD: Verify code 24// TOOD: Verify code
28const ResultCode ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::Kernel, 25const ResultCode ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::Kernel,
29 ErrorSummary::InvalidArgument, ErrorLevel::Permanent); 26 ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
30 27
31enum KernelHandle : Handle { 28enum KernelHandle : Handle {
32 CurrentThread = 0xFFFF8000, 29 CurrentThread = 0xFFFF8000,
33 CurrentProcess = 0xFFFF8001, 30 CurrentProcess = 0xFFFF8001,
34}; 31};
35 32
36enum class HandleType : u32 { 33enum class HandleType : u32 {
37 Unknown = 0, 34 Unknown = 0,
38 35
39 Session = 2, 36 Session = 2,
40 Event = 3, 37 Event = 3,
41 Mutex = 4, 38 Mutex = 4,
42 SharedMemory = 5, 39 SharedMemory = 5,
43 Redirection = 6, 40 Redirection = 6,
44 Thread = 7, 41 Thread = 7,
45 Process = 8, 42 Process = 8,
46 AddressArbiter = 9, 43 AddressArbiter = 9,
47 Semaphore = 10, 44 Semaphore = 10,
48 Timer = 11, 45 Timer = 11,
49 ResourceLimit = 12, 46 ResourceLimit = 12,
50 CodeSet = 13, 47 CodeSet = 13,
51 ClientPort = 14, 48 ClientPort = 14,
52 ServerPort = 15, 49 ServerPort = 15,
53}; 50};
54 51
55enum { 52enum {
56 DEFAULT_STACK_SIZE = 0x4000, 53 DEFAULT_STACK_SIZE = 0x4000,
57}; 54};
58 55
59class Object : NonCopyable { 56class Object : NonCopyable {
@@ -61,10 +58,16 @@ public:
61 virtual ~Object() {} 58 virtual ~Object() {}
62 59
63 /// Returns a unique identifier for the object. For debugging purposes only. 60 /// Returns a unique identifier for the object. For debugging purposes only.
64 unsigned int GetObjectId() const { return object_id; } 61 unsigned int GetObjectId() const {
62 return object_id;
63 }
65 64
66 virtual std::string GetTypeName() const { return "[BAD KERNEL OBJECT TYPE]"; } 65 virtual std::string GetTypeName() const {
67 virtual std::string GetName() const { return "[UNKNOWN KERNEL OBJECT]"; } 66 return "[BAD KERNEL OBJECT TYPE]";
67 }
68 virtual std::string GetName() const {
69 return "[UNKNOWN KERNEL OBJECT]";
70 }
68 virtual Kernel::HandleType GetHandleType() const = 0; 71 virtual Kernel::HandleType GetHandleType() const = 0;
69 72
70 /** 73 /**
@@ -122,7 +125,6 @@ using SharedPtr = boost::intrusive_ptr<T>;
122/// Class that represents a Kernel object that a thread can be waiting on 125/// Class that represents a Kernel object that a thread can be waiting on
123class WaitObject : public Object { 126class WaitObject : public Object {
124public: 127public:
125
126 /** 128 /**
127 * Check if the current thread should wait until the object is available 129 * 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 130 * @return True if the current thread should wait due to this object being unavailable
@@ -247,8 +249,12 @@ private:
247 */ 249 */
248 static const size_t MAX_COUNT = 4096; 250 static const size_t MAX_COUNT = 4096;
249 251
250 static u16 GetSlot(Handle handle) { return handle >> 15; } 252 static u16 GetSlot(Handle handle) {
251 static u16 GetGeneration(Handle handle) { return handle & 0x7FFF; } 253 return handle >> 15;
254 }
255 static u16 GetGeneration(Handle handle) {
256 return handle & 0x7FFF;
257 }
252 258
253 /// Stores the Object referenced by the handle or null if the slot is empty. 259 /// Stores the Object referenced by the handle or null if the slot is empty.
254 std::array<SharedPtr<Object>, MAX_COUNT> objects; 260 std::array<SharedPtr<Object>, MAX_COUNT> objects;