From 3913795ee5daae5fb2770c1ff153ba2dc5ab9a61 Mon Sep 17 00:00:00 2001 From: J-Alves Date: Tue, 8 Feb 2022 14:06:20 +0000 Subject: feat(cactus): save and restore GP x0-x4 on entry The GP registers x0-x4 can be used to pass information from the SPMC to the SP at cold boot. They are also used for initialization operations before execution gets to the main function. This patch saves their state at the entry to a cold boot, and restores them before jumping to cactus main. Signed-off-by: J-Alves Change-Id: I0c4efe8b35a50596813645b0e94df3cced73d855 --- spm/cactus/aarch64/cactus_entrypoint.S | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'spm/cactus/aarch64') diff --git a/spm/cactus/aarch64/cactus_entrypoint.S b/spm/cactus/aarch64/cactus_entrypoint.S index 1541063..5d9f9f0 100644 --- a/spm/cactus/aarch64/cactus_entrypoint.S +++ b/spm/cactus/aarch64/cactus_entrypoint.S @@ -22,6 +22,12 @@ func cactus_entrypoint /* Entry reason is primary EC cold boot */ mov x19, #1 secondary_cold_entry: + /* Saving parameter registers to temporary registers. */ + mov x10, x1 + mov x11, x2 + mov x12, x3 + mov x13, x4 + /* Entry reason is secondary EC cold boot */ mrs x0, mpidr_el1 bl platform_get_core_pos @@ -77,5 +83,13 @@ pie_fixup: /* Jump to the C entrypoint (it does not return) */ 0: mov x0, x19 + + /* Restoring parameter registers before jumping to cactus_main. */ + mov x1, x10 + mov x2, x11 + mov x3, x12 + mov x4, x13 + + /* And jump to the C entrypoint. */ b cactus_main endfunc cactus_entrypoint -- cgit v1.2.3