From be3e3c568ab76fbd0d725aeb7a42fc94f982557b Mon Sep 17 00:00:00 2001 From: Amir Cohen Date: Sun, 22 Oct 2017 10:54:58 +0300 Subject: [PATCH] Add msplim_ns for public box --- api/src/uvisor-input.S | 3 +++ core/system/inc/linker.h | 3 +++ core/system/src/main.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/api/src/uvisor-input.S b/api/src/uvisor-input.S index 95536a4f..321e4319 100644 --- a/api/src/uvisor-input.S +++ b/api/src/uvisor-input.S @@ -114,6 +114,9 @@ uvisor_config: /* Debug driver pointer */ .long __uvisor_debug_driver + /* Stack limit for public box MSPLIM_NS, accessed by public_box_stack_limit */ + .long __StackLimit + /* uVisor mode of operation * Modes available: UVISOR_ENABLED, UVISOR_DISABLED, UVISOR_PERMISSIVE. */ __uvisor_mode: diff --git a/core/system/inc/linker.h b/core/system/inc/linker.h index a173b2cb..df6030fc 100644 --- a/core/system/inc/linker.h +++ b/core/system/inc/linker.h @@ -121,6 +121,9 @@ typedef struct { UvisorLibHooks const * const lib_hooks; TUvisorDebugDriver const * const debug_driver; + + /* Stack limit for public box MSPNS_LIM*/ + uint32_t public_box_stack_limit; } UVISOR_PACKED UvisorConfig; extern UvisorConfig const __uvisor_config; diff --git a/core/system/src/main.c b/core/system/src/main.c index 4f168803..3a9ef5ea 100644 --- a/core/system/src/main.c +++ b/core/system/src/main.c @@ -161,6 +161,9 @@ void main_init(void) /* NS P stack pointer, for the RTOS and the uVisor-ns. */ __TZ_set_MSP_NS(original_sp); + /* NS P limit, for the RTOS and the uVisor-ns. */ + __TZ_set_MSPLIM_NS(__uvisor_config.public_box_stack_limit); + /* S NP stack pointer, for the SDSs and the transition gateways. */ __set_PSP((uint32_t) &__uvisor_stack_top_np__); #else /* defined(ARCH_CORE_ARMv8M) */