summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-02-13 17:21:43 +0100
committerLiam <byteslice@airmail.cc>2023-02-14 01:03:12 +0100
commitceda2d280e8a3030c1e23083c5cea9158387fe4c (patch)
tree8041460840ed81d4cb74d87eecfb8fb720cdfa15 /src/core/hle/kernel
parentkernel: use GetCurrentProcess (diff)
downloadyuzu-ceda2d280e8a3030c1e23083c5cea9158387fe4c.tar
yuzu-ceda2d280e8a3030c1e23083c5cea9158387fe4c.tar.gz
yuzu-ceda2d280e8a3030c1e23083c5cea9158387fe4c.tar.bz2
yuzu-ceda2d280e8a3030c1e23083c5cea9158387fe4c.tar.lz
yuzu-ceda2d280e8a3030c1e23083c5cea9158387fe4c.tar.xz
yuzu-ceda2d280e8a3030c1e23083c5cea9158387fe4c.tar.zst
yuzu-ceda2d280e8a3030c1e23083c5cea9158387fe4c.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/k_client_port.cpp2
-rw-r--r--src/core/hle/kernel/k_handle_table.h3
-rw-r--r--src/core/hle/kernel/k_session.cpp2
-rw-r--r--src/core/hle/kernel/kernel.cpp46
-rw-r--r--src/core/hle/kernel/kernel.h24
5 files changed, 39 insertions, 38 deletions
diff --git a/src/core/hle/kernel/k_client_port.cpp b/src/core/hle/kernel/k_client_port.cpp
index 9a540987b..c72a91a76 100644
--- a/src/core/hle/kernel/k_client_port.cpp
+++ b/src/core/hle/kernel/k_client_port.cpp
@@ -61,7 +61,7 @@ bool KClientPort::IsSignaled() const {
Result KClientPort::CreateSession(KClientSession** out) {
// Reserve a new session from the resource limit.
//! FIXME: we are reserving this from the wrong resource limit!
- KScopedResourceReservation session_reservation(kernel.CurrentProcess()->GetResourceLimit(),
+ KScopedResourceReservation session_reservation(kernel.ApplicationProcess()->GetResourceLimit(),
LimitableResource::SessionCountMax);
R_UNLESS(session_reservation.Succeeded(), ResultLimitReached);
diff --git a/src/core/hle/kernel/k_handle_table.h b/src/core/hle/kernel/k_handle_table.h
index 1bf68e6b0..d7660630c 100644
--- a/src/core/hle/kernel/k_handle_table.h
+++ b/src/core/hle/kernel/k_handle_table.h
@@ -90,7 +90,8 @@ public:
// Handle pseudo-handles.
if constexpr (std::derived_from<KProcess, T>) {
if (handle == Svc::PseudoHandle::CurrentProcess) {
- auto* const cur_process = GetCurrentProcessPointer(m_kernel);
+ //! FIXME: this is the wrong process!
+ auto* const cur_process = m_kernel.ApplicationProcess();
ASSERT(cur_process != nullptr);
return cur_process;
}
diff --git a/src/core/hle/kernel/k_session.cpp b/src/core/hle/kernel/k_session.cpp
index 819f39f12..7e677c028 100644
--- a/src/core/hle/kernel/k_session.cpp
+++ b/src/core/hle/kernel/k_session.cpp
@@ -34,7 +34,7 @@ void KSession::Initialize(KClientPort* port_, const std::string& name_) {
// Set our owner process.
//! FIXME: this is the wrong process!
- process = kernel.CurrentProcess();
+ process = kernel.ApplicationProcess();
process->Open();
// Set our port.
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 5b72eaaa1..b1922659d 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -102,13 +102,13 @@ struct KernelCore::Impl {
void InitializeCores() {
for (u32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) {
- cores[core_id]->Initialize((*current_process).Is64BitProcess());
- system.Memory().SetCurrentPageTable(*current_process, core_id);
+ cores[core_id]->Initialize((*application_process).Is64BitProcess());
+ system.Memory().SetCurrentPageTable(*application_process, core_id);
}
}
- void CloseCurrentProcess() {
- KProcess* old_process = current_process.exchange(nullptr);
+ void CloseApplicationProcess() {
+ KProcess* old_process = application_process.exchange(nullptr);
if (old_process == nullptr) {
return;
}
@@ -182,7 +182,7 @@ struct KernelCore::Impl {
}
}
- CloseCurrentProcess();
+ CloseApplicationProcess();
// Track kernel objects that were not freed on shutdown
{
@@ -363,8 +363,8 @@ struct KernelCore::Impl {
}
}
- void MakeCurrentProcess(KProcess* process) {
- current_process = process;
+ void MakeApplicationProcess(KProcess* process) {
+ application_process = process;
}
static inline thread_local u32 host_thread_id = UINT32_MAX;
@@ -821,7 +821,7 @@ struct KernelCore::Impl {
// Lists all processes that exist in the current session.
std::vector<KProcess*> process_list;
- std::atomic<KProcess*> current_process{};
+ std::atomic<KProcess*> application_process{};
std::unique_ptr<Kernel::GlobalSchedulerContext> global_scheduler_context;
std::unique_ptr<Kernel::KHardwareTimer> hardware_timer;
@@ -941,20 +941,20 @@ void KernelCore::AppendNewProcess(KProcess* process) {
impl->process_list.push_back(process);
}
-void KernelCore::MakeCurrentProcess(KProcess* process) {
- impl->MakeCurrentProcess(process);
+void KernelCore::MakeApplicationProcess(KProcess* process) {
+ impl->MakeApplicationProcess(process);
}
-KProcess* KernelCore::CurrentProcess() {
- return impl->current_process;
+KProcess* KernelCore::ApplicationProcess() {
+ return impl->application_process;
}
-const KProcess* KernelCore::CurrentProcess() const {
- return impl->current_process;
+const KProcess* KernelCore::ApplicationProcess() const {
+ return impl->application_process;
}
-void KernelCore::CloseCurrentProcess() {
- impl->CloseCurrentProcess();
+void KernelCore::CloseApplicationProcess() {
+ impl->CloseApplicationProcess();
}
const std::vector<KProcess*>& KernelCore::GetProcessList() const {
@@ -1202,12 +1202,12 @@ const Kernel::KSharedMemory& KernelCore::GetHidBusSharedMem() const {
return *impl->hidbus_shared_mem;
}
-void KernelCore::Suspend(bool suspended) {
+void KernelCore::SuspendApplication(bool suspended) {
const bool should_suspend{exception_exited || suspended};
const auto activity = should_suspend ? ProcessActivity::Paused : ProcessActivity::Runnable;
- //! This refers to the application process, not the current process.
- KScopedAutoObject<KProcess> process = CurrentProcess();
+ // Get the application process.
+ KScopedAutoObject<KProcess> process = ApplicationProcess();
if (process.IsNull()) {
return;
}
@@ -1218,8 +1218,8 @@ void KernelCore::Suspend(bool suspended) {
// Wait for process execution to stop.
bool must_wait{should_suspend};
- // KernelCore::Suspend must be called from locked context, or we
- // could race another call to SetActivity, interfering with waiting.
+ // KernelCore::SuspendApplication must be called from locked context,
+ // or we could race another call to SetActivity, interfering with waiting.
while (must_wait) {
KScopedSchedulerLock sl{*this};
@@ -1253,9 +1253,9 @@ bool KernelCore::IsShuttingDown() const {
return impl->IsShuttingDown();
}
-void KernelCore::ExceptionalExit() {
+void KernelCore::ExceptionalExitApplication() {
exception_exited = true;
- Suspend(true);
+ SuspendApplication(true);
}
void KernelCore::EnterSVCProfile() {
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index af0ae0e98..a236e6b42 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -131,17 +131,17 @@ public:
/// Adds the given shared pointer to an internal list of active processes.
void AppendNewProcess(KProcess* process);
- /// Makes the given process the new current process.
- void MakeCurrentProcess(KProcess* process);
+ /// Makes the given process the new application process.
+ void MakeApplicationProcess(KProcess* process);
- /// Retrieves a pointer to the current process.
- KProcess* CurrentProcess();
+ /// Retrieves a pointer to the application process.
+ KProcess* ApplicationProcess();
- /// Retrieves a const pointer to the current process.
- const KProcess* CurrentProcess() const;
+ /// Retrieves a const pointer to the application process.
+ const KProcess* ApplicationProcess() const;
- /// Closes the current process.
- void CloseCurrentProcess();
+ /// Closes the application process.
+ void CloseApplicationProcess();
/// Retrieves the list of processes.
const std::vector<KProcess*>& GetProcessList() const;
@@ -288,11 +288,11 @@ public:
/// Gets the shared memory object for HIDBus services.
const Kernel::KSharedMemory& GetHidBusSharedMem() const;
- /// Suspend/unsuspend all processes.
- void Suspend(bool suspend);
+ /// Suspend/unsuspend application process.
+ void SuspendApplication(bool suspend);
- /// Exceptional exit all processes.
- void ExceptionalExit();
+ /// Exceptional exit application process.
+ void ExceptionalExitApplication();
/// Notify emulated CPU cores to shut down.
void ShutdownCores();