Le 02/01/2020 à 12:10, Laurent Vivier a écrit : > Le 02/01/2020 à 11:36, Jason A. Donenfeld a écrit : >> On Linux, calling `reboot(RB_AUTOBOOT);` will result in >> arch/m68k/mac/misc.c's mac_reset function being called. That in turn >> looks at the rombase (or uses 0x40800000 is there's no rombase), adds >> 0xa, and jumps to that address. At the moment, there's nothing there, so >> the kernel just crashes when trying to reboot. So, this commit adds a >> very simple implementation at that location, which just writes to via2 >> to power down. >> >> Signed-off-by: Jason A. Donenfeld <ja...@zx2c4.com> >> --- > > There are two cleaners solution to do that: > 1- catch the jump to the ROM address in QEMU and shutdown the machine, see > > https://github.com/vivier/qemu-m68k/commit/51cd57d1128059819038b9800455fbf794430c15 > > 2- or as you do, write a fake ROM but use the VIA2 port B bit 3 to > shutdown the machine see hw/misc/mac_via.c mos6522_q800_via2_portB_write().
OK, 2 is what you do, so I think we can take this. The assembly code is correct but not easy to read, could you use defined values (VIA_BASE) and add some comments? I think we don't need the BI_MAC_ROMBASE: in fact MACROM_ADDR is wrong, you can change its definition to 0x40800000. Thanks, Laurent