TMF Hg

merge in changes from default branch experimental_memory_mapper_v2

  • Fri, 18 Jan 2013 22:52:43 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 18 Jan 2013 22:52:43 +0000] rev 132
  • merge in changes from default branch

add TODO

  • Fri, 18 Jan 2013 18:51:50 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 18 Jan 2013 18:51:50 +0000] rev 131
  • add TODO

[wd2010] disable DMA pagefault workaround (no longer required)

  • Fri, 18 Jan 2013 17:20:07 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 18 Jan 2013 17:20:07 +0000] rev 130
  • [wd2010] disable DMA pagefault workaround (no longer required)

[memory] Emulate main memory read wrap-around

  • Fri, 18 Jan 2013 17:18:50 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 18 Jan 2013 17:18:50 +0000] rev 129
  • [memory] Emulate main memory read wrap-around

    3B1s with 512K or 1MB of base memory have a decoding quirk which causes reads
    to 'wrap around'. That is to say, on a 512K machine, reading from addresses 0,
    512K, 1024K or 1536K will address the same RAM byte. On a 1MB machine,
    addresses 0 and 1024K address the same RAM byte.

    Emulating this incorrectly causes P4TEST to report an incorrect amount of
    available base RAM.

experimental memory mapper, not quite working experimental_memory_mapper_v2

  • Fri, 18 Jan 2013 17:03:48 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 18 Jan 2013 17:03:48 +0000] rev 128
  • experimental memory mapper, not quite working

fix default HDD sectors-per-track

  • Wed, 16 Jan 2013 00:41:51 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 16 Jan 2013 00:41:51 +0000] rev 127
  • fix default HDD sectors-per-track

    The 64MB Micropolis drive we're trying to emulate in FreeBee has 17 sectors
    per track. Fix this in main.c to avoid tripping the sector range checks.

[wd2010] allow seek delay to be overridden at compile time

  • Wed, 16 Jan 2013 00:40:18 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 16 Jan 2013 00:40:18 +0000] rev 126
  • [wd2010] allow seek delay to be overridden at compile time

[wd2010] properly constrain R/W ops based on end sector

  • Wed, 16 Jan 2013 00:38:13 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 16 Jan 2013 00:38:13 +0000] rev 125
  • [wd2010] properly constrain R/W ops based on end sector

[wd2010] display 'number of sectors' for sector R/W ops, display WrLBA in bytes not sectors

  • Wed, 16 Jan 2013 00:36:51 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 16 Jan 2013 00:36:51 +0000] rev 124
  • [wd2010] display 'number of sectors' for sector R/W ops, display WrLBA in bytes not sectors

[wd2010] fix confusing expressions used for multisector mode

  • Wed, 16 Jan 2013 00:35:10 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 16 Jan 2013 00:35:10 +0000] rev 123
  • [wd2010] fix confusing expressions used for multisector mode

[wd2010] use size_t for init filesize, make disc init more verbose

  • Wed, 16 Jan 2013 00:34:11 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 16 Jan 2013 00:34:11 +0000] rev 122
  • [wd2010] use size_t for init filesize, make disc init more verbose

Implement m68k_read_disassembler_* properly

  • Tue, 15 Jan 2013 17:02:56 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Tue, 15 Jan 2013 17:02:56 +0000] rev 121
  • Implement m68k_read_disassembler_* properly

    The previous implementations of m68k_read_disassembler are unsuitable due to
    interactions with the memory mapper. A read from memory by the DASM should not
    mutate system state.

    So we modify the m68k_read_disassembler_{8,16,32} functions to do the memory
    mapping themselves without causing page faults (bus error exception) or
    updating the page flag bits (which could really upset the kernel).

    Now all we need is a debugger/disassembler...

Max out system memory by default

  • Mon, 14 Jan 2013 09:50:37 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Mon, 14 Jan 2013 09:50:37 +0000] rev 120
  • Max out system memory by default

    Set the system memory to 2MiB base, 2MiB ext. This is a fully loaded 3B1
    motherboard with a RAM expansion board. 512KiB base/no ext is the minimum
    which can be specified (e.g. kernel memory map area only) but does not leave
    any room for userspace. The kernel doesn't like that and doesn't handle it
    gracefully...!

Handle memory more gracefully

  • Mon, 14 Jan 2013 09:48:21 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Mon, 14 Jan 2013 09:48:21 +0000] rev 119
  • Handle memory more gracefully

    Fixed in this cset:

    * Return an 'empty space' value if the memory wraps around

    * Allow the 'empty bus' value to be changed via an ifdef

    * Properly handle situations where expansion memory is turned off

More bus error fixes for FreeBee

  • Mon, 14 Jan 2013 09:22:12 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Mon, 14 Jan 2013 09:22:12 +0000] rev 118
  • More bus error fixes for FreeBee

    I have fixed two more bus error handling bugs in FreeBee. First, the CPU core was executing the instruction regardless of whether a bus error occurs when fetching the opcode (which caused it to execute a bogus instruction in such cases). The other one was related to one of my previous fixes - the jump to the bus error vector was at the beginning of the main loop, so it wouldn't be called immediately after the bus error occurred if the timeslot expired, causing the return address to be off.

    With these fixes, Unix now runs enough to get into userspace and run the install script (it is also possible to break out and get a shell prompt). However, many commands segfault semi-randomly (or more specifically, it seems that some child processes forked by the shell might be segfaulting before they can exec the command program), so installing the system isn't possible yet. I am not sure exactly what the bug is, but it seems to be related to some function in the shell returning null when the code calling it is assuming that it won't. What the function is, or why it is returning null, I'm not sure (the shell is built without the shared libc and is stripped, making identifying the function harder). I suspect that the function might be in libc, but that is hard to tell.

    Author: Andrew Warkentin <andreww591 gmail com>

show LED state change only if SHOW_LEDS is defined

  • Tue, 20 Nov 2012 23:31:03 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Tue, 20 Nov 2012 23:31:03 +0000] rev 117
  • show LED state change only if SHOW_LEDS is defined

Add support for MSR2, partial reads from GENSTAT

  • Sat, 17 Nov 2012 22:26:53 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Sat, 17 Nov 2012 22:26:53 +0000] rev 116
  • Add support for MSR2, partial reads from GENSTAT

    * GENSTAT is sometimes read in 8bit mode. Handle this properly.

    * Add support for the MSR2 register (additional HDD head select bit only at
    the moment)

wd2010: use LOGS when logging unformatted strings

  • Sat, 17 Nov 2012 22:15:23 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Sat, 17 Nov 2012 22:15:23 +0000] rev 115
  • wd2010: use LOGS when logging unformatted strings

Fix bit masking logic in 'dead bus' return

  • Sat, 17 Nov 2012 22:14:09 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Sat, 17 Nov 2012 22:14:09 +0000] rev 114
  • Fix bit masking logic in 'dead bus' return

    In some cases (e.g. 16bit reads) a bad 'idle bus' return may be provided.
    Promote the '1' to unsigned long prior to left-shifting it.

ACCESS_CHECK_RD should return the right number of bits!

  • Sat, 17 Nov 2012 21:28:48 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Sat, 17 Nov 2012 21:28:48 +0000] rev 113
  • ACCESS_CHECK_RD should return the right number of bits!

    If the ACCESS_CHECK_RD() macro detects a page fault, it always returns a
    32-bit error response ("all bus pins high"). Musashi really doesn't like it
    when we pass in a 32-bit value when it expects a 16-bit one!

add HDD support + fixes

  • Sat, 17 Nov 2012 19:18:29 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Sat, 17 Nov 2012 19:18:29 +0000] rev 112
  • add HDD support + fixes

    Patch-Author: Andrew Warkentin <andreww591!gmail>
    Patch-Message-ID: <50A772FC.8020009@gmail.com>

    I have added floppy write support, full hard disk emulation, and proper handling of DMA page faults to FreeBee. I also fixed the floppy step commands, changed the "force interrupt" floppy command to generate a type 1 status, and changed the DMA address counter to reset to 3fff when a transfer completes (which is what Unix seems to expect - without it, the kernel says that the floppy isn't ready). The floppy, hard disk, and DMA page fault tests all pass. Initializing hard disks and floppies also works (the geometry for both is still fixed by the size of the image, though, and format commands only appear to succeed, but they don't modify the image). Unix still doesn't run, though (it hangs after reading some sectors from the floppy).

Improve floppy disc support

  • Sat, 17 Nov 2012 19:13:08 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Sat, 17 Nov 2012 19:13:08 +0000] rev 111
  • Improve floppy disc support

    Patch-Author: Andrew Warkentin <andreww591!gmail>
    Patch-Message-ID: <50A772FC.8020009@gmail.com>

[musashi] fix stackframe type for bus errors

  • Thu, 08 Dec 2011 23:44:19 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Thu, 08 Dec 2011 23:44:19 +0000] rev 110
  • [musashi] fix stackframe type for bus errors

    Bus errors incorrectly pushed a Type 0000 stackframe, when they should have pushed a Type 1000 (Type $8) stackframe.
    Also, type 1000 frames were not handled for 68010 CPUs. They are now, but code must later be added to handle them for 68020s. FIXME!

    Reported-By: Armin Diehl <ad ardiehl.de>

[musashi] Fix handling of bus errors

  • Tue, 15 Nov 2011 10:12:37 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Tue, 15 Nov 2011 10:12:37 +0000] rev 109
  • [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).

Fix BSR0 UDS/LDS bit polarity

  • Tue, 15 Nov 2011 09:30:57 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Tue, 15 Nov 2011 09:30:57 +0000] rev 108
  • Fix BSR0 UDS/LDS bit polarity

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

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

only strobe BUSERR if dma access caused a pagefault, and don't send IRQ0s (musashi auto-clears IRQs)!

  • Fri, 04 Mar 2011 02:12:25 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 04 Mar 2011 02:12:25 +0000] rev 107
  • only strobe BUSERR if dma access caused a pagefault, and don't send IRQ0s (musashi auto-clears IRQs)!

More verbose logging of page faults and bus errors

  • Fri, 04 Mar 2011 01:38:39 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 04 Mar 2011 01:38:39 +0000] rev 106
  • More verbose logging of page faults and bus errors

fix small typos in WriteMem32

  • Fri, 04 Mar 2011 01:37:42 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 04 Mar 2011 01:37:42 +0000] rev 105
  • fix small typos in WriteMem32

    WriteMem32 warnings for writes to MapRAM and VRAM mirrors were incorrectly declaring themselves as read operations.

fix issue with WE+ bit becoming unset, fix pagefault:not-mapped-in logic

  • Fri, 04 Mar 2011 01:36:30 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 04 Mar 2011 01:36:30 +0000] rev 104
  • fix issue with WE+ bit becoming unset, fix pagefault:not-mapped-in logic

    - The WE+ (page write enable) bit was becoming unset when the Page Status bits were being set.
    A stupid mistake in an AND expression was unsetting the write-enable, thus making S4TEST 12,2 and 12,3 fail spectacularly.

    - Pagefaults were not being generated correctly for pages which were not mapped in. Even Supervisor code accessing unmapped pages should get a PF.

more verbose bus error logging

  • Fri, 04 Mar 2011 00:44:36 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 04 Mar 2011 00:44:36 +0000] rev 103
  • more verbose bus error logging

add Error Enable bit to gcr write handler

  • Fri, 04 Mar 2011 00:44:06 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 04 Mar 2011 00:44:06 +0000] rev 102
  • add Error Enable bit to gcr write handler

add Error Enable bit to system state

  • Fri, 04 Mar 2011 00:41:52 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Fri, 04 Mar 2011 00:41:52 +0000] rev 101
  • add Error Enable bit to system state

Fix broken pagebit update code (was failing S4TEST 19 Map Translation test)

  • Thu, 03 Mar 2011 13:05:21 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Thu, 03 Mar 2011 13:05:21 +0000] rev 100
  • Fix broken pagebit update code (was failing S4TEST 19 Map Translation test)

use LOG functions for kbc debugging, make KBC debugging optional

  • Thu, 03 Mar 2011 08:18:57 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Thu, 03 Mar 2011 08:18:57 +0000] rev 99
  • use LOG functions for kbc debugging, make KBC debugging optional

add single-string logging functions to work around gcc warning

  • Thu, 03 Mar 2011 08:15:09 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Thu, 03 Mar 2011 08:15:09 +0000] rev 98
  • add single-string logging functions to work around gcc warning

Add 60Hz timer tick patch from Andrew Warkentin <andreww591 gmail com>

  • Wed, 02 Mar 2011 07:16:32 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Wed, 02 Mar 2011 07:16:32 +0000] rev 97
  • Add 60Hz timer tick patch from Andrew Warkentin <andreww591 gmail com>

    ... I have also attached a patch that adds the 60Hz timer interrupt (I'm not sure if it's totally correct, though, since the cursor blinks rather slowly).

    Received-From: Andrew Warkentin <andreww591 gmail com>
    Signed-Off-By: Philip Pemberton <philpem@philpem.me.uk>

Add keyboard patch from Andrew Warkentin <andreww591 gmail com>

  • Tue, 01 Mar 2011 21:33:32 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Tue, 01 Mar 2011 21:33:32 +0000] rev 96
  • Add keyboard patch from Andrew Warkentin <andreww591 gmail com>

    I fixed the keyboard in FreeBee. I looked at the keyboard driver source available on a few sites, and it appears that BEGKBD/KEY_BEGIN_KEYBOARD is only supposed to be sent after the end of mouse data, and that KLAST/KEY_LIST_END is not a separate code, but a flag that is set on the last non-KALLUP/KEY_ALL_UP code in a list. I have attached a patch that implements these changes. I have also attached a patch that adds the 60Hz timer interrupt (I'm not sure if it's totally correct, though, since the cursor blinks rather slowly).

    Received-From: Andrew Warkentin <andreww591 gmail com>
    Signed-Off-By: Philip Pemberton <philpem@philpem.me.uk>

make it possible to eject the floppy disc (use F11!)

  • Thu, 10 Feb 2011 01:09:42 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Thu, 10 Feb 2011 01:09:42 +0000] rev 95
  • make it possible to eject the floppy disc (use F11!)

fix keyboard update-flag handler to only set flag when a mapped key has been pressed

  • Thu, 10 Feb 2011 01:09:04 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Thu, 10 Feb 2011 01:09:04 +0000] rev 94
  • fix keyboard update-flag handler to only set flag when a mapped key has been pressed

properly handle 8 and 16 bit KBC writes

  • Thu, 10 Feb 2011 01:08:32 +0000
  • by Philip Pemberton <philpem@philpem.me.uk> [Thu, 10 Feb 2011 01:08:32 +0000] rev 93
  • properly handle 8 and 16 bit KBC writes