kickstart.S revision 1.1.2.1 1 /* $NetBSD: kickstart.S,v 1.1.2.1 1999/12/27 18:31:37 wrstuden Exp $ */
2
3 /*
4 * Copyright (C) 1998 Ignatios Souvatzis. All rights reserved.
5 */
6
7 #define PPC_CACHESIZE 16384
8 #define PPC_LINESIZE 32
9
10 /*
11 Memst: .long 0x08000000
12 Krnst: .long 0x082f3400
13 Krnsz: .long 0x00100000
14 */
15 .globl _start
16 _start:
17 bl L2 /* we start with this address @ 0xfff00100 */
18 L2:
19 lis 13,0xf60000@ha
20 li 14,0x08
21 stb 14,0xf60000@l(13)
22 #ifdef DEBUG
23 lis 13,0xdff180@h
24 ori 13,13,0xdff180@l
25
26 lis 12,1000000@h
27 ori 12,12,1000000@l
28 mtctr 12
29 L2a:
30 li 14,0x00f
31 sth 14,0(13)
32 sync
33 li 14,0xf0f
34 sth 14,0(13)
35 sync
36 bdnz L2a
37 #endif
38 mflr 3
39 lwz 4,-16(3)
40 lwz 5,-12(3)
41 lwz 6,-8(3)
42 li 7,3
43 addi 8,6,3
44 cmplw 4,5
45 andc 8,8,7
46 srwi 9,8,2
47 mtctr 9
48 bgt Lb0
49 /* here: copying downwards and forwards */
50 lwz 9,0(5)
51 stw 9,0(4)
52 bdz Lflush
53 Lf1: lwzu 7,4(5)
54 stwu 7,4(4)
55 bdnz Lf1
56 b Lflush
57
58 Lb0: add 4,4,8 /* add the rounded up length */
59 add 5,5,8 /* add the rounded up length */
60 Lb1: lwzu 7,-4(5)
61 stwu 7,-4(4)
62 bdnz Lb1
63
64 Lflush:
65 #ifdef DEBUG
66 li 14,0xff0
67 sth 14,0(13)
68 sync
69 #endif
70 li 10,PPC_CACHESIZE/PPC_LINESIZE
71 li 11,PPC_LINESIZE
72 /* dcbst loop */
73 mtctr 10
74 lwz 12,-8(3)
75 Lfl1: dcbst 0,12
76 add 12,12,11
77 bdnz Lfl1
78 sync /* and wait for past instructions to finish */
79 /* icbi loop */
80 mtctr 10
81 lwz 12,-8(3)
82 Lfl2: icbi 0,12
83 add 12,12,11
84 bdnz Lfl2
85 sync /* and wait for past instructions to finish */
86 isync /* and flush instruction queue */
87 Ljump:
88 #ifdef DEBUG
89 li 14,0x0f0
90 sth 14,0(13)
91 sync
92 #endif
93 lwz 3,-16(3)
94 mtlr 3
95 blr
96 /* NOTREACHED */
97