core: Replace "AppCore" nomenclature with just "CPU".
This commit is contained in:
parent
5ac5cbeab7
commit
e26fbfd1d7
|
@ -25,7 +25,7 @@ CallstackWidget::CallstackWidget(QWidget* parent) : QDockWidget(parent) {
|
|||
|
||||
void CallstackWidget::OnDebugModeEntered() {
|
||||
// Stack pointer
|
||||
const u32 sp = Core::AppCore().GetReg(13);
|
||||
const u32 sp = Core::CPU().GetReg(13);
|
||||
|
||||
Clear();
|
||||
|
||||
|
|
|
@ -185,13 +185,13 @@ DisassemblerWidget::DisassemblerWidget(QWidget* parent, EmuThread* emu_thread)
|
|||
}
|
||||
|
||||
void DisassemblerWidget::Init() {
|
||||
model->ParseFromAddress(Core::AppCore().GetPC());
|
||||
model->ParseFromAddress(Core::CPU().GetPC());
|
||||
|
||||
disasm_ui.treeView->resizeColumnToContents(0);
|
||||
disasm_ui.treeView->resizeColumnToContents(1);
|
||||
disasm_ui.treeView->resizeColumnToContents(2);
|
||||
|
||||
QModelIndex model_index = model->IndexFromAbsoluteAddress(Core::AppCore().GetPC());
|
||||
QModelIndex model_index = model->IndexFromAbsoluteAddress(Core::CPU().GetPC());
|
||||
disasm_ui.treeView->scrollTo(model_index);
|
||||
disasm_ui.treeView->selectionModel()->setCurrentIndex(
|
||||
model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
||||
|
@ -215,7 +215,7 @@ void DisassemblerWidget::OnPause() {
|
|||
|
||||
// TODO: By now, the CPU might not have actually stopped...
|
||||
if (Core::System::GetInstance().IsPoweredOn()) {
|
||||
model->SetNextInstruction(Core::AppCore().GetPC());
|
||||
model->SetNextInstruction(Core::CPU().GetPC());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ void DisassemblerWidget::OnToggleStartStop() {
|
|||
}
|
||||
|
||||
void DisassemblerWidget::OnDebugModeEntered() {
|
||||
u32 next_instr = Core::AppCore().GetPC();
|
||||
u32 next_instr = Core::CPU().GetPC();
|
||||
|
||||
if (model->GetBreakPoints().IsAddressBreakPoint(next_instr))
|
||||
emu_thread->SetRunning(false);
|
||||
|
|
|
@ -63,11 +63,11 @@ void RegistersWidget::OnDebugModeEntered() {
|
|||
|
||||
for (int i = 0; i < core_registers->childCount(); ++i)
|
||||
core_registers->child(i)->setText(
|
||||
1, QString("0x%1").arg(Core::AppCore().GetReg(i), 8, 16, QLatin1Char('0')));
|
||||
1, QString("0x%1").arg(Core::CPU().GetReg(i), 8, 16, QLatin1Char('0')));
|
||||
|
||||
for (int i = 0; i < vfp_registers->childCount(); ++i)
|
||||
vfp_registers->child(i)->setText(
|
||||
1, QString("0x%1").arg(Core::AppCore().GetVFPReg(i), 8, 16, QLatin1Char('0')));
|
||||
1, QString("0x%1").arg(Core::CPU().GetVFPReg(i), 8, 16, QLatin1Char('0')));
|
||||
|
||||
UpdateCPSRValues();
|
||||
UpdateVFPSystemRegisterValues();
|
||||
|
@ -127,7 +127,7 @@ void RegistersWidget::CreateCPSRChildren() {
|
|||
}
|
||||
|
||||
void RegistersWidget::UpdateCPSRValues() {
|
||||
const u32 cpsr_val = Core::AppCore().GetCPSR();
|
||||
const u32 cpsr_val = Core::CPU().GetCPSR();
|
||||
|
||||
cpsr->setText(1, QString("0x%1").arg(cpsr_val, 8, 16, QLatin1Char('0')));
|
||||
cpsr->child(0)->setText(
|
||||
|
@ -191,10 +191,10 @@ void RegistersWidget::CreateVFPSystemRegisterChildren() {
|
|||
}
|
||||
|
||||
void RegistersWidget::UpdateVFPSystemRegisterValues() {
|
||||
const u32 fpscr_val = Core::AppCore().GetVFPSystemReg(VFP_FPSCR);
|
||||
const u32 fpexc_val = Core::AppCore().GetVFPSystemReg(VFP_FPEXC);
|
||||
const u32 fpinst_val = Core::AppCore().GetVFPSystemReg(VFP_FPINST);
|
||||
const u32 fpinst2_val = Core::AppCore().GetVFPSystemReg(VFP_FPINST2);
|
||||
const u32 fpscr_val = Core::CPU().GetVFPSystemReg(VFP_FPSCR);
|
||||
const u32 fpexc_val = Core::CPU().GetVFPSystemReg(VFP_FPEXC);
|
||||
const u32 fpinst_val = Core::CPU().GetVFPSystemReg(VFP_FPINST);
|
||||
const u32 fpinst2_val = Core::CPU().GetVFPSystemReg(VFP_FPINST2);
|
||||
|
||||
QTreeWidgetItem* const fpscr = vfp_system_registers->child(0);
|
||||
fpscr->setText(1, QString("0x%1").arg(fpscr_val, 8, 16, QLatin1Char('0')));
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Core {
|
|||
/*static*/ System System::s_instance;
|
||||
|
||||
System::ResultStatus System::RunLoop(int tight_loop) {
|
||||
if (!app_core) {
|
||||
if (!cpu_core) {
|
||||
return ResultStatus::ErrorNotInitialized;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ System::ResultStatus System::RunLoop(int tight_loop) {
|
|||
CoreTiming::Advance();
|
||||
PrepareReschedule();
|
||||
} else {
|
||||
app_core->Run(tight_loop);
|
||||
cpu_core->Run(tight_loop);
|
||||
}
|
||||
|
||||
HW::Update();
|
||||
|
@ -109,7 +109,7 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
|
|||
}
|
||||
|
||||
void System::PrepareReschedule() {
|
||||
app_core->PrepareReschedule();
|
||||
cpu_core->PrepareReschedule();
|
||||
reschedule_pending = true;
|
||||
}
|
||||
|
||||
|
@ -123,16 +123,16 @@ void System::Reschedule() {
|
|||
}
|
||||
|
||||
System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
|
||||
if (app_core) {
|
||||
app_core.reset();
|
||||
if (cpu_core) {
|
||||
cpu_core.reset();
|
||||
}
|
||||
|
||||
Memory::Init();
|
||||
|
||||
if (Settings::values.use_cpu_jit) {
|
||||
app_core = std::make_unique<ARM_Dynarmic>(USER32MODE);
|
||||
cpu_core = std::make_unique<ARM_Dynarmic>(USER32MODE);
|
||||
} else {
|
||||
app_core = std::make_unique<ARM_DynCom>(USER32MODE);
|
||||
cpu_core = std::make_unique<ARM_DynCom>(USER32MODE);
|
||||
}
|
||||
|
||||
CoreTiming::Init();
|
||||
|
|
|
@ -88,18 +88,18 @@ public:
|
|||
* @returns True if the emulated system is powered on, otherwise false.
|
||||
*/
|
||||
bool IsPoweredOn() const {
|
||||
return app_core != nullptr;
|
||||
return cpu_core != nullptr;
|
||||
}
|
||||
|
||||
/// Prepare the core emulation for a reschedule
|
||||
void PrepareReschedule();
|
||||
|
||||
/**
|
||||
* Gets a reference to the emulated AppCore CPU.
|
||||
* @returns A reference to the emulated AppCore CPU.
|
||||
* Gets a reference to the emulated CPU.
|
||||
* @returns A reference to the emulated CPU.
|
||||
*/
|
||||
ARM_Interface& AppCore() {
|
||||
return *app_core;
|
||||
ARM_Interface& CPU() {
|
||||
return *cpu_core;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -117,8 +117,8 @@ private:
|
|||
/// AppLoader used to load the current executing application
|
||||
std::unique_ptr<Loader::AppLoader> app_loader;
|
||||
|
||||
///< ARM11 application core
|
||||
std::unique_ptr<ARM_Interface> app_core;
|
||||
///< ARM11 CPU core
|
||||
std::unique_ptr<ARM_Interface> cpu_core;
|
||||
|
||||
/// When true, signals that a reschedule should happen
|
||||
bool reschedule_pending{};
|
||||
|
@ -126,8 +126,8 @@ private:
|
|||
static System s_instance;
|
||||
};
|
||||
|
||||
static ARM_Interface& AppCore() {
|
||||
return System::GetInstance().AppCore();
|
||||
static ARM_Interface& CPU() {
|
||||
return System::GetInstance().CPU();
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
|
|
@ -146,7 +146,7 @@ void UnregisterAllEvents() {
|
|||
}
|
||||
|
||||
void Init() {
|
||||
Core::AppCore().down_count = INITIAL_SLICE_LENGTH;
|
||||
Core::CPU().down_count = INITIAL_SLICE_LENGTH;
|
||||
g_slice_length = INITIAL_SLICE_LENGTH;
|
||||
global_timer = 0;
|
||||
idled_cycles = 0;
|
||||
|
@ -186,7 +186,7 @@ void Shutdown() {
|
|||
}
|
||||
|
||||
u64 GetTicks() {
|
||||
return (u64)global_timer + g_slice_length - Core::AppCore().down_count;
|
||||
return (u64)global_timer + g_slice_length - Core::CPU().down_count;
|
||||
}
|
||||
|
||||
u64 GetIdleTicks() {
|
||||
|
@ -460,18 +460,18 @@ void MoveEvents() {
|
|||
}
|
||||
|
||||
void ForceCheck() {
|
||||
s64 cycles_executed = g_slice_length - Core::AppCore().down_count;
|
||||
s64 cycles_executed = g_slice_length - Core::CPU().down_count;
|
||||
global_timer += cycles_executed;
|
||||
// This will cause us to check for new events immediately.
|
||||
Core::AppCore().down_count = 0;
|
||||
Core::CPU().down_count = 0;
|
||||
// But let's not eat a bunch more time in Advance() because of this.
|
||||
g_slice_length = 0;
|
||||
}
|
||||
|
||||
void Advance() {
|
||||
s64 cycles_executed = g_slice_length - Core::AppCore().down_count;
|
||||
s64 cycles_executed = g_slice_length - Core::CPU().down_count;
|
||||
global_timer += cycles_executed;
|
||||
Core::AppCore().down_count = g_slice_length;
|
||||
Core::CPU().down_count = g_slice_length;
|
||||
|
||||
if (has_ts_events)
|
||||
MoveEvents();
|
||||
|
@ -480,7 +480,7 @@ void Advance() {
|
|||
if (!first) {
|
||||
if (g_slice_length < 10000) {
|
||||
g_slice_length += 10000;
|
||||
Core::AppCore().down_count += g_slice_length;
|
||||
Core::CPU().down_count += g_slice_length;
|
||||
}
|
||||
} else {
|
||||
// Note that events can eat cycles as well.
|
||||
|
@ -490,7 +490,7 @@ void Advance() {
|
|||
|
||||
const int diff = target - g_slice_length;
|
||||
g_slice_length += diff;
|
||||
Core::AppCore().down_count += diff;
|
||||
Core::CPU().down_count += diff;
|
||||
}
|
||||
if (advance_callback)
|
||||
advance_callback(static_cast<int>(cycles_executed));
|
||||
|
@ -506,12 +506,12 @@ void LogPendingEvents() {
|
|||
}
|
||||
|
||||
void Idle(int max_idle) {
|
||||
s64 cycles_down = Core::AppCore().down_count;
|
||||
s64 cycles_down = Core::CPU().down_count;
|
||||
if (max_idle != 0 && cycles_down > max_idle)
|
||||
cycles_down = max_idle;
|
||||
|
||||
if (first && cycles_down > 0) {
|
||||
s64 cycles_executed = g_slice_length - Core::AppCore().down_count;
|
||||
s64 cycles_executed = g_slice_length - Core::CPU().down_count;
|
||||
s64 cycles_next_event = first->time - global_timer;
|
||||
|
||||
if (cycles_next_event < cycles_executed + cycles_down) {
|
||||
|
@ -526,9 +526,9 @@ void Idle(int max_idle) {
|
|||
cycles_down / (float)(g_clock_rate_arm11 * 0.001f));
|
||||
|
||||
idled_cycles += cycles_down;
|
||||
Core::AppCore().down_count -= cycles_down;
|
||||
if (Core::AppCore().down_count == 0)
|
||||
Core::AppCore().down_count = -1;
|
||||
Core::CPU().down_count -= cycles_down;
|
||||
if (Core::CPU().down_count == 0)
|
||||
Core::CPU().down_count = -1;
|
||||
}
|
||||
|
||||
std::string GetScheduledEventsSummary() {
|
||||
|
|
|
@ -450,9 +450,9 @@ static void SendSignal(u32 signal) {
|
|||
|
||||
latest_signal = signal;
|
||||
|
||||
std::string buffer = Common::StringFromFormat("T%02x%02x:%08x;%02x:%08x;", latest_signal, 15,
|
||||
htonl(Core::AppCore().GetPC()), 13,
|
||||
htonl(Core::AppCore().GetReg(13)));
|
||||
std::string buffer =
|
||||
Common::StringFromFormat("T%02x%02x:%08x;%02x:%08x;", latest_signal, 15,
|
||||
htonl(Core::CPU().GetPC()), 13, htonl(Core::CPU().GetReg(13)));
|
||||
LOG_DEBUG(Debug_GDBStub, "Response: %s", buffer.c_str());
|
||||
SendReply(buffer.c_str());
|
||||
}
|
||||
|
@ -539,15 +539,15 @@ static void ReadRegister() {
|
|||
}
|
||||
|
||||
if (id <= R15_REGISTER) {
|
||||
IntToGdbHex(reply, Core::AppCore().GetReg(id));
|
||||
IntToGdbHex(reply, Core::CPU().GetReg(id));
|
||||
} else if (id == CPSR_REGISTER) {
|
||||
IntToGdbHex(reply, Core::AppCore().GetCPSR());
|
||||
IntToGdbHex(reply, Core::CPU().GetCPSR());
|
||||
} else if (id > CPSR_REGISTER && id < FPSCR_REGISTER) {
|
||||
IntToGdbHex(reply, Core::AppCore().GetVFPReg(
|
||||
IntToGdbHex(reply, Core::CPU().GetVFPReg(
|
||||
id - CPSR_REGISTER -
|
||||
1)); // VFP registers should start at 26, so one after CSPR_REGISTER
|
||||
} else if (id == FPSCR_REGISTER) {
|
||||
IntToGdbHex(reply, Core::AppCore().GetVFPSystemReg(VFP_FPSCR)); // Get FPSCR
|
||||
IntToGdbHex(reply, Core::CPU().GetVFPSystemReg(VFP_FPSCR)); // Get FPSCR
|
||||
IntToGdbHex(reply + 8, 0);
|
||||
} else {
|
||||
return SendReply("E01");
|
||||
|
@ -564,22 +564,22 @@ static void ReadRegisters() {
|
|||
u8* bufptr = buffer;
|
||||
|
||||
for (int reg = 0; reg <= R15_REGISTER; reg++) {
|
||||
IntToGdbHex(bufptr + reg * CHAR_BIT, Core::AppCore().GetReg(reg));
|
||||
IntToGdbHex(bufptr + reg * CHAR_BIT, Core::CPU().GetReg(reg));
|
||||
}
|
||||
|
||||
bufptr += (16 * CHAR_BIT);
|
||||
|
||||
IntToGdbHex(bufptr, Core::AppCore().GetCPSR());
|
||||
IntToGdbHex(bufptr, Core::CPU().GetCPSR());
|
||||
|
||||
bufptr += CHAR_BIT;
|
||||
|
||||
for (int reg = 0; reg <= 31; reg++) {
|
||||
IntToGdbHex(bufptr + reg * CHAR_BIT, Core::AppCore().GetVFPReg(reg));
|
||||
IntToGdbHex(bufptr + reg * CHAR_BIT, Core::CPU().GetVFPReg(reg));
|
||||
}
|
||||
|
||||
bufptr += (32 * CHAR_BIT);
|
||||
|
||||
IntToGdbHex(bufptr, Core::AppCore().GetVFPSystemReg(VFP_FPSCR));
|
||||
IntToGdbHex(bufptr, Core::CPU().GetVFPSystemReg(VFP_FPSCR));
|
||||
|
||||
SendReply(reinterpret_cast<char*>(buffer));
|
||||
}
|
||||
|
@ -596,13 +596,13 @@ static void WriteRegister() {
|
|||
}
|
||||
|
||||
if (id <= R15_REGISTER) {
|
||||
Core::AppCore().SetReg(id, GdbHexToInt(buffer_ptr));
|
||||
Core::CPU().SetReg(id, GdbHexToInt(buffer_ptr));
|
||||
} else if (id == CPSR_REGISTER) {
|
||||
Core::AppCore().SetCPSR(GdbHexToInt(buffer_ptr));
|
||||
Core::CPU().SetCPSR(GdbHexToInt(buffer_ptr));
|
||||
} else if (id > CPSR_REGISTER && id < FPSCR_REGISTER) {
|
||||
Core::AppCore().SetVFPReg(id - CPSR_REGISTER - 1, GdbHexToInt(buffer_ptr));
|
||||
Core::CPU().SetVFPReg(id - CPSR_REGISTER - 1, GdbHexToInt(buffer_ptr));
|
||||
} else if (id == FPSCR_REGISTER) {
|
||||
Core::AppCore().SetVFPSystemReg(VFP_FPSCR, GdbHexToInt(buffer_ptr));
|
||||
Core::CPU().SetVFPSystemReg(VFP_FPSCR, GdbHexToInt(buffer_ptr));
|
||||
} else {
|
||||
return SendReply("E01");
|
||||
}
|
||||
|
@ -619,20 +619,19 @@ static void WriteRegisters() {
|
|||
|
||||
for (int i = 0, reg = 0; reg <= FPSCR_REGISTER; i++, reg++) {
|
||||
if (reg <= R15_REGISTER) {
|
||||
Core::AppCore().SetReg(reg, GdbHexToInt(buffer_ptr + i * CHAR_BIT));
|
||||
Core::CPU().SetReg(reg, GdbHexToInt(buffer_ptr + i * CHAR_BIT));
|
||||
} else if (reg == CPSR_REGISTER) {
|
||||
Core::AppCore().SetCPSR(GdbHexToInt(buffer_ptr + i * CHAR_BIT));
|
||||
Core::CPU().SetCPSR(GdbHexToInt(buffer_ptr + i * CHAR_BIT));
|
||||
} else if (reg == CPSR_REGISTER - 1) {
|
||||
// Dummy FPA register, ignore
|
||||
} else if (reg < CPSR_REGISTER) {
|
||||
// Dummy FPA registers, ignore
|
||||
i += 2;
|
||||
} else if (reg > CPSR_REGISTER && reg < FPSCR_REGISTER) {
|
||||
Core::AppCore().SetVFPReg(reg - CPSR_REGISTER - 1,
|
||||
GdbHexToInt(buffer_ptr + i * CHAR_BIT));
|
||||
Core::CPU().SetVFPReg(reg - CPSR_REGISTER - 1, GdbHexToInt(buffer_ptr + i * CHAR_BIT));
|
||||
i++; // Skip padding
|
||||
} else if (reg == FPSCR_REGISTER) {
|
||||
Core::AppCore().SetVFPSystemReg(VFP_FPSCR, GdbHexToInt(buffer_ptr + i * CHAR_BIT));
|
||||
Core::CPU().SetVFPSystemReg(VFP_FPSCR, GdbHexToInt(buffer_ptr + i * CHAR_BIT));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
namespace HLE {
|
||||
|
||||
#define PARAM(n) Core::AppCore().GetReg(n)
|
||||
#define PARAM(n) Core::CPU().GetReg(n)
|
||||
|
||||
/// An invalid result code that is meant to be overwritten when a thread resumes from waiting
|
||||
static const ResultCode RESULT_INVALID(0xDEADC0DE);
|
||||
|
@ -24,7 +24,7 @@ static const ResultCode RESULT_INVALID(0xDEADC0DE);
|
|||
* @param res Result to return
|
||||
*/
|
||||
static inline void FuncReturn(u32 res) {
|
||||
Core::AppCore().SetReg(0, res);
|
||||
Core::CPU().SetReg(0, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,8 +33,8 @@ static inline void FuncReturn(u32 res) {
|
|||
* @todo Verify that this function is correct
|
||||
*/
|
||||
static inline void FuncReturn64(u64 res) {
|
||||
Core::AppCore().SetReg(0, (u32)(res & 0xFFFFFFFF));
|
||||
Core::AppCore().SetReg(1, (u32)((res >> 32) & 0xFFFFFFFF));
|
||||
Core::CPU().SetReg(0, (u32)(res & 0xFFFFFFFF));
|
||||
Core::CPU().SetReg(1, (u32)((res >> 32) & 0xFFFFFFFF));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -49,7 +49,7 @@ template <ResultCode func(u32*, u32, u32, u32, u32, u32)>
|
|||
void Wrap() {
|
||||
u32 param_1 = 0;
|
||||
u32 retval = func(¶m_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)).raw;
|
||||
Core::AppCore().SetReg(1, param_1);
|
||||
Core::CPU().SetReg(1, param_1);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ template <ResultCode func(u32*, s32, u32, u32, u32, s32)>
|
|||
void Wrap() {
|
||||
u32 param_1 = 0;
|
||||
u32 retval = func(¶m_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)).raw;
|
||||
Core::AppCore().SetReg(1, param_1);
|
||||
Core::CPU().SetReg(1, param_1);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ void Wrap() {
|
|||
.raw;
|
||||
|
||||
if (retval != RESULT_INVALID.raw) {
|
||||
Core::AppCore().SetReg(1, (u32)param_1);
|
||||
Core::CPU().SetReg(1, (u32)param_1);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ template <ResultCode func(u32*)>
|
|||
void Wrap() {
|
||||
u32 param_1 = 0;
|
||||
u32 retval = func(¶m_1).raw;
|
||||
Core::AppCore().SetReg(1, param_1);
|
||||
Core::CPU().SetReg(1, param_1);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -102,11 +102,11 @@ void Wrap() {
|
|||
MemoryInfo memory_info = {};
|
||||
PageInfo page_info = {};
|
||||
u32 retval = func(&memory_info, &page_info, PARAM(2)).raw;
|
||||
Core::AppCore().SetReg(1, memory_info.base_address);
|
||||
Core::AppCore().SetReg(2, memory_info.size);
|
||||
Core::AppCore().SetReg(3, memory_info.permission);
|
||||
Core::AppCore().SetReg(4, memory_info.state);
|
||||
Core::AppCore().SetReg(5, page_info.flags);
|
||||
Core::CPU().SetReg(1, memory_info.base_address);
|
||||
Core::CPU().SetReg(2, memory_info.size);
|
||||
Core::CPU().SetReg(3, memory_info.permission);
|
||||
Core::CPU().SetReg(4, memory_info.state);
|
||||
Core::CPU().SetReg(5, page_info.flags);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -115,11 +115,11 @@ void Wrap() {
|
|||
MemoryInfo memory_info = {};
|
||||
PageInfo page_info = {};
|
||||
u32 retval = func(&memory_info, &page_info, PARAM(2), PARAM(3)).raw;
|
||||
Core::AppCore().SetReg(1, memory_info.base_address);
|
||||
Core::AppCore().SetReg(2, memory_info.size);
|
||||
Core::AppCore().SetReg(3, memory_info.permission);
|
||||
Core::AppCore().SetReg(4, memory_info.state);
|
||||
Core::AppCore().SetReg(5, page_info.flags);
|
||||
Core::CPU().SetReg(1, memory_info.base_address);
|
||||
Core::CPU().SetReg(2, memory_info.size);
|
||||
Core::CPU().SetReg(3, memory_info.permission);
|
||||
Core::CPU().SetReg(4, memory_info.state);
|
||||
Core::CPU().SetReg(5, page_info.flags);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ template <ResultCode func(s32*, u32)>
|
|||
void Wrap() {
|
||||
s32 param_1 = 0;
|
||||
u32 retval = func(¶m_1, PARAM(1)).raw;
|
||||
Core::AppCore().SetReg(1, param_1);
|
||||
Core::CPU().SetReg(1, param_1);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ template <ResultCode func(u32*, u32)>
|
|||
void Wrap() {
|
||||
u32 param_1 = 0;
|
||||
u32 retval = func(¶m_1, PARAM(1)).raw;
|
||||
Core::AppCore().SetReg(1, param_1);
|
||||
Core::CPU().SetReg(1, param_1);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ template <ResultCode func(u32*, const char*)>
|
|||
void Wrap() {
|
||||
u32 param_1 = 0;
|
||||
u32 retval = func(¶m_1, (char*)Memory::GetPointer(PARAM(1))).raw;
|
||||
Core::AppCore().SetReg(1, param_1);
|
||||
Core::CPU().SetReg(1, param_1);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ template <ResultCode func(u32*, s32, s32)>
|
|||
void Wrap() {
|
||||
u32 param_1 = 0;
|
||||
u32 retval = func(¶m_1, PARAM(1), PARAM(2)).raw;
|
||||
Core::AppCore().SetReg(1, param_1);
|
||||
Core::CPU().SetReg(1, param_1);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ template <ResultCode func(s32*, u32, s32)>
|
|||
void Wrap() {
|
||||
s32 param_1 = 0;
|
||||
u32 retval = func(¶m_1, PARAM(1), PARAM(2)).raw;
|
||||
Core::AppCore().SetReg(1, param_1);
|
||||
Core::CPU().SetReg(1, param_1);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -184,8 +184,8 @@ template <ResultCode func(s64*, u32, s32)>
|
|||
void Wrap() {
|
||||
s64 param_1 = 0;
|
||||
u32 retval = func(¶m_1, PARAM(1), PARAM(2)).raw;
|
||||
Core::AppCore().SetReg(1, (u32)param_1);
|
||||
Core::AppCore().SetReg(2, (u32)(param_1 >> 32));
|
||||
Core::CPU().SetReg(1, (u32)param_1);
|
||||
Core::CPU().SetReg(2, (u32)(param_1 >> 32));
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ void Wrap() {
|
|||
u32 param_1 = 0;
|
||||
// The last parameter is passed in R0 instead of R4
|
||||
u32 retval = func(¶m_1, PARAM(1), PARAM(2), PARAM(3), PARAM(0)).raw;
|
||||
Core::AppCore().SetReg(1, param_1);
|
||||
Core::CPU().SetReg(1, param_1);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -209,8 +209,8 @@ template <ResultCode func(s64*, Kernel::Handle, u32)>
|
|||
void Wrap() {
|
||||
s64 param_1 = 0;
|
||||
u32 retval = func(¶m_1, PARAM(1), PARAM(2)).raw;
|
||||
Core::AppCore().SetReg(1, (u32)param_1);
|
||||
Core::AppCore().SetReg(2, (u32)(param_1 >> 32));
|
||||
Core::CPU().SetReg(1, (u32)param_1);
|
||||
Core::CPU().SetReg(2, (u32)(param_1 >> 32));
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
@ -227,8 +227,8 @@ void Wrap() {
|
|||
reinterpret_cast<const char*>(Memory::GetPointer(PARAM(2))), PARAM(3))
|
||||
.raw;
|
||||
// The first out parameter is moved into R2 and the second is moved into R1.
|
||||
Core::AppCore().SetReg(1, param_2);
|
||||
Core::AppCore().SetReg(2, param_1);
|
||||
Core::CPU().SetReg(1, param_2);
|
||||
Core::CPU().SetReg(2, param_1);
|
||||
FuncReturn(retval);
|
||||
}
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ static void SwitchContext(Thread* new_thread) {
|
|||
// Save context for previous thread
|
||||
if (previous_thread) {
|
||||
previous_thread->last_running_ticks = CoreTiming::GetTicks();
|
||||
Core::AppCore().SaveContext(previous_thread->context);
|
||||
Core::CPU().SaveContext(previous_thread->context);
|
||||
|
||||
if (previous_thread->status == THREADSTATUS_RUNNING) {
|
||||
// This is only the case when a reschedule is triggered without the current thread
|
||||
|
@ -213,8 +213,8 @@ static void SwitchContext(Thread* new_thread) {
|
|||
// Restores thread to its nominal priority if it has been temporarily changed
|
||||
new_thread->current_priority = new_thread->nominal_priority;
|
||||
|
||||
Core::AppCore().LoadContext(new_thread->context);
|
||||
Core::AppCore().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress());
|
||||
Core::CPU().LoadContext(new_thread->context);
|
||||
Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress());
|
||||
} else {
|
||||
current_thread = nullptr;
|
||||
}
|
||||
|
|
|
@ -457,7 +457,7 @@ static void LoadCRO(Interface* self, bool link_on_load_bug_fix) {
|
|||
}
|
||||
}
|
||||
|
||||
Core::AppCore().ClearInstructionCache();
|
||||
Core::CPU().ClearInstructionCache();
|
||||
|
||||
LOG_INFO(Service_LDR, "CRO \"%s\" loaded at 0x%08X, fixed_end=0x%08X", cro.ModuleName().data(),
|
||||
cro_address, cro_address + fix_size);
|
||||
|
@ -562,7 +562,7 @@ static void UnloadCRO(Interface* self) {
|
|||
memory_synchronizer.RemoveMemoryBlock(cro_address, cro_buffer_ptr);
|
||||
}
|
||||
|
||||
Core::AppCore().ClearInstructionCache();
|
||||
Core::CPU().ClearInstructionCache();
|
||||
|
||||
cmd_buff[1] = result.raw;
|
||||
}
|
||||
|
@ -624,7 +624,7 @@ static void LinkCRO(Interface* self) {
|
|||
}
|
||||
|
||||
memory_synchronizer.SynchronizeOriginalMemory();
|
||||
Core::AppCore().ClearInstructionCache();
|
||||
Core::CPU().ClearInstructionCache();
|
||||
|
||||
cmd_buff[1] = result.raw;
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ static void UnlinkCRO(Interface* self) {
|
|||
}
|
||||
|
||||
memory_synchronizer.SynchronizeOriginalMemory();
|
||||
Core::AppCore().ClearInstructionCache();
|
||||
Core::CPU().ClearInstructionCache();
|
||||
|
||||
cmd_buff[1] = result.raw;
|
||||
}
|
||||
|
|
|
@ -583,7 +583,7 @@ static ResultCode CreateThread(Kernel::Handle* out_handle, s32 priority, u32 ent
|
|||
|
||||
/// Called when a thread exits
|
||||
static void ExitThread() {
|
||||
LOG_TRACE(Kernel_SVC, "called, pc=0x%08X", Core::AppCore().GetPC());
|
||||
LOG_TRACE(Kernel_SVC, "called, pc=0x%08X", Core::CPU().GetPC());
|
||||
|
||||
Kernel::ExitCurrentThread();
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ static ResultCode CreateMutex(Kernel::Handle* out_handle, u32 initial_locked) {
|
|||
using Kernel::Mutex;
|
||||
|
||||
SharedPtr<Mutex> mutex = Mutex::Create(initial_locked != 0);
|
||||
mutex->name = Common::StringFromFormat("mutex-%08x", Core::AppCore().GetReg(14));
|
||||
mutex->name = Common::StringFromFormat("mutex-%08x", Core::CPU().GetReg(14));
|
||||
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(mutex)));
|
||||
|
||||
LOG_TRACE(Kernel_SVC, "called initial_locked=%s : created handle=0x%08X",
|
||||
|
@ -684,7 +684,7 @@ static ResultCode CreateSemaphore(Kernel::Handle* out_handle, s32 initial_count,
|
|||
using Kernel::Semaphore;
|
||||
|
||||
CASCADE_RESULT(SharedPtr<Semaphore> semaphore, Semaphore::Create(initial_count, max_count));
|
||||
semaphore->name = Common::StringFromFormat("semaphore-%08x", Core::AppCore().GetReg(14));
|
||||
semaphore->name = Common::StringFromFormat("semaphore-%08x", Core::CPU().GetReg(14));
|
||||
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(semaphore)));
|
||||
|
||||
LOG_TRACE(Kernel_SVC, "called initial_count=%d, max_count=%d, created handle=0x%08X",
|
||||
|
@ -741,7 +741,7 @@ static ResultCode CreateEvent(Kernel::Handle* out_handle, u32 reset_type) {
|
|||
using Kernel::Event;
|
||||
|
||||
SharedPtr<Event> evt = Event::Create(static_cast<Kernel::ResetType>(reset_type));
|
||||
evt->name = Common::StringFromFormat("event-%08x", Core::AppCore().GetReg(14));
|
||||
evt->name = Common::StringFromFormat("event-%08x", Core::CPU().GetReg(14));
|
||||
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(evt)));
|
||||
|
||||
LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type,
|
||||
|
@ -788,7 +788,7 @@ static ResultCode CreateTimer(Kernel::Handle* out_handle, u32 reset_type) {
|
|||
using Kernel::Timer;
|
||||
|
||||
SharedPtr<Timer> timer = Timer::Create(static_cast<Kernel::ResetType>(reset_type));
|
||||
timer->name = Common::StringFromFormat("timer-%08x", Core::AppCore().GetReg(14));
|
||||
timer->name = Common::StringFromFormat("timer-%08x", Core::CPU().GetReg(14));
|
||||
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(timer)));
|
||||
|
||||
LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type,
|
||||
|
@ -855,8 +855,7 @@ static void SleepThread(s64 nanoseconds) {
|
|||
static s64 GetSystemTick() {
|
||||
s64 result = CoreTiming::GetTicks();
|
||||
// Advance time to defeat dumb games (like Cubic Ninja) that busy-wait for the frame to end.
|
||||
Core::AppCore().AddTicks(
|
||||
150); // Measured time between two calls on a 9.2 o3DS with Ninjhax 1.1b
|
||||
Core::CPU().AddTicks(150); // Measured time between two calls on a 9.2 o3DS with Ninjhax 1.1b
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue