Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/zaurus/stand/zbsdmod - WARNS=4



details:   https://anonhg.NetBSD.org/src/rev/94e6841e7b5a
branches:  trunk
changeset: 771951:94e6841e7b5a
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Sun Dec 11 14:05:39 2011 +0000

description:
- WARNS=4
- object size is more smaller.

diffstat:

 sys/arch/zaurus/stand/zbsdmod/Makefile       |  10 ++++-
 sys/arch/zaurus/stand/zbsdmod/compat_linux.h |  14 +--------
 sys/arch/zaurus/stand/zbsdmod/zbsdmod.c      |  43 ++++++++++++++++++---------
 3 files changed, 37 insertions(+), 30 deletions(-)

diffs (154 lines):

diff -r c729d034c74a -r 94e6841e7b5a sys/arch/zaurus/stand/zbsdmod/Makefile
--- a/sys/arch/zaurus/stand/zbsdmod/Makefile    Sun Dec 11 11:05:11 2011 +0000
+++ b/sys/arch/zaurus/stand/zbsdmod/Makefile    Sun Dec 11 14:05:39 2011 +0000
@@ -1,10 +1,12 @@
-#      $NetBSD: Makefile,v 1.5 2009/04/13 12:25:36 nonaka Exp $
+#      $NetBSD: Makefile,v 1.6 2011/12/11 14:05:39 nonaka Exp $
+
+WARNS?=        4
 
 S=     ${.CURDIR}/../../../..
 
 OBJS=  zbsdmod.o
 SRCS=  zbsdmod.c
-NOMAN= yes
+NOMAN= # defined
 
 realall: ${OBJS}
 
@@ -15,7 +17,9 @@
        ${INSTALL_FILE} ${INSTALL_COPY} -o root -g wheel -m 644 \
                ${OBJS} ${DESTDIR}/${BINDIR}
 
-CFLAGS=                -Wall -Wmissing-prototypes -Wstrict-prototypes
+CPUFLAGS=
+COPTS=         -Os
+CFLAGS+=       -fno-strict-aliasing
 CFLAGS+=       -DMACHINE=\"${MACHINE}\" -DUTS_RELEASE=\"2.4.20\"
 CPPFLAGS+=      -nostdinc -D_STANDALONE
 CPPFLAGS+=     -I${.OBJDIR} -I${S}
