ARM: Add secure section for initialized data
authorChen-Yu Tsai <wens@csie.org>
Tue, 5 Jul 2016 13:45:06 +0000 (21:45 +0800)
committerHans de Goede <hdegoede@redhat.com>
Fri, 15 Jul 2016 13:54:58 +0000 (15:54 +0200)
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@csie.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
arch/arm/config.mk
arch/arm/cpu/u-boot.lds
arch/arm/include/asm/secure.h

index 9a5a9747c48a4b82380c34f568fb1239be0cb6cd..8f8586295efd76e57f00c07c0214c103e8d99d4b 100644 (file)
@@ -120,8 +120,8 @@ endif
 ifdef CONFIG_ARM64
 OBJCOPYFLAGS += -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn
 else
-OBJCOPYFLAGS += -j .text -j .secure_text -j .rodata -j .hash -j .data -j \
-       .got -j .got.plt -j .u_boot_list -j .rel.dyn
+OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \
+               -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn
 endif
 
 ifdef CONFIG_OF_EMBED
index 5a65c27cfa74f90237c21fd0670909adb2690fe7..36c9fd0bd01f36737ed60b3b33d239b7cb860610 100644 (file)
@@ -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))
index 6d9088beb4d20725a1a2b7908e1fac5efbd48b34..5a403bc0f153593163f3883692233ac1386ff81d 100644 (file)
@@ -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
 /*