From 214798c3c1e4095f08b0134d0437830635251ada Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 26 Dec 2008 20:05:43 +0000 Subject: [PATCH] fix an issue which could cause an invalid SWI in thumb mode to crash the emulator --- desmume/src/thumb_instructions.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/desmume/src/thumb_instructions.cpp b/desmume/src/thumb_instructions.cpp index 1158d107f..8a275d0af 100644 --- a/desmume/src/thumb_instructions.cpp +++ b/desmume/src/thumb_instructions.cpp @@ -902,7 +902,10 @@ TEMPLATE static u32 FASTCALL OP_SWI_THUMB() } else { - u32 swinum = cpu->instruction & 0xFF; + //zero 25-dec-2008 - in arm, we were masking to 0x1F. + //this is probably safer since an invalid opcode could crash the emu + //u32 swinum = cpu->instruction & 0xFF; + u32 swinum = cpu->instruction & 0x1F; return cpu->swi_tab[swinum](cpu) + 3; } //return 3;