diff -r c729d034c74a -r 94e6841e7b5a sys/arch/zaurus/stand/zbsdmod/compat_linux.h
--- a/sys/arch/zaurus/stand/zbsdmod/compat_linux.h      Sun Dec 11 11:05:11 2011 +0000
+++ b/sys/arch/zaurus/stand/zbsdmod/compat_linux.h      Sun Dec 11 14:05:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_linux.h,v 1.5 2010/12/26 09:02:52 nonaka Exp $  */
+/*     $NetBSD: compat_linux.h,v 1.6 2011/12/11 14:05:39 nonaka Exp $  */
 /*     $OpenBSD: compat_linux.h,v 1.5 2006/01/15 17:58:27 deraadt Exp $        */
 
 /*
@@ -31,12 +31,6 @@
 struct file;
 struct inode;
 
-#include <sys/cdefs.h>
-#define        ELFSIZE 32
-#include <sys/exec_elf.h>
-#include <sys/types.h>
-#include <sys/errno.h>
-
 typedef long loff_t;
 
 struct file_operations {
@@ -71,12 +65,6 @@
 extern void printk(const char *, ...) __printflike(1, 2);
 extern void *memcpy(void *, const void *, size_t);
 
-/* Linux LKM support */
-static const char __module_kernel_version[] __attribute__((section(".modinfo"))) =
-"kernel_version=" UTS_RELEASE;
-static const char __module_using_checksums[] __attribute__((section(".modinfo"))) =
-"using_checksums=1";
-
 /* procfs support */
 struct proc_dir_entry {
         unsigned short low_ino;
diff -r c729d034c74a -r 94e6841e7b5a sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
--- a/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c   Sun Dec 11 11:05:11 2011 +0000
+++ b/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c   Sun Dec 11 14:05:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zbsdmod.c,v 1.6 2011/05/05 09:07:59 nonaka Exp $       */
+/*     $NetBSD: zbsdmod.c,v 1.7 2011/12/11 14:05:39 nonaka Exp $       */
 /*     $OpenBSD: zbsdmod.c,v 1.7 2005/05/02 02:45:29 uwe Exp $ */
 
 /*
@@ -21,9 +21,21 @@
  * Zaurus NetBSD bootstrap loader.
  */
 
+#include <sys/cdefs.h>
+#define ELFSIZE 32
+#include <sys/exec_elf.h>
+#include <sys/types.h>
+#include <sys/errno.h>
+
+#include <machine/bootinfo.h>
+
 #include "compat_linux.h"
 
-#include <machine/bootinfo.h>
+/* Linux LKM support */
+const char __module_kernel_version[] __attribute__((section(".modinfo"))) =
+    "kernel_version=" UTS_RELEASE;
+const char __module_using_checksums[] __attribute__((section(".modinfo"))) =
+    "using_checksums=1";
 
 #define ZBOOTDEV_MAJOR 99
 #define ZBOOTDEV_MODE  0222
@@ -57,6 +69,11 @@
        0,                      /* check media change */
        0,                      /* revalidate */
        0,                      /* lock */
+       0,                      /* sendpage */
+       0,                      /* get_unmapped_area */
+#ifdef MAGIC_ROM_PTR
+       0,                      /* romptr */
+#endif /* MAGIC_ROM_PTR */
 };
 
 static int isopen;
@@ -108,7 +125,7 @@
                        continue;
 
 #define IS_TEXT(p)     (p.p_flags & PF_X)
-#define IS_DATA(p)     ((p.p_flags & PF_X) == 0)
+#define IS_DATA(p)     (p.p_flags & PF_W)
 #define IS_BSS(p)      (p.p_filesz < p.p_memsz)
                /*
                 * XXX: Assume first address is lowest
@@ -249,16 +266,16 @@
        addr = (int *)(elf->e_entry);
        __asm volatile (
                "mov    r0, %0;"
-               "mov    r2, #0;"
-               "mcr    p15, 0, r2, c7, c7, 0;"
-               "mov    r2, r2;"
+               "mcr    p15, 0, r1, c7, c7, 0;"
+               "mrc    p15, 0, r1, c2, c0, 0;"
+               "mov    r1, r1;"
                "sub    pc, pc, #4;"
                "mov    r1, #(0x00000010 | 0x00000020);"
                "mcr    p15, 0, r1, c1, c0, 0;"
-               "mcr    p15, 0, r2, c8, c7, 0;"
-               "mov    r2, r2;"
-               "sub    pc, pc, #4;"
-               "mov    pc, r0" :: "r"(addr) : "r0","r1","r2");
+               "mcr    p15, 0, r1, c8, c7, 0;"
+               "mrc    p15, 0, r1, c2, c0, 0;"
+               "sub    pc, r0, r1, lsr #32;"
+               :: "r" (addr) : "r0", "r1");
 }
 
 /*
@@ -346,10 +363,8 @@
                return -EBUSY;
 
        if (position > 0) {
-               printk("%s: loaded %ld bytes\n", ZBOOTDEV_NAME,
-                   position);
-
-               if (position < BOOTINFO_MAXSIZE) {
+               printk("%s: loaded %ld bytes\n", ZBOOTDEV_NAME, position);
+               if (position < (loff_t)BOOTINFO_MAXSIZE) {
                        *(u_int *)bootargs = BOOTARGS_MAGIC;
                        memcpy(bootargs + sizeof(u_int), bsdimage, position);
                } else {



Home | Main Index | Thread Index | Old Index