mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-12-26 13:16:58 +00:00
HLE: move SharedPage into Kernel
similar to config_mem, kernel is responsible for setting up this
This commit is contained in:
parent
773ec47629
commit
263290d48c
|
@ -144,6 +144,8 @@ add_library(core STATIC
|
|||
hle/kernel/session.h
|
||||
hle/kernel/shared_memory.cpp
|
||||
hle/kernel/shared_memory.h
|
||||
hle/kernel/shared_page.cpp
|
||||
hle/kernel/shared_page.h
|
||||
hle/kernel/svc.cpp
|
||||
hle/kernel/svc.h
|
||||
hle/kernel/thread.cpp
|
||||
|
@ -386,8 +388,6 @@ add_library(core STATIC
|
|||
hle/service/ssl_c.h
|
||||
hle/service/y2r_u.cpp
|
||||
hle/service/y2r_u.h
|
||||
hle/shared_page.cpp
|
||||
hle/shared_page.h
|
||||
hw/aes/arithmetic128.cpp
|
||||
hw/aes/arithmetic128.h
|
||||
hw/aes/ccm.cpp
|
||||
|
|
|
@ -194,7 +194,6 @@ System::ResultStatus System::Init(EmuWindow& emu_window, u32 system_mode) {
|
|||
#endif
|
||||
|
||||
service_manager = std::make_shared<Service::SM::ServiceManager>(*this);
|
||||
shared_page_handler = std::make_shared<SharedPage::Handler>();
|
||||
archive_manager = std::make_unique<Service::FS::ArchiveManager>(*this);
|
||||
|
||||
HW::Init();
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <string>
|
||||
#include "common/common_types.h"
|
||||
#include "core/frontend/applets/swkbd.h"
|
||||
#include "core/hle/shared_page.h"
|
||||
#include "core/loader/loader.h"
|
||||
#include "core/memory.h"
|
||||
#include "core/perf_stats.h"
|
||||
|
@ -203,10 +202,6 @@ public:
|
|||
return registered_swkbd;
|
||||
}
|
||||
|
||||
std::shared_ptr<SharedPage::Handler> GetSharedPageHandler() const {
|
||||
return shared_page_handler;
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Initialize the emulated system.
|
||||
|
@ -246,9 +241,6 @@ private:
|
|||
std::unique_ptr<RPC::RPCServer> rpc_server;
|
||||
#endif
|
||||
|
||||
/// Shared Page
|
||||
std::shared_ptr<SharedPage::Handler> shared_page_handler;
|
||||
|
||||
std::unique_ptr<Service::FS::ArchiveManager> archive_manager;
|
||||
|
||||
public: // HACK: this is temporary exposed for tests,
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#include "core/hle/kernel/memory.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/kernel/resource_limit.h"
|
||||
#include "core/hle/kernel/shared_page.h"
|
||||
#include "core/hle/kernel/thread.h"
|
||||
#include "core/hle/kernel/timer.h"
|
||||
#include "core/hle/shared_page.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
@ -64,4 +64,12 @@ const TimerManager& KernelSystem::GetTimerManager() const {
|
|||
return *timer_manager;
|
||||
}
|
||||
|
||||
SharedPage::Handler& KernelSystem::GetSharedPageHandler() {
|
||||
return *shared_page_handler;
|
||||
}
|
||||
|
||||
const SharedPage::Handler& KernelSystem::GetSharedPageHandler() const {
|
||||
return *shared_page_handler;
|
||||
}
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -16,6 +16,10 @@ namespace ConfigMem {
|
|||
class Handler;
|
||||
}
|
||||
|
||||
namespace SharedPage {
|
||||
class Handler;
|
||||
}
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class AddressArbiter;
|
||||
|
@ -202,6 +206,9 @@ public:
|
|||
|
||||
void MapSharedPages(VMManager& address_space);
|
||||
|
||||
SharedPage::Handler& GetSharedPageHandler();
|
||||
const SharedPage::Handler& GetSharedPageHandler() const;
|
||||
|
||||
private:
|
||||
void MemoryInit(u32 mem_type);
|
||||
|
||||
|
@ -221,6 +228,7 @@ private:
|
|||
std::unique_ptr<TimerManager> timer_manager;
|
||||
|
||||
std::unique_ptr<ConfigMem::Handler> config_mem_handler;
|
||||
std::unique_ptr<SharedPage::Handler> shared_page_handler;
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "core/core.h"
|
||||
#include "core/hle/kernel/config_mem.h"
|
||||
#include "core/hle/kernel/memory.h"
|
||||
#include "core/hle/kernel/shared_page.h"
|
||||
#include "core/hle/kernel/vm_manager.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/memory.h"
|
||||
|
@ -72,6 +73,8 @@ void KernelSystem::MemoryInit(u32 mem_type) {
|
|||
config_mem.app_mem_alloc = memory_region_sizes[mem_type][0];
|
||||
config_mem.sys_mem_alloc = memory_regions[1].size;
|
||||
config_mem.base_mem_alloc = memory_regions[2].size;
|
||||
|
||||
shared_page_handler = std::make_unique<SharedPage::Handler>();
|
||||
}
|
||||
|
||||
void MemoryShutdown() {
|
||||
|
@ -164,11 +167,9 @@ void KernelSystem::MapSharedPages(VMManager& address_space) {
|
|||
|
||||
auto shared_page_vma =
|
||||
address_space
|
||||
.MapBackingMemory(
|
||||
Memory::SHARED_PAGE_VADDR,
|
||||
reinterpret_cast<u8*>(
|
||||
&Core::System::GetInstance().GetSharedPageHandler()->GetSharedPage()),
|
||||
Memory::SHARED_PAGE_SIZE, MemoryState::Shared)
|
||||
.MapBackingMemory(Memory::SHARED_PAGE_VADDR,
|
||||
reinterpret_cast<u8*>(&shared_page_handler->GetSharedPage()),
|
||||
Memory::SHARED_PAGE_SIZE, MemoryState::Shared)
|
||||
.Unwrap();
|
||||
address_space.Reprotect(shared_page_vma, VMAPermission::Read);
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#include <chrono>
|
||||
#include <cstring>
|
||||
#include "core/core_timing.h"
|
||||
#include "core/hle/kernel/shared_page.h"
|
||||
#include "core/hle/service/ptm/ptm.h"
|
||||
#include "core/hle/shared_page.h"
|
||||
#include "core/movie.h"
|
||||
#include "core/settings.h"
|
||||
|
|
@ -12,7 +12,6 @@
|
|||
#include "core/hle/kernel/resource_limit.h"
|
||||
#include "core/hle/kernel/thread.h"
|
||||
#include "core/hle/kernel/timer.h"
|
||||
#include "core/hle/shared_page.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/handle_table.h"
|
||||
#include "core/hle/kernel/shared_memory.h"
|
||||
#include "core/hle/kernel/shared_page.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/hle/service/gsp/gsp_gpu.h"
|
||||
#include "core/hw/gpu.h"
|
||||
|
@ -731,7 +732,7 @@ void GSP_GPU::SetLedForceOff(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
u8 state = rp.Pop<u8>();
|
||||
|
||||
system.GetSharedPageHandler()->Set3DLed(state);
|
||||
system.Kernel().GetSharedPageHandler().Set3DLed(state);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/event.h"
|
||||
#include "core/hle/kernel/shared_memory.h"
|
||||
#include "core/hle/kernel/shared_page.h"
|
||||
#include "core/hle/lock.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/hle/service/nwm/nwm_uds.h"
|
||||
|
@ -1407,8 +1408,8 @@ NWM_UDS::NWM_UDS(Core::System& system) : ServiceFramework("nwm::UDS"), system(sy
|
|||
}
|
||||
}
|
||||
|
||||
system.GetSharedPageHandler()->SetMacAddress(mac);
|
||||
system.GetSharedPageHandler()->SetWifiLinkLevel(SharedPage::WifiLinkLevel::BEST);
|
||||
system.Kernel().GetSharedPageHandler().SetMacAddress(mac);
|
||||
system.Kernel().GetSharedPageHandler().SetWifiLinkLevel(SharedPage::WifiLinkLevel::BEST);
|
||||
}
|
||||
|
||||
NWM_UDS::~NWM_UDS() {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "core/core_timing.h"
|
||||
#include "core/hle/kernel/memory.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/shared_page.h"
|
||||
#include "core/hle/kernel/shared_page.h"
|
||||
#include "core/memory.h"
|
||||
|
||||
TEST_CASE("Memory::IsValidVirtualAddress", "[core][memory]") {
|
||||
|
|
Loading…
Reference in a new issue