[coreboot-gerrit] New patch to review for coreboot: 188f6ee arm64: move seeding stack to C
Patrick Georgi (pgeorgi@google.com)
gerrit at coreboot.org
Thu Mar 26 10:48:31 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/9014
-gerrit
commit 188f6ee21705e595fae03f6571fc8867c5c95e89
Author: Aaron Durbin <adurbin at chromium.org>
Date: Wed Aug 27 15:30:56 2014 -0500
arm64: move seeding stack to C
Move the stack seeding out of assembly and into C so the
code in stage_entry.S can more easily be used. The seeding
of the stack doesn't touch at least 256 bytes to account
for current usage at time fo the call.
BUG=chrome-os-partner:31545
BRANCH=None
TEST=Built and booted into kernel on ryu.
Change-Id: Ib9659ec4265652461bde746140567f21533cc265
Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
Original-Commit-Id: f478cfe175aa674cdfdbbd890663eeaad9d82b1f
Original-Change-Id: I44004220a02b1ff06d27a0555eb4e96d9e213544
Original-Signed-off-by: Aaron Durbin <adurbin at chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/214770
Original-Reviewed-by: Furquan Shaikh <furquan at chromium.org>
---
src/arch/arm64/c_entry.c | 20 ++++++++++++++++++++
src/arch/arm64/stage_entry.S | 26 +-------------------------
2 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/src/arch/arm64/c_entry.c b/src/arch/arm64/c_entry.c
index a4d4b0c..f08a585 100644
--- a/src/arch/arm64/c_entry.c
+++ b/src/arch/arm64/c_entry.c
@@ -18,14 +18,34 @@
*/
#include <arch/stages.h>
+#include <arch/cpu.h>
void __attribute__((weak)) arm64_soc_init(void)
{
/* Default weak implementation does nothing. */
}
+static void seed_stack(void)
+{
+ char *stack_begin;
+ uint64_t *slot;
+ int i;
+ int size;
+
+ stack_begin = cpu_get_stack(smp_processor_id());
+ stack_begin -= CONFIG_STACK_SIZE;
+ slot = (void *)stack_begin;
+
+ /* Pad out 256 bytes for current usage. */
+ size = CONFIG_STACK_SIZE - 256;
+ size /= sizeof(*slot);
+ for (i = 0; i < size; i++)
+ *slot++ = 0xdeadbeefdeadbeefULL;
+}
+
void arm64_init(void)
{
+ seed_stack();
arm64_soc_init();
main();
}
diff --git a/src/arch/arm64/stage_entry.S b/src/arch/arm64/stage_entry.S
index 1de8894..8613655 100644
--- a/src/arch/arm64/stage_entry.S
+++ b/src/arch/arm64/stage_entry.S
@@ -74,30 +74,6 @@ ENTRY(cpu_get_exception_stack)
.quad _estack_exceptions
ENDPROC(cpu_get_exception_stack)
-
-ENTRY(seed_stack)
- /*
- * Initialize the stack to a known value. This is used to check for
- * stack overflow later in the boot process.
- */
- ldr x0, .stack_bottom
- mov x1, sp
- ldr x2, =0xdeadbeefdeadbeef
- ldr x3, =0x8
-
-init_stack_loop:
- str x2, [x0]
- add x0, x0, x3
- cmp x0, x1
- bne init_stack_loop
-
-load_stack:
- b arm64_init
- .align 4
- .stack_bottom:
- .quad _stack
-ENDPROC(seed_stack)
-
/*
* Boot strap the processor into a C environemnt. That consists of providing
* 16-byte aligned stack. The programming enviroment uses SP_EL0 as its main
@@ -123,7 +99,7 @@ ENTRY(arm64_c_environment)
bl cpu_get_stack
mov sp, x0
- b seed_stack
+ b arm64_init
ENDPROC(arm64_c_environment)
CPU_RESET_ENTRY(arm64_cpu_startup)
More information about the coreboot-gerrit
mailing list