New pmap module for m68k

Jason Thorpe <[email protected]> Sun, 9 Nov 2025 10:18:22 -0800
Newsgroups gmane.os.netbsd.ports.m68k
Message-ID <[email protected]>
Hey folks,

In the evenings over the last couple of weeks I=E2=80=99ve been working =
on a new pmap module for the m68k ports.  The intention is to address =
the fundamental limitations of the classical Hibler pmap =
(pmap_motorola.c) with regard to the 68040.  The new module has a =
completely different page table management strategy and natively works =
with the 3-level table configuration of the 68040 while also natively =
working with he mandatory 2-level configuration imposed by the HP MMU =
found in the HP 9000/320 and 9000/350.

One of the reasons I wanted to do this is so that larger memory configs =
can be supported on 68040.  Currently, 68040 systems suffer from address =
space exhaustion because of the way the 3-level MMU tables were =
shoehorned into the Hibler pmap.  This morning, I successfully booted =
NetBSD/virt68k multi-user with a 2G RAM configuration using the new =
pmap.  With luck, this will make pkgsrc building for m68k a lot easier!

Some work will be required to integrate this with other m68k ports, =
pmap_bootstrap1() specifically needs to gain some additional =
capabilities to make it per-platform adaptable (I do *not* want to end =
up with a separate copy per port).  The Amiga and Atari ports are going =
to be a heavier lift because they=E2=80=99re odd-ball in their early =
bootstrap compared to the others.  Definitely looking for help in this =
aspect, so drop me an email if you=E2=80=99re interested in helping with =
the effort and have hardware (or a decently functioning emulator) that =
can be used for testing.



WARNING: Image format was not specified for 'disk1.raw' and probing =
guessed raw.
         Automatically detecting the format is dangerous for raw images, =
write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
WARNING: Image format was not specified for 'disk0.raw' and probing =
guessed raw.
         Automatically detecting the format is dangerous for raw images, =
