aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolodymyr Babchuk <vlad.babchuk@gmail.com>2018-02-06 21:59:54 +0200
committerJérôme Forissier <jerome.forissier@linaro.org>2019-02-01 14:56:34 +0100
commitc211d0a49ecf2673dfb90f29fa31840eda12a18d (patch)
tree6dd6a931f55c4b2c3b898956130c19335e383043
parent15216d4da08190b15d38303f12a42017fb46d551 (diff)
virt: tag variables with __nex_data and __nex_bss
Variables that are needed by OP-TEE nexus will be moved to nexus memory. Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
-rw-r--r--core/arch/arm/kernel/generic_boot.c2
-rw-r--r--core/arch/arm/kernel/thread.c37
-rw-r--r--core/arch/arm/kernel/trace_ext.c4
-rw-r--r--core/arch/arm/mm/core_mmu.c18
-rw-r--r--core/arch/arm/mm/core_mmu_lpae.c7
-rw-r--r--core/arch/arm/plat-vexpress/main.c4
-rw-r--r--core/kernel/console.c2
-rw-r--r--lib/libutils/isoc/bget_malloc.c2
-rw-r--r--lib/libutils/isoc/stack_check.c3
9 files changed, 42 insertions, 37 deletions
diff --git a/core/arch/arm/kernel/generic_boot.c b/core/arch/arm/kernel/generic_boot.c
index 35f36885..f49ff0dd 100644
--- a/core/arch/arm/kernel/generic_boot.c
+++ b/core/arch/arm/kernel/generic_boot.c
@@ -79,7 +79,7 @@ struct dt_descriptor {
int frag_id;
};
-static struct dt_descriptor external_dt;
+static struct dt_descriptor external_dt __nex_bss;
#endif
#ifdef CFG_SECONDARY_INIT_CNTFRQ
diff --git a/core/arch/arm/kernel/thread.c b/core/arch/arm/kernel/thread.c
index 2ce1eae0..f78c9bcd 100644
--- a/core/arch/arm/kernel/thread.c
+++ b/core/arch/arm/kernel/thread.c
@@ -71,7 +71,7 @@
struct thread_ctx threads[CFG_NUM_THREADS];
-struct thread_core_local thread_core_local[CFG_TEE_CORE_NB_CORE];
+struct thread_core_local thread_core_local[CFG_TEE_CORE_NB_CORE] __nex_bss;
#ifdef CFG_WITH_STACK_CANARIES
#ifdef ARM32
@@ -118,31 +118,36 @@ const uint32_t stack_tmp_stride = sizeof(stack_tmp[0]);
KEEP_PAGER(stack_tmp_export);
KEEP_PAGER(stack_tmp_stride);
-thread_smc_handler_t thread_std_smc_handler_ptr;
-static thread_smc_handler_t thread_fast_smc_handler_ptr;
-thread_nintr_handler_t thread_nintr_handler_ptr;
-thread_pm_handler_t thread_cpu_on_handler_ptr;
-thread_pm_handler_t thread_cpu_off_handler_ptr;
-thread_pm_handler_t thread_cpu_suspend_handler_ptr;
-thread_pm_handler_t thread_cpu_resume_handler_ptr;
-thread_pm_handler_t thread_system_off_handler_ptr;
-thread_pm_handler_t thread_system_reset_handler_ptr;
+thread_smc_handler_t thread_std_smc_handler_ptr __nex_bss;
+static thread_smc_handler_t thread_fast_smc_handler_ptr __nex_bss;
+thread_nintr_handler_t thread_nintr_handler_ptr __nex_bss;
+thread_pm_handler_t thread_cpu_on_handler_ptr __nex_bss;
+thread_pm_handler_t thread_cpu_off_handler_ptr __nex_bss;
+thread_pm_handler_t thread_cpu_suspend_handler_ptr __nex_bss;
+thread_pm_handler_t thread_cpu_resume_handler_ptr __nex_bss;
+thread_pm_handler_t thread_system_off_handler_ptr __nex_bss;
+thread_pm_handler_t thread_system_reset_handler_ptr __nex_bss;
#ifdef CFG_CORE_UNMAP_CORE_AT_EL0
-static vaddr_t thread_user_kcode_va;
-long thread_user_kcode_offset;
-static size_t thread_user_kcode_size;
+static vaddr_t thread_user_kcode_va __nex_bss;
+long thread_user_kcode_offset __nex_bss;
+static size_t thread_user_kcode_size __nex_bss;
#endif
#if defined(CFG_CORE_UNMAP_CORE_AT_EL0) && \
defined(CFG_CORE_WORKAROUND_SPECTRE_BP_SEC) && defined(ARM64)
-long thread_user_kdata_sp_offset;
+long thread_user_kdata_sp_offset __nex_bss;
static uint8_t thread_user_kdata_page[
ROUNDUP(sizeof(thread_core_local), SMALL_PAGE_SIZE)]
- __aligned(SMALL_PAGE_SIZE) __section(".nozi.kdata_page");
+ __aligned(SMALL_PAGE_SIZE)
+#ifndef CFG_VIRTUALIZATION
+ __section(".nozi.kdata_page");
+#else
+ __section(".nex_nozi.kdata_page");
+#endif
#endif
-static unsigned int thread_global_lock = SPINLOCK_UNLOCK;
+static unsigned int thread_global_lock __nex_bss = SPINLOCK_UNLOCK;
static bool thread_prealloc_rpc_cache;
static unsigned int thread_rpc_pnum;
diff --git a/core/arch/arm/kernel/trace_ext.c b/core/arch/arm/kernel/trace_ext.c
index 6165582a..9f847907 100644
--- a/core/arch/arm/kernel/trace_ext.c
+++ b/core/arch/arm/kernel/trace_ext.c
@@ -10,8 +10,8 @@
#include <mm/core_mmu.h>
const char trace_ext_prefix[] = "TC";
-int trace_level = TRACE_LEVEL;
-static unsigned int puts_lock = SPINLOCK_UNLOCK;
+int trace_level __nex_data = TRACE_LEVEL;
+static unsigned int puts_lock __nex_bss = SPINLOCK_UNLOCK;
void trace_ext_puts(const char *str)
{
diff --git a/core/arch/arm/mm/core_mmu.c b/core/arch/arm/mm/core_mmu.c
index b6eca709..b7d59f6e 100644
--- a/core/arch/arm/mm/core_mmu.c
+++ b/core/arch/arm/mm/core_mmu.c
@@ -44,11 +44,11 @@
*/
/* Default NSec shared memory allocated from NSec world */
-unsigned long default_nsec_shm_size;
-unsigned long default_nsec_shm_paddr;
+unsigned long default_nsec_shm_size __nex_bss;
+unsigned long default_nsec_shm_paddr __nex_bss;
static struct tee_mmap_region
- static_memory_map[CFG_MMAP_REGIONS + 1];
+ static_memory_map[CFG_MMAP_REGIONS + 1] __nex_bss;
/* Define the platform's memory layout. */
struct memaccess_area {
@@ -57,14 +57,14 @@ struct memaccess_area {
};
#define MEMACCESS_AREA(a, s) { .paddr = a, .size = s }
-static struct memaccess_area secure_only[] = {
+static struct memaccess_area secure_only[] __nex_data = {
#ifdef TZSRAM_BASE
MEMACCESS_AREA(TZSRAM_BASE, TZSRAM_SIZE),
#endif
MEMACCESS_AREA(TZDRAM_BASE, TZDRAM_SIZE),
};
-static struct memaccess_area nsec_shared[] = {
+static struct memaccess_area nsec_shared[] __nex_data = {
MEMACCESS_AREA(TEE_SHMEM_START, TEE_SHMEM_SIZE),
};
@@ -111,8 +111,8 @@ register_phys_mem(MEM_AREA_NSEC_SHM, TEE_SHMEM_START, TEE_SHMEM_SIZE);
*/
#define MMU_NUM_ASID_PAIRS 64
-static bitstr_t bit_decl(g_asid, MMU_NUM_ASID_PAIRS);
-static unsigned int g_asid_spinlock = SPINLOCK_UNLOCK;
+static bitstr_t bit_decl(g_asid, MMU_NUM_ASID_PAIRS) __nex_bss;
+static unsigned int g_asid_spinlock __nex_bss = SPINLOCK_UNLOCK;
static unsigned int mmu_spinlock;
@@ -299,8 +299,8 @@ static void check_phys_mem_is_outside(struct core_mmu_phys_mem *start,
}
}
-static const struct core_mmu_phys_mem *discovered_nsec_ddr_start;
-static size_t discovered_nsec_ddr_nelems;
+static const struct core_mmu_phys_mem *discovered_nsec_ddr_start __nex_bss;
+static size_t discovered_nsec_ddr_nelems __nex_bss;
static int cmp_pmem_by_addr(const void *a, const void *b)
{
diff --git a/core/arch/arm/mm/core_mmu_lpae.c b/core/arch/arm/mm/core_mmu_lpae.c
index 2c71bc41..d2c7dd87 100644
--- a/core/arch/arm/mm/core_mmu_lpae.c
+++ b/core/arch/arm/mm/core_mmu_lpae.c
@@ -201,10 +201,9 @@ static uint64_t xlat_tables[MAX_XLAT_TABLES][XLAT_TABLE_ENTRIES]
static uint64_t xlat_tables_ul1[CFG_NUM_THREADS][XLAT_TABLE_ENTRIES]
__aligned(XLAT_TABLE_SIZE) __section(".nozi.mmu.l2");
-
-static unsigned int next_xlat;
-static paddr_t max_pa;
-static int user_va_idx = -1;
+static unsigned int next_xlat __nex_bss;
+static paddr_t max_pa __nex_bss;
+static int user_va_idx __nex_data = -1;
static uint32_t desc_to_mattr(unsigned level, uint64_t desc)
{
diff --git a/core/arch/arm/plat-vexpress/main.c b/core/arch/arm/plat-vexpress/main.c
index adcc74a6..e1ec463a 100644
--- a/core/arch/arm/plat-vexpress/main.c
+++ b/core/arch/arm/plat-vexpress/main.c
@@ -49,8 +49,8 @@ static const struct thread_handlers handlers = {
#endif
};
-static struct gic_data gic_data;
-static struct pl011_data console_data;
+static struct gic_data gic_data __nex_bss;
+static struct pl011_data console_data __nex_bss;
register_phys_mem(MEM_AREA_IO_SEC, CONSOLE_UART_BASE, PL011_REG_SIZE);
#if defined(PLATFORM_FLAVOR_fvp)
diff --git a/core/kernel/console.c b/core/kernel/console.c
index 7dbaba26..5d5e9554 100644
--- a/core/kernel/console.c
+++ b/core/kernel/console.c
@@ -16,7 +16,7 @@
#include <libfdt.h>
#endif
-static struct serial_chip *serial_console;
+static struct serial_chip *serial_console __nex_bss;
void __weak console_putc(int ch)
{
diff --git a/lib/libutils/isoc/bget_malloc.c b/lib/libutils/isoc/bget_malloc.c
index 8defeb0d..c614af45 100644
--- a/lib/libutils/isoc/bget_malloc.c
+++ b/lib/libutils/isoc/bget_malloc.c
@@ -178,7 +178,7 @@ static void malloc_unlock(struct malloc_ctx *ctx __unused,
static DEFINE_CTX(malloc_ctx);
#ifdef CFG_VIRTUALIZATION
-static DEFINE_CTX(nex_malloc_ctx);
+static __nex_data DEFINE_CTX(nex_malloc_ctx);
#endif
#ifdef BufStats
diff --git a/lib/libutils/isoc/stack_check.c b/lib/libutils/isoc/stack_check.c
index ca8a9dcb..2a0b2a80 100644
--- a/lib/libutils/isoc/stack_check.c
+++ b/lib/libutils/isoc/stack_check.c
@@ -2,7 +2,8 @@
/*
* Copyright (c) 2014, STMicroelectronics International N.V.
*/
-void *__stack_chk_guard = (void *)0x00000aff;
+#include <compiler.h>
+void *__stack_chk_guard __nex_data = (void *)0x00000aff;
void __attribute__((noreturn)) __stack_chk_fail(void);