summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/hle/service/pctl/module.cpp (renamed from src/core/hle/service/pctl/pctl_a.cpp)37
-rw-r--r--src/core/hle/service/pctl/module.h28
-rw-r--r--src/core/hle/service/pctl/pctl.cpp11
-rw-r--r--src/core/hle/service/pctl/pctl.h8
-rw-r--r--src/core/hle/service/pctl/pctl_a.h20
-rw-r--r--src/core/hle/service/service.cpp2
-rw-r--r--src/core/memory.cpp50
8 files changed, 97 insertions, 63 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index b3807c204..f4be926e4 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -181,10 +181,10 @@ add_library(core STATIC
hle/service/nvflinger/buffer_queue.h
hle/service/nvflinger/nvflinger.cpp
hle/service/nvflinger/nvflinger.h
+ hle/service/pctl/module.cpp
+ hle/service/pctl/module.h
hle/service/pctl/pctl.cpp
hle/service/pctl/pctl.h
- hle/service/pctl/pctl_a.cpp
- hle/service/pctl/pctl_a.h
hle/service/service.cpp
hle/service/service.h
hle/service/set/set.cpp
diff --git a/src/core/hle/service/pctl/pctl_a.cpp b/src/core/hle/service/pctl/module.cpp
index 24a6cf310..dd20d5ae7 100644
--- a/src/core/hle/service/pctl/pctl_a.cpp
+++ b/src/core/hle/service/pctl/module.cpp
@@ -4,7 +4,8 @@
#include "common/logging/log.h"
#include "core/hle/ipc_helpers.h"
-#include "core/hle/service/pctl/pctl_a.h"
+#include "core/hle/service/pctl/module.h"
+#include "core/hle/service/pctl/pctl.h"
namespace Service::PCTL {
@@ -12,7 +13,7 @@ class IParentalControlService final : public ServiceFramework<IParentalControlSe
public:
IParentalControlService() : ServiceFramework("IParentalControlService") {
static const FunctionInfo functions[] = {
- {1, nullptr, "Initialize"},
+ {1, &IParentalControlService::Initialize, "Initialize"},
{1001, nullptr, "CheckFreeCommunicationPermission"},
{1002, nullptr, "ConfirmLaunchApplicationPermission"},
{1003, nullptr, "ConfirmResumeApplicationPermission"},
@@ -108,20 +109,38 @@ public:
};
RegisterHandlers(functions);
}
+
+private:
+ void Initialize(Kernel::HLERequestContext& ctx) {
+ NGLOG_WARNING(Service_PCTL, "(STUBBED) called");
+ IPC::ResponseBuilder rb{ctx, 2, 0, 0};
+ rb.Push(RESULT_SUCCESS);
+ }
};
-void PCTL_A::CreateService(Kernel::HLERequestContext& ctx) {
+
+void Module::Interface::CreateService(Kernel::HLERequestContext& ctx) {
+ IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+ rb.Push(RESULT_SUCCESS);
+ rb.PushIpcInterface<IParentalControlService>();
+ NGLOG_DEBUG(Service_PCTL, "called");
+}
+
+void Module::Interface::CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IParentalControlService>();
NGLOG_DEBUG(Service_PCTL, "called");
}
-PCTL_A::PCTL_A() : ServiceFramework("pctl:a") {
- static const FunctionInfo functions[] = {
- {0, &PCTL_A::CreateService, "CreateService"},
- {1, nullptr, "CreateServiceWithoutInitialize"},
- };
- RegisterHandlers(functions);
+Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
+ : ServiceFramework(name), module(std::move(module)) {}
+
+void InstallInterfaces(SM::ServiceManager& service_manager) {
+ auto module = std::make_shared<Module>();
+ std::make_shared<PCTL>(module, "pctl")->InstallAsService(service_manager);
+ std::make_shared<PCTL>(module, "pctl:a")->InstallAsService(service_manager);
+ std::make_shared<PCTL>(module, "pctl:r")->InstallAsService(service_manager);
+ std::make_shared<PCTL>(module, "pctl:s")->InstallAsService(service_manager);
}
} // namespace Service::PCTL
diff --git a/src/core/hle/service/pctl/module.h b/src/core/hle/service/pctl/module.h
new file mode 100644
index 000000000..68da628a8
--- /dev/null
+++ b/src/core/hle/service/pctl/module.h
@@ -0,0 +1,28 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "core/hle/service/service.h"
+
+namespace Service::PCTL {
+
+class Module final {
+public:
+ class Interface : public ServiceFramework<Interface> {
+ public:
+ Interface(std::shared_ptr<Module> module, const char* name);
+
+ void CreateService(Kernel::HLERequestContext& ctx);
+ void CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx);
+
+ protected:
+ std::shared_ptr<Module> module;
+ };
+};
+
+/// Registers all PCTL services with the specified service manager.
+void InstallInterfaces(SM::ServiceManager& service_manager);
+
+} // namespace Service::PCTL
diff --git a/src/core/hle/service/pctl/pctl.cpp b/src/core/hle/service/pctl/pctl.cpp
index 6ee81866d..de2741d66 100644
--- a/src/core/hle/service/pctl/pctl.cpp
+++ b/src/core/hle/service/pctl/pctl.cpp
@@ -3,12 +3,15 @@
// Refer to the license.txt file included.
#include "core/hle/service/pctl/pctl.h"
-#include "core/hle/service/pctl/pctl_a.h"
namespace Service::PCTL {
-void InstallInterfaces(SM::ServiceManager& service_manager) {
- std::make_shared<PCTL_A>()->InstallAsService(service_manager);
+PCTL::PCTL(std::shared_ptr<Module> module, const char* name)
+ : Module::Interface(std::move(module), name) {
+ static const FunctionInfo functions[] = {
+ {0, &PCTL::CreateService, "CreateService"},
+ {1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"},
+ };
+ RegisterHandlers(functions);
}
-
} // namespace Service::PCTL
diff --git a/src/core/hle/service/pctl/pctl.h b/src/core/hle/service/pctl/pctl.h
index f0a84b115..8ddf69128 100644
--- a/src/core/hle/service/pctl/pctl.h
+++ b/src/core/hle/service/pctl/pctl.h
@@ -4,11 +4,13 @@
#pragma once
-#include "core/hle/service/service.h"
+#include "core/hle/service/pctl/module.h"
namespace Service::PCTL {
-/// Registers all PCTL services with the specified service manager.
-void InstallInterfaces(SM::ServiceManager& service_manager);
+class PCTL final : public Module::Interface {
+public:
+ explicit PCTL(std::shared_ptr<Module> module, const char* name);
+};
} // namespace Service::PCTL
diff --git a/src/core/hle/service/pctl/pctl_a.h b/src/core/hle/service/pctl/pctl_a.h
deleted file mode 100644
index 09ed82e1b..000000000
--- a/src/core/hle/service/pctl/pctl_a.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2018 yuzu emulator team
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "core/hle/service/service.h"
-
-namespace Service::PCTL {
-
-class PCTL_A final : public ServiceFramework<PCTL_A> {
-public:
- PCTL_A();
- ~PCTL_A() = default;
-
-private:
- void CreateService(Kernel::HLERequestContext& ctx);
-};
-
-} // namespace Service::PCTL
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 5817819fe..a85c406be 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -29,7 +29,7 @@
#include "core/hle/service/nifm/nifm.h"
#include "core/hle/service/ns/ns.h"
#include "core/hle/service/nvdrv/nvdrv.h"
-#include "core/hle/service/pctl/pctl.h"
+#include "core/hle/service/pctl/module.h"
#include "core/hle/service/service.h"
#include "core/hle/service/set/settings.h"
#include "core/hle/service/sm/controller.h"
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index ff0420c56..d7c0080fa 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -39,8 +39,8 @@ PageTable* GetCurrentPageTable() {
}
static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, PageType type) {
- LOG_DEBUG(HW_Memory, "Mapping %p onto %016" PRIX64 "-%016" PRIX64, memory, base * PAGE_SIZE,
- (base + size) * PAGE_SIZE);
+ NGLOG_DEBUG(HW_Memory, "Mapping {} onto {:016X}-{:016X}", fmt::ptr(memory), base * PAGE_SIZE,
+ (base + size) * PAGE_SIZE);
RasterizerFlushVirtualRegion(base << PAGE_BITS, size * PAGE_SIZE,
FlushMode::FlushAndInvalidate);
@@ -169,10 +169,10 @@ T Read(const VAddr vaddr) {
PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
switch (type) {
case PageType::Unmapped:
- LOG_ERROR(HW_Memory, "unmapped Read%lu @ 0x%08X", sizeof(T) * 8, vaddr);
+ NGLOG_ERROR(HW_Memory, "Unmapped Read{} @ {:#010X}", sizeof(T) * 8, vaddr);
return 0;
case PageType::Memory:
- ASSERT_MSG(false, "Mapped memory page without a pointer @ %08X", vaddr);
+ ASSERT_MSG(false, "Mapped memory page without a pointer @ %016" PRIX64, vaddr);
break;
case PageType::RasterizerCachedMemory: {
RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Flush);
@@ -201,11 +201,11 @@ void Write(const VAddr vaddr, const T data) {
PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
switch (type) {
case PageType::Unmapped:
- LOG_ERROR(HW_Memory, "unmapped Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data,
- vaddr);
+ NGLOG_ERROR(HW_Memory, "Unmapped Write{} {:#010X} @ {:#018X}", sizeof(data) * 8, (u32)data,
+ vaddr);
return;
case PageType::Memory:
- ASSERT_MSG(false, "Mapped memory page without a pointer @ %08X", vaddr);
+ ASSERT_MSG(false, "Mapped memory page without a pointer @ %016" PRIX64, vaddr);
break;
case PageType::RasterizerCachedMemory: {
RasterizerFlushVirtualRegion(vaddr, sizeof(T), FlushMode::Invalidate);
@@ -251,7 +251,7 @@ u8* GetPointer(const VAddr vaddr) {
return GetPointerFromVMA(vaddr);
}
- LOG_ERROR(HW_Memory, "unknown GetPointer @ 0x%08x", vaddr);
+ NGLOG_ERROR(HW_Memory, "Unknown GetPointer @ {:#018X}", vaddr);
return nullptr;
}
@@ -288,13 +288,12 @@ u8* GetPhysicalPointer(PAddr address) {
});
if (area == std::end(memory_areas)) {
- LOG_ERROR(HW_Memory, "unknown GetPhysicalPointer @ 0x%016" PRIX64, address);
+ NGLOG_ERROR(HW_Memory, "Unknown GetPhysicalPointer @ {:#018X}", address);
return nullptr;
}
if (area->paddr_base == IO_AREA_PADDR) {
- LOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr=0x%016" PRIX64,
- address);
+ NGLOG_ERROR(HW_Memory, "MMIO mappings are not supported yet. phys_addr={:018X}", address);
return nullptr;
}
@@ -341,9 +340,9 @@ void RasterizerMarkRegionCached(Tegra::GPUVAddr gpu_addr, u64 size, bool cached)
Core::System::GetInstance().GPU().memory_manager->GpuToCpuAddress(gpu_addr);
// The GPU <-> CPU virtual memory mapping is not 1:1
if (!maybe_vaddr) {
- LOG_ERROR(HW_Memory,
- "Trying to flush a cached region to an invalid physical address %08X",
- gpu_addr);
+ NGLOG_ERROR(HW_Memory,
+ "Trying to flush a cached region to an invalid physical address {:016X}",
+ gpu_addr);
continue;
}
VAddr vaddr = *maybe_vaddr;
@@ -477,8 +476,9 @@ void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_
switch (page_table.attributes[page_index]) {
case PageType::Unmapped: {
- LOG_ERROR(HW_Memory, "unmapped ReadBlock @ 0x%08X (start address = 0x%08X, size = %zu)",
- current_vaddr, src_addr, size);
+ NGLOG_ERROR(HW_Memory,
+ "Unmapped ReadBlock @ {:#018X} (start address = {:#018X}, size = {})",
+ current_vaddr, src_addr, size);
std::memset(dest_buffer, 0, copy_amount);
break;
}
@@ -540,9 +540,9 @@ void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const voi
switch (page_table.attributes[page_index]) {
case PageType::Unmapped: {
- LOG_ERROR(HW_Memory,
- "unmapped WriteBlock @ 0x%08X (start address = 0x%08X, size = %zu)",
- current_vaddr, dest_addr, size);
+ NGLOG_ERROR(HW_Memory,
+ "Unmapped WriteBlock @ {:#018X} (start address = {:#018X}, size = {})",
+ current_vaddr, dest_addr, size);
break;
}
case PageType::Memory: {
@@ -588,8 +588,9 @@ void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const size
switch (page_table.attributes[page_index]) {
case PageType::Unmapped: {
- LOG_ERROR(HW_Memory, "unmapped ZeroBlock @ 0x%08X (start address = 0x%08X, size = %zu)",
- current_vaddr, dest_addr, size);
+ NGLOG_ERROR(HW_Memory,
+ "Unmapped ZeroBlock @ {:#018X} (start address = {#:018X}, size = {})",
+ current_vaddr, dest_addr, size);
break;
}
case PageType::Memory: {
@@ -628,8 +629,9 @@ void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr,
switch (page_table.attributes[page_index]) {
case PageType::Unmapped: {
- LOG_ERROR(HW_Memory, "unmapped CopyBlock @ 0x%08X (start address = 0x%08X, size = %zu)",
- current_vaddr, src_addr, size);
+ NGLOG_ERROR(HW_Memory,
+ "Unmapped CopyBlock @ {:#018X} (start address = {:#018X}, size = {})",
+ current_vaddr, src_addr, size);
ZeroBlock(process, dest_addr, copy_amount);
break;
}
@@ -678,7 +680,7 @@ boost::optional<PAddr> TryVirtualToPhysicalAddress(const VAddr addr) {
PAddr VirtualToPhysicalAddress(const VAddr addr) {
auto paddr = TryVirtualToPhysicalAddress(addr);
if (!paddr) {
- LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%016" PRIX64, addr);
+ NGLOG_ERROR(HW_Memory, "Unknown virtual address @ {:#018X}", addr);
// To help with debugging, set bit on address so that it's obviously invalid.
return addr | 0x80000000;
}