It's been a while since I last repoted but I've made some progress. I've changed the thread title to reflect what I've been up to:
So I first tried to get an instruction trace for booting into DBOF. I captured stdout to a file but the spew was so vast that my M4 MBA ground to a standstill - paging like crazy since Terminal.app’s scrollback buffer swamped the machine (if it didn’t just die).
I modified dinguspcc adding —instruction_log option to write disassembly directly to a file. In fact, since I’m not a C++ fan, I got Claude to do this for me using Cursor. This worked .. but not at all efficiently and the emulation was so slow that it didn’t make much progress. Also, the log file gets huge — into hundreds of gigabytes!
I decided to add more specific smarts to dingusppc. Firstly, I aded a hook to drop into the debugger when the boot blocks (at sector 0) are read. Up to this point the boot sequence is the same for MacOS and Copland. For DBOF, the ROM then loads MacOSLoader rather than the System file. Tracing from here, I could identify where the page table is constructed for DBOF. It’s early in the DBOF code read from MacOSLoader resource ‘opfw’. The page table is based at real_base and it’s always 0x400000 for DBOF.
016F481C->017B381C: 80A30020 lwz r5, 0x20(r3) ; in{ r3:17135E0 } out{ r5:400000 }
…
000048AC: 7C3903A6 mtsdr1 r1 ; in{ r1:4E0000 } out{ sdr1:4E0000 }
However, I couldn’t pinpoint where the 0x400000 address was coming from. It was in R5 when the PTEs were written but, although R5 had been loaded from a known memory location (0x1713600), this was in turn set by 68k code which is practically impossible to decipher from the emulating PPC stream. Note that, rather helpfully, the ROM maps the 68K emulation code at virtual addresses 68xxxxxx so it’s easy to spot legacy code being run.
Now, it turned out that by overriding R5 from the debugger by hand, I could change the physical base of the DBOF page table (at virtual 0xFF800000) and DBOF would successfully boot to the CLI! If only I could find the memory location and hence disk location for the 0x400000 to patch….
So I added code similar to the watch-point logic to enter the debugger when the location of the 0x400000 was written. That gave me the 68k code loading it and from the sequence of words being read I could tell the resource being loaded. And that turned out to be ’nkld’. From the MacNosy listing attached by
@joevt earlier:
nkld_128 LINK A6,#-$680
MOVEM.L D3-D7/A2-A4,-(A7)
…
lab_12 MOVEA.L #KeyMap,A0
…
MOVEA.L vab_29(A6),A2
MOVE.L vab_21(A6),(A2)
MOVE.L vab_22(A6),4(A2)
MOVE.L vab_23(A6),8(A2)
MOVE.L vab_24(A6),12(A2)
MOVE.L vab_25(A6),16(A2)
MOVE.L vab_26(A6),20(A2)
MOVE.L vab_27(A6),24(A2)
MOVE.L vab_28(A6),28(A2)
MOVE.L #$400000,32(A2) <<<<<<<<<<<
The physical base address of 0x400000 is a fixed value which is not computed from the memory configuration. Hence, patching it seems viable (provided it’s consistent with the machine’s actual memory config).
And, indeed, using ResEdit to patch this location in the ‘nkld’ resource of MacOSLoader produces a system that boots to DBOF at a high enough physical (real-base) address that enables my modified ofwboot.xcf loaded from floppy to boot a NetBSD kernel from a scsi disk image:
Open Firmware, 2.0
To continue booting the MacOS type:
BYE<return>
To continue booting from the default boot device type:
BOOT<return>
ok
0 > boot fd:,ofwboot.xcf scsi/@0/netbsd loading XCOFF
tsize=F950 dsize=258 bsize=2750 entry=1000000
SECTIONS:
.text 01000000 01000000 0000F950 00001000
.pad 0100F948 0100F948 000006B0 00010950
.data 01010000 01010000 00000258 00011000
.bss 01010258 01010258 00002750 00000000
.gnu.att 00000000 00000000 00000010 00011258
.ident 00000000 00000000 000000AF 00011268
loading .text, done..
loading .data, done..
clearing .bss, done..
>> NetBSD/macppc OpenFirmware Boot, Revision 1.13 (Tue Aug 12 20:11:41 UTC 2025)
11056036+166232 [476224+463762]=0xb999f0
start=0x100000
DEFAULT CATCH!, code=FFF00400 at %SRR0: 001001DC %SRR1: 40000030
ok
This took a machine-check exception very early and way too soon for any console or debugging output.
But by adding further code to my modified loader, I was able to patch the kernel (with “b .”s) and discover the trap occurred on return from the fist OF call from the NetBSD kernel (to find / in the device tree). Since OF entry/exit is very machine and OF dependent, and I was using the generic NetBSD 9.2 kernel, I built specifically 601 capable version instead. (I was also pruned PCI and other absent devices.) This got much further:
>> NetBSD/macppc OpenFirmware Boot, Revision 1.13 (Tue Aug 12 20:11:41 UTC 2025)
4099596+137488 [223648+213414]=0x4756d0
start=0x100000
[ 1.0000000] mem region 0 start=0 size=800000
[ 1.0000000] mem region 1 start=1000000 size=2000000
[ 1.0000000] mem region 2 start=5000000 size=2000000
[ 1.0000000] mem region 3 start=9000000 size=2000000
[ 1.0000000] mem region 4 start=d000000 size=2000000
[ 1.0000000] avail region 0 start=0x90000 size=0x70000
[ 1.0000000] avail region 1 start=0x200000 size=0x600000
[ 1.0000000] avail region 2 start=0x1013000 size=0x3ed000
[ 1.0000000] avail region 3 start=0x1500000 size=0x1b00000
[ 1.0000000] avail region 4 start=0x5000000 size=0x2000000
[ 1.0000000] avail region 5 start=0x9000000 size=0x2000000
[ 1.0000000] avail region 6 start=0xd000000 size=0x2000000
So the console has been opened, and written to, and there’s been memory discovery from the device tree. Progress .. and perhaps the first time NetBSD has seen a Nubus PPC Mac!