summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Niño Díaz <antonio.ninodiaz@arm.com>2018-12-18 15:22:49 +0100
committerGitHub <noreply@github.com>2018-12-18 15:22:49 +0100
commit85686f18420d13d2edcc3cd8e833be294e7b6914 (patch)
tree2da846f994203d8fb90675e0e94da7d0749acaed
parentbcc7ad76c62fe7a65b14cf796b3beb9813e2da69 (diff)
parent8b9a0de440223fb0820168c5a28e9dc4b46b153a (diff)
Merge pull request #1717 from satheesbalya-arm/sb1/sb1_2629_romlib_ifc
romlib: Add platform specific jump table list
-rw-r--r--Makefile2
-rw-r--r--lib/romlib/Makefile9
-rwxr-xr-xlib/romlib/gentbl.sh31
-rwxr-xr-xlib/romlib/genwrappers.sh2
-rw-r--r--lib/romlib/jmptbl.i67
-rw-r--r--plat/arm/board/fvp/jmptbl.i17
-rw-r--r--plat/arm/board/juno/jmptbl.i17
7 files changed, 103 insertions, 42 deletions
diff --git a/Makefile b/Makefile
index 18fdfe7d..5c61f8da 100644
--- a/Makefile
+++ b/Makefile
@@ -880,7 +880,7 @@ ${SPTOOL}:
.PHONY: libraries
romlib.bin: libraries
- ${Q}${MAKE} BUILD_PLAT=${BUILD_PLAT} INCLUDES='${INCLUDES}' DEFINES='${DEFINES}' --no-print-directory -C ${ROMLIBPATH} all
+ ${Q}${MAKE} PLAT_DIR=${PLAT_DIR} BUILD_PLAT=${BUILD_PLAT} INCLUDES='${INCLUDES}' DEFINES='${DEFINES}' --no-print-directory -C ${ROMLIBPATH} all
cscope:
@echo " CSCOPE"
diff --git a/lib/romlib/Makefile b/lib/romlib/Makefile
index 00dde31c..0e5d4475 100644
--- a/lib/romlib/Makefile
+++ b/lib/romlib/Makefile
@@ -60,11 +60,16 @@ $(WRAPPER_DIR)/jmpvar.s: $(BUILD_DIR)/romlib.elf
$(LIB_DIR)/libwrappers.a: jmptbl.i $(WRAPPER_DIR)/jmpvar.o
@echo " AR $@"
- $(Q)./genwrappers.sh -b $(WRAPPER_DIR) -o $@ jmptbl.i
+ $(Q)./genwrappers.sh -b $(WRAPPER_DIR) -o $@ $(BUILD_DIR)/jmptbl.i
$(BUILD_DIR)/jmptbl.s: jmptbl.i
@echo " TBL $@"
- $(Q)./gentbl.sh -o $@ jmptbl.i
+ if [ -e "../../$(PLAT_DIR)/jmptbl.i" ] ; \
+ then \
+ $(Q)./gentbl.sh -o $@ -b $(BUILD_DIR) ../../$(PLAT_DIR)/jmptbl.i; \
+ else \
+ @echo "USE_ROMLIB=1 requires jump table list file: jmptbl.i in platform directory"; \
+ fi
clean:
@rm -f $(BUILD_DIR)/*
diff --git a/lib/romlib/gentbl.sh b/lib/romlib/gentbl.sh
index 0695f6e4..e64cfe2b 100755
--- a/lib/romlib/gentbl.sh
+++ b/lib/romlib/gentbl.sh
@@ -6,6 +6,7 @@
set -e
output=jmptbl.s
+build=.
for i
do
@@ -14,27 +15,45 @@ do
output=$2
shift 2
;;
+ -b)
+ build=$2
+ shift 2
+ ;;
--)
shift
break
;;
-*)
- echo usage: gentbl.sh [-o output] file ... >&2
+ echo usage: gentbl.sh [-o output] [-b dir] file ... >&2
exit 1
;;
esac
done
tmp=`mktemp`
-trap "rm -f $tmp" EXIT INT QUIT
-
+trap "rm -f $$.tmp" EXIT INT QUIT
rm -f $output
+# Pre-process include files
+awk '!/^$/ && !/[:blank:]*#.*/{
+if (NF == 2 && $1 == "include") {
+ while ((getline line < $2) > 0)
+ if (line !~ /^$/ && line !~ /[:blank:]*#.*/)
+ print line
+ close($2)
+} else
+ print
+}' "$@" |
+awk -v OFS="\t" '
+BEGIN{print "#index\tlib\tfunction\t[patch]"}
+{print NR-1, $0}' | tee $build/jmptbl.i |
awk -v OFS="\n" '
BEGIN {print "\t.text",
"\t.globl\tjmptbl",
"jmptbl:"}
{sub(/[:blank:]*#.*/,"")}
-!/^$/ {print "\tb\t" $3}' "$@" > $tmp
-
-mv $tmp $output
+!/^$/ {if ($3 == "reserved")
+ print "\t.word\t0x0"
+ else
+ print "\tb\t" $3}' > $$.tmp &&
+mv $$.tmp $output
diff --git a/lib/romlib/genwrappers.sh b/lib/romlib/genwrappers.sh
index 48ee5a43..746e4ba9 100755
--- a/lib/romlib/genwrappers.sh
+++ b/lib/romlib/genwrappers.sh
@@ -31,7 +31,7 @@ do
done
awk '{sub(/[:blank:]*#.*/,"")}
-!/^$/ && !/\\tpatch$/ {print $1*4, $2, $3}' "$@" |
+!/^$/ && !/\\tpatch$/ !/\\treserved$/ {print $1*4, $2, $3}' "$@" |
while read idx lib sym
do
file=$build/${lib}_$sym
diff --git a/lib/romlib/jmptbl.i b/lib/romlib/jmptbl.i
index 5eca5aab..a7280d0d 100644
--- a/lib/romlib/jmptbl.i
+++ b/lib/romlib/jmptbl.i
@@ -4,37 +4,40 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# Format:
-# index lib function [patch]
+# lib function [patch]
# Add "patch" at the end of the line to patch a function. For example:
-# 14 mbedtls mbedtls_memory_buffer_alloc_init patch
+# mbedtls mbedtls_memory_buffer_alloc_init patch
+# Holes can be introduced in the table by using a special keyword "reserved".
+# Example:
+# reserved reserved
+# The jump table will contain an invalid instruction instead of branch
-0 rom rom_lib_init
-1 fdt fdt_getprop_namelen
-2 fdt fdt_setprop_inplace
-3 fdt fdt_check_header
-4 fdt fdt_node_offset_by_compatible
-5 mbedtls mbedtls_asn1_get_alg
-6 mbedtls mbedtls_asn1_get_alg_null
-7 mbedtls mbedtls_asn1_get_bitstring_null
-8 mbedtls mbedtls_asn1_get_bool
-9 mbedtls mbedtls_asn1_get_int
-10 mbedtls mbedtls_asn1_get_tag
-11 mbedtls mbedtls_free
-12 mbedtls mbedtls_md
-13 mbedtls mbedtls_md_get_size
-14 mbedtls mbedtls_memory_buffer_alloc_init
-15 mbedtls mbedtls_oid_get_md_alg
-16 mbedtls mbedtls_oid_get_numeric_string
-17 mbedtls mbedtls_oid_get_pk_alg
-18 mbedtls mbedtls_oid_get_sig_alg
-19 mbedtls mbedtls_pk_free
-20 mbedtls mbedtls_pk_init
-21 mbedtls mbedtls_pk_parse_subpubkey
-22 mbedtls mbedtls_pk_verify_ext
-23 mbedtls mbedtls_platform_set_calloc_free
-24 mbedtls mbedtls_platform_set_snprintf
-25 mbedtls mbedtls_x509_get_rsassa_pss_params
-26 mbedtls mbedtls_x509_get_sig_alg
-27 mbedtls mbedtls_md_info_from_type
-28 c exit
-29 c atexit \ No newline at end of file
+rom rom_lib_init
+fdt fdt_getprop_namelen
+fdt fdt_setprop_inplace
+fdt fdt_check_header
+fdt fdt_node_offset_by_compatible
+mbedtls mbedtls_asn1_get_alg
+mbedtls mbedtls_asn1_get_alg_null
+mbedtls mbedtls_asn1_get_bitstring_null
+mbedtls mbedtls_asn1_get_bool
+mbedtls mbedtls_asn1_get_int
+mbedtls mbedtls_asn1_get_tag
+mbedtls mbedtls_free
+mbedtls mbedtls_md
+mbedtls mbedtls_md_get_size
+mbedtls mbedtls_memory_buffer_alloc_init
+mbedtls mbedtls_oid_get_md_alg
+mbedtls mbedtls_oid_get_numeric_string
+mbedtls mbedtls_oid_get_pk_alg
+mbedtls mbedtls_oid_get_sig_alg
+mbedtls mbedtls_pk_free
+mbedtls mbedtls_pk_init
+mbedtls mbedtls_pk_parse_subpubkey
+mbedtls mbedtls_pk_verify_ext
+mbedtls mbedtls_platform_set_snprintf
+mbedtls mbedtls_x509_get_rsassa_pss_params
+mbedtls mbedtls_x509_get_sig_alg
+mbedtls mbedtls_md_info_from_type
+c exit
+c atexit
diff --git a/plat/arm/board/fvp/jmptbl.i b/plat/arm/board/fvp/jmptbl.i
new file mode 100644
index 00000000..8d232d58
--- /dev/null
+++ b/plat/arm/board/fvp/jmptbl.i
@@ -0,0 +1,17 @@
+#
+# Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Platform specific romlib functions can be added or included here.
+# The index in the output file will be generated cumulatively in the same
+# order as it is given in this file.
+# Output file can be found at: $BUILD_DIR/jmptbl.i
+#
+# Format:
+# lib function [patch]
+# Example:
+# rom rom_lib_init
+# fdt fdt_getprop_namelen patch
+
+include ../../lib/romlib/jmptbl.i
diff --git a/plat/arm/board/juno/jmptbl.i b/plat/arm/board/juno/jmptbl.i
new file mode 100644
index 00000000..8d232d58
--- /dev/null
+++ b/plat/arm/board/juno/jmptbl.i
@@ -0,0 +1,17 @@
+#
+# Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Platform specific romlib functions can be added or included here.
+# The index in the output file will be generated cumulatively in the same
+# order as it is given in this file.
+# Output file can be found at: $BUILD_DIR/jmptbl.i
+#
+# Format:
+# lib function [patch]
+# Example:
+# rom rom_lib_init
+# fdt fdt_getprop_namelen patch
+
+include ../../lib/romlib/jmptbl.i