core/memory: Introduce skeleton of Memory class

Currently, the main memory management code is one of the remaining
places where we have global state. The next series of changes will aim
to rectify this.

This change simply introduces the main skeleton of the class that will
contain all the necessary state.
This commit is contained in:
Lioncash 2019-11-26 12:33:20 -05:00
parent 6df6caaf5f
commit 4c2ed2706e
4 changed files with 56 additions and 3 deletions

View file

@ -39,6 +39,7 @@
#include "core/hle/service/service.h"
#include "core/hle/service/sm/sm.h"
#include "core/loader/loader.h"
#include "core/memory.h"
#include "core/memory/cheat_engine.h"
#include "core/perf_stats.h"
#include "core/reporter.h"
@ -112,8 +113,8 @@ FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
}
struct System::Impl {
explicit Impl(System& system)
: kernel{system}, fs_controller{system}, cpu_core_manager{system}, reporter{system},
applet_manager{system} {}
: kernel{system}, fs_controller{system}, memory{system},
cpu_core_manager{system}, reporter{system}, applet_manager{system} {}
Cpu& CurrentCpuCore() {
return cpu_core_manager.GetCurrentCore();
@ -341,7 +342,8 @@ struct System::Impl {
std::unique_ptr<VideoCore::RendererBase> renderer;
std::unique_ptr<Tegra::GPU> gpu_core;
std::shared_ptr<Tegra::DebugContext> debug_context;
std::unique_ptr<Core::Hardware::InterruptManager> interrupt_manager;
std::unique_ptr<Hardware::InterruptManager> interrupt_manager;
Memory::Memory memory;
CpuCoreManager cpu_core_manager;
bool is_powered_on = false;
bool exit_lock = false;
@ -498,6 +500,14 @@ const ExclusiveMonitor& System::Monitor() const {
return impl->cpu_core_manager.GetExclusiveMonitor();
}
Memory::Memory& System::Memory() {
return impl->memory;
}
const Memory::Memory& System::Memory() const {
return impl->memory;
}
Tegra::GPU& System::GPU() {
return *impl->gpu_core;
}