Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/stand/lib efiboot: fix calculation of the kern...



details:   https://anonhg.NetBSD.org/src/rev/5f6cd5a6c27c
branches:  trunk
changeset: 822534:5f6cd5a6c27c
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Fri Mar 24 08:50:17 2017 +0000

description:
efiboot: fix calculation of the kernel size when loading modules.

diffstat:

 sys/arch/i386/stand/lib/exec.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (44 lines):

diff -r b46196549eae -r 5f6cd5a6c27c sys/arch/i386/stand/lib/exec.c
--- a/sys/arch/i386/stand/lib/exec.c    Fri Mar 24 08:18:27 2017 +0000
+++ b/sys/arch/i386/stand/lib/exec.c    Fri Mar 24 08:50:17 2017 +0000
@@ -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 @@
 {
        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 @@
 
                /* 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);



Home | Main Index | Thread Index | Old Index