From 590872e3be4b8c651cf6b9f0331200f4e761c701 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 6 May 2021 02:29:20 +0200 Subject: [PATCH] early-access version 1658 --- README.md | 2 +- src/core/hle/kernel/k_process.cpp | 16 ++++++++-------- src/core/hle/kernel/k_process.h | 2 ++ src/core/hle/kernel/kernel.cpp | 8 -------- src/core/hle/kernel/kernel.h | 3 --- src/core/hle/service/nvdrv/interface.cpp | 2 +- 6 files changed, 12 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index c11c19a69..6b0ce81e0 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1656. +This is the source code for early-access 1658. ## Legal Notice diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index 174318180..07ff6a3d1 100755 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -127,6 +127,7 @@ ResultCode KProcess::Initialize(KProcess* process, Core::System& system, std::st process->resource_limit = kernel.GetSystemResourceLimit(); process->status = ProcessStatus::Created; process->program_id = 0; + process->system = &system; process->process_id = type == ProcessType::KernelInternal ? kernel.CreateNewKernelProcessID() : kernel.CreateNewUserProcessID(); process->capabilities.InitializeForMetadatalessProcess(); @@ -367,7 +368,7 @@ void KProcess::Run(s32 main_thread_priority, u64 stack_size) { ChangeStatus(ProcessStatus::Running); - SetupMainThread(kernel.System(), *this, main_thread_priority, main_thread_stack_top); + SetupMainThread(*system, *this, main_thread_priority, main_thread_stack_top); } void KProcess::PrepareForTermination() { @@ -389,7 +390,7 @@ void KProcess::PrepareForTermination() { } }; - stop_threads(kernel.System().GlobalSchedulerContext().GetThreadList()); + stop_threads(system->GlobalSchedulerContext().GetThreadList()); FreeTLSRegion(tls_region_address); tls_region_address = 0; @@ -437,7 +438,7 @@ VAddr KProcess::CreateTLSRegion() { const VAddr start{page_table->GetKernelMapRegionStart()}; const VAddr size{page_table->GetKernelMapRegionEnd() - start}; - const PAddr tls_map_addr{kernel.System().DeviceMemory().GetPhysicalAddr(tls_page_ptr)}; + const PAddr tls_map_addr{system->DeviceMemory().GetPhysicalAddr(tls_page_ptr)}; const VAddr tls_page_addr{page_table ->AllocateAndMapMemory(1, PageSize, true, start, size / PageSize, KMemoryState::ThreadLocal, @@ -478,8 +479,7 @@ void KProcess::LoadModule(CodeSet code_set, VAddr base_addr) { page_table->SetCodeMemoryPermission(segment.addr + base_addr, segment.size, permission); }; - kernel.System().Memory().WriteBlock(*this, base_addr, code_set.memory.data(), - code_set.memory.size()); + system->Memory().WriteBlock(*this, base_addr, code_set.memory.data(), code_set.memory.size()); ReprotectSegment(code_set.CodeSegment(), KMemoryPermission::ReadAndExecute); ReprotectSegment(code_set.RODataSegment(), KMemoryPermission::Read); @@ -492,9 +492,9 @@ bool KProcess::IsSignaled() const { } KProcess::KProcess(KernelCore& kernel) - : KAutoObjectWithSlabHeapAndContainer{kernel}, - page_table{std::make_unique(kernel.System())}, handle_table{kernel}, - address_arbiter{kernel.System()}, condition_var{kernel.System()}, state_lock{kernel} {} + : KAutoObjectWithSlabHeapAndContainer{kernel}, page_table{std::make_unique( + *system)}, + handle_table{kernel}, address_arbiter{*system}, condition_var{*system}, state_lock{kernel} {} KProcess::~KProcess() = default; diff --git a/src/core/hle/kernel/k_process.h b/src/core/hle/kernel/k_process.h index 62ab26b05..b4a2e5d6d 100755 --- a/src/core/hle/kernel/k_process.h +++ b/src/core/hle/kernel/k_process.h @@ -477,6 +477,8 @@ private: KThread* exception_thread{}; + Core::System* system{}; + KLightLock state_lock; }; diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 32bbf2d9b..d917077fa 100755 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -1013,12 +1013,4 @@ void KernelCore::SetIsPhantomModeForSingleCore(bool value) { impl->SetIsPhantomModeForSingleCore(value); } -Core::System& KernelCore::System() { - return impl->system; -} - -const Core::System& KernelCore::System() const { - return impl->system; -} - } // namespace Kernel diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 51aaccbc7..5d1b62abe 100755 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -265,9 +265,6 @@ public: bool IsPhantomModeForSingleCore() const; void SetIsPhantomModeForSingleCore(bool value); - Core::System& System(); - const Core::System& System() const; - /// Gets the slab heap for the specified kernel object type. template KSlabHeap& SlabHeap() { diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index 613d2f149..dc9b9341f 100755 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -40,7 +40,7 @@ void NVDRV::Open(Kernel::HLERequestContext& ctx) { rb.Push(0); rb.PushEnum(NvResult::NotSupported); - LOG_WARNING(Service_NVDRV, "/dev/nvhost-prof-gpu cannot be openned on production"); + LOG_WARNING(Service_NVDRV, "/dev/nvhost-prof-gpu cannot be opened in production"); return; }