diff options
| author | 2021-01-29 23:06:40 -0800 | |
|---|---|---|
| committer | 2021-01-29 23:06:40 -0800 | |
| commit | a4526c4e1acb50808bbe205952101142288e1c60 (patch) | |
| tree | 7109edf89606c43352da9de40d0e3a920a08b659 /src/core/hle/kernel/kernel.h | |
| parent | Merge pull request #5795 from ReinUsesLisp/bytes-to-map-end (diff) | |
| parent | hle: kernel: KLightLock: Fix several bugs. (diff) | |
| download | yuzu-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.h | 18 |
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; | |||
| 43 | class SharedMemory; | 43 | class SharedMemory; |
| 44 | class ServiceThread; | 44 | class ServiceThread; |
| 45 | class Synchronization; | 45 | class Synchronization; |
| 46 | class Thread; | 46 | class KThread; |
| 47 | class TimeManager; | 47 | class TimeManager; |
| 48 | 48 | ||
| 49 | using EmuThreadHandle = uintptr_t; | ||
| 50 | constexpr EmuThreadHandle EmuThreadHandleInvalid{}; | ||
| 51 | constexpr EmuThreadHandle EmuThreadHandleReserved{1ULL << 63}; | ||
| 52 | |||
| 49 | /// Represents a single instance of the kernel. | 53 | /// Represents a single instance of the kernel. |
| 50 | class KernelCore { | 54 | class KernelCore { |
| 51 | private: | 55 | private: |
| @@ -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 | |||
| 240 | private: | 248 | private: |
| 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(); |