mirror of
https://github.com/RKX1209/nsemu.git
synced 2024-06-15 18:57:39 -04:00
30 lines
688 B
C++
30 lines
688 B
C++
/* nsemu - LGPL - Copyright 2017 rkx1209<rkx1209dev@gmail.com> */
|
|
#include <thread>
|
|
#include "Nsemu.hpp"
|
|
|
|
Nsemu *Nsemu::inst = nullptr;
|
|
static std::thread cpu_thread;
|
|
|
|
static void LoadNso(Nsemu *nsemu, string path) {
|
|
Nso nso (path);
|
|
nso.load (nsemu);
|
|
}
|
|
|
|
static void CpuThread() {
|
|
ns_print ("[CPU]\tLaunching ARMv8::VCPU.....\n");
|
|
Cpu::Init ();
|
|
Cpu::SetState (Cpu::State::Running);
|
|
ns_print ("[CPU]\tRunning.....\n");
|
|
Cpu::Run ();
|
|
}
|
|
|
|
bool Nsemu::BootUp(const std::string& path) {
|
|
ns_print ("Booting... %s\n", path.c_str ());
|
|
Memory::InitMemmap (this);
|
|
LoadNso (this, path);
|
|
cpu_thread = std::thread (CpuThread);
|
|
/* Run cpu */
|
|
cpu_thread.join ();
|
|
return true;
|
|
}
|