From 745c5c702fbda516ce2ffc4ea5fab4733a300b08 Mon Sep 17 00:00:00 2001
From: raj <raj@FreeBSD.org>
Date: Tue, 14 Oct 2008 10:11:14 +0000
Subject: Initial support of loader(8) for ARM machines running U-Boot.

This uses the common U-Boot support lib (sys/boot/uboot, already used on
FreeBSD/powerpc), and assumes the underlying firmware has the modern API for
stand-alone apps enabled in the config (CONFIG_API).

Only netbooting is supported at the moment.

Obtained from:	Marvell, Semihalf
---
 sys/boot/common/load_elf.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'sys/boot/common/load_elf.c')

diff --git a/sys/boot/common/load_elf.c b/sys/boot/common/load_elf.c
index eabc426..35b3f0b 100644
--- a/sys/boot/common/load_elf.c
+++ b/sys/boot/common/load_elf.c
@@ -289,7 +289,16 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off)
 #ifdef ELF_VERBOSE
 	    printf("Converted entry 0x%08x\n", ehdr->e_entry);
 #endif
-	} else 
+	} else
+	    off = 0;
+#elif defined(__arm__)
+	if (off & 0xf0000000u) {
+	    off = -(off & 0xf0000000u);
+	    ehdr->e_entry += off;
+#ifdef ELF_VERBOSE
+	    printf("Converted entry 0x%08x\n", ehdr->e_entry);
+#endif
+	} else
 	    off = 0;
 #else
 	off = 0;		/* other archs use direct mapped kernels */
-- 
cgit v1.1