Module Name: src Committed By: martin Date: Thu Mar 30 11:54:34 UTC 2023
Modified Files: src/sys/arch/amiga/stand/bootblock/boot [netbsd-10]: console.c libstubs.h libstubs.s version Log Message: Pull up following revision(s) (requested by abs in ticket #133): sys/arch/amiga/stand/bootblock/boot/libstubs.h: revision 1.8 sys/arch/amiga/stand/bootblock/boot/version: revision 1.3 sys/arch/amiga/stand/bootblock/boot/libstubs.s: revision 1.11 sys/arch/amiga/stand/bootblock/boot/console.c: revision 1.16 Fix NetBSD/amiga bootblocks for Kickstart 3.2 - from Karoly Balogh Kickstart 3.2 changed to not initialize console.device before bootstrap, so the previous NetBSD bootblocks would crash when they tried to initialise console output. With this change if the call to the OpenDevice() stub fails, the code now calls FindResident() and InitResident() before retrying the OpenDevice(). Many thanks to Karoly Balogh for tracking this down (and also for knowing just who to poke to get insight into the 3.2 changes :) To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.15.46.1 \ src/sys/arch/amiga/stand/bootblock/boot/console.c cvs rdiff -u -r1.7 -r1.7.94.1 \ src/sys/arch/amiga/stand/bootblock/boot/libstubs.h cvs rdiff -u -r1.10 -r1.10.94.1 \ src/sys/arch/amiga/stand/bootblock/boot/libstubs.s cvs rdiff -u -r1.2 -r1.2.18.1 src/sys/arch/amiga/stand/bootblock/boot/version Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amiga/stand/bootblock/boot/console.c diff -u src/sys/arch/amiga/stand/bootblock/boot/console.c:1.15 src/sys/arch/amiga/stand/bootblock/boot/console.c:1.15.46.1 --- src/sys/arch/amiga/stand/bootblock/boot/console.c:1.15 Sun Dec 18 12:02:37 2016 +++ src/sys/arch/amiga/stand/bootblock/boot/console.c Thu Mar 30 11:54:33 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: console.c,v 1.15 2016/12/18 12:02:37 mlelstv Exp $ */ +/* $NetBSD: console.c,v 1.15.46.1 2023/03/30 11:54:33 martin Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -138,8 +138,20 @@ consinit(void *consptr) { goto err; mc->cnior->buf = (void *)mc->w; - if (OpenDevice("console.device", 0, mc->cnior, 0)) - goto err; + mc->cnior->length = 136; /* sizeof(struct Window) */ + if (OpenDevice("console.device", 0, mc->cnior, 0)) { + /* Kickstart 3.2 decided not to initialize console.device + before bootstrap, so we have to do it ourselves. */ + void *res = FindResident("console.device"); + if (!res) + goto err; + + if (!InitResident(res, 0)) + goto err; + + if (OpenDevice("console.device", 0, mc->cnior, 0)) + goto err; + } mc->tmior = (struct TimerIO *)CreateIORequest(mc->cnmp, sizeof(struct TimerIO)); if (!mc->tmior) Index: src/sys/arch/amiga/stand/bootblock/boot/libstubs.h diff -u src/sys/arch/amiga/stand/bootblock/boot/libstubs.h:1.7 src/sys/arch/amiga/stand/bootblock/boot/libstubs.h:1.7.94.1 --- src/sys/arch/amiga/stand/bootblock/boot/libstubs.h:1.7 Sat Oct 17 11:18:18 2009 +++ src/sys/arch/amiga/stand/bootblock/boot/libstubs.h Thu Mar 30 11:54:33 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: libstubs.h,v 1.7 2009/10/17 11:18:18 mlelstv Exp $ */ +/* $NetBSD: libstubs.h,v 1.7.94.1 2023/03/30 11:54:33 martin Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -65,6 +65,7 @@ void CloseDevice(struct AmigaIO *); #endif void *FindResident(const char *); +void *InitResident(const char *, u_int32_t); void *OpenResource(const char *); u_int32_t CachePreDMA(u_int32_t, u_int32_t *, int); Index: src/sys/arch/amiga/stand/bootblock/boot/libstubs.s diff -u src/sys/arch/amiga/stand/bootblock/boot/libstubs.s:1.10 src/sys/arch/amiga/stand/bootblock/boot/libstubs.s:1.10.94.1 --- src/sys/arch/amiga/stand/bootblock/boot/libstubs.s:1.10 Sat Oct 17 11:18:18 2009 +++ src/sys/arch/amiga/stand/bootblock/boot/libstubs.s Thu Mar 30 11:54:33 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: libstubs.s,v 1.10 2009/10/17 11:18:18 mlelstv Exp $ */ +/* $NetBSD: libstubs.s,v 1.10.94.1 2023/03/30 11:54:33 martin Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -208,6 +208,16 @@ ENTRY_NOPROFILE(FindResident) movl %d0,%a0 | Comply with ELF ABI rts +ENTRY_NOPROFILE(InitResident) + movl %a6,%sp@- + movl %pc@(_C_LABEL(SysBase):w),%a6 + movl %sp@(8),%a1 + movl %sp@(12),%d1 + jsr %a6@(-0x66) + movl %sp@+,%a6 + movl %d0,%a0 | Comply with ELF ABI + rts + ENTRY_NOPROFILE(OpenResource) movl %a6,%sp@- movl %pc@(_C_LABEL(SysBase):w),%a6 Index: src/sys/arch/amiga/stand/bootblock/boot/version diff -u src/sys/arch/amiga/stand/bootblock/boot/version:1.2 src/sys/arch/amiga/stand/bootblock/boot/version:1.2.18.1 --- src/sys/arch/amiga/stand/bootblock/boot/version:1.2 Thu Feb 25 03:42:14 2021 +++ src/sys/arch/amiga/stand/bootblock/boot/version Thu Mar 30 11:54:33 2023 @@ -1,4 +1,4 @@ -$NetBSD: version,v 1.2 2021/02/25 03:42:14 rin Exp $ +$NetBSD: version,v 1.2.18.1 2023/03/30 11:54:33 martin Exp $ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important - make sure the entries are appended on end, last item @@ -12,3 +12,4 @@ is taken as the current. 2.4: Moved default command into fixed location for easy patching 3.0: Initial 2 stage amiga bootblocks 3.1: Add support for FFSv2 +3.2: Fix booting with some "modern" Kickstart versions