Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x68k/stand Overhaul xxboot. And merge floppy boot,...



details:   https://anonhg.NetBSD.org/src/rev/031b5b489b76
branches:  trunk
changeset: 974897:031b5b489b76
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sun Aug 16 06:43:43 2020 +0000

description:
Overhaul xxboot.  And merge floppy boot, taken from boot_ustar.
- Rewrite boot.S completely.
  boot.S now supports boot from SCSI HD/CD and floppy.
- Use IOCS call to identify the floppy format, instead of chkfmt.s which
  accesses hardware directly.
- Import print_hex() debug function from boot_ufs.
- Import a feature that displays initial registers (for debug) from boot_ufs,
  and restore it (this in boot_ufs has been broken).
- Add size optimized alternatives for some libkern routines.
- Stop linking libsa to prevent to link unexpected objects.
- Bump version to 2.0.

diffstat:

 sys/arch/x68k/stand/libiocs/iocscall.h             |    3 +-
 sys/arch/x68k/stand/xxboot/Makefile.xxboot         |   14 +-
 sys/arch/x68k/stand/xxboot/ashldi3.S               |  121 +++
 sys/arch/x68k/stand/xxboot/ashrdi3.S               |  139 +++
 sys/arch/x68k/stand/xxboot/boot.S                  |  788 ++++++++++----------
 sys/arch/x68k/stand/xxboot/bootmain.c              |  140 +++-
 sys/arch/x68k/stand/xxboot/consio1.c               |    6 +-
 sys/arch/x68k/stand/xxboot/fdboot_ustarfs/Makefile |   11 +
 sys/arch/x68k/stand/xxboot/memcmp.S                |  150 +++
 sys/arch/x68k/stand/xxboot/memcpy.S                |  181 ++++
 sys/arch/x68k/stand/xxboot/memset.S                |  138 +++
 sys/arch/x68k/stand/xxboot/version                 |    3 +-
 sys/arch/x68k/stand/xxboot/xx.c                    |   22 +-
 sys/arch/x68k/stand/xxboot/xxboot.h                |   29 +-
 sys/arch/x68k/stand/xxboot/xxboot.ldscript         |    5 +
 sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile   |    3 +-
 sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile   |    3 +-
 sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile   |    3 +-
 sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile   |    3 +-
 19 files changed, 1317 insertions(+), 445 deletions(-)

diffs (truncated from 2125 to 300 lines):

diff -r cec8c84eb33e -r 031b5b489b76 sys/arch/x68k/stand/libiocs/iocscall.h
--- a/sys/arch/x68k/stand/libiocs/iocscall.h    Sun Aug 16 06:43:05 2020 +0000
+++ b/sys/arch/x68k/stand/libiocs/iocscall.h    Sun Aug 16 06:43:43 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iocscall.h,v 1.2 2020/01/18 05:07:34 isaki Exp $       */
+/*     $NetBSD: iocscall.h,v 1.3 2020/08/16 06:43:43 isaki Exp $       */
 
 /*
  *     IOCS call macros for X680x0
@@ -30,6 +30,7 @@
 #define __B_CLR_ST     0x2A
 #define __B_READ       0x46
 #define __B_RECALI     0x47
+#define __B_READID     0x4A
 #define __B_DRVCHK     0x4E
 #define __BOOTINF      0xFFFFFF8E
 #define __JISSFT       0xFFFFFFA1
diff -r cec8c84eb33e -r 031b5b489b76 sys/arch/x68k/stand/xxboot/Makefile.xxboot
--- a/sys/arch/x68k/stand/xxboot/Makefile.xxboot        Sun Aug 16 06:43:05 2020 +0000
+++ b/sys/arch/x68k/stand/xxboot/Makefile.xxboot        Sun Aug 16 06:43:43 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.xxboot,v 1.17 2020/08/14 03:54:46 isaki Exp $
+#      $NetBSD: Makefile.xxboot,v 1.18 2020/08/16 06:43:43 isaki Exp $
 
 NOMAN=         # defined
 
@@ -25,7 +25,12 @@
 S=             ${.CURDIR}/../../../../..
 M=             $S/arch/x68k
 .PATH:         ${.CURDIR}/..
-SRCS=  boot.S bootmain.c conf.c consio1.c xx.c
+SRCS=  boot.S bootmain.c conf.c xx.c
+SRCS+= ashrdi3.S
+SRCS+= ashldi3.S
+SRCS+= memcpy.S
+SRCS+= memset.S
+SRCS+= memcmp.S
 
 .include "${S}/conf/newvers_stand.mk"
 
@@ -47,7 +52,7 @@
 LINKFLAGS+=  --defsym=TEXTDATASIZE=$(TEXTDATASIZE)
 LIBIOCS!= cd $M/stand/libiocs && ${PRINTOBJDIR}
 LIBSA!=          cd $M/stand/libsa && ${PRINTOBJDIR}
-LDLIBS=          -L${LIBSA}/lib/sa -lsa -L ${LIBSA}/lib/kern -lkern
+LDLIBS=          -L ${LIBSA}/lib/kern -lkern
 LDLIBS+=  -L${LIBIOCS} -liocs
 
 .PATH: $S/lib/libsa
@@ -57,8 +62,11 @@
 CPPFLAGS+= -DLIBSA_NO_FS_WRITE
 CPPFLAGS+= -DLIBSA_NO_RAW_ACCESS
 CPPFLAGS+= -DLIBSA_NO_TWIDDLE
+CPPFLAGS+= -DUSTAR_SECT_PER_CYL=30
 SRCS+= open.c close.c read.c lseek.c loadfile.c loadfile_aout.c alloc.c
+SRCS+= errno.c globals.c
 SRCS+=  $(FS).c
+SRCS+= ${BOOTSRCS}
 
 .PATH: $M/stand/common
 SRCS+= exec_image.S
diff -r cec8c84eb33e -r 031b5b489b76 sys/arch/x68k/stand/xxboot/ashldi3.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/x68k/stand/xxboot/ashldi3.S      Sun Aug 16 06:43:43 2020 +0000
@@ -0,0 +1,121 @@
+/*     $NetBSD: ashldi3.S,v 1.1 2020/08/16 06:43:43 isaki Exp $        */
+
+/*
+ * Copyright (C) 2020 Tetsuya Isaki. All rights reserved.
+ * Copyright (C) 2020 Y.Sugahara (moveccr). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Size optimized version for primary bootloader.
+ */
+
+#include <machine/asm.h>
+
+ASENTRY_NOPROFILE(__ashldi3)
+               moveml  %sp@(4),%d0-%d1/%a0     | %d0:%d1 = quad value
+                                               | %a0     = shift count
+               jbra    start
+loop:
+               lsll    #1,%d1                  | X:%d1 =<< 1
+               roxll   #1,%d0                  | %d0:X =<< 1
+start:
+               subql   #1,%a0                  | sub %a0 doesn't affect ccr,
+               tstl    %a0                     |  but this extra TST op is
+                                               |  smaller than push/pop %d2.
+               jpl     loop
+               rts
+
+
+#if defined(SELFTEST)
+#include "iocscall.h"
+               .macro  PRINT   msg
+               leal    \msg,%a1
+               IOCS(__B_PRINT)
+               .endm
+
+               .macro  TEST    name
+               leal    \name,%a2
+               jbsr    test
+               .endm
+
+ASENTRY_NOPROFILE(selftest_ashldi3)
+               moveml  %d2-%d7/%a2-%a6,%sp@-
+               PRINT   %pc@(msg_testname)
+
+               TEST    test0
+               TEST    test1
+               TEST    test2
+               TEST    test63
+
+               PRINT   %pc@(msg_crlf)
+               moveml  %sp@+,%d2-%d7/%a2-%a6
+               rts
+
+test:
+               moveml  %a2@+,%d0-%d2           | %d0:%d1 = value
+                                               | %d2     = count
+               moveml  %d0-%d2,%sp@-
+               jbsr    __ashldi3
+               leal    %sp@(12),%sp
+
+               cmpl    %a2@+,%d0               | compare high word
+               jne     fail
+               cmpl    %a2@+,%d1               | compare low word
+               jne     fail
+               PRINT   %pc@(msg_ok)
+               rts
+fail:
+               PRINT   %pc@(msg_fail)
+               rts
+
+test0:         | count = 0
+               .long   0x11223344, 0x55667788
+               .long   0
+               .long   0x11223344, 0x55667788
+
+test1:         | count = 1
+               .long   0x11223344, 0x55667788
+               .long   1
+               .long   0x22446688, 0xaaccef10
+
+test2:         | count = 2
+               .long   0x11223344, 0x55667788
+               .long   2
+               .long   0x4488cd11, 0x5599de20
+
+test63:                | count = 63
+               .long   0x11223344, 0x55667789
+               .long   63
+               .long   0x80000000, 0x00000000
+
+msg_testname:
+               .asciz  "__ashldi3"
+msg_ok:
+               .asciz  " ok"
+msg_fail:
+               .asciz  " fail"
+msg_crlf:
+               .asciz  "\r\n"
+
+#endif
diff -r cec8c84eb33e -r 031b5b489b76 sys/arch/x68k/stand/xxboot/ashrdi3.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/x68k/stand/xxboot/ashrdi3.S      Sun Aug 16 06:43:43 2020 +0000
@@ -0,0 +1,139 @@
+/*     $NetBSD: ashrdi3.S,v 1.1 2020/08/16 06:43:43 isaki Exp $        */
+
+/*
+ * Copyright (C) 2020 Tetsuya Isaki. All rights reserved.
+ * Copyright (C) 2020 Y.Sugahara (moveccr). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Size optimized version for primary bootloader.
+ */
+
+#include <machine/asm.h>
+
+ASENTRY_NOPROFILE(__ashrdi3)
+               moveml  %sp@(4),%d0-%d1/%a0     | %d0:%d1 = quad value
+                                               | %a0     = shift count
+               jbra    start
+loop:
+               asrl    #1,%d0                  | %d0:X >>>= 1
+               roxrl   #1,%d1                  | X:%d1 >>= 1
+start:
+               subql   #1,%a0                  | sub %a0 doesn't affect ccr,
+               tstl    %a0                     |  but this extra TST op is
+                                               |  smaller than push/pop %d2.
+               jpl     loop
+               rts
+
+
+#if defined(SELFTEST)
+#include "iocscall.h"
+               .macro  PRINT   msg
+               leal    \msg,%a1
+               IOCS(__B_PRINT)
+               .endm
+
+               .macro  TEST    name
+               leal    \name,%a2
+               jbsr    test
+               .endm
+
+ASENTRY_NOPROFILE(selftest_ashrdi3)
+               moveml  %d2-%d7/%a2-%a6,%sp@-
+               PRINT   %pc@(msg_testname)
+
+               TEST    test0
+               TEST    test1p
+               TEST    test1m
+               TEST    test4p
+               TEST    test4m
+               TEST    test63p
+               TEST    test63m
+
+               PRINT   %pc@(msg_crlf)
+               moveml  %sp@+,%d2-%d7/%a2-%a6
+               rts
+
+test:
+               moveml  %a2@+,%d0-%d2           | %d0:%d1 = value
+                                               | %d2     = count
+               moveml  %d0-%d2,%sp@-
+               jbsr    __ashrdi3
+               leal    %sp@(12),%sp
+
+               cmpl    %a2@+,%d0               | compare high word
+               jne     fail
+               cmpl    %a2@+,%d1               | compare low word
+               jne     fail
+               PRINT   %pc@(msg_ok)
+               rts
+fail:
+               PRINT   %pc@(msg_fail)
+               rts
+
+test0:         | count = 0
+               .long   0x11223344, 0x55667788
+               .long   0
+               .long   0x11223344, 0x55667788
+
+test1p:                | count = 1
+               .long   0x11223344, 0x55667788
+               .long   1
+               .long   0x089119a2, 0x2ab33bc4
+
+test1m:                | count = 1 (negative value)
+               .long   0x91223344, 0x55667788
+               .long   1
+               .long   0xc89119a2, 0x2ab33bc4
+
+test4p:                | count = 4



Home | Main Index | Thread Index | Old Index