[coreboot-gerrit] New patch to review for coreboot: f72b8d2 arm64: Adapt stage_entry to make it usable by secmon

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Fri Mar 27 09:59:14 CET 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9079

-gerrit

commit f72b8d209cac7c06d815484db6aff7808acf3cd8
Author: Furquan Shaikh <furquan at google.com>
Date:   Wed Sep 10 12:19:38 2014 -0700

    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 at chromium.org>
    Original-Commit-Id: ffedb03208bafab6d5886db0259ec205dd20588f
    Original-Change-Id: I74a7a609fbc08692d68708abe132cd219c89b456
    Original-Signed-off-by: Furquan Shaikh <furquan at google.com>
    Original-Reviewed-on: https://chromium-review.googlesource.com/217570
    Original-Reviewed-by: Aaron Durbin <adurbin at chromium.org>
    Original-Tested-by: Furquan Shaikh <furquan at chromium.org>
    Original-Commit-Queue: Furquan Shaikh <furquan at chromium.org>
---
 src/arch/arm64/stage_entry.S | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/arch/arm64/stage_entry.S b/src/arch/arm64/stage_entry.S
index 301711e..6b8ca7b 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 */



More information about the coreboot-gerrit mailing list