summaryrefslogtreecommitdiff
path: root/cactus
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2017-11-22 13:56:57 +0000
committerSandrine Bailleux <sandrine.bailleux@arm.com>2017-11-23 09:23:08 +0000
commit3641e7df27de3e3a414ed8fd0e053d406a17d42d (patch)
treec28cd1c02ad686c3535b10b6c7b902d9d2424b36 /cactus
parent9ab2c503c01b052b77fdc14fc9589b4b63378472 (diff)
Cactus: Check the boot information data passed by the firmware
This patch examines the secure_partition_boot_info_t structure passed from TF to Cactus and makes sure it matches Cactus' expections. Also add some comments. Change-Id: I512384003b5192e63cfd9a9ed7cf4ef965090b95 Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Diffstat (limited to 'cactus')
-rw-r--r--cactus/cactus.h1
-rw-r--r--cactus/cactus.mk1
-rw-r--r--cactus/cactus_main.c20
3 files changed, 22 insertions, 0 deletions
diff --git a/cactus/cactus.h b/cactus/cactus.h
index 976fe62..88a041e 100644
--- a/cactus/cactus.h
+++ b/cactus/cactus.h
@@ -9,6 +9,7 @@
#include <types.h>
+/* Linker symbols used to figure out the memory layout of Cactus. */
extern uintptr_t __TEXT_START__, __TEXT_END__;
#define CACTUS_TEXT_START ((uintptr_t)&__TEXT_START__)
#define CACTUS_TEXT_END ((uintptr_t)&__TEXT_END__)
diff --git a/cactus/cactus.mk b/cactus/cactus.mk
index 5c37276..0ca9be7 100644
--- a/cactus/cactus.mk
+++ b/cactus/cactus.mk
@@ -14,6 +14,7 @@ CACTUS_SOURCES := cactus/aarch64/cactus_entrypoint.S \
cactus/cactus_tests_misc.c \
cactus/cactus_tests_system_setup.c \
drivers/arm/pl011/${ARCH}/pl011_console.S \
+ framework/debug.c \
framework/${ARCH}/asm_debug.S \
lib/${ARCH}/cache_helpers.S \
lib/${ARCH}/misc_helpers.S \
diff --git a/cactus/cactus_main.c b/cactus/cactus_main.c
index 0bec5aa..47225b8 100644
--- a/cactus/cactus_main.c
+++ b/cactus/cactus_main.c
@@ -15,6 +15,8 @@
#include "cactus.h"
#include "cactus_tests.h"
+
+/* Host machine information injected by the build system in the ELF file. */
extern const char build_message[];
extern const char version_string[];
@@ -73,9 +75,27 @@ int cactus_main(void *el3_el0_buffer, size_t el3_el0_buffer_size)
const secure_partition_boot_info_t *boot_info =
(const secure_partition_boot_info_t *) el3_el0_buffer;
+ if (el3_el0_buffer_size < sizeof(secure_partition_boot_info_t)) {
+ ERROR("The memory buffer shared between EL3/S-EL0 is too small\n");
+ ERROR("It is %lu bytes, it should be at least %lu bytes\n",
+ el3_el0_buffer_size,
+ sizeof(secure_partition_boot_info_t));
+ panic();
+ }
+
+ if ((CACTUS_TEXT_START != boot_info->sp_image_base) ||
+ (CACTUS_RWDATA_END > boot_info->sp_image_base
+ + boot_info->sp_image_size)) {
+ ERROR("Cactus does not fit in the buffer allocated for the secure partition\n");
+ panic();
+ }
+
cactus_print_memory_layout(boot_info);
+ /*
+ * Run tests.
+ */
misc_tests();
system_setup_tests();
mem_attr_changes_tests(boot_info);