! the startup sequence mustn't disturb these.
- ! Set up system registers.
- ! Wipe the bss. (I'm a little suprised that __m_a_i_n doesn't do this.)
+ ! Wipe the bss. This must happen absolutely first, because we need
+ ! to store the old system registers into it.
addcmpb.lt r6, #1, r7, _1
+ ! Set up system registers.
! Set up the new stack and save the kernel parameters to it.
- lea sp, .stack + STACKSIZE
+ lea sp, .stack + STACKSIZE - 6*4
! r4-r5 are not pointers and don't need adjusting
! Call the language startup code.
! Fall through to __exit if this returns.
! We store the stack pointer and return address on entry so that we can