Allocate a user stack to run code in.
--HG-- branch : dtrg-videocore
This commit is contained in:
parent
cdce394b6c
commit
b5e5df4a63
1 changed files with 22 additions and 11 deletions
|
@ -16,6 +16,12 @@
|
||||||
.sect .text
|
.sect .text
|
||||||
|
|
||||||
#define gp r15
|
#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:
|
begtext:
|
||||||
! Set up system registers.
|
! Set up system registers.
|
||||||
|
@ -24,27 +30,28 @@ begtext:
|
||||||
st sp, .returnsp
|
st sp, .returnsp
|
||||||
st lr, .returnlr
|
st lr, .returnlr
|
||||||
|
|
||||||
! The GPU kernel code will load parameters into r0-r5. Save them
|
! Wipe the bss. (I'm a little suprised that __m_a_i_n doesn't do this.)
|
||||||
! so that the user code can access them.
|
|
||||||
|
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 r0, gp ! pointer
|
||||||
sub r1, gp ! pointer
|
sub r1, gp ! pointer
|
||||||
sub r2, gp ! pointer
|
sub r2, gp ! pointer
|
||||||
sub r3, gp ! pointer
|
sub r3, gp ! pointer
|
||||||
! r4-r5 are not pointers and don't need adjusting
|
! r4-r5 are not pointers and don't need adjusting
|
||||||
push r0-r5
|
push r0-r5
|
||||||
|
|
||||||
sub r0, sp, gp
|
sub r0, sp, gp
|
||||||
st r0, _gpu_parameters
|
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.
|
! Push standard parameters onto the stack and go.
|
||||||
|
|
||||||
mov r0, #0
|
mov r0, #0
|
||||||
|
@ -89,3 +96,7 @@ __exit:
|
||||||
.define _gpu_parameters
|
.define _gpu_parameters
|
||||||
.comm _gpu_parameters, 4
|
.comm _gpu_parameters, 4
|
||||||
|
|
||||||
|
! User stack.
|
||||||
|
|
||||||
|
.comm .stack, STACKSIZE
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue