summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/kernel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
-rw-r--r--src/core/hle/kernel/kernel.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 615d7901a..3e0800a71 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -13,6 +13,7 @@
#include "core/core.h"
#include "core/core_timing.h"
+#include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h"
@@ -115,6 +116,7 @@ struct KernelCore::Impl {
next_thread_id = 1;
process_list.clear();
+ current_process.reset();
handle_table.Clear();
resource_limits.fill(nullptr);
@@ -124,6 +126,8 @@ struct KernelCore::Impl {
timer_callback_handle_table.Clear();
timer_callback_event_type = nullptr;
+
+ named_ports.clear();
}
void InitializeResourceLimits(KernelCore& kernel) {
@@ -203,6 +207,7 @@ struct KernelCore::Impl {
// Lists all processes that exist in the current session.
std::vector<SharedPtr<Process>> process_list;
+ SharedPtr<Process> current_process;
Kernel::HandleTable handle_table;
std::array<SharedPtr<ResourceLimit>, 4> resource_limits;
@@ -217,6 +222,10 @@ struct KernelCore::Impl {
// TODO(yuriks): This can be removed if Thread objects are explicitly pooled in the future,
// allowing us to simply use a pool index or similar.
Kernel::HandleTable thread_wakeup_callback_handle_table;
+
+ /// Map of named ports managed by the kernel, which can be retrieved using
+ /// the ConnectToPort SVC.
+ NamedPortTable named_ports;
};
KernelCore::KernelCore() : impl{std::make_unique<Impl>()} {}
@@ -257,6 +266,35 @@ void KernelCore::AppendNewProcess(SharedPtr<Process> process) {
impl->process_list.push_back(std::move(process));
}
+void KernelCore::MakeCurrentProcess(SharedPtr<Process> process) {
+ impl->current_process = std::move(process);
+}
+
+SharedPtr<Process>& KernelCore::CurrentProcess() {
+ return impl->current_process;
+}
+
+const SharedPtr<Process>& KernelCore::CurrentProcess() const {
+ return impl->current_process;
+}
+
+void KernelCore::AddNamedPort(std::string name, SharedPtr<ClientPort> port) {
+ impl->named_ports.emplace(std::move(name), std::move(port));
+}
+
+KernelCore::NamedPortTable::iterator KernelCore::FindNamedPort(const std::string& name) {
+ return impl->named_ports.find(name);
+}
+
+KernelCore::NamedPortTable::const_iterator KernelCore::FindNamedPort(
+ const std::string& name) const {
+ return impl->named_ports.find(name);
+}
+
+bool KernelCore::IsValidNamedPort(NamedPortTable::const_iterator port) const {
+ return port != impl->named_ports.cend();
+}
+
u32 KernelCore::CreateNewObjectID() {
return impl->next_object_id++;
}