1 /* start.S - AsbestOS stage2 startup code
3 Copyright (C) 2010-2011 Hector Martin "marcan" <hector@marcansoft.com>
5 This code is licensed to you under the terms of the GNU GPL, version 2;
6 see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
9 #include "../common/assembly.h"
13 .section .start,"ax",@progbits
19 /* at this point, one thread is (hopefully) spinning in the decrementer vector */
20 /* release it here (it will already be in realmode and with IRQs disabled) */
21 lis r3, _threads_start@h
22 ori r3, r3, _threads_start@l
26 /* both threads end up running here */
28 /* if this is thread 1, go to _thread1_start */
33 /* set up the TOC register */
34 lis r2, (__toc_start+0x8000)@h
35 ori r2, r2, (__toc_start+0x8000)@l
36 /* set up the stack */
38 ori r1, r1, _stack_bot@l
39 /* make space for the first stack frame */
46 ori r3, r3, __bss_start@l
48 ori r4, r4, __bss_end@l
56 /* jump to main (panic if it returns) */
60 /* thread 1 runs this code - spin until we have a vector */
62 lis r3, _thread1_active@h
63 ori r3, r3, _thread1_active@l
72 li r3, 1 /* CPU number for Linux */
76 .global _thread1_active, _thread1_release, _thread1_vector
77 _thread1_active: .quad 0
78 _thread1_release: .quad 0
79 _thread1_vector: .quad 0