Fix GDB stub reporting of CPSR

This commit is contained in:
Jeremy Herbert 2017-03-27 22:07:19 +10:00 committed by endrift
parent fc67f3fbe4
commit 93dbae1e5f
1 changed files with 18 additions and 0 deletions

View File

@ -321,13 +321,31 @@ static void _readGPRs(struct GDBStub* stub, const char* message) {
UNUSED(message);
int r;
int i = 0;
// General purpose registers
for (r = 0; r < ARM_PC; ++r) {
_int2hex32(cpu->gprs[r], &stub->outgoing[i]);
i += 8;
}
// Program counter
_int2hex32(cpu->gprs[ARM_PC] - (cpu->cpsr.t ? WORD_SIZE_THUMB : WORD_SIZE_ARM), &stub->outgoing[i]);
i += 8;
// Floating point registers, unused on the GBA (8 of them, 24 bits each)
for (r = 0; r < 8 * 3; ++r) {
_int2hex32(0, &stub->outgoing[i]);
i += 8;
}
// Floating point status, unused on the GBA (32 bits)
_int2hex32(0, &stub->outgoing[i]);
i += 8;
// CPU status
_int2hex32(cpu->cpsr.packed, &stub->outgoing[i]);
i += 8;
stub->outgoing[i] = 0;
_sendMessage(stub);
}