Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/stand/efiboot Consistently have ALIGN sizes as the power...
details: https://anonhg.NetBSD.org/src/rev/de61248bdf17
branches: trunk
changeset: 379109:de61248bdf17
user: skrll <skrll%NetBSD.org@localhost>
date: Tue May 11 07:15:10 2021 +0000
description:
Consistently have ALIGN sizes as the power of two size, i.e. change
FDT_ALIGN, and use the same math(s) to round.
In the process fix the load_offset for the kernel to use the EFIBOOT_ALIGN
aligned address if that's what we get from AllocatePages.
diffstat:
sys/stand/efiboot/exec.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diffs (45 lines):
diff -r eac3391d9698 -r de61248bdf17 sys/stand/efiboot/exec.c
--- a/sys/stand/efiboot/exec.c Tue May 11 06:58:03 2021 +0000
+++ b/sys/stand/efiboot/exec.c Tue May 11 07:15:10 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.19 2020/10/10 19:17:39 jmcneill Exp $ */
+/* $NetBSD: exec.c,v 1.20 2021/05/11 07:15:10 skrll Exp $ */
/*-
* Copyright (c) 2019 Jason R. Thorpe
@@ -42,7 +42,7 @@ extern char twiddle_toggle;
u_long load_offset = 0;
#define FDT_SPACE (4 * 1024 * 1024)
-#define FDT_ALIGN ((2 * 1024 * 1024) - 1)
+#define FDT_ALIGN (2 * 1024 * 1024)
static EFI_PHYSICAL_ADDRESS initrd_addr, dtb_addr, rndseed_addr, efirng_addr;
static u_long initrd_size = 0, dtb_size = 0, rndseed_size = 0, efirng_size = 0;
@@ -260,7 +260,7 @@ exec_netbsd(const char *fname, const cha
return EIO;
}
close(fd);
- marks[MARK_END] = (((u_long) marks[MARK_END] + sizeof(int) - 1)) & (-sizeof(int));
+ marks[MARK_END] = (((u_long) marks[MARK_END] + sizeof(int) - 1)) & -sizeof(int);
alloc_size = marks[MARK_END] - marks[MARK_START] + FDT_SPACE + EFIBOOT_ALIGN;
#ifdef EFIBOOT_ALLOCATE_MAX_ADDRESS
@@ -279,7 +279,7 @@ exec_netbsd(const char *fname, const cha
}
memset(marks, 0, sizeof(marks));
- load_offset = (addr + EFIBOOT_ALIGN) & ~(EFIBOOT_ALIGN - 1);
+ load_offset = (addr + EFIBOOT_ALIGN - 1) & -EFIBOOT_ALIGN;
fd = loadfile(fname, marks, LOAD_KERNEL);
if (fd < 0) {
printf("boot: %s: %s\n", fname, strerror(errno));
@@ -308,7 +308,7 @@ exec_netbsd(const char *fname, const cha
load_file(get_rndseed_path(), 0, false,
&rndseed_addr, &rndseed_size);
- efi_fdt_init((marks[MARK_END] + FDT_ALIGN) & ~FDT_ALIGN, FDT_ALIGN + 1);
+ efi_fdt_init((marks[MARK_END] + FDT_ALIGN - 1) & -FDT_ALIGN, FDT_ALIGN);
load_modules(fname);
load_fdt_overlays();
efi_fdt_initrd(initrd_addr, initrd_size);
Home |
Main Index |
Thread Index |
Old Index