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/mboot Use common library libiocs.a. sug...



details:   https://anonhg.NetBSD.org/src/rev/dcbfa0a0b84d
branches:  trunk
changeset: 778572:dcbfa0a0b84d
user:      isaki <isaki%NetBSD.org@localhost>
date:      Thu Apr 05 12:01:36 2012 +0000

description:
Use common library libiocs.a.  suggested by tsutsui@.
o Originally, mboot had an IOCS_S_READEXT() inline function but
  its expansion corrupted (from somewhere after branching netbsd-5).
  This solves PR#46293 by using the common library.
  This problem was reported by Y.Sugahara at NetBSD booth at
  Open Source Conference (OSC) 2012 Ehime in March.
o As a side effect, it also correct the different problem that
  IOCS_S_READ() calls _S_READEXT not _S_READ.
Should be pulled up to netbsd-6.

diffstat:

 sys/arch/x68k/stand/mboot/Makefile |  12 +++-
 sys/arch/x68k/stand/mboot/mboot.c  |  97 +------------------------------------
 2 files changed, 11 insertions(+), 98 deletions(-)

diffs (159 lines):

diff -r 2e495fa83839 -r dcbfa0a0b84d sys/arch/x68k/stand/mboot/Makefile
--- a/sys/arch/x68k/stand/mboot/Makefile        Thu Apr 05 11:05:53 2012 +0000
+++ b/sys/arch/x68k/stand/mboot/Makefile        Thu Apr 05 12:01:36 2012 +0000
@@ -1,4 +1,7 @@
-#      $NetBSD: Makefile,v 1.15 2009/01/12 07:56:31 tsutsui Exp $
+#      $NetBSD: Makefile,v 1.16 2012/04/05 12:01:36 isaki Exp $
+
+NOMAN=         # defined
+.include <bsd.own.mk>
 
 BOOT=          mboot
 VERSION=       0.1
@@ -10,7 +13,6 @@
 PROG=          ${BOOT}
 BINDIR=                /usr/mdec
 BINMODE=       444
-NOMAN=         # defined
 STRIPFLAG=
 
 STRIP?=                /usr/bin/strip
@@ -20,17 +22,19 @@
 
 CPPFLAGS+=     -D_STANDALONE
 CPPFLAGS+=     -nostdinc -I${KERN} -I${.CURDIR} -I.
-#CPPFLAGS+=    -I${.CURDIR}/../libiocs
+CPPFLAGS+=     -I${.CURDIR}/../libiocs
 CPPFLAGS+=     -DTEXTADDR="0x${TEXT}" 
 CPPFLAGS+=     -DBOOT=\"${BOOT}\" -DBOOT_VERS=\"${VERSION}\"
 CFLAGS=                -Wno-main -Os -m68000
 
 LINKFLAGS=     -N -static -Ttext ${TEXT}
+LIBIOCS!=      cd ${.CURDIR}/../libiocs && ${PRINTOBJDIR}
+LDLIBS+=       ${LIBIOCS}/libiocs.a
 
 .include "../Makefile.booters"
 
 realall: ${PROG}
-${BOOT}:       ${OBJS}
+${BOOT}:       ${OBJS} ${LDLIBS}
        ${_MKTARGET_LINK}
        ${LD} ${LINKFLAGS} -o ${BOOT}.x ${OBJS} ${LDLIBS}
 #      ${STRIP} ${BOOT}.x
