1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#include "ppc_asm.h"
16
17
18
19
20
21
22
23
24
25
26
27 .text
28
29 .globl _zimage_start
30_zimage_start:
31
32
33 mfmsr 9
34 rlwinm 9, 9, 0, ~((1<<4)|(1<<5))
35 bcl 20, 31, 1f
361:
37 mflr 8
38 clrlwi 8, 8, 3
39 addi 8, 8, _mmu_off - 1b
40 mtsrr0 8
41 mtsrr1 9
42 rfi
43_mmu_off:
44
45
46
47 isync
48 li 8, 0
49 mtspr 0x210, 8
50 mtspr 0x212, 8
51 mtspr 0x214, 8
52 mtspr 0x216, 8
53 mtspr 0x218, 8
54 mtspr 0x21a, 8
55 mtspr 0x21c, 8
56 mtspr 0x21e, 8
57
58 mtspr 0x230, 8
59 mtspr 0x232, 8
60 mtspr 0x234, 8
61 mtspr 0x236, 8
62 mtspr 0x238, 8
63 mtspr 0x23a, 8
64 mtspr 0x23c, 8
65 mtspr 0x23e, 8
66
67 li 8, 0x01ff
68 li 9, 0x0002
69 mtspr 0x211, 9
70 mtspr 0x210, 8
71 mtspr 0x219, 9
72 mtspr 0x218, 8
73
74 lis 8, 0x0c00
75 ori 8, 8, 0x3ff
76 lis 9, 0x0c00
77 ori 9, 9, 0x002a
78 mtspr 0x21b, 9
79 mtspr 0x21a, 8
80
81 lis 8, 0x0100
82 ori 8, 8, 0x00ff
83 lis 9, 0x0100
84 ori 9, 9, 0x0002
85 mtspr 0x215, 9
86 mtspr 0x214, 8
87 mtspr 0x21d, 9
88 mtspr 0x21c, 8
89
90 lis 8, 0x1000
91 ori 8, 8, 0x07ff
92 lis 9, 0x1000
93 ori 9, 9, 0x0002
94 mtspr 0x216, 8
95 mtspr 0x217, 9
96 mtspr 0x21e, 8
97 mtspr 0x21f, 9
98
99
100 mfspr 8, 0x3f3
101 oris 8, 8, 0x0200
102 mtspr 0x3f3, 8
103
104
105 mfspr 8, 0x3f0
106 andi. 0, 8, (1<<15)
107 bne 1f
108 ori 8, 8, (1<<15)|(1<<11)
1091:
110 andi. 0, 8, (1<<14)
111 bne 1f
112 ori 8, 8, (1<<14)|(1<<10)
1131:
114 mtspr 0x3f0, 8
115 isync
116
117
118 li 3, 0
119 li 4, 0
120 li 5, 0
121
122
123 bcl 20, 31, 1f
1241:
125 mflr 8
126 addi 8, 8, _mmu_on - 1b
127 mfmsr 9
128 ori 9, 9, (1<<4)|(1<<5)
129 mtsrr0 8
130 mtsrr1 9
131 sync
132 rfi
133_mmu_on:
134
135 lis 8, 0x0d00
136 ori 8, 8, 0x00c0
137 lwz 9, 0(8)
138 ori 9, 9, 0x20
139 stw 9, 0(8)
140
141 b _zimage_start_lib
142
143