Implement SWI
Jeffrey Pfau jeffrey@endrift.com
Sun, 14 Apr 2013 11:57:39 -0700
4 files changed,
21 insertions(+),
1 deletions(-)
M
src/gba.c
→
src/gba.c
@@ -21,6 +21,9 @@ static void GBAStore32(struct ARMMemory* memory, uint32_t address, int32_t value);
static void GBAStore16(struct ARMMemory* memory, uint32_t address, int16_t value); static void GBAStore8(struct ARMMemory* memory, uint32_t address, int8_t value); +static void GBASwi16(struct ARMBoard* board, int immediate); +static void GBASwi32(struct ARMBoard* board, int immediate); + static void GBASetActiveRegion(struct ARMMemory* memory, uint32_t region); static void GBAHitStub(struct ARMBoard* board, uint32_t opcode);@@ -81,6 +84,8 @@ }
void GBABoardInit(struct GBABoard* board) { board->d.reset = GBABoardReset; + board->d.swi16 = GBASwi16; + board->d.swi32 = GBASwi32; board->d.hitStub = GBAHitStub; }@@ -394,6 +399,17 @@ break;
default: break; } +} + +static void GBASwi16(struct ARMBoard* board, int immediate) { + switch (immediate) { + default: + GBALog(GBA_LOG_STUB, "Stub software interrupt: %02x", immediate); + } +} + +static void GBASwi32(struct ARMBoard* board, int immediate) { + GBASwi32(board, immediate >> 8); } void GBALog(int level, const char* format, ...) {
M
src/isa-thumb.c
→
src/isa-thumb.c
@@ -410,7 +410,7 @@ } else { \
ARM_WRITE_PC; \ }) -DEFINE_INSTRUCTION_THUMB(SWI, ARM_STUB) +DEFINE_INSTRUCTION_THUMB(SWI, cpu->board->swi16(cpu->board, opcode & 0xFF)) #define DECLARE_INSTRUCTION_THUMB(EMITTER, NAME) \ EMITTER ## NAME