[U-Boot] [PATCH 12/15] ARM: Add secure section for initialized data

Chen-Yu Tsai wens at csie.org
Sun Jun 19 06:38:42 CEST 2016


The secure monitor may need to store global or static values within the
secure section of memory, such as target PC or CPU power status.

Signed-off-by: Chen-Yu Tsai <wens at csie.org>
---
 arch/arm/cpu/u-boot.lds       | 9 +++++++--
 arch/arm/include/asm/secure.h | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index 5a65c27cfa74..36c9fd0bd01f 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -69,12 +69,17 @@ SECTIONS
 		*(._secure.text)
 	}
 
-	.secure_stack ALIGN(ADDR(.secure_text) + SIZEOF(.secure_text),
+	.secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text))
+	{
+		*(._secure.data)
+	}
+
+	.secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data),
 			    CONSTANT(COMMONPAGESIZE)) (NOLOAD) :
 #ifdef __ARMV7_PSCI_STACK_IN_RAM
 		AT(ADDR(.secure_stack))
 #else
-		AT(LOADADDR(.secure_text) + SIZEOF(.secure_text))
+		AT(LOADADDR(.secure_data) + SIZEOF(.secure_data))
 #endif
 	{
 		KEEP(*(.__secure_stack_start))
diff --git a/arch/arm/include/asm/secure.h b/arch/arm/include/asm/secure.h
index 6d9088beb4d2..5a403bc0f153 100644
--- a/arch/arm/include/asm/secure.h
+++ b/arch/arm/include/asm/secure.h
@@ -4,6 +4,7 @@
 #include <config.h>
 
 #define __secure __attribute__ ((section ("._secure.text")))
+#define __secure_data __attribute__ ((section ("._secure.data")))
 
 #ifdef CONFIG_ARMV7_SECURE_BASE
 /*
-- 
2.8.1



More information about the U-Boot mailing list