diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cpus/aarch64/cortex_a76.S | 5 | ||||
-rw-r--r-- | lib/cpus/aarch64/cortex_a76ae.S | 5 | ||||
-rw-r--r-- | lib/cpus/aarch64/cortex_deimos.S | 5 | ||||
-rw-r--r-- | lib/cpus/aarch64/neoverse_e1.S | 5 | ||||
-rw-r--r-- | lib/cpus/aarch64/neoverse_n1.S | 5 | ||||
-rw-r--r-- | lib/cpus/aarch64/neoverse_zeus.S | 5 | ||||
-rw-r--r-- | lib/romlib/Makefile | 9 | ||||
-rwxr-xr-x | lib/romlib/gentbl.sh | 13 | ||||
-rwxr-xr-x | lib/romlib/genwrappers.sh | 27 |
9 files changed, 70 insertions, 9 deletions
diff --git a/lib/cpus/aarch64/cortex_a76.S b/lib/cpus/aarch64/cortex_a76.S index b48283cbb..868667ebc 100644 --- a/lib/cpus/aarch64/cortex_a76.S +++ b/lib/cpus/aarch64/cortex_a76.S @@ -18,6 +18,11 @@ #error "Cortex-A76 must be compiled with HW_ASSISTED_COHERENCY enabled" #endif +/* 64-bit only core */ +#if CTX_INCLUDE_AARCH32_REGS == 1 +#error "Cortex-A76 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" +#endif + #define ESR_EL3_A64_SMC0 0x5e000000 #define ESR_EL3_A32_SMC0 0x4e000000 diff --git a/lib/cpus/aarch64/cortex_a76ae.S b/lib/cpus/aarch64/cortex_a76ae.S index 46e9450f2..888f98b50 100644 --- a/lib/cpus/aarch64/cortex_a76ae.S +++ b/lib/cpus/aarch64/cortex_a76ae.S @@ -13,6 +13,11 @@ #error "Cortex-A76AE must be compiled with HW_ASSISTED_COHERENCY enabled" #endif +/* 64-bit only core */ +#if CTX_INCLUDE_AARCH32_REGS == 1 +#error "Cortex-A76AE supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" +#endif + /* --------------------------------------------- * HW will do the cache maintenance while powering down * --------------------------------------------- diff --git a/lib/cpus/aarch64/cortex_deimos.S b/lib/cpus/aarch64/cortex_deimos.S index e73e89f73..df4c12853 100644 --- a/lib/cpus/aarch64/cortex_deimos.S +++ b/lib/cpus/aarch64/cortex_deimos.S @@ -16,6 +16,11 @@ #error "Deimos must be compiled with HW_ASSISTED_COHERENCY enabled" #endif +/* 64-bit only core */ +#if CTX_INCLUDE_AARCH32_REGS == 1 +#error "Cortex-Deimos supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" +#endif + /* --------------------------------------------- * HW will do the cache maintenance while powering down * --------------------------------------------- diff --git a/lib/cpus/aarch64/neoverse_e1.S b/lib/cpus/aarch64/neoverse_e1.S index 71e7b5171..d840da84b 100644 --- a/lib/cpus/aarch64/neoverse_e1.S +++ b/lib/cpus/aarch64/neoverse_e1.S @@ -16,6 +16,11 @@ #error "Neoverse E1 must be compiled with HW_ASSISTED_COHERENCY enabled" #endif +/* 64-bit only core */ +#if CTX_INCLUDE_AARCH32_REGS == 1 +#error "Neoverse-E1 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" +#endif + func neoverse_e1_cpu_pwr_dwn mrs x0, NEOVERSE_E1_CPUPWRCTLR_EL1 orr x0, x0, #NEOVERSE_E1_CPUPWRCTLR_EL1_CORE_PWRDN_BIT diff --git a/lib/cpus/aarch64/neoverse_n1.S b/lib/cpus/aarch64/neoverse_n1.S index 3b8e8afb7..d685b7e9b 100644 --- a/lib/cpus/aarch64/neoverse_n1.S +++ b/lib/cpus/aarch64/neoverse_n1.S @@ -15,6 +15,11 @@ #error "Neoverse N1 must be compiled with HW_ASSISTED_COHERENCY enabled" #endif +/* 64-bit only core */ +#if CTX_INCLUDE_AARCH32_REGS == 1 +#error "Neoverse-N1 supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" +#endif + /* -------------------------------------------------- * Errata Workaround for Neoverse N1 Erratum 1043202. * This applies to revision r0p0 and r1p0 of Neoverse N1. diff --git a/lib/cpus/aarch64/neoverse_zeus.S b/lib/cpus/aarch64/neoverse_zeus.S index c5241afab..3d850137c 100644 --- a/lib/cpus/aarch64/neoverse_zeus.S +++ b/lib/cpus/aarch64/neoverse_zeus.S @@ -16,6 +16,11 @@ #error "Neoverse Zeus must be compiled with HW_ASSISTED_COHERENCY enabled" #endif +/* 64-bit only core */ +#if CTX_INCLUDE_AARCH32_REGS == 1 +#error "Neoverse-Zeus supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" +#endif + /* --------------------------------------------- * HW will do the cache maintenance while powering down * --------------------------------------------- diff --git a/lib/romlib/Makefile b/lib/romlib/Makefile index 7a3a51ea0..bc05d0fa8 100644 --- a/lib/romlib/Makefile +++ b/lib/romlib/Makefile @@ -29,6 +29,11 @@ ifeq ($(DEBUG),1) LDFLAGS += -Map=$(MAPFILE) endif +ifeq (${ARM_ARCH_MINOR},0) + ASFLAGS = -march=armv8-a +else + ASFLAGS = -march=armv8.${ARM_ARCH_MINOR}-a +endif .PHONY: all clean distclean @@ -60,13 +65,13 @@ $(WRAPPER_DIR)/jmpvar.s: $(BUILD_DIR)/romlib.elf $(LIB_DIR)/libwrappers.a: $(BUILD_DIR)/jmptbl.i $(WRAPPER_DIR)/jmpvar.o @echo " AR $@" - $(Q)./genwrappers.sh -b $(WRAPPER_DIR) -o $@ $(BUILD_DIR)/jmptbl.i + $(Q)./genwrappers.sh -b $(WRAPPER_DIR) -o $@ --bti=$(ENABLE_BTI) --asflags=$(ASFLAGS) $(BUILD_DIR)/jmptbl.i $(BUILD_DIR)/jmptbl.i: $(BUILD_DIR)/jmptbl.s $(BUILD_DIR)/jmptbl.s: ../../$(PLAT_DIR)/jmptbl.i @echo " TBL $@" - $(Q)./gentbl.sh -o $@ -b $(BUILD_DIR) ../../$(PLAT_DIR)/jmptbl.i + $(Q)./gentbl.sh -o $@ -b $(BUILD_DIR) --bti=$(ENABLE_BTI) ../../$(PLAT_DIR)/jmptbl.i clean: @rm -f $(BUILD_DIR)/* diff --git a/lib/romlib/gentbl.sh b/lib/romlib/gentbl.sh index e64cfe2be..bfb1ec3cf 100755 --- a/lib/romlib/gentbl.sh +++ b/lib/romlib/gentbl.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. +# Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause @@ -19,6 +19,10 @@ do build=$2 shift 2 ;; + --bti=*) + enable_bti=$(echo $1 | sed 's/--bti=\(.*\)/\1/') + shift 1 + ;; --) shift break @@ -47,12 +51,15 @@ if (NF == 2 && $1 == "include") { awk -v OFS="\t" ' BEGIN{print "#index\tlib\tfunction\t[patch]"} {print NR-1, $0}' | tee $build/jmptbl.i | -awk -v OFS="\n" ' +awk -v OFS="\n" -v BTI=$enable_bti ' BEGIN {print "\t.text", "\t.globl\tjmptbl", "jmptbl:"} {sub(/[:blank:]*#.*/,"")} -!/^$/ {if ($3 == "reserved") +!/^$/ { + if (BTI == 1) + print "\tbti\tj" + if ($3 == "reserved") print "\t.word\t0x0" else print "\tb\t" $3}' > $$.tmp && diff --git a/lib/romlib/genwrappers.sh b/lib/romlib/genwrappers.sh index 07d59ac45..e092548e0 100755 --- a/lib/romlib/genwrappers.sh +++ b/lib/romlib/genwrappers.sh @@ -19,6 +19,14 @@ do build=$2 shift 2 ;; + --bti=*) + enable_bti=$(echo $1 | sed 's/--bti=\(.*\)/\1/') + shift 1 + ;; + --asflags=*) + asflags=$(echo $1 | sed 's/--asflags=\(.*\)/\1/') + shift 1 + ;; --) shift break @@ -30,8 +38,13 @@ do esac done -awk '{sub(/[:blank:]*#.*/,"")} -!/^$/ && $NF != "patch" && $NF != "reserved" {print $1*4, $2, $3}' "$@" | +awk -v BTI=$enable_bti ' +{sub(/[:blank:]*#.*/,"")} +!/^$/ && $NF != "patch" && $NF != "reserved" { + if (BTI == 1) + print $1*8, $2, $3 + else + print $1*4, $2, $3}' "$@" | while read idx lib sym do file=$build/${lib}_$sym @@ -39,14 +52,20 @@ do cat <<EOF > $file.s .globl $sym $sym: +EOF +if [ $enable_bti = 1 ] +then + echo "\tbti\tjc" >> $file.s +fi + cat <<EOF >> $file.s ldr x17, =jmptbl - ldr x17, [x17] mov x16, #$idx + ldr x17, [x17] add x16, x16, x17 br x16 EOF - ${CROSS_COMPILE}as -o $file.o $file.s + ${CROSS_COMPILE}as ${asflags} -o $file.o $file.s done ${CROSS_COMPILE}ar -rc $out $build/*.o |