Module Name: src
Committed By: nonaka
Date: Fri Mar 24 08:50:17 UTC 2017
Modified Files:
src/sys/arch/i386/stand/lib: exec.c
Log Message:
efiboot: fix calculation of the kernel size when loading modules.
To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/i386/stand/lib/exec.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/i386/stand/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.67 src/sys/arch/i386/stand/lib/exec.c:1.68
--- src/sys/arch/i386/stand/lib/exec.c:1.67 Sun Mar 12 05:33:48 2017
+++ src/sys/arch/i386/stand/lib/exec.c Fri Mar 24 08:50:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.67 2017/03/12 05:33:48 nonaka Exp $ */
+/* $NetBSD: exec.c,v 1.68 2017/03/24 08:50:17 nonaka Exp $ */
/*
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -469,14 +469,16 @@ count_netbsd(const char *file, u_long *r
{
u_long marks[MARK_MAX];
char kdev[64];
- char base_path[64];
+ char base_path[64] = "/";
struct stat st;
boot_module_t *bm;
u_long sz;
int err, fd;
+ howto = AB_SILENT;
+
memset(marks, 0, sizeof(marks));
- if ((fd = loadfile(file, marks, COUNT_KERNEL)) == -1)
+ if ((fd = loadfile(file, marks, COUNT_KERNEL | LOAD_NOTE)) == -1)
return -1;
close(fd);
marks[MARK_END] = (((u_long) marks[MARK_END] + sizeof(int) - 1)) &
@@ -490,13 +492,13 @@ count_netbsd(const char *file, u_long *r
/* If the root fs type is unusual, load its module. */
if (fsmod != NULL)
- module_add(__UNCONST(fsmod));
+ module_add_common(fsmod, BM_TYPE_KMOD);
for (bm = boot_modules; bm; bm = bm->bm_next) {
fd = module_open(bm, 0, kdev, base_path, false);
if (fd == -1)
continue;
- sz = (image_end + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
+ sz = (sz + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
err = fstat(fd, &st);
if (err == -1 || st.st_size == -1) {
close(fd);