Module Name:    src
Committed By:   jmcneill
Date:           Sun Sep  2 23:50:23 UTC 2018

Modified Files:
        src/sys/arch/evbarm/include: loadfile_machdep.h
        src/sys/stand/efiboot: exec.c

Log Message:
Support loading kernels at PAs above 0x3fffffffff on arm64


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/include/loadfile_machdep.h
cvs rdiff -u -r1.2 -r1.3 src/sys/stand/efiboot/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/evbarm/include/loadfile_machdep.h
diff -u src/sys/arch/evbarm/include/loadfile_machdep.h:1.4 src/sys/arch/evbarm/include/loadfile_machdep.h:1.5
--- src/sys/arch/evbarm/include/loadfile_machdep.h:1.4	Thu Aug 23 19:01:22 2018
+++ src/sys/arch/evbarm/include/loadfile_machdep.h	Sun Sep  2 23:50:23 2018
@@ -9,7 +9,8 @@
 #define COUNT_KERNEL	(COUNT_ALL & ~COUNT_TEXTA)
 
 #if defined(__aarch64__)
-#define LOADADDR(a)		((((u_long)(a)) + offset) & 0x3fffffffff)
+extern u_long			load_offset;
+#define LOADADDR(a)		(((((u_long)(a)) + offset) & 0x3fffffffff) + load_offset)
 #else
 #define LOADADDR(a)		(((u_long)(a)))
 #endif

Index: src/sys/stand/efiboot/exec.c
diff -u src/sys/stand/efiboot/exec.c:1.2 src/sys/stand/efiboot/exec.c:1.3
--- src/sys/stand/efiboot/exec.c:1.2	Mon Aug 27 09:51:32 2018
+++ src/sys/stand/efiboot/exec.c	Sun Sep  2 23:50:23 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.2 2018/08/27 09:51:32 jmcneill Exp $ */
+/* $NetBSD: exec.c,v 1.3 2018/09/02 23:50:23 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <[email protected]>
@@ -31,6 +31,8 @@
 
 #include <loadfile.h>
 
+u_long load_offset = 0;
+
 int
 exec_netbsd(const char *fname, const char *args)
 {
@@ -65,13 +67,14 @@ exec_netbsd(const char *fname, const cha
 	}
 
 	memset(marks, 0, sizeof(marks));
-	marks[MARK_START] = (addr + EFIBOOT_ALIGN) & ~(EFIBOOT_ALIGN - 1);
+	load_offset = (addr + EFIBOOT_ALIGN) & ~(EFIBOOT_ALIGN - 1);
 	fd = loadfile(fname, marks, LOAD_KERNEL);
 	if (fd < 0) {
 		printf("boot: %s: %s\n", fname, strerror(errno));
 		goto cleanup;
 	}
 	close(fd);
+	load_offset = 0;
 
 	if (efi_fdt_size() > 0) {
 		efi_fdt_bootargs(args);

Reply via email to