mirror of https://git.suyu.dev/suyu/suyu
hle: kernel: Rename Process to KProcess.
This commit is contained in:
parent
bf380b8584
commit
2a7eff57a8
|
@ -197,6 +197,8 @@ add_library(core STATIC
|
|||
hle/kernel/k_port.cpp
|
||||
hle/kernel/k_port.h
|
||||
hle/kernel/k_priority_queue.h
|
||||
hle/kernel/k_process.cpp
|
||||
hle/kernel/k_process.h
|
||||
hle/kernel/k_readable_event.cpp
|
||||
hle/kernel/k_readable_event.h
|
||||
hle/kernel/k_resource_limit.cpp
|
||||
|
@ -235,8 +237,6 @@ add_library(core STATIC
|
|||
hle/kernel/physical_core.cpp
|
||||
hle/kernel/physical_core.h
|
||||
hle/kernel/physical_memory.h
|
||||
hle/kernel/process.cpp
|
||||
hle/kernel/process.h
|
||||
hle/kernel/process_capability.cpp
|
||||
hle/kernel/process_capability.h
|
||||
hle/kernel/service_thread.cpp
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "core/core.h"
|
||||
#include "core/core_timing.h"
|
||||
#include "core/hardware_properties.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/svc.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
#include "core/file_sys/vfs_real.h"
|
||||
#include "core/hardware_interrupt_manager.h"
|
||||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/physical_core.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/service/am/applets/applets.h"
|
||||
#include "core/hle/service/apm/controller.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
|
@ -233,9 +233,9 @@ struct System::Impl {
|
|||
}
|
||||
|
||||
telemetry_session->AddInitialInfo(*app_loader, fs_controller, *content_provider);
|
||||
auto main_process = Kernel::Process::Create(system.Kernel());
|
||||
ASSERT(Kernel::Process::Initialize(main_process, system, "main",
|
||||
Kernel::Process::ProcessType::Userland)
|
||||
auto main_process = Kernel::KProcess::Create(system.Kernel());
|
||||
ASSERT(Kernel::KProcess::Initialize(main_process, system, "main",
|
||||
Kernel::KProcess::ProcessType::Userland)
|
||||
.IsSuccess());
|
||||
main_process->Open();
|
||||
const auto [load_result, load_parameters] = app_loader->Load(*main_process, system);
|
||||
|
@ -326,7 +326,7 @@ struct System::Impl {
|
|||
return app_loader->ReadTitle(out);
|
||||
}
|
||||
|
||||
void AddGlueRegistrationForProcess(Loader::AppLoader& loader, Kernel::Process& process) {
|
||||
void AddGlueRegistrationForProcess(Loader::AppLoader& loader, Kernel::KProcess& process) {
|
||||
std::vector<u8> nacp_data;
|
||||
FileSys::NACP nacp;
|
||||
if (loader.ReadControlData(nacp) == Loader::ResultStatus::Success) {
|
||||
|
@ -517,7 +517,7 @@ const Kernel::GlobalSchedulerContext& System::GlobalSchedulerContext() const {
|
|||
return impl->kernel.GlobalSchedulerContext();
|
||||
}
|
||||
|
||||
Kernel::Process* System::CurrentProcess() {
|
||||
Kernel::KProcess* System::CurrentProcess() {
|
||||
return impl->kernel.CurrentProcess();
|
||||
}
|
||||
|
||||
|
@ -529,7 +529,7 @@ const Core::DeviceMemory& System::DeviceMemory() const {
|
|||
return *impl->device_memory;
|
||||
}
|
||||
|
||||
const Kernel::Process* System::CurrentProcess() const {
|
||||
const Kernel::KProcess* System::CurrentProcess() const {
|
||||
return impl->kernel.CurrentProcess();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Kernel {
|
|||
class GlobalSchedulerContext;
|
||||
class KernelCore;
|
||||
class PhysicalCore;
|
||||
class Process;
|
||||
class KProcess;
|
||||
class KScheduler;
|
||||
} // namespace Kernel
|
||||
|
||||
|
@ -263,10 +263,10 @@ public:
|
|||
[[nodiscard]] const Core::DeviceMemory& DeviceMemory() const;
|
||||
|
||||
/// Provides a pointer to the current process
|
||||
[[nodiscard]] Kernel::Process* CurrentProcess();
|
||||
[[nodiscard]] Kernel::KProcess* CurrentProcess();
|
||||
|
||||
/// Provides a constant pointer to the current process.
|
||||
[[nodiscard]] const Kernel::Process* CurrentProcess() const;
|
||||
[[nodiscard]] const Kernel::KProcess* CurrentProcess() const;
|
||||
|
||||
/// Provides a reference to the core timing instance.
|
||||
[[nodiscard]] Timing::CoreTiming& CoreTiming();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "core/file_sys/patch_manager.h"
|
||||
#include "core/file_sys/registered_cache.h"
|
||||
#include "core/file_sys/romfs_factory.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/loader/loader.h"
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "core/core.h"
|
||||
#include "core/file_sys/savedata_factory.h"
|
||||
#include "core/file_sys/vfs.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
#include "common/logging/log.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/handle_table.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/handle_table.h"
|
||||
#include "core/hle/kernel/hle_ipc.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_readable_event.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h"
|
||||
|
@ -23,7 +24,6 @@
|
|||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/k_writable_event.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
#include "core/hle/kernel/time_manager.h"
|
||||
#include "core/memory.h"
|
||||
|
|
|
@ -38,7 +38,7 @@ class Domain;
|
|||
class HandleTable;
|
||||
class HLERequestContext;
|
||||
class KernelCore;
|
||||
class Process;
|
||||
class KProcess;
|
||||
class KServerSession;
|
||||
class KThread;
|
||||
class KReadableEvent;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "core/hle/kernel/k_memory_layout.h"
|
||||
#include "core/hle/kernel/k_memory_manager.h"
|
||||
#include "core/hle/kernel/k_port.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_resource_limit.h"
|
||||
#include "core/hle/kernel/k_session.h"
|
||||
#include "core/hle/kernel/k_shared_memory.h"
|
||||
|
@ -20,7 +21,6 @@
|
|||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/k_transfer_memory.h"
|
||||
#include "core/hle/kernel/memory_types.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
namespace Kernel::Init {
|
||||
|
@ -28,7 +28,7 @@ namespace Kernel::Init {
|
|||
#define SLAB_COUNT(CLASS) g_slab_resource_counts.num_##CLASS
|
||||
|
||||
#define FOREACH_SLAB_TYPE(HANDLER, ...) \
|
||||
HANDLER(Process, (SLAB_COUNT(Process)), ##__VA_ARGS__) \
|
||||
HANDLER(KProcess, (SLAB_COUNT(KProcess)), ##__VA_ARGS__) \
|
||||
HANDLER(KThread, (SLAB_COUNT(KThread)), ##__VA_ARGS__) \
|
||||
HANDLER(KEvent, (SLAB_COUNT(KEvent)), ##__VA_ARGS__) \
|
||||
HANDLER(KPort, (SLAB_COUNT(KPort)), ##__VA_ARGS__) \
|
||||
|
@ -48,7 +48,7 @@ enum KSlabType : u32 {
|
|||
#undef DEFINE_SLAB_TYPE_ENUM_MEMBER
|
||||
|
||||
// Constexpr counts.
|
||||
constexpr size_t SlabCountProcess = 80;
|
||||
constexpr size_t SlabCountKProcess = 80;
|
||||
constexpr size_t SlabCountKThread = 800;
|
||||
constexpr size_t SlabCountKEvent = 700;
|
||||
constexpr size_t SlabCountKInterruptEvent = 100;
|
||||
|
@ -69,7 +69,7 @@ constexpr size_t SlabCountExtraKThread = 160;
|
|||
|
||||
// Global to hold our resource counts.
|
||||
KSlabResourceCounts g_slab_resource_counts = {
|
||||
.num_Process = SlabCountProcess,
|
||||
.num_KProcess = SlabCountKProcess,
|
||||
.num_KThread = SlabCountKThread,
|
||||
.num_KEvent = SlabCountKEvent,
|
||||
.num_KInterruptEvent = SlabCountKInterruptEvent,
|
||||
|
|
|
@ -15,7 +15,7 @@ class KMemoryLayout;
|
|||
namespace Kernel::Init {
|
||||
|
||||
struct KSlabResourceCounts {
|
||||
size_t num_Process;
|
||||
size_t num_KProcess;
|
||||
size_t num_KThread;
|
||||
size_t num_KEvent;
|
||||
size_t num_KInterruptEvent;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
namespace Kernel {
|
||||
|
||||
class KernelCore;
|
||||
class Process;
|
||||
class KProcess;
|
||||
|
||||
using Handle = u32;
|
||||
|
||||
|
@ -106,7 +106,7 @@ public:
|
|||
// Finalize is responsible for cleaning up resource, but does not destroy the object.
|
||||
virtual void Finalize() {}
|
||||
|
||||
virtual Process* GetOwner() const {
|
||||
virtual KProcess* GetOwner() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ void KAutoObjectWithListContainer::Unregister(KAutoObjectWithList* obj) {
|
|||
m_object_list.erase(m_object_list.iterator_to(*obj));
|
||||
}
|
||||
|
||||
size_t KAutoObjectWithListContainer::GetOwnedCount(Process* owner) {
|
||||
size_t KAutoObjectWithListContainer::GetOwnedCount(KProcess* owner) {
|
||||
KScopedLightLock lk(m_lock);
|
||||
|
||||
size_t count = 0;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
namespace Kernel {
|
||||
|
||||
class KernelCore;
|
||||
class Process;
|
||||
class KProcess;
|
||||
|
||||
class KAutoObjectWithListContainer {
|
||||
NON_COPYABLE(KAutoObjectWithListContainer);
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
void Register(KAutoObjectWithList* obj);
|
||||
void Unregister(KAutoObjectWithList* obj);
|
||||
size_t GetOwnedCount(Process* owner);
|
||||
size_t GetOwnedCount(KProcess* owner);
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
KServerSession,
|
||||
KClientPort,
|
||||
KClientSession,
|
||||
Process,
|
||||
KProcess,
|
||||
KResourceLimit,
|
||||
KLightSession,
|
||||
KPort,
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
#include "core/core.h"
|
||||
#include "core/hle/kernel/k_condition_variable.h"
|
||||
#include "core/hle/kernel/k_linked_list.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h"
|
||||
#include "core/hle/kernel/k_synchronization_object.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/svc_common.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
#include "core/memory.h"
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include "core/hle/kernel/k_event.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_resource_limit.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
@ -45,7 +45,7 @@ void KEvent::Finalize() {
|
|||
|
||||
void KEvent::PostDestroy(uintptr_t arg) {
|
||||
// Release the event count resource the owner process holds.
|
||||
Process* owner = reinterpret_cast<Process*>(arg);
|
||||
KProcess* owner = reinterpret_cast<KProcess*>(arg);
|
||||
if (owner) {
|
||||
owner->GetResourceLimit()->Release(LimitableResource::Events, 1);
|
||||
owner->Close();
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Kernel {
|
|||
class KernelCore;
|
||||
class KReadableEvent;
|
||||
class KWritableEvent;
|
||||
class Process;
|
||||
class KProcess;
|
||||
|
||||
class KEvent final : public KAutoObjectWithSlabHeapAndContainer<KEvent, KAutoObjectWithList> {
|
||||
KERNEL_AUTOOBJECT_TRAITS(KEvent, KAutoObject);
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
static void PostDestroy(uintptr_t arg);
|
||||
|
||||
virtual Process* GetOwner() const override {
|
||||
virtual KProcess* GetOwner() const override {
|
||||
return owner;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
private:
|
||||
KReadableEvent readable_event;
|
||||
KWritableEvent writable_event;
|
||||
Process* owner{};
|
||||
KProcess* owner{};
|
||||
bool initialized{};
|
||||
};
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
#include "core/hle/kernel/k_memory_block_manager.h"
|
||||
#include "core/hle/kernel/k_page_linked_list.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_resource_limit.h"
|
||||
#include "core/hle/kernel/k_scoped_resource_reservation.h"
|
||||
#include "core/hle/kernel/k_system_control.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
#include "core/hle/kernel/code_set.h"
|
||||
#include "core/hle/kernel/k_memory_block_manager.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_resource_limit.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/k_scoped_resource_reservation.h"
|
||||
#include "core/hle/kernel/k_slab_heap.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
#include "core/hle/lock.h"
|
||||
#include "core/memory.h"
|
||||
|
@ -37,7 +37,7 @@ namespace {
|
|||
* @param owner_process The parent process for the main thread
|
||||
* @param priority The priority to give the main thread
|
||||
*/
|
||||
void SetupMainThread(Core::System& system, Process& owner_process, u32 priority, VAddr stack_top) {
|
||||
void SetupMainThread(Core::System& system, KProcess& owner_process, u32 priority, VAddr stack_top) {
|
||||
const VAddr entry_point = owner_process.PageTable().GetCodeRegionStart();
|
||||
ASSERT(owner_process.GetResourceLimit()->Reserve(LimitableResource::Threads, 1));
|
||||
|
||||
|
@ -117,8 +117,8 @@ private:
|
|||
std::bitset<num_slot_entries> is_slot_used;
|
||||
};
|
||||
|
||||
ResultCode Process::Initialize(Process* process, Core::System& system, std::string name,
|
||||
ProcessType type) {
|
||||
ResultCode KProcess::Initialize(KProcess* process, Core::System& system, std::string name,
|
||||
ProcessType type) {
|
||||
auto& kernel = system.Kernel();
|
||||
|
||||
process->name = std::move(name);
|
||||
|
@ -144,11 +144,11 @@ ResultCode Process::Initialize(Process* process, Core::System& system, std::stri
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
KResourceLimit* Process::GetResourceLimit() const {
|
||||
KResourceLimit* KProcess::GetResourceLimit() const {
|
||||
return resource_limit;
|
||||
}
|
||||
|
||||
void Process::IncrementThreadCount() {
|
||||
void KProcess::IncrementThreadCount() {
|
||||
ASSERT(num_threads >= 0);
|
||||
num_created_threads++;
|
||||
|
||||
|
@ -157,7 +157,7 @@ void Process::IncrementThreadCount() {
|
|||
}
|
||||
}
|
||||
|
||||
void Process::DecrementThreadCount() {
|
||||
void KProcess::DecrementThreadCount() {
|
||||
ASSERT(num_threads > 0);
|
||||
|
||||
if (const auto count = --num_threads; count == 0) {
|
||||
|
@ -165,7 +165,7 @@ void Process::DecrementThreadCount() {
|
|||
}
|
||||
}
|
||||
|
||||
u64 Process::GetTotalPhysicalMemoryAvailable() const {
|
||||
u64 KProcess::GetTotalPhysicalMemoryAvailable() const {
|
||||
const u64 capacity{resource_limit->GetFreeValue(LimitableResource::PhysicalMemory) +
|
||||
page_table->GetTotalHeapSize() + GetSystemResourceSize() + image_size +
|
||||
main_thread_stack_size};
|
||||
|
@ -179,20 +179,20 @@ u64 Process::GetTotalPhysicalMemoryAvailable() const {
|
|||
return memory_usage_capacity;
|
||||
}
|
||||
|
||||
u64 Process::GetTotalPhysicalMemoryAvailableWithoutSystemResource() const {
|
||||
u64 KProcess::GetTotalPhysicalMemoryAvailableWithoutSystemResource() const {
|
||||
return GetTotalPhysicalMemoryAvailable() - GetSystemResourceSize();
|
||||
}
|
||||
|
||||
u64 Process::GetTotalPhysicalMemoryUsed() const {
|
||||
u64 KProcess::GetTotalPhysicalMemoryUsed() const {
|
||||
return image_size + main_thread_stack_size + page_table->GetTotalHeapSize() +
|
||||
GetSystemResourceSize();
|
||||
}
|
||||
|
||||
u64 Process::GetTotalPhysicalMemoryUsedWithoutSystemResource() const {
|
||||
u64 KProcess::GetTotalPhysicalMemoryUsedWithoutSystemResource() const {
|
||||
return GetTotalPhysicalMemoryUsed() - GetSystemResourceUsage();
|
||||
}
|
||||
|
||||
bool Process::ReleaseUserException(KThread* thread) {
|
||||
bool KProcess::ReleaseUserException(KThread* thread) {
|
||||
KScopedSchedulerLock sl{kernel};
|
||||
|
||||
if (exception_thread == thread) {
|
||||
|
@ -217,7 +217,7 @@ bool Process::ReleaseUserException(KThread* thread) {
|
|||
}
|
||||
}
|
||||
|
||||
void Process::PinCurrentThread() {
|
||||
void KProcess::PinCurrentThread() {
|
||||
ASSERT(kernel.GlobalSchedulerContext().IsLocked());
|
||||
|
||||
// Get the current thread.
|
||||
|
@ -232,7 +232,7 @@ void Process::PinCurrentThread() {
|
|||
KScheduler::SetSchedulerUpdateNeeded(kernel);
|
||||
}
|
||||
|
||||
void Process::UnpinCurrentThread() {
|
||||
void KProcess::UnpinCurrentThread() {
|
||||
ASSERT(kernel.GlobalSchedulerContext().IsLocked());
|
||||
|
||||
// Get the current thread.
|
||||
|
@ -247,15 +247,15 @@ void Process::UnpinCurrentThread() {
|
|||
KScheduler::SetSchedulerUpdateNeeded(kernel);
|
||||
}
|
||||
|
||||
void Process::RegisterThread(const KThread* thread) {
|
||||
void KProcess::RegisterThread(const KThread* thread) {
|
||||
thread_list.push_back(thread);
|
||||
}
|
||||
|
||||
void Process::UnregisterThread(const KThread* thread) {
|
||||
void KProcess::UnregisterThread(const KThread* thread) {
|
||||
thread_list.remove(thread);
|
||||
}
|
||||
|
||||
ResultCode Process::Reset() {
|
||||
ResultCode KProcess::Reset() {
|
||||
// Lock the process and the scheduler.
|
||||
KScopedLightLock lk(state_lock);
|
||||
KScopedSchedulerLock sl{kernel};
|
||||
|
@ -269,8 +269,8 @@ ResultCode Process::Reset() {
|
|||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata,
|
||||
std::size_t code_size) {
|
||||
ResultCode KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata,
|
||||
std::size_t code_size) {
|
||||
program_id = metadata.GetTitleID();
|
||||
ideal_core = metadata.GetMainThreadCore();
|
||||
is_64bit_process = metadata.Is64BitProgram();
|
||||
|
@ -332,7 +332,7 @@ ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata,
|
|||
return handle_table.SetSize(capabilities.GetHandleTableSize());
|
||||
}
|
||||
|
||||
void Process::Run(s32 main_thread_priority, u64 stack_size) {
|
||||
void KProcess::Run(s32 main_thread_priority, u64 stack_size) {
|
||||
AllocateMainThreadStack(stack_size);
|
||||
resource_limit->Reserve(LimitableResource::Threads, 1);
|
||||
resource_limit->Reserve(LimitableResource::PhysicalMemory, main_thread_stack_size);
|
||||
|
@ -345,7 +345,7 @@ void Process::Run(s32 main_thread_priority, u64 stack_size) {
|
|||
SetupMainThread(kernel.System(), *this, main_thread_priority, main_thread_stack_top);
|
||||
}
|
||||
|
||||
void Process::PrepareForTermination() {
|
||||
void KProcess::PrepareForTermination() {
|
||||
ChangeStatus(ProcessStatus::Exiting);
|
||||
|
||||
const auto stop_threads = [this](const std::vector<KThread*>& thread_list) {
|
||||
|
@ -377,14 +377,14 @@ void Process::PrepareForTermination() {
|
|||
ChangeStatus(ProcessStatus::Exited);
|
||||
}
|
||||
|
||||
void Process::Finalize() {
|
||||
void KProcess::Finalize() {
|
||||
// Release memory to the resource limit.
|
||||
if (resource_limit != nullptr) {
|
||||
resource_limit->Close();
|
||||
}
|
||||
|
||||
// Perform inherited finalization.
|
||||
KAutoObjectWithSlabHeapAndContainer<Process, KSynchronizationObject>::Finalize();
|
||||
KAutoObjectWithSlabHeapAndContainer<KProcess, KSynchronizationObject>::Finalize();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -400,7 +400,7 @@ static auto FindTLSPageWithAvailableSlots(std::vector<TLSPage>& tls_pages) {
|
|||
[](const auto& page) { return page.HasAvailableSlots(); });
|
||||
}
|
||||
|
||||
VAddr Process::CreateTLSRegion() {
|
||||
VAddr KProcess::CreateTLSRegion() {
|
||||
KScopedSchedulerLock lock(kernel);
|
||||
if (auto tls_page_iter{FindTLSPageWithAvailableSlots(tls_pages)};
|
||||
tls_page_iter != tls_pages.cend()) {
|
||||
|
@ -431,7 +431,7 @@ VAddr Process::CreateTLSRegion() {
|
|||
return *reserve_result;
|
||||
}
|
||||
|
||||
void Process::FreeTLSRegion(VAddr tls_address) {
|
||||
void KProcess::FreeTLSRegion(VAddr tls_address) {
|
||||
KScopedSchedulerLock lock(kernel);
|
||||
const VAddr aligned_address = Common::AlignDown(tls_address, Core::Memory::PAGE_SIZE);
|
||||
auto iter =
|
||||
|
@ -446,7 +446,7 @@ void Process::FreeTLSRegion(VAddr tls_address) {
|
|||
iter->ReleaseSlot(tls_address);
|
||||
}
|
||||
|
||||
void Process::LoadModule(CodeSet code_set, VAddr base_addr) {
|
||||
void KProcess::LoadModule(CodeSet code_set, VAddr base_addr) {
|
||||
std::lock_guard lock{HLE::g_hle_lock};
|
||||
const auto ReprotectSegment = [&](const CodeSet::Segment& segment,
|
||||
KMemoryPermission permission) {
|
||||
|
@ -461,19 +461,19 @@ void Process::LoadModule(CodeSet code_set, VAddr base_addr) {
|
|||
ReprotectSegment(code_set.DataSegment(), KMemoryPermission::ReadAndWrite);
|
||||
}
|
||||
|
||||
bool Process::IsSignaled() const {
|
||||
bool KProcess::IsSignaled() const {
|
||||
ASSERT(kernel.GlobalSchedulerContext().IsLocked());
|
||||
return is_signaled;
|
||||
}
|
||||
|
||||
Process::Process(KernelCore& kernel)
|
||||
KProcess::KProcess(KernelCore& kernel)
|
||||
: KAutoObjectWithSlabHeapAndContainer{kernel},
|
||||
page_table{std::make_unique<KPageTable>(kernel.System())}, handle_table{kernel},
|
||||
address_arbiter{kernel.System()}, condition_var{kernel.System()}, state_lock{kernel} {}
|
||||
|
||||
Process::~Process() = default;
|
||||
KProcess::~KProcess() = default;
|
||||
|
||||
void Process::ChangeStatus(ProcessStatus new_status) {
|
||||
void KProcess::ChangeStatus(ProcessStatus new_status) {
|
||||
if (status == new_status) {
|
||||
return;
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ void Process::ChangeStatus(ProcessStatus new_status) {
|
|||
NotifyAvailable();
|
||||
}
|
||||
|
||||
ResultCode Process::AllocateMainThreadStack(std::size_t stack_size) {
|
||||
ResultCode KProcess::AllocateMainThreadStack(std::size_t stack_size) {
|
||||
ASSERT(stack_size);
|
||||
|
||||
// The kernel always ensures that the given stack size is page aligned.
|
|
@ -62,12 +62,13 @@ enum class ProcessStatus {
|
|||
DebugBreak,
|
||||
};
|
||||
|
||||
class Process final : public KAutoObjectWithSlabHeapAndContainer<Process, KSynchronizationObject> {
|
||||
KERNEL_AUTOOBJECT_TRAITS(Process, KSynchronizationObject);
|
||||
class KProcess final
|
||||
: public KAutoObjectWithSlabHeapAndContainer<KProcess, KSynchronizationObject> {
|
||||
KERNEL_AUTOOBJECT_TRAITS(KProcess, KSynchronizationObject);
|
||||
|
||||
public:
|
||||
explicit Process(KernelCore& kernel);
|
||||
~Process() override;
|
||||
explicit KProcess(KernelCore& kernel);
|
||||
~KProcess() override;
|
||||
|
||||
enum : u64 {
|
||||
/// Lowest allowed process ID for a kernel initial process.
|
||||
|
@ -89,7 +90,7 @@ public:
|
|||
|
||||
static constexpr std::size_t RANDOM_ENTROPY_SIZE = 4;
|
||||
|
||||
static ResultCode Initialize(Process* process, Core::System& system, std::string name,
|
||||
static ResultCode Initialize(KProcess* process, Core::System& system, std::string name,
|
||||
ProcessType type);
|
||||
|
||||
/// Gets a reference to the process' page table.
|
|
@ -15,12 +15,12 @@
|
|||
#include "core/core.h"
|
||||
#include "core/core_timing.h"
|
||||
#include "core/cpu_manager.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/physical_core.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/time_manager.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -71,7 +71,7 @@ u64 KScheduler::UpdateHighestPriorityThread(KThread* highest_thread) {
|
|||
}
|
||||
if (state.should_count_idle) {
|
||||
if (highest_thread != nullptr) {
|
||||
if (Process* process = highest_thread->GetOwnerProcess(); process != nullptr) {
|
||||
if (KProcess* process = highest_thread->GetOwnerProcess(); process != nullptr) {
|
||||
process->SetRunningThread(core_id, highest_thread, state.idle_count);
|
||||
}
|
||||
} else {
|
||||
|
@ -104,7 +104,7 @@ u64 KScheduler::UpdateHighestPriorityThreadsImpl(KernelCore& kernel) {
|
|||
if (top_thread != nullptr) {
|
||||
// If the thread has no waiters, we need to check if the process has a thread pinned.
|
||||
if (top_thread->GetNumKernelWaiters() == 0) {
|
||||
if (Process* parent = top_thread->GetOwnerProcess(); parent != nullptr) {
|
||||
if (KProcess* parent = top_thread->GetOwnerProcess(); parent != nullptr) {
|
||||
if (KThread* pinned = parent->GetPinnedThread(static_cast<s32>(core_id));
|
||||
pinned != nullptr && pinned != top_thread) {
|
||||
// We prefer our parent's pinned thread if possible. However, we also don't
|
||||
|
@ -411,7 +411,7 @@ void KScheduler::YieldWithoutCoreMigration(KernelCore& kernel) {
|
|||
|
||||
// Get the current thread and process.
|
||||
KThread& cur_thread = Kernel::GetCurrentThread(kernel);
|
||||
Process& cur_process = *kernel.CurrentProcess();
|
||||
KProcess& cur_process = *kernel.CurrentProcess();
|
||||
|
||||
// If the thread's yield count matches, there's nothing for us to do.
|
||||
if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) {
|
||||
|
@ -450,7 +450,7 @@ void KScheduler::YieldWithCoreMigration(KernelCore& kernel) {
|
|||
|
||||
// Get the current thread and process.
|
||||
KThread& cur_thread = Kernel::GetCurrentThread(kernel);
|
||||
Process& cur_process = *kernel.CurrentProcess();
|
||||
KProcess& cur_process = *kernel.CurrentProcess();
|
||||
|
||||
// If the thread's yield count matches, there's nothing for us to do.
|
||||
if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) {
|
||||
|
@ -538,7 +538,7 @@ void KScheduler::YieldToAnyThread(KernelCore& kernel) {
|
|||
|
||||
// Get the current thread and process.
|
||||
KThread& cur_thread = Kernel::GetCurrentThread(kernel);
|
||||
Process& cur_process = *kernel.CurrentProcess();
|
||||
KProcess& cur_process = *kernel.CurrentProcess();
|
||||
|
||||
// If the thread's yield count matches, there's nothing for us to do.
|
||||
if (cur_thread.GetYieldScheduleCount() == cur_process.GetScheduledCount()) {
|
||||
|
@ -724,7 +724,7 @@ void KScheduler::ScheduleImpl() {
|
|||
|
||||
current_thread.store(next_thread);
|
||||
|
||||
Process* const previous_process = system.Kernel().CurrentProcess();
|
||||
KProcess* const previous_process = system.Kernel().CurrentProcess();
|
||||
|
||||
UpdateLastContextSwitchTime(previous_thread, previous_process);
|
||||
|
||||
|
@ -780,7 +780,7 @@ void KScheduler::SwitchToCurrent() {
|
|||
}
|
||||
}
|
||||
|
||||
void KScheduler::UpdateLastContextSwitchTime(KThread* thread, Process* process) {
|
||||
void KScheduler::UpdateLastContextSwitchTime(KThread* thread, KProcess* process) {
|
||||
const u64 prev_switch_ticks = last_context_switch_time;
|
||||
const u64 most_recent_switch_ticks = system.CoreTiming().GetCPUTicks();
|
||||
const u64 update_ticks = most_recent_switch_ticks - prev_switch_ticks;
|
||||
|
|
|
@ -24,7 +24,7 @@ class System;
|
|||
namespace Kernel {
|
||||
|
||||
class KernelCore;
|
||||
class Process;
|
||||
class KProcess;
|
||||
class SchedulerLock;
|
||||
class KThread;
|
||||
|
||||
|
@ -165,7 +165,7 @@ private:
|
|||
* most recent tick count retrieved. No special arithmetic is
|
||||
* applied to it.
|
||||
*/
|
||||
void UpdateLastContextSwitchTime(KThread* thread, Process* process);
|
||||
void UpdateLastContextSwitchTime(KThread* thread, KProcess* process);
|
||||
|
||||
static void OnSwitch(void* this_scheduler);
|
||||
void SwitchToCurrent();
|
||||
|
@ -197,7 +197,7 @@ private:
|
|||
|
||||
class [[nodiscard]] KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> {
|
||||
public:
|
||||
explicit KScopedSchedulerLock(KernelCore & kernel);
|
||||
explicit KScopedSchedulerLock(KernelCore& kernel);
|
||||
~KScopedSchedulerLock();
|
||||
};
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_resource_limit.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
@ -33,10 +33,10 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
explicit KScopedResourceReservation(const Process* p, LimitableResource r, s64 v, s64 t)
|
||||
explicit KScopedResourceReservation(const KProcess* p, LimitableResource r, s64 v, s64 t)
|
||||
: KScopedResourceReservation(p->GetResourceLimit(), r, v, t) {}
|
||||
|
||||
explicit KScopedResourceReservation(const Process* p, LimitableResource r, s64 v = 1)
|
||||
explicit KScopedResourceReservation(const KProcess* p, LimitableResource r, s64 v = 1)
|
||||
: KScopedResourceReservation(p->GetResourceLimit(), r, v) {}
|
||||
|
||||
~KScopedResourceReservation() noexcept {
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
#include "core/hle/kernel/handle_table.h"
|
||||
#include "core/hle/kernel/hle_ipc.h"
|
||||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/k_server_session.h"
|
||||
#include "core/hle/kernel/k_session.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
|
|
@ -71,7 +71,7 @@ void KSession::OnClientClosed() {
|
|||
|
||||
void KSession::PostDestroy(uintptr_t arg) {
|
||||
// Release the session count resource the owner process holds.
|
||||
Process* owner = reinterpret_cast<Process*>(arg);
|
||||
KProcess* owner = reinterpret_cast<KProcess*>(arg);
|
||||
owner->GetResourceLimit()->Release(LimitableResource::Sessions, 1);
|
||||
owner->Close();
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ private:
|
|||
std::atomic<std::underlying_type<State>::type> atomic_state{
|
||||
static_cast<std::underlying_type<State>::type>(State::Invalid)};
|
||||
KClientPort* port{};
|
||||
Process* process{};
|
||||
KProcess* process{};
|
||||
bool initialized{};
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ KSharedMemory::~KSharedMemory() {
|
|||
}
|
||||
|
||||
ResultCode KSharedMemory::Initialize(KernelCore& kernel_, Core::DeviceMemory& device_memory_,
|
||||
Process* owner_process_, KPageLinkedList&& page_list_,
|
||||
KProcess* owner_process_, KPageLinkedList&& page_list_,
|
||||
KMemoryPermission owner_permission_,
|
||||
KMemoryPermission user_permission_, PAddr physical_address_,
|
||||
std::size_t size_, std::string name_) {
|
||||
|
@ -74,7 +74,7 @@ void KSharedMemory::Finalize() {
|
|||
KAutoObjectWithSlabHeapAndContainer<KSharedMemory, KAutoObjectWithList>::Finalize();
|
||||
}
|
||||
|
||||
ResultCode KSharedMemory::Map(Process& target_process, VAddr address, std::size_t size,
|
||||
ResultCode KSharedMemory::Map(KProcess& target_process, VAddr address, std::size_t size,
|
||||
KMemoryPermission permissions) {
|
||||
const u64 page_count{(size + PageSize - 1) / PageSize};
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "core/device_memory.h"
|
||||
#include "core/hle/kernel/k_memory_block.h"
|
||||
#include "core/hle/kernel/k_page_linked_list.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/slab_helpers.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
|
@ -28,7 +28,7 @@ public:
|
|||
~KSharedMemory() override;
|
||||
|
||||
ResultCode Initialize(KernelCore& kernel_, Core::DeviceMemory& device_memory_,
|
||||
Process* owner_process_, KPageLinkedList&& page_list_,
|
||||
KProcess* owner_process_, KPageLinkedList&& page_list_,
|
||||
KMemoryPermission owner_permission_, KMemoryPermission user_permission_,
|
||||
PAddr physical_address_, std::size_t size_, std::string name_);
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
* @param size Size of the shared memory block to map
|
||||
* @param permissions Memory block map permissions (specified by SVC field)
|
||||
*/
|
||||
ResultCode Map(Process& target_process, VAddr address, std::size_t size,
|
||||
ResultCode Map(KProcess& target_process, VAddr address, std::size_t size,
|
||||
KMemoryPermission permissions);
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
|
||||
private:
|
||||
Core::DeviceMemory* device_memory;
|
||||
Process* owner_process{};
|
||||
KProcess* owner_process{};
|
||||
KPageLinkedList page_list;
|
||||
KMemoryPermission owner_permission{};
|
||||
KMemoryPermission user_permission{};
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
#include "core/hle/kernel/handle_table.h"
|
||||
#include "core/hle/kernel/k_condition_variable.h"
|
||||
#include "core/hle/kernel/k_memory_layout.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_resource_limit.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/k_thread_queue.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
#include "core/hle/kernel/time_manager.h"
|
||||
#include "core/hle/result.h"
|
||||
|
@ -65,7 +65,7 @@ KThread::KThread(KernelCore& kernel)
|
|||
KThread::~KThread() = default;
|
||||
|
||||
ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top, s32 prio,
|
||||
s32 virt_core, Process* owner, ThreadType type) {
|
||||
s32 virt_core, KProcess* owner, ThreadType type) {
|
||||
// Assert parameters are valid.
|
||||
ASSERT((type == ThreadType::Main) ||
|
||||
(Svc::HighestThreadPriority <= prio && prio <= Svc::LowestThreadPriority));
|
||||
|
@ -209,7 +209,7 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
|
|||
}
|
||||
|
||||
ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uintptr_t arg,
|
||||
VAddr user_stack_top, s32 prio, s32 core, Process* owner,
|
||||
VAddr user_stack_top, s32 prio, s32 core, KProcess* owner,
|
||||
ThreadType type, std::function<void(void*)>&& init_func,
|
||||
void* init_func_parameter) {
|
||||
// Initialize the thread.
|
||||
|
@ -242,7 +242,7 @@ ResultCode KThread::InitializeHighPriorityThread(Core::System& system, KThread*
|
|||
|
||||
ResultCode KThread::InitializeUserThread(Core::System& system, KThread* thread,
|
||||
KThreadFunction func, uintptr_t arg, VAddr user_stack_top,
|
||||
s32 prio, s32 virt_core, Process* owner) {
|
||||
s32 prio, s32 virt_core, KProcess* owner) {
|
||||
system.Kernel().GlobalSchedulerContext().AddThread(thread);
|
||||
return InitializeThread(thread, func, arg, user_stack_top, prio, virt_core, owner,
|
||||
ThreadType::User, Core::CpuManager::GetGuestThreadStartFunc(),
|
||||
|
@ -250,7 +250,7 @@ ResultCode KThread::InitializeUserThread(Core::System& system, KThread* thread,
|
|||
}
|
||||
|
||||
void KThread::PostDestroy(uintptr_t arg) {
|
||||
Process* owner = reinterpret_cast<Process*>(arg & ~1ULL);
|
||||
KProcess* owner = reinterpret_cast<KProcess*>(arg & ~1ULL);
|
||||
const bool resource_limit_release_hint = (arg & 1);
|
||||
const s64 hint_value = (resource_limit_release_hint ? 0 : 1);
|
||||
if (owner != nullptr) {
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace Kernel {
|
|||
|
||||
class GlobalSchedulerContext;
|
||||
class KernelCore;
|
||||
class Process;
|
||||
class KProcess;
|
||||
class KScheduler;
|
||||
class KThreadQueue;
|
||||
|
||||
|
@ -105,7 +105,7 @@ class KThread final : public KAutoObjectWithSlabHeapAndContainer<KThread, KSynch
|
|||
|
||||
private:
|
||||
friend class KScheduler;
|
||||
friend class Process;
|
||||
friend class KProcess;
|
||||
|
||||
public:
|
||||
static constexpr s32 DefaultThreadPriority = 44;
|
||||
|
@ -290,11 +290,11 @@ public:
|
|||
current_core_id = core;
|
||||
}
|
||||
|
||||
[[nodiscard]] Process* GetOwnerProcess() {
|
||||
[[nodiscard]] KProcess* GetOwnerProcess() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
[[nodiscard]] const Process* GetOwnerProcess() const {
|
||||
[[nodiscard]] const KProcess* GetOwnerProcess() const {
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
@ -389,7 +389,7 @@ public:
|
|||
[[nodiscard]] static ResultCode InitializeUserThread(Core::System& system, KThread* thread,
|
||||
KThreadFunction func, uintptr_t arg,
|
||||
VAddr user_stack_top, s32 prio,
|
||||
s32 virt_core, Process* owner);
|
||||
s32 virt_core, KProcess* owner);
|
||||
|
||||
public:
|
||||
struct StackParameters {
|
||||
|
@ -641,11 +641,11 @@ private:
|
|||
void StartTermination();
|
||||
|
||||
[[nodiscard]] ResultCode Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack_top,
|
||||
s32 prio, s32 virt_core, Process* owner, ThreadType type);
|
||||
s32 prio, s32 virt_core, KProcess* owner, ThreadType type);
|
||||
|
||||
[[nodiscard]] static ResultCode InitializeThread(KThread* thread, KThreadFunction func,
|
||||
uintptr_t arg, VAddr user_stack_top, s32 prio,
|
||||
s32 core, Process* owner, ThreadType type,
|
||||
s32 core, KProcess* owner, ThreadType type,
|
||||
std::function<void(void*)>&& init_func,
|
||||
void* init_func_parameter);
|
||||
|
||||
|
@ -669,7 +669,7 @@ private:
|
|||
std::atomic<s64> cpu_time{};
|
||||
KSynchronizationObject* synced_object{};
|
||||
VAddr address_key{};
|
||||
Process* parent{};
|
||||
KProcess* parent{};
|
||||
VAddr kernel_stack_top{};
|
||||
u32* light_ipc_data{};
|
||||
VAddr tls_address{};
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_resource_limit.h"
|
||||
#include "core/hle/kernel/k_transfer_memory.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
@ -37,7 +37,7 @@ void KTransferMemory::Finalize() {
|
|||
}
|
||||
|
||||
void KTransferMemory::PostDestroy(uintptr_t arg) {
|
||||
Process* owner = reinterpret_cast<Process*>(arg);
|
||||
KProcess* owner = reinterpret_cast<KProcess*>(arg);
|
||||
owner->GetResourceLimit()->Release(LimitableResource::TransferMemory, 1);
|
||||
owner->Close();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class Memory;
|
|||
namespace Kernel {
|
||||
|
||||
class KernelCore;
|
||||
class Process;
|
||||
class KProcess;
|
||||
|
||||
class KTransferMemory final
|
||||
: public KAutoObjectWithSlabHeapAndContainer<KTransferMemory, KAutoObjectWithList> {
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
static void PostDestroy(uintptr_t arg);
|
||||
|
||||
Process* GetOwner() const {
|
||||
KProcess* GetOwner() const {
|
||||
return owner;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
Process* owner{};
|
||||
KProcess* owner{};
|
||||
VAddr address{};
|
||||
Svc::MemoryPermission owner_perm{};
|
||||
size_t size{};
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/kernel/k_memory_layout.h"
|
||||
#include "core/hle/kernel/k_memory_manager.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_resource_limit.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/k_shared_memory.h"
|
||||
|
@ -38,7 +39,6 @@
|
|||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/physical_core.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/service_thread.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
#include "core/hle/kernel/time_manager.h"
|
||||
|
@ -98,8 +98,8 @@ struct KernelCore::Impl {
|
|||
service_threads.clear();
|
||||
|
||||
next_object_id = 0;
|
||||
next_kernel_process_id = Process::InitialKIPIDMin;
|
||||
next_user_process_id = Process::ProcessIDMin;
|
||||
next_kernel_process_id = KProcess::InitialKIPIDMin;
|
||||
next_user_process_id = KProcess::ProcessIDMin;
|
||||
next_thread_id = 1;
|
||||
|
||||
for (s32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) {
|
||||
|
@ -220,7 +220,7 @@ struct KernelCore::Impl {
|
|||
}
|
||||
}
|
||||
|
||||
void MakeCurrentProcess(Process* process) {
|
||||
void MakeCurrentProcess(KProcess* process) {
|
||||
current_process = process;
|
||||
if (process == nullptr) {
|
||||
return;
|
||||
|
@ -632,13 +632,13 @@ struct KernelCore::Impl {
|
|||
}
|
||||
|
||||
std::atomic<u32> next_object_id{0};
|
||||
std::atomic<u64> next_kernel_process_id{Process::InitialKIPIDMin};
|
||||
std::atomic<u64> next_user_process_id{Process::ProcessIDMin};
|
||||
std::atomic<u64> next_kernel_process_id{KProcess::InitialKIPIDMin};
|
||||
std::atomic<u64> next_user_process_id{KProcess::ProcessIDMin};
|
||||
std::atomic<u64> next_thread_id{1};
|
||||
|
||||
// Lists all processes that exist in the current session.
|
||||
std::vector<Process*> process_list;
|
||||
Process* current_process{};
|
||||
std::vector<KProcess*> process_list;
|
||||
KProcess* current_process{};
|
||||
std::unique_ptr<Kernel::GlobalSchedulerContext> global_scheduler_context;
|
||||
Kernel::TimeManager time_manager;
|
||||
|
||||
|
@ -725,23 +725,23 @@ KScopedAutoObject<KThread> KernelCore::RetrieveThreadFromGlobalHandleTable(Handl
|
|||
return impl->global_handle_table.GetObject<KThread>(handle);
|
||||
}
|
||||
|
||||
void KernelCore::AppendNewProcess(Process* process) {
|
||||
void KernelCore::AppendNewProcess(KProcess* process) {
|
||||
impl->process_list.push_back(process);
|
||||
}
|
||||
|
||||
void KernelCore::MakeCurrentProcess(Process* process) {
|
||||
void KernelCore::MakeCurrentProcess(KProcess* process) {
|
||||
impl->MakeCurrentProcess(process);
|
||||
}
|
||||
|
||||
Process* KernelCore::CurrentProcess() {
|
||||
KProcess* KernelCore::CurrentProcess() {
|
||||
return impl->current_process;
|
||||
}
|
||||
|
||||
const Process* KernelCore::CurrentProcess() const {
|
||||
const KProcess* KernelCore::CurrentProcess() const {
|
||||
return impl->current_process;
|
||||
}
|
||||
|
||||
const std::vector<Process*>& KernelCore::GetProcessList() const {
|
||||
const std::vector<KProcess*>& KernelCore::GetProcessList() const {
|
||||
return impl->process_list;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class KEvent;
|
|||
class KLinkedListNode;
|
||||
class KMemoryManager;
|
||||
class KPort;
|
||||
class Process;
|
||||
class KProcess;
|
||||
class KResourceLimit;
|
||||
class KScheduler;
|
||||
class KSession;
|
||||
|
@ -101,19 +101,19 @@ public:
|
|||
KScopedAutoObject<KThread> RetrieveThreadFromGlobalHandleTable(Handle handle) const;
|
||||
|
||||
/// Adds the given shared pointer to an internal list of active processes.
|
||||
void AppendNewProcess(Process* process);
|
||||
void AppendNewProcess(KProcess* process);
|
||||
|
||||
/// Makes the given process the new current process.
|
||||
void MakeCurrentProcess(Process* process);
|
||||
void MakeCurrentProcess(KProcess* process);
|
||||
|
||||
/// Retrieves a pointer to the current process.
|
||||
Process* CurrentProcess();
|
||||
KProcess* CurrentProcess();
|
||||
|
||||
/// Retrieves a const pointer to the current process.
|
||||
const Process* CurrentProcess() const;
|
||||
const KProcess* CurrentProcess() const;
|
||||
|
||||
/// Retrieves the list of processes.
|
||||
const std::vector<Process*>& GetProcessList() const;
|
||||
const std::vector<KProcess*>& GetProcessList() const;
|
||||
|
||||
/// Gets the sole instance of the global scheduler
|
||||
Kernel::GlobalSchedulerContext& GlobalSchedulerContext();
|
||||
|
@ -274,7 +274,7 @@ public:
|
|||
return slab_heap_container->linked_list_node;
|
||||
} else if constexpr (std::is_same_v<T, KPort>) {
|
||||
return slab_heap_container->port;
|
||||
} else if constexpr (std::is_same_v<T, Process>) {
|
||||
} else if constexpr (std::is_same_v<T, KProcess>) {
|
||||
return slab_heap_container->process;
|
||||
} else if constexpr (std::is_same_v<T, KResourceLimit>) {
|
||||
return slab_heap_container->resource_limit;
|
||||
|
@ -292,7 +292,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
friend class Process;
|
||||
friend class KProcess;
|
||||
friend class KThread;
|
||||
|
||||
/// Creates a new object ID, incrementing the internal object ID counter.
|
||||
|
@ -325,7 +325,7 @@ private:
|
|||
KSlabHeap<KEvent> event;
|
||||
KSlabHeap<KLinkedListNode> linked_list_node;
|
||||
KSlabHeap<KPort> port;
|
||||
KSlabHeap<Process> process;
|
||||
KSlabHeap<KProcess> process;
|
||||
KSlabHeap<KResourceLimit> resource_limit;
|
||||
KSlabHeap<KSession> session;
|
||||
KSlabHeap<KSharedMemory> shared_memory;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "core/hle/kernel/k_memory_block.h"
|
||||
#include "core/hle/kernel/k_memory_layout.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_readable_event.h"
|
||||
#include "core/hle/kernel/k_resource_limit.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
|
@ -42,7 +43,6 @@
|
|||
#include "core/hle/kernel/k_writable_event.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/physical_core.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/svc.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
#include "core/hle/kernel/svc_types.h"
|
||||
|
@ -402,8 +402,8 @@ static ResultCode GetProcessId(Core::System& system, u64* out_process_id, Handle
|
|||
R_UNLESS(obj.IsNotNull(), ResultInvalidHandle);
|
||||
|
||||
// Get the process from the object.
|
||||
Process* process = nullptr;
|
||||
if (Process* p = obj->DynamicCast<Process*>(); p != nullptr) {
|
||||
KProcess* process = nullptr;
|
||||
if (KProcess* p = obj->DynamicCast<KProcess*>(); p != nullptr) {
|
||||
// The object is a process, so we can use it directly.
|
||||
process = p;
|
||||
} 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
|
|||
}
|
||||
|
||||
const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
|
||||
KScopedAutoObject process = handle_table.GetObject<Process>(handle);
|
||||
KScopedAutoObject process = handle_table.GetObject<KProcess>(handle);
|
||||
if (process.IsNull()) {
|
||||
LOG_ERROR(Kernel_SVC, "Process is not valid! info_id={}, info_sub_id={}, handle={:08X}",
|
||||
info_id, info_sub_id, handle);
|
||||
|
@ -838,7 +838,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
|
|||
return ResultInvalidCombination;
|
||||
}
|
||||
|
||||
Process* const current_process = system.Kernel().CurrentProcess();
|
||||
KProcess* const current_process = system.Kernel().CurrentProcess();
|
||||
HandleTable& handle_table = current_process->GetHandleTable();
|
||||
const auto resource_limit = current_process->GetResourceLimit();
|
||||
if (!resource_limit) {
|
||||
|
@ -861,9 +861,9 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
|
|||
return ResultInvalidHandle;
|
||||
}
|
||||
|
||||
if (info_sub_id >= Process::RANDOM_ENTROPY_SIZE) {
|
||||
if (info_sub_id >= KProcess::RANDOM_ENTROPY_SIZE) {
|
||||
LOG_ERROR(Kernel_SVC, "Entropy size is out of range, expected {} but got {}",
|
||||
Process::RANDOM_ENTROPY_SIZE, info_sub_id);
|
||||
KProcess::RANDOM_ENTROPY_SIZE, info_sub_id);
|
||||
return ResultInvalidCombination;
|
||||
}
|
||||
|
||||
|
@ -955,7 +955,7 @@ static ResultCode MapPhysicalMemory(Core::System& system, VAddr addr, u64 size)
|
|||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
Process* const current_process{system.Kernel().CurrentProcess()};
|
||||
KProcess* const current_process{system.Kernel().CurrentProcess()};
|
||||
auto& page_table{current_process->PageTable()};
|
||||
|
||||
if (current_process->GetSystemResourceSize() == 0) {
|
||||
|
@ -1009,7 +1009,7 @@ static ResultCode UnmapPhysicalMemory(Core::System& system, VAddr addr, u64 size
|
|||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
Process* const current_process{system.Kernel().CurrentProcess()};
|
||||
KProcess* const current_process{system.Kernel().CurrentProcess()};
|
||||
auto& page_table{current_process->PageTable()};
|
||||
|
||||
if (current_process->GetSystemResourceSize() == 0) {
|
||||
|
@ -1153,7 +1153,7 @@ static ResultCode GetThreadPriority32(Core::System& system, u32* out_priority, H
|
|||
/// Sets the priority for the specified thread
|
||||
static ResultCode SetThreadPriority(Core::System& system, Handle thread_handle, u32 priority) {
|
||||
// Get the current process.
|
||||
Process& process = *system.Kernel().CurrentProcess();
|
||||
KProcess& process = *system.Kernel().CurrentProcess();
|
||||
|
||||
// Validate the priority.
|
||||
R_UNLESS(HighestThreadPriority <= priority && priority <= LowestThreadPriority,
|
||||
|
@ -1264,7 +1264,7 @@ static ResultCode QueryProcessMemory(Core::System& system, VAddr memory_info_add
|
|||
std::lock_guard lock{HLE::g_hle_lock};
|
||||
LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address);
|
||||
const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
|
||||
KScopedAutoObject process = handle_table.GetObject<Process>(process_handle);
|
||||
KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
|
||||
if (process.IsNull()) {
|
||||
LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}",
|
||||
process_handle);
|
||||
|
@ -1346,7 +1346,7 @@ static ResultCode MapProcessCodeMemory(Core::System& system, Handle process_hand
|
|||
}
|
||||
|
||||
const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
|
||||
KScopedAutoObject process = handle_table.GetObject<Process>(process_handle);
|
||||
KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
|
||||
if (process.IsNull()) {
|
||||
LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).",
|
||||
process_handle);
|
||||
|
@ -1414,7 +1414,7 @@ static ResultCode UnmapProcessCodeMemory(Core::System& system, Handle process_ha
|
|||
}
|
||||
|
||||
const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
|
||||
KScopedAutoObject process = handle_table.GetObject<Process>(process_handle);
|
||||
KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
|
||||
if (process.IsNull()) {
|
||||
LOG_ERROR(Kernel_SVC, "Invalid process handle specified (handle=0x{:08X}).",
|
||||
process_handle);
|
||||
|
@ -1830,7 +1830,7 @@ static ResultCode ResetSignal(Core::System& system, Handle handle) {
|
|||
|
||||
// Try to reset as process.
|
||||
{
|
||||
KScopedAutoObject process = handle_table.GetObject<Process>(handle);
|
||||
KScopedAutoObject process = handle_table.GetObject<KProcess>(handle);
|
||||
if (process.IsNotNull()) {
|
||||
return process->Reset();
|
||||
}
|
||||
|
@ -2077,7 +2077,7 @@ static ResultCode GetProcessInfo(Core::System& system, u64* out, Handle process_
|
|||
};
|
||||
|
||||
const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
|
||||
KScopedAutoObject process = handle_table.GetObject<Process>(process_handle);
|
||||
KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle);
|
||||
if (process.IsNull()) {
|
||||
LOG_ERROR(Kernel_SVC, "Process handle does not exist, process_handle=0x{:08X}",
|
||||
process_handle);
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "core/file_sys/control_metadata.h"
|
||||
#include "core/file_sys/patch_manager.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/service/acc/acc.h"
|
||||
#include "core/hle/service/acc/acc_aa.h"
|
||||
#include "core/hle/service/acc/acc_su.h"
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
#include "core/file_sys/savedata_factory.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_event.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_readable_event.h"
|
||||
#include "core/hle/kernel/k_transfer_memory.h"
|
||||
#include "core/hle/kernel/k_writable_event.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/service/acc/profile_manager.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/hle/service/am/applet_ae.h"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "common/string_util.h"
|
||||
#include "core/core.h"
|
||||
#include "core/frontend/applets/error.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/hle/service/am/applets/error.h"
|
||||
#include "core/reporter.h"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "common/logging/log.h"
|
||||
#include "core/core.h"
|
||||
#include "core/frontend/applets/general_frontend.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/hle/service/am/applets/general_backend.h"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "core/file_sys/system_archive/system_archive.h"
|
||||
#include "core/file_sys/vfs_vector.h"
|
||||
#include "core/frontend/applets/web_browser.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/hle/service/am/applets/web_browser.h"
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
#include "core/file_sys/patch_manager.h"
|
||||
#include "core/file_sys/registered_cache.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_readable_event.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/service/aoc/aoc_u.h"
|
||||
#include "core/loader/loader.h"
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
#include "core/core.h"
|
||||
#include "core/file_sys/vfs.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_readable_event.h"
|
||||
#include "core/hle/kernel/k_writable_event.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/service/bcat/backend/backend.h"
|
||||
#include "core/hle/service/bcat/bcat.h"
|
||||
#include "core/hle/service/bcat/module.h"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "common/swap.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/fatal/fatal.h"
|
||||
#include "core/hle/service/fatal/fatal_p.h"
|
||||
#include "core/hle/service/fatal/fatal_u.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "core/file_sys/sdmc_factory.h"
|
||||
#include "core/file_sys/vfs.h"
|
||||
#include "core/file_sys/vfs_offset.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/hle/service/filesystem/fsp_ldr.h"
|
||||
#include "core/hle/service/filesystem/fsp_pr.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "core/file_sys/system_archive/system_archive.h"
|
||||
#include "core/file_sys/vfs.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/hle/service/filesystem/fsp_srv.h"
|
||||
#include "core/reporter.h"
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#include "core/file_sys/control_metadata.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/hle_ipc.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/service/glue/arp.h"
|
||||
#include "core/hle/service/glue/errors.h"
|
||||
#include "core/hle/service/glue/manager.h"
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include "core/core.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_system_control.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/svc_results.h"
|
||||
#include "core/hle/service/ldr/ldr.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
@ -321,7 +321,7 @@ public:
|
|||
return addr;
|
||||
}
|
||||
|
||||
ResultVal<VAddr> MapProcessCodeMemory(Kernel::Process* process, VAddr baseAddress,
|
||||
ResultVal<VAddr> MapProcessCodeMemory(Kernel::KProcess* process, VAddr baseAddress,
|
||||
u64 size) const {
|
||||
for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) {
|
||||
auto& page_table{process->PageTable()};
|
||||
|
@ -342,7 +342,7 @@ public:
|
|||
return ERROR_INSUFFICIENT_ADDRESS_SPACE;
|
||||
}
|
||||
|
||||
ResultVal<VAddr> MapNro(Kernel::Process* process, VAddr nro_addr, std::size_t nro_size,
|
||||
ResultVal<VAddr> MapNro(Kernel::KProcess* process, VAddr nro_addr, std::size_t nro_size,
|
||||
VAddr bss_addr, std::size_t bss_size, std::size_t size) const {
|
||||
for (std::size_t retry = 0; retry < MAXIMUM_MAP_RETRIES; retry++) {
|
||||
auto& page_table{process->PageTable()};
|
||||
|
@ -378,7 +378,7 @@ public:
|
|||
return ERROR_INSUFFICIENT_ADDRESS_SPACE;
|
||||
}
|
||||
|
||||
ResultCode LoadNro(Kernel::Process* process, const NROHeader& nro_header, VAddr nro_addr,
|
||||
ResultCode LoadNro(Kernel::KProcess* process, const NROHeader& nro_header, VAddr nro_addr,
|
||||
VAddr start) const {
|
||||
const VAddr text_start{start + nro_header.segment_headers[TEXT_INDEX].memory_offset};
|
||||
const VAddr ro_start{start + nro_header.segment_headers[RO_INDEX].memory_offset};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "core/file_sys/control_metadata.h"
|
||||
#include "core/file_sys/patch_manager.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/pctl/module.h"
|
||||
#include "core/hle/service/pctl/pctl.h"
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include "core/core.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/service/pm/pm.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
|
@ -17,8 +17,9 @@ constexpr ResultCode ERROR_PROCESS_NOT_FOUND{ErrorModule::PM, 1};
|
|||
|
||||
constexpr u64 NO_PROCESS_FOUND_PID{0};
|
||||
|
||||
std::optional<Kernel::Process*> SearchProcessList(const std::vector<Kernel::Process*>& process_list,
|
||||
std::function<bool(Kernel::Process*)> predicate) {
|
||||
std::optional<Kernel::KProcess*> SearchProcessList(
|
||||
const std::vector<Kernel::KProcess*>& process_list,
|
||||
std::function<bool(Kernel::KProcess*)> predicate) {
|
||||
const auto iter = std::find_if(process_list.begin(), process_list.end(), predicate);
|
||||
|
||||
if (iter == process_list.end()) {
|
||||
|
@ -29,9 +30,9 @@ std::optional<Kernel::Process*> SearchProcessList(const std::vector<Kernel::Proc
|
|||
}
|
||||
|
||||
void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx,
|
||||
const std::vector<Kernel::Process*>& process_list) {
|
||||
const std::vector<Kernel::KProcess*>& process_list) {
|
||||
const auto process = SearchProcessList(process_list, [](const auto& process) {
|
||||
return process->GetProcessID() == Kernel::Process::ProcessIDMin;
|
||||
return process->GetProcessID() == Kernel::KProcess::ProcessIDMin;
|
||||
});
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
|
@ -124,7 +125,7 @@ private:
|
|||
|
||||
class Info final : public ServiceFramework<Info> {
|
||||
public:
|
||||
explicit Info(Core::System& system_, const std::vector<Kernel::Process*>& process_list_)
|
||||
explicit Info(Core::System& system_, const std::vector<Kernel::KProcess*>& process_list_)
|
||||
: ServiceFramework{system_, "pm:info"}, process_list{process_list_} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &Info::GetTitleId, "GetTitleId"},
|
||||
|
@ -154,7 +155,7 @@ private:
|
|||
rb.Push((*process)->GetTitleID());
|
||||
}
|
||||
|
||||
const std::vector<Kernel::Process*>& process_list;
|
||||
const std::vector<Kernel::KProcess*>& process_list;
|
||||
};
|
||||
|
||||
class Shell final : public ServiceFramework<Shell> {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "common/logging/log.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/acc/profile_manager.h"
|
||||
#include "core/hle/service/prepo/prepo.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
#include "core/hle/ipc.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_server_port.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/service/acc/acc.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/hle/service/aoc/aoc_u.h"
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include "core/file_sys/patch_manager.h"
|
||||
#include "core/file_sys/romfs_factory.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/loader/deconstructed_rom_directory.h"
|
||||
#include "core/loader/nso.h"
|
||||
|
@ -88,7 +88,7 @@ FileType AppLoader_DeconstructedRomDirectory::IdentifyType(const FileSys::Virtua
|
|||
}
|
||||
|
||||
AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirectory::Load(
|
||||
Kernel::Process& process, Core::System& system) {
|
||||
Kernel::KProcess& process, Core::System& system) {
|
||||
if (is_loaded) {
|
||||
return {ResultStatus::ErrorAlreadyLoaded, {}};
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
return IdentifyType(file);
|
||||
}
|
||||
|
||||
LoadResult Load(Kernel::Process& process, Core::System& system) override;
|
||||
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
|
||||
|
||||
ResultStatus ReadRomFS(FileSys::VirtualFile& out_dir) override;
|
||||
ResultStatus ReadIcon(std::vector<u8>& out_buffer) override;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "common/logging/log.h"
|
||||
#include "core/hle/kernel/code_set.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/loader/elf.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
|
@ -386,7 +386,7 @@ FileType AppLoader_ELF::IdentifyType(const FileSys::VirtualFile& elf_file) {
|
|||
return FileType::Error;
|
||||
}
|
||||
|
||||
AppLoader_ELF::LoadResult AppLoader_ELF::Load(Kernel::Process& process,
|
||||
AppLoader_ELF::LoadResult AppLoader_ELF::Load(Kernel::KProcess& process,
|
||||
[[maybe_unused]] Core::System& system) {
|
||||
if (is_loaded) {
|
||||
return {ResultStatus::ErrorAlreadyLoaded, {}};
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
return IdentifyType(file);
|
||||
}
|
||||
|
||||
LoadResult Load(Kernel::Process& process, Core::System& system) override;
|
||||
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
|
||||
};
|
||||
|
||||
} // namespace Loader
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "core/file_sys/program_metadata.h"
|
||||
#include "core/hle/kernel/code_set.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/loader/kip.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
|
@ -42,7 +42,7 @@ FileType AppLoader_KIP::GetFileType() const {
|
|||
: FileType::Error;
|
||||
}
|
||||
|
||||
AppLoader::LoadResult AppLoader_KIP::Load(Kernel::Process& process,
|
||||
AppLoader::LoadResult AppLoader_KIP::Load(Kernel::KProcess& process,
|
||||
[[maybe_unused]] Core::System& system) {
|
||||
if (is_loaded) {
|
||||
return {ResultStatus::ErrorAlreadyLoaded, {}};
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
FileType GetFileType() const override;
|
||||
|
||||
LoadResult Load(Kernel::Process& process, Core::System& system) override;
|
||||
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<FileSys::KIP> kip;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "common/logging/log.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/loader/deconstructed_rom_directory.h"
|
||||
#include "core/loader/elf.h"
|
||||
#include "core/loader/kip.h"
|
||||
|
|
|
@ -25,7 +25,7 @@ class NACP;
|
|||
|
||||
namespace Kernel {
|
||||
struct AddressMapping;
|
||||
class Process;
|
||||
class KProcess;
|
||||
} // namespace Kernel
|
||||
|
||||
namespace Loader {
|
||||
|
@ -165,7 +165,7 @@ public:
|
|||
*
|
||||
* @return The status result of the operation.
|
||||
*/
|
||||
virtual LoadResult Load(Kernel::Process& process, Core::System& system) = 0;
|
||||
virtual LoadResult Load(Kernel::KProcess& process, Core::System& system) = 0;
|
||||
|
||||
/**
|
||||
* Get the code (typically .code section) of the application
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "core/file_sys/content_archive.h"
|
||||
#include "core/file_sys/romfs.h"
|
||||
#include "core/file_sys/xts_archive.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/loader/nax.h"
|
||||
#include "core/loader/nca.h"
|
||||
|
||||
|
@ -41,7 +41,7 @@ FileType AppLoader_NAX::GetFileType() const {
|
|||
return IdentifyTypeImpl(*nax);
|
||||
}
|
||||
|
||||
AppLoader_NAX::LoadResult AppLoader_NAX::Load(Kernel::Process& process, Core::System& system) {
|
||||
AppLoader_NAX::LoadResult AppLoader_NAX::Load(Kernel::KProcess& process, Core::System& system) {
|
||||
if (is_loaded) {
|
||||
return {ResultStatus::ErrorAlreadyLoaded, {}};
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
FileType GetFileType() const override;
|
||||
|
||||
LoadResult Load(Kernel::Process& process, Core::System& system) override;
|
||||
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
|
||||
|
||||
ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override;
|
||||
u64 ReadRomFSIVFCOffset() const override;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "core/core.h"
|
||||
#include "core/file_sys/content_archive.h"
|
||||
#include "core/file_sys/romfs_factory.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/loader/deconstructed_rom_directory.h"
|
||||
#include "core/loader/nca.h"
|
||||
|
@ -32,7 +32,7 @@ FileType AppLoader_NCA::IdentifyType(const FileSys::VirtualFile& nca_file) {
|
|||
return FileType::Error;
|
||||
}
|
||||
|
||||
AppLoader_NCA::LoadResult AppLoader_NCA::Load(Kernel::Process& process, Core::System& system) {
|
||||
AppLoader_NCA::LoadResult AppLoader_NCA::Load(Kernel::KProcess& process, Core::System& system) {
|
||||
if (is_loaded) {
|
||||
return {ResultStatus::ErrorAlreadyLoaded, {}};
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
return IdentifyType(file);
|
||||
}
|
||||
|
||||
LoadResult Load(Kernel::Process& process, Core::System& system) override;
|
||||
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
|
||||
|
||||
ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override;
|
||||
u64 ReadRomFSIVFCOffset() const override;
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#include "core/file_sys/vfs_offset.h"
|
||||
#include "core/hle/kernel/code_set.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/loader/nro.h"
|
||||
#include "core/loader/nso.h"
|
||||
|
@ -130,7 +130,7 @@ static constexpr u32 PageAlignSize(u32 size) {
|
|||
return static_cast<u32>((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK);
|
||||
}
|
||||
|
||||
static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data) {
|
||||
static bool LoadNroImpl(Kernel::KProcess& process, const std::vector<u8>& data) {
|
||||
if (data.size() < sizeof(NroHeader)) {
|
||||
return {};
|
||||
}
|
||||
|
@ -199,11 +199,11 @@ static bool LoadNroImpl(Kernel::Process& process, const std::vector<u8>& data) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AppLoader_NRO::LoadNro(Kernel::Process& process, const FileSys::VfsFile& nro_file) {
|
||||
bool AppLoader_NRO::LoadNro(Kernel::KProcess& process, const FileSys::VfsFile& nro_file) {
|
||||
return LoadNroImpl(process, nro_file.ReadAllBytes());
|
||||
}
|
||||
|
||||
AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::Process& process, Core::System& system) {
|
||||
AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::KProcess& process, Core::System& system) {
|
||||
if (is_loaded) {
|
||||
return {ResultStatus::ErrorAlreadyLoaded, {}};
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class NACP;
|
|||
}
|
||||
|
||||
namespace Kernel {
|
||||
class Process;
|
||||
class KProcess;
|
||||
}
|
||||
|
||||
namespace Loader {
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
return IdentifyType(file);
|
||||
}
|
||||
|
||||
LoadResult Load(Kernel::Process& process, Core::System& system) override;
|
||||
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
|
||||
|
||||
ResultStatus ReadIcon(std::vector<u8>& buffer) override;
|
||||
ResultStatus ReadProgramId(u64& out_program_id) override;
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
bool IsRomFSUpdatable() const override;
|
||||
|
||||
private:
|
||||
bool LoadNro(Kernel::Process& process, const FileSys::VfsFile& nro_file);
|
||||
bool LoadNro(Kernel::KProcess& process, const FileSys::VfsFile& nro_file);
|
||||
|
||||
std::vector<u8> icon_data;
|
||||
std::unique_ptr<FileSys::NACP> nacp;
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#include "core/file_sys/patch_manager.h"
|
||||
#include "core/hle/kernel/code_set.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/loader/nso.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
|
@ -71,7 +71,7 @@ FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& in_file) {
|
|||
return FileType::NSO;
|
||||
}
|
||||
|
||||
std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, Core::System& system,
|
||||
std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::KProcess& process, Core::System& system,
|
||||
const FileSys::VfsFile& nso_file, VAddr load_base,
|
||||
bool should_pass_arguments, bool load_into_process,
|
||||
std::optional<FileSys::PatchManager> pm) {
|
||||
|
@ -162,7 +162,7 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, Core::S
|
|||
return load_base + image_size;
|
||||
}
|
||||
|
||||
AppLoader_NSO::LoadResult AppLoader_NSO::Load(Kernel::Process& process, Core::System& system) {
|
||||
AppLoader_NSO::LoadResult AppLoader_NSO::Load(Kernel::KProcess& process, Core::System& system) {
|
||||
if (is_loaded) {
|
||||
return {ResultStatus::ErrorAlreadyLoaded, {}};
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class System;
|
|||
}
|
||||
|
||||
namespace Kernel {
|
||||
class Process;
|
||||
class KProcess;
|
||||
}
|
||||
|
||||
namespace Loader {
|
||||
|
@ -86,12 +86,12 @@ public:
|
|||
return IdentifyType(file);
|
||||
}
|
||||
|
||||
static std::optional<VAddr> LoadModule(Kernel::Process& process, Core::System& system,
|
||||
static std::optional<VAddr> LoadModule(Kernel::KProcess& process, Core::System& system,
|
||||
const FileSys::VfsFile& nso_file, VAddr load_base,
|
||||
bool should_pass_arguments, bool load_into_process,
|
||||
std::optional<FileSys::PatchManager> pm = {});
|
||||
|
||||
LoadResult Load(Kernel::Process& process, Core::System& system) override;
|
||||
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
|
||||
|
||||
ResultStatus ReadNSOModules(Modules& out_modules) override;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "core/file_sys/patch_manager.h"
|
||||
#include "core/file_sys/registered_cache.h"
|
||||
#include "core/file_sys/submission_package.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/loader/deconstructed_rom_directory.h"
|
||||
#include "core/loader/nca.h"
|
||||
|
@ -79,7 +79,7 @@ FileType AppLoader_NSP::IdentifyType(const FileSys::VirtualFile& nsp_file) {
|
|||
return FileType::Error;
|
||||
}
|
||||
|
||||
AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::Process& process, Core::System& system) {
|
||||
AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::KProcess& process, Core::System& system) {
|
||||
if (is_loaded) {
|
||||
return {ResultStatus::ErrorAlreadyLoaded, {}};
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
return IdentifyType(file);
|
||||
}
|
||||
|
||||
LoadResult Load(Kernel::Process& process, Core::System& system) override;
|
||||
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
|
||||
|
||||
ResultStatus ReadRomFS(FileSys::VirtualFile& out_file) override;
|
||||
u64 ReadRomFSIVFCOffset() const override;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "core/file_sys/registered_cache.h"
|
||||
#include "core/file_sys/romfs.h"
|
||||
#include "core/file_sys/submission_package.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/loader/nca.h"
|
||||
#include "core/loader/xci.h"
|
||||
|
@ -56,7 +56,7 @@ FileType AppLoader_XCI::IdentifyType(const FileSys::VirtualFile& xci_file) {
|
|||
return FileType::Error;
|
||||
}
|
||||
|
||||
AppLoader_XCI::LoadResult AppLoader_XCI::Load(Kernel::Process& process, Core::System& system) {
|
||||
AppLoader_XCI::LoadResult AppLoader_XCI::Load(Kernel::KProcess& process, Core::System& system) {
|
||||
if (is_loaded) {
|
||||
return {ResultStatus::ErrorAlreadyLoaded, {}};
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
return IdentifyType(file);
|
||||
}
|
||||
|
||||
LoadResult Load(Kernel::Process& process, Core::System& system) override;
|
||||
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
|
||||
|
||||
ResultStatus ReadRomFS(FileSys::VirtualFile& out_file) override;
|
||||
u64 ReadRomFSIVFCOffset() const override;
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#include "core/core.h"
|
||||
#include "core/device_memory.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/physical_memory.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/memory.h"
|
||||
#include "video_core/gpu.h"
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace Core::Memory {
|
|||
struct Memory::Impl {
|
||||
explicit Impl(Core::System& system_) : system{system_} {}
|
||||
|
||||
void SetCurrentPageTable(Kernel::Process& process, u32 core_id) {
|
||||
void SetCurrentPageTable(Kernel::KProcess& process, u32 core_id) {
|
||||
current_page_table = &process.PageTable().PageTableImpl();
|
||||
|
||||
const std::size_t address_space_width = process.PageTable().GetAddressSpaceWidth();
|
||||
|
@ -50,7 +50,7 @@ struct Memory::Impl {
|
|||
MapPages(page_table, base / PAGE_SIZE, size / PAGE_SIZE, 0, Common::PageType::Unmapped);
|
||||
}
|
||||
|
||||
bool IsValidVirtualAddress(const Kernel::Process& process, const VAddr vaddr) const {
|
||||
bool IsValidVirtualAddress(const Kernel::KProcess& process, const VAddr vaddr) const {
|
||||
const auto& page_table = process.PageTable().PageTableImpl();
|
||||
const auto [pointer, type] = page_table.pointers[vaddr >> PAGE_BITS].PointerType();
|
||||
return pointer != nullptr || type == Common::PageType::RasterizerCachedMemory;
|
||||
|
@ -194,7 +194,7 @@ struct Memory::Impl {
|
|||
return string;
|
||||
}
|
||||
|
||||
void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_buffer,
|
||||
void ReadBlock(const Kernel::KProcess& process, const VAddr src_addr, void* dest_buffer,
|
||||
const std::size_t size) {
|
||||
const auto& page_table = process.PageTable().PageTableImpl();
|
||||
|
||||
|
@ -239,7 +239,7 @@ struct Memory::Impl {
|
|||
}
|
||||
}
|
||||
|
||||
void ReadBlockUnsafe(const Kernel::Process& process, const VAddr src_addr, void* dest_buffer,
|
||||
void ReadBlockUnsafe(const Kernel::KProcess& process, const VAddr src_addr, void* dest_buffer,
|
||||
const std::size_t size) {
|
||||
const auto& page_table = process.PageTable().PageTableImpl();
|
||||
|
||||
|
@ -291,7 +291,7 @@ struct Memory::Impl {
|
|||
ReadBlockUnsafe(*system.CurrentProcess(), src_addr, dest_buffer, size);
|
||||
}
|
||||
|
||||
void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const void* src_buffer,
|
||||
void WriteBlock(const Kernel::KProcess& process, const VAddr dest_addr, const void* src_buffer,
|
||||
const std::size_t size) {
|
||||
const auto& page_table = process.PageTable().PageTableImpl();
|
||||
std::size_t remaining_size = size;
|
||||
|
@ -334,7 +334,7 @@ struct Memory::Impl {
|
|||
}
|
||||
}
|
||||
|
||||
void WriteBlockUnsafe(const Kernel::Process& process, const VAddr dest_addr,
|
||||
void WriteBlockUnsafe(const Kernel::KProcess& process, const VAddr dest_addr,
|
||||
const void* src_buffer, const std::size_t size) {
|
||||
const auto& page_table = process.PageTable().PageTableImpl();
|
||||
std::size_t remaining_size = size;
|
||||
|
@ -384,7 +384,7 @@ struct Memory::Impl {
|
|||
WriteBlockUnsafe(*system.CurrentProcess(), dest_addr, src_buffer, size);
|
||||
}
|
||||
|
||||
void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const std::size_t size) {
|
||||
void ZeroBlock(const Kernel::KProcess& process, const VAddr dest_addr, const std::size_t size) {
|
||||
const auto& page_table = process.PageTable().PageTableImpl();
|
||||
std::size_t remaining_size = size;
|
||||
std::size_t page_index = dest_addr >> PAGE_BITS;
|
||||
|
@ -429,7 +429,7 @@ struct Memory::Impl {
|
|||
ZeroBlock(*system.CurrentProcess(), dest_addr, size);
|
||||
}
|
||||
|
||||
void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr,
|
||||
void CopyBlock(const Kernel::KProcess& process, VAddr dest_addr, VAddr src_addr,
|
||||
const std::size_t size) {
|
||||
const auto& page_table = process.PageTable().PageTableImpl();
|
||||
std::size_t remaining_size = size;
|
||||
|
@ -741,7 +741,7 @@ void Memory::Reset() {
|
|||
impl = std::make_unique<Impl>(system);
|
||||
}
|
||||
|
||||
void Memory::SetCurrentPageTable(Kernel::Process& process, u32 core_id) {
|
||||
void Memory::SetCurrentPageTable(Kernel::KProcess& process, u32 core_id) {
|
||||
impl->SetCurrentPageTable(process, core_id);
|
||||
}
|
||||
|
||||
|
@ -753,7 +753,7 @@ void Memory::UnmapRegion(Common::PageTable& page_table, VAddr base, u64 size) {
|
|||
impl->UnmapRegion(page_table, base, size);
|
||||
}
|
||||
|
||||
bool Memory::IsValidVirtualAddress(const Kernel::Process& process, const VAddr vaddr) const {
|
||||
bool Memory::IsValidVirtualAddress(const Kernel::KProcess& process, const VAddr vaddr) const {
|
||||
return impl->IsValidVirtualAddress(process, vaddr);
|
||||
}
|
||||
|
||||
|
@ -829,7 +829,7 @@ std::string Memory::ReadCString(VAddr vaddr, std::size_t max_length) {
|
|||
return impl->ReadCString(vaddr, max_length);
|
||||
}
|
||||
|
||||
void Memory::ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_buffer,
|
||||
void Memory::ReadBlock(const Kernel::KProcess& process, const VAddr src_addr, void* dest_buffer,
|
||||
const std::size_t size) {
|
||||
impl->ReadBlock(process, src_addr, dest_buffer, size);
|
||||
}
|
||||
|
@ -838,7 +838,7 @@ void Memory::ReadBlock(const VAddr src_addr, void* dest_buffer, const std::size_
|
|||
impl->ReadBlock(src_addr, dest_buffer, size);
|
||||
}
|
||||
|
||||
void Memory::ReadBlockUnsafe(const Kernel::Process& process, const VAddr src_addr,
|
||||
void Memory::ReadBlockUnsafe(const Kernel::KProcess& process, const VAddr src_addr,
|
||||
void* dest_buffer, const std::size_t size) {
|
||||
impl->ReadBlockUnsafe(process, src_addr, dest_buffer, size);
|
||||
}
|
||||
|
@ -847,7 +847,7 @@ void Memory::ReadBlockUnsafe(const VAddr src_addr, void* dest_buffer, const std:
|
|||
impl->ReadBlockUnsafe(src_addr, dest_buffer, size);
|
||||
}
|
||||
|
||||
void Memory::WriteBlock(const Kernel::Process& process, VAddr dest_addr, const void* src_buffer,
|
||||
void Memory::WriteBlock(const Kernel::KProcess& process, VAddr dest_addr, const void* src_buffer,
|
||||
std::size_t size) {
|
||||
impl->WriteBlock(process, dest_addr, src_buffer, size);
|
||||
}
|
||||
|
@ -856,7 +856,7 @@ void Memory::WriteBlock(const VAddr dest_addr, const void* src_buffer, const std
|
|||
impl->WriteBlock(dest_addr, src_buffer, size);
|
||||
}
|
||||
|
||||
void Memory::WriteBlockUnsafe(const Kernel::Process& process, VAddr dest_addr,
|
||||
void Memory::WriteBlockUnsafe(const Kernel::KProcess& process, VAddr dest_addr,
|
||||
const void* src_buffer, std::size_t size) {
|
||||
impl->WriteBlockUnsafe(process, dest_addr, src_buffer, size);
|
||||
}
|
||||
|
@ -866,7 +866,7 @@ void Memory::WriteBlockUnsafe(const VAddr dest_addr, const void* src_buffer,
|
|||
impl->WriteBlockUnsafe(dest_addr, src_buffer, size);
|
||||
}
|
||||
|
||||
void Memory::ZeroBlock(const Kernel::Process& process, VAddr dest_addr, std::size_t size) {
|
||||
void Memory::ZeroBlock(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size) {
|
||||
impl->ZeroBlock(process, dest_addr, size);
|
||||
}
|
||||
|
||||
|
@ -874,7 +874,7 @@ void Memory::ZeroBlock(VAddr dest_addr, std::size_t size) {
|
|||
impl->ZeroBlock(dest_addr, size);
|
||||
}
|
||||
|
||||
void Memory::CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr,
|
||||
void Memory::CopyBlock(const Kernel::KProcess& process, VAddr dest_addr, VAddr src_addr,
|
||||
const std::size_t size) {
|
||||
impl->CopyBlock(process, dest_addr, src_addr, size);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class System;
|
|||
|
||||
namespace Kernel {
|
||||
class PhysicalMemory;
|
||||
class Process;
|
||||
class KProcess;
|
||||
} // namespace Kernel
|
||||
|
||||
namespace Core::Memory {
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
*
|
||||
* @param process The process to use the page table of.
|
||||
*/
|
||||
void SetCurrentPageTable(Kernel::Process& process, u32 core_id);
|
||||
void SetCurrentPageTable(Kernel::KProcess& process, u32 core_id);
|
||||
|
||||
/**
|
||||
* Maps an allocated buffer onto a region of the emulated process address space.
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
*
|
||||
* @returns True if the given virtual address is valid, false otherwise.
|
||||
*/
|
||||
bool IsValidVirtualAddress(const Kernel::Process& process, VAddr vaddr) const;
|
||||
bool IsValidVirtualAddress(const Kernel::KProcess& process, VAddr vaddr) const;
|
||||
|
||||
/**
|
||||
* Checks whether or not the supplied address is a valid virtual
|
||||
|
@ -333,7 +333,7 @@ public:
|
|||
* @post The range [dest_buffer, size) contains the read bytes from the
|
||||
* process' address space.
|
||||
*/
|
||||
void ReadBlock(const Kernel::Process& process, VAddr src_addr, void* dest_buffer,
|
||||
void ReadBlock(const Kernel::KProcess& process, VAddr src_addr, void* dest_buffer,
|
||||
std::size_t size);
|
||||
|
||||
/**
|
||||
|
@ -354,7 +354,7 @@ public:
|
|||
* @post The range [dest_buffer, size) contains the read bytes from the
|
||||
* process' address space.
|
||||
*/
|
||||
void ReadBlockUnsafe(const Kernel::Process& process, VAddr src_addr, void* dest_buffer,
|
||||
void ReadBlockUnsafe(const Kernel::KProcess& process, VAddr src_addr, void* dest_buffer,
|
||||
std::size_t size);
|
||||
|
||||
/**
|
||||
|
@ -414,7 +414,7 @@ public:
|
|||
* and will mark that region as invalidated to caches that the active
|
||||
* graphics backend may be maintaining over the course of execution.
|
||||
*/
|
||||
void WriteBlock(const Kernel::Process& process, VAddr dest_addr, const void* src_buffer,
|
||||
void WriteBlock(const Kernel::KProcess& process, VAddr dest_addr, const void* src_buffer,
|
||||
std::size_t size);
|
||||
|
||||
/**
|
||||
|
@ -434,7 +434,7 @@ public:
|
|||
* will be ignored and an error will be logged.
|
||||
*
|
||||
*/
|
||||
void WriteBlockUnsafe(const Kernel::Process& process, VAddr dest_addr, const void* src_buffer,
|
||||
void WriteBlockUnsafe(const Kernel::KProcess& process, VAddr dest_addr, const void* src_buffer,
|
||||
std::size_t size);
|
||||
|
||||
/**
|
||||
|
@ -486,7 +486,7 @@ public:
|
|||
* @post The range [dest_addr, size) within the process' address space is
|
||||
* filled with zeroes.
|
||||
*/
|
||||
void ZeroBlock(const Kernel::Process& process, VAddr dest_addr, std::size_t size);
|
||||
void ZeroBlock(const Kernel::KProcess& process, VAddr dest_addr, std::size_t size);
|
||||
|
||||
/**
|
||||
* Fills the specified address range within the current process' address space with zeroes.
|
||||
|
@ -511,7 +511,7 @@ public:
|
|||
* @post The range [dest_addr, size) within the process' address space contains the
|
||||
* same data within the range [src_addr, size).
|
||||
*/
|
||||
void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr,
|
||||
void CopyBlock(const Kernel::KProcess& process, VAddr dest_addr, VAddr src_addr,
|
||||
std::size_t size);
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "core/core_timing_util.h"
|
||||
#include "core/hardware_properties.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/hid/controllers/npad.h"
|
||||
#include "core/hle/service/hid/hid.h"
|
||||
#include "core/hle/service/sm/sm.h"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "core/core.h"
|
||||
#include "core/hle/kernel/hle_ipc.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/memory.h"
|
||||
#include "core/reporter.h"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "common/logging/log.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/k_page_table.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/memory.h"
|
||||
#include "video_core/gpu.h"
|
||||
#include "video_core/memory_manager.h"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "common/scope_exit.h"
|
||||
#include "common/settings.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/memory.h"
|
||||
#include "video_core/engines/kepler_compute.h"
|
||||
#include "video_core/engines/maxwell_3d.h"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "common/settings.h"
|
||||
#include "common/zstd_compression.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "video_core/engines/shader_type.h"
|
||||
#include "video_core/renderer_opengl/gl_shader_cache.h"
|
||||
#include "video_core/renderer_opengl/gl_shader_disk_cache.h"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "common/settings.h"
|
||||
#include "core/core.h"
|
||||
#include "core/frontend/framebuffer_layout.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "input_common/keyboard.h"
|
||||
#include "input_common/main.h"
|
||||
#include "input_common/mouse/mouse_input.h"
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
#include "core/core.h"
|
||||
#include "core/hle/kernel/handle_table.h"
|
||||
#include "core/hle/kernel/k_class_token.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/kernel/k_readable_event.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/k_synchronization_object.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/svc_common.h"
|
||||
#include "core/hle/kernel/svc_types.h"
|
||||
#include "core/memory.h"
|
||||
|
|
|
@ -92,7 +92,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
|
|||
#include "core/file_sys/romfs.h"
|
||||
#include "core/file_sys/savedata_factory.h"
|
||||
#include "core/file_sys/submission_package.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/am/am.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/hle/service/nfp/nfp.h"
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "core/crypto/key_manager.h"
|
||||
#include "core/file_sys/registered_cache.h"
|
||||
#include "core/file_sys/vfs_real.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/k_process.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/loader/loader.h"
|
||||
#include "core/telemetry_session.h"
|
||||
|
|
Loading…
Reference in New Issue