1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28#include <config.h>
29#include <mpc8260.h>
30#include <timestamp.h>
31#include <version.h>
32
33#define CONFIG_8260 1
34#define _LINUX_CONFIG_H 1
35
36#include <ppc_asm.tmpl>
37#include <ppc_defs.h>
38
39#include <asm/cache.h>
40#include <asm/mmu.h>
41
42#ifndef CONFIG_IDENT_STRING
43#define CONFIG_IDENT_STRING ""
44#endif
45
46
47
48#undef MSR_KERNEL
49
50#ifdef DEBUG
51#define MSR_KERNEL (MSR_FP|MSR_RI)
52#else
53#define MSR_KERNEL (MSR_FP|MSR_ME|MSR_RI)
54#endif
55
56
57
58
59
60
61 START_GOT
62 GOT_ENTRY(_GOT2_TABLE_)
63 GOT_ENTRY(_FIXUP_TABLE_)
64
65 GOT_ENTRY(_start)
66 GOT_ENTRY(_start_of_vectors)
67 GOT_ENTRY(_end_of_vectors)
68 GOT_ENTRY(transfer_to_handler)
69
70 GOT_ENTRY(__init_end)
71 GOT_ENTRY(_end)
72 GOT_ENTRY(__bss_start)
73
74 GOT_ENTRY(environment)
75#endif
76 END_GOT
77
78
79
80
81
82
83
84
85 .data
86 .globl version_string
87version_string:
88 .ascii U_BOOT_VERSION
89 .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
90 .ascii CONFIG_IDENT_STRING, "\0"
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123#define _HRCW_TABLE_ENTRY(w) \
124 .fill 8,1,(((w)>>24)&0xff); \
125 .fill 8,1,(((w)>>16)&0xff); \
126 .fill 8,1,(((w)>> 8)&0xff); \
127 .fill 8,1,(((w) )&0xff)
128 .text
129 .globl _hrcw_table
130_hrcw_table:
131 _HRCW_TABLE_ENTRY(CONFIG_SYS_HRCW_MASTER)
132 _HRCW_TABLE_ENTRY(CONFIG_SYS_HRCW_SLAVE1)
133 _HRCW_TABLE_ENTRY(CONFIG_SYS_HRCW_SLAVE2)
134 _HRCW_TABLE_ENTRY(CONFIG_SYS_HRCW_SLAVE3)
135 _HRCW_TABLE_ENTRY(CONFIG_SYS_HRCW_SLAVE4)
136 _HRCW_TABLE_ENTRY(CONFIG_SYS_HRCW_SLAVE5)
137 _HRCW_TABLE_ENTRY(CONFIG_SYS_HRCW_SLAVE6)
138 _HRCW_TABLE_ENTRY(CONFIG_SYS_HRCW_SLAVE7)
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160 . = EXC_OFF_SYS_RESET
161
162 .globl _start
163_start:
164 li r21, BOOTFLAG_COLD
165 nop
166 b boot_cold
167
168 . = EXC_OFF_SYS_RESET + 0x10
169
170 .globl _start_warm
171_start_warm:
172 li r21, BOOTFLAG_WARM
173 b boot_warm
174
175boot_cold:
176
177 lis r3, CONFIG_SYS_DEFAULT_IMMR@h
178 nop
179 lwz r4, 0(r3)
180 nop
181 rlwinm r4, r4, 0, 8, 5
182 nop
183 oris r4, r4, 0x0200
184 nop
185 stw r4, 0(r3)
186 nop
187#endif
188boot_warm:
189 mfmsr r5
190
191
192
193 li r0, 0
194 mtmsr r0
195 isync
196 bl cogent_init_8260
197#endif
198
199
200 lis r3, CONFIG_SYS_IMMR@h
201 ori r3, r3, CONFIG_SYS_IMMR@l
202 lis r4, CONFIG_SYS_DEFAULT_IMMR@h
203 stw r3, 0x1A8(r4)
204#endif
205
206
207
208
209 bl init_8260_core
210
211#ifndef CONFIG_SYS_RAMBOOT
212
213
214
215
216 lis r3, (CONFIG_SYS_IMMR+IM_REGBASE)@h
217 lwz r4, IM_OR0@l(r3)
218 li r5, 0x7fff
219 and r4, r4, r5
220 stw r4, IM_OR0@l(r3)
221
222
223
224
225 lis r3, CONFIG_SYS_MONITOR_BASE@h
226 ori r3, r3, CONFIG_SYS_MONITOR_BASE@l
227 addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
228 mtlr r3
229 blr
230
231in_flash:
232#endif
233
234
235
236
237 lis r3, CONFIG_SYS_IMMR@h
238 ori r1, r3, CONFIG_SYS_INIT_SP_OFFSET
239 li r0, 0
240 stwu r0, -4(r1)
241 stwu r0, -4(r1)
242
243
244
245
246
247
248 GET_GOT
249
250
251 bl cpu_init_f
252
253#ifdef DEBUG
254 bl init_debug
255#endif
256
257 mr r3, r21
258
259 bl board_init_f
260
261
262
263
264
265 .globl _start_of_vectors
266_start_of_vectors:
267
268
269 STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
270
271
272 STD_EXCEPTION(0x300, DataStorage, UnknownException)
273
274
275 STD_EXCEPTION(0x400, InstStorage, UnknownException)
276
277
278 STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
279
280
281 . = 0x600
282Alignment:
283 EXCEPTION_PROLOG(SRR0, SRR1)
284 mfspr r4,DAR
285 stw r4,_DAR(r21)
286 mfspr r5,DSISR
287 stw r5,_DSISR(r21)
288 addi r3,r1,STACK_FRAME_OVERHEAD
289 li r20,MSR_KERNEL
290 rlwimi r20,r23,0,16,16
291 rlwimi r20,r23,0,25,25
292 lwz r6,GOT(transfer_to_handler)
293 mtlr r6
294 blrl
295.L_Alignment:
296 .long AlignmentException - _start + EXC_OFF_SYS_RESET
297 .long int_return - _start + EXC_OFF_SYS_RESET
298
299
300 . = 0x700
301ProgramCheck:
302 EXCEPTION_PROLOG(SRR0, SRR1)
303 addi r3,r1,STACK_FRAME_OVERHEAD
304 li r20,MSR_KERNEL
305 rlwimi r20,r23,0,16,16
306 rlwimi r20,r23,0,25,25
307 lwz r6,GOT(transfer_to_handler)
308 mtlr r6
309 blrl
310.L_ProgramCheck:
311 .long ProgramCheckException - _start + EXC_OFF_SYS_RESET
312 .long int_return - _start + EXC_OFF_SYS_RESET
313
314 STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
315
316
317
318
319 STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
320
321 STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
322 STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
323 STD_EXCEPTION(0xc00, SystemCall, UnknownException)
324 STD_EXCEPTION(0xd00, SingleStep, UnknownException)
325
326 STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
327 STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
328
329 STD_EXCEPTION(0x1000, InstructionTLBMiss, UnknownException)
330 STD_EXCEPTION(0x1100, DataLoadTLBMiss, UnknownException)
331 STD_EXCEPTION(0x1200, DataStoreTLBMiss, UnknownException)
332#ifdef DEBUG
333 . = 0x1300
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
3511: b 1b
352#else
353 STD_EXCEPTION(0x1300, InstructionBreakpoint, DebugException)
354#endif
355 STD_EXCEPTION(0x1400, SMI, UnknownException)
356
357 STD_EXCEPTION(0x1500, Trap_15, UnknownException)
358 STD_EXCEPTION(0x1600, Trap_16, UnknownException)
359 STD_EXCEPTION(0x1700, Trap_17, UnknownException)
360 STD_EXCEPTION(0x1800, Trap_18, UnknownException)
361 STD_EXCEPTION(0x1900, Trap_19, UnknownException)
362 STD_EXCEPTION(0x1a00, Trap_1a, UnknownException)
363 STD_EXCEPTION(0x1b00, Trap_1b, UnknownException)
364 STD_EXCEPTION(0x1c00, Trap_1c, UnknownException)
365 STD_EXCEPTION(0x1d00, Trap_1d, UnknownException)
366 STD_EXCEPTION(0x1e00, Trap_1e, UnknownException)
367 STD_EXCEPTION(0x1f00, Trap_1f, UnknownException)
368 STD_EXCEPTION(0x2000, Trap_20, UnknownException)
369 STD_EXCEPTION(0x2100, Trap_21, UnknownException)
370 STD_EXCEPTION(0x2200, Trap_22, UnknownException)
371 STD_EXCEPTION(0x2300, Trap_23, UnknownException)
372 STD_EXCEPTION(0x2400, Trap_24, UnknownException)
373 STD_EXCEPTION(0x2500, Trap_25, UnknownException)
374 STD_EXCEPTION(0x2600, Trap_26, UnknownException)
375 STD_EXCEPTION(0x2700, Trap_27, UnknownException)
376 STD_EXCEPTION(0x2800, Trap_28, UnknownException)
377 STD_EXCEPTION(0x2900, Trap_29, UnknownException)
378 STD_EXCEPTION(0x2a00, Trap_2a, UnknownException)
379 STD_EXCEPTION(0x2b00, Trap_2b, UnknownException)
380 STD_EXCEPTION(0x2c00, Trap_2c, UnknownException)
381 STD_EXCEPTION(0x2d00, Trap_2d, UnknownException)
382 STD_EXCEPTION(0x2e00, Trap_2e, UnknownException)
383 STD_EXCEPTION(0x2f00, Trap_2f, UnknownException)
384
385
386 .globl _end_of_vectors
387_end_of_vectors:
388
389 . = 0x3000
390
391
392
393
394
395
396 .globl transfer_to_handler
397transfer_to_handler:
398 stw r22,_NIP(r21)
399 lis r22,MSR_POW@h
400 andc r23,r23,r22
401 stw r23,_MSR(r21)
402 SAVE_GPR(7, r21)
403 SAVE_4GPRS(8, r21)
404 SAVE_8GPRS(12, r21)
405 SAVE_8GPRS(24, r21)
406 mflr r23
407 andi. r24,r23,0x3f00
408 stw r24,TRAP(r21)
409 li r22,0
410 stw r22,RESULT(r21)
411 lwz r24,0(r23)
412 lwz r23,4(r23)
413 mtspr SRR0,r24
414 mtspr SRR1,r20
415 mtlr r23
416 SYNC
417 rfi
418
419int_return:
420 mfmsr r28
421 li r4,0
422 ori r4,r4,MSR_EE
423 andc r28,r28,r4
424 SYNC
425 mtmsr r28
426 SYNC
427 lwz r2,_CTR(r1)
428 lwz r0,_LINK(r1)
429 mtctr r2
430 mtlr r0
431 lwz r2,_XER(r1)
432 lwz r0,_CCR(r1)
433 mtspr XER,r2
434 mtcrf 0xFF,r0
435 REST_10GPRS(3, r1)
436 REST_10GPRS(13, r1)
437 REST_8GPRS(23, r1)
438 REST_GPR(31, r1)
439 lwz r2,_NIP(r1)
440 lwz r0,_MSR(r1)
441 mtspr SRR0,r2
442 mtspr SRR1,r0
443 lwz r0,GPR0(r1)
444 lwz r2,GPR2(r1)
445 lwz r1,GPR1(r1)
446 SYNC
447 rfi
448
449
450
451
452
453
454
455
456 .globl cogent_init_8260
457cogent_init_8260:
458
459
460
461
462 lis r4, (CONFIG_SYS_IMMR+IM_REGBASE)@h
463 lis r3, CONFIG_SYS_IMMR@h
464 stw r3, IM_IMMR@l(r4)
465 lwz r3, IM_IMMR@l(r4)
466 stw r3, 0(r0)
467 lis r3, CONFIG_SYS_SYPCR@h
468 ori r3, r3, CONFIG_SYS_SYPCR@l
469 stw r3, IM_SYPCR@l(r4)
470 lwz r3, IM_SYPCR@l(r4)
471 stw r3, 4(r0)
472 lis r3, CONFIG_SYS_SCCR@h
473 ori r3, r3, CONFIG_SYS_SCCR@l
474 stw r3, IM_SCCR@l(r4)
475 lwz r3, IM_SCCR@l(r4)
476 stw r3, 8(r0)
477
478
479
480
481
482 lis r1, 0x1234
483 ori r1, r1, 0x5678
484 stw r1, 0x20(r0)
485 lwz r1, 0x20(r0)
486 stw r1, 0x24(r0)
487 lwz r1, 0x24(r0)
488 lis r3, 0x0e80
489 ori r3, r3, 0
490 stw r1, 4(r3)
491 lwz r1, 4(r3)
492
493
494
495
496 blr
497
498#endif
499
500
501
502
503
504
505
506 .globl init_8260_core
507init_8260_core:
508
509
510
511
512 li r3, MSR_KERNEL
513 rlwimi r3, r5, 0, 25, 25
514#ifdef DEBUG
515 rlwimi r3, r5, 0, 21, 22
516#endif
517 SYNC
518 mtmsr r3
519 SYNC
520 mtspr SRR1, r3
521
522
523
524
525 lis r3, (CONFIG_SYS_IMMR+IM_REGBASE)@h
526
527 lis r4, CONFIG_SYS_SYPCR@h
528 ori r4, r4, CONFIG_SYS_SYPCR@l
529 stw r4, IM_SYPCR@l(r3)
530#endif
531
532 li r4, 21868
533 sth r4, IM_SWSR@l(r3)
534 li r4, -21959
535 sth r4, IM_SWSR@l(r3)
536#endif
537
538
539
540
541
542 lis r3, CONFIG_SYS_HID0_INIT@h
543 ori r3, r3, CONFIG_SYS_HID0_INIT@l
544 SYNC
545 mtspr HID0, r3
546
547 lis r3, CONFIG_SYS_HID0_FINAL@h
548 ori r3, r3, CONFIG_SYS_HID0_FINAL@l
549 SYNC
550 mtspr HID0, r3
551
552 lis r3, CONFIG_SYS_HID2@h
553 ori r3, r3, CONFIG_SYS_HID2@l
554 mtspr HID2, r3
555
556
557
558
559 li r0, 0
560 mtspr DBAT0U, r0
561 mtspr DBAT0L, r0
562 mtspr DBAT1U, r0
563 mtspr DBAT1L, r0
564 mtspr DBAT2U, r0
565 mtspr DBAT2L, r0
566 mtspr DBAT3U, r0
567 mtspr DBAT3L, r0
568 mtspr IBAT0U, r0
569 mtspr IBAT0L, r0
570 mtspr IBAT1U, r0
571 mtspr IBAT1L, r0
572 mtspr IBAT2U, r0
573 mtspr IBAT2L, r0
574 mtspr IBAT3U, r0
575 mtspr IBAT3L, r0
576 SYNC
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598 li r3, 32
599 mtctr r3
600 li r3, 0
6011: tlbie r3
602 addi r3, r3, 0x1000
603 bdnz 1b
604 SYNC
605
606
607
608
609 blr
610
611#ifdef DEBUG
612
613
614
615
616
617
618
619
620 .globl init_debug
621init_debug:
622
623 lis r3, (CONFIG_SYS_IMMR+IM_REGBASE)@h
624
625
626
627
628
629 li r4, CONFIG_SYS_MPTPR
630 sth r4, IM_MPTPR@l(r3)
631
632 li r4, CONFIG_SYS_PSRT
633 stb r4, IM_PSRT@l(r3)
634
635 lis r4, (CONFIG_SYS_PSDMR|PSDMR_OP_NORM)@h
636 ori r4, r4, (CONFIG_SYS_PSDMR|PSDMR_OP_NORM)@l
637 stw r4, IM_PSDMR@l(r3)
638
639 lis r4, (CONFIG_SYS_PSDMR|PSDMR_OP_PREA)@h
640 ori r4, r4, (CONFIG_SYS_PSDMR|PSDMR_OP_PREA)@l
641 stw r4, IM_PSDMR@l(r3)
642 stb r0, 0(0)
643
644 lis r4, (CONFIG_SYS_PSDMR|PSDMR_OP_CBRR)@h
645 ori r4, r4, (CONFIG_SYS_PSDMR|PSDMR_OP_CBRR)@l
646 stw r4, IM_PSDMR@l(r3)
647 stb r0, 0(0)
648 stb r0, 0(0)
649 stb r0, 0(0)
650 stb r0, 0(0)
651 stb r0, 0(0)
652 stb r0, 0(0)
653 stb r0, 0(0)
654 stb r0, 0(0)
655
656 lis r4, (CONFIG_SYS_PSDMR|PSDMR_OP_MRW)@h
657 ori r4, r4, (CONFIG_SYS_PSDMR|PSDMR_OP_MRW)@l
658 stw r4, IM_PSDMR@l(r3)
659 stb r0, 0(0)
660
661 lis r4, (CONFIG_SYS_PSDMR|PSDMR_OP_NORM|PSDMR_RFEN)@h
662 ori r4, r4, (CONFIG_SYS_PSDMR|PSDMR_OP_NORM|PSDMR_RFEN)@l
663 stw r4, IM_PSDMR@l(r3)
664 stb r0, 0(0)
665
666
667#define VEC_WRD_CNT ((_end_of_vectors - _start + EXC_OFF_SYS_RESET) / 4)
668
669 lwz r3, GOT(_end_of_vectors)
670 rlwinm r4, r3, 0, 18, 31
671 lis r5, VEC_WRD_CNT@h
672 ori r5, r5, VEC_WRD_CNT@l
673 mtctr r5
6741:
675 lwzu r5, -4(r3)
676 stwu r5, -4(r4)
677 bdnz 1b
678
679
680
681
682
683
684
685
686
687
688
689
690
691 lis r3, CONFIG_SYS_IMMR@h
692 lwz r3, 0(r3)
693 mtspr IABR, r3
694
695
696
697
698
699 lis r3, (CONFIG_SYS_IMMR + CONFIG_SYS_INIT_SP_OFFSET)@h
700 ori r3, r3, (CONFIG_SYS_IMMR + CONFIG_SYS_INIT_SP_OFFSET)@l
701 li r4, ((CONFIG_SYS_INIT_SP_OFFSET - 4) / 4)
702 mtctr r4
703 lis r4, 0xdeadbeaf@h
704 ori r4, r4, 0xdeadbeaf@l
7051:
706 stwu r4, -4(r3)
707 bdnz 1b
708
709
710
711
712 blr
713#endif
714
715
716
717
718
719
720 .globl icache_enable
721icache_enable:
722 mfspr r3, HID0
723 ori r3, r3, HID0_ICE
724 lis r4, 0
725 ori r4, r4, HID0_ILOCK
726 andc r3, r3, r4
727 ori r4, r3, HID0_ICFI
728 isync
729 mtspr HID0, r4
730 isync
731 mtspr HID0, r3
732 blr
733
734 .globl icache_disable
735icache_disable:
736 mfspr r3, HID0
737 lis r4, 0
738 ori r4, r4, HID0_ICE|HID0_ILOCK
739 andc r3, r3, r4
740 ori r4, r3, HID0_ICFI
741 isync
742 mtspr HID0, r4
743 isync
744 mtspr HID0, r3
745 blr
746
747 .globl icache_status
748icache_status:
749 mfspr r3, HID0
750 rlwinm r3, r3, HID0_ICE_BITPOS + 1, 31, 31
751 blr
752
753 .globl dcache_enable
754dcache_enable:
755 mfspr r3, HID0
756 ori r3, r3, HID0_DCE
757 lis r4, 0
758 ori r4, r4, HID0_DLOCK
759 andc r3, r3, r4
760 ori r4, r3, HID0_DCI
761 sync
762 mtspr HID0, r4
763 sync
764 mtspr HID0, r3
765 blr
766
767 .globl dcache_disable
768dcache_disable:
769 mfspr r3, HID0
770 lis r4, 0
771 ori r4, r4, HID0_DCE|HID0_DLOCK
772 andc r3, r3, r4
773 ori r4, r3, HID0_DCI
774 sync
775 mtspr HID0, r4
776 sync
777 mtspr HID0, r3
778 blr
779
780 .globl dcache_status
781dcache_status:
782 mfspr r3, HID0
783 rlwinm r3, r3, HID0_DCE_BITPOS + 1, 31, 31
784 blr
785
786 .globl get_pvr
787get_pvr:
788 mfspr r3, PVR
789 blr
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804 .globl relocate_code
805relocate_code:
806 mr r1, r3
807 mr r9, r4
808 mr r10, r5
809
810 mr r3, r5
811 lis r4, CONFIG_SYS_MONITOR_BASE@h
812 ori r4, r4, CONFIG_SYS_MONITOR_BASE@l
813 lwz r5, GOT(__init_end)
814 sub r5, r5, r4
815 li r6, CONFIG_SYS_CACHELINE_SIZE
816
817
818
819
820
821
822
823
824 sub r15, r10, r4
825
826
827 add r14, r14, r15
828
829 add r30, r30, r15
830
831
832
833
834
835 cmplw cr1,r3,r4
836 addi r0,r5,3
837 srwi. r0,r0,2
838 beq cr1,4f
839 beq 7f
840 mtctr r0
841 bge cr1,2f
842
843 la r8,-4(r4)
844 la r7,-4(r3)
8451: lwzu r0,4(r8)
846 stwu r0,4(r7)
847 bdnz 1b
848 b 4f
849
8502: slwi r0,r0,2
851 add r8,r4,r0
852 add r7,r3,r0
8533: lwzu r0,-4(r8)
854 stwu r0,-4(r7)
855 bdnz 3b
856
857
858
859
860
8614: cmpwi r6,0
862 add r5,r3,r5
863 beq 7f
864 subi r0,r6,1
865 andc r3,r3,r0
866 mfspr r7,HID0
867 rlwinm r7,r7,HID0_DCE_BITPOS+1,31,31
868 cmpwi r7,0
869 beq 9f
870 mr r4,r3
8715: dcbst 0,r4
872 add r4,r4,r6
873 cmplw r4,r5
874 blt 5b
875 sync
8769: mfspr r7,HID0
877 rlwinm r7,r7,HID0_ICE_BITPOS+1,31,31
878 cmpwi r7,0
879 beq 7f
880 mr r4,r3
8816: icbi 0,r4
882 add r4,r4,r6
883 cmplw r4,r5
884 blt 6b
8857: sync
886 isync
887
888
889
890
891
892
893 addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
894 mtlr r0
895 blr
896
897in_ram:
898
899
900
901
902
903
904
905 li r0,__got2_entries@sectoff@l
906 la r3,GOT(_GOT2_TABLE_)
907 lwz r11,GOT(_GOT2_TABLE_)
908 mtctr r0
909 sub r11,r3,r11
910 addi r3,r3,-4
9111: lwzu r0,4(r3)
912 add r0,r0,r11
913 stw r0,0(r3)
914 bdnz 1b
915
916
917
918
919
9202: li r0,__fixup_entries@sectoff@l
921 lwz r3,GOT(_FIXUP_TABLE_)
922 cmpwi r0,0
923 mtctr r0
924 addi r3,r3,-4
925 beq 4f
9263: lwzu r4,4(r3)
927 lwzux r0,r4,r11
928 add r0,r0,r11
929 stw r10,0(r3)
930 stw r0,0(r4)
931 bdnz 3b
9324:
933clear_bss:
934
935
936
937 lwz r3,GOT(__bss_start)
938
939
940
941
942
943
944
945
946 lwz r4,GOT(environment)
947#else
948 lwz r4,GOT(_end)
949#endif
950
951 cmplw 0, r3, r4
952 beq 6f
953
954 li r0, 0
9555:
956 stw r0, 0(r3)
957 addi r3, r3, 4
958 cmplw 0, r3, r4
959 bne 5b
9606:
961
962 mr r3, r9
963 mr r4, r10
964 bl board_init_r
965
966
967
968
969
970
971
972 .globl trap_init
973trap_init:
974 lwz r7, GOT(_start)
975 lwz r8, GOT(_end_of_vectors)
976
977 li r9, 0x100
978
979 cmplw 0, r7, r8
980 bgelr
981
982 mflr r4
9831:
984 lwz r0, 0(r7)
985 stw r0, 0(r9)
986 addi r7, r7, 4
987 addi r9, r9, 4
988 cmplw 0, r7, r8
989 bne 1b
990
991
992
993
994 li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
995 li r8, Alignment - _start + EXC_OFF_SYS_RESET
9962:
997 bl trap_reloc
998 addi r7, r7, 0x100
999 cmplw 0, r7, r8
1000 blt 2b
1001
1002 li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
1003 bl trap_reloc
1004
1005 li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
1006 bl trap_reloc
1007
1008 li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
1009 li r8, SystemCall - _start + EXC_OFF_SYS_RESET
10103:
1011 bl trap_reloc
1012 addi r7, r7, 0x100
1013 cmplw 0, r7, r8
1014 blt 3b
1015
1016 li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
1017 li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
10184:
1019 bl trap_reloc
1020 addi r7, r7, 0x100
1021 cmplw 0, r7, r8
1022 blt 4b
1023
1024 mfmsr r3
1025 lis r7, MSR_IP@h
1026 ori r7, r7, MSR_IP@l
1027 andc r3, r3, r7
1028 SYNC
1029 mtmsr r3
1030 SYNC
1031
1032 mtlr r4
1033 blr
1034
1035
1036
1037
1038trap_reloc:
1039 lwz r0, 0(r7)
1040 add r0, r0, r3
1041 stw r0, 0(r7)
1042
1043 lwz r0, 4(r7)
1044 add r0, r0, r3
1045 stw r0, 4(r7)
1046
1047 blr
1048