1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00

Don't set the offset when loading the kernel on the arm loader.efi. The

copyin and copyout code handle virtual addresses such that they will take
a virtual address and convert it into a valid physical address. It may
also mean we fail to boot as the elf files load address could be 0.

Sponsored by:	ABT Systems Ltd
This commit is contained in:
Andrew Turner 2016-02-09 09:39:30 +00:00
parent c075c8bb77
commit 35ad131a2a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=295429

View File

@ -353,7 +353,7 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off)
#endif
} else
off = 0;
#elif defined(__arm__)
#elif defined(__arm__) && !defined(EFI)
/*
* The elf headers in arm kernels specify virtual addresses in all
* header fields, even the ones that should be physical addresses.
@ -364,6 +364,11 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off)
* translates it to a physical address. We do the va->pa conversion on
* the entry point address in the header now, so that later we can
* launch the kernel by just jumping to that address.
*
* When booting from UEFI the copyin and copyout functions handle
* adjusting the location relative to the first virtual address.
* Because of this there is no need to adjust the offset or entry
* point address as these will both be handled by the efi code.
*/
off -= ehdr->e_entry & ~PAGE_MASK;
ehdr->e_entry += off;