Commit Graph

323 Commits

Author SHA1 Message Date
Jeffrey Pfau 8caf58ee42 ARM7: Add function for turning r15 into the address of the current instruction 2015-02-03 03:12:04 -08:00
Jeffrey Pfau e85e8968f2 ARM7: Tidy up decoder MSR and MRS instructions 2015-01-26 01:42:21 -08:00
Jeffrey Pfau 96bc5b9bc7 Debugger: Disassembly now lists PSR bitmasks (fixes #191) 2015-01-26 01:41:06 -08:00
Jeffrey Pfau 6d43fb7890 Debugger: Merge Thumb BL instructions when disassembling (fixes #133) 2015-01-18 13:28:58 -08:00
Jeffrey Pfau 293831e3bf ARM: Fix some decoder errors 2015-01-10 14:19:05 -08:00
Jeffrey Pfau 6d18b9aea5 GBA Memory: Simplify memory API and use fixed bus width 2015-01-10 01:20:21 -08:00
Jeffrey Pfau f9120b842f ARM: Create component hotplugging and use it for attaching and detaching the debugger 2015-01-07 02:05:04 -08:00
Jeffrey Pfau a6f895da7d Debugger: Align PC-relative loads in Thumb 2014-12-25 04:17:32 -08:00
Jeffrey Pfau 0a3cf87745 Debugger: Negative PC-relative loads now properly subtract the offset 2014-12-20 15:10:54 -08:00
Jeffrey Pfau 28ac288d2c ARM7: Extend prefetch by one stage 2014-12-20 05:19:16 -08:00
Jeffrey Pfau 3d21ce1fd0 ARM7: Fix LDM writeback to a register already written 2014-12-17 21:15:49 -08:00
Jeffrey Pfau f6a7fedb28 All: Add MPL 2.0 license and associated headers 2014-12-03 00:39:06 -08:00
Jeffrey Pfau 853bcec0c2 ARM: Use a more robust ROR idiom 2014-11-19 03:37:40 -08:00
Jeffrey Pfau 9e400e86da ARM: multiply wait macros should write to local variable instead of global cycle count 2014-11-19 03:37:40 -08:00
Jeffrey Pfau 3c41bd2427 ARM: Reduce size of ARM condition prediction 2014-11-19 03:37:40 -08:00
Jeffrey Pfau 845d6e1d24 ARM: Run tighter loop in CPU 2014-11-19 03:37:40 -08:00
Jeffrey Pfau 37554a40ea Add likely/unlikely macros 2014-11-18 04:37:17 -08:00
Jeffrey Pfau 6f4a6d6372 Debugger: Disassemble shifted registers in addressing mode 2 2014-11-15 17:16:11 -08:00
Jeffrey Pfau 8b44ea61ab Debugger: Fix *RBT being called *RTB 2014-11-15 17:04:34 -08:00
Jeffrey Pfau 5ace8e5023 Debugger: Fix ARM LDM/STM disassembling 2014-11-15 16:54:19 -08:00
Jeffrey Pfau 264f6f1df2 Debugger: disassemble register shifts 2014-11-15 16:32:38 -08:00
Jeffrey Pfau 537480b940 Load/Store multiple functions 2014-10-21 22:35:02 -07:00
Jeffrey Pfau f7b1cee66e Use branchType instead of branches in decoder for more expressive branch decoding 2014-10-21 00:45:06 -07:00
Jeffrey Pfau 6b382caa0f Fix decoding of {STR/LDR}[B]T 2014-10-19 03:45:11 -07:00
Jeffrey Pfau 4247db81e4 Split out macros from common.h 2014-10-11 18:18:47 -07:00
Jeffrey Pfau 8bbac2f512 Add __attribute__((unused)) to generated bitfield functions 2014-10-06 00:18:53 -07:00
Jeffrey Pfau f30a625b51 Reduce size of ARMInstructionInfo 2014-10-02 04:42:18 -07:00
Jeffrey Pfau 235141f1f3 Fix PSRs on some PPC compilers 2014-10-01 12:42:12 +00:00
Jeffrey Pfau d1f8e58b13 Attempt to stabilize PPC asm across compilers 2014-10-01 12:41:51 +00:00
Jeffrey Pfau 56a105e3da Fix addresses being truncated 2014-10-01 03:23:16 -07:00
Jeffrey Pfau 0a5a099059 Make PPC asm directives a bit more resilient to different compilers 2014-10-01 09:33:37 +00:00
Jeffrey Pfau 5afd8ea1bb The old implementation of endian swapping was sufficient, put it back 2014-10-01 00:57:52 -07:00
Jeffrey Pfau f4d27e5e40 Use new bitfields for DMAs 2014-10-01 00:17:51 -07:00
Jeffrey Pfau 7e4dc6c15c Replace dispstat assorted variables with a bitfield 2014-09-30 23:29:30 -07:00
Jeffrey Pfau 5874d416df Start replacing packed structs with flags 2014-09-30 22:50:27 -07:00
Jeffrey Pfau b6b1060676 Fix PPC asm directives on older GCCs 2014-09-30 22:03:49 -07:00
Jeffrey Pfau 6672aebfe4 Proper endian swapping on older PPC ISAs 2014-09-30 10:08:43 +00:00
Jeffrey Pfau 6cff3d423e Remove unnecessarily duplicated code in ARMStep 2014-08-29 01:41:32 -07:00
Jeffrey Pfau baa71027e3 Reimplement prefetch, temporarily removing busy loop optimization 2014-08-28 05:45:37 -07:00
Jeffrey Pfau 433f0ba360 Tighter looping for ARMRun 2014-08-28 05:00:38 -07:00
Jeffrey Pfau cbb522a702 Fix *mull, *mlal instructions in disassembler 2014-07-23 23:12:54 -07:00
Jeffrey Pfau 5477c891c5 Fix cmp and related opcodes in disassembler 2014-07-23 23:12:28 -07:00
Jeffrey Pfau 823b97603a Properly account for LDR I cycles (fixes #90) 2014-07-19 00:39:51 -07:00
Jeffrey Pfau 42484bbcc3 Allow save file to be specified externally 2014-07-16 02:57:04 -07:00
Jeffrey Pfau d8654f3b88 Use stdbool for readability 2014-07-16 01:02:34 -07:00
Jeffrey Pfau fce2fb9252 Move flags and masks into defines to avoid making enums with values that are too large 2014-07-15 23:38:44 -07:00
Jeffrey Pfau e89a705419 Revise macros for stricter C99 conformance 2014-07-15 23:30:55 -07:00
Jeffrey Pfau 939c349533 Slightly more accurate waitstate emulation 2014-07-13 22:21:37 -07:00
Jeffrey Pfau ca23c47aeb Add missing include 2014-07-13 05:47:16 -07:00
Jeffrey Pfau f74815988b Remove redundant includes 2014-07-12 04:43:41 -07:00
Jeffrey Pfau aefa5f0ab8 Merge branch 'decoder'
Conflicts:
	src/debugger/cli-debugger.c
2014-07-12 00:40:40 -07:00
Jeffrey Pfau 3261dd482c Fix should-be-zero operands being listed 2014-07-12 00:39:05 -07:00
Jeffrey Pfau b41e11d4c1 Decode MSR and MRS 2014-07-12 00:29:00 -07:00
Jeffrey Pfau a2eec31632 Show s flag for ARM instructions 2014-07-12 00:13:11 -07:00
Jeffrey Pfau d245eb3f88 Remove leftover code 2014-07-11 23:52:17 -07:00
Jeffrey Pfau 027a6f129c Fix ordering of flags and condition 2014-07-11 23:31:46 -07:00
Jeffrey Pfau a09d8649ee Begin work on ARM disassembler 2014-07-11 03:50:29 -07:00
Jeffrey Pfau ba4874f8b7 Cleaning up writeback and add some TODOs 2014-07-11 03:19:02 -07:00
Jeffrey Pfau 874f23fc59 Add mnemonics and fourth operand for ARM 2014-07-11 01:28:02 -07:00
Jeffrey Pfau 2b0dccb243 Fold direction into memory format 2014-07-11 01:27:32 -07:00
Jeffrey Pfau 45c6299b3b Fix decoding Thumb TST 2014-07-11 01:26:57 -07:00
Jeffrey Pfau 2921ba8842 Split ARM emitters into own file 2014-07-10 23:21:28 -07:00
Jeffrey Pfau fde2107a6b Fix disassembler memory boundary conditions 2014-07-10 03:31:24 -07:00
Jeffrey Pfau 64cc5ada86 Merge Thumb mnemonics into ARM mnemonics in preparation for ARM decoder 2014-07-10 03:30:59 -07:00
Jeffrey Pfau a22c89fedb Remove notion of special register 2014-07-10 02:33:16 -07:00
Jeffrey Pfau 55977796f3 Move UNUSED macro to common.h 2014-07-10 01:00:38 -07:00
Jeffrey Pfau ea656f188e Remove out-of-date TODO 2014-07-07 03:00:58 -07:00
Jeffrey Pfau e739e4000b Initialize halt 2014-04-20 01:05:29 -07:00
Jeffrey Pfau 9bf77f6653 Call ARMDeinit 2014-04-20 00:52:37 -07:00
Jeffrey Pfau 7a4ca414e5 Restructure watchpoints 2014-04-20 00:47:49 -07:00
Jeffrey Pfau 0f68dbc832 Redo component model/type punning 2014-04-20 00:19:55 -07:00
Jeffrey Pfau c0eb7c81f7 Remove ARMMemory and ARMBoard shims 2014-04-19 18:14:17 -07:00
Jeffrey Pfau 775e417cc6 Move halting functionality out of GBAHalt 2014-04-16 23:05:44 -07:00
Jeffrey Pfau ecb1939ff1 Move common headers to common.h, remove util and debugger from being first class include directories 2014-04-02 23:51:35 -07:00
Jeffrey Pfau fec4040691 Load/store with immediate width corrections 2014-03-29 23:08:32 -07:00
Jeffrey Pfau fc132b4d93 Some instructions can write to pc directly 2014-03-29 23:08:32 -07:00
Jeffrey Pfau 01d4672f56 Reclassify thumb load/store multiple instructions 2014-03-29 23:08:32 -07:00
Jeffrey Pfau 764d9740ee Fix exporting of ARMDecodeThumb 2014-03-29 23:08:32 -07:00
Jeffrey Pfau c8a2f595d4 Start cycle counting 2014-03-29 23:08:32 -07:00
Jeffrey Pfau 9b2cd97505 Split out decoder files in preparation of ARM decoder 2014-03-29 23:08:31 -07:00
Jeffrey Pfau c8e1a9cd59 PC-relative disassembling 2014-03-29 23:08:31 -07:00
Jeffrey Pfau 39e1a85ffc Implement memory decoding 2014-03-29 23:06:07 -07:00
Jeffrey Pfau f32155526b More thumb decompilation 2014-03-29 23:06:07 -07:00
Jeffrey Pfau e60cbfaf84 Begin disassembler 2014-03-29 23:06:07 -07:00
Jeffrey Pfau 58545f112e Rename decompiler to decoder 2014-03-29 22:59:40 -07:00
Jeffrey Pfau 65c1d67dfd Descriptions of all opcodes 2014-03-29 22:59:40 -07:00
Jeffrey Pfau 5d19919df2 Extract emittor macros into headers 2014-03-29 22:59:39 -07:00
Jeffrey Pfau 66d1c0c55c Start fleshing out decompiler 2014-03-29 22:59:39 -07:00
Jeffrey Pfau 5b91d6d336 Small framework for decompiler 2014-03-29 22:59:39 -07:00
Jeffrey Pfau 8e5b806cdd Have board re-read CPSR when it is modified by MSR 2014-01-27 00:21:14 -08:00
Jeffrey Pfau 2553b96e9b Skip table lookup in ARMStep if not needed 2014-01-21 23:15:51 -08:00
Jeffrey Pfau 52808da265 Inline CPU stepping 2014-01-21 22:36:40 -08:00
Jeffrey Pfau e7d4f3ae8a Fix MSR with immediate 2014-01-20 15:40:56 -08:00
Jeffrey Pfau 12f4ff6cbb Fix ARM_ROR 2014-01-20 15:40:44 -08:00
Jeffrey Pfau 2db6d27496 Implement SWP, SWPB 2014-01-20 15:19:52 -08:00
Jeffrey Pfau fede211874 Remove checks for ARM writeback operations that fail on real hardware 2014-01-20 15:10:41 -08:00
Jeffrey Pfau a969d70de3 Handle illegal and stub opcodes separately 2014-01-18 00:39:51 -08:00
Jeffrey Pfau 53a52d8cf8 Call setActiveRegion with the right address 2013-11-02 03:56:13 -07:00
Jeffrey Pfau 915b04dded Add support for PowerPC to the memory and CPU interfaces 2013-10-26 01:53:13 -04:00
Jeffrey Pfau a55b4dc87f Fix valgrind-found uninitialized values 2013-10-18 08:42:15 -07:00
Jeffrey Pfau f90b01b95d Fix setting privilege mode when entering SVC 2013-10-14 22:32:52 -07:00
Jeffrey Pfau 09a0f95ed4 Actually use GBATestIRQ 2013-10-09 01:56:59 -07:00
Jeffrey Pfau c3a7d87214 Add missing variable 2013-10-09 00:44:44 -07:00
Jeffrey Pfau 3e3bb58ae5 Minor timing fixes 2013-10-08 02:10:43 -07:00
Jeffrey Pfau 25885e1e82 Invalid memory reads 2013-09-27 23:48:56 -07:00
Jeffrey Pfau 99769695d7 Fix ADCS C bit 2013-09-26 00:25:48 -07:00
Jeffrey Pfau 13a2289e25 Fix ADCS 2013-09-25 00:27:40 -07:00
Jeffrey Pfau 6b86cdf9ef LDM should force-align loads 2013-07-31 01:59:00 -07:00
Jeffrey Pfau 425056ca15 Ensure LDM does not write back incorrectly with register list overlaps 2013-07-27 03:02:52 -07:00
Jeffrey Pfau 9e578da5a1 Do register writeback in addressing mode 2 before actual load/store 2013-07-26 23:42:45 -07:00
Jeffrey Pfau 8b1eb01a96 Fix MUL, UMULL, UMLAL 2013-07-26 01:03:34 -07:00
Jeffrey Pfau 6321b1f827 Fix ARM_CARRY_FROM 2013-07-26 00:50:20 -07:00
Jeffrey Pfau a6d87bbfb9 Better cycle counting for STR 2013-05-11 18:01:16 -07:00
Jeffrey Pfau b6361cdfa9 Start LDM/STM timings 2013-05-11 17:05:57 -07:00
Jeffrey Pfau 013e322c0b Improved cycle counting for branches 2013-05-11 14:45:31 -07:00
Jeffrey Pfau f6592b17b8 Implement MUL timings 2013-05-11 14:35:10 -07:00
Jeffrey Pfau fc7aec557b Count cycles for load/store singles 2013-05-04 23:57:12 -07:00
Jeffrey Pfau 13a46429e2 Remove -Wno-unused and fix resulting errors 2013-05-02 00:35:32 -07:00
Jeffrey Pfau a635f4de4d Implement addressing mode 1 ASR register shift 2013-05-02 00:32:04 -07:00
Jeffrey Pfau 86c228f2e4 Implement SMLAL 2013-05-02 00:29:06 -07:00
Jeffrey Pfau 61c6b7186e Implement UMLAL 2013-05-01 23:11:00 -07:00
Jeffrey Pfau cd73c562ea Implement addressing mode 1 LSL/LSR with register 2013-05-01 23:08:22 -07:00
Jeffrey Pfau da489b90f8 Ensure shifter carry-out gets bits set right 2013-04-30 21:02:56 -07:00
Jeffrey Pfau 118c393d1b Fix addressing mode 2 register post-indexed 2013-04-30 02:43:12 -07:00
Jeffrey Pfau 337d4dc1e6 Implement addressing mode 1 ROR with register 2013-04-30 02:42:54 -07:00
Jeffrey Pfau e1963c6e60 Implement SMULL 2013-04-30 01:42:24 -07:00
Jeffrey Pfau 6450ce16b2 Fix LDR(3) 2013-04-28 01:33:45 -07:00
Jeffrey Pfau e86f7d79fb Clean up and fix conditions for CPSR V 2013-04-28 00:19:15 -07:00
Jeffrey Pfau 19f9b72c33 Fix CPSR C being written 2013-04-28 00:06:13 -07:00
Jeffrey Pfau 682684cb6d Output MUL into the right register 2013-04-27 23:44:33 -07:00
Jeffrey Pfau 2c8786ae4c Use LE instead of GE where appropriate 2013-04-27 23:44:17 -07:00
Jeffrey Pfau 2e78381e55 Implement SWI 2013-04-27 02:56:34 -07:00
Jeffrey Pfau 6c44cf8dfc Implement BL 2013-04-27 02:54:16 -07:00
Jeffrey Pfau 21b9222357 Fix entering SWI mode 2013-04-27 02:50:35 -07:00
Jeffrey Pfau bd9714b540 Implement STR(2)/STRH(2) 2013-04-27 02:42:42 -07:00
Jeffrey Pfau 2fc5474d91 Implement addressing mode 1 ROR immediate 2013-04-27 01:54:57 -07:00
Jeffrey Pfau 13c95a2aae Build fixes for linux 2013-04-26 03:08:59 -07:00
Jeffrey Pfau d2e84f0a30 Implement IntrWait 2013-04-26 02:00:59 -07:00
Jeffrey Pfau 301c07dda3 Implement ADC, SBC 2013-04-26 01:25:31 -07:00
Jeffrey Pfau 65e0445375 Implement TST 2013-04-25 00:56:43 -07:00
Jeffrey Pfau cfc3ec4f3b Implement ROR 2013-04-25 00:53:24 -07:00
Jeffrey Pfau 21490dcf51 Implement CMN 2013-04-25 00:48:35 -07:00
Jeffrey Pfau 190f9b41e6 Implement STRB(2) 2013-04-23 02:13:59 -07:00
Jeffrey Pfau 67d25794e1 Fix LDMIA/STMIA 2013-04-20 18:03:59 -07:00
Jeffrey Pfau 14100f19d1 Implement LSL(2) 2013-04-20 18:03:48 -07:00
Jeffrey Pfau cb48145ea3 Move main emulation into thread 2013-04-20 15:54:09 -07:00
Jeffrey Pfau 18fae08450 Fix Load/store shifters 2013-04-20 14:21:42 -07:00
Jeffrey Pfau cd0f75c83f Implement MLA 2013-04-20 13:36:42 -07:00
Jeffrey Pfau bf54a68b0e Implement UMULL 2013-04-20 13:22:10 -07:00
Jeffrey Pfau e272481ccd Implement LDR(2) 2013-04-20 02:57:20 -07:00
Jeffrey Pfau adfd8f6872 Make sure if we reset the CPSR to the SPSR that we check if we get tossed into Thumb 2013-04-19 21:26:00 -07:00
Jeffrey Pfau 633a87269a Initialize cpu->privilegeMode 2013-04-19 21:09:00 -07:00
Jeffrey Pfau 5f1f6088bd Implement MUL 2013-04-18 01:35:48 -07:00
Jeffrey Pfau 783b2a3e09 Implement ADD(5) 2013-04-18 01:24:46 -07:00
Jeffrey Pfau 0048de2108 Fix addressing mode 3 immediate 2013-04-18 01:06:19 -07:00
Jeffrey Pfau 4f8c288f20 Ensure cpsr.t reads back out properly 2013-04-18 00:19:41 -07:00
Jeffrey Pfau ed48ab1c64 Fix storing SPSR 2013-04-18 00:15:45 -07:00
Jeffrey Pfau 062e09ccf5 Implement MSRI 2013-04-18 00:09:28 -07:00
Jeffrey Pfau fdf36f5820 Implement MRS 2013-04-18 00:06:48 -07:00
Jeffrey Pfau b3832205fc Fix some MRS/MSR encoding problems 2013-04-18 00:03:39 -07:00
Jeffrey Pfau 6608ae282c Ensure loads to PC work 2013-04-17 23:54:31 -07:00
Jeffrey Pfau cb03781a5b Implement LDM, STM 2013-04-17 23:44:35 -07:00
Jeffrey Pfau 38b1c8d235 Make sure CPSR is updated for IRQ mode properly 2013-04-17 00:29:20 -07:00
Jeffrey Pfau f30b367c7e Make sure to rewrite active region data when jumping to IRQ handler 2013-04-17 00:24:00 -07:00
Jeffrey Pfau c143dec77d Fix ADD(4) and MOV(3) 2013-04-16 23:52:30 -07:00
Jeffrey Pfau 4b4914afb6 Implement MUL 2013-04-16 23:26:49 -07:00
Jeffrey Pfau 6b07dd33af Implement ASR(1) 2013-04-16 23:24:19 -07:00
Jeffrey Pfau bc9d0690bb Clean up extra backslashes 2013-04-16 19:29:00 -07:00
Jeffrey Pfau 2d0c3bf275 Implement IRQs 2013-04-16 07:50:34 -07:00
Jeffrey Pfau 2fe2c80ae5 Add dummy renderer + frame counting infrastructure from GBA.js 2013-04-15 23:01:40 -07:00
Jeffrey Pfau 9b5d5d6478 Start implementing events + add video stubs 2013-04-15 22:18:28 -07:00
Jeffrey Pfau ecc4775c31 Start implementing instruction timing 2013-04-14 23:12:03 -07:00
Jeffrey Pfau 1ca6487151 Create subdirs 2013-04-14 13:04:24 -07:00