DS: Add SWI handling for ARM7 CPU
Jeffrey Pfau jeffrey@endrift.com
Fri, 03 Jun 2016 19:57:48 -0700
2 files changed,
15 insertions(+),
2 deletions(-)
M
src/ds/bios.c
→
src/ds/bios.c
@@ -5,7 +5,20 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "bios.h" +#include "arm/arm.h" + mLOG_DEFINE_CATEGORY(DS_BIOS, "DS BIOS"); const uint32_t DS7_BIOS_CHECKSUM = 0x1280F0D5; const uint32_t DS9_BIOS_CHECKSUM = 0x2AB23573; + +void DS7Swi16(struct ARMCore* cpu, int immediate) { + mLOG(DS_BIOS, DEBUG, "SWI7: %02X r0: %08X r1: %08X r2: %08X r3: %08X", + immediate, cpu->gprs[0], cpu->gprs[1], cpu->gprs[2], cpu->gprs[3]); + + ARMRaiseSWI(cpu); +} + +void DS7Swi32(struct ARMCore* cpu, int immediate) { + DS7Swi16(cpu, immediate >> 16); +}
M
src/ds/ds.c
→
src/ds/ds.c
@@ -104,8 +104,8 @@
void DS7InterruptHandlerInit(struct ARMInterruptHandler* irqh) { irqh->reset = DS7Reset; irqh->processEvents = DSProcessEvents; - irqh->swi16 = NULL; - irqh->swi32 = NULL; + irqh->swi16 = DS7Swi16; + irqh->swi32 = DS7Swi32; irqh->hitIllegal = DSIllegal; irqh->readCPSR = DS7TestIRQ; irqh->writeCP15 = NULL;