Port-zaurus archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: NetBSD/zaurus 8.1 problems and possible fixes
I wrote:
> (1) Incorrect entry point in kernel LINKFLAGS
:
> Index: conf/Makefile.zaurus.inc
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/zaurus/conf/Makefile.zaurus.inc,v
> retrieving revision 1.9
> diff -u -p -d -r1.9 Makefile.zaurus.inc
> --- conf/Makefile.zaurus.inc 25 Aug 2015 02:38:15 -0000 1.9
> +++ conf/Makefile.zaurus.inc 22 Oct 2019 04:49:32 -0000
> @@ -20,6 +20,8 @@ SYSTEM_LD_TAIL_EXTRA+=; \
> KERNEL_BASE_VIRT= $(LOADADDRESS)
>
> KERNLDSCRIPT= ldscript
> +TEXTADDR= # defined in ldscript
> +LINKENTRY= # defined in ldscript
>
> EXTRA_CLEAN+= netbsd.map assym.d ldscript tmp
>
> ---
> (2) Unexpected zbsdmod.o (Linux kmod) behavior
:
> Index: stand/zbsdmod/zbsdmod.c
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c,v
> retrieving revision 1.9
> diff -u -p -d -r1.9 zbsdmod.c
> --- stand/zbsdmod/zbsdmod.c 2 Dec 2013 18:36:11 -0000 1.9
> +++ stand/zbsdmod/zbsdmod.c 22 Oct 2019 04:49:32 -0000
> @@ -284,6 +284,13 @@ elf32bsdboot(void)
> "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 */
>
I've committed these two fixes. (pending-pullups)
> 2. Unaddressed (but workarounded) issue
>
> (1) Kernel fault 'Alignment Fault 3'
This is not addressed. However it looks options DIAGNOSTIC
can avoid this fault, and commenting out COPY_SYMTAB
is also required in that case to shrink kernel size.
(COPY_SYMTAB consumes ~500KB, but I wonder if zbsdmod.o
loads symbol table)
> (2) yet another kernel load failure
>
> The modified above GENERIC kernel works, but when I removed
> the "COPTS" line, "options DIAGNOSTIC", or "COPY_SYMTAB" line,
> the each modified kernel is not loaded (or executed) properly.
>
> The behavior is similar to the following movie reported
> by Sevan Janiyan on this list back in 2017:
> https://mail-index.netbsd.org/port-zaurus/2017/04/01/msg000065.html
> >> https://www.geeklan.co.uk/files/tmp/zaurus3.mov
>
> I have no idea what happens in this case.
This seems caused by uninitialized kernel BSS on loading kernel
by zbsdmod.o.
With the following change, some kernels (that caused white-out screen
like the above when loaded by the previous zbsdmod.o) are loaded
properly.
Index: compat_linux.h
===================================================================
RCS file: /cvsroot/src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h,v
retrieving revision 1.6
diff -u -p -d -r1.6 compat_linux.h
--- compat_linux.h 11 Dec 2011 14:05:39 -0000 1.6
+++ compat_linux.h 26 Oct 2019 14:26:05 -0000
@@ -64,6 +64,7 @@ extern int register_chrdev(unsigned int,
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 {
Index: zbsdmod.c
===================================================================
RCS file: /cvsroot/src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c,v
retrieving revision 1.10
diff -u -p -d -r1.10 zbsdmod.c
--- zbsdmod.c 26 Oct 2019 09:58:40 -0000 1.10
+++ zbsdmod.c 26 Oct 2019 14:26:05 -0000
@@ -262,6 +262,10 @@ elf32bsdboot(void)
(((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);
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index