Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tsutsui
Last active October 26, 2019 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsutsui/2033b30e7ccec8a5130f4a6441f53f82 to your computer and use it in GitHub Desktop.
Save tsutsui/2033b30e7ccec8a5130f4a6441f53f82 to your computer and use it in GitHub Desktop.
Another fix for NetBSD/zaurus load failure issue (no BSS clear after kernel load)
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment