summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/kernel.h')
-rw-r--r--src/core/hle/kernel/kernel.h89
1 files changed, 84 insertions, 5 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 131311472..089e959ac 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -4,14 +4,93 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "common/common_types.h" 7#include "core/hle/kernel/object.h"
8
9template <typename T>
10class ResultVal;
11
12namespace CoreTiming {
13struct EventType;
14}
8 15
9namespace Kernel { 16namespace Kernel {
10 17
11/// Initialize the kernel with the specified system mode. 18class HandleTable;
12void Init(); 19class Process;
20class ResourceLimit;
21class Thread;
22class Timer;
23
24enum class ResourceLimitCategory : u8;
25
26/// Represents a single instance of the kernel.
27class KernelCore {
28public:
29 KernelCore();
30 ~KernelCore();
31
32 KernelCore(const KernelCore&) = delete;
33 KernelCore& operator=(const KernelCore&) = delete;
34
35 KernelCore(KernelCore&&) = delete;
36 KernelCore& operator=(KernelCore&&) = delete;
37
38 /// Resets the kernel to a clean slate for use.
39 void Initialize();
40
41 /// Clears all resources in use by the kernel instance.
42 void Shutdown();
43
44 /// Provides a reference to the handle table.
45 Kernel::HandleTable& HandleTable();
46
47 /// Provides a const reference to the handle table.
48 const Kernel::HandleTable& HandleTable() const;
49
50 /// Retrieves a shared pointer to a ResourceLimit identified by the given category.
51 SharedPtr<ResourceLimit> ResourceLimitForCategory(ResourceLimitCategory category) const;
52
53 /// Retrieves a shared pointer to a Thread instance within the thread wakeup handle table.
54 SharedPtr<Thread> RetrieveThreadFromWakeupCallbackHandleTable(Handle handle) const;
55
56 /// Retrieves a shared pointer to a Timer instance within the timer callback handle table.
57 SharedPtr<Timer> RetrieveTimerFromCallbackHandleTable(Handle handle) const;
58
59 /// Adds the given shared pointer to an internal list of active processes.
60 void AppendNewProcess(SharedPtr<Process> process);
61
62private:
63 friend class Object;
64 friend class Process;
65 friend class Thread;
66 friend class Timer;
67
68 /// Creates a new object ID, incrementing the internal object ID counter.
69 u32 CreateNewObjectID();
70
71 /// Creates a new process ID, incrementing the internal process ID counter;
72 u32 CreateNewProcessID();
73
74 /// Creates a new thread ID, incrementing the internal thread ID counter.
75 u32 CreateNewThreadID();
76
77 /// Creates a timer callback handle for the given timer.
78 ResultVal<Handle> CreateTimerCallbackHandle(const SharedPtr<Timer>& timer);
79
80 /// Retrieves the event type used for thread wakeup callbacks.
81 CoreTiming::EventType* ThreadWakeupCallbackEventType() const;
82
83 /// Retrieves the event type used for timer callbacks.
84 CoreTiming::EventType* TimerCallbackEventType() const;
85
86 /// Provides a reference to the thread wakeup callback handle table.
87 Kernel::HandleTable& ThreadWakeupCallbackHandleTable();
88
89 /// Provides a const reference to the thread wakeup callback handle table.
90 const Kernel::HandleTable& ThreadWakeupCallbackHandleTable() const;
13 91
14/// Shutdown the kernel 92 struct Impl;
15void Shutdown(); 93 std::unique_ptr<Impl> impl;
94};
16 95
17} // namespace Kernel 96} // namespace Kernel