summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.h
diff options
context:
space:
mode:
authorGravatar bunnei2021-01-29 23:06:40 -0800
committerGravatar GitHub2021-01-29 23:06:40 -0800
commita4526c4e1acb50808bbe205952101142288e1c60 (patch)
tree7109edf89606c43352da9de40d0e3a920a08b659 /src/core/hle/kernel/kernel.h
parentMerge pull request #5795 from ReinUsesLisp/bytes-to-map-end (diff)
parenthle: kernel: KLightLock: Fix several bugs. (diff)
downloadyuzu-a4526c4e1acb50808bbe205952101142288e1c60.tar.gz
yuzu-a4526c4e1acb50808bbe205952101142288e1c60.tar.xz
yuzu-a4526c4e1acb50808bbe205952101142288e1c60.zip
Merge pull request #5779 from bunnei/kthread-rewrite
Rewrite KThread to be more accurate
Diffstat (limited to 'src/core/hle/kernel/kernel.h')
-rw-r--r--src/core/hle/kernel/kernel.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 933d9a7d6..e7c77727b 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -43,9 +43,13 @@ class KScheduler;
43class SharedMemory; 43class SharedMemory;
44class ServiceThread; 44class ServiceThread;
45class Synchronization; 45class Synchronization;
46class Thread; 46class KThread;
47class TimeManager; 47class TimeManager;
48 48
49using EmuThreadHandle = uintptr_t;
50constexpr EmuThreadHandle EmuThreadHandleInvalid{};
51constexpr EmuThreadHandle EmuThreadHandleReserved{1ULL << 63};
52
49/// Represents a single instance of the kernel. 53/// Represents a single instance of the kernel.
50class KernelCore { 54class KernelCore {
51private: 55private:
@@ -84,7 +88,7 @@ public:
84 std::shared_ptr<ResourceLimit> GetSystemResourceLimit() const; 88 std::shared_ptr<ResourceLimit> GetSystemResourceLimit() const;
85 89
86 /// Retrieves a shared pointer to a Thread instance within the thread wakeup handle table. 90 /// Retrieves a shared pointer to a Thread instance within the thread wakeup handle table.
87 std::shared_ptr<Thread> RetrieveThreadFromGlobalHandleTable(Handle handle) const; 91 std::shared_ptr<KThread> RetrieveThreadFromGlobalHandleTable(Handle handle) const;
88 92
89 /// Adds the given shared pointer to an internal list of active processes. 93 /// Adds the given shared pointer to an internal list of active processes.
90 void AppendNewProcess(std::shared_ptr<Process> process); 94 void AppendNewProcess(std::shared_ptr<Process> process);
@@ -161,8 +165,8 @@ public:
161 /// Determines whether or not the given port is a valid named port. 165 /// Determines whether or not the given port is a valid named port.
162 bool IsValidNamedPort(NamedPortTable::const_iterator port) const; 166 bool IsValidNamedPort(NamedPortTable::const_iterator port) const;
163 167
164 /// Gets the current host_thread/guest_thread handle. 168 /// Gets the current host_thread/guest_thread pointer.
165 Core::EmuThreadHandle GetCurrentEmuThreadID() const; 169 KThread* GetCurrentEmuThread() const;
166 170
167 /// Gets the current host_thread handle. 171 /// Gets the current host_thread handle.
168 u32 GetCurrentHostThreadID() const; 172 u32 GetCurrentHostThreadID() const;
@@ -237,10 +241,14 @@ public:
237 */ 241 */
238 void ReleaseServiceThread(std::weak_ptr<Kernel::ServiceThread> service_thread); 242 void ReleaseServiceThread(std::weak_ptr<Kernel::ServiceThread> service_thread);
239 243
244 /// Workaround for single-core mode when preempting threads while idle.
245 bool IsPhantomModeForSingleCore() const;
246 void SetIsPhantomModeForSingleCore(bool value);
247
240private: 248private:
241 friend class Object; 249 friend class Object;
242 friend class Process; 250 friend class Process;
243 friend class Thread; 251 friend class KThread;
244 252
245 /// Creates a new object ID, incrementing the internal object ID counter. 253 /// Creates a new object ID, incrementing the internal object ID counter.
246 u32 CreateNewObjectID(); 254 u32 CreateNewObjectID();