summaryrefslogtreecommitdiffstats
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.h69
1 files changed, 34 insertions, 35 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index e3169f5a7..56906f2da 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -11,7 +11,7 @@
#include <vector>
#include "core/arm/cpu_interrupt_handler.h"
#include "core/hardware_properties.h"
-#include "core/hle/kernel/memory/memory_types.h"
+#include "core/hle/kernel/memory_types.h"
#include "core/hle/kernel/object.h"
namespace Core {
@@ -27,26 +27,27 @@ struct EventType;
namespace Kernel {
-namespace Memory {
-class MemoryManager;
-template <typename T>
-class SlabHeap;
-} // namespace Memory
-
-class AddressArbiter;
class ClientPort;
class GlobalSchedulerContext;
class HandleTable;
+class KMemoryManager;
+class KResourceLimit;
+class KScheduler;
+class KSharedMemory;
+class KThread;
class PhysicalCore;
class Process;
-class ResourceLimit;
-class KScheduler;
-class SharedMemory;
class ServiceThread;
class Synchronization;
-class Thread;
class TimeManager;
+template <typename T>
+class KSlabHeap;
+
+using EmuThreadHandle = uintptr_t;
+constexpr EmuThreadHandle EmuThreadHandleInvalid{};
+constexpr EmuThreadHandle EmuThreadHandleReserved{1ULL << 63};
+
/// Represents a single instance of the kernel.
class KernelCore {
private:
@@ -82,10 +83,10 @@ public:
void Shutdown();
/// Retrieves a shared pointer to the system resource limit instance.
- std::shared_ptr<ResourceLimit> GetSystemResourceLimit() const;
+ std::shared_ptr<KResourceLimit> GetSystemResourceLimit() const;
/// Retrieves a shared pointer to a Thread instance within the thread wakeup handle table.
- std::shared_ptr<Thread> RetrieveThreadFromGlobalHandleTable(Handle handle) const;
+ std::shared_ptr<KThread> RetrieveThreadFromGlobalHandleTable(Handle handle) const;
/// Adds the given shared pointer to an internal list of active processes.
void AppendNewProcess(std::shared_ptr<Process> process);
@@ -129,12 +130,6 @@ public:
/// Gets the an instance of the current physical CPU core.
const Kernel::PhysicalCore& CurrentPhysicalCore() const;
- /// Gets the an instance of the Synchronization Interface.
- Kernel::Synchronization& Synchronization();
-
- /// Gets the an instance of the Synchronization Interface.
- const Kernel::Synchronization& Synchronization() const;
-
/// Gets the an instance of the TimeManager Interface.
Kernel::TimeManager& TimeManager();
@@ -168,8 +163,8 @@ public:
/// Determines whether or not the given port is a valid named port.
bool IsValidNamedPort(NamedPortTable::const_iterator port) const;
- /// Gets the current host_thread/guest_thread handle.
- Core::EmuThreadHandle GetCurrentEmuThreadID() const;
+ /// Gets the current host_thread/guest_thread pointer.
+ KThread* GetCurrentEmuThread() const;
/// Gets the current host_thread handle.
u32 GetCurrentHostThreadID() const;
@@ -181,40 +176,40 @@ public:
void RegisterHostThread();
/// Gets the virtual memory manager for the kernel.
- Memory::MemoryManager& MemoryManager();
+ KMemoryManager& MemoryManager();
/// Gets the virtual memory manager for the kernel.
- const Memory::MemoryManager& MemoryManager() const;
+ const KMemoryManager& MemoryManager() const;
/// Gets the slab heap allocated for user space pages.
- Memory::SlabHeap<Memory::Page>& GetUserSlabHeapPages();
+ KSlabHeap<Page>& GetUserSlabHeapPages();
/// Gets the slab heap allocated for user space pages.
- const Memory::SlabHeap<Memory::Page>& GetUserSlabHeapPages() const;
+ const KSlabHeap<Page>& GetUserSlabHeapPages() const;
/// Gets the shared memory object for HID services.
- Kernel::SharedMemory& GetHidSharedMem();
+ Kernel::KSharedMemory& GetHidSharedMem();
/// Gets the shared memory object for HID services.
- const Kernel::SharedMemory& GetHidSharedMem() const;
+ const Kernel::KSharedMemory& GetHidSharedMem() const;
/// Gets the shared memory object for font services.
- Kernel::SharedMemory& GetFontSharedMem();
+ Kernel::KSharedMemory& GetFontSharedMem();
/// Gets the shared memory object for font services.
- const Kernel::SharedMemory& GetFontSharedMem() const;
+ const Kernel::KSharedMemory& GetFontSharedMem() const;
/// Gets the shared memory object for IRS services.
- Kernel::SharedMemory& GetIrsSharedMem();
+ Kernel::KSharedMemory& GetIrsSharedMem();
/// Gets the shared memory object for IRS services.
- const Kernel::SharedMemory& GetIrsSharedMem() const;
+ const Kernel::KSharedMemory& GetIrsSharedMem() const;
/// Gets the shared memory object for Time services.
- Kernel::SharedMemory& GetTimeSharedMem();
+ Kernel::KSharedMemory& GetTimeSharedMem();
/// Gets the shared memory object for Time services.
- const Kernel::SharedMemory& GetTimeSharedMem() const;
+ const Kernel::KSharedMemory& GetTimeSharedMem() const;
/// Suspend/unsuspend the OS.
void Suspend(bool in_suspention);
@@ -244,10 +239,14 @@ public:
*/
void ReleaseServiceThread(std::weak_ptr<Kernel::ServiceThread> service_thread);
+ /// Workaround for single-core mode when preempting threads while idle.
+ bool IsPhantomModeForSingleCore() const;
+ void SetIsPhantomModeForSingleCore(bool value);
+
private:
friend class Object;
friend class Process;
- friend class Thread;
+ friend class KThread;
/// Creates a new object ID, incrementing the internal object ID counter.
u32 CreateNewObjectID();