Set a "kernbase" symbol in 32-bit arm locore.S and use it with ldscript.arm.

This brings arm into line with how every other arch does it.  For some
reason, only arm lacked a definition of a symbol named kernbase in its
locore.S file(s) for use in its ldscript.arm file.  Needlessly different
means harder to maintain.

Using a common symbol name also eases work in progress on a script to help
generate arm and arm64 kernels packaged in various ways (like with a header
blob needed for a bootloader prepended to the kernel file).
This commit is contained in:
Ian Lepore 2019-12-30 23:20:46 +00:00
parent 1f8bdab601
commit 140da6f8fe
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356211
3 changed files with 9 additions and 4 deletions

View File

@ -62,9 +62,11 @@ __FBSDID("$FreeBSD$");
*/ */
.text .text
.align 2 .align 2
.globl kernbase
.set kernbase,KERNVIRTADDR
#ifdef PHYSADDR #ifdef PHYSADDR
.globl kernbase
.set kernbase,KERNBASE
.globl physaddr .globl physaddr
.set physaddr,PHYSADDR .set physaddr,PHYSADDR
#endif #endif

View File

@ -59,6 +59,9 @@ __FBSDID("$FreeBSD$");
.text .text
.align 2 .align 2
.globl kernbase
.set kernbase,KERNVIRTADDR
#if __ARM_ARCH >= 7 #if __ARM_ARCH >= 7
#define HANDLE_HYP \ #define HANDLE_HYP \
/* Leave HYP mode */ ;\ /* Leave HYP mode */ ;\

View File

@ -61,7 +61,7 @@ KERNVIRTADDR= 0xc0000000
# "ELF for the ARM architecture" for more info on the mapping symbols. # "ELF for the ARM architecture" for more info on the mapping symbols.
SYSTEM_LD= \ SYSTEM_LD= \
${SYSTEM_LD_BASECMD} \ ${SYSTEM_LD_BASECMD} \
--defsym='text_start=${KERNVIRTADDR} + SIZEOF_HEADERS' \ --defsym='text_start=kernbase + SIZEOF_HEADERS' \
-o ${.TARGET} ${SYSTEM_OBJS} vers.o; \ -o ${.TARGET} ${SYSTEM_OBJS} vers.o; \
$(OBJCOPY) \ $(OBJCOPY) \
--wildcard \ --wildcard \
@ -77,7 +77,7 @@ KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin
${KERNEL_KO}.bin: ${SYSTEM_DEP} vers.o ${KERNEL_KO}.bin: ${SYSTEM_DEP} vers.o
@echo "linking ${.TARGET}" @echo "linking ${.TARGET}"
@${SYSTEM_LD_BASECMD} \ @${SYSTEM_LD_BASECMD} \
--defsym='text_start=${KERNVIRTADDR}' \ --defsym='text_start=kernbase' \
-o ${.TARGET} ${SYSTEM_OBJS} vers.o -o ${.TARGET} ${SYSTEM_OBJS} vers.o
${SIZE} ${.TARGET} ${SIZE} ${.TARGET}
@${OBJCOPY} \ @${OBJCOPY} \