]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/powerpc/cpu/mpc512x/start.S
powerpc: Cleanup BOOTFLAG_* references
[people/ms/u-boot.git] / arch / powerpc / cpu / mpc512x / start.S
CommitLineData
8993e54b
RJ
1/*
2 * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
3 * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
3b74e7ec 4 * Copyright (C) 2000-2009 Wolfgang Denk <wd@denx.de>
4c2e3da8 5 * Copyright Freescale Semiconductor, Inc. 2004, 2006.
8993e54b
RJ
6 *
7 * See file CREDITS for list of people who contributed to this
8 * project.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * MA 02111-1307 USA
24 *
25 * Based on the MPC83xx code.
26 */
27
28/*
29 * U-Boot - Startup Code for MPC512x based Embedded Boards
30 */
31
32#include <config.h>
561858ee 33#include <timestamp.h>
8993e54b
RJ
34#include <version.h>
35
36#define CONFIG_521X 1 /* needed for Linux kernel header files*/
37
3b74e7ec
WD
38#include <asm/immap_512x.h>
39#include "asm-offsets.h"
40
8993e54b
RJ
41#include <ppc_asm.tmpl>
42#include <ppc_defs.h>
43
44#include <asm/cache.h>
45#include <asm/mmu.h>
d98b0523 46#include <asm/u-boot.h>
8993e54b
RJ
47
48#ifndef CONFIG_IDENT_STRING
49#define CONFIG_IDENT_STRING "MPC512X"
50#endif
51
52/*
53 * Floating Point enable, Machine Check and Recoverable Interr.
54 */
55#undef MSR_KERNEL
56#ifdef DEBUG
57#define MSR_KERNEL (MSR_FP|MSR_RI)
58#else
59#define MSR_KERNEL (MSR_FP|MSR_ME|MSR_RI)
60#endif
61
62/* Macros for manipulating CSx_START/STOP */
63#define START_REG(start) ((start) >> 16)
64#define STOP_REG(start, size) (((start) + (size) - 1) >> 16)
65
66/*
67 * Set up GOT: Global Offset Table
68 *
0f8aa159 69 * Use r12 to access the GOT
8993e54b
RJ
70 */
71 START_GOT
72 GOT_ENTRY(_GOT2_TABLE_)
73 GOT_ENTRY(_FIXUP_TABLE_)
74
75 GOT_ENTRY(_start)
76 GOT_ENTRY(_start_of_vectors)
77 GOT_ENTRY(_end_of_vectors)
78 GOT_ENTRY(transfer_to_handler)
79
80 GOT_ENTRY(__init_end)
81 GOT_ENTRY(_end)
82 GOT_ENTRY(__bss_start)
83 END_GOT
84
85/*
86 * Magic number and version string
87 */
88 .long 0x27051956 /* U-Boot Magic Number */
89 .globl version_string
90version_string:
91 .ascii U_BOOT_VERSION
561858ee 92 .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
8993e54b
RJ
93 .ascii " ", CONFIG_IDENT_STRING, "\0"
94
95/*
96 * Vector Table
97 */
98 .text
99 . = EXC_OFF_SYS_RESET
100
101 .globl _start
102 /* Start from here after reset/power on */
103_start:
8993e54b
RJ
104 b boot_cold
105
106 .globl _start_of_vectors
107_start_of_vectors:
108
109/* Machine check */
110 STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
111
112/* Data Storage exception. */
113 STD_EXCEPTION(0x300, DataStorage, UnknownException)
114
115/* Instruction Storage exception. */
116 STD_EXCEPTION(0x400, InstStorage, UnknownException)
117
118/* External Interrupt exception. */
119 STD_EXCEPTION(0x500, ExtInterrupt, UnknownException)
120
121/* Alignment exception. */
122 . = 0x600
123Alignment:
124 EXCEPTION_PROLOG(SRR0, SRR1)
125 mfspr r4,DAR
126 stw r4,_DAR(r21)
127 mfspr r5,DSISR
128 stw r5,_DSISR(r21)
129 addi r3,r1,STACK_FRAME_OVERHEAD
fc4e1887 130 EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
8993e54b
RJ
131
132/* Program check exception */
133 . = 0x700
134ProgramCheck:
135 EXCEPTION_PROLOG(SRR0, SRR1)
136 addi r3,r1,STACK_FRAME_OVERHEAD
fc4e1887
JT
137 EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
138 MSR_KERNEL, COPY_EE)
8993e54b
RJ
139
140/* Floating Point Unit unavailable exception */
141 STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
142
143/* Decrementer */
144 STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
145
146/* Critical interrupt */
147 STD_EXCEPTION(0xa00, Critical, UnknownException)
148
149/* System Call */
150 STD_EXCEPTION(0xc00, SystemCall, UnknownException)
151
152/* Trace interrupt */
153 STD_EXCEPTION(0xd00, Trace, UnknownException)
154
155/* Performance Monitor interrupt */
156 STD_EXCEPTION(0xf00, PerfMon, UnknownException)
157
158/* Intruction Translation Miss */
159 STD_EXCEPTION(0x1000, InstructionTLBMiss, UnknownException)
160
161/* Data Load Translation Miss */
162 STD_EXCEPTION(0x1100, DataLoadTLBMiss, UnknownException)
163
164/* Data Store Translation Miss */
165 STD_EXCEPTION(0x1200, DataStoreTLBMiss, UnknownException)
166
167/* Instruction Address Breakpoint */
168 STD_EXCEPTION(0x1300, InstructionAddrBreakpoint, DebugException)
169
170/* System Management interrupt */
171 STD_EXCEPTION(0x1400, SystemMgmtInterrupt, UnknownException)
172
173 .globl _end_of_vectors
174_end_of_vectors:
175
176 . = 0x3000
177boot_cold:
178 /* Save msr contents */
179 mfmsr r5
180
181 /* Set IMMR area to our preferred location */
182 lis r4, CONFIG_DEFAULT_IMMR@h
6d0f6bcf
JCPV
183 lis r3, CONFIG_SYS_IMMR@h
184 ori r3, r3, CONFIG_SYS_IMMR@l
8993e54b
RJ
185 stw r3, IMMRBAR(r4)
186 mtspr MBAR, r3 /* IMMRBAR is mirrored into the MBAR SPR (311) */
187
188 /* Initialise the machine */
189 bl cpu_early_init
190
191 /*
192 * Set up Local Access Windows:
193 *
194 * 1) Boot/CS0 (boot FLASH)
195 * 2) On-chip SRAM (initial stack purposes)
196 */
197
198 /* Boot CS/CS0 window range */
6d0f6bcf
JCPV
199 lis r3, CONFIG_SYS_IMMR@h
200 ori r3, r3, CONFIG_SYS_IMMR@l
8993e54b 201
6d0f6bcf
JCPV
202 lis r4, START_REG(CONFIG_SYS_FLASH_BASE)
203 ori r4, r4, STOP_REG(CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_SIZE)
8993e54b
RJ
204 stw r4, LPCS0AW(r3)
205
206 /*
207 * The SRAM window has a fixed size (256K), so only the start address
208 * is necessary
209 */
6d0f6bcf 210 lis r4, START_REG(CONFIG_SYS_SRAM_BASE) & 0xff00
8993e54b
RJ
211 stw r4, SRAMBAR(r3)
212
b1b54e35 213 /*
8993e54b 214 * According to MPC5121e RM, configuring local access windows should
b1b54e35 215 * be followed by a dummy read of the config register that was
8993e54b 216 * modified last and an isync
b1b54e35 217 */
8993e54b
RJ
218 lwz r4, SRAMBAR(r3)
219 isync
220
221 /*
222 * Set configuration of the Boot/CS0, the SRAM window does not have a
223 * config register so no params can be set for it
224 */
6d0f6bcf
JCPV
225 lis r3, (CONFIG_SYS_IMMR + LPC_OFFSET)@h
226 ori r3, r3, (CONFIG_SYS_IMMR + LPC_OFFSET)@l
8993e54b 227
6d0f6bcf
JCPV
228 lis r4, CONFIG_SYS_CS0_CFG@h
229 ori r4, r4, CONFIG_SYS_CS0_CFG@l
b1b54e35 230 stw r4, CS0_CONFIG(r3)
8993e54b
RJ
231
232 /* Master enable all CS's */
233 lis r4, CS_CTRL_ME@h
234 ori r4, r4, CS_CTRL_ME@l
235 stw r4, CS_CTRL(r3)
236
6d0f6bcf
JCPV
237 lis r4, (CONFIG_SYS_MONITOR_BASE)@h
238 ori r4, r4, (CONFIG_SYS_MONITOR_BASE)@l
8993e54b
RJ
239 addi r5, r4, in_flash - _start + EXC_OFF_SYS_RESET
240 mtlr r5
241 blr
242
243in_flash:
6d0f6bcf
JCPV
244 lis r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET)@h
245 ori r1, r1, (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET)@l
8993e54b
RJ
246
247 li r0, 0 /* Make room for stack frame header and */
248 stwu r0, -4(r1) /* clear final stack frame so that */
249 stwu r0, -4(r1) /* stack backtraces terminate cleanly */
250
251 /* let the C-code set up the rest */
252 /* */
253 /* Be careful to keep code relocatable & stack humble */
254 /*------------------------------------------------------*/
255
256 GET_GOT /* initialize GOT access */
257
258 /* r3: IMMR */
6d0f6bcf 259 lis r3, CONFIG_SYS_IMMR@h
8993e54b
RJ
260 /* run low-level CPU init code (in Flash) */
261 bl cpu_init_f
262
8993e54b
RJ
263 /* run 1st part of board init code (in Flash) */
264 bl board_init_f
265
266 /* NOTREACHED - board_init_f() does not return */
267
268/*
269 * This code finishes saving the registers to the exception frame
270 * and jumps to the appropriate handler for the exception.
271 * Register r21 is pointer into trap frame, r1 has new stack pointer.
272 */
273 .globl transfer_to_handler
274transfer_to_handler:
275 stw r22,_NIP(r21)
276 lis r22,MSR_POW@h
277 andc r23,r23,r22
278 stw r23,_MSR(r21)
279 SAVE_GPR(7, r21)
280 SAVE_4GPRS(8, r21)
281 SAVE_8GPRS(12, r21)
282 SAVE_8GPRS(24, r21)
283 mflr r23
284 andi. r24,r23,0x3f00 /* get vector offset */
285 stw r24,TRAP(r21)
286 li r22,0
287 stw r22,RESULT(r21)
288 lwz r24,0(r23) /* virtual address of handler */
289 lwz r23,4(r23) /* where to go when done */
290 mtspr SRR0,r24
291 mtspr SRR1,r20
292 mtlr r23
293 SYNC
294 rfi /* jump to handler, enable MMU */
295
296int_return:
297 mfmsr r28 /* Disable interrupts */
298 li r4,0
299 ori r4,r4,MSR_EE
300 andc r28,r28,r4
301 SYNC /* Some chip revs need this... */
302 mtmsr r28
303 SYNC
304 lwz r2,_CTR(r1)
305 lwz r0,_LINK(r1)
306 mtctr r2
307 mtlr r0
308 lwz r2,_XER(r1)
309 lwz r0,_CCR(r1)
310 mtspr XER,r2
311 mtcrf 0xFF,r0
312 REST_10GPRS(3, r1)
313 REST_10GPRS(13, r1)
314 REST_8GPRS(23, r1)
315 REST_GPR(31, r1)
316 lwz r2,_NIP(r1) /* Restore environment */
317 lwz r0,_MSR(r1)
318 mtspr SRR0,r2
319 mtspr SRR1,r0
320 lwz r0,GPR0(r1)
321 lwz r2,GPR2(r1)
322 lwz r1,GPR1(r1)
323 SYNC
324 rfi
325
326/*
327 * This code initialises the machine, it expects original MSR contents to be in r5.
328 */
329cpu_early_init:
330 /* Initialize machine status; enable machine check interrupt */
331 /*-----------------------------------------------------------*/
332
333 li r3, MSR_KERNEL /* Set ME and RI flags */
334 rlwimi r3, r5, 0, 25, 25 /* preserve IP bit */
335#ifdef DEBUG
336 rlwimi r3, r5, 0, 21, 22 /* debugger might set SE, BE bits */
337#endif
338 mtmsr r3
339 SYNC
340 mtspr SRR1, r3 /* Mirror current MSR state in SRR1 */
341
6d0f6bcf 342 lis r3, CONFIG_SYS_IMMR@h
8993e54b
RJ
343
344#if defined(CONFIG_WATCHDOG)
345 /* Initialise the watchdog and reset it */
346 /*--------------------------------------*/
6d0f6bcf 347 lis r4, CONFIG_SYS_WATCHDOG_VALUE
8993e54b
RJ
348 ori r4, r4, (SWCRR_SWEN | SWCRR_SWRI | SWCRR_SWPR)
349 stw r4, SWCRR(r3)
350
351 /* reset */
352 li r4, 0x556C
353 sth r4, SWSRR@l(r3)
354 li r4, 0x0
355 ori r4, r4, 0xAA39
356 sth r4, SWSRR@l(r3)
357#else
358 /* Disable the watchdog */
359 /*----------------------*/
360 lwz r4, SWCRR(r3)
361 /*
362 * Check to see if it's enabled for disabling: once disabled by s/w
363 * it's not possible to re-enable it
364 */
365 andi. r4, r4, 0x4
366 beq 1f
367 xor r4, r4, r4
368 stw r4, SWCRR(r3)
3691:
370#endif /* CONFIG_WATCHDOG */
371
372 /* Initialize the Hardware Implementation-dependent Registers */
373 /* HID0 also contains cache control */
374 /*------------------------------------------------------*/
6d0f6bcf
JCPV
375 lis r3, CONFIG_SYS_HID0_INIT@h
376 ori r3, r3, CONFIG_SYS_HID0_INIT@l
8993e54b
RJ
377 SYNC
378 mtspr HID0, r3
379
6d0f6bcf
JCPV
380 lis r3, CONFIG_SYS_HID0_FINAL@h
381 ori r3, r3, CONFIG_SYS_HID0_FINAL@l
8993e54b
RJ
382 SYNC
383 mtspr HID0, r3
384
6d0f6bcf
JCPV
385 lis r3, CONFIG_SYS_HID2@h
386 ori r3, r3, CONFIG_SYS_HID2@l
8993e54b
RJ
387 SYNC
388 mtspr HID2, r3
389 sync
390 blr
391
392
393/* Cache functions.
394 *
395 * Note: requires that all cache bits in
396 * HID0 are in the low half word.
397 */
398 .globl icache_enable
399icache_enable:
400 mfspr r3, HID0
401 ori r3, r3, HID0_ICE
402 lis r4, 0
403 ori r4, r4, HID0_ILOCK
404 andc r3, r3, r4
405 ori r4, r3, HID0_ICFI
406 isync
407 mtspr HID0, r4 /* sets enable and invalidate, clears lock */
408 isync
409 mtspr HID0, r3 /* clears invalidate */
410 blr
411
412 .globl icache_disable
413icache_disable:
414 mfspr r3, HID0
415 lis r4, 0
416 ori r4, r4, HID0_ICE|HID0_ILOCK
417 andc r3, r3, r4
418 ori r4, r3, HID0_ICFI
419 isync
420 mtspr HID0, r4 /* sets invalidate, clears enable and lock*/
421 isync
422 mtspr HID0, r3 /* clears invalidate */
423 blr
424
425 .globl icache_status
426icache_status:
427 mfspr r3, HID0
428 rlwinm r3, r3, (31 - HID0_ICE_SHIFT + 1), 31, 31
429 blr
430
431 .globl dcache_enable
432dcache_enable:
433 mfspr r3, HID0
434 li r5, HID0_DCFI|HID0_DLOCK
435 andc r3, r3, r5
436 mtspr HID0, r3 /* no invalidate, unlock */
437 ori r3, r3, HID0_DCE
438 ori r5, r3, HID0_DCFI
439 mtspr HID0, r5 /* enable + invalidate */
440 mtspr HID0, r3 /* enable */
441 sync
442 blr
443
444 .globl dcache_disable
445dcache_disable:
446 mfspr r3, HID0
447 lis r4, 0
448 ori r4, r4, HID0_DCE|HID0_DLOCK
449 andc r3, r3, r4
450 ori r4, r3, HID0_DCI
451 sync
452 mtspr HID0, r4 /* sets invalidate, clears enable and lock */
453 sync
454 mtspr HID0, r3 /* clears invalidate */
455 blr
456
457 .globl dcache_status
458dcache_status:
459 mfspr r3, HID0
460 rlwinm r3, r3, (31 - HID0_DCE_SHIFT + 1), 31, 31
461 blr
462
463 .globl get_pvr
464get_pvr:
465 mfspr r3, PVR
466 blr
467
8993e54b
RJ
468/*-------------------------------------------------------------------*/
469
470/*
471 * void relocate_code (addr_sp, gd, addr_moni)
472 *
473 * This "function" does not return, instead it continues in RAM
474 * after relocating the monitor code.
475 *
476 * r3 = dest
477 * r4 = src
478 * r5 = length in bytes
479 * r6 = cachelinesize
480 */
481 .globl relocate_code
482relocate_code:
483 mr r1, r3 /* Set new stack pointer */
484 mr r9, r4 /* Save copy of Global Data pointer */
485 mr r10, r5 /* Save copy of Destination Address */
486
0f8aa159 487 GET_GOT
8993e54b 488 mr r3, r5 /* Destination Address */
6d0f6bcf
JCPV
489 lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */
490 ori r4, r4, CONFIG_SYS_MONITOR_BASE@l
8993e54b
RJ
491 lwz r5, GOT(__init_end)
492 sub r5, r5, r4
6d0f6bcf 493 li r6, CONFIG_SYS_CACHELINE_SIZE /* Cache Line Size */
8993e54b
RJ
494
495 /*
496 * Fix GOT pointer:
497 *
6d0f6bcf 498 * New GOT-PTR = (old GOT-PTR - CONFIG_SYS_MONITOR_BASE)
8993e54b
RJ
499 * + Destination Address
500 *
501 * Offset:
502 */
503 sub r15, r10, r4
504
505 /* First our own GOT */
0f8aa159 506 add r12, r12, r15
8993e54b
RJ
507 /* then the one used by the C code */
508 add r30, r30, r15
509
510 /*
511 * Now relocate code
512 */
513 cmplw cr1,r3,r4
514 addi r0,r5,3
515 srwi. r0,r0,2
516 beq cr1,4f /* In place copy is not necessary */
517 beq 7f /* Protect against 0 count */
518 mtctr r0
519 bge cr1,2f
520 la r8,-4(r4)
521 la r7,-4(r3)
522
523 /* copy */
5241: lwzu r0,4(r8)
525 stwu r0,4(r7)
526 bdnz 1b
527
528 addi r0,r5,3
529 srwi. r0,r0,2
530 mtctr r0
531 la r8,-4(r4)
532 la r7,-4(r3)
533
534 /* and compare */
53520: lwzu r20,4(r8)
536 lwzu r21,4(r7)
537 xor. r22, r20, r21
538 bne 30f
539 bdnz 20b
540 b 4f
541
542 /* compare failed */
54330: li r3, 0
544 blr
545
5462: slwi r0,r0,2 /* re copy in reverse order ... y do we needed it? */
547 add r8,r4,r0
548 add r7,r3,r0
5493: lwzu r0,-4(r8)
550 stwu r0,-4(r7)
551 bdnz 3b
552
553/*
554 * Now flush the cache: note that we must start from a cache aligned
555 * address. Otherwise we might miss one cache line.
556 */
5574: cmpwi r6,0
558 add r5,r3,r5
559 beq 7f /* Always flush prefetch queue in any case */
560 subi r0,r6,1
561 andc r3,r3,r0
562 mr r4,r3
5635: dcbst 0,r4
564 add r4,r4,r6
565 cmplw r4,r5
566 blt 5b
567 sync /* Wait for all dcbst to complete on bus */
568 mr r4,r3
5696: icbi 0,r4
570 add r4,r4,r6
571 cmplw r4,r5
572 blt 6b
5737: sync /* Wait for all icbi to complete on bus */
574 isync
575
576/*
577 * We are done. Do not return, instead branch to second part of board
578 * initialization, now running from RAM.
579 */
580 addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
581 mtlr r0
582 blr
583
584in_ram:
585 /*
0f8aa159 586 * Relocation Function, r12 point to got2+0x8000
8993e54b
RJ
587 *
588 * Adjust got2 pointers, no need to check for 0, this code
589 * already puts a few entries in the table.
590 */
591 li r0,__got2_entries@sectoff@l
592 la r3,GOT(_GOT2_TABLE_)
593 lwz r11,GOT(_GOT2_TABLE_)
594 mtctr r0
595 sub r11,r3,r11
596 addi r3,r3,-4
5971: lwzu r0,4(r3)
afc3ba0f
JT
598 cmpwi r0,0
599 beq- 2f
8993e54b
RJ
600 add r0,r0,r11
601 stw r0,0(r3)
afc3ba0f 6022: bdnz 1b
8993e54b
RJ
603
604 /*
605 * Now adjust the fixups and the pointers to the fixups
606 * in case we need to move ourselves again.
607 */
afc3ba0f 608 li r0,__fixup_entries@sectoff@l
8993e54b
RJ
609 lwz r3,GOT(_FIXUP_TABLE_)
610 cmpwi r0,0
611 mtctr r0
612 addi r3,r3,-4
613 beq 4f
6143: lwzu r4,4(r3)
615 lwzux r0,r4,r11
616 add r0,r0,r11
617 stw r10,0(r3)
618 stw r0,0(r4)
619 bdnz 3b
6204:
621clear_bss:
622 /*
623 * Now clear BSS segment
624 */
625 lwz r3,GOT(__bss_start)
626 lwz r4,GOT(_end)
627
628 cmplw 0, r3, r4
629 beq 6f
630
631 li r0, 0
6325:
633 stw r0, 0(r3)
634 addi r3, r3, 4
635 cmplw 0, r3, r4
636 bne 5b
6376:
638 mr r3, r9 /* Global Data pointer */
639 mr r4, r10 /* Destination Address */
640 bl board_init_r
641
642 /*
643 * Copy exception vector code to low memory
644 *
645 * r3: dest_addr
646 * r7: source address, r8: end address, r9: target address
647 */
648 .globl trap_init
649trap_init:
0f8aa159
JT
650 mflr r4 /* save link register */
651 GET_GOT
8993e54b
RJ
652 lwz r7, GOT(_start)
653 lwz r8, GOT(_end_of_vectors)
654
655 li r9, 0x100 /* reset vector at 0x100 */
656
657 cmplw 0, r7, r8
658 bgelr /* return if r7>=r8 - just in case */
8993e54b
RJ
6591:
660 lwz r0, 0(r7)
661 stw r0, 0(r9)
662 addi r7, r7, 4
663 addi r9, r9, 4
664 cmplw 0, r7, r8
665 bne 1b
666
667 /*
668 * relocate `hdlr' and `int_return' entries
669 */
670 li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
671 li r8, Alignment - _start + EXC_OFF_SYS_RESET
6722:
673 bl trap_reloc
674 addi r7, r7, 0x100 /* next exception vector */
675 cmplw 0, r7, r8
676 blt 2b
677
678 li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
679 bl trap_reloc
680
681 li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
682 bl trap_reloc
683
684 li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
685 li r8, SystemCall - _start + EXC_OFF_SYS_RESET
6863:
687 bl trap_reloc
688 addi r7, r7, 0x100 /* next exception vector */
689 cmplw 0, r7, r8
690 blt 3b
691
692 li r7, .L_Trace - _start + EXC_OFF_SYS_RESET
693 li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
6944:
695 bl trap_reloc
696 addi r7, r7, 0x100 /* next exception vector */
697 cmplw 0, r7, r8
698 blt 4b
699
700 mfmsr r3 /* now that the vectors have */
701 lis r7, MSR_IP@h /* relocated into low memory */
702 ori r7, r7, MSR_IP@l /* MSR[IP] can be turned off */
703 andc r3, r3, r7 /* (if it was on) */
704 SYNC /* Some chip revs need this... */
705 mtmsr r3
706 SYNC
707
708 mtlr r4 /* restore link register */
709 blr