Module Name:    src
Committed By:   nonaka
Date:           Sun Dec 11 14:05:39 UTC 2011

Modified Files:
        src/sys/arch/zaurus/stand/zbsdmod: Makefile compat_linux.h zbsdmod.c

Log Message:
- WARNS=4
- object size is more smaller.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/zaurus/stand/zbsdmod/Makefile \
    src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.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/zaurus/stand/zbsdmod/Makefile
diff -u src/sys/arch/zaurus/stand/zbsdmod/Makefile:1.5 src/sys/arch/zaurus/stand/zbsdmod/Makefile:1.6
--- src/sys/arch/zaurus/stand/zbsdmod/Makefile:1.5	Mon Apr 13 12:25:36 2009
+++ src/sys/arch/zaurus/stand/zbsdmod/Makefile	Sun Dec 11 14:05:39 2011
@@ -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 @@ afterinstall:
 	${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}
Index: src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
diff -u src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h:1.5 src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h:1.6
--- src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h:1.5	Sun Dec 26 09:02:52 2010
+++ src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h	Sun Dec 11 14:05:39 2011
@@ -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	int unregister_chrdev(unsigned in
 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;

Index: src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
diff -u src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.6 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.7
--- src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.6	Thu May  5 09:07:59 2011
+++ src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c	Sun Dec 11 14:05:39 2011
@@ -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,10 +21,22 @@
  * Zaurus NetBSD bootstrap loader.
  */
 
-#include "compat_linux.h"
+#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"
+
+/* 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
 #define ZBOOTDEV_NAME	"zboot"
@@ -57,6 +69,11 @@ static struct file_operations fops = {
 	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 @@ elf32bsdboot(void)
 			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 @@ elf32bsdboot(void)
 	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 @@ zbsdmod_close(struct inode *ino, struct 
 		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 {

Reply via email to