src/musashi/example/history.txt

Tue, 15 Nov 2011 10:12:37 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Tue, 15 Nov 2011 10:12:37 +0000
changeset 109
2f8afb9e5baa
parent 0
8bf1bf91a36d
permissions
-rw-r--r--

[musashi] Fix handling of bus errors

Patch-Author: Andrew Warkentin <andreww591!gmail>
Patch-MessageID: <4EC200CE.2020304@gmail.com>

I have fixed the first page fault test failure in FreeBee (the page fault test now hangs rather than errors out, because it is trying to read from the hard drive to test DMA page faults).

There were actually two bugs (the first bug was masking the second one).

First, the ancient version of Musashi that you used is unable to properly resume from bus errors that happen in the middle of certain instructions (some instructions are fetched in stages, with the PC being advanced to each part of the instruction, so basically what happens is the CPU core attempts to read the memory location referenced by the first operand, the bus error occurs, causing the PC to jump to the exception vector, but the faulting instruction is still in the middle of being fetched, so the PC is then advanced past the beginning of the exception handler). I fixed this by delaying the jump to the bus error vector until after the faulting instruction finishes.

The second bug is simpler - you had the UDS and LDS bits in BSR0 inverted (they are supposed to be active low).

philpem@0 1 The history of Musashi for anyone who might be interested:
philpem@0 2 ---------------------------------------------------------
philpem@0 3
philpem@0 4 Musashi was born out of sheer boredom.
philpem@0 5 I needed something to code, and so having had fun with a few of the emulators
philpem@0 6 around, I decided to try my hand at CPU emulation.
philpem@0 7 I had owned an Amiga for many years and had done some assembly coding on it so
philpem@0 8 I figured it would be the ideal chip to cut my teeth on.
philpem@0 9 Had I known then how much work was involved in emulating a chip like this, I
philpem@0 10 may not have even started ;-)
philpem@0 11
philpem@0 12
philpem@0 13
philpem@0 14 12-May-1998: First outline
philpem@0 15
philpem@0 16 11-Jun-1998: Early disassembler
philpem@0 17
philpem@0 18 20-Nov-1998: First prototype v0.1
philpem@0 19
philpem@0 20 04-Dec-1998: Final prototype v0.4
philpem@0 21
philpem@0 22 20-Dec-1998: Beta release of Musashi v0.5 that could run Rastan Saga under MAME
philpem@0 23 (barely).
philpem@0 24
philpem@0 25 06-Jan-1999: Musashi 1.0 released
philpem@0 26
philpem@0 27 17-Mar-1999: Musashi 2.0 released
philpem@0 28 - Major code overhaul.
philpem@0 29 - Replaced monolithic codebase with a code generator program.
philpem@0 30 - Added correct m68000 timing.
philpem@0 31 - Moved timing into the opcode handlers.
philpem@0 32
philpem@0 33 25-Mar-1999: Musashi 2.1 released
philpem@0 34 - Added support for m68010.
philpem@0 35 - Many bugfixes.
philpem@0 36
philpem@0 37 13-May-1999: Musashi 2.2 released
philpem@0 38 - Added support for m68020.
philpem@0 39 - Lots of bugfixes.
philpem@0 40
philpem@0 41 05-Apr-2000: Musashi 3.0 released
philpem@0 42 - Major code overhaul.
philpem@0 43 - Rewrote code generator program and changed the format of
philpem@0 44 m68k_in.c.
philpem@0 45 - Added support for m68ec020.
philpem@0 46 - Removed timing from the opcode handlers.
philpem@0 47 - Added correct timing for m68000, m68010, and m68020.
philpem@0 48 Note: 68020 timing is the cache timing from the manual.
philpem@0 49 - Removed the m68k_peek_xxx() and m68k_poke_xxx() instructions and
philpem@0 50 replaced them with m68k_get_reg() and m68k_set_reg().
philpem@0 51 - Added support for function codes.
philpem@0 52 - Revamped m68kconf.h to be easier to configure and more powerful.
philpem@0 53 - Added option to separate immediate and normal reads.
philpem@0 54 - Added support for (undocumented) m68000 instruction prefetch.
philpem@0 55 - Rewrote indexed addressing mode handling.
philpem@0 56 - Rewrote interrupt handling.
philpem@0 57 - Fixed a masking bug for m68k_get_reg() when requesting the PC.
philpem@0 58 - Moved the instruction table sorting routine to m68kmake.c so
philpem@0 59 that it is invoked at compile time rather than at runtime.
philpem@0 60 - Rewrote the exception handling routines to support different
philpem@0 61 stack frames (needed for m68020 emulation).
philpem@0 62 - Rewrote faster status register and condition code flag handling
philpem@0 63 functions / macros.
philpem@0 64 - Fixed function code handling to fetch from program space when
philpem@0 65 using pc-relative addressing.
philpem@0 66 - Fixed initial program counter and stack pointer fetching on
philpem@0 67 reset (loads from program space now).
philpem@0 68 - A lot of code cleanup.
philpem@0 69 - LOTS of bugfixes (especially in the m68020 code).
philpem@0 70
philpem@0 71 28-May-2000: Musashi 3.1 released
philpem@0 72 - Fixed bug in m68k_get_reg() that retrieved the wrong value for
philpem@0 73 the status register.
philpem@0 74 - Fixed register bug in movec.
philpem@0 75 - Fixed cpu type comparison problem that caused indexed
philpem@0 76 addressing modes to be incorrectly interpreted when in m68ec020
philpem@0 77 mode.
philpem@0 78 - Added code to speed up busy waiting on some branch instructions.
philpem@0 79 - Fixed some bfxxx opcode bugs.
philpem@0 80
philpem@0 81 14-Aug-2000: Musashi 3.2 released
philpem@0 82 - Fixed RTE bug that killed the program counter when in m68020
philpem@0 83 mode.
philpem@0 84 - Minor fixes in negx and nbcd.
philpem@0 85 - renamed d68k.c to m68kdasm.c and merged d68k.h into m68k.h.
philpem@0 86 d68k_read_xxx() instructions have been renamed to
philpem@0 87 m68k_read_xxx_disassembler().
philpem@0 88 - Rewrote exception processing and fixed 68020 stack frame
philpem@0 89 problems.
philpem@0 90 - FINALLY fixed the mull and divl instructions.
philpem@0 91 - Added 64-bit safe code fixes.
philpem@0 92 - Added 64-bit optimizations (these will only be ANSI compliant
philpem@0 93 under c9x, and so to use them you must turn on M68K_USE_64_BIT
philpem@0 94 in m68kconf.h).
philpem@0 95
philpem@0 96 27-Jan-2001: Musashi 3.3 released
philpem@0 97 Note: This is the last release of Musashi before I separate the
philpem@0 98 68020 core.
philpem@0 99 - Fixed problem when displaying negative numbers in disassembler
philpem@0 100 - Fixed cpu type selector - was allowing 020 instructions to be
philpem@0 101 disassembled when in 000 mode.
philpem@0 102 - Fixed opcode jumptable generator (ambiguous operators in the
philpem@0 103 test for f-line ops)
philpem@0 104 - Fixed signed/unsigned problem in divl and mull opcodes (not
philpem@0 105 sure if this was causing an error but best to be sure)
philpem@0 106 - Cleaned up the naming scheme for the opcode handlers
philpem@0 107
philpem@0 108 02-Feb-2001: Musashi 3.3.1 released
philpem@0 109 Note: due to the pc-relative requirement for some new drivers
philpem@0 110 in MAME, I've released this small update.
philpem@0 111 - Added pc-relative read modes
philpem@0 112 - small optimizations to the exception handling that will help
philpem@0 113 when splitting the cores
philpem@0 114 - Updated the example (oops!)