Rev 1058 | Rev 1071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1058 | Rev 1068 | ||
---|---|---|---|
Line 44... | Line 44... | ||
44 | 44 | ||
45 | jump_to_kernel: |
45 | jump_to_kernel: |
46 | 46 | ||
47 | # r3 = memmap (pa) |
47 | # r3 = memmap (pa) |
48 | # r4 = trans (pa) |
48 | # r4 = trans (pa) |
49 | # r5 = number of kernel pages |
49 | # r5 = kernel size |
50 | # r6 = real_mode (pa) |
50 | # r6 = real_mode (pa) |
51 | 51 | ||
52 | mtspr srr0, r6 |
52 | mtspr srr0, r6 |
53 | 53 | ||
54 | # jumps to real_mode |
54 | # jumps to real_mode |
Line 67... | Line 67... | ||
67 | real_mode: |
67 | real_mode: |
68 | 68 | ||
69 | # copy kernel to proper location |
69 | # copy kernel to proper location |
70 | # |
70 | # |
71 | # r4 = trans (pa) |
71 | # r4 = trans (pa) |
72 | # r5 = number of kernel pages |
72 | # r5 = kernel size |
73 | 73 | ||
74 | li r31, PAGE_SIZE >> 3 |
74 | li r31, PAGE_SIZE >> 2 |
75 | li r30, 0 |
75 | li r30, 0 |
76 | 76 | ||
77 | page_copy: |
77 | page_copy: |
78 | 78 | ||
79 | cmpwi r5, 0 |
79 | cmpwi r5, 0 |
80 | beq copy_end |
80 | beq copy_end |
81 | 81 | ||
82 | # copy single page |
82 | # copy page |
83 | 83 | ||
84 | mtctr r31 |
84 | mtctr r31 |
85 | lwz r29, 0(r4) |
85 | lwz r29, 0(r4) |
86 | 86 | ||
87 | copy_loop: |
87 | copy_loop: |
Line 89... | Line 89... | ||
89 | lwz r28, 0(r29) |
89 | lwz r28, 0(r29) |
90 | stw r28, 0(r30) |
90 | stw r28, 0(r30) |
91 | 91 | ||
92 | addi r29, r29, 4 |
92 | addi r29, r29, 4 |
93 | addi r30, r30, 4 |
93 | addi r30, r30, 4 |
- | 94 | subi r5, r5, 4 |
|
- | 95 | ||
- | 96 | cmpwi r5, 0 |
|
- | 97 | beq copy_end |
|
94 | 98 | ||
95 | bdnz copy_loop |
99 | bdnz copy_loop |
96 | 100 | ||
97 | subi r5, r5, 1 |
- | |
98 | addi r4, r4, 4 |
101 | addi r4, r4, 4 |
99 | b page_copy |
102 | b page_copy |
100 | 103 | ||
101 | copy_end: |
104 | copy_end: |
102 | 105 | ||
103 | # fill segment registers |
106 | # invalidate segment registers |
104 | 107 | ||
105 | li r31, 16 |
108 | # li r31, 16 |
106 | mtctr r31 |
109 | # mtctr r31 |
107 | li r31, 0 |
110 | # li r31, 0 |
108 | li r30, 0x2000 |
111 | # li r30, 0 |
109 | 112 | ||
110 | seg_fill: |
113 | seg_fill: |
111 | 114 | ||
112 | mtsrin r30, r31 |
115 | # mtsrin r30, r31 |
- | 116 | # addis r31, r31, 0x1000 # move to next SR |
|
113 | 117 | # |
|
- | 118 | # bdnz seg_fill |
|
- | 119 | ||
114 | addis r31, r31, 0x1000 # add 256 MB |
120 | # invalidate block address translation registers |
- | 121 | ||
- | 122 | mtspr ibat0u, r30 |
|
- | 123 | mtspr ibat0l, r30 |
|
- | 124 | ||
- | 125 | mtspr ibat1u, r30 |
|
- | 126 | mtspr ibat1l, r30 |
|
- | 127 | ||
- | 128 | mtspr ibat2u, r30 |
|
- | 129 | mtspr ibat2l, r30 |
|
- | 130 | ||
- | 131 | mtspr ibat3u, r30 |
|
- | 132 | mtspr ibat3l, r30 |
|
- | 133 | ||
- | 134 | mtspr dbat0u, r30 |
|
115 | addi r30, r30, 0x111 # move to next SR |
135 | mtspr dbat0l, r30 |
- | 136 | ||
- | 137 | mtspr dbat1u, r30 |
|
- | 138 | mtspr dbat1l, r30 |
|
- | 139 | ||
- | 140 | mtspr dbat2u, r30 |
|
- | 141 | mtspr dbat2l, r30 |
|
116 | 142 | ||
- | 143 | mtspr dbat3u, r30 |
|
117 | bdnz seg_fill |
144 | mtspr dbat3l, r30 |
118 | 145 | ||
119 | # create identity mapping |
146 | # create identity mapping |
120 | 147 | ||
- | 148 | # FIXME: map exactly the size of RAM |
|
- | 149 | ||
- | 150 | lis r31, 0x8000 |
|
- | 151 | ori r31, r31, 0x0ffe |
|
- | 152 | ||
- | 153 | lis r30, 0x0000 |
|
- | 154 | ori r30, r30, 0x0002 |
|
- | 155 | ||
- | 156 | mtspr ibat0u, r31 |
|
- | 157 | mtspr ibat0l, r30 |
|
- | 158 | ||
- | 159 | mtspr dbat0u, r31 |
|
- | 160 | mtspr dbat0l, r30 |
|
- | 161 | ||
- | 162 | # FIXME: temporal framebuffer mapping |
|
- | 163 | ||
- | 164 | lis r31, 0xf000 |
|
- | 165 | ori r31, r31, 0x0ffe |
|
- | 166 | ||
- | 167 | lis r30, 0x8400 |
|
- | 168 | ori r30, r30, 0x0002 |
|
- | 169 | ||
- | 170 | mtspr dbat1u, r31 |
|
- | 171 | mtspr dbat1l, r30 |
|
- | 172 | ||
121 | tlbia |
173 | tlbia |
122 | 174 | ||
123 | # start the kernel |
175 | # start the kernel |
124 | # |
176 | # |
125 | # r3 = memmap (pa) |
177 | # r3 = memmap (pa) |