summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
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 {
61Result KClientPort::CreateSession(KClientSession** out) { 61Result KClientPort::CreateSession(KClientSession** out) {
62 // Reserve a new session from the resource limit. 62 // Reserve a new session from the resource limit.
63 //! FIXME: we are reserving this from the wrong resource limit! 63 //! FIXME: we are reserving this from the wrong resource limit!
64 KScopedResourceReservation session_reservation(kernel.CurrentProcess()->GetResourceLimit(), 64 KScopedResourceReservation session_reservation(kernel.ApplicationProcess()->GetResourceLimit(),
65 LimitableResource::SessionCountMax); 65 LimitableResource::SessionCountMax);
66 R_UNLESS(session_reservation.Succeeded(), ResultLimitReached); 66 R_UNLESS(session_reservation.Succeeded(), ResultLimitReached);
67 67
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:
90 // Handle pseudo-handles. 90 // Handle pseudo-handles.
91 if constexpr (std::derived_from<KProcess, T>) { 91 if constexpr (std::derived_from<KProcess, T>) {
92 if (handle == Svc::PseudoHandle::CurrentProcess) { 92 if (handle == Svc::PseudoHandle::CurrentProcess) {
93 auto* const cur_process = GetCurrentProcessPointer(m_kernel); 93 //! FIXME: this is the wrong process!
94 auto* const cur_process = m_kernel.ApplicationProcess();
94 ASSERT(cur_process != nullptr); 95 ASSERT(cur_process != nullptr);
95 return cur_process; 96 return cur_process;
96 } 97 }
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_) {
34 34
35 // Set our owner process. 35 // Set our owner process.
36 //! FIXME: this is the wrong process! 36 //! FIXME: this is the wrong process!
37 process = kernel.CurrentProcess(); 37 process = kernel.ApplicationProcess();
38 process->Open(); 38 process->Open();
39 39
40 // Set our port. 40 // 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 {
102 102
103 void InitializeCores() { 103 void InitializeCores() {
104 for (u32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) { 104 for (u32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) {
105 cores[core_id]->Initialize((*current_process).Is64BitProcess()); 105 cores[core_id]->Initialize((*application_process).Is64BitProcess());
106 system.Memory().SetCurrentPageTable(*current_process, core_id); 106 system.Memory().SetCurrentPageTable(*application_process, core_id);
107 } 107 }
108 } 108 }
109 109
110 void CloseCurrentProcess() { 110 void CloseApplicationProcess() {
111 KProcess* old_process = current_process.exchange(nullptr); 111 KProcess* old_process = application_process.exchange(nullptr);
112 if (old_process == nullptr) { 112 if (old_process == nullptr) {
113 return; 113 return;
114 } 114 }
@@ -182,7 +182,7 @@ struct KernelCore::Impl {
182 } 182 }
183 } 183 }
184 184
185 CloseCurrentProcess(); 185 CloseApplicationProcess();
186 186
187 // Track kernel objects that were not freed on shutdown 187 // Track kernel objects that were not freed on shutdown
188 { 188 {
@@ -363,8 +363,8 @@ struct KernelCore::Impl {
363 } 363 }
364 } 364 }
365 365
366 void MakeCurrentProcess(KProcess* process) { 366 void MakeApplicationProcess(KProcess* process) {
367 current_process = process; 367 application_process = process;
368 } 368 }
369 369
370 static inline thread_local u32 host_thread_id = UINT32_MAX; 370 static inline thread_local u32 host_thread_id = UINT32_MAX;
@@ -821,7 +821,7 @@ struct KernelCore::Impl {
821 821
822 // Lists all processes that exist in the current session. 822 // Lists all processes that exist in the current session.
823 std::vector<KProcess*> process_list; 823 std::vector<KProcess*> process_list;
824 std::atomic<KProcess*> current_process{}; 824 std::atomic<KProcess*> application_process{};
825 std::unique_ptr<Kernel::GlobalSchedulerContext> global_scheduler_context; 825 std::unique_ptr<Kernel::GlobalSchedulerContext> global_scheduler_context;
826 std::unique_ptr<Kernel::KHardwareTimer> hardware_timer; 826 std::unique_ptr<Kernel::KHardwareTimer> hardware_timer;
827 827
@@ -941,20 +941,20 @@ void KernelCore::AppendNewProcess(KProcess* process) {
941 impl->process_list.push_back(process); 941 impl->process_list.push_back(process);
942} 942}
943 943
944void KernelCore::MakeCurrentProcess(KProcess* process) { 944void KernelCore::MakeApplicationProcess(KProcess* process) {
945 impl->MakeCurrentProcess(process); 945 impl->MakeApplicationProcess(process);
946} 946}
947 947
948KProcess* KernelCore::CurrentProcess() { 948KProcess* KernelCore::ApplicationProcess() {
949 return impl->current_process; 949 return impl->application_process;
950} 950}
951 951
952const KProcess* KernelCore::CurrentProcess() const { 952const KProcess* KernelCore::ApplicationProcess() const {
953 return impl->current_process; 953 return impl->application_process;
954} 954}
955 955
956void KernelCore::CloseCurrentProcess() { 956void KernelCore::CloseApplicationProcess() {
957 impl->CloseCurrentProcess(); 957 impl->CloseApplicationProcess();
958} 958}
959 959
960const std::vector<KProcess*>& KernelCore::GetProcessList() const { 960const std::vector<KProcess*>& KernelCore::GetProcessList() const {
@@ -1202,12 +1202,12 @@ const Kernel::KSharedMemory& KernelCore::GetHidBusSharedMem() const {
1202 return *impl->hidbus_shared_mem; 1202 return *impl->hidbus_shared_mem;
1203} 1203}
1204 1204
1205void KernelCore::Suspend(bool suspended) { 1205void KernelCore::SuspendApplication(bool suspended) {
1206 const bool should_suspend{exception_exited || suspended}; 1206 const bool should_suspend{exception_exited || suspended};
1207 const auto activity = should_suspend ? ProcessActivity::Paused : ProcessActivity::Runnable; 1207 const auto activity = should_suspend ? ProcessActivity::Paused : ProcessActivity::Runnable;
1208 1208
1209 //! This refers to the application process, not the current process. 1209 // Get the application process.
1210 KScopedAutoObject<KProcess> process = CurrentProcess(); 1210 KScopedAutoObject<KProcess> process = ApplicationProcess();
1211 if (process.IsNull()) { 1211 if (process.IsNull()) {
1212 return; 1212 return;
1213 } 1213 }
@@ -1218,8 +1218,8 @@ void KernelCore::Suspend(bool suspended) {
1218 // Wait for process execution to stop. 1218 // Wait for process execution to stop.
1219 bool must_wait{should_suspend}; 1219 bool must_wait{should_suspend};
1220 1220
1221 // KernelCore::Suspend must be called from locked context, or we 1221 // KernelCore::SuspendApplication must be called from locked context,
1222 // could race another call to SetActivity, interfering with waiting. 1222 // or we could race another call to SetActivity, interfering with waiting.
1223 while (must_wait) { 1223 while (must_wait) {
1224 KScopedSchedulerLock sl{*this}; 1224 KScopedSchedulerLock sl{*this};
1225 1225
@@ -1253,9 +1253,9 @@ bool KernelCore::IsShuttingDown() const {
1253 return impl->IsShuttingDown(); 1253 return impl->IsShuttingDown();
1254} 1254}
1255 1255
1256void KernelCore::ExceptionalExit() { 1256void KernelCore::ExceptionalExitApplication() {
1257 exception_exited = true; 1257 exception_exited = true;
1258 Suspend(true); 1258 SuspendApplication(true);
1259} 1259}
1260 1260
1261void KernelCore::EnterSVCProfile() { 1261void 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:
131 /// Adds the given shared pointer to an internal list of active processes. 131 /// Adds the given shared pointer to an internal list of active processes.
132 void AppendNewProcess(KProcess* process); 132 void AppendNewProcess(KProcess* process);
133 133
134 /// Makes the given process the new current process. 134 /// Makes the given process the new application process.
135 void MakeCurrentProcess(KProcess* process); 135 void MakeApplicationProcess(KProcess* process);
136 136
137 /// Retrieves a pointer to the current process. 137 /// Retrieves a pointer to the application process.
138 KProcess* CurrentProcess(); 138 KProcess* ApplicationProcess();
139 139
140 /// Retrieves a const pointer to the current process. 140 /// Retrieves a const pointer to the application process.
141 const KProcess* CurrentProcess() const; 141 const KProcess* ApplicationProcess() const;
142 142
143 /// Closes the current process. 143 /// Closes the application process.
144 void CloseCurrentProcess(); 144 void CloseApplicationProcess();
145 145
146 /// Retrieves the list of processes. 146 /// Retrieves the list of processes.
147 const std::vector<KProcess*>& GetProcessList() const; 147 const std::vector<KProcess*>& GetProcessList() const;
@@ -288,11 +288,11 @@ public:
288 /// Gets the shared memory object for HIDBus services. 288 /// Gets the shared memory object for HIDBus services.
289 const Kernel::KSharedMemory& GetHidBusSharedMem() const; 289 const Kernel::KSharedMemory& GetHidBusSharedMem() const;
290 290
291 /// Suspend/unsuspend all processes. 291 /// Suspend/unsuspend application process.
292 void Suspend(bool suspend); 292 void SuspendApplication(bool suspend);
293 293
294 /// Exceptional exit all processes. 294 /// Exceptional exit application process.
295 void ExceptionalExit(); 295 void ExceptionalExitApplication();
296 296
297 /// Notify emulated CPU cores to shut down. 297 /// Notify emulated CPU cores to shut down.
298 void ShutdownCores(); 298 void ShutdownCores();