diff options
Diffstat (limited to 'src/core')
76 files changed, 242 insertions, 240 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 4e1387c7e..889a2d2f8 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -197,6 +197,8 @@ add_library(core STATIC | |||
| 197 | hle/kernel/k_port.cpp | 197 | hle/kernel/k_port.cpp |
| 198 | hle/kernel/k_port.h | 198 | hle/kernel/k_port.h |
| 199 | hle/kernel/k_priority_queue.h | 199 | hle/kernel/k_priority_queue.h |
| 200 | hle/kernel/k_process.cpp | ||
| 201 | hle/kernel/k_process.h | ||
| 200 | hle/kernel/k_readable_event.cpp | 202 | hle/kernel/k_readable_event.cpp |
| 201 | hle/kernel/k_readable_event.h | 203 | hle/kernel/k_readable_event.h |
| 202 | hle/kernel/k_resource_limit.cpp | 204 | hle/kernel/k_resource_limit.cpp |
| @@ -235,8 +237,6 @@ add_library(core STATIC | |||
| 235 | hle/kernel/physical_core.cpp | 237 | hle/kernel/physical_core.cpp |
| 236 | hle/kernel/physical_core.h | 238 | hle/kernel/physical_core.h |
| 237 | hle/kernel/physical_memory.h | 239 | hle/kernel/physical_memory.h |
| 238 | hle/kernel/process.cpp | ||
| 239 | hle/kernel/process.h | ||
| 240 | hle/kernel/process_capability.cpp | 240 | hle/kernel/process_capability.cpp |
| 241 | hle/kernel/process_capability.h | 241 | hle/kernel/process_capability.h |
| 242 | hle/kernel/service_thread.cpp | 242 | hle/kernel/service_thread.cpp |
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp index 4ff72abd8..653bb7a77 100644 --- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp | |||
| @@ -16,8 +16,8 @@ | |||
| 16 | #include "core/core.h" | 16 | #include "core/core.h" |
| 17 | #include "core/core_timing.h" | 17 | #include "core/core_timing.h" |
| 18 | #include "core/hardware_properties.h" | 18 | #include "core/hardware_properties.h" |
| 19 | #include "core/hle/kernel/k_process.h" | ||
| 19 | #include "core/hle/kernel/k_scheduler.h" | 20 | #include "core/hle/kernel/k_scheduler.h" |
| 20 | #include "core/hle/kernel/process.h" | ||
| 21 | #include "core/hle/kernel/svc.h" | 21 | #include "core/hle/kernel/svc.h" |
| 22 | #include "core/memory.h" | 22 | #include "core/memory.h" |
| 23 | 23 | ||
diff --git a/src/core/core.cpp b/src/core/core.cpp index 4bb96d77d..434bf3262 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -28,11 +28,11 @@ | |||
| 28 | #include "core/file_sys/vfs_real.h" | 28 | #include "core/file_sys/vfs_real.h" |
| 29 | #include "core/hardware_interrupt_manager.h" | 29 | #include "core/hardware_interrupt_manager.h" |
| 30 | #include "core/hle/kernel/k_client_port.h" | 30 | #include "core/hle/kernel/k_client_port.h" |
| 31 | #include "core/hle/kernel/k_process.h" | ||
| 31 | #include "core/hle/kernel/k_scheduler.h" | 32 | #include "core/hle/kernel/k_scheduler.h" |
| 32 | #include "core/hle/kernel/k_thread.h" | 33 | #include "core/hle/kernel/k_thread.h" |
| 33 | #include "core/hle/kernel/kernel.h" | 34 | #include "core/hle/kernel/kernel.h" |
| 34 | #include "core/hle/kernel/physical_core.h" | 35 | #include "core/hle/kernel/physical_core.h" |
| 35 | #include "core/hle/kernel/process.h" | ||
| 36 | #include "core/hle/service/am/applets/applets.h" | 36 | #include "core/hle/service/am/applets/applets.h" |
| 37 | #include "core/hle/service/apm/controller.h" | 37 | #include "core/hle/service/apm/controller.h" |
| 38 | #include "core/hle/service/filesystem/filesystem.h" | 38 | #include "core/hle/service/filesystem/filesystem.h" |
| @@ -233,9 +233,9 @@ struct System::Impl { | |||
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | telemetry_session->AddInitialInfo(*app_loader, fs_controller, *content_provider); | 235 | telemetry_session->AddInitialInfo(*app_loader, fs_controller, *content_provider); |
| 236 | auto main_process = Kernel::Process::Create(system.Kernel()); | 236 | auto main_process = Kernel::KProcess::Create(system.Kernel()); |
| 237 | ASSERT(Kernel::Process::Initialize(main_process, system, "main", | 237 | ASSERT(Kernel::KProcess::Initialize(main_process, system, "main", |
| 238 | Kernel::Process::ProcessType::Userland) | 238 | Kernel::KProcess::ProcessType::Userland) |
| 239 | .IsSuccess()); | 239 | .IsSuccess()); |
| 240 | main_process->Open(); | 240 | main_process->Open(); |
| 241 | const auto [load_result, load_parameters] = app_loader->Load(*main_process, system); | 241 | const auto [load_result, load_parameters] = app_loader->Load(*main_process, system); |
| @@ -326,7 +326,7 @@ struct System::Impl { | |||
| 326 | return app_loader->ReadTitle(out); | 326 | return app_loader->ReadTitle(out); |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | void AddGlueRegistrationForProcess(Loader::AppLoader& loader, Kernel::Process& process) { | 329 | void AddGlueRegistrationForProcess(Loader::AppLoader& loader, Kernel::KProcess& process) { |
| 330 | std::vector<u8> nacp_data; | 330 | std::vector<u8> nacp_data; |
| 331 | FileSys::NACP nacp; | 331 | FileSys::NACP nacp; |
| 332 | if (loader.ReadControlData(nacp) == Loader::ResultStatus::Success) { | 332 | if (loader.ReadControlData(nacp) == Loader::ResultStatus::Success) { |
| @@ -517,7 +517,7 @@ const Kernel::GlobalSchedulerContext& System::GlobalSchedulerContext() const { | |||
| 517 | return impl->kernel.GlobalSchedulerContext(); | 517 | return impl->kernel.GlobalSchedulerContext(); |
| 518 | } | 518 | } |
| 519 | 519 | ||
| 520 | Kernel::Process* System::CurrentProcess() { | 520 | Kernel::KProcess* System::CurrentProcess() { |
| 521 | return impl->kernel.CurrentProcess(); | 521 | return impl->kernel.CurrentProcess(); |
| 522 | } | 522 | } |
| 523 | 523 | ||
| @@ -529,7 +529,7 @@ const Core::DeviceMemory& System::DeviceMemory() const { | |||
| 529 | return *impl->device_memory; | 529 | return *impl->device_memory; |
| 530 | } | 530 | } |
| 531 | 531 | ||
| 532 | const Kernel::Process* System::CurrentProcess() const { | 532 | const Kernel::KProcess* System::CurrentProcess() const { |
| 533 | return impl->kernel.CurrentProcess(); | 533 | return impl->kernel.CurrentProcess(); |
| 534 | } | 534 | } |
| 535 | 535 | ||
diff --git a/src/core/core.h b/src/core/core.h index 16e191266..8b93ba998 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -28,7 +28,7 @@ namespace Kernel { | |||
| 28 | class GlobalSchedulerContext; | 28 | class GlobalSchedulerContext; |
| 29 | class KernelCore; | 29 | class KernelCore; |
| 30 | class PhysicalCore; | 30 | class PhysicalCore; |
| 31 | class Process; | 31 | class KProcess; |
| 32 | class KScheduler; | 32 | class KScheduler; |
| 33 | } // namespace Kernel | 33 | } // namespace Kernel |
| 34 | 34 | ||
| @@ -263,10 +263,10 @@ public: | |||
| 263 | [[nodiscard]] const Core::DeviceMemory& DeviceMemory() const; | 263 | [[nodiscard]] const Core::DeviceMemory& DeviceMemory() const; |
| 264 | 264 | ||
| 265 | /// Provides a pointer to the current process | 265 | /// Provides a pointer to the current process |
| 266 | [[nodiscard]] Kernel::Process* CurrentProcess(); | 266 | [[nodiscard]] Kernel::KProcess* CurrentProcess(); |
| 267 | 267 | ||
| 268 | /// Provides a constant pointer to the current process. | 268 | /// Provides a constant pointer to the current process. |
| 269 | [[nodiscard]] const Kernel::Process* CurrentProcess() const; | 269 | [[nodiscard]] const Kernel::KProcess* CurrentProcess() const; |
| 270 | 270 | ||
| 271 | /// Provides a reference to the core timing instance. | 271 | /// Provides a reference to the core timing instance. |
| 272 | [[nodiscard]] Timing::CoreTiming& CoreTiming(); | 272 | [[nodiscard]] Timing::CoreTiming& CoreTiming(); |
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index de6ab721d..aa7f3072f 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include "core/file_sys/patch_manager.h" | 13 | #include "core/file_sys/patch_manager.h" |
| 14 | #include "core/file_sys/registered_cache.h" | 14 | #include "core/file_sys/registered_cache.h" |
| 15 | #include "core/file_sys/romfs_factory.h" | 15 | #include "core/file_sys/romfs_factory.h" |
| 16 | #include "core/hle/kernel/process.h" | 16 | #include "core/hle/kernel/k_process.h" |
| 17 | #include "core/hle/service/filesystem/filesystem.h" | 17 | #include "core/hle/service/filesystem/filesystem.h" |
| 18 | #include "core/loader/loader.h" | 18 | #include "core/loader/loader.h" |
| 19 | 19 | ||
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index fa68af3a8..f973d1d21 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "core/core.h" | 9 | #include "core/core.h" |
| 10 | #include "core/file_sys/savedata_factory.h" | 10 | #include "core/file_sys/savedata_factory.h" |
| 11 | #include "core/file_sys/vfs.h" | 11 | #include "core/file_sys/vfs.h" |
| 12 | #include "core/hle/kernel/process.h" | 12 | #include "core/hle/kernel/k_process.h" |
| 13 | 13 | ||
| 14 | namespace FileSys { | 14 | namespace FileSys { |
| 15 | 15 | ||
diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp index cd752da4e..16c528f5b 100644 --- a/src/core/hle/kernel/handle_table.cpp +++ b/src/core/hle/kernel/handle_table.cpp | |||
| @@ -7,10 +7,10 @@ | |||
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/hle/kernel/handle_table.h" | 9 | #include "core/hle/kernel/handle_table.h" |
| 10 | #include "core/hle/kernel/k_process.h" | ||
| 10 | #include "core/hle/kernel/k_scheduler.h" | 11 | #include "core/hle/kernel/k_scheduler.h" |
| 11 | #include "core/hle/kernel/k_thread.h" | 12 | #include "core/hle/kernel/k_thread.h" |
| 12 | #include "core/hle/kernel/kernel.h" | 13 | #include "core/hle/kernel/kernel.h" |
| 13 | #include "core/hle/kernel/process.h" | ||
| 14 | #include "core/hle/kernel/svc_results.h" | 14 | #include "core/hle/kernel/svc_results.h" |
| 15 | 15 | ||
| 16 | namespace Kernel { | 16 | namespace Kernel { |
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index a11528f28..69190286d 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include "core/hle/ipc_helpers.h" | 16 | #include "core/hle/ipc_helpers.h" |
| 17 | #include "core/hle/kernel/handle_table.h" | 17 | #include "core/hle/kernel/handle_table.h" |
| 18 | #include "core/hle/kernel/hle_ipc.h" | 18 | #include "core/hle/kernel/hle_ipc.h" |
| 19 | #include "core/hle/kernel/k_process.h" | ||
| 19 | #include "core/hle/kernel/k_readable_event.h" | 20 | #include "core/hle/kernel/k_readable_event.h" |
| 20 | #include "core/hle/kernel/k_scheduler.h" | 21 | #include "core/hle/kernel/k_scheduler.h" |
| 21 | #include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" | 22 | #include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" |
| @@ -23,7 +24,6 @@ | |||
| 23 | #include "core/hle/kernel/k_thread.h" | 24 | #include "core/hle/kernel/k_thread.h" |
| 24 | #include "core/hle/kernel/k_writable_event.h" | 25 | #include "core/hle/kernel/k_writable_event.h" |
| 25 | #include "core/hle/kernel/kernel.h" | 26 | #include "core/hle/kernel/kernel.h" |
| 26 | #include "core/hle/kernel/process.h" | ||
| 27 | #include "core/hle/kernel/svc_results.h" | 27 | #include "core/hle/kernel/svc_results.h" |
| 28 | #include "core/hle/kernel/time_manager.h" | 28 | #include "core/hle/kernel/time_manager.h" |
| 29 | #include "core/memory.h" | 29 | #include "core/memory.h" |
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 7f7ab74dd..4b92ba655 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h | |||
| @@ -38,7 +38,7 @@ class Domain; | |||
| 38 | class HandleTable; | 38 | class HandleTable; |
| 39 | class HLERequestContext; | 39 | class HLERequestContext; |
| 40 | class KernelCore; | 40 | class KernelCore; |
| 41 | class Process; | 41 | class KProcess; |
| 42 | class KServerSession; | 42 | class KServerSession; |
| 43 | class KThread; | 43 | class KThread; |
| 44 | class KReadableEvent; | 44 | class KReadableEvent; |
diff --git a/src/core/hle/kernel/init/init_slab_setup.cpp b/src/core/hle/kernel/init/init_slab_setup.cpp index f8c255732..04e481a0a 100644 --- a/src/core/hle/kernel/init/init_slab_setup.cpp +++ b/src/core/hle/kernel/init/init_slab_setup.cpp | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include "core/hle/kernel/k_memory_layout.h" | 13 | #include "core/hle/kernel/k_memory_layout.h" |
| 14 | #include "core/hle/kernel/k_memory_manager.h" | 14 | #include "core/hle/kernel/k_memory_manager.h" |
| 15 | #include "core/hle/kernel/k_port.h" | 15 | #include "core/hle/kernel/k_port.h" |
| 16 | #include "core/hle/kernel/k_process.h" | ||
| 16 | #include "core/hle/kernel/k_resource_limit.h" | 17 | #include "core/hle/kernel/k_resource_limit.h" |
| 17 | #include "core/hle/kernel/k_session.h" | 18 | #include "core/hle/kernel/k_session.h" |
| 18 | #include "core/hle/kernel/k_shared_memory.h" | 19 | #include "core/hle/kernel/k_shared_memory.h" |
| @@ -20,7 +21,6 @@ | |||
| 20 | #include "core/hle/kernel/k_thread.h" | 21 | #include "core/hle/kernel/k_thread.h" |
| 21 | #include "core/hle/kernel/k_transfer_memory.h" | 22 | #include "core/hle/kernel/k_transfer_memory.h" |
| 22 | #include "core/hle/kernel/memory_types.h" | 23 | #include "core/hle/kernel/memory_types.h" |
| 23 | #include "core/hle/kernel/process.h" | ||
| 24 | #include "core/memory.h" | 24 | #include "core/memory.h" |
| 25 | 25 | ||
| 26 | namespace Kernel::Init { | 26 | namespace Kernel::Init { |
| @@ -28,7 +28,7 @@ namespace Kernel::Init { | |||
| 28 | #define SLAB_COUNT(CLASS) g_slab_resource_counts.num_##CLASS | 28 | #define SLAB_COUNT(CLASS) g_slab_resource_counts.num_##CLASS |
| 29 | 29 | ||
| 30 | #define FOREACH_SLAB_TYPE(HANDLER, ...) \ | 30 | #define FOREACH_SLAB_TYPE(HANDLER, ...) \ |
| 31 | HANDLER(Process, (SLAB_COUNT(Process)), ##__VA_ARGS__) \ | 31 | HANDLER(KProcess, (SLAB_COUNT(KProcess)), ##__VA_ARGS__) \ |
| 32 | HANDLER(KThread, (SLAB_COUNT(KThread)), ##__VA_ARGS__) \ | 32 | HANDLER(KThread, (SLAB_COUNT(KThread)), ##__VA_ARGS__) \ |
| 33 | HANDLER(KEvent, (SLAB_COUNT(KEvent)), ##__VA_ARGS__) \ | 33 | HANDLER(KEvent, (SLAB_COUNT(KEvent)), ##__VA_ARGS__) \ |
| 34 | HANDLER(KPort, (SLAB_COUNT(KPort)), ##__VA_ARGS__) \ | 34 | HANDLER(KPort, (SLAB_COUNT(KPort)), ##__VA_ARGS__) \ |
| @@ -48,7 +48,7 @@ enum KSlabType : u32 { | |||
| 48 | #undef DEFINE_SLAB_TYPE_ENUM_MEMBER | 48 | #undef DEFINE_SLAB_TYPE_ENUM_MEMBER |
| 49 | 49 | ||
| 50 | // Constexpr counts. | 50 | // Constexpr counts. |
| 51 | constexpr size_t SlabCountProcess = 80; | 51 | constexpr size_t SlabCountKProcess = 80; |
| 52 | constexpr size_t SlabCountKThread = 800; | 52 | constexpr size_t SlabCountKThread = 800; |
| 53 | constexpr size_t SlabCountKEvent = 700; | 53 | constexpr size_t SlabCountKEvent = 700; |
| 54 | constexpr size_t SlabCountKInterruptEvent = 100; | 54 | constexpr size_t SlabCountKInterruptEvent = 100; |
| @@ -69,7 +69,7 @@ constexpr size_t SlabCountExtraKThread = 160; | |||
| 69 | 69 | ||
| 70 | // Global to hold our resource counts. | 70 | // Global to hold our resource counts. |
| 71 | KSlabResourceCounts g_slab_resource_counts = { | 71 | KSlabResourceCounts g_slab_resource_counts = { |
| 72 | .num_Process = SlabCountProcess, | 72 | .num_KProcess = SlabCountKProcess, |
| 73 | .num_KThread = SlabCountKThread, | 73 | .num_KThread = SlabCountKThread, |
| 74 | .num_KEvent = SlabCountKEvent, | 74 | .num_KEvent = SlabCountKEvent, |
| 75 | .num_KInterruptEvent = SlabCountKInterruptEvent, | 75 | .num_KInterruptEvent = SlabCountKInterruptEvent, |
diff --git a/src/core/hle/kernel/init/init_slab_setup.h b/src/core/hle/kernel/init/init_slab_setup.h index 8876678b3..6418b97ac 100644 --- a/src/core/hle/kernel/init/init_slab_setup.h +++ b/src/core/hle/kernel/init/init_slab_setup.h | |||
| @@ -15,7 +15,7 @@ class KMemoryLayout; | |||
| 15 | namespace Kernel::Init { | 15 | namespace Kernel::Init { |
| 16 | 16 | ||
| 17 | struct KSlabResourceCounts { | 17 | struct KSlabResourceCounts { |
| 18 | size_t num_Process; | 18 | size_t num_KProcess; |
| 19 | size_t num_KThread; | 19 | size_t num_KThread; |
| 20 | size_t num_KEvent; | 20 | size_t num_KEvent; |
| 21 | size_t num_KInterruptEvent; | 21 | size_t num_KInterruptEvent; |
diff --git a/src/core/hle/kernel/k_auto_object.h b/src/core/hle/kernel/k_auto_object.h index fd6405a0e..5a180b7dc 100644 --- a/src/core/hle/kernel/k_auto_object.h +++ b/src/core/hle/kernel/k_auto_object.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | namespace Kernel { | 15 | namespace Kernel { |
| 16 | 16 | ||
| 17 | class KernelCore; | 17 | class KernelCore; |
| 18 | class Process; | 18 | class KProcess; |
| 19 | 19 | ||
| 20 | using Handle = u32; | 20 | using Handle = u32; |
| 21 | 21 | ||
| @@ -106,7 +106,7 @@ public: | |||
| 106 | // Finalize is responsible for cleaning up resource, but does not destroy the object. | 106 | // Finalize is responsible for cleaning up resource, but does not destroy the object. |
| 107 | virtual void Finalize() {} | 107 | virtual void Finalize() {} |
| 108 | 108 | ||
| 109 | virtual Process* GetOwner() const { | 109 | virtual KProcess* GetOwner() const { |
| 110 | return nullptr; | 110 | return nullptr; |
| 111 | } | 111 | } |
| 112 | 112 | ||
diff --git a/src/core/hle/kernel/k_auto_object_container.cpp b/src/core/hle/kernel/k_auto_object_container.cpp index 9ba8a54c7..85d03ebe3 100644 --- a/src/core/hle/kernel/k_auto_object_container.cpp +++ b/src/core/hle/kernel/k_auto_object_container.cpp | |||
| @@ -18,7 +18,7 @@ void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList* obj) { | |||
| 18 | m_object_list.erase(m_object_list.iterator_to(*obj)); | 18 | m_object_list.erase(m_object_list.iterator_to(*obj)); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | size_t KAutoObjectWithListContainer::GetOwnedCount(Process* owner) { | 21 | size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess* owner) { |
| 22 | KScopedLightLock lk(m_lock); | 22 | KScopedLightLock lk(m_lock); |
| 23 | 23 | ||
| 24 | size_t count = 0; | 24 | size_t count = 0; |
diff --git a/src/core/hle/kernel/k_auto_object_container.h b/src/core/hle/kernel/k_auto_object_container.h index 4b599b7c3..6d1cd4862 100644 --- a/src/core/hle/kernel/k_auto_object_container.h +++ b/src/core/hle/kernel/k_auto_object_container.h | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | namespace Kernel { | 16 | namespace Kernel { |
| 17 | 17 | ||
| 18 | class KernelCore; | 18 | class KernelCore; |
| 19 | class Process; | 19 | class KProcess; |
| 20 | 20 | ||
| 21 | class KAutoObjectWithListContainer { | 21 | class KAutoObjectWithListContainer { |
| 22 | NON_COPYABLE(KAutoObjectWithListContainer); | 22 | NON_COPYABLE(KAutoObjectWithListContainer); |
| @@ -66,7 +66,7 @@ public: | |||
| 66 | 66 | ||
| 67 | void Register(KAutoObjectWithList* obj); | 67 | void Register(KAutoObjectWithList* obj); |
| 68 | void Unregister(KAutoObjectWithList* obj); | 68 | void Unregister(KAutoObjectWithList* obj); |
| 69 | size_t GetOwnedCount(Process* owner); | 69 | size_t GetOwnedCount(KProcess* owner); |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | } // namespace Kernel | 72 | } // namespace Kernel |
diff --git a/src/core/hle/kernel/k_class_token.h b/src/core/hle/kernel/k_class_token.h index 89b80a341..fb4307cd0 100644 --- a/src/core/hle/kernel/k_class_token.h +++ b/src/core/hle/kernel/k_class_token.h | |||
| @@ -97,7 +97,7 @@ public: | |||
| 97 | KServerSession, | 97 | KServerSession, |
| 98 | KClientPort, | 98 | KClientPort, |
| 99 | KClientSession, | 99 | KClientSession, |
| 100 | Process, | 100 | KProcess, |
| 101 | KResourceLimit, | 101 | KResourceLimit, |
| 102 | KLightSession, | 102 | KLightSession, |
| 103 | KPort, | 103 | KPort, |
diff --git a/src/core/hle/kernel/k_condition_variable.cpp b/src/core/hle/kernel/k_condition_variable.cpp index 72565af05..a9738f7ce 100644 --- a/src/core/hle/kernel/k_condition_variable.cpp +++ b/src/core/hle/kernel/k_condition_variable.cpp | |||
| @@ -8,12 +8,12 @@ | |||
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/hle/kernel/k_condition_variable.h" | 9 | #include "core/hle/kernel/k_condition_variable.h" |
| 10 | #include "core/hle/kernel/k_linked_list.h" | 10 | #include "core/hle/kernel/k_linked_list.h" |
| 11 | #include "core/hle/kernel/k_process.h" | ||
| 11 | #include "core/hle/kernel/k_scheduler.h" | 12 | #include "core/hle/kernel/k_scheduler.h" |
| 12 | #include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" | 13 | #include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" |
| 13 | #include "core/hle/kernel/k_synchronization_object.h" | 14 | #include "core/hle/kernel/k_synchronization_object.h" |
| 14 | #include "core/hle/kernel/k_thread.h" | 15 | #include "core/hle/kernel/k_thread.h" |
| 15 | #include "core/hle/kernel/kernel.h" | 16 | #include "core/hle/kernel/kernel.h" |
| 16 | #include "core/hle/kernel/process.h" | ||
| 17 | #include "core/hle/kernel/svc_common.h" | 17 | #include "core/hle/kernel/svc_common.h" |
| 18 | #include "core/hle/kernel/svc_results.h" | 18 | #include "core/hle/kernel/svc_results.h" |
| 19 | #include "core/memory.h" | 19 | #include "core/memory.h" |
diff --git a/src/core/hle/kernel/k_event.cpp b/src/core/hle/kernel/k_event.cpp index fdec0c36f..986355b78 100644 --- a/src/core/hle/kernel/k_event.cpp +++ b/src/core/hle/kernel/k_event.cpp | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/kernel/k_event.h" | 5 | #include "core/hle/kernel/k_event.h" |
| 6 | #include "core/hle/kernel/k_process.h" | ||
| 6 | #include "core/hle/kernel/k_resource_limit.h" | 7 | #include "core/hle/kernel/k_resource_limit.h" |
| 7 | #include "core/hle/kernel/process.h" | ||
| 8 | 8 | ||
| 9 | namespace Kernel { | 9 | namespace Kernel { |
| 10 | 10 | ||
| @@ -45,7 +45,7 @@ void KEvent::Finalize() { | |||
| 45 | 45 | ||
| 46 | void KEvent::PostDestroy(uintptr_t arg) { | 46 | void KEvent::PostDestroy(uintptr_t arg) { |
| 47 | // Release the event count resource the owner process holds. | 47 | // Release the event count resource the owner process holds. |
| 48 | Process* owner = reinterpret_cast<Process*>(arg); | 48 | KProcess* owner = reinterpret_cast<KProcess*>(arg); |
| 49 | if (owner) { | 49 | if (owner) { |
| 50 | owner->GetResourceLimit()->Release(LimitableResource::Events, 1); | 50 | owner->GetResourceLimit()->Release(LimitableResource::Events, 1); |
| 51 | owner->Close(); | 51 | owner->Close(); |
diff --git a/src/core/hle/kernel/k_event.h b/src/core/hle/kernel/k_event.h index f0b89f882..4ca869930 100644 --- a/src/core/hle/kernel/k_event.h +++ b/src/core/hle/kernel/k_event.h | |||
| @@ -13,7 +13,7 @@ namespace Kernel { | |||
| 13 | class KernelCore; | 13 | class KernelCore; |
| 14 | class KReadableEvent; | 14 | class KReadableEvent; |
| 15 | class KWritableEvent; | 15 | class KWritableEvent; |
| 16 | class Process; | 16 | class KProcess; |
| 17 | 17 | ||
| 18 | class KEvent final : public KAutoObjectWithSlabHeapAndContainer<KEvent, KAutoObjectWithList> { | 18 | class KEvent final : public KAutoObjectWithSlabHeapAndContainer<KEvent, KAutoObjectWithList> { |
| 19 | KERNEL_AUTOOBJECT_TRAITS(KEvent, KAutoObject); | 19 | KERNEL_AUTOOBJECT_TRAITS(KEvent, KAutoObject); |
| @@ -36,7 +36,7 @@ public: | |||
| 36 | 36 | ||
| 37 | static void PostDestroy(uintptr_t arg); | 37 | static void PostDestroy(uintptr_t arg); |
| 38 | 38 | ||
| 39 | virtual Process* GetOwner() const override { | 39 | virtual KProcess* GetOwner() const override { |
| 40 | return owner; | 40 | return owner; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| @@ -51,7 +51,7 @@ public: | |||
| 51 | private: | 51 | private: |
| 52 | KReadableEvent readable_event; | 52 | KReadableEvent readable_event; |
| 53 | KWritableEvent writable_event; | 53 | KWritableEvent writable_event; |
| 54 | Process* owner{}; | 54 | KProcess* owner{}; |
| 55 | bool initialized{}; | 55 | bool initialized{}; |
| 56 | }; | 56 | }; |
| 57 | 57 | ||
diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp index 5f60b95cd..2f33cb6c1 100644 --- a/src/core/hle/kernel/k_page_table.cpp +++ b/src/core/hle/kernel/k_page_table.cpp | |||
| @@ -11,11 +11,11 @@ | |||
| 11 | #include "core/hle/kernel/k_memory_block_manager.h" | 11 | #include "core/hle/kernel/k_memory_block_manager.h" |
| 12 | #include "core/hle/kernel/k_page_linked_list.h" | 12 | #include "core/hle/kernel/k_page_linked_list.h" |
| 13 | #include "core/hle/kernel/k_page_table.h" | 13 | #include "core/hle/kernel/k_page_table.h" |
| 14 | #include "core/hle/kernel/k_process.h" | ||
| 14 | #include "core/hle/kernel/k_resource_limit.h" | 15 | #include "core/hle/kernel/k_resource_limit.h" |
| 15 | #include "core/hle/kernel/k_scoped_resource_reservation.h" | 16 | #include "core/hle/kernel/k_scoped_resource_reservation.h" |
| 16 | #include "core/hle/kernel/k_system_control.h" | 17 | #include "core/hle/kernel/k_system_control.h" |
| 17 | #include "core/hle/kernel/kernel.h" | 18 | #include "core/hle/kernel/kernel.h" |
| 18 | #include "core/hle/kernel/process.h" | ||
| 19 | #include "core/hle/kernel/svc_results.h" | 19 | #include "core/hle/kernel/svc_results.h" |
| 20 | #include "core/memory.h" | 20 | #include "core/memory.h" |
| 21 | 21 | ||
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/k_process.cpp index 315640bea..edc3b5175 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/k_process.cpp | |||
| @@ -17,13 +17,13 @@ | |||
| 17 | #include "core/hle/kernel/code_set.h" | 17 | #include "core/hle/kernel/code_set.h" |
| 18 | #include "core/hle/kernel/k_memory_block_manager.h" | 18 | #include "core/hle/kernel/k_memory_block_manager.h" |
| 19 | #include "core/hle/kernel/k_page_table.h" | 19 | #include "core/hle/kernel/k_page_table.h" |
| 20 | #include "core/hle/kernel/k_process.h" | ||
| 20 | #include "core/hle/kernel/k_resource_limit.h" | 21 | #include "core/hle/kernel/k_resource_limit.h" |
| 21 | #include "core/hle/kernel/k_scheduler.h" | 22 | #include "core/hle/kernel/k_scheduler.h" |
| 22 | #include "core/hle/kernel/k_scoped_resource_reservation.h" | 23 | #include "core/hle/kernel/k_scoped_resource_reservation.h" |
| 23 | #include "core/hle/kernel/k_slab_heap.h" | 24 | #include "core/hle/kernel/k_slab_heap.h" |
| 24 | #include "core/hle/kernel/k_thread.h" | 25 | #include "core/hle/kernel/k_thread.h" |
| 25 | #include "core/hle/kernel/kernel.h" | 26 | #include "core/hle/kernel/kernel.h" |
| 26 | #include "core/hle/kernel/process.h" | ||
| 27 | #include "core/hle/kernel/svc_results.h" | 27 | #include "core/hle/kernel/svc_results.h" |
| 28 | #include "core/hle/lock.h" | 28 | #include "core/hle/lock.h" |
| 29 | #include "core/memory.h" | 29 | #include "core/memory.h" |
| @@ -37,7 +37,7 @@ namespace { | |||
| 37 | * @param owner_process The parent process for the main thread | 37 | * @param owner_process The parent process for the main thread |
| 38 | * @param priority The priority to give the main thread | 38 | * @param priority The priority to give the main thread |
| 39 | */ | 39 | */ |
| 40 | void SetupMainThread(Core::System& system, Process& owner_process, u32 priority, VAddr stack_top) { | 40 | void SetupMainThread(Core::System& system, KProcess& owner_process, u32 priority, VAddr stack_top) { |
| 41 | const VAddr entry_point = owner_process.PageTable().GetCodeRegionStart(); | 41 | const VAddr entry_point = owner_process.PageTable().GetCodeRegionStart(); |
| 42 | ASSERT(owner_process.GetResourceLimit()->Reserve(LimitableResource::Threads, 1)); | 42 | ASSERT(owner_process.GetResourceLimit()->Reserve(LimitableResource::Threads, 1)); |
| 43 | 43 | ||
| @@ -117,8 +117,8 @@ private: | |||
| 117 | std::bitset<num_slot_entries> is_slot_used; | 117 | std::bitset<num_slot_entries> is_slot_used; |
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| 120 | ResultCode Process::Initialize(Process* process, Core::System& system, std::string name, | 120 | ResultCode KProcess::Initialize(KProcess* process, Core::System& system, std::string name, |
| 121 | ProcessType type) { | 121 | ProcessType type) { |
| 122 | auto& kernel = system.Kernel(); | 122 | auto& kernel = system.Kernel(); |
| 123 | 123 | ||
| 124 | process->name = std::move(name); | 124 | process->name = std::move(name); |
| @@ -144,11 +144,11 @@ ResultCode Process::Initialize(Process* process, Core::System& system, std::stri | |||
| 144 | return RESULT_SUCCESS; | 144 | return RESULT_SUCCESS; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | KResourceLimit* Process::GetResourceLimit() const { | 147 | KResourceLimit* KProcess::GetResourceLimit() const { |
| 148 | return resource_limit; | 148 | return resource_limit; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | void Process::IncrementThreadCount() { | 151 | void KProcess::IncrementThreadCount() { |
| 152 | ASSERT(num_threads >= 0); | 152 | ASSERT(num_threads >= 0); |
| 153 | num_created_threads++; | 153 | num_created_threads++; |
| 154 | 154 | ||
| @@ -157,7 +157,7 @@ void Process::IncrementThreadCount() { | |||
| 157 | } | 157 | } |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | void Process::DecrementThreadCount() { | 160 | void KProcess::DecrementThreadCount() { |
| 161 | ASSERT(num_threads > 0); | 161 | ASSERT(num_threads > 0); |
| 162 | 162 | ||
| 163 | if (const auto count = --num_threads; count == 0) { | 163 | if (const auto count = --num_threads; count == 0) { |
| @@ -165,7 +165,7 @@ void Process::DecrementThreadCount() { | |||
| 165 | } | 165 | } |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | u64 Process::GetTotalPhysicalMemoryAvailable() const { | 168 | u64 KProcess::GetTotalPhysicalMemoryAvailable() const { |
| 169 | const u64 capacity{resource_limit->GetFreeValue(LimitableResource::PhysicalMemory) + | 169 | const u64 capacity{resource_limit->GetFreeValue(LimitableResource::PhysicalMemory) + |
| 170 | page_table->GetTotalHeapSize() + GetSystemResourceSize() + image_size + | 170 | page_table->GetTotalHeapSize() + GetSystemResourceSize() + image_size + |
| 171 | main_thread_stack_size}; | 171 | main_thread_stack_size}; |
| @@ -179,20 +179,20 @@ u64 Process::GetTotalPhysicalMemoryAvailable() const { | |||
| 179 | return memory_usage_capacity; | 179 | return memory_usage_capacity; |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | u64 Process::GetTotalPhysicalMemoryAvailableWithoutSystemResource() const { | 182 | u64 KProcess::GetTotalPhysicalMemoryAvailableWithoutSystemResource() const { |
| 183 | return GetTotalPhysicalMemoryAvailable() - GetSystemResourceSize(); | 183 | return GetTotalPhysicalMemoryAvailable() - GetSystemResourceSize(); |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | u64 Process::GetTotalPhysicalMemoryUsed() const { | 186 | u64 KProcess::GetTotalPhysicalMemoryUsed() const { |
| 187 | return image_size + main_thread_stack_size + page_table->GetTotalHeapSize() + | 187 | return image_size + main_thread_stack_size + page_table->GetTotalHeapSize() + |
| 188 | GetSystemResourceSize(); | 188 | GetSystemResourceSize(); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | u64 Process::GetTotalPhysicalMemoryUsedWithoutSystemResource() const { | 191 | u64 KProcess::GetTotalPhysicalMemoryUsedWithoutSystemResource() const { |
| 192 | return GetTotalPhysicalMemoryUsed() - GetSystemResourceUsage(); | 192 | return GetTotalPhysicalMemoryUsed() - GetSystemResourceUsage(); |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | bool Process::ReleaseUserException(KThread* thread) { | 195 | bool KProcess::ReleaseUserException(KThread* thread) { |
| 196 | KScopedSchedulerLock sl{kernel}; | 196 | KScopedSchedulerLock sl{kernel}; |
| 197 | 197 | ||
| 198 | if (exception_thread == thread) { | 198 | if (exception_thread == thread) { |
| @@ -217,7 +217,7 @@ bool Process::ReleaseUserException(KThread* thread) { | |||
| 217 | } | 217 | } |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | void Process::PinCurrentThread() { | 220 | void KProcess::PinCurrentThread() { |
| 221 | ASSERT(kernel.GlobalSchedulerContext().IsLocked()); | 221 | ASSERT(kernel.GlobalSchedulerContext().IsLocked()); |
| 222 | 222 | ||
| 223 | // Get the current thread. | 223 | // Get the current thread. |
| @@ -232,7 +232,7 @@ void Process::PinCurrentThread() { | |||
| 232 | KScheduler::SetSchedulerUpdateNeeded(kernel); | 232 | KScheduler::SetSchedulerUpdateNeeded(kernel); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | void Process::UnpinCurrentThread() { | 235 | void KProcess::UnpinCurrentThread() { |
| 236 | ASSERT(kernel.GlobalSchedulerContext().IsLocked()); | 236 | ASSERT(kernel.GlobalSchedulerContext().IsLocked()); |
| 237 | 237 | ||
| 238 | // Get the current thread. | 238 | // Get the current thread. |
| @@ -247,15 +247,15 @@ void Process::UnpinCurrentThread() { | |||
| 247 | KScheduler::SetSchedulerUpdateNeeded(kernel); | 247 | KScheduler::SetSchedulerUpdateNeeded(kernel); |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | void Process::RegisterThread(const KThread* thread) { | 250 | void KProcess::RegisterThread(const KThread* thread) { |
| 251 | thread_list.push_back(thread); | 251 | thread_list.push_back(thread); |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | void Process::UnregisterThread(const KThread* thread) { | 254 | void KProcess::UnregisterThread(const KThread* thread) { |
| 255 | thread_list.remove(thread); | 255 | thread_list.remove(thread); |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | ResultCode Process::Reset() { | 258 | ResultCode KProcess::Reset() { |
| 259 | // Lock the process and the scheduler. | 259 | // Lock the process and the scheduler. |
| 260 | KScopedLightLock lk(state_lock); | 260 | KScopedLightLock lk(state_lock); |
| 261 | KScopedSchedulerLock sl{kernel}; | 261 | KScopedSchedulerLock sl{kernel}; |
| @@ -269,8 +269,8 @@ ResultCode Process::Reset() { | |||
| 269 | return RESULT_SUCCESS; | 269 | return RESULT_SUCCESS; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, | 272 | ResultCode KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, |
| 273 | std::size_t code_size) { | 273 | std::size_t code_size) { |
| 274 | program_id = metadata.GetTitleID(); | 274 | program_id = metadata.GetTitleID(); |
| 275 | ideal_core = metadata.GetMainThreadCore(); | 275 | ideal_core = metadata.GetMainThreadCore(); |
| 276 | is_64bit_process = metadata.Is64BitProgram(); | 276 | is_64bit_process = metadata.Is64BitProgram(); |
| @@ -332,7 +332,7 @@ ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, | |||
| 332 | return handle_table.SetSize(capabilities.GetHandleTableSize()); | 332 | return handle_table.SetSize(capabilities.GetHandleTableSize()); |
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | void Process::Run(s32 main_thread_priority, u64 stack_size) { | 335 | void KProcess::Run(s32 main_thread_priority, u64 stack_size) { |
| 336 | AllocateMainThreadStack(stack_size); | 336 | AllocateMainThreadStack(stack_size); |
| 337 | resource_limit->Reserve(LimitableResource::Threads, 1); | 337 | resource_limit->Reserve(LimitableResource::Threads, 1); |
| 338 | resource_limit->Reserve(LimitableResource::PhysicalMemory, main_thread_stack_size); | 338 | resource_limit->Reserve(LimitableResource::PhysicalMemory, main_thread_stack_size); |
| @@ -345,7 +345,7 @@ void Process::Run(s32 main_thread_priority, u64 stack_size) { | |||
| 345 | SetupMainThread(kernel.System(), *this, main_thread_priority, main_thread_stack_top); | 345 | SetupMainThread(kernel.System(), *this, main_thread_priority, main_thread_stack_top); |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | void Process::PrepareForTermination() { | 348 | void KProcess::PrepareForTermination() { |
| 349 | ChangeStatus(ProcessStatus::Exiting); | 349 | ChangeStatus(ProcessStatus::Exiting); |
| 350 | 350 | ||
| 351 | const auto stop_threads = [this](const std::vector<KThread*>& thread_list) { | 351 | const auto stop_threads = [this](const std::vector<KThread*>& thread_list) { |
| @@ -377,14 +377,14 @@ void Process::PrepareForTermination() { | |||
| 377 | ChangeStatus(ProcessStatus::Exited); | 377 | ChangeStatus(ProcessStatus::Exited); |
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | void Process::Finalize() { | 380 | void KProcess::Finalize() { |
| 381 | // Release memory to the resource limit. | 381 | // Release memory to the resource limit. |
| 382 | if (resource_limit != nullptr) { | 382 | if (resource_limit != nullptr) { |
| 383 | resource_limit->Close(); | 383 | resource_limit->Close(); |
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | // Perform inherited finalization. | 386 | // Perform inherited finalization. |
| 387 | KAutoObjectWithSlabHeapAndContainer<Process, KSynchronizationObject>::Finalize(); | 387 | KAutoObjectWithSlabHeapAndContainer<KProcess, KSynchronizationObject>::Finalize(); |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | /** | 390 | /** |
| @@ -400,7 +400,7 @@ static auto FindTLSPageWithAvailableSlots(std::vector<TLSPage>& tls_pages) { | |||
| 400 | [](const auto& page) { return page.HasAvailableSlots(); }); | 400 | [](const auto& page) { return page.HasAvailableSlots(); }); |
| 401 | } | 401 | } |
| 402 | 402 | ||
| 403 | VAddr Process::CreateTLSRegion() { | 403 | VAddr KProcess::CreateTLSRegion() { |
| 404 | KScopedSchedulerLock lock(kernel); | 404 | KScopedSchedulerLock lock(kernel); |
| 405 | if (auto tls_page_iter{FindTLSPageWithAvailableSlots(tls_pages)}; | 405 | if (auto tls_page_iter{FindTLSPageWithAvailableSlots(tls_pages)}; |
| 406 | tls_page_iter != tls_pages.cend()) { | 406 | tls_page_iter != tls_pages.cend()) { |
| @@ -431,7 +431,7 @@ VAddr Process::CreateTLSRegion() { | |||
| 431 | return *reserve_result; | 431 | return *reserve_result; |
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | void Process::FreeTLSRegion(VAddr tls_address) { | 434 | void KProcess::FreeTLSRegion(VAddr tls_address) { |
| 435 | KScopedSchedulerLock lock(kernel); | 435 | KScopedSchedulerLock lock(kernel); |
| 436 | const VAddr aligned_address = Common::AlignDown(tls_address, Core::Memory::PAGE_SIZE); | 436 | const VAddr aligned_address = Common::AlignDown(tls_address, Core::Memory::PAGE_SIZE); |
| 437 | auto iter = | 437 | auto iter = |
| @@ -446,7 +446,7 @@ void Process::FreeTLSRegion(VAddr tls_address) { | |||
| 446 | iter->ReleaseSlot(tls_address); | 446 | iter->ReleaseSlot(tls_address); |
| 447 | } | 447 | } |
| 448 | 448 | ||
| 449 | void Process::LoadModule(CodeSet code_set, VAddr base_addr) { | 449 | void KProcess::LoadModule(CodeSet code_set, VAddr base_addr) { |
| 450 | std::lock_guard lock{HLE::g_hle_lock}; | 450 | std::lock_guard lock{HLE::g_hle_lock}; |
| 451 | const auto ReprotectSegment = [&](const CodeSet::Segment& segment, | 451 | const auto ReprotectSegment = [&](const CodeSet::Segment& segment, |
| 452 | KMemoryPermission permission) { | 452 | KMemoryPermission permission) { |
| @@ -461,19 +461,19 @@ void Process::LoadModule(CodeSet code_set, VAddr base_addr) { | |||
| 461 | ReprotectSegment(code_set.DataSegment(), KMemoryPermission::ReadAndWrite); | 461 | ReprotectSegment(code_set.DataSegment(), KMemoryPermission::ReadAndWrite); |
| 462 | } | 462 | } |
| 463 | 463 | ||
| 464 | bool Process::IsSignaled() const { | 464 | bool KProcess::IsSignaled() const { |
| 465 | ASSERT(kernel.GlobalSchedulerContext().IsLocked()); | 465 | ASSERT(kernel.GlobalSchedulerContext().IsLocked()); |
| 466 | return is_signaled; | 466 | return is_signaled; |
| 467 | } | 467 | } |
| 468 | 468 | ||
| 469 | Process::Process(KernelCore& kernel) | 469 | KProcess::KProcess(KernelCore& kernel) |
| 470 | : KAutoObjectWithSlabHeapAndContainer{kernel}, | 470 | : KAutoObjectWithSlabHeapAndContainer{kernel}, |
| 471 | page_table{std::make_unique<KPageTable>(kernel.System())}, handle_table{kernel}, | 471 | page_table{std::make_unique<KPageTable>(kernel.System())}, handle_table{kernel}, |
| 472 | address_arbiter{kernel.System()}, condition_var{kernel.System()}, state_lock{kernel} {} | 472 | address_arbiter{kernel.System()}, condition_var{kernel.System()}, state_lock{kernel} {} |
| 473 | 473 | ||
| 474 | Process::~Process() = default; | 474 | KProcess::~KProcess() = default; |
| 475 | 475 | ||
| 476 | void Process::ChangeStatus(ProcessStatus new_status) { | 476 | void KProcess::ChangeStatus(ProcessStatus new_status) { |
| 477 | if (status == new_status) { | 477 | if (status == new_status) { |
| 478 | return; | 478 | return; |
| 479 | } | 479 | } |
| @@ -483,7 +483,7 @@ void Process::ChangeStatus(ProcessStatus new_status) { | |||
| 483 | NotifyAvailable(); | 483 | NotifyAvailable(); |
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | ResultCode Process::AllocateMainThreadStack(std::size_t stack_size) { | 486 | ResultCode KProcess::AllocateMainThreadStack(std::size_t stack_size) { |
| 487 | ASSERT(stack_size); | 487 | ASSERT(stack_size); |
| 488 | 488 | ||
| 489 | // The kernel always ensures that the given stack size is page aligned. | 489 | // The kernel always ensures that the given stack size is page aligned. |
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/k_process.h index b775e1fd0..961c0d9ba 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/k_process.h | |||
| @@ -62,12 +62,13 @@ enum class ProcessStatus { | |||
| 62 | DebugBreak, | 62 | DebugBreak, |
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | class Process final : public KAutoObjectWithSlabHeapAndContainer<Process, KSynchronizationObject> { | 65 | class KProcess final |
| 66 | KERNEL_AUTOOBJECT_TRAITS(Process, KSynchronizationObject); | 66 | : public KAutoObjectWithSlabHeapAndContainer<KProcess, KSynchronizationObject> { |
| 67 | KERNEL_AUTOOBJECT_TRAITS(KProcess, KSynchronizationObject); | ||
| 67 | 68 | ||
| 68 | public: | 69 | public: |
| 69 | explicit Process(KernelCore& kernel); | 70 | explicit KProcess(KernelCore& kernel); |
| 70 | ~Process() override; | 71 | ~KProcess() override; |
| 71 | 72 | ||
| 72 | enum : u64 { | 73 | enum : u64 { |
| 73 | /// Lowest allowed process ID for a kernel initial process. | 74 | /// Lowest allowed process ID for a kernel initial process. |
| @@ -89,7 +90,7 @@ public: | |||
| 89 | 90 | ||
| 90 | static constexpr std::size_t RANDOM_ENTROPY_SIZE = 4; | 91 | static constexpr std::size_t RANDOM_ENTROPY_SIZE = 4; |
| 91 | 92 | ||
| 92 | static ResultCode Initialize(Process* process, Core::System& system, std::string name, | 93 | static ResultCode Initialize(KProcess* process, Core::System& system, std::string name, |
| 93 | ProcessType type); | 94 | ProcessType type); |
| 94 | 95 | ||
| 95 | /// Gets a reference to the process' page table. | 96 | /// Gets a reference to the process' page table. |
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp index 38c6b50fa..0115fe6d1 100644 --- a/src/core/hle/kernel/k_scheduler.cpp +++ b/src/core/hle/kernel/k_scheduler.cpp | |||
| @@ -15,12 +15,12 @@ | |||
| 15 | #include "core/core.h" | 15 | #include "core/core.h" |
| 16 | #include "core/core_timing.h" | 16 | #include "core/core_timing.h" |
| 17 | #include "core/cpu_manager.h" | 17 | #include "core/cpu_manager.h" |
| 18 | #include "core/hle/kernel/k_process.h" | ||
| 18 | #include "core/hle/kernel/k_scheduler.h" | 19 | #include "core/hle/kernel/k_scheduler.h" |
| 19 | #include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" | 20 | #include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" |
| 20 | #include "core/hle/kernel/k_thread.h" | 21 | #include "core/hle/kernel/k_thread.h" |
| 21 | #include "core/hle/kernel/kernel.h" | 22 | #include "core/hle/kernel/kernel.h" |
| 22 | #include "core/hle/kernel/physical_core.h" | 23 | #include "core/hle/kernel/physical_core.h" |
| 23 | #include "core/hle/kernel/process.h" | ||
| 24 | #include "core/hle/kernel/time_manager.h" | 24 | #include "core/hle/kernel/time_manager.h" |
| 25 | 25 | ||
| 26 | namespace Kernel { | 26 | namespace Kernel { |
| @@ -71,7 +71,7 @@ u64 KScheduler::UpdateHighestPriorityThread(KThread* highest_thread) { | |||
| 71 | } | 71 | } |
| 72 | if (state.should_count_idle) { | 72 | if (state.should_count_idle) { |
| 73 | if (highest_thread != nullptr) { | 73 | if (highest_thread != nullptr) { |
| 74 | if (Process* process = highest_thread->GetOwnerProcess(); process != nullptr) { | 74 | if (KProcess* process = highest_thread->GetOwnerProcess(); process != nullptr) { |
| 75 | process->SetRunningThread(core_id, highest_thread, state.idle_count); | 75 | process->SetRunningThread(core_id, highest_thread, state.idle_count); |
| 76 | } | 76 | } |
| 77 | } else { | 77 | } else { |
| @@ -104,7 +104,7 @@ u64 KScheduler::UpdateHighestPriorityThreadsImpl(KernelCore& kernel) { | |||
| 104 | if (top_thread != nullptr) { | 104 | if (top_thread != nullptr) { |
| 105 | // If the thread has no waiters, we need to check if the process has a thread pinned. | 105 | // If the thread has no waiters, we need to check if the process has a thread pinned. |
| 106 | if (top_thread->GetNumKernelWaiters() == 0) { | 106 | if (top_thread->GetNumKernelWaiters() == 0) { |
| 107 | if (Process* parent = top_thread->GetOwnerProcess(); parent != nullptr) { | 107 | if (KProcess* parent = top_thread->GetOwnerProcess(); parent != nullptr) { |
| 108 | if (KThread* pinned = parent->GetPinnedThread(static_cast<s32>(core_id)); | 108 | if (KThread* pinned = parent->GetPinnedThread(static_cast<s32>(core_id)); |
| 109 | pinned != nullptr && pinned != top_thread) { | 109 | pinned != nullptr && pinned != top_thread) { |
| 110 | // We prefer our parent's pinned thread if possible. However, we also don't | 110 | // We prefer our parent's pinned thread if possible. However, we also don't |
| @@ -411,7 +411,7 @@ void KScheduler::YieldWithoutCoreMigration(KernelCore& kernel) { | |||
| 411 | 411 | ||
| 412 | // Get the current thread and process. | 412 | // Get the current thread and process. |
| 413 | KThread& cur_thread = Kernel::GetCurrentThread(kernel); | 413 | KThread& cur_thread = Kernel::GetCurrentThread(kernel); |
| 414 | Process& cur_process = *kernel.CurrentProcess(); | 414 | KProcess& cur_process = *kernel.CurrentProcess(); |
| 415 | 415 | ||
| 416 | // If the thread's yield count matches, there's nothing for us to do. | 416 | // If the thread's yield count matches, there's nothing for us to do. |
| 417 | if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) { | 417 | if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) { |
| @@ -450,7 +450,7 @@ void KScheduler::YieldWithCoreMigration(KernelCore& kernel) { | |||
| 450 | 450 | ||
| 451 | // Get the current thread and process. | 451 | // Get the current thread and process. |
| 452 | KThread& cur_thread = Kernel::GetCurrentThread(kernel); | 452 | KThread& cur_thread = Kernel::GetCurrentThread(kernel); |
| 453 | Process& cur_process = *kernel.CurrentProcess(); | 453 | KProcess& cur_process = *kernel.CurrentProcess(); |
| 454 | 454 | ||
| 455 | // If the thread's yield count matches, there's nothing for us to do. | 455 | // If the thread's yield count matches, there's nothing for us to do. |
| 456 | if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) { | 456 | if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) { |
| @@ -538,7 +538,7 @@ void KScheduler::YieldToAnyThread(KernelCore& kernel) { | |||
| 538 | 538 | ||
| 539 | // Get the current thread and process. | 539 | // Get the current thread and process. |
| 540 | KThread& cur_thread = Kernel::GetCurrentThread(kernel); | 540 | KThread& cur_thread = Kernel::GetCurrentThread(kernel); |
| 541 | Process& cur_process = *kernel.CurrentProcess(); | 541 | KProcess& cur_process = *kernel.CurrentProcess(); |
| 542 | 542 | ||
| 543 | // If the thread's yield count matches, there's nothing for us to do. | 543 | // If the thread's yield count matches, there's nothing for us to do. |
| 544 | if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) { | 544 | if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) { |
| @@ -724,7 +724,7 @@ void KScheduler::ScheduleImpl() { | |||
| 724 | 724 | ||
| 725 | current_thread.store(next_thread); | 725 | current_thread.store(next_thread); |
| 726 | 726 | ||
| 727 | Process* const previous_process = system.Kernel().CurrentProcess(); | 727 | KProcess* const previous_process = system.Kernel().CurrentProcess(); |
| 728 | 728 | ||
| 729 | UpdateLastContextSwitchTime(previous_thread, previous_process); | 729 | UpdateLastContextSwitchTime(previous_thread, previous_process); |
| 730 | 730 | ||
| @@ -780,7 +780,7 @@ void KScheduler::SwitchToCurrent() { | |||
| 780 | } | 780 | } |
| 781 | } | 781 | } |
| 782 | 782 | ||
| 783 | void KScheduler::UpdateLastContextSwitchTime(KThread* thread, Process* process) { | 783 | void KScheduler::UpdateLastContextSwitchTime(KThread* thread, KProcess* process) { |
| 784 | const u64 prev_switch_ticks = last_context_switch_time; | 784 | const u64 prev_switch_ticks = last_context_switch_time; |
| 785 | const u64 most_recent_switch_ticks = system.CoreTiming().GetCPUTicks(); | 785 | const u64 most_recent_switch_ticks = system.CoreTiming().GetCPUTicks(); |
| 786 | const u64 update_ticks = most_recent_switch_ticks - prev_switch_ticks; | 786 | const u64 update_ticks = most_recent_switch_ticks - prev_switch_ticks; |
diff --git a/src/core/hle/kernel/k_scheduler.h b/src/core/hle/kernel/k_scheduler.h index 01387b892..282c1863b 100644 --- a/src/core/hle/kernel/k_scheduler.h +++ b/src/core/hle/kernel/k_scheduler.h | |||
| @@ -24,7 +24,7 @@ class System; | |||
| 24 | namespace Kernel { | 24 | namespace Kernel { |
| 25 | 25 | ||
| 26 | class KernelCore; | 26 | class KernelCore; |
| 27 | class Process; | 27 | class KProcess; |
| 28 | class SchedulerLock; | 28 | class SchedulerLock; |
| 29 | class KThread; | 29 | class KThread; |
| 30 | 30 | ||
| @@ -165,7 +165,7 @@ private: | |||
| 165 | * most recent tick count retrieved. No special arithmetic is | 165 | * most recent tick count retrieved. No special arithmetic is |
| 166 | * applied to it. | 166 | * applied to it. |
| 167 | */ | 167 | */ |
| 168 | void UpdateLastContextSwitchTime(KThread* thread, Process* process); | 168 | void UpdateLastContextSwitchTime(KThread* thread, KProcess* process); |
| 169 | 169 | ||
| 170 | static void OnSwitch(void* this_scheduler); | 170 | static void OnSwitch(void* this_scheduler); |
| 171 | void SwitchToCurrent(); | 171 | void SwitchToCurrent(); |
| @@ -197,7 +197,7 @@ private: | |||
| 197 | 197 | ||
| 198 | class [[nodiscard]] KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> { | 198 | class [[nodiscard]] KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> { |
| 199 | public: | 199 | public: |
| 200 | explicit KScopedSchedulerLock(KernelCore & kernel); | 200 | explicit KScopedSchedulerLock(KernelCore& kernel); |
| 201 | ~KScopedSchedulerLock(); | 201 | ~KScopedSchedulerLock(); |
| 202 | }; | 202 | }; |
| 203 | 203 | ||
diff --git a/src/core/hle/kernel/k_scoped_resource_reservation.h b/src/core/hle/kernel/k_scoped_resource_reservation.h index b160587c5..07272075d 100644 --- a/src/core/hle/kernel/k_scoped_resource_reservation.h +++ b/src/core/hle/kernel/k_scoped_resource_reservation.h | |||
| @@ -8,8 +8,8 @@ | |||
| 8 | #pragma once | 8 | #pragma once |
| 9 | 9 | ||
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "core/hle/kernel/k_process.h" | ||
| 11 | #include "core/hle/kernel/k_resource_limit.h" | 12 | #include "core/hle/kernel/k_resource_limit.h" |
| 12 | #include "core/hle/kernel/process.h" | ||
| 13 | 13 | ||
| 14 | namespace Kernel { | 14 | namespace Kernel { |
| 15 | 15 | ||
| @@ -33,10 +33,10 @@ public: | |||
| 33 | } | 33 | } |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | explicit KScopedResourceReservation(const Process* p, LimitableResource r, s64 v, s64 t) | 36 | explicit KScopedResourceReservation(const KProcess* p, LimitableResource r, s64 v, s64 t) |
| 37 | : KScopedResourceReservation(p->GetResourceLimit(), r, v, t) {} | 37 | : KScopedResourceReservation(p->GetResourceLimit(), r, v, t) {} |
| 38 | 38 | ||
| 39 | explicit KScopedResourceReservation(const Process* p, LimitableResource r, s64 v = 1) | 39 | explicit KScopedResourceReservation(const KProcess* p, LimitableResource r, s64 v = 1) |
| 40 | : KScopedResourceReservation(p->GetResourceLimit(), r, v) {} | 40 | : KScopedResourceReservation(p->GetResourceLimit(), r, v) {} |
| 41 | 41 | ||
| 42 | ~KScopedResourceReservation() noexcept { | 42 | ~KScopedResourceReservation() noexcept { |
diff --git a/src/core/hle/kernel/k_server_session.cpp b/src/core/hle/kernel/k_server_session.cpp index 863f9aa5f..3bc259693 100644 --- a/src/core/hle/kernel/k_server_session.cpp +++ b/src/core/hle/kernel/k_server_session.cpp | |||
| @@ -13,12 +13,12 @@ | |||
| 13 | #include "core/hle/kernel/handle_table.h" | 13 | #include "core/hle/kernel/handle_table.h" |
| 14 | #include "core/hle/kernel/hle_ipc.h" | 14 | #include "core/hle/kernel/hle_ipc.h" |
| 15 | #include "core/hle/kernel/k_client_port.h" | 15 | #include "core/hle/kernel/k_client_port.h" |
| 16 | #include "core/hle/kernel/k_process.h" | ||
| 16 | #include "core/hle/kernel/k_scheduler.h" | 17 | #include "core/hle/kernel/k_scheduler.h" |
| 17 | #include "core/hle/kernel/k_server_session.h" | 18 | #include "core/hle/kernel/k_server_session.h" |
| 18 | #include "core/hle/kernel/k_session.h" | 19 | #include "core/hle/kernel/k_session.h" |
| 19 | #include "core/hle/kernel/k_thread.h" | 20 | #include "core/hle/kernel/k_thread.h" |
| 20 | #include "core/hle/kernel/kernel.h" | 21 | #include "core/hle/kernel/kernel.h" |
| 21 | #include "core/hle/kernel/process.h" | ||
| 22 | #include "core/memory.h" | 22 | #include "core/memory.h" |
| 23 | 23 | ||
| 24 | namespace Kernel { | 24 | namespace Kernel { |
diff --git a/src/core/hle/kernel/k_session.cpp b/src/core/hle/kernel/k_session.cpp index 6f5947ce7..5e629d446 100644 --- a/src/core/hle/kernel/k_session.cpp +++ b/src/core/hle/kernel/k_session.cpp | |||
| @@ -71,7 +71,7 @@ void KSession::OnClientClosed() { | |||
| 71 | 71 | ||
| 72 | void KSession::PostDestroy(uintptr_t arg) { | 72 | void KSession::PostDestroy(uintptr_t arg) { |
| 73 | // Release the session count resource the owner process holds. | 73 | // Release the session count resource the owner process holds. |
| 74 | Process* owner = reinterpret_cast<Process*>(arg); | 74 | KProcess* owner = reinterpret_cast<KProcess*>(arg); |
| 75 | owner->GetResourceLimit()->Release(LimitableResource::Sessions, 1); | 75 | owner->GetResourceLimit()->Release(LimitableResource::Sessions, 1); |
| 76 | owner->Close(); | 76 | owner->Close(); |
| 77 | } | 77 | } |
diff --git a/src/core/hle/kernel/k_session.h b/src/core/hle/kernel/k_session.h index f29195fa0..d50e21f3f 100644 --- a/src/core/hle/kernel/k_session.h +++ b/src/core/hle/kernel/k_session.h | |||
| @@ -89,7 +89,7 @@ private: | |||
| 89 | std::atomic<std::underlying_type<State>::type> atomic_state{ | 89 | std::atomic<std::underlying_type<State>::type> atomic_state{ |
| 90 | static_cast<std::underlying_type<State>::type>(State::Invalid)}; | 90 | static_cast<std::underlying_type<State>::type>(State::Invalid)}; |
| 91 | KClientPort* port{}; | 91 | KClientPort* port{}; |
| 92 | Process* process{}; | 92 | KProcess* process{}; |
| 93 | bool initialized{}; | 93 | bool initialized{}; |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
diff --git a/src/core/hle/kernel/k_shared_memory.cpp b/src/core/hle/kernel/k_shared_memory.cpp index e91bc94bd..f137a182a 100644 --- a/src/core/hle/kernel/k_shared_memory.cpp +++ b/src/core/hle/kernel/k_shared_memory.cpp | |||
| @@ -19,7 +19,7 @@ KSharedMemory::~KSharedMemory() { | |||
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | ResultCode KSharedMemory::Initialize(KernelCore& kernel_, Core::DeviceMemory& device_memory_, | 21 | ResultCode KSharedMemory::Initialize(KernelCore& kernel_, Core::DeviceMemory& device_memory_, |
| 22 | Process* owner_process_, KPageLinkedList&& page_list_, | 22 | KProcess* owner_process_, KPageLinkedList&& page_list_, |
| 23 | KMemoryPermission owner_permission_, | 23 | KMemoryPermission owner_permission_, |
| 24 | KMemoryPermission user_permission_, PAddr physical_address_, | 24 | KMemoryPermission user_permission_, PAddr physical_address_, |
| 25 | std::size_t size_, std::string name_) { | 25 | std::size_t size_, std::string name_) { |
| @@ -74,7 +74,7 @@ void KSharedMemory::Finalize() { | |||
| 74 | KAutoObjectWithSlabHeapAndContainer<KSharedMemory, KAutoObjectWithList>::Finalize(); | 74 | KAutoObjectWithSlabHeapAndContainer<KSharedMemory, KAutoObjectWithList>::Finalize(); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | ResultCode KSharedMemory::Map(Process& target_process, VAddr address, std::size_t size, | 77 | ResultCode KSharedMemory::Map(KProcess& target_process, VAddr address, std::size_t size, |
| 78 | KMemoryPermission permissions) { | 78 | KMemoryPermission permissions) { |
| 79 | const u64 page_count{(size + PageSize - 1) / PageSize}; | 79 | const u64 page_count{(size + PageSize - 1) / PageSize}; |
| 80 | 80 | ||
diff --git a/src/core/hle/kernel/k_shared_memory.h b/src/core/hle/kernel/k_shared_memory.h index 9547546a5..2d315c916 100644 --- a/src/core/hle/kernel/k_shared_memory.h +++ b/src/core/hle/kernel/k_shared_memory.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "core/device_memory.h" | 11 | #include "core/device_memory.h" |
| 12 | #include "core/hle/kernel/k_memory_block.h" | 12 | #include "core/hle/kernel/k_memory_block.h" |
| 13 | #include "core/hle/kernel/k_page_linked_list.h" | 13 | #include "core/hle/kernel/k_page_linked_list.h" |
| 14 | #include "core/hle/kernel/process.h" | 14 | #include "core/hle/kernel/k_process.h" |
| 15 | #include "core/hle/kernel/slab_helpers.h" | 15 | #include "core/hle/kernel/slab_helpers.h" |
| 16 | #include "core/hle/result.h" | 16 | #include "core/hle/result.h" |
| 17 | 17 | ||
| @@ -28,7 +28,7 @@ public: | |||
| 28 | ~KSharedMemory() override; | 28 | ~KSharedMemory() override; |
| 29 | 29 | ||
| 30 | ResultCode Initialize(KernelCore& kernel_, Core::DeviceMemory& device_memory_, | 30 | ResultCode Initialize(KernelCore& kernel_, Core::DeviceMemory& device_memory_, |
| 31 | Process* owner_process_, KPageLinkedList&& page_list_, | 31 | KProcess* owner_process_, KPageLinkedList&& page_list_, |
| 32 | KMemoryPermission owner_permission_, KMemoryPermission user_permission_, | 32 | KMemoryPermission owner_permission_, KMemoryPermission user_permission_, |
| 33 | PAddr physical_address_, std::size_t size_, std::string name_); | 33 | PAddr physical_address_, std::size_t size_, std::string name_); |
| 34 | 34 | ||
| @@ -39,7 +39,7 @@ public: | |||
| 39 | * @param size Size of the shared memory block to map | 39 | * @param size Size of the shared memory block to map |
| 40 | * @param permissions Memory block map permissions (specified by SVC field) | 40 | * @param permissions Memory block map permissions (specified by SVC field) |
| 41 | */ | 41 | */ |
| 42 | ResultCode Map(Process& target_process, VAddr address, std::size_t size, | 42 | ResultCode Map(KProcess& target_process, VAddr address, std::size_t size, |
| 43 | KMemoryPermission permissions); | 43 | KMemoryPermission permissions); |
| 44 | 44 | ||
| 45 | /** | 45 | /** |
| @@ -69,7 +69,7 @@ public: | |||
| 69 | 69 | ||
| 70 | private: | 70 | private: |
| 71 | Core::DeviceMemory* device_memory; | 71 | Core::DeviceMemory* device_memory; |
| 72 | Process* owner_process{}; | 72 | KProcess* owner_process{}; |
| 73 | KPageLinkedList page_list; | 73 | KPageLinkedList page_list; |
| 74 | KMemoryPermission owner_permission{}; | 74 | KMemoryPermission owner_permission{}; |
| 75 | KMemoryPermission user_permission{}; | 75 | KMemoryPermission user_permission{}; |
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp index c59f3113c..3de0157ac 100644 --- a/src/core/hle/kernel/k_thread.cpp +++ b/src/core/hle/kernel/k_thread.cpp | |||
| @@ -21,13 +21,13 @@ | |||
| 21 | #include "core/hle/kernel/handle_table.h" | 21 | #include "core/hle/kernel/handle_table.h" |
| 22 | #include "core/hle/kernel/k_condition_variable.h" | 22 | #include "core/hle/kernel/k_condition_variable.h" |
| 23 | #include "core/hle/kernel/k_memory_layout.h" | 23 | #include "core/hle/kernel/k_memory_layout.h" |
| 24 | #include "core/hle/kernel/k_process.h" | ||
| 24 | #include "core/hle/kernel/k_resource_limit.h" | 25 | #include "core/hle/kernel/k_resource_limit.h" |
| 25 | #include "core/hle/kernel/k_scheduler.h" | 26 | #include "core/hle/kernel/k_scheduler.h" |
| 26 | #include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" | 27 | #include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h" |
| 27 | #include "core/hle/kernel/k_thread.h" | 28 | #include "core/hle/kernel/k_thread.h" |
| 28 | #include "core/hle/kernel/k_thread_queue.h" | 29 | #include "core/hle/kernel/k_thread_queue.h" |
| 29 | #include "core/hle/kernel/kernel.h" | 30 | #include "core/hle/kernel/kernel.h" |
| 30 | #include "core/hle/kernel/process.h" | ||
| 31 | #include "core/hle/kernel/svc_results.h" | 31 | #include "core/hle/kernel/svc_results.h" |
| 32 | #include "core/hle/kernel/time_manager.h" | 32 | #include "core/hle/kernel/time_manager.h" |
| 33 | #include "core/hle/result.h" | 33 | #include "core/hle/result.h" |
| @@ -65,7 +65,7 @@ KThread::KThread(KernelCore& kernel) | |||
| 65 | KThread::~KThread() = default; | 65 | KThread::~KThread() = default; |
| 66 | 66 | ||
| 67 | ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top, s32 prio, | 67 | ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top, s32 prio, |
| 68 | s32 virt_core, Process* owner, ThreadType type) { | 68 | s32 virt_core, KProcess* owner, ThreadType type) { |
| 69 | // Assert parameters are valid. | 69 | // Assert parameters are valid. |
| 70 | ASSERT((type == ThreadType::Main) || | 70 | ASSERT((type == ThreadType::Main) || |
| 71 | (Svc::HighestThreadPriority <= prio && prio <= Svc::LowestThreadPriority)); | 71 | (Svc::HighestThreadPriority <= prio && prio <= Svc::LowestThreadPriority)); |
| @@ -209,7 +209,7 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s | |||
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uintptr_t arg, | 211 | ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uintptr_t arg, |
| 212 | VAddr user_stack_top, s32 prio, s32 core, Process* owner, | 212 | VAddr user_stack_top, s32 prio, s32 core, KProcess* owner, |
| 213 | ThreadType type, std::function<void(void*)>&& init_func, | 213 | ThreadType type, std::function<void(void*)>&& init_func, |
| 214 | void* init_func_parameter) { | 214 | void* init_func_parameter) { |
| 215 | // Initialize the thread. | 215 | // Initialize the thread. |
| @@ -242,7 +242,7 @@ ResultCode KThread::InitializeHighPriorityThread(Core::System& system, KThread* | |||
| 242 | 242 | ||
| 243 | ResultCode KThread::InitializeUserThread(Core::System& system, KThread* thread, | 243 | ResultCode KThread::InitializeUserThread(Core::System& system, KThread* thread, |
| 244 | KThreadFunction func, uintptr_t arg, VAddr user_stack_top, | 244 | KThreadFunction func, uintptr_t arg, VAddr user_stack_top, |
| 245 | s32 prio, s32 virt_core, Process* owner) { | 245 | s32 prio, s32 virt_core, KProcess* owner) { |
| 246 | system.Kernel().GlobalSchedulerContext().AddThread(thread); | 246 | system.Kernel().GlobalSchedulerContext().AddThread(thread); |
| 247 | return InitializeThread(thread, func, arg, user_stack_top, prio, virt_core, owner, | 247 | return InitializeThread(thread, func, arg, user_stack_top, prio, virt_core, owner, |
| 248 | ThreadType::User, Core::CpuManager::GetGuestThreadStartFunc(), | 248 | ThreadType::User, Core::CpuManager::GetGuestThreadStartFunc(), |
| @@ -250,7 +250,7 @@ ResultCode KThread::InitializeUserThread(Core::System& system, KThread* thread, | |||
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | void KThread::PostDestroy(uintptr_t arg) { | 252 | void KThread::PostDestroy(uintptr_t arg) { |
| 253 | Process* owner = reinterpret_cast<Process*>(arg & ~1ULL); | 253 | KProcess* owner = reinterpret_cast<KProcess*>(arg & ~1ULL); |
| 254 | const bool resource_limit_release_hint = (arg & 1); | 254 | const bool resource_limit_release_hint = (arg & 1); |
| 255 | const s64 hint_value = (resource_limit_release_hint ? 0 : 1); | 255 | const s64 hint_value = (resource_limit_release_hint ? 0 : 1); |
| 256 | if (owner != nullptr) { | 256 | if (owner != nullptr) { |
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index 5b943b18b..4145ef56c 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h | |||
| @@ -37,7 +37,7 @@ namespace Kernel { | |||
| 37 | 37 | ||
| 38 | class GlobalSchedulerContext; | 38 | class GlobalSchedulerContext; |
| 39 | class KernelCore; | 39 | class KernelCore; |
| 40 | class Process; | 40 | class KProcess; |
| 41 | class KScheduler; | 41 | class KScheduler; |
| 42 | class KThreadQueue; | 42 | class KThreadQueue; |
| 43 | 43 | ||
| @@ -105,7 +105,7 @@ class KThread final : public KAutoObjectWithSlabHeapAndContainer<KThread, KSynch | |||
| 105 | 105 | ||
| 106 | private: | 106 | private: |
| 107 | friend class KScheduler; | 107 | friend class KScheduler; |
| 108 | friend class Process; | 108 | friend class KProcess; |
| 109 | 109 | ||
| 110 | public: | 110 | public: |
| 111 | static constexpr s32 DefaultThreadPriority = 44; | 111 | static constexpr s32 DefaultThreadPriority = 44; |
| @@ -290,11 +290,11 @@ public: | |||
| 290 | current_core_id = core; | 290 | current_core_id = core; |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | [[nodiscard]] Process* GetOwnerProcess() { | 293 | [[nodiscard]] KProcess* GetOwnerProcess() { |
| 294 | return parent; | 294 | return parent; |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | [[nodiscard]] const Process* GetOwnerProcess() const { | 297 | [[nodiscard]] const KProcess* GetOwnerProcess() const { |
| 298 | return parent; | 298 | return parent; |
| 299 | } | 299 | } |
| 300 | 300 | ||
| @@ -389,7 +389,7 @@ public: | |||
| 389 | [[nodiscard]] static ResultCode InitializeUserThread(Core::System& system, KThread* thread, | 389 | [[nodiscard]] static ResultCode InitializeUserThread(Core::System& system, KThread* thread, |
| 390 | KThreadFunction func, uintptr_t arg, | 390 | KThreadFunction func, uintptr_t arg, |
| 391 | VAddr user_stack_top, s32 prio, | 391 | VAddr user_stack_top, s32 prio, |
| 392 | s32 virt_core, Process* owner); | 392 | s32 virt_core, KProcess* owner); |
| 393 | 393 | ||
| 394 | public: | 394 | public: |
| 395 | struct StackParameters { | 395 | struct StackParameters { |
| @@ -641,11 +641,11 @@ private: | |||
| 641 | void StartTermination(); | 641 | void StartTermination(); |
| 642 | 642 | ||
| 643 | [[nodiscard]] ResultCode Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top, | 643 | [[nodiscard]] ResultCode Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top, |
| 644 | s32 prio, s32 virt_core, Process* owner, ThreadType type); | 644 | s32 prio, s32 virt_core, KProcess* owner, ThreadType type); |
| 645 | 645 | ||
| 646 | [[nodiscard]] static ResultCode InitializeThread(KThread* thread, KThreadFunction func, | 646 | [[nodiscard]] static ResultCode InitializeThread(KThread* thread, KThreadFunction func, |
| 647 | uintptr_t arg, VAddr user_stack_top, s32 prio, | 647 | uintptr_t arg, VAddr user_stack_top, s32 prio, |
| 648 | s32 core, Process* owner, ThreadType type, | 648 | s32 core, KProcess* owner, ThreadType type, |
| 649 | std::function<void(void*)>&& init_func, | 649 | std::function<void(void*)>&& init_func, |
| 650 | void* init_func_parameter); | 650 | void* init_func_parameter); |
| 651 | 651 | ||
| @@ -669,7 +669,7 @@ private: | |||
| 669 | std::atomic<s64> cpu_time{}; | 669 | std::atomic<s64> cpu_time{}; |
| 670 | KSynchronizationObject* synced_object{}; | 670 | KSynchronizationObject* synced_object{}; |
| 671 | VAddr address_key{}; | 671 | VAddr address_key{}; |
| 672 | Process* parent{}; | 672 | KProcess* parent{}; |
| 673 | VAddr kernel_stack_top{}; | 673 | VAddr kernel_stack_top{}; |
| 674 | u32* light_ipc_data{}; | 674 | u32* light_ipc_data{}; |
| 675 | VAddr tls_address{}; | 675 | VAddr tls_address{}; |
diff --git a/src/core/hle/kernel/k_transfer_memory.cpp b/src/core/hle/kernel/k_transfer_memory.cpp index 09c067f95..201617d32 100644 --- a/src/core/hle/kernel/k_transfer_memory.cpp +++ b/src/core/hle/kernel/k_transfer_memory.cpp | |||
| @@ -2,10 +2,10 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/kernel/k_process.h" | ||
| 5 | #include "core/hle/kernel/k_resource_limit.h" | 6 | #include "core/hle/kernel/k_resource_limit.h" |
| 6 | #include "core/hle/kernel/k_transfer_memory.h" | 7 | #include "core/hle/kernel/k_transfer_memory.h" |
| 7 | #include "core/hle/kernel/kernel.h" | 8 | #include "core/hle/kernel/kernel.h" |
| 8 | #include "core/hle/kernel/process.h" | ||
| 9 | 9 | ||
| 10 | namespace Kernel { | 10 | namespace Kernel { |
| 11 | 11 | ||
| @@ -37,7 +37,7 @@ void KTransferMemory::Finalize() { | |||
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | void KTransferMemory::PostDestroy(uintptr_t arg) { | 39 | void KTransferMemory::PostDestroy(uintptr_t arg) { |
| 40 | Process* owner = reinterpret_cast<Process*>(arg); | 40 | KProcess* owner = reinterpret_cast<KProcess*>(arg); |
| 41 | owner->GetResourceLimit()->Release(LimitableResource::TransferMemory, 1); | 41 | owner->GetResourceLimit()->Release(LimitableResource::TransferMemory, 1); |
| 42 | owner->Close(); | 42 | owner->Close(); |
| 43 | } | 43 | } |
diff --git a/src/core/hle/kernel/k_transfer_memory.h b/src/core/hle/kernel/k_transfer_memory.h index 1e4fa9323..f56398b9c 100644 --- a/src/core/hle/kernel/k_transfer_memory.h +++ b/src/core/hle/kernel/k_transfer_memory.h | |||
| @@ -19,7 +19,7 @@ class Memory; | |||
| 19 | namespace Kernel { | 19 | namespace Kernel { |
| 20 | 20 | ||
| 21 | class KernelCore; | 21 | class KernelCore; |
| 22 | class Process; | 22 | class KProcess; |
| 23 | 23 | ||
| 24 | class KTransferMemory final | 24 | class KTransferMemory final |
| 25 | : public KAutoObjectWithSlabHeapAndContainer<KTransferMemory, KAutoObjectWithList> { | 25 | : public KAutoObjectWithSlabHeapAndContainer<KTransferMemory, KAutoObjectWithList> { |
| @@ -43,7 +43,7 @@ public: | |||
| 43 | 43 | ||
| 44 | static void PostDestroy(uintptr_t arg); | 44 | static void PostDestroy(uintptr_t arg); |
| 45 | 45 | ||
| 46 | Process* GetOwner() const { | 46 | KProcess* GetOwner() const { |
| 47 | return owner; | 47 | return owner; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| @@ -56,7 +56,7 @@ public: | |||
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | private: | 58 | private: |
| 59 | Process* owner{}; | 59 | KProcess* owner{}; |
| 60 | VAddr address{}; | 60 | VAddr address{}; |
| 61 | Svc::MemoryPermission owner_perm{}; | 61 | Svc::MemoryPermission owner_perm{}; |
| 62 | size_t size{}; | 62 | size_t size{}; |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 409bcfaa0..718525c4c 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include "core/hle/kernel/k_client_port.h" | 31 | #include "core/hle/kernel/k_client_port.h" |
| 32 | #include "core/hle/kernel/k_memory_layout.h" | 32 | #include "core/hle/kernel/k_memory_layout.h" |
| 33 | #include "core/hle/kernel/k_memory_manager.h" | 33 | #include "core/hle/kernel/k_memory_manager.h" |
| 34 | #include "core/hle/kernel/k_process.h" | ||
| 34 | #include "core/hle/kernel/k_resource_limit.h" | 35 | #include "core/hle/kernel/k_resource_limit.h" |
| 35 | #include "core/hle/kernel/k_scheduler.h" | 36 | #include "core/hle/kernel/k_scheduler.h" |
| 36 | #include "core/hle/kernel/k_shared_memory.h" | 37 | #include "core/hle/kernel/k_shared_memory.h" |
| @@ -38,7 +39,6 @@ | |||
| 38 | #include "core/hle/kernel/k_thread.h" | 39 | #include "core/hle/kernel/k_thread.h" |
| 39 | #include "core/hle/kernel/kernel.h" | 40 | #include "core/hle/kernel/kernel.h" |
| 40 | #include "core/hle/kernel/physical_core.h" | 41 | #include "core/hle/kernel/physical_core.h" |
| 41 | #include "core/hle/kernel/process.h" | ||
| 42 | #include "core/hle/kernel/service_thread.h" | 42 | #include "core/hle/kernel/service_thread.h" |
| 43 | #include "core/hle/kernel/svc_results.h" | 43 | #include "core/hle/kernel/svc_results.h" |
| 44 | #include "core/hle/kernel/time_manager.h" | 44 | #include "core/hle/kernel/time_manager.h" |
| @@ -98,8 +98,8 @@ struct KernelCore::Impl { | |||
| 98 | service_threads.clear(); | 98 | service_threads.clear(); |
| 99 | 99 | ||
| 100 | next_object_id = 0; | 100 | next_object_id = 0; |
| 101 | next_kernel_process_id = Process::InitialKIPIDMin; | 101 | next_kernel_process_id = KProcess::InitialKIPIDMin; |
| 102 | next_user_process_id = Process::ProcessIDMin; | 102 | next_user_process_id = KProcess::ProcessIDMin; |
| 103 | next_thread_id = 1; | 103 | next_thread_id = 1; |
| 104 | 104 | ||
| 105 | for (s32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) { | 105 | for (s32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) { |
| @@ -220,7 +220,7 @@ struct KernelCore::Impl { | |||
| 220 | } | 220 | } |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | void MakeCurrentProcess(Process* process) { | 223 | void MakeCurrentProcess(KProcess* process) { |
| 224 | current_process = process; | 224 | current_process = process; |
| 225 | if (process == nullptr) { | 225 | if (process == nullptr) { |
| 226 | return; | 226 | return; |
| @@ -632,13 +632,13 @@ struct KernelCore::Impl { | |||
| 632 | } | 632 | } |
| 633 | 633 | ||
| 634 | std::atomic<u32> next_object_id{0}; | 634 | std::atomic<u32> next_object_id{0}; |
| 635 | std::atomic<u64> next_kernel_process_id{Process::InitialKIPIDMin}; | 635 | std::atomic<u64> next_kernel_process_id{KProcess::InitialKIPIDMin}; |
| 636 | std::atomic<u64> next_user_process_id{Process::ProcessIDMin}; | 636 | std::atomic<u64> next_user_process_id{KProcess::ProcessIDMin}; |
| 637 | std::atomic<u64> next_thread_id{1}; | 637 | std::atomic<u64> next_thread_id{1}; |
| 638 | 638 | ||
| 639 | // Lists all processes that exist in the current session. | 639 | // Lists all processes that exist in the current session. |
| 640 | std::vector<Process*> process_list; | 640 | std::vector<KProcess*> process_list; |
| 641 | Process* current_process{}; | 641 | KProcess* current_process{}; |
| 642 | std::unique_ptr<Kernel::GlobalSchedulerContext> global_scheduler_context; | 642 | std::unique_ptr<Kernel::GlobalSchedulerContext> global_scheduler_context; |
| 643 | Kernel::TimeManager time_manager; | 643 | Kernel::TimeManager time_manager; |
| 644 | 644 | ||
| @@ -725,23 +725,23 @@ KScopedAutoObject<KThread> KernelCore::RetrieveThreadFromGlobalHandleTable(Handl | |||
| 725 | return impl->global_handle_table.GetObject<KThread>(handle); | 725 | return impl->global_handle_table.GetObject<KThread>(handle); |
| 726 | } | 726 | } |
| 727 | 727 | ||
| 728 | void KernelCore::AppendNewProcess(Process* process) { | 728 | void KernelCore::AppendNewProcess(KProcess* process) { |
| 729 | impl->process_list.push_back(process); | 729 | impl->process_list.push_back(process); |
| 730 | } | 730 | } |
| 731 | 731 | ||
| 732 | void KernelCore::MakeCurrentProcess(Process* process) { | 732 | void KernelCore::MakeCurrentProcess(KProcess* process) { |
| 733 | impl->MakeCurrentProcess(process); | 733 | impl->MakeCurrentProcess(process); |
| 734 | } | 734 | } |
| 735 | 735 | ||
| 736 | Process* KernelCore::CurrentProcess() { | 736 | KProcess* KernelCore::CurrentProcess() { |
| 737 | return impl->current_process; | 737 | return impl->current_process; |
| 738 | } | 738 | } |
| 739 | 739 | ||
| 740 | const Process* KernelCore::CurrentProcess() const { | 740 | const KProcess* KernelCore::CurrentProcess() const { |
| 741 | return impl->current_process; | 741 | return impl->current_process; |
| 742 | } | 742 | } |
| 743 | 743 | ||
| 744 | const std::vector<Process*>& KernelCore::GetProcessList() const { | 744 | const std::vector<KProcess*>& KernelCore::GetProcessList() const { |
| 745 | return impl->process_list; | 745 | return impl->process_list; |
| 746 | } | 746 | } |
| 747 | 747 | ||
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index de7f83423..0dd9deaeb 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h | |||
| @@ -37,7 +37,7 @@ class KEvent; | |||
| 37 | class KLinkedListNode; | 37 | class KLinkedListNode; |
| 38 | class KMemoryManager; | 38 | class KMemoryManager; |
| 39 | class KPort; | 39 | class KPort; |
| 40 | class Process; | 40 | class KProcess; |
| 41 | class KResourceLimit; | 41 | class KResourceLimit; |
| 42 | class KScheduler; | 42 | class KScheduler; |
| 43 | class KSession; | 43 | class KSession; |
| @@ -101,19 +101,19 @@ public: | |||
| 101 | KScopedAutoObject<KThread> RetrieveThreadFromGlobalHandleTable(Handle handle) const; | 101 | KScopedAutoObject<KThread> RetrieveThreadFromGlobalHandleTable(Handle handle) const; |
| 102 | 102 | ||
| 103 | /// Adds the given shared pointer to an internal list of active processes. | 103 | /// Adds the given shared pointer to an internal list of active processes. |
| 104 | void AppendNewProcess(Process* process); | 104 | void AppendNewProcess(KProcess* process); |
| 105 | 105 | ||
| 106 | /// Makes the given process the new current process. | 106 | /// Makes the given process the new current process. |
| 107 | void MakeCurrentProcess(Process* process); | 107 | void MakeCurrentProcess(KProcess* process); |
| 108 | 108 | ||
| 109 | /// Retrieves a pointer to the current process. | 109 | /// Retrieves a pointer to the current process. |
| 110 | Process* CurrentProcess(); | 110 | KProcess* CurrentProcess(); |
| 111 | 111 | ||
| 112 | /// Retrieves a const pointer to the current process. | 112 | /// Retrieves a const pointer to the current process. |
| 113 | const Process* CurrentProcess() const; | 113 | const KProcess* CurrentProcess() const; |
| 114 | 114 | ||
| 115 | /// Retrieves the list of processes. | 115 | /// Retrieves the list of processes. |
| 116 | const std::vector<Process*>& GetProcessList() const; | 116 | const std::vector<KProcess*>& GetProcessList() const; |
| 117 | 117 | ||
| 118 | /// Gets the sole instance of the global scheduler | 118 | /// Gets the sole instance of the global scheduler |
| 119 | Kernel::GlobalSchedulerContext& GlobalSchedulerContext(); | 119 | Kernel::GlobalSchedulerContext& GlobalSchedulerContext(); |
| @@ -274,7 +274,7 @@ public: | |||
| 274 | return slab_heap_container->linked_list_node; | 274 | return slab_heap_container->linked_list_node; |
| 275 | } else if constexpr (std::is_same_v<T, KPort>) { | 275 | } else if constexpr (std::is_same_v<T, KPort>) { |
| 276 | return slab_heap_container->port; | 276 | return slab_heap_container->port; |
| 277 | } else if constexpr (std::is_same_v<T, Process>) { | 277 | } else if constexpr (std::is_same_v<T, KProcess>) { |
| 278 | return slab_heap_container->process; | 278 | return slab_heap_container->process; |
| 279 | } else if constexpr (std::is_same_v<T, KResourceLimit>) { | 279 | } else if constexpr (std::is_same_v<T, KResourceLimit>) { |
| 280 | return slab_heap_container->resource_limit; | 280 | return slab_heap_container->resource_limit; |
| @@ -292,7 +292,7 @@ public: | |||
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | private: | 294 | private: |
| 295 | friend class Process; | 295 | friend class KProcess; |
| 296 | friend class KThread; | 296 | friend class KThread; |
| 297 | 297 | ||
| 298 | /// Creates a new object ID, incrementing the internal object ID counter. | 298 | /// Creates a new object ID, incrementing the internal object ID counter. |
| @@ -325,7 +325,7 @@ private: | |||
| 325 | KSlabHeap<KEvent> event; | 325 | KSlabHeap<KEvent> event; |
| 326 | KSlabHeap<KLinkedListNode> linked_list_node; | 326 | KSlabHeap<KLinkedListNode> linked_list_node; |
| 327 | KSlabHeap<KPort> port; | 327 | KSlabHeap<KPort> port; |
| 328 | KSlabHeap<Process> process; | 328 | KSlabHeap<KProcess> process; |
| 329 | KSlabHeap<KResourceLimit> resource_limit; | 329 | KSlabHeap<KResourceLimit> resource_limit; |
| 330 | KSlabHeap<KSession> session; | 330 | KSlabHeap<KSession> session; |
| 331 | KSlabHeap<KSharedMemory> shared_memory; | 331 | KSlabHeap<KSharedMemory> shared_memory; |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index ef8fa98a9..725f16ea4 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include "core/hle/kernel/k_memory_block.h" | 30 | #include "core/hle/kernel/k_memory_block.h" |
| 31 | #include "core/hle/kernel/k_memory_layout.h" | 31 | #include "core/hle/kernel/k_memory_layout.h" |
| 32 | #include "core/hle/kernel/k_page_table.h" | 32 | #include "core/hle/kernel/k_page_table.h" |
| 33 | #include "core/hle/kernel/k_process.h" | ||
| 33 | #include "core/hle/kernel/k_readable_event.h" | 34 | #include "core/hle/kernel/k_readable_event.h" |
| 34 | #include "core/hle/kernel/k_resource_limit.h" | 35 | #include "core/hle/kernel/k_resource_limit.h" |
| 35 | #include "core/hle/kernel/k_scheduler.h" | 36 | #include "core/hle/kernel/k_scheduler.h" |
| @@ -42,7 +43,6 @@ | |||
| 42 | #include "core/hle/kernel/k_writable_event.h" | 43 | #include "core/hle/kernel/k_writable_event.h" |
| 43 | #include "core/hle/kernel/kernel.h" | 44 | #include "core/hle/kernel/kernel.h" |
| 44 | #include "core/hle/kernel/physical_core.h" | 45 | #include "core/hle/kernel/physical_core.h" |
| 45 | #include "core/hle/kernel/process.h" | ||
| 46 | #include "core/hle/kernel/svc.h" | 46 | #include "core/hle/kernel/svc.h" |
| 47 | #include "core/hle/kernel/svc_results.h" | 47 | #include "core/hle/kernel/svc_results.h" |
| 48 | #include "core/hle/kernel/svc_types.h" | 48 | #include "core/hle/kernel/svc_types.h" |
| @@ -402,8 +402,8 @@ static ResultCode GetProcessId(Core::System& system, u64* out_process_id, Handle | |||
| 402 | R_UNLESS(obj.IsNotNull(), ResultInvalidHandle); | 402 | R_UNLESS(obj.IsNotNull(), ResultInvalidHandle); |
| 403 | 403 | ||
| 404 | // Get the process from the object. | 404 | // Get the process from the object. |
| 405 | Process* process = nullptr; | 405 | KProcess* process = nullptr; |
| 406 | if (Process* p = obj->DynamicCast<Process*>(); p != nullptr) { | 406 | if (KProcess* p = obj->DynamicCast<KProcess*>(); p != nullptr) { |
| 407 | // The object is a process, so we can use it directly. | 407 | // The object is a process, so we can use it directly. |
| 408 | process = p; | 408 | process = p; |
| 409 | } else if (KThread* t = obj->DynamicCast<KThread*>(); t != nullptr) { | 409 | } else if (KThread* t = obj->DynamicCast<KThread*>(); t != nullptr) { |
| @@ -733,7 +733,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle | |||
| 733 | } | 733 | } |
| 734 | 734 | ||
| 735 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); | 735 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); |
| 736 | KScopedAutoObject process = handle_table.GetObject<Process>(handle); | 736 | KScopedAutoObject process = handle_table.GetObject<KProcess>(handle); |
| 737 | if (process.IsNull()) { | 737 | if (process.IsNull()) { |
| 738 | LOG_ERROR(Kernel_SVC, "Process is not valid! info_id={}, info_sub_id={}, handle={:08X}", | 738 | LOG_ERROR(Kernel_SVC, "Process is not valid! info_id={}, info_sub_id={}, handle={:08X}", |
| 739 | info_id, info_sub_id, handle); | 739 | info_id, info_sub_id, handle); |
| @@ -838,7 +838,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle | |||
| 838 | return ResultInvalidCombination; | 838 | return ResultInvalidCombination; |
| 839 | } | 839 | } |
| 840 | 840 | ||
| 841 | Process* const current_process = system.Kernel().CurrentProcess(); | 841 | KProcess* const current_process = system.Kernel().CurrentProcess(); |
| 842 | HandleTable& handle_table = current_process->GetHandleTable(); | 842 | HandleTable& handle_table = current_process->GetHandleTable(); |
| 843 | const auto resource_limit = current_process->GetResourceLimit(); | 843 | const auto resource_limit = current_process->GetResourceLimit(); |
| 844 | if (!resource_limit) { | 844 | if (!resource_limit) { |
| @@ -861,9 +861,9 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle | |||
| 861 | return ResultInvalidHandle; | 861 | return ResultInvalidHandle; |
| 862 | } | 862 | } |
| 863 | 863 | ||
| 864 | if (info_sub_id >= Process::RANDOM_ENTROPY_SIZE) { | 864 | if (info_sub_id >= KProcess::RANDOM_ENTROPY_SIZE) { |
| 865 | LOG_ERROR(Kernel_SVC, "Entropy size is out of range, expected {} but got {}", | 865 | LOG_ERROR(Kernel_SVC, "Entropy size is out of range, expected {} but got {}", |
| 866 | Process::RANDOM_ENTROPY_SIZE, info_sub_id); | 866 | KProcess::RANDOM_ENTROPY_SIZE, info_sub_id); |
| 867 | return ResultInvalidCombination; | 867 | return ResultInvalidCombination; |
| 868 | } | 868 | } |
| 869 | 869 | ||
| @@ -955,7 +955,7 @@ static ResultCode MapPhysicalMemory(Core::System& system, VAddr addr, u64 size) | |||
| 955 | return ResultInvalidMemoryRegion; | 955 | return ResultInvalidMemoryRegion; |
| 956 | } | 956 | } |
| 957 | 957 | ||
| 958 | Process* const current_process{system.Kernel().CurrentProcess()}; | 958 | KProcess* const current_process{system.Kernel().CurrentProcess()}; |
| 959 | auto& page_table{current_process->PageTable()}; | 959 | auto& page_table{current_process->PageTable()}; |
| 960 | 960 | ||
| 961 | if (current_process->GetSystemResourceSize() == 0) { | 961 | if (current_process->GetSystemResourceSize() == 0) { |
| @@ -1009,7 +1009,7 @@ static ResultCode UnmapPhysicalMemory(Core::System& system, VAddr addr, u64 size | |||
| 1009 | return ResultInvalidMemoryRegion; | 1009 | return ResultInvalidMemoryRegion; |
| 1010 | } | 1010 | } |
| 1011 | 1011 | ||
| 1012 | Process* const current_process{system.Kernel().CurrentProcess()}; | 1012 | KProcess* const current_process{system.Kernel().CurrentProcess()}; |
| 1013 | auto& page_table{current_process->PageTable()}; | 1013 | auto& page_table{current_process->PageTable()}; |
| 1014 | 1014 | ||
| 1015 | if (current_process->GetSystemResourceSize() == 0) { | 1015 | if (current_process->GetSystemResourceSize() == 0) { |
| @@ -1153,7 +1153,7 @@ static ResultCode GetThreadPriority32(Core::System& system, u32* out_priority, H | |||
| 1153 | /// Sets the priority for the specified thread | 1153 | /// Sets the priority for the specified thread |
| 1154 | static ResultCode SetThreadPriority(Core::System& system, Handle thread_handle, u32 priority) { | 1154 | static ResultCode SetThreadPriority(Core::System& system, Handle thread_handle, u32 priority) { |
| 1155 | // Get the current process. | 1155 | // Get the current process. |
| 1156 | Process& process = *system.Kernel().CurrentProcess(); | 1156 | KProcess& process = *system.Kernel().CurrentProcess(); |
| 1157 | 1157 | ||
| 1158 | // Validate the priority. | 1158 | // Validate the priority. |
| 1159 | R_UNLESS(HighestThreadPriority <= priority && priority <= LowestThreadPriority, | 1159 | R_UNLESS(HighestThreadPriority <= priority && priority <= LowestThreadPriority, |
| @@ -1264,7 +1264,7 @@ static ResultCode QueryProcessMemory(Core::System& system, VAddr memory_info_add | |||
| 1264 | std::lock_guard lock{HLE::g_hle_lock}; | 1264 | std::lock_guard lock{HLE::g_hle_lock}; |
| 1265 | LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address); | 1265 | LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address); |
| 1266 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); | 1266 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); |
| 1267 | KScopedAutoObject process = handle_table.GetObject<Process>(process_handle); | 1267 | KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle); |
| 1268 | if (process.IsNull()) { | 1268 | if (process.IsNull()) { |
| 1269 | LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}", | 1269 | LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}", |
| 1270 | process_handle); | 1270 | process_handle); |
| @@ -1346,7 +1346,7 @@ static ResultCode MapProcessCodeMemory(Core::System& system, Handle process_hand | |||
| 1346 | } | 1346 | } |
| 1347 | 1347 | ||
| 1348 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); | 1348 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); |
| 1349 | KScopedAutoObject process = handle_table.GetObject<Process>(process_handle); | 1349 | KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle); |
| 1350 | if (process.IsNull()) { | 1350 | if (process.IsNull()) { |
| 1351 | LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).", | 1351 | LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).", |
| 1352 | process_handle); | 1352 | process_handle); |
| @@ -1414,7 +1414,7 @@ static ResultCode UnmapProcessCodeMemory(Core::System& system, Handle process_ha | |||
| 1414 | } | 1414 | } |
| 1415 | 1415 | ||
| 1416 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); | 1416 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); |
| 1417 | KScopedAutoObject process = handle_table.GetObject<Process>(process_handle); | 1417 | KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle); |
| 1418 | if (process.IsNull()) { | 1418 | if (process.IsNull()) { |
| 1419 | LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).", | 1419 | LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).", |
| 1420 | process_handle); | 1420 | process_handle); |
| @@ -1830,7 +1830,7 @@ static ResultCode ResetSignal(Core::System& system, Handle handle) { | |||
| 1830 | 1830 | ||
| 1831 | // Try to reset as process. | 1831 | // Try to reset as process. |
| 1832 | { | 1832 | { |
| 1833 | KScopedAutoObject process = handle_table.GetObject<Process>(handle); | 1833 | KScopedAutoObject process = handle_table.GetObject<KProcess>(handle); |
| 1834 | if (process.IsNotNull()) { | 1834 | if (process.IsNotNull()) { |
| 1835 | return process->Reset(); | 1835 | return process->Reset(); |
| 1836 | } | 1836 | } |
| @@ -2077,7 +2077,7 @@ static ResultCode GetProcessInfo(Core::System& system, u64* out, Handle process_ | |||
| 2077 | }; | 2077 | }; |
| 2078 | 2078 | ||
| 2079 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); | 2079 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); |
| 2080 | KScopedAutoObject process = handle_table.GetObject<Process>(process_handle); | 2080 | KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle); |
| 2081 | if (process.IsNull()) { | 2081 | if (process.IsNull()) { |
| 2082 | LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}", | 2082 | LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}", |
| 2083 | process_handle); | 2083 | process_handle); |
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 5450dcf0f..49c09a570 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -16,8 +16,8 @@ | |||
| 16 | #include "core/file_sys/control_metadata.h" | 16 | #include "core/file_sys/control_metadata.h" |
| 17 | #include "core/file_sys/patch_manager.h" | 17 | #include "core/file_sys/patch_manager.h" |
| 18 | #include "core/hle/ipc_helpers.h" | 18 | #include "core/hle/ipc_helpers.h" |
| 19 | #include "core/hle/kernel/k_process.h" | ||
| 19 | #include "core/hle/kernel/kernel.h" | 20 | #include "core/hle/kernel/kernel.h" |
| 20 | #include "core/hle/kernel/process.h" | ||
| 21 | #include "core/hle/service/acc/acc.h" | 21 | #include "core/hle/service/acc/acc.h" |
| 22 | #include "core/hle/service/acc/acc_aa.h" | 22 | #include "core/hle/service/acc/acc_aa.h" |
| 23 | #include "core/hle/service/acc/acc_su.h" | 23 | #include "core/hle/service/acc/acc_su.h" |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 47d194119..e8b82db00 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -15,11 +15,11 @@ | |||
| 15 | #include "core/file_sys/savedata_factory.h" | 15 | #include "core/file_sys/savedata_factory.h" |
| 16 | #include "core/hle/ipc_helpers.h" | 16 | #include "core/hle/ipc_helpers.h" |
| 17 | #include "core/hle/kernel/k_event.h" | 17 | #include "core/hle/kernel/k_event.h" |
| 18 | #include "core/hle/kernel/k_process.h" | ||
| 18 | #include "core/hle/kernel/k_readable_event.h" | 19 | #include "core/hle/kernel/k_readable_event.h" |
| 19 | #include "core/hle/kernel/k_transfer_memory.h" | 20 | #include "core/hle/kernel/k_transfer_memory.h" |
| 20 | #include "core/hle/kernel/k_writable_event.h" | 21 | #include "core/hle/kernel/k_writable_event.h" |
| 21 | #include "core/hle/kernel/kernel.h" | 22 | #include "core/hle/kernel/kernel.h" |
| 22 | #include "core/hle/kernel/process.h" | ||
| 23 | #include "core/hle/service/acc/profile_manager.h" | 23 | #include "core/hle/service/acc/profile_manager.h" |
| 24 | #include "core/hle/service/am/am.h" | 24 | #include "core/hle/service/am/am.h" |
| 25 | #include "core/hle/service/am/applet_ae.h" | 25 | #include "core/hle/service/am/applet_ae.h" |
diff --git a/src/core/hle/service/am/applets/error.cpp b/src/core/hle/service/am/applets/error.cpp index 0dd6ec68e..08348b180 100644 --- a/src/core/hle/service/am/applets/error.cpp +++ b/src/core/hle/service/am/applets/error.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "common/string_util.h" | 9 | #include "common/string_util.h" |
| 10 | #include "core/core.h" | 10 | #include "core/core.h" |
| 11 | #include "core/frontend/applets/error.h" | 11 | #include "core/frontend/applets/error.h" |
| 12 | #include "core/hle/kernel/process.h" | 12 | #include "core/hle/kernel/k_process.h" |
| 13 | #include "core/hle/service/am/am.h" | 13 | #include "core/hle/service/am/am.h" |
| 14 | #include "core/hle/service/am/applets/error.h" | 14 | #include "core/hle/service/am/applets/error.h" |
| 15 | #include "core/reporter.h" | 15 | #include "core/reporter.h" |
diff --git a/src/core/hle/service/am/applets/general_backend.cpp b/src/core/hle/service/am/applets/general_backend.cpp index b7483261e..e95499edd 100644 --- a/src/core/hle/service/am/applets/general_backend.cpp +++ b/src/core/hle/service/am/applets/general_backend.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 10 | #include "core/core.h" | 10 | #include "core/core.h" |
| 11 | #include "core/frontend/applets/general_frontend.h" | 11 | #include "core/frontend/applets/general_frontend.h" |
| 12 | #include "core/hle/kernel/process.h" | 12 | #include "core/hle/kernel/k_process.h" |
| 13 | #include "core/hle/result.h" | 13 | #include "core/hle/result.h" |
| 14 | #include "core/hle/service/am/am.h" | 14 | #include "core/hle/service/am/am.h" |
| 15 | #include "core/hle/service/am/applets/general_backend.h" | 15 | #include "core/hle/service/am/applets/general_backend.h" |
diff --git a/src/core/hle/service/am/applets/web_browser.cpp b/src/core/hle/service/am/applets/web_browser.cpp index 2404921fd..e5f4a4485 100644 --- a/src/core/hle/service/am/applets/web_browser.cpp +++ b/src/core/hle/service/am/applets/web_browser.cpp | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | #include "core/file_sys/system_archive/system_archive.h" | 17 | #include "core/file_sys/system_archive/system_archive.h" |
| 18 | #include "core/file_sys/vfs_vector.h" | 18 | #include "core/file_sys/vfs_vector.h" |
| 19 | #include "core/frontend/applets/web_browser.h" | 19 | #include "core/frontend/applets/web_browser.h" |
| 20 | #include "core/hle/kernel/process.h" | 20 | #include "core/hle/kernel/k_process.h" |
| 21 | #include "core/hle/result.h" | 21 | #include "core/hle/result.h" |
| 22 | #include "core/hle/service/am/am.h" | 22 | #include "core/hle/service/am/am.h" |
| 23 | #include "core/hle/service/am/applets/web_browser.h" | 23 | #include "core/hle/service/am/applets/web_browser.h" |
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index 7d7a8c0ad..1863260f1 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp | |||
| @@ -16,9 +16,9 @@ | |||
| 16 | #include "core/file_sys/patch_manager.h" | 16 | #include "core/file_sys/patch_manager.h" |
| 17 | #include "core/file_sys/registered_cache.h" | 17 | #include "core/file_sys/registered_cache.h" |
| 18 | #include "core/hle/ipc_helpers.h" | 18 | #include "core/hle/ipc_helpers.h" |
| 19 | #include "core/hle/kernel/k_process.h" | ||
| 19 | #include "core/hle/kernel/k_readable_event.h" | 20 | #include "core/hle/kernel/k_readable_event.h" |
| 20 | #include "core/hle/kernel/kernel.h" | 21 | #include "core/hle/kernel/kernel.h" |
| 21 | #include "core/hle/kernel/process.h" | ||
| 22 | #include "core/hle/service/aoc/aoc_u.h" | 22 | #include "core/hle/service/aoc/aoc_u.h" |
| 23 | #include "core/loader/loader.h" | 23 | #include "core/loader/loader.h" |
| 24 | 24 | ||
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp index 05635a2a5..0206cbb6a 100644 --- a/src/core/hle/service/bcat/module.cpp +++ b/src/core/hle/service/bcat/module.cpp | |||
| @@ -12,9 +12,9 @@ | |||
| 12 | #include "core/core.h" | 12 | #include "core/core.h" |
| 13 | #include "core/file_sys/vfs.h" | 13 | #include "core/file_sys/vfs.h" |
| 14 | #include "core/hle/ipc_helpers.h" | 14 | #include "core/hle/ipc_helpers.h" |
| 15 | #include "core/hle/kernel/k_process.h" | ||
| 15 | #include "core/hle/kernel/k_readable_event.h" | 16 | #include "core/hle/kernel/k_readable_event.h" |
| 16 | #include "core/hle/kernel/k_writable_event.h" | 17 | #include "core/hle/kernel/k_writable_event.h" |
| 17 | #include "core/hle/kernel/process.h" | ||
| 18 | #include "core/hle/service/bcat/backend/backend.h" | 18 | #include "core/hle/service/bcat/backend/backend.h" |
| 19 | #include "core/hle/service/bcat/bcat.h" | 19 | #include "core/hle/service/bcat/bcat.h" |
| 20 | #include "core/hle/service/bcat/module.h" | 20 | #include "core/hle/service/bcat/module.h" |
diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp index 13147472e..432abde76 100644 --- a/src/core/hle/service/fatal/fatal.cpp +++ b/src/core/hle/service/fatal/fatal.cpp | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include "common/swap.h" | 12 | #include "common/swap.h" |
| 13 | #include "core/core.h" | 13 | #include "core/core.h" |
| 14 | #include "core/hle/ipc_helpers.h" | 14 | #include "core/hle/ipc_helpers.h" |
| 15 | #include "core/hle/kernel/process.h" | 15 | #include "core/hle/kernel/k_process.h" |
| 16 | #include "core/hle/service/fatal/fatal.h" | 16 | #include "core/hle/service/fatal/fatal.h" |
| 17 | #include "core/hle/service/fatal/fatal_p.h" | 17 | #include "core/hle/service/fatal/fatal_p.h" |
| 18 | #include "core/hle/service/fatal/fatal_u.h" | 18 | #include "core/hle/service/fatal/fatal_u.h" |
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 67b2b3102..67baaee9b 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #include "core/file_sys/sdmc_factory.h" | 21 | #include "core/file_sys/sdmc_factory.h" |
| 22 | #include "core/file_sys/vfs.h" | 22 | #include "core/file_sys/vfs.h" |
| 23 | #include "core/file_sys/vfs_offset.h" | 23 | #include "core/file_sys/vfs_offset.h" |
| 24 | #include "core/hle/kernel/process.h" | 24 | #include "core/hle/kernel/k_process.h" |
| 25 | #include "core/hle/service/filesystem/filesystem.h" | 25 | #include "core/hle/service/filesystem/filesystem.h" |
| 26 | #include "core/hle/service/filesystem/fsp_ldr.h" | 26 | #include "core/hle/service/filesystem/fsp_ldr.h" |
| 27 | #include "core/hle/service/filesystem/fsp_pr.h" | 27 | #include "core/hle/service/filesystem/fsp_pr.h" |
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 7dc487e48..92ea27074 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include "core/file_sys/system_archive/system_archive.h" | 25 | #include "core/file_sys/system_archive/system_archive.h" |
| 26 | #include "core/file_sys/vfs.h" | 26 | #include "core/file_sys/vfs.h" |
| 27 | #include "core/hle/ipc_helpers.h" | 27 | #include "core/hle/ipc_helpers.h" |
| 28 | #include "core/hle/kernel/process.h" | 28 | #include "core/hle/kernel/k_process.h" |
| 29 | #include "core/hle/service/filesystem/filesystem.h" | 29 | #include "core/hle/service/filesystem/filesystem.h" |
| 30 | #include "core/hle/service/filesystem/fsp_srv.h" | 30 | #include "core/hle/service/filesystem/fsp_srv.h" |
| 31 | #include "core/reporter.h" | 31 | #include "core/reporter.h" |
diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp index 7b1c6677c..6ad62ee5a 100644 --- a/src/core/hle/service/glue/arp.cpp +++ b/src/core/hle/service/glue/arp.cpp | |||
| @@ -9,8 +9,8 @@ | |||
| 9 | #include "core/file_sys/control_metadata.h" | 9 | #include "core/file_sys/control_metadata.h" |
| 10 | #include "core/hle/ipc_helpers.h" | 10 | #include "core/hle/ipc_helpers.h" |
| 11 | #include "core/hle/kernel/hle_ipc.h" | 11 | #include "core/hle/kernel/hle_ipc.h" |
| 12 | #include "core/hle/kernel/k_process.h" | ||
| 12 | #include "core/hle/kernel/kernel.h" | 13 | #include "core/hle/kernel/kernel.h" |
| 13 | #include "core/hle/kernel/process.h" | ||
| 14 | #include "core/hle/service/glue/arp.h" | 14 | #include "core/hle/service/glue/arp.h" |
| 15 | #include "core/hle/service/glue/errors.h" | 15 | #include "core/hle/service/glue/errors.h" |
| 16 | #include "core/hle/service/glue/manager.h" | 16 | #include "core/hle/service/glue/manager.h" |
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp index c8bc60ad1..563916f29 100644 --- a/src/core/hle/service/ldr/ldr.cpp +++ b/src/core/hle/service/ldr/ldr.cpp | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | #include "core/core.h" | 12 | #include "core/core.h" |
| 13 | #include "core/hle/ipc_helpers.h" | 13 | #include "core/hle/ipc_helpers.h" |
| 14 | #include "core/hle/kernel/k_page_table.h" | 14 | #include "core/hle/kernel/k_page_table.h" |
| 15 | #include "core/hle/kernel/k_process.h" | ||
| 15 | #include "core/hle/kernel/k_system_control.h" | 16 | #include "core/hle/kernel/k_system_control.h" |
| 16 | #include "core/hle/kernel/process.h" | ||
| 17 | #include "core/hle/kernel/svc_results.h" | 17 | #include "core/hle/kernel/svc_results.h" |
| 18 | #include "core/hle/service/ldr/ldr.h" | 18 | #include "core/hle/service/ldr/ldr.h" |
| 19 | #include "core/hle/service/service.h" | 19 | #include "core/hle/service/service.h" |
| @@ -321,7 +321,7 @@ public: | |||
| 321 | return addr; | 321 | return addr; |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | ResultVal<VAddr> MapProcessCodeMemory(Kernel::Process* process, VAddr baseAddress, | 324 | ResultVal<VAddr> MapProcessCodeMemory(Kernel::KProcess* process, VAddr baseAddress, |
| 325 | u64 size) const { | 325 | u64 size) const { |
| 326 | for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) { | 326 | for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) { |
| 327 | auto& page_table{process->PageTable()}; | 327 | auto& page_table{process->PageTable()}; |
| @@ -342,7 +342,7 @@ public: | |||
| 342 | return ERROR_INSUFFICIENT_ADDRESS_SPACE; | 342 | return ERROR_INSUFFICIENT_ADDRESS_SPACE; |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | ResultVal<VAddr> MapNro(Kernel::Process* process, VAddr nro_addr, std::size_t nro_size, | 345 | ResultVal<VAddr> MapNro(Kernel::KProcess* process, VAddr nro_addr, std::size_t nro_size, |
| 346 | VAddr bss_addr, std::size_t bss_size, std::size_t size) const { | 346 | VAddr bss_addr, std::size_t bss_size, std::size_t size) const { |
| 347 | for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) { | 347 | for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) { |
| 348 | auto& page_table{process->PageTable()}; | 348 | auto& page_table{process->PageTable()}; |
| @@ -378,7 +378,7 @@ public: | |||
| 378 | return ERROR_INSUFFICIENT_ADDRESS_SPACE; | 378 | return ERROR_INSUFFICIENT_ADDRESS_SPACE; |
| 379 | } | 379 | } |
| 380 | 380 | ||
| 381 | ResultCode LoadNro(Kernel::Process* process, const NROHeader& nro_header, VAddr nro_addr, | 381 | ResultCode LoadNro(Kernel::KProcess* process, const NROHeader& nro_header, VAddr nro_addr, |
| 382 | VAddr start) const { | 382 | VAddr start) const { |
| 383 | const VAddr text_start{start + nro_header.segment_headers[TEXT_INDEX].memory_offset}; | 383 | const VAddr text_start{start + nro_header.segment_headers[TEXT_INDEX].memory_offset}; |
| 384 | const VAddr ro_start{start + nro_header.segment_headers[RO_INDEX].memory_offset}; | 384 | const VAddr ro_start{start + nro_header.segment_headers[RO_INDEX].memory_offset}; |
diff --git a/src/core/hle/service/pctl/module.cpp b/src/core/hle/service/pctl/module.cpp index 9bebe6088..1c3d81143 100644 --- a/src/core/hle/service/pctl/module.cpp +++ b/src/core/hle/service/pctl/module.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include "core/file_sys/control_metadata.h" | 7 | #include "core/file_sys/control_metadata.h" |
| 8 | #include "core/file_sys/patch_manager.h" | 8 | #include "core/file_sys/patch_manager.h" |
| 9 | #include "core/hle/ipc_helpers.h" | 9 | #include "core/hle/ipc_helpers.h" |
| 10 | #include "core/hle/kernel/process.h" | 10 | #include "core/hle/kernel/k_process.h" |
| 11 | #include "core/hle/service/pctl/module.h" | 11 | #include "core/hle/service/pctl/module.h" |
| 12 | #include "core/hle/service/pctl/pctl.h" | 12 | #include "core/hle/service/pctl/pctl.h" |
| 13 | 13 | ||
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp index 3a00849e1..f4715935d 100644 --- a/src/core/hle/service/pm/pm.cpp +++ b/src/core/hle/service/pm/pm.cpp | |||
| @@ -4,8 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #include "core/core.h" | 5 | #include "core/core.h" |
| 6 | #include "core/hle/ipc_helpers.h" | 6 | #include "core/hle/ipc_helpers.h" |
| 7 | #include "core/hle/kernel/k_process.h" | ||
| 7 | #include "core/hle/kernel/kernel.h" | 8 | #include "core/hle/kernel/kernel.h" |
| 8 | #include "core/hle/kernel/process.h" | ||
| 9 | #include "core/hle/service/pm/pm.h" | 9 | #include "core/hle/service/pm/pm.h" |
| 10 | #include "core/hle/service/service.h" | 10 | #include "core/hle/service/service.h" |
| 11 | 11 | ||
| @@ -17,8 +17,9 @@ constexpr ResultCode ERROR_PROCESS_NOT_FOUND{ErrorModule::PM, 1}; | |||
| 17 | 17 | ||
| 18 | constexpr u64 NO_PROCESS_FOUND_PID{0}; | 18 | constexpr u64 NO_PROCESS_FOUND_PID{0}; |
| 19 | 19 | ||
| 20 | std::optional<Kernel::Process*> SearchProcessList(const std::vector<Kernel::Process*>& process_list, | 20 | std::optional<Kernel::KProcess*> SearchProcessList( |
| 21 | std::function<bool(Kernel::Process*)> predicate) { | 21 | const std::vector<Kernel::KProcess*>& process_list, |
| 22 | std::function<bool(Kernel::KProcess*)> predicate) { | ||
| 22 | const auto iter = std::find_if(process_list.begin(), process_list.end(), predicate); | 23 | const auto iter = std::find_if(process_list.begin(), process_list.end(), predicate); |
| 23 | 24 | ||
| 24 | if (iter == process_list.end()) { | 25 | if (iter == process_list.end()) { |
| @@ -29,9 +30,9 @@ std::optional<Kernel::Process*> SearchProcessList(const std::vector<Kernel::Proc | |||
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx, | 32 | void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx, |
| 32 | const std::vector<Kernel::Process*>& process_list) { | 33 | const std::vector<Kernel::KProcess*>& process_list) { |
| 33 | const auto process = SearchProcessList(process_list, [](const auto& process) { | 34 | const auto process = SearchProcessList(process_list, [](const auto& process) { |
| 34 | return process->GetProcessID() == Kernel::Process::ProcessIDMin; | 35 | return process->GetProcessID() == Kernel::KProcess::ProcessIDMin; |
| 35 | }); | 36 | }); |
| 36 | 37 | ||
| 37 | IPC::ResponseBuilder rb{ctx, 4}; | 38 | IPC::ResponseBuilder rb{ctx, 4}; |
| @@ -124,7 +125,7 @@ private: | |||
| 124 | 125 | ||
| 125 | class Info final : public ServiceFramework<Info> { | 126 | class Info final : public ServiceFramework<Info> { |
| 126 | public: | 127 | public: |
| 127 | explicit Info(Core::System& system_, const std::vector<Kernel::Process*>& process_list_) | 128 | explicit Info(Core::System& system_, const std::vector<Kernel::KProcess*>& process_list_) |
| 128 | : ServiceFramework{system_, "pm:info"}, process_list{process_list_} { | 129 | : ServiceFramework{system_, "pm:info"}, process_list{process_list_} { |
| 129 | static const FunctionInfo functions[] = { | 130 | static const FunctionInfo functions[] = { |
| 130 | {0, &Info::GetTitleId, "GetTitleId"}, | 131 | {0, &Info::GetTitleId, "GetTitleId"}, |
| @@ -154,7 +155,7 @@ private: | |||
| 154 | rb.Push((*process)->GetTitleID()); | 155 | rb.Push((*process)->GetTitleID()); |
| 155 | } | 156 | } |
| 156 | 157 | ||
| 157 | const std::vector<Kernel::Process*>& process_list; | 158 | const std::vector<Kernel::KProcess*>& process_list; |
| 158 | }; | 159 | }; |
| 159 | 160 | ||
| 160 | class Shell final : public ServiceFramework<Shell> { | 161 | class Shell final : public ServiceFramework<Shell> { |
diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp index 449e8d63b..c914f8145 100644 --- a/src/core/hle/service/prepo/prepo.cpp +++ b/src/core/hle/service/prepo/prepo.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "common/logging/log.h" | 6 | #include "common/logging/log.h" |
| 7 | #include "core/core.h" | 7 | #include "core/core.h" |
| 8 | #include "core/hle/ipc_helpers.h" | 8 | #include "core/hle/ipc_helpers.h" |
| 9 | #include "core/hle/kernel/process.h" | 9 | #include "core/hle/kernel/k_process.h" |
| 10 | #include "core/hle/service/acc/profile_manager.h" | 10 | #include "core/hle/service/acc/profile_manager.h" |
| 11 | #include "core/hle/service/prepo/prepo.h" | 11 | #include "core/hle/service/prepo/prepo.h" |
| 12 | #include "core/hle/service/service.h" | 12 | #include "core/hle/service/service.h" |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 42e464024..00e683c2f 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -12,10 +12,10 @@ | |||
| 12 | #include "core/hle/ipc.h" | 12 | #include "core/hle/ipc.h" |
| 13 | #include "core/hle/ipc_helpers.h" | 13 | #include "core/hle/ipc_helpers.h" |
| 14 | #include "core/hle/kernel/k_client_port.h" | 14 | #include "core/hle/kernel/k_client_port.h" |
| 15 | #include "core/hle/kernel/k_process.h" | ||
| 15 | #include "core/hle/kernel/k_server_port.h" | 16 | #include "core/hle/kernel/k_server_port.h" |
| 16 | #include "core/hle/kernel/k_thread.h" | 17 | #include "core/hle/kernel/k_thread.h" |
| 17 | #include "core/hle/kernel/kernel.h" | 18 | #include "core/hle/kernel/kernel.h" |
| 18 | #include "core/hle/kernel/process.h" | ||
| 19 | #include "core/hle/service/acc/acc.h" | 19 | #include "core/hle/service/acc/acc.h" |
| 20 | #include "core/hle/service/am/am.h" | 20 | #include "core/hle/service/am/am.h" |
| 21 | #include "core/hle/service/aoc/aoc_u.h" | 21 | #include "core/hle/service/aoc/aoc_u.h" |
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp index fed47ecda..42f023258 100644 --- a/src/core/loader/deconstructed_rom_directory.cpp +++ b/src/core/loader/deconstructed_rom_directory.cpp | |||
| @@ -13,8 +13,8 @@ | |||
| 13 | #include "core/file_sys/patch_manager.h" | 13 | #include "core/file_sys/patch_manager.h" |
| 14 | #include "core/file_sys/romfs_factory.h" | 14 | #include "core/file_sys/romfs_factory.h" |
| 15 | #include "core/hle/kernel/k_page_table.h" | 15 | #include "core/hle/kernel/k_page_table.h" |
| 16 | #include "core/hle/kernel/k_process.h" | ||
| 16 | #include "core/hle/kernel/kernel.h" | 17 | #include "core/hle/kernel/kernel.h" |
| 17 | #include "core/hle/kernel/process.h" | ||
| 18 | #include "core/hle/service/filesystem/filesystem.h" | 18 | #include "core/hle/service/filesystem/filesystem.h" |
| 19 | #include "core/loader/deconstructed_rom_directory.h" | 19 | #include "core/loader/deconstructed_rom_directory.h" |
| 20 | #include "core/loader/nso.h" | 20 | #include "core/loader/nso.h" |
| @@ -88,7 +88,7 @@ FileType AppLoader_DeconstructedRomDirectory::IdentifyType(const FileSys::Virtua | |||
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirectory::Load( | 90 | AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirectory::Load( |
| 91 | Kernel::Process& process, Core::System& system) { | 91 | Kernel::KProcess& process, Core::System& system) { |
| 92 | if (is_loaded) { | 92 | if (is_loaded) { |
| 93 | return {ResultStatus::ErrorAlreadyLoaded, {}}; | 93 | return {ResultStatus::ErrorAlreadyLoaded, {}}; |
| 94 | } | 94 | } |
diff --git a/src/core/loader/deconstructed_rom_directory.h b/src/core/loader/deconstructed_rom_directory.h index 22a4ec5a6..a49a8b001 100644 --- a/src/core/loader/deconstructed_rom_directory.h +++ b/src/core/loader/deconstructed_rom_directory.h | |||
| @@ -44,7 +44,7 @@ public: | |||
| 44 | return IdentifyType(file); | 44 | return IdentifyType(file); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | LoadResult Load(Kernel::Process& process, Core::System& system) override; | 47 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; |
| 48 | 48 | ||
| 49 | ResultStatus ReadRomFS(FileSys::VirtualFile& out_dir) override; | 49 | ResultStatus ReadRomFS(FileSys::VirtualFile& out_dir) override; |
| 50 | ResultStatus ReadIcon(std::vector<u8>& out_buffer) override; | 50 | ResultStatus ReadIcon(std::vector<u8>& out_buffer) override; |
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index 627c18c7e..c062a4259 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| 12 | #include "core/hle/kernel/code_set.h" | 12 | #include "core/hle/kernel/code_set.h" |
| 13 | #include "core/hle/kernel/k_page_table.h" | 13 | #include "core/hle/kernel/k_page_table.h" |
| 14 | #include "core/hle/kernel/process.h" | 14 | #include "core/hle/kernel/k_process.h" |
| 15 | #include "core/loader/elf.h" | 15 | #include "core/loader/elf.h" |
| 16 | #include "core/memory.h" | 16 | #include "core/memory.h" |
| 17 | 17 | ||
| @@ -386,7 +386,7 @@ FileType AppLoader_ELF::IdentifyType(const FileSys::VirtualFile& elf_file) { | |||
| 386 | return FileType::Error; | 386 | return FileType::Error; |
| 387 | } | 387 | } |
| 388 | 388 | ||
| 389 | AppLoader_ELF::LoadResult AppLoader_ELF::Load(Kernel::Process& process, | 389 | AppLoader_ELF::LoadResult AppLoader_ELF::Load(Kernel::KProcess& process, |
| 390 | [[maybe_unused]] Core::System& system) { | 390 | [[maybe_unused]] Core::System& system) { |
| 391 | if (is_loaded) { | 391 | if (is_loaded) { |
| 392 | return {ResultStatus::ErrorAlreadyLoaded, {}}; | 392 | return {ResultStatus::ErrorAlreadyLoaded, {}}; |
diff --git a/src/core/loader/elf.h b/src/core/loader/elf.h index 2b86c0b49..890299a20 100644 --- a/src/core/loader/elf.h +++ b/src/core/loader/elf.h | |||
| @@ -32,7 +32,7 @@ public: | |||
| 32 | return IdentifyType(file); | 32 | return IdentifyType(file); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | LoadResult Load(Kernel::Process& process, Core::System& system) override; | 35 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | } // namespace Loader | 38 | } // namespace Loader |
diff --git a/src/core/loader/kip.cpp b/src/core/loader/kip.cpp index 9b447da2a..3ae9e6e0e 100644 --- a/src/core/loader/kip.cpp +++ b/src/core/loader/kip.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include "core/file_sys/program_metadata.h" | 7 | #include "core/file_sys/program_metadata.h" |
| 8 | #include "core/hle/kernel/code_set.h" | 8 | #include "core/hle/kernel/code_set.h" |
| 9 | #include "core/hle/kernel/k_page_table.h" | 9 | #include "core/hle/kernel/k_page_table.h" |
| 10 | #include "core/hle/kernel/process.h" | 10 | #include "core/hle/kernel/k_process.h" |
| 11 | #include "core/loader/kip.h" | 11 | #include "core/loader/kip.h" |
| 12 | #include "core/memory.h" | 12 | #include "core/memory.h" |
| 13 | 13 | ||
| @@ -42,7 +42,7 @@ FileType AppLoader_KIP::GetFileType() const { | |||
| 42 | : FileType::Error; | 42 | : FileType::Error; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | AppLoader::LoadResult AppLoader_KIP::Load(Kernel::Process& process, | 45 | AppLoader::LoadResult AppLoader_KIP::Load(Kernel::KProcess& process, |
| 46 | [[maybe_unused]] Core::System& system) { | 46 | [[maybe_unused]] Core::System& system) { |
| 47 | if (is_loaded) { | 47 | if (is_loaded) { |
| 48 | return {ResultStatus::ErrorAlreadyLoaded, {}}; | 48 | return {ResultStatus::ErrorAlreadyLoaded, {}}; |
diff --git a/src/core/loader/kip.h b/src/core/loader/kip.h index 2fe636f01..5f914b4a8 100644 --- a/src/core/loader/kip.h +++ b/src/core/loader/kip.h | |||
| @@ -32,7 +32,7 @@ public: | |||
| 32 | 32 | ||
| 33 | FileType GetFileType() const override; | 33 | FileType GetFileType() const override; |
| 34 | 34 | ||
| 35 | LoadResult Load(Kernel::Process& process, Core::System& system) override; | 35 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; |
| 36 | 36 | ||
| 37 | private: | 37 | private: |
| 38 | std::unique_ptr<FileSys::KIP> kip; | 38 | std::unique_ptr<FileSys::KIP> kip; |
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index e4f5fd40c..11b2d0837 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| 12 | #include "common/string_util.h" | 12 | #include "common/string_util.h" |
| 13 | #include "core/core.h" | 13 | #include "core/core.h" |
| 14 | #include "core/hle/kernel/process.h" | 14 | #include "core/hle/kernel/k_process.h" |
| 15 | #include "core/loader/deconstructed_rom_directory.h" | 15 | #include "core/loader/deconstructed_rom_directory.h" |
| 16 | #include "core/loader/elf.h" | 16 | #include "core/loader/elf.h" |
| 17 | #include "core/loader/kip.h" | 17 | #include "core/loader/kip.h" |
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index bf6db1ab1..9eac11dec 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -25,7 +25,7 @@ class NACP; | |||
| 25 | 25 | ||
| 26 | namespace Kernel { | 26 | namespace Kernel { |
| 27 | struct AddressMapping; | 27 | struct AddressMapping; |
| 28 | class Process; | 28 | class KProcess; |
| 29 | } // namespace Kernel | 29 | } // namespace Kernel |
| 30 | 30 | ||
| 31 | namespace Loader { | 31 | namespace Loader { |
| @@ -165,7 +165,7 @@ public: | |||
| 165 | * | 165 | * |
| 166 | * @return The status result of the operation. | 166 | * @return The status result of the operation. |
| 167 | */ | 167 | */ |
| 168 | virtual LoadResult Load(Kernel::Process& process, Core::System& system) = 0; | 168 | virtual LoadResult Load(Kernel::KProcess& process, Core::System& system) = 0; |
| 169 | 169 | ||
| 170 | /** | 170 | /** |
| 171 | * Get the code (typically .code section) of the application | 171 | * Get the code (typically .code section) of the application |
diff --git a/src/core/loader/nax.cpp b/src/core/loader/nax.cpp index f53c3a72c..aceb66414 100644 --- a/src/core/loader/nax.cpp +++ b/src/core/loader/nax.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "core/file_sys/content_archive.h" | 6 | #include "core/file_sys/content_archive.h" |
| 7 | #include "core/file_sys/romfs.h" | 7 | #include "core/file_sys/romfs.h" |
| 8 | #include "core/file_sys/xts_archive.h" | 8 | #include "core/file_sys/xts_archive.h" |
| 9 | #include "core/hle/kernel/process.h" | 9 | #include "core/hle/kernel/k_process.h" |
| 10 | #include "core/loader/nax.h" | 10 | #include "core/loader/nax.h" |
| 11 | #include "core/loader/nca.h" | 11 | #include "core/loader/nca.h" |
| 12 | 12 | ||
| @@ -41,7 +41,7 @@ FileType AppLoader_NAX::GetFileType() const { | |||
| 41 | return IdentifyTypeImpl(*nax); | 41 | return IdentifyTypeImpl(*nax); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | AppLoader_NAX::LoadResult AppLoader_NAX::Load(Kernel::Process& process, Core::System& system) { | 44 | AppLoader_NAX::LoadResult AppLoader_NAX::Load(Kernel::KProcess& process, Core::System& system) { |
| 45 | if (is_loaded) { | 45 | if (is_loaded) { |
| 46 | return {ResultStatus::ErrorAlreadyLoaded, {}}; | 46 | return {ResultStatus::ErrorAlreadyLoaded, {}}; |
| 47 | } | 47 | } |
diff --git a/src/core/loader/nax.h b/src/core/loader/nax.h index 68427c1cf..b3a50894f 100644 --- a/src/core/loader/nax.h +++ b/src/core/loader/nax.h | |||
| @@ -37,7 +37,7 @@ public: | |||
| 37 | 37 | ||
| 38 | FileType GetFileType() const override; | 38 | FileType GetFileType() const override; |
| 39 | 39 | ||
| 40 | LoadResult Load(Kernel::Process& process, Core::System& system) override; | 40 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; |
| 41 | 41 | ||
| 42 | ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override; | 42 | ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override; |
| 43 | u64 ReadRomFSIVFCOffset() const override; | 43 | u64 ReadRomFSIVFCOffset() const override; |
diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp index 47e7a77a9..418cbf61b 100644 --- a/src/core/loader/nca.cpp +++ b/src/core/loader/nca.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "core/core.h" | 9 | #include "core/core.h" |
| 10 | #include "core/file_sys/content_archive.h" | 10 | #include "core/file_sys/content_archive.h" |
| 11 | #include "core/file_sys/romfs_factory.h" | 11 | #include "core/file_sys/romfs_factory.h" |
| 12 | #include "core/hle/kernel/process.h" | 12 | #include "core/hle/kernel/k_process.h" |
| 13 | #include "core/hle/service/filesystem/filesystem.h" | 13 | #include "core/hle/service/filesystem/filesystem.h" |
| 14 | #include "core/loader/deconstructed_rom_directory.h" | 14 | #include "core/loader/deconstructed_rom_directory.h" |
| 15 | #include "core/loader/nca.h" | 15 | #include "core/loader/nca.h" |
| @@ -32,7 +32,7 @@ FileType AppLoader_NCA::IdentifyType(const FileSys::VirtualFile& nca_file) { | |||
| 32 | return FileType::Error; | 32 | return FileType::Error; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | AppLoader_NCA::LoadResult AppLoader_NCA::Load(Kernel::Process& process, Core::System& system) { | 35 | AppLoader_NCA::LoadResult AppLoader_NCA::Load(Kernel::KProcess& process, Core::System& system) { |
| 36 | if (is_loaded) { | 36 | if (is_loaded) { |
| 37 | return {ResultStatus::ErrorAlreadyLoaded, {}}; | 37 | return {ResultStatus::ErrorAlreadyLoaded, {}}; |
| 38 | } | 38 | } |
diff --git a/src/core/loader/nca.h b/src/core/loader/nca.h index c9792f390..f2ff080bb 100644 --- a/src/core/loader/nca.h +++ b/src/core/loader/nca.h | |||
| @@ -39,7 +39,7 @@ public: | |||
| 39 | return IdentifyType(file); | 39 | return IdentifyType(file); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | LoadResult Load(Kernel::Process& process, Core::System& system) override; | 42 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; |
| 43 | 43 | ||
| 44 | ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override; | 44 | ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override; |
| 45 | u64 ReadRomFSIVFCOffset() const override; | 45 | u64 ReadRomFSIVFCOffset() const override; |
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 0597cfa60..ef54fa574 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp | |||
| @@ -17,8 +17,8 @@ | |||
| 17 | #include "core/file_sys/vfs_offset.h" | 17 | #include "core/file_sys/vfs_offset.h" |
| 18 | #include "core/hle/kernel/code_set.h" | 18 | #include "core/hle/kernel/code_set.h" |
| 19 | #include "core/hle/kernel/k_page_table.h" | 19 | #include "core/hle/kernel/k_page_table.h" |
| 20 | #include "core/hle/kernel/k_process.h" | ||
| 20 | #include "core/hle/kernel/k_thread.h" | 21 | #include "core/hle/kernel/k_thread.h" |
| 21 | #include "core/hle/kernel/process.h" | ||
| 22 | #include "core/hle/service/filesystem/filesystem.h" | 22 | #include "core/hle/service/filesystem/filesystem.h" |
| 23 | #include "core/loader/nro.h" | 23 | #include "core/loader/nro.h" |
| 24 | #include "core/loader/nso.h" | 24 | #include "core/loader/nso.h" |
| @@ -130,7 +130,7 @@ static constexpr u32 PageAlignSize(u32 size) { | |||
| 130 | return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK); | 130 | return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data) { | 133 | static bool LoadNroImpl(Kernel::KProcess& process, const std::vector<u8>& data) { |
| 134 | if (data.size() < sizeof(NroHeader)) { | 134 | if (data.size() < sizeof(NroHeader)) { |
| 135 | return {}; | 135 | return {}; |
| 136 | } | 136 | } |
| @@ -199,11 +199,11 @@ static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data) { | |||
| 199 | return true; | 199 | return true; |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | bool AppLoader_NRO::LoadNro(Kernel::Process& process, const FileSys::VfsFile& nro_file) { | 202 | bool AppLoader_NRO::LoadNro(Kernel::KProcess& process, const FileSys::VfsFile& nro_file) { |
| 203 | return LoadNroImpl(process, nro_file.ReadAllBytes()); | 203 | return LoadNroImpl(process, nro_file.ReadAllBytes()); |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::Process& process, Core::System& system) { | 206 | AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::KProcess& process, Core::System& system) { |
| 207 | if (is_loaded) { | 207 | if (is_loaded) { |
| 208 | return {ResultStatus::ErrorAlreadyLoaded, {}}; | 208 | return {ResultStatus::ErrorAlreadyLoaded, {}}; |
| 209 | } | 209 | } |
diff --git a/src/core/loader/nro.h b/src/core/loader/nro.h index 20bbaeb0e..fd453b402 100644 --- a/src/core/loader/nro.h +++ b/src/core/loader/nro.h | |||
| @@ -19,7 +19,7 @@ class NACP; | |||
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | namespace Kernel { | 21 | namespace Kernel { |
| 22 | class Process; | 22 | class KProcess; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | namespace Loader { | 25 | namespace Loader { |
| @@ -43,7 +43,7 @@ public: | |||
| 43 | return IdentifyType(file); | 43 | return IdentifyType(file); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | LoadResult Load(Kernel::Process& process, Core::System& system) override; | 46 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; |
| 47 | 47 | ||
| 48 | ResultStatus ReadIcon(std::vector<u8>& buffer) override; | 48 | ResultStatus ReadIcon(std::vector<u8>& buffer) override; |
| 49 | ResultStatus ReadProgramId(u64& out_program_id) override; | 49 | ResultStatus ReadProgramId(u64& out_program_id) override; |
| @@ -53,7 +53,7 @@ public: | |||
| 53 | bool IsRomFSUpdatable() const override; | 53 | bool IsRomFSUpdatable() const override; |
| 54 | 54 | ||
| 55 | private: | 55 | private: |
| 56 | bool LoadNro(Kernel::Process& process, const FileSys::VfsFile& nro_file); | 56 | bool LoadNro(Kernel::KProcess& process, const FileSys::VfsFile& nro_file); |
| 57 | 57 | ||
| 58 | std::vector<u8> icon_data; | 58 | std::vector<u8> icon_data; |
| 59 | std::unique_ptr<FileSys::NACP> nacp; | 59 | std::unique_ptr<FileSys::NACP> nacp; |
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index f671afe02..df59412cf 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -17,8 +17,8 @@ | |||
| 17 | #include "core/file_sys/patch_manager.h" | 17 | #include "core/file_sys/patch_manager.h" |
| 18 | #include "core/hle/kernel/code_set.h" | 18 | #include "core/hle/kernel/code_set.h" |
| 19 | #include "core/hle/kernel/k_page_table.h" | 19 | #include "core/hle/kernel/k_page_table.h" |
| 20 | #include "core/hle/kernel/k_process.h" | ||
| 20 | #include "core/hle/kernel/k_thread.h" | 21 | #include "core/hle/kernel/k_thread.h" |
| 21 | #include "core/hle/kernel/process.h" | ||
| 22 | #include "core/loader/nso.h" | 22 | #include "core/loader/nso.h" |
| 23 | #include "core/memory.h" | 23 | #include "core/memory.h" |
| 24 | 24 | ||
| @@ -71,7 +71,7 @@ FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& in_file) { | |||
| 71 | return FileType::NSO; | 71 | return FileType::NSO; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, Core::System& system, | 74 | std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::KProcess& process, Core::System& system, |
| 75 | const FileSys::VfsFile& nso_file, VAddr load_base, | 75 | const FileSys::VfsFile& nso_file, VAddr load_base, |
| 76 | bool should_pass_arguments, bool load_into_process, | 76 | bool should_pass_arguments, bool load_into_process, |
| 77 | std::optional<FileSys::PatchManager> pm) { | 77 | std::optional<FileSys::PatchManager> pm) { |
| @@ -162,7 +162,7 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, Core::S | |||
| 162 | return load_base + image_size; | 162 | return load_base + image_size; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | AppLoader_NSO::LoadResult AppLoader_NSO::Load(Kernel::Process& process, Core::System& system) { | 165 | AppLoader_NSO::LoadResult AppLoader_NSO::Load(Kernel::KProcess& process, Core::System& system) { |
| 166 | if (is_loaded) { | 166 | if (is_loaded) { |
| 167 | return {ResultStatus::ErrorAlreadyLoaded, {}}; | 167 | return {ResultStatus::ErrorAlreadyLoaded, {}}; |
| 168 | } | 168 | } |
diff --git a/src/core/loader/nso.h b/src/core/loader/nso.h index 195149b55..f7b61bc2d 100644 --- a/src/core/loader/nso.h +++ b/src/core/loader/nso.h | |||
| @@ -17,7 +17,7 @@ class System; | |||
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | namespace Kernel { | 19 | namespace Kernel { |
| 20 | class Process; | 20 | class KProcess; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | namespace Loader { | 23 | namespace Loader { |
| @@ -86,12 +86,12 @@ public: | |||
| 86 | return IdentifyType(file); | 86 | return IdentifyType(file); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | static std::optional<VAddr> LoadModule(Kernel::Process& process, Core::System& system, | 89 | static std::optional<VAddr> LoadModule(Kernel::KProcess& process, Core::System& system, |
| 90 | const FileSys::VfsFile& nso_file, VAddr load_base, | 90 | const FileSys::VfsFile& nso_file, VAddr load_base, |
| 91 | bool should_pass_arguments, bool load_into_process, | 91 | bool should_pass_arguments, bool load_into_process, |
| 92 | std::optional<FileSys::PatchManager> pm = {}); | 92 | std::optional<FileSys::PatchManager> pm = {}); |
| 93 | 93 | ||
| 94 | LoadResult Load(Kernel::Process& process, Core::System& system) override; | 94 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; |
| 95 | 95 | ||
| 96 | ResultStatus ReadNSOModules(Modules& out_modules) override; | 96 | ResultStatus ReadNSOModules(Modules& out_modules) override; |
| 97 | 97 | ||
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp index d7e590f1c..d815a7cd3 100644 --- a/src/core/loader/nsp.cpp +++ b/src/core/loader/nsp.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include "core/file_sys/patch_manager.h" | 13 | #include "core/file_sys/patch_manager.h" |
| 14 | #include "core/file_sys/registered_cache.h" | 14 | #include "core/file_sys/registered_cache.h" |
| 15 | #include "core/file_sys/submission_package.h" | 15 | #include "core/file_sys/submission_package.h" |
| 16 | #include "core/hle/kernel/process.h" | 16 | #include "core/hle/kernel/k_process.h" |
| 17 | #include "core/hle/service/filesystem/filesystem.h" | 17 | #include "core/hle/service/filesystem/filesystem.h" |
| 18 | #include "core/loader/deconstructed_rom_directory.h" | 18 | #include "core/loader/deconstructed_rom_directory.h" |
| 19 | #include "core/loader/nca.h" | 19 | #include "core/loader/nca.h" |
| @@ -79,7 +79,7 @@ FileType AppLoader_NSP::IdentifyType(const FileSys::VirtualFile& nsp_file) { | |||
| 79 | return FileType::Error; | 79 | return FileType::Error; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::Process& process, Core::System& system) { | 82 | AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::KProcess& process, Core::System& system) { |
| 83 | if (is_loaded) { | 83 | if (is_loaded) { |
| 84 | return {ResultStatus::ErrorAlreadyLoaded, {}}; | 84 | return {ResultStatus::ErrorAlreadyLoaded, {}}; |
| 85 | } | 85 | } |
diff --git a/src/core/loader/nsp.h b/src/core/loader/nsp.h index 1660f1b94..644c0ff58 100644 --- a/src/core/loader/nsp.h +++ b/src/core/loader/nsp.h | |||
| @@ -45,7 +45,7 @@ public: | |||
| 45 | return IdentifyType(file); | 45 | return IdentifyType(file); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | LoadResult Load(Kernel::Process& process, Core::System& system) override; | 48 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; |
| 49 | 49 | ||
| 50 | ResultStatus ReadRomFS(FileSys::VirtualFile& out_file) override; | 50 | ResultStatus ReadRomFS(FileSys::VirtualFile& out_file) override; |
| 51 | u64 ReadRomFSIVFCOffset() const override; | 51 | u64 ReadRomFSIVFCOffset() const override; |
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp index 0125ddf33..635d6ae15 100644 --- a/src/core/loader/xci.cpp +++ b/src/core/loader/xci.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include "core/file_sys/registered_cache.h" | 13 | #include "core/file_sys/registered_cache.h" |
| 14 | #include "core/file_sys/romfs.h" | 14 | #include "core/file_sys/romfs.h" |
| 15 | #include "core/file_sys/submission_package.h" | 15 | #include "core/file_sys/submission_package.h" |
| 16 | #include "core/hle/kernel/process.h" | 16 | #include "core/hle/kernel/k_process.h" |
| 17 | #include "core/hle/service/filesystem/filesystem.h" | 17 | #include "core/hle/service/filesystem/filesystem.h" |
| 18 | #include "core/loader/nca.h" | 18 | #include "core/loader/nca.h" |
| 19 | #include "core/loader/xci.h" | 19 | #include "core/loader/xci.h" |
| @@ -56,7 +56,7 @@ FileType AppLoader_XCI::IdentifyType(const FileSys::VirtualFile& xci_file) { | |||
| 56 | return FileType::Error; | 56 | return FileType::Error; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | AppLoader_XCI::LoadResult AppLoader_XCI::Load(Kernel::Process& process, Core::System& system) { | 59 | AppLoader_XCI::LoadResult AppLoader_XCI::Load(Kernel::KProcess& process, Core::System& system) { |
| 60 | if (is_loaded) { | 60 | if (is_loaded) { |
| 61 | return {ResultStatus::ErrorAlreadyLoaded, {}}; | 61 | return {ResultStatus::ErrorAlreadyLoaded, {}}; |
| 62 | } | 62 | } |
diff --git a/src/core/loader/xci.h b/src/core/loader/xci.h index 7ea8179af..708155c30 100644 --- a/src/core/loader/xci.h +++ b/src/core/loader/xci.h | |||
| @@ -45,7 +45,7 @@ public: | |||
| 45 | return IdentifyType(file); | 45 | return IdentifyType(file); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | LoadResult Load(Kernel::Process& process, Core::System& system) override; | 48 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; |
| 49 | 49 | ||
| 50 | ResultStatus ReadRomFS(FileSys::VirtualFile& out_file) override; | 50 | ResultStatus ReadRomFS(FileSys::VirtualFile& out_file) override; |
| 51 | u64 ReadRomFSIVFCOffset() const override; | 51 | u64 ReadRomFSIVFCOffset() const override; |
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index ee4599063..b4c56e1c1 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -17,8 +17,8 @@ | |||
| 17 | #include "core/core.h" | 17 | #include "core/core.h" |
| 18 | #include "core/device_memory.h" | 18 | #include "core/device_memory.h" |
| 19 | #include "core/hle/kernel/k_page_table.h" | 19 | #include "core/hle/kernel/k_page_table.h" |
| 20 | #include "core/hle/kernel/k_process.h" | ||
| 20 | #include "core/hle/kernel/physical_memory.h" | 21 | #include "core/hle/kernel/physical_memory.h" |
| 21 | #include "core/hle/kernel/process.h" | ||
| 22 | #include "core/memory.h" | 22 | #include "core/memory.h" |
| 23 | #include "video_core/gpu.h" | 23 | #include "video_core/gpu.h" |
| 24 | 24 | ||
| @@ -30,7 +30,7 @@ namespace Core::Memory { | |||
| 30 | struct Memory::Impl { | 30 | struct Memory::Impl { |
| 31 | explicit Impl(Core::System& system_) : system{system_} {} | 31 | explicit Impl(Core::System& system_) : system{system_} {} |
| 32 | 32 | ||
| 33 | void SetCurrentPageTable(Kernel::Process& process, u32 core_id) { | 33 | void SetCurrentPageTable(Kernel::KProcess& process, u32 core_id) { |
| 34 | current_page_table = &process.PageTable().PageTableImpl(); | 34 | current_page_table = &process.PageTable().PageTableImpl(); |
| 35 | 35 | ||
| 36 | const std::size_t address_space_width = process.PageTable().GetAddressSpaceWidth(); | 36 | const std::size_t address_space_width = process.PageTable().GetAddressSpaceWidth(); |
| @@ -50,7 +50,7 @@ struct Memory::Impl { | |||
| 50 | MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, 0, Common::PageType::Unmapped); | 50 | MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, 0, Common::PageType::Unmapped); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | bool IsValidVirtualAddress(const Kernel::Process& process, const VAddr vaddr) const { | 53 | bool IsValidVirtualAddress(const Kernel::KProcess& process, const VAddr vaddr) const { |
| 54 | const auto& page_table = process.PageTable().PageTableImpl(); | 54 | const auto& page_table = process.PageTable().PageTableImpl(); |
| 55 | const auto [pointer, type] = page_table.pointers[vaddr >> PAGE_BITS].PointerType(); | 55 | const auto [pointer, type] = page_table.pointers[vaddr >> PAGE_BITS].PointerType(); |
| 56 | return pointer != nullptr || type == Common::PageType::RasterizerCachedMemory; | 56 | return pointer != nullptr || type == Common::PageType::RasterizerCachedMemory; |
| @@ -194,7 +194,7 @@ struct Memory::Impl { | |||
| 194 | return string; | 194 | return string; |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_buffer, | 197 | void ReadBlock(const Kernel::KProcess& process, const VAddr src_addr, void* dest_buffer, |
| 198 | const std::size_t size) { | 198 | const std::size_t size) { |
| 199 | const auto& page_table = process.PageTable().PageTableImpl(); | 199 | const auto& page_table = process.PageTable().PageTableImpl(); |
| 200 | 200 | ||
| @@ -239,7 +239,7 @@ struct Memory::Impl { | |||
| 239 | } | 239 | } |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | void ReadBlockUnsafe(const Kernel::Process& process, const VAddr src_addr, void* dest_buffer, | 242 | void ReadBlockUnsafe(const Kernel::KProcess& process, const VAddr src_addr, void* dest_buffer, |
| 243 | const std::size_t size) { | 243 | const std::size_t size) { |
| 244 | const auto& page_table = process.PageTable().PageTableImpl(); | 244 | const auto& page_table = process.PageTable().PageTableImpl(); |
| 245 | 245 | ||
| @@ -291,7 +291,7 @@ struct Memory::Impl { | |||
| 291 | ReadBlockUnsafe(*system.CurrentProcess(), src_addr, dest_buffer, size); | 291 | ReadBlockUnsafe(*system.CurrentProcess(), src_addr, dest_buffer, size); |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const void* src_buffer, | 294 | void WriteBlock(const Kernel::KProcess& process, const VAddr dest_addr, const void* src_buffer, |
| 295 | const std::size_t size) { | 295 | const std::size_t size) { |
| 296 | const auto& page_table = process.PageTable().PageTableImpl(); | 296 | const auto& page_table = process.PageTable().PageTableImpl(); |
| 297 | std::size_t remaining_size = size; | 297 | std::size_t remaining_size = size; |
| @@ -334,7 +334,7 @@ struct Memory::Impl { | |||
| 334 | } | 334 | } |
| 335 | } | 335 | } |
| 336 | 336 | ||
| 337 | void WriteBlockUnsafe(const Kernel::Process& process, const VAddr dest_addr, | 337 | void WriteBlockUnsafe(const Kernel::KProcess& process, const VAddr dest_addr, |
| 338 | const void* src_buffer, const std::size_t size) { | 338 | const void* src_buffer, const std::size_t size) { |
| 339 | const auto& page_table = process.PageTable().PageTableImpl(); | 339 | const auto& page_table = process.PageTable().PageTableImpl(); |
| 340 | std::size_t remaining_size = size; | 340 | std::size_t remaining_size = size; |
| @@ -384,7 +384,7 @@ struct Memory::Impl { | |||
| 384 | WriteBlockUnsafe(*system.CurrentProcess(), dest_addr, src_buffer, size); | 384 | WriteBlockUnsafe(*system.CurrentProcess(), dest_addr, src_buffer, size); |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const std::size_t size) { | 387 | void ZeroBlock(const Kernel::KProcess& process, const VAddr dest_addr, const std::size_t size) { |
| 388 | const auto& page_table = process.PageTable().PageTableImpl(); | 388 | const auto& page_table = process.PageTable().PageTableImpl(); |
| 389 | std::size_t remaining_size = size; | 389 | std::size_t remaining_size = size; |
| 390 | std::size_t page_index = dest_addr >> PAGE_BITS; | 390 | std::size_t page_index = dest_addr >> PAGE_BITS; |
| @@ -429,7 +429,7 @@ struct Memory::Impl { | |||
| 429 | ZeroBlock(*system.CurrentProcess(), dest_addr, size); | 429 | ZeroBlock(*system.CurrentProcess(), dest_addr, size); |
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr, | 432 | void CopyBlock(const Kernel::KProcess& process, VAddr dest_addr, VAddr src_addr, |
| 433 | const std::size_t size) { | 433 | const std::size_t size) { |
| 434 | const auto& page_table = process.PageTable().PageTableImpl(); | 434 | const auto& page_table = process.PageTable().PageTableImpl(); |
| 435 | std::size_t remaining_size = size; | 435 | std::size_t remaining_size = size; |
| @@ -741,7 +741,7 @@ void Memory::Reset() { | |||
| 741 | impl = std::make_unique<Impl>(system); | 741 | impl = std::make_unique<Impl>(system); |
| 742 | } | 742 | } |
| 743 | 743 | ||
| 744 | void Memory::SetCurrentPageTable(Kernel::Process& process, u32 core_id) { | 744 | void Memory::SetCurrentPageTable(Kernel::KProcess& process, u32 core_id) { |
| 745 | impl->SetCurrentPageTable(process, core_id); | 745 | impl->SetCurrentPageTable(process, core_id); |
| 746 | } | 746 | } |
| 747 | 747 | ||
| @@ -753,7 +753,7 @@ void Memory::UnmapRegion(Common::PageTable& page_table, VAddr base, u64 size) { | |||
| 753 | impl->UnmapRegion(page_table, base, size); | 753 | impl->UnmapRegion(page_table, base, size); |
| 754 | } | 754 | } |
| 755 | 755 | ||
| 756 | bool Memory::IsValidVirtualAddress(const Kernel::Process& process, const VAddr vaddr) const { | 756 | bool Memory::IsValidVirtualAddress(const Kernel::KProcess& process, const VAddr vaddr) const { |
| 757 | return impl->IsValidVirtualAddress(process, vaddr); | 757 | return impl->IsValidVirtualAddress(process, vaddr); |
| 758 | } | 758 | } |
| 759 | 759 | ||
| @@ -829,7 +829,7 @@ std::string Memory::ReadCString(VAddr vaddr, std::size_t max_length) { | |||
| 829 | return impl->ReadCString(vaddr, max_length); | 829 | return impl->ReadCString(vaddr, max_length); |
| 830 | } | 830 | } |
| 831 | 831 | ||
| 832 | void Memory::ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_buffer, | 832 | void Memory::ReadBlock(const Kernel::KProcess& process, const VAddr src_addr, void* dest_buffer, |
| 833 | const std::size_t size) { | 833 | const std::size_t size) { |
| 834 | impl->ReadBlock(process, src_addr, dest_buffer, size); | 834 | impl->ReadBlock(process, src_addr, dest_buffer, size); |
| 835 | } | 835 | } |
| @@ -838,7 +838,7 @@ void Memory::ReadBlock(const VAddr src_addr, void* dest_buffer, const std::size_ | |||
| 838 | impl->ReadBlock(src_addr, dest_buffer, size); | 838 | impl->ReadBlock(src_addr, dest_buffer, size); |
| 839 | } | 839 | } |
| 840 | 840 | ||
| 841 | void Memory::ReadBlockUnsafe(const Kernel::Process& process, const VAddr src_addr, | 841 | void Memory::ReadBlockUnsafe(const Kernel::KProcess& process, const VAddr src_addr, |
| 842 | void* dest_buffer, const std::size_t size) { | 842 | void* dest_buffer, const std::size_t size) { |
| 843 | impl->ReadBlockUnsafe(process, src_addr, dest_buffer, size); | 843 | impl->ReadBlockUnsafe(process, src_addr, dest_buffer, size); |
| 844 | } | 844 | } |
| @@ -847,7 +847,7 @@ void Memory::ReadBlockUnsafe(const VAddr src_addr, void* dest_buffer, const std: | |||
| 847 | impl->ReadBlockUnsafe(src_addr, dest_buffer, size); | 847 | impl->ReadBlockUnsafe(src_addr, dest_buffer, size); |
| 848 | } | 848 | } |
| 849 | 849 | ||
| 850 | void Memory::WriteBlock(const Kernel::Process& process, VAddr dest_addr, const void* src_buffer, | 850 | void Memory::WriteBlock(const Kernel::KProcess& process, VAddr dest_addr, const void* src_buffer, |
| 851 | std::size_t size) { | 851 | std::size_t size) { |
| 852 | impl->WriteBlock(process, dest_addr, src_buffer, size); | 852 | impl->WriteBlock(process, dest_addr, src_buffer, size); |
| 853 | } | 853 | } |
| @@ -856,7 +856,7 @@ void Memory::WriteBlock(const VAddr dest_addr, const void* src_buffer, const std | |||
| 856 | impl->WriteBlock(dest_addr, src_buffer, size); | 856 | impl->WriteBlock(dest_addr, src_buffer, size); |
| 857 | } | 857 | } |
| 858 | 858 | ||
| 859 | void Memory::WriteBlockUnsafe(const Kernel::Process& process, VAddr dest_addr, | 859 | void Memory::WriteBlockUnsafe(const Kernel::KProcess& process, VAddr dest_addr, |
| 860 | const void* src_buffer, std::size_t size) { | 860 | const void* src_buffer, std::size_t size) { |
| 861 | impl->WriteBlockUnsafe(process, dest_addr, src_buffer, size); | 861 | impl->WriteBlockUnsafe(process, dest_addr, src_buffer, size); |
| 862 | } | 862 | } |
| @@ -866,7 +866,7 @@ void Memory::WriteBlockUnsafe(const VAddr dest_addr, const void* src_buffer, | |||
| 866 | impl->WriteBlockUnsafe(dest_addr, src_buffer, size); | 866 | impl->WriteBlockUnsafe(dest_addr, src_buffer, size); |
| 867 | } | 867 | } |
| 868 | 868 | ||
| 869 | void Memory::ZeroBlock(const Kernel::Process& process, VAddr dest_addr, std::size_t size) { | 869 | void Memory::ZeroBlock(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size) { |
| 870 | impl->ZeroBlock(process, dest_addr, size); | 870 | impl->ZeroBlock(process, dest_addr, size); |
| 871 | } | 871 | } |
| 872 | 872 | ||
| @@ -874,7 +874,7 @@ void Memory::ZeroBlock(VAddr dest_addr, std::size_t size) { | |||
| 874 | impl->ZeroBlock(dest_addr, size); | 874 | impl->ZeroBlock(dest_addr, size); |
| 875 | } | 875 | } |
| 876 | 876 | ||
| 877 | void Memory::CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr, | 877 | void Memory::CopyBlock(const Kernel::KProcess& process, VAddr dest_addr, VAddr src_addr, |
| 878 | const std::size_t size) { | 878 | const std::size_t size) { |
| 879 | impl->CopyBlock(process, dest_addr, src_addr, size); | 879 | impl->CopyBlock(process, dest_addr, src_addr, size); |
| 880 | } | 880 | } |
diff --git a/src/core/memory.h b/src/core/memory.h index 9a706a9ac..345fd870d 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -19,7 +19,7 @@ class System; | |||
| 19 | 19 | ||
| 20 | namespace Kernel { | 20 | namespace Kernel { |
| 21 | class PhysicalMemory; | 21 | class PhysicalMemory; |
| 22 | class Process; | 22 | class KProcess; |
| 23 | } // namespace Kernel | 23 | } // namespace Kernel |
| 24 | 24 | ||
| 25 | namespace Core::Memory { | 25 | namespace Core::Memory { |
| @@ -68,7 +68,7 @@ public: | |||
| 68 | * | 68 | * |
| 69 | * @param process The process to use the page table of. | 69 | * @param process The process to use the page table of. |
| 70 | */ | 70 | */ |
| 71 | void SetCurrentPageTable(Kernel::Process& process, u32 core_id); | 71 | void SetCurrentPageTable(Kernel::KProcess& process, u32 core_id); |
| 72 | 72 | ||
| 73 | /** | 73 | /** |
| 74 | * Maps an allocated buffer onto a region of the emulated process address space. | 74 | * Maps an allocated buffer onto a region of the emulated process address space. |
| @@ -99,7 +99,7 @@ public: | |||
| 99 | * | 99 | * |
| 100 | * @returns True if the given virtual address is valid, false otherwise. | 100 | * @returns True if the given virtual address is valid, false otherwise. |
| 101 | */ | 101 | */ |
| 102 | bool IsValidVirtualAddress(const Kernel::Process& process, VAddr vaddr) const; | 102 | bool IsValidVirtualAddress(const Kernel::KProcess& process, VAddr vaddr) const; |
| 103 | 103 | ||
| 104 | /** | 104 | /** |
| 105 | * Checks whether or not the supplied address is a valid virtual | 105 | * Checks whether or not the supplied address is a valid virtual |
| @@ -333,7 +333,7 @@ public: | |||
| 333 | * @post The range [dest_buffer, size) contains the read bytes from the | 333 | * @post The range [dest_buffer, size) contains the read bytes from the |
| 334 | * process' address space. | 334 | * process' address space. |
| 335 | */ | 335 | */ |
| 336 | void ReadBlock(const Kernel::Process& process, VAddr src_addr, void* dest_buffer, | 336 | void ReadBlock(const Kernel::KProcess& process, VAddr src_addr, void* dest_buffer, |
| 337 | std::size_t size); | 337 | std::size_t size); |
| 338 | 338 | ||
| 339 | /** | 339 | /** |
| @@ -354,7 +354,7 @@ public: | |||
| 354 | * @post The range [dest_buffer, size) contains the read bytes from the | 354 | * @post The range [dest_buffer, size) contains the read bytes from the |
| 355 | * process' address space. | 355 | * process' address space. |
| 356 | */ | 356 | */ |
| 357 | void ReadBlockUnsafe(const Kernel::Process& process, VAddr src_addr, void* dest_buffer, | 357 | void ReadBlockUnsafe(const Kernel::KProcess& process, VAddr src_addr, void* dest_buffer, |
| 358 | std::size_t size); | 358 | std::size_t size); |
| 359 | 359 | ||
| 360 | /** | 360 | /** |
| @@ -414,7 +414,7 @@ public: | |||
| 414 | * and will mark that region as invalidated to caches that the active | 414 | * and will mark that region as invalidated to caches that the active |
| 415 | * graphics backend may be maintaining over the course of execution. | 415 | * graphics backend may be maintaining over the course of execution. |
| 416 | */ | 416 | */ |
| 417 | void WriteBlock(const Kernel::Process& process, VAddr dest_addr, const void* src_buffer, | 417 | void WriteBlock(const Kernel::KProcess& process, VAddr dest_addr, const void* src_buffer, |
| 418 | std::size_t size); | 418 | std::size_t size); |
| 419 | 419 | ||
| 420 | /** | 420 | /** |
| @@ -434,7 +434,7 @@ public: | |||
| 434 | * will be ignored and an error will be logged. | 434 | * will be ignored and an error will be logged. |
| 435 | * | 435 | * |
| 436 | */ | 436 | */ |
| 437 | void WriteBlockUnsafe(const Kernel::Process& process, VAddr dest_addr, const void* src_buffer, | 437 | void WriteBlockUnsafe(const Kernel::KProcess& process, VAddr dest_addr, const void* src_buffer, |
| 438 | std::size_t size); | 438 | std::size_t size); |
| 439 | 439 | ||
| 440 | /** | 440 | /** |
| @@ -486,7 +486,7 @@ public: | |||
| 486 | * @post The range [dest_addr, size) within the process' address space is | 486 | * @post The range [dest_addr, size) within the process' address space is |
| 487 | * filled with zeroes. | 487 | * filled with zeroes. |
| 488 | */ | 488 | */ |
| 489 | void ZeroBlock(const Kernel::Process& process, VAddr dest_addr, std::size_t size); | 489 | void ZeroBlock(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size); |
| 490 | 490 | ||
| 491 | /** | 491 | /** |
| 492 | * Fills the specified address range within the current process' address space with zeroes. | 492 | * Fills the specified address range within the current process' address space with zeroes. |
| @@ -511,7 +511,7 @@ public: | |||
| 511 | * @post The range [dest_addr, size) within the process' address space contains the | 511 | * @post The range [dest_addr, size) within the process' address space contains the |
| 512 | * same data within the range [src_addr, size). | 512 | * same data within the range [src_addr, size). |
| 513 | */ | 513 | */ |
| 514 | void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr, | 514 | void CopyBlock(const Kernel::KProcess& process, VAddr dest_addr, VAddr src_addr, |
| 515 | std::size_t size); | 515 | std::size_t size); |
| 516 | 516 | ||
| 517 | /** | 517 | /** |
diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index 7643b7846..0f5ef7954 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "core/core_timing_util.h" | 11 | #include "core/core_timing_util.h" |
| 12 | #include "core/hardware_properties.h" | 12 | #include "core/hardware_properties.h" |
| 13 | #include "core/hle/kernel/k_page_table.h" | 13 | #include "core/hle/kernel/k_page_table.h" |
| 14 | #include "core/hle/kernel/process.h" | 14 | #include "core/hle/kernel/k_process.h" |
| 15 | #include "core/hle/service/hid/controllers/npad.h" | 15 | #include "core/hle/service/hid/controllers/npad.h" |
| 16 | #include "core/hle/service/hid/hid.h" | 16 | #include "core/hle/service/hid/hid.h" |
| 17 | #include "core/hle/service/sm/sm.h" | 17 | #include "core/hle/service/sm/sm.h" |
diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp index 311d4dda8..896add892 100644 --- a/src/core/reporter.cpp +++ b/src/core/reporter.cpp | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #include "core/core.h" | 19 | #include "core/core.h" |
| 20 | #include "core/hle/kernel/hle_ipc.h" | 20 | #include "core/hle/kernel/hle_ipc.h" |
| 21 | #include "core/hle/kernel/k_page_table.h" | 21 | #include "core/hle/kernel/k_page_table.h" |
| 22 | #include "core/hle/kernel/process.h" | 22 | #include "core/hle/kernel/k_process.h" |
| 23 | #include "core/hle/result.h" | 23 | #include "core/hle/result.h" |
| 24 | #include "core/memory.h" | 24 | #include "core/memory.h" |
| 25 | #include "core/reporter.h" | 25 | #include "core/reporter.h" |