Merge pull request #8521 from lat9nq/gdbstub-in-bounds

gdbstub_arch: Directly access SP register
merge-requests/60/head
Morph 2022-07-04 21:27:12 +07:00 committed by GitHub
commit 908c79881b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

@ -191,8 +191,10 @@ std::string GDBStubA64::RegRead(const Kernel::KThread* thread, size_t id) const
const auto& gprs{context.cpu_registers}; const auto& gprs{context.cpu_registers};
const auto& fprs{context.vector_registers}; const auto& fprs{context.vector_registers};
if (id <= SP_REGISTER) { if (id < SP_REGISTER) {
return ValueToHex(gprs[id]); return ValueToHex(gprs[id]);
} else if (id == SP_REGISTER) {
return ValueToHex(context.sp);
} else if (id == PC_REGISTER) { } else if (id == PC_REGISTER) {
return ValueToHex(context.pc); return ValueToHex(context.pc);
} else if (id == PSTATE_REGISTER) { } else if (id == PSTATE_REGISTER) {
@ -215,8 +217,10 @@ void GDBStubA64::RegWrite(Kernel::KThread* thread, size_t id, std::string_view v
auto& context{thread->GetContext64()}; auto& context{thread->GetContext64()};
if (id <= SP_REGISTER) { if (id < SP_REGISTER) {
context.cpu_registers[id] = HexToValue<u64>(value); context.cpu_registers[id] = HexToValue<u64>(value);
} else if (id == SP_REGISTER) {
context.sp = HexToValue<u64>(value);
} else if (id == PC_REGISTER) { } else if (id == PC_REGISTER) {
context.pc = HexToValue<u64>(value); context.pc = HexToValue<u64>(value);
} else if (id == PSTATE_REGISTER) { } else if (id == PSTATE_REGISTER) {