lsw: JPN fix
[savezelda.git] / loader / crt0.s
1 # Copyright 2008-2009  Segher Boessenkool  <segher@kernel.crashing.org>
2 # This code is licensed to you under the terms of the GNU GPL, version 2;
3 # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
4
5
6         .globl _start
7 _start:
8
9         # Disable interrupts, enable FP.
10         mfmsr 3 ; rlwinm 3,3,0,17,15 ; ori 3,3,0x2000 ; mtmsr 3 ; isync
11
12         # Setup stack.
13         lis 1,_stack_top@ha ; addi 1,1,_stack_top@l ; li 0,0 ; stwu 0,-64(1)
14
15         # Clear BSS.
16         lis 3,__bss_start@ha ; addi 3,3,__bss_start@l
17         li 4,0
18         lis 5,__bss_end@ha ; addi 5,5,__bss_end@l ; sub 5,5,3
19         bl memset
20
21         # Go!
22         bl main
23
24         # If it returns, hang.  Shouldn't happen.
25         b .