Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/arch/zaurus Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/0d4187ebad95
branches:  netbsd-8
changeset: 460773:0d4187ebad95
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Nov 03 11:38:50 2019 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #1420):

        sys/arch/zaurus/stand/zbsdmod/Makefile: revision 1.12
        sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.10
        sys/arch/zaurus/conf/Makefile.zaurus.inc: revision 1.10
        sys/arch/zaurus/stand/zbsdmod/zbsdmod.c: revision 1.11
        sys/arch/zaurus/stand/zbsdmod/compat_linux.h: revision 1.7

Explicitly set empty LINKENTRY to keep ENTRY address specified in ldscript.

This fixes kernel boot failures of NetBSD/zaurus 8.x and later.
While here, also set empty TEXTADDR also specified in ldscript.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/22/msg000069.html

Should be pulled up to netbsd-8 and netbsd-9.

 -

Fix another boot failure issue of NetBSD/zaurus 8.x and later.

It looks some cacheline alignment restriction so that zbsdmod.o in
NetBSD/zaurus 8.x release cannot jump to a loaded kernel properly.

Adding an explicit alingment pseudo op to put all instructions
between I-cache flush and jumping to the loaded kernel into the
same cacheline solves the issue.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/22/msg000069.html

Should be pulled up to netbsd-8 and netbsd-9.

 -

Misc cleanup to avoid future confusion.
- Remove more unnecessary debug sections
- Use DBG instead of COPTS to specify -Os as defined in bsd.prog.mk
- Use CFLAGS and CPPFLAGS correctly
- Explicitly set -ffreestanding

 -

Make sure to clear bss before jumping to a kernel copied from load buffer.
This will fix yet another boot failure issue
"screen white-out after loading a kernel"
 https://mail-index.netbsd.org/port-zaurus/2019/10/26/msg000072.html

Should be pulled up to netbsd-8 and netbsd-9.

diffstat:

 sys/arch/zaurus/conf/Makefile.zaurus.inc     |   4 +++-
 sys/arch/zaurus/stand/zbsdmod/Makefile       |  23 +++++++++++++++++------
 sys/arch/zaurus/stand/zbsdmod/compat_linux.h |   3 ++-
 sys/arch/zaurus/stand/zbsdmod/zbsdmod.c      |  13 ++++++++++++-
 4 files changed, 34 insertions(+), 9 deletions(-)

diffs (115 lines):

diff -r affce00f58b1 -r 0d4187ebad95 sys/arch/zaurus/conf/Makefile.zaurus.inc
--- a/sys/arch/zaurus/conf/Makefile.zaurus.inc  Fri Nov 01 09:30:36 2019 +0000
+++ b/sys/arch/zaurus/conf/Makefile.zaurus.inc  Sun Nov 03 11:38:50 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.zaurus.inc,v 1.9 2015/08/25 02:38:15 uebayasi Exp $
+#      $NetBSD: Makefile.zaurus.inc,v 1.9.10.1 2019/11/03 11:38:50 martin Exp $
 
 MACHINE_ARCH?=         arm
 CPPFLAGS+=             -D${MACHINE}
@@ -20,6 +20,8 @@
 KERNEL_BASE_VIRT=      $(LOADADDRESS)
 
 KERNLDSCRIPT=          ldscript
+TEXTADDR=              # defined in ldscript
+LINKENTRY=             # defined in ldscript
 
 EXTRA_CLEAN+=          netbsd.map assym.d ldscript tmp
 
diff -r affce00f58b1 -r 0d4187ebad95 sys/arch/zaurus/stand/zbsdmod/Makefile
--- a/sys/arch/zaurus/stand/zbsdmod/Makefile    Fri Nov 01 09:30:36 2019 +0000
+++ b/sys/arch/zaurus/stand/zbsdmod/Makefile    Sun Nov 03 11:38:50 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.10 2016/01/31 15:32:13 christos Exp $
+#      $NetBSD: Makefile,v 1.10.10.1 2019/11/03 11:38:50 martin Exp $
 
 WARNS?=        4
 
@@ -10,8 +10,18 @@
 SRCS=  zbsdmod.c
 NOMAN= # defined
 
