Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-10]: src/sys/arch/amiga/stand/bootblock/boot Pull up following re...



details:   https://anonhg.NetBSD.org/src/rev/f4e382da2348
branches:  netbsd-10
changeset: 374072:f4e382da2348
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Mar 30 11:54:33 2023 +0000

description:
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 :)

diffstat:

 sys/arch/amiga/stand/bootblock/boot/console.c  |  18 +++++++++++++++---
 sys/arch/amiga/stand/bootblock/boot/libstubs.h |   3 ++-
 sys/arch/amiga/stand/bootblock/boot/libstubs.s |  12 +++++++++++-
 sys/arch/amiga/stand/bootblock/boot/version    |   3 ++-
 4 files changed, 30 insertions(+), 6 deletions(-)

diffs (89 lines):

diff -r 467099bd7953 -r f4e382da2348 sys/arch/amiga/stand/bootblock/boot/console.c
--- a/sys/arch/amiga/stand/bootblock/boot/console.c     Thu Mar 30 11:49:11 2023 +0000
+++ b/sys/arch/amiga/stand/bootblock/boot/console.c     Thu Mar 30 11:54:33 2023 +0000
@@ -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)
diff -r 467099bd7953 -r f4e382da2348 sys/arch/amiga/stand/bootblock/boot/libstubs.h
--- a/sys/arch/amiga/stand/bootblock/boot/libstubs.h    Thu Mar 30 11:49:11 2023 +0000
+++ b/sys/arch/amiga/stand/bootblock/boot/libstubs.h    Thu Mar 30 11:54:33 2023 +0000
@@ -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);
diff -r 467099bd7953 -r f4e382da2348 sys/arch/amiga/stand/bootblock/boot/libstubs.s
--- a/sys/arch/amiga/stand/bootblock/boot/libstubs.s    Thu Mar 30 11:49:11 2023 +0000
+++ b/sys/arch/amiga/stand/bootblock/boot/libstubs.s    Thu Mar 30 11:54:33 2023 +0000
@@ -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
diff -r 467099bd7953 -r f4e382da2348 sys/arch/amiga/stand/bootblock/boot/version
--- a/sys/arch/amiga/stand/bootblock/boot/version       Thu Mar 30 11:49:11 2023 +0000
+++ b/sys/arch/amiga/stand/bootblock/boot/version       Thu Mar 30 11:54:33 2023 +0000
@@ -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 @@ 2.3:  ???
 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



Home | Main Index | Thread Index | Old Index