write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
[   1.0000000] Initialized Goldfish TTY console @ 0xff008000
[   1.0000000] Memory segment 0: addr=3D0x00633000 size=3D0x7f9cd000
[   1.0000000] entropy: ready
[   1.0000000] pmap_growkernel: initial_kernel_ptpages=3D515, =
initial_kernel_stpages=3D9
[   1.0000000] pmap_growkernel: requested maxkvaddr=3D0x02796000
[   1.0000000] pmap_growkernel: returning=3D0x80c00000
[   1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, =
2003,
[   1.0000000]     2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, =
2013,
[   1.0000000]     2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, =
2023,
[   1.0000000]     2024, 2025
[   1.0000000]     The NetBSD Foundation, Inc.  All rights reserved.
[   1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[   1.0000000]     The Regents of the University of California.  All =
rights reserved.

[   1.0000000] NetBSD 11.99.3 (GENERIC) #109: Sun Nov  9 09:28:16 PST =
2025
[   1.0000000] =
[email protected]:/Users/thorpej/NetBSD/current/m68k/src/sys/arch/vir=
t68k/compile/GENERIC
[   1.0000000] Qemu 9.1.0: MC68040+MMU+FPU, 4k+4k on-chip physical I/D =
caches
[   1.0000000] total memory =3D 2048 MB
[   1.0000000] avail memory =3D 2010 MB
[   1.0000000] mainbus0 (root)
[   1.0000000] gfpic0 at mainbus0 addr 0xff000000: Google Goldfish PIC
[   1.0000000] gfpic0: interrupting at IPL 1
[   1.0000000] gfpic1 at mainbus0 addr 0xff001000: Google Goldfish PIC
[   1.0000000] gfpic1: interrupting at IPL 2
[   1.0000000] gfpic2 at mainbus0 addr 0xff002000: Google Goldfish PIC
[   1.0000000] gfpic2: interrupting at IPL 3
[   1.0000000] gfpic3 at mainbus0 addr 0xff003000: Google Goldfish PIC
[   1.0000000] gfpic3: interrupting at IPL 4
[   1.0000000] gfpic4 at mainbus0 addr 0xff004000: Google Goldfish PIC
[   1.0000000] gfpic4: interrupting at IPL 5
[   1.0000000] gfpic5 at mainbus0 addr 0xff005000: Google Goldfish PIC
[   1.0000000] gfpic5: interrupting at IPL 6
[   1.0000000] gfrtc0 at mainbus0 addr 0xff006000: Google Goldfish RTC + =
timer
[   1.0000000] gfrtc0: hardclock interrupting at gfpic5 irq 1 (IPL 6)
[   1.0000000] gfrtc0: Using as delay() timer.
[   1.0000000] gfrtc1 at mainbus0 addr 0xff007000: Google Goldfish RTC + =
timer
[   1.0000000] gfrtc1: using as Time of Day Register.
[   1.0000000] gftty0 at mainbus0 addr 0xff008000: Google Goldfish TTY
[   1.0000000] gftty0: console
[   1.0000000] gftty0: interrupting at gfpic0 irq 32 (IPL 1)
[   1.0000000] virtctrl0 at mainbus0 addr 0xff009000: Qemu Virtual =
System Controller
[   1.0000000] virtctrl0: features=3D0x00000001
[   1.0000000] virtio0 at mainbus0 addr 0xff01f600
[   1.0000000] virtio0: VirtIO-MMIO-v2
[   1.0000000] virtio0: network device (id 1, rev. 0x01)
[   1.0000000] vioif0 at virtio0: features: =
0x130870020<V1,EVENT_IDX,INDIRECT_DESC,CTRL_MAC,CTRL_RX,CTRL_VQ,STATUS,MAC=
>
[   1.0000000] vioif0: Ethernet address 52:54:00:12:34:56
[   1.0000000] virtio0: interrupting at gfpic4 irq 28 (IPL 5)
[   1.0000000] virtio1 at mainbus0 addr 0xff01f800
[   1.0000000] virtio1: VirtIO-MMIO-v2
[   1.0000000] virtio1: SCSI device (id 8, rev. 0x01)
[   1.0000000] vioscsi0 at virtio1: features: =
0x110000000<V1,INDIRECT_DESC>
[   1.0000000] vioscsi0: cmd_per_lun 128 qsize 1024 seg_max 254 =
max_target 255 max_lun 16383
[   1.0000000] virtio1: interrupting at gfpic4 irq 29 (IPL 5)
[   1.0000000] scsibus0 at vioscsi0: 256 targets, 16384 luns per target
[   1.0000000] virtio2 at mainbus0 addr 0xff01fa00
[   1.0000000] virtio2: VirtIO-MMIO-v2
[   1.0000000] virtio2: entropy device (id 4, rev. 0x01)
[   1.0000000] viornd0 at virtio2: features: =
0x110000000<V1,INDIRECT_DESC>
[   1.0000000] virtio2: interrupting at gfpic4 irq 30 (IPL 5)
[   1.0000000] virtio3 at mainbus0 addr 0xff01fc00
[   1.0000000] virtio3: VirtIO-MMIO-v2
[   1.0000000] virtio3: block device (id 2, rev. 0x01)
[   1.0000000] ld0 at virtio3: features: =
0x110002e54<V1,INDIRECT_DESC,DISCARD,CONFIG_WCE,TOPOLOGY,FLUSH,BLK_SIZE,GE=
OMETRY,SEG_MAX>
[   1.0000000] ld0: max 254 segs of max 65536 bytes
[   1.0000000] virtio3: interrupting at gfpic4 irq 31 (IPL 5)
[   1.0000000] ld0: 8193 MB, 16383 cyl, 16 head, 63 sec, 512 bytes/sect =
x 16779264 sectors
[   1.0000000] virtio4 at mainbus0 addr 0xff01fe00
[   1.0000000] virtio4: VirtIO-MMIO-v2
[   1.0000000] virtio4: block device (id 2, rev. 0x01)
[   1.0000000] ld1 at virtio4: features: =
0x110002e54<V1,INDIRECT_DESC,DISCARD,CONFIG_WCE,TOPOLOGY,FLUSH,BLK_SIZE,GE=
OMETRY,SEG_MAX>
[   1.0000000] ld1: max 254 segs of max 65536 bytes
[   1.0000000] virtio4: interrupting at gfpic4 irq 32 (IPL 5)
[   1.0000000] ld1: 16384 MB, 16383 cyl, 16 head, 63 sec, 512 bytes/sect =
x 33554432 sectors
[   1.0000000] No statclock; using hardclock.
[   1.0000000] Initialzing hardclock: freq=3D100 Hz, interval=3D10000 =
usec
[   1.1300030] cd0 at scsibus0 target 6 lun 0: <QEMU, QEMU CD-ROM, 2.5+> =
cdrom removable
[   1.1300030] cd0: async, 8-bit transfers, tagged queueing
[   4.9200030] swwdog0: software watchdog initialized
[   4.9400030] root on ld0a dumps on ld0b
[   4.9600030] root file system type: ffs
[   4.9600030] kern.module.path=3D/stand/virt68k/11.99.3/modules
Sun Nov  9 09:33:21 PST 2025
Starting root file system check:
/dev/rld0a: file system is clean; not checking
Setting sysctl variables:
ddb.onpanic: 1 -> 0
swapctl: setting dump device to /dev/ld0b
swapctl: adding /dev/ld0b as swap device at priority 0
Starting file system checks:
/dev/rld1a: file system is clean; not checking
Loaded entropy from /var/db/entropy-file.
Waiting for entropy...done
Setting tty flags.
Starting network.
Hostname: virt68k
IPv6 mode: host
Configuring network interfaces: vioif0.
Adding interface aliases:.
Waiting for duplicate address detection to finish...
Starting dhcpcd.
Starting mdnsd.
Building databases: dev, utmp, utmpx.
Starting syslogd.
Nov  9 09:33:35 virt68k syslogd[427]: /var/log/messages: No such file or =
directory
Nov  9 09:33:35 virt68k syslogd[427]: /var/log/messages: No such file or =
directory
Mounting all file systems...
Clearing temporary files.
Creating a.out runtime link editor directory cache.
Checking quotas: done.
Setting securelevel: kern.securelevel: 0 -> 1
swapctl: setting dump device to /dev/ld0b
Starting virecover.
Checking for core dump...
savecore: no core dump
Starting local daemons:.
Updating motd.
Starting ntpd.
Starting sshd.
Starting inetd.
Starting cron.
Sun Nov  9 09:33:40 PST 2025

NetBSD/virt68k (virt68k) (constty)

login:=20

-- thorpej