From b5e5df4a63b8e5c8269faa881d4a1d8492aa8c7b Mon Sep 17 00:00:00 2001 From: David Given Date: Wed, 22 May 2013 18:25:30 +0100 Subject: [PATCH] Allocate a user stack to run code in. --HG-- branch : dtrg-videocore --- plat/rpi/boot.s | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/plat/rpi/boot.s b/plat/rpi/boot.s index e190f2ae3..9e54d3292 100644 --- a/plat/rpi/boot.s +++ b/plat/rpi/boot.s @@ -16,6 +16,12 @@ .sect .text #define gp r15 +#define STACKSIZE 16*1024 + +! MAIN ENTRY POINT +! +! When running as a kernel, our parameters are passed in in r0-r5, so +! the startup sequence mustn't disturb these. begtext: ! Set up system registers. @@ -24,27 +30,28 @@ begtext: st sp, .returnsp st lr, .returnlr - ! The GPU kernel code will load parameters into r0-r5. Save them - ! so that the user code can access them. + ! Wipe the bss. (I'm a little suprised that __m_a_i_n doesn't do this.) + + lea r6, begbss + lea r7, endbss + mov r8, #0 +_1: + stb r8, (r6) + addcmpb.lt r6, #1, r7, _1 + + ! Set up the new stack and save the kernel parameters to it. + lea sp, .stack + STACKSIZE sub r0, gp ! pointer sub r1, gp ! pointer sub r2, gp ! pointer sub r3, gp ! pointer ! r4-r5 are not pointers and don't need adjusting push r0-r5 + sub r0, sp, gp st r0, _gpu_parameters - ! Wipe the bss. (I'm a little suprised that __m_a_i_n doesn't do this.) - - lea r0, begbss - lea r1, endbss - mov r2, #0 -_1: - stb r2, (r0) - addcmpb.lt r0, #1, r1, _1 - ! Push standard parameters onto the stack and go. mov r0, #0 @@ -89,3 +96,7 @@ __exit: .define _gpu_parameters .comm _gpu_parameters, 4 +! User stack. + +.comm .stack, STACKSIZE + -- 2.34.1