+OBJCOPY_FLAGS=                 \
+       -R .debug_abbrev        \
+       -R .debug_aranges       \
+       -R .debug_info          \
+       -R .debug_line          \
+       -R .debug_loc           \
+       -R .debug_ranges        \
+       -R .debug_str           \
+       -R .eh_frame
+
 realall: ${OBJS}
-       ${OBJCOPY} -R .eh_frame ${.OBJDIR}/zbsdmod.o
+       ${OBJCOPY} ${OBJCOPY_FLAGS} ${.OBJDIR}/zbsdmod.o
 
 .include <bsd.klinks.mk>
 .include <bsd.prog.mk>
@@ -21,11 +31,12 @@
                ${OBJS} ${DESTDIR}/${BINDIR}
 
 CPUFLAGS=
-COPTS=         -Os
+DBG=           -Os
 CFLAGS+=       -fno-strict-aliasing
-CFLAGS+=       -DMACHINE=\"${MACHINE}\" -DUTS_RELEASE=\"2.4.20\"
-CPPFLAGS+=     ${ARM_APCS_FLAGS} -mcpu=xscale
-CPPFLAGS+=      -nostdinc -D_STANDALONE
+CFLAGS+=       -ffreestanding -nostdinc
+CFLAGS+=       ${ARM_APCS_FLAGS} -mcpu=xscale
+CPPFLAGS+=     -DMACHINE=\"${MACHINE}\" -DUTS_RELEASE=\"2.4.20\"
+CPPFLAGS+=     -D_STANDALONE
 CPPFLAGS+=     -I${.OBJDIR} -I${S}
 
 release: check_RELEASEDIR
diff -r affce00f58b1 -r 0d4187ebad95 sys/arch/zaurus/stand/zbsdmod/compat_linux.h
--- a/sys/arch/zaurus/stand/zbsdmod/compat_linux.h      Fri Nov 01 09:30:36 2019 +0000
+++ b/sys/arch/zaurus/stand/zbsdmod/compat_linux.h      Sun Nov 03 11:38:50 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_linux.h,v 1.6 2011/12/11 14:05:39 nonaka Exp $  */
+/*     $NetBSD: compat_linux.h,v 1.6.40.1 2019/11/03 11:38:50 martin Exp $     */
 /*     $OpenBSD: compat_linux.h,v 1.5 2006/01/15 17:58:27 deraadt Exp $        */
 
 /*
@@ -64,6 +64,7 @@
 extern int unregister_chrdev(unsigned int, const char *);
 extern void printk(const char *, ...) __printflike(1, 2);
 extern void *memcpy(void *, const void *, size_t);
+extern void *memset(void *, int, size_t);
 
 /* procfs support */
 struct proc_dir_entry {
diff -r affce00f58b1 -r 0d4187ebad95 sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
--- a/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c   Fri Nov 01 09:30:36 2019 +0000
+++ b/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c   Sun Nov 03 11:38:50 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zbsdmod.c,v 1.9 2013/12/02 18:36:11 joerg Exp $        */
+/*     $NetBSD: zbsdmod.c,v 1.9.22.1 2019/11/03 11:38:50 martin Exp $  */
 /*     $OpenBSD: zbsdmod.c,v 1.7 2005/05/02 02:45:29 uwe Exp $ */
 
 /*
@@ -262,6 +262,10 @@
                                    (((char *)elf) + phdr[i].p_offset)[sz];
                        }
                }
+               if (IS_BSS(phdr[i])) {
+                       memset((void *)(phdr[i].p_vaddr + phdr[i].p_filesz), 0,
+                           phdr[i].p_memsz - phdr[i].p_filesz);
+               }
        }
 
        addr = (int *)(elf->e_entry);
@@ -284,6 +288,13 @@
                "mov    r1, r1;"
                "sub    pc, pc, #4;"
                "mov    r1, #(0x00000010 | 0x00000020);"
+               /*
+                * Put the rest of instructions into the same cacheline
+                * to make sure no I$ refill after invalidation.
+                */
+               "b      2f;"
+               ".align 5;"
+               "2:"
                "mcr    p15, 0, r1, c1, c0, 0;" /* Write new control register */
                "mcr    p15, 0, r1, c8, c7, 0;" /* invalidate I+D TLB */
                "mcr    p15, 0, r1, c7, c5, 0;" /* invalidate I$ and BTB */



Home | Main Index | Thread Index | Old Index