Module Name: src Committed By: isaki Date: Thu Apr 5 12:01:37 UTC 2012
Modified Files: src/sys/arch/x68k/stand/mboot: Makefile mboot.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x68k/stand/mboot/Makefile cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x68k/stand/mboot/mboot.c 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/x68k/stand/mboot/Makefile diff -u src/sys/arch/x68k/stand/mboot/Makefile:1.15 src/sys/arch/x68k/stand/mboot/Makefile:1.16 --- src/sys/arch/x68k/stand/mboot/Makefile:1.15 Mon Jan 12 07:56:31 2009 +++ src/sys/arch/x68k/stand/mboot/Makefile Thu Apr 5 12:01:36 2012 @@ -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 @@ TEXTSZ= 1024 PROG= ${BOOT} BINDIR= /usr/mdec BINMODE= 444 -NOMAN= # defined STRIPFLAG= STRIP?= /usr/bin/strip @@ -20,17 +22,19 @@ KERN!= cd ${.CURDIR}/../../../..; pwd 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 Index: src/sys/arch/x68k/stand/mboot/mboot.c diff -u src/sys/arch/x68k/stand/mboot/mboot.c:1.9 src/sys/arch/x68k/stand/mboot/mboot.c:1.10 --- src/sys/arch/x68k/stand/mboot/mboot.c:1.9 Sat Oct 1 15:59:01 2011 +++ src/sys/arch/x68k/stand/mboot/mboot.c Thu Apr 5 12:01:36 2012 @@ -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) {