1 /* $NetBSD: srt0.s,v 1.3 2005/12/11 12:18:48 christos Exp $ */
4 * Copyright (C) 1996-1999 Cort Dougan (cort@fsmlasb.com).
5 * Copyright (C) 1996-1999 Gary Thomas (gdt@osf.org).
6 * Copyright (C) 1996-1999 Paul Mackeras (paulus@linuxcare.com).
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by TooLs GmbH.
20 * 4. The name of TooLs GmbH may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
29 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
32 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #define HID0_DCI (1<<10)
38 #define HID0_ICFI (1<<11)
39 #define HID0_DCE (1<<14)
40 #define HID0_ICE (1<<15)
42 /* when we start, the IPLCB pointer is in r3, and the extended one is in r4 */
50 mr 11,3 /* save the IPLCB pointer in r11 */
51 mr 12,4 /* save the extended IPLCB in r12 */
52 li 3,MSR_IP
/* Establish default MSR value */
59 lis 4,~
(HID0_ICE|HID0_DCE
)@h
60 ori 4,4,~
(HID0_ICE|HID0_DCE
)@
l
65 /* We aren't passed our loadaddr, so leave it alone */
68 * check if we need to relocate ourselves to the link addr or were we
69 * loaded there to begin with -- Cort
74 subi 3,3,4 /* we get the nip, not the ip of the branch */
81 * no matter where we're loaded, move ourselves to -Ttext address
88 addi 5,5,3 /* Round up - just in case */
89 sub 5,5,4 /* Compute # longwords to move */
92 subi 3,3,4 /* Set up for loop */
100 mtlr 3 /* Easiest way to do an absolute jump */
105 mr 9,1 /* Save old stack pointer */
111 mr 3,11 /* arg1: IPLCB pointer */
112 mr 4,12 /* arg2: IPLCB extended block pointer */
119 * run(startsym, endsym, args, bootinfo, entry)
123 mtctr 7 /* Entry point */
127 * Flush instruction cache
135 ori 4,4,HID0_ICE|HID0_ICFI
166 mfmsr 5 /* save MSR to r5 */