diff options
author | Furquan Shaikh <furquan@google.com> | 2014-09-10 12:19:38 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-03-28 07:05:08 +0100 |
commit | ab020f304efdac61d38876a95005d8478659faae (patch) | |
tree | d45d9d3e5a09eb57111985cdf234df53e35ce3a4 /src/arch/arm64/stage_entry.S | |
parent | f228e8d435f2f8c4a7ab954b9d9c2136f74fe560 (diff) |
arm64: Adapt stage_entry to make it usable by secmon
stage_entry is the best place to enter for secmon, since it sets up all the
stacks right. The only need we need to take care is losing out on the parameter
passed to secmon. This patch adds an entry point for secmon rmodule and moves
the argument from x0 to x25, which is restored just before the jump to c_entry
BUG=chrome-os-partner:30785
BRANCH=None
TEST=Compiles successfully
Change-Id: I9638e9716b3bd5bff272e88fe9d965528d71e394
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: ffedb03208bafab6d5886db0259ec205dd20588f
Original-Change-Id: I74a7a609fbc08692d68708abe132cd219c89b456
Original-Signed-off-by: Furquan Shaikh <furquan@google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/217570
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Tested-by: Furquan Shaikh <furquan@chromium.org>
Original-Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: http://review.coreboot.org/9079
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/arch/arm64/stage_entry.S')
-rw-r--r-- | src/arch/arm64/stage_entry.S | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/arch/arm64/stage_entry.S b/src/arch/arm64/stage_entry.S index 301711e8f9..6b8ca7b424 100644 --- a/src/arch/arm64/stage_entry.S +++ b/src/arch/arm64/stage_entry.S @@ -17,6 +17,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +/* + * ======================== stage_entry.S ===================================== + * This file acts as an entry point to the different stages of arm64 as well as + * for the secure monitor. They share the same process of setting up stacks and + * jumping to c code. It is important to save x25 from corruption as it contains + * the argument for secure monitor. + * ============================================================================= + */ #include <arch/asm.h> #define __ASSEMBLY__ @@ -71,6 +79,10 @@ ENDPROC(cpu_get_exception_stack) * 16-byte aligned stack. The programming enviroment uses SP_EL0 as its main * stack while keeping SP_ELx reserved for exception entry. */ +/* + * IMPORTANT: Ensure x25 is not corrupted because it saves the argument to + * secmon + */ ENTRY(arm64_c_environment) bl smp_processor_id /* x0 = cpu */ mov x24, x0 @@ -92,14 +104,22 @@ ENTRY(arm64_c_environment) mov sp, x0 /* Get entry point by dereferencing c_entry. */ - ldr x0, 1f - ldr x0, [x0] - br x0 + ldr x1, 1f + ldr x1, [x1] + /* Move back the arguments from x25 to x0 */ + mov x0, x25 + br x1 .align 3 1: .quad c_entry ENDPROC(arm64_c_environment) +ENTRY(__rmodule_entry) + /* Save the arguments to secmon in x25 */ + mov x25, x0 + b arm64_c_environment +ENDPROC(__rmodule_entry) + CPU_RESET_ENTRY(arm64_cpu_startup) read_current x0, sctlr bic x0, x0, #(1 << 25) /* Little Endian */ |