diff -r 2e495fa83839 -r dcbfa0a0b84d sys/arch/x68k/stand/mboot/mboot.c
--- a/sys/arch/x68k/stand/mboot/mboot.c Thu Apr 05 11:05:53 2012 +0000
+++ b/sys/arch/x68k/stand/mboot/mboot.c Thu Apr 05 12:01:36 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mboot.c,v 1.9 2011/10/01 15:59:01 chs Exp $    */
+/*     $NetBSD: mboot.c,v 1.10 2012/04/05 12:01:36 isaki Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -32,105 +32,14 @@
 #include <sys/types.h>
 #include <machine/disklabel.h>
 
-int bootmain(int);
-
-struct iocs_readcap {
-       unsigned long   block;
-       unsigned long   size;
-};
-static inline int
-IOCS_BITSNS (int row)
-{
-       register unsigned int reg_d0 __asm ("%d0");
-
-       __asm volatile ("movel %1,%%d1\n\t"
-                         "movel #0x04,%0\n\t"
-                         "trap #15"
-                         : "=d" (reg_d0)
-                         : "ri" ((int) row)
-                         : "%d1");
-
-       return reg_d0;
-}
-static inline void
-IOCS_B_PRINT (const char *str)
-{
-       __asm volatile ("moval %0,%%a1\n\t"
-                         "movel #0x21,%%d0\n\t"
-                         "trap #15\n\t"
-                         :
-                         : "a" ((int) str)
-                         : "%a1", "%d0");
-       return;
-}
-static inline int
-IOCS_S_READCAP (int id, struct iocs_readcap *cap)
-{
-       register int reg_d0 __asm ("%d0");
+#include "iocs.h"
 
-       __asm volatile ("moveml %%d4,%%sp@-\n\t"
-                         "movel %2,%%d4\n\t"
-                         "moval %3,%%a1\n\t"
-                         "movel #0x25,%%d1\n\t"
-                         "movel #0xf5,%%d0\n\t"
-                         "trap #15\n\t"
-                         "moveml %%sp@+,%%d4"
-                         : "=d" (reg_d0), "=m" (*cap)
-                         : "ri" (id), "g" ((int) cap)
-                         : "%d1", "%a1");
-
-       return reg_d0;
-}
-static inline int
-IOCS_S_READ (int pos, int blk, int id, int size, void *buf)
-{
-       register int reg_d0 __asm ("%d0");
-
-       __asm volatile ("moveml %%d3-%%d5,%%sp@-\n\t"
-                         "movel %2,%%d2\n\t"
-                         "movel %3,%%d3\n\t"
-                         "movel %4,%%d4\n\t"
-                         "movel %5,%%d5\n\t"
-                         "moval %6,%%a1\n\t"
-                         "movel #0x26,%%d1\n\t"
-                         "movel #0xf5,%%d0\n\t"
-                         "trap #15\n\t"
-                         "moveml %%sp@+,%%d3-%%d5"
-                         : "=d" (reg_d0), "=m" (*(char*) buf)
-                         : "ri" (pos), "ri" (blk), "ri" (id), "ri" (size), "g" ((int) buf)
-                         : "%d1", "%d2", "%a1");
-
-       return reg_d0;
-}
-
-static inline int
-IOCS_S_READEXT (int pos, int blk, int id, int size, void *buf)
-{
-       register int reg_d0 __asm ("%d0");
-
-       __asm volatile ("moveml %%d3-%%d5,%%sp@-\n\t"
-                         "movel %2,%%d2\n\t"
-                         "movel %3,%%d3\n\t"
-                         "movel %4,%%d4\n\t"
-                         "movel %5,%%d5\n\t"
-                         "moval %6,%%a1\n\t"
-                         "movel #0x26,%%d1\n\t"
-                         "movel #0xf5,%%d0\n\t"
-                         "trap #15\n\t"
-                         "moveml %%sp@+,%%d3-%%d5"
-                         : "=d" (reg_d0), "=m" (*(char*) buf)
-                         : "ri" (pos), "ri" (blk), "ri" (id), "ri" (size), "g" ((int) buf)
-                         : "%d1", "%d2", "%a1");
-
-       return reg_d0;
-}
+int bootmain(int);
 
 #define PART_BOOTABLE  0
 #define PART_UNUSED    1
 #define PART_INUSE     2
 
-
-
 int
 bootmain(int scsiid)
 {



Home | Main Index | Thread Index | Old Index