start.S 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. /*
  2. * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
  3. * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
  4. * Copyright (C) 2000,2001,2002 Wolfgang Denk <wd@denx.de>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. /* U-Boot - Startup Code for PowerPC based Embedded Boards
  25. *
  26. *
  27. * The processor starts at 0x00000100 and the code is executed
  28. * from flash. The code is organized to be at an other address
  29. * in memory, but as long we don't jump around before relocating,
  30. * board_init lies at a quite high address and when the cpu has
  31. * jumped there, everything is ok.
  32. * This works because the cpu gives the FLASH (CS0) the whole
  33. * address space at startup, and board_init lies as a echo of
  34. * the flash somewhere up there in the memory map.
  35. *
  36. * board_init will change CS0 to be positioned at the correct
  37. * address and (s)dram will be positioned at address 0
  38. */
  39. #include <asm-offsets.h>
  40. #include <config.h>
  41. #include <mpc8xx.h>
  42. #include <version.h>
  43. #define CONFIG_8xx 1 /* needed for Linux kernel header files */
  44. #define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
  45. #include <ppc_asm.tmpl>
  46. #include <ppc_defs.h>
  47. #include <asm/cache.h>
  48. #include <asm/mmu.h>
  49. #include <asm/u-boot.h>
  50. /* We don't want the MMU yet.
  51. */
  52. #undef MSR_KERNEL
  53. #define MSR_KERNEL ( MSR_ME | MSR_RI ) /* Machine Check and Recoverable Interr. */
  54. /*
  55. * Set up GOT: Global Offset Table
  56. *
  57. * Use r12 to access the GOT
  58. */
  59. START_GOT
  60. GOT_ENTRY(_GOT2_TABLE_)
  61. GOT_ENTRY(_FIXUP_TABLE_)
  62. GOT_ENTRY(_start)
  63. GOT_ENTRY(_start_of_vectors)
  64. GOT_ENTRY(_end_of_vectors)
  65. GOT_ENTRY(transfer_to_handler)
  66. GOT_ENTRY(__init_end)
  67. GOT_ENTRY(__bss_end__)
  68. GOT_ENTRY(__bss_start)
  69. END_GOT
  70. /*
  71. * r3 - 1st arg to board_init(): IMMP pointer
  72. * r4 - 2nd arg to board_init(): boot flag
  73. */
  74. .text
  75. .long 0x27051956 /* U-Boot Magic Number */
  76. .globl version_string
  77. version_string:
  78. .ascii U_BOOT_VERSION_STRING, "\0"
  79. . = EXC_OFF_SYS_RESET
  80. .globl _start
  81. _start:
  82. lis r3, CONFIG_SYS_IMMR@h /* position IMMR */
  83. mtspr 638, r3
  84. /* Initialize machine status; enable machine check interrupt */
  85. /*----------------------------------------------------------------------*/
  86. li r3, MSR_KERNEL /* Set ME, RI flags */
  87. mtmsr r3
  88. mtspr SRR1, r3 /* Make SRR1 match MSR */
  89. mfspr r3, ICR /* clear Interrupt Cause Register */
  90. /* Initialize debug port registers */
  91. /*----------------------------------------------------------------------*/
  92. xor r0, r0, r0 /* Clear R0 */
  93. mtspr LCTRL1, r0 /* Initialize debug port regs */
  94. mtspr LCTRL2, r0
  95. mtspr COUNTA, r0
  96. mtspr COUNTB, r0
  97. /* Reset the caches */
  98. /*----------------------------------------------------------------------*/
  99. mfspr r3, IC_CST /* Clear error bits */
  100. mfspr r3, DC_CST
  101. lis r3, IDC_UNALL@h /* Unlock all */
  102. mtspr IC_CST, r3
  103. mtspr DC_CST, r3
  104. lis r3, IDC_INVALL@h /* Invalidate all */
  105. mtspr IC_CST, r3
  106. mtspr DC_CST, r3
  107. lis r3, IDC_DISABLE@h /* Disable data cache */
  108. mtspr DC_CST, r3
  109. #if !defined(CONFIG_SYS_DELAYED_ICACHE)
  110. /* On IP860 and PCU E,
  111. * we cannot enable IC yet
  112. */
  113. lis r3, IDC_ENABLE@h /* Enable instruction cache */
  114. #endif
  115. mtspr IC_CST, r3
  116. /* invalidate all tlb's */
  117. /*----------------------------------------------------------------------*/
  118. tlbia
  119. isync
  120. /*
  121. * Calculate absolute address in FLASH and jump there
  122. *----------------------------------------------------------------------*/
  123. lis r3, CONFIG_SYS_MONITOR_BASE@h
  124. ori r3, r3, CONFIG_SYS_MONITOR_BASE@l
  125. addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
  126. mtlr r3
  127. blr
  128. in_flash:
  129. /* initialize some SPRs that are hard to access from C */
  130. /*----------------------------------------------------------------------*/
  131. lis r3, CONFIG_SYS_IMMR@h /* pass IMMR as arg1 to C routine */
  132. ori r1, r3, CONFIG_SYS_INIT_SP_OFFSET /* set up the stack in internal DPRAM */
  133. /* Note: R0 is still 0 here */
  134. stwu r0, -4(r1) /* clear final stack frame so that */
  135. stwu r0, -4(r1) /* stack backtraces terminate cleanly */
  136. /*
  137. * Disable serialized ifetch and show cycles
  138. * (i.e. set processor to normal mode).
  139. * This is also a silicon bug workaround, see errata
  140. */
  141. li r2, 0x0007
  142. mtspr ICTRL, r2
  143. /* Set up debug mode entry */
  144. lis r2, CONFIG_SYS_DER@h
  145. ori r2, r2, CONFIG_SYS_DER@l
  146. mtspr DER, r2
  147. /* let the C-code set up the rest */
  148. /* */
  149. /* Be careful to keep code relocatable ! */
  150. /*----------------------------------------------------------------------*/
  151. GET_GOT /* initialize GOT access */
  152. /* r3: IMMR */
  153. bl cpu_init_f /* run low-level CPU init code (from Flash) */
  154. bl board_init_f /* run 1st part of board init code (from Flash) */
  155. /* NOTREACHED - board_init_f() does not return */
  156. .globl _start_of_vectors
  157. _start_of_vectors:
  158. /* Machine check */
  159. STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
  160. /* Data Storage exception. "Never" generated on the 860. */
  161. STD_EXCEPTION(0x300, DataStorage, UnknownException)
  162. /* Instruction Storage exception. "Never" generated on the 860. */
  163. STD_EXCEPTION(0x400, InstStorage, UnknownException)
  164. /* External Interrupt exception. */
  165. STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
  166. /* Alignment exception. */
  167. . = 0x600
  168. Alignment:
  169. EXCEPTION_PROLOG(SRR0, SRR1)
  170. mfspr r4,DAR
  171. stw r4,_DAR(r21)
  172. mfspr r5,DSISR
  173. stw r5,_DSISR(r21)
  174. addi r3,r1,STACK_FRAME_OVERHEAD
  175. EXC_XFER_TEMPLATE(Alignment, AlignmentException, MSR_KERNEL, COPY_EE)
  176. /* Program check exception */
  177. . = 0x700
  178. ProgramCheck:
  179. EXCEPTION_PROLOG(SRR0, SRR1)
  180. addi r3,r1,STACK_FRAME_OVERHEAD
  181. EXC_XFER_TEMPLATE(ProgramCheck, ProgramCheckException,
  182. MSR_KERNEL, COPY_EE)
  183. /* No FPU on MPC8xx. This exception is not supposed to happen.
  184. */
  185. STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
  186. /* I guess we could implement decrementer, and may have
  187. * to someday for timekeeping.
  188. */
  189. STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
  190. STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
  191. STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
  192. STD_EXCEPTION(0xc00, SystemCall, UnknownException)
  193. STD_EXCEPTION(0xd00, SingleStep, UnknownException)
  194. STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
  195. STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
  196. /* On the MPC8xx, this is a software emulation interrupt. It occurs
  197. * for all unimplemented and illegal instructions.
  198. */
  199. STD_EXCEPTION(0x1000, SoftEmu, SoftEmuException)
  200. STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
  201. STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
  202. STD_EXCEPTION(0x1300, InstructionTLBError, UnknownException)
  203. STD_EXCEPTION(0x1400, DataTLBError, UnknownException)
  204. STD_EXCEPTION(0x1500, Reserved5, UnknownException)
  205. STD_EXCEPTION(0x1600, Reserved6, UnknownException)
  206. STD_EXCEPTION(0x1700, Reserved7, UnknownException)
  207. STD_EXCEPTION(0x1800, Reserved8, UnknownException)
  208. STD_EXCEPTION(0x1900, Reserved9, UnknownException)
  209. STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
  210. STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
  211. STD_EXCEPTION(0x1c00, DataBreakpoint, UnknownException)
  212. STD_EXCEPTION(0x1d00, InstructionBreakpoint, DebugException)
  213. STD_EXCEPTION(0x1e00, PeripheralBreakpoint, UnknownException)
  214. STD_EXCEPTION(0x1f00, DevPortBreakpoint, UnknownException)
  215. .globl _end_of_vectors
  216. _end_of_vectors:
  217. . = 0x2000
  218. /*
  219. * This code finishes saving the registers to the exception frame
  220. * and jumps to the appropriate handler for the exception.
  221. * Register r21 is pointer into trap frame, r1 has new stack pointer.
  222. */
  223. .globl transfer_to_handler
  224. transfer_to_handler:
  225. stw r22,_NIP(r21)
  226. lis r22,MSR_POW@h
  227. andc r23,r23,r22
  228. stw r23,_MSR(r21)
  229. SAVE_GPR(7, r21)
  230. SAVE_4GPRS(8, r21)
  231. SAVE_8GPRS(12, r21)
  232. SAVE_8GPRS(24, r21)
  233. mflr r23
  234. andi. r24,r23,0x3f00 /* get vector offset */
  235. stw r24,TRAP(r21)
  236. li r22,0
  237. stw r22,RESULT(r21)
  238. mtspr SPRG2,r22 /* r1 is now kernel sp */
  239. lwz r24,0(r23) /* virtual address of handler */
  240. lwz r23,4(r23) /* where to go when done */
  241. mtspr SRR0,r24
  242. mtspr SRR1,r20
  243. mtlr r23
  244. SYNC
  245. rfi /* jump to handler, enable MMU */
  246. int_return:
  247. mfmsr r28 /* Disable interrupts */
  248. li r4,0
  249. ori r4,r4,MSR_EE
  250. andc r28,r28,r4
  251. SYNC /* Some chip revs need this... */
  252. mtmsr r28
  253. SYNC
  254. lwz r2,_CTR(r1)
  255. lwz r0,_LINK(r1)
  256. mtctr r2
  257. mtlr r0
  258. lwz r2,_XER(r1)
  259. lwz r0,_CCR(r1)
  260. mtspr XER,r2
  261. mtcrf 0xFF,r0
  262. REST_10GPRS(3, r1)
  263. REST_10GPRS(13, r1)
  264. REST_8GPRS(23, r1)
  265. REST_GPR(31, r1)
  266. lwz r2,_NIP(r1) /* Restore environment */
  267. lwz r0,_MSR(r1)
  268. mtspr SRR0,r2
  269. mtspr SRR1,r0
  270. lwz r0,GPR0(r1)
  271. lwz r2,GPR2(r1)
  272. lwz r1,GPR1(r1)
  273. SYNC
  274. rfi
  275. /* Cache functions.
  276. */
  277. .globl icache_enable
  278. icache_enable:
  279. SYNC
  280. lis r3, IDC_INVALL@h
  281. mtspr IC_CST, r3
  282. lis r3, IDC_ENABLE@h
  283. mtspr IC_CST, r3
  284. blr
  285. .globl icache_disable
  286. icache_disable:
  287. SYNC
  288. lis r3, IDC_DISABLE@h
  289. mtspr IC_CST, r3
  290. blr
  291. .globl icache_status
  292. icache_status:
  293. mfspr r3, IC_CST
  294. srwi r3, r3, 31 /* >>31 => select bit 0 */
  295. blr
  296. .globl dcache_enable
  297. dcache_enable:
  298. #if 0
  299. SYNC
  300. #endif
  301. #if 1
  302. lis r3, 0x0400 /* Set cache mode with MMU off */
  303. mtspr MD_CTR, r3
  304. #endif
  305. lis r3, IDC_INVALL@h
  306. mtspr DC_CST, r3
  307. #if 0
  308. lis r3, DC_SFWT@h
  309. mtspr DC_CST, r3
  310. #endif
  311. lis r3, IDC_ENABLE@h
  312. mtspr DC_CST, r3
  313. blr
  314. .globl dcache_disable
  315. dcache_disable:
  316. SYNC
  317. lis r3, IDC_DISABLE@h
  318. mtspr DC_CST, r3
  319. lis r3, IDC_INVALL@h
  320. mtspr DC_CST, r3
  321. blr
  322. .globl dcache_status
  323. dcache_status:
  324. mfspr r3, DC_CST
  325. srwi r3, r3, 31 /* >>31 => select bit 0 */
  326. blr
  327. .globl dc_read
  328. dc_read:
  329. mtspr DC_ADR, r3
  330. mfspr r3, DC_DAT
  331. blr
  332. /*
  333. * unsigned int get_immr (unsigned int mask)
  334. *
  335. * return (mask ? (IMMR & mask) : IMMR);
  336. */
  337. .globl get_immr
  338. get_immr:
  339. mr r4,r3 /* save mask */
  340. mfspr r3, IMMR /* IMMR */
  341. cmpwi 0,r4,0 /* mask != 0 ? */
  342. beq 4f
  343. and r3,r3,r4 /* IMMR & mask */
  344. 4:
  345. blr
  346. .globl get_pvr
  347. get_pvr:
  348. mfspr r3, PVR
  349. blr
  350. .globl wr_ic_cst
  351. wr_ic_cst:
  352. mtspr IC_CST, r3
  353. blr
  354. .globl rd_ic_cst
  355. rd_ic_cst:
  356. mfspr r3, IC_CST
  357. blr
  358. .globl wr_ic_adr
  359. wr_ic_adr:
  360. mtspr IC_ADR, r3
  361. blr
  362. .globl wr_dc_cst
  363. wr_dc_cst:
  364. mtspr DC_CST, r3
  365. blr
  366. .globl rd_dc_cst
  367. rd_dc_cst:
  368. mfspr r3, DC_CST
  369. blr
  370. .globl wr_dc_adr
  371. wr_dc_adr:
  372. mtspr DC_ADR, r3
  373. blr
  374. /*------------------------------------------------------------------------------*/
  375. /*
  376. * void relocate_code (addr_sp, gd, addr_moni)
  377. *
  378. * This "function" does not return, instead it continues in RAM
  379. * after relocating the monitor code.
  380. *
  381. * r3 = dest
  382. * r4 = src
  383. * r5 = length in bytes
  384. * r6 = cachelinesize
  385. */
  386. .globl relocate_code
  387. relocate_code:
  388. mr r1, r3 /* Set new stack pointer */
  389. mr r9, r4 /* Save copy of Global Data pointer */
  390. mr r10, r5 /* Save copy of Destination Address */
  391. GET_GOT
  392. mr r3, r5 /* Destination Address */
  393. lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */
  394. ori r4, r4, CONFIG_SYS_MONITOR_BASE@l
  395. lwz r5, GOT(__init_end)
  396. sub r5, r5, r4
  397. li r6, CONFIG_SYS_CACHELINE_SIZE /* Cache Line Size */
  398. /*
  399. * Fix GOT pointer:
  400. *
  401. * New GOT-PTR = (old GOT-PTR - CONFIG_SYS_MONITOR_BASE) + Destination Address
  402. *
  403. * Offset:
  404. */
  405. sub r15, r10, r4
  406. /* First our own GOT */
  407. add r12, r12, r15
  408. /* then the one used by the C code */
  409. add r30, r30, r15
  410. /*
  411. * Now relocate code
  412. */
  413. cmplw cr1,r3,r4
  414. addi r0,r5,3
  415. srwi. r0,r0,2
  416. beq cr1,4f /* In place copy is not necessary */
  417. beq 7f /* Protect against 0 count */
  418. mtctr r0
  419. bge cr1,2f
  420. la r8,-4(r4)
  421. la r7,-4(r3)
  422. 1: lwzu r0,4(r8)
  423. stwu r0,4(r7)
  424. bdnz 1b
  425. b 4f
  426. 2: slwi r0,r0,2
  427. add r8,r4,r0
  428. add r7,r3,r0
  429. 3: lwzu r0,-4(r8)
  430. stwu r0,-4(r7)
  431. bdnz 3b
  432. /*
  433. * Now flush the cache: note that we must start from a cache aligned
  434. * address. Otherwise we might miss one cache line.
  435. */
  436. 4: cmpwi r6,0
  437. add r5,r3,r5
  438. beq 7f /* Always flush prefetch queue in any case */
  439. subi r0,r6,1
  440. andc r3,r3,r0
  441. mr r4,r3
  442. 5: dcbst 0,r4
  443. add r4,r4,r6
  444. cmplw r4,r5
  445. blt 5b
  446. sync /* Wait for all dcbst to complete on bus */
  447. mr r4,r3
  448. 6: icbi 0,r4
  449. add r4,r4,r6
  450. cmplw r4,r5
  451. blt 6b
  452. 7: sync /* Wait for all icbi to complete on bus */
  453. isync
  454. /*
  455. * We are done. Do not return, instead branch to second part of board
  456. * initialization, now running from RAM.
  457. */
  458. addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
  459. mtlr r0
  460. blr
  461. in_ram:
  462. /*
  463. * Relocation Function, r12 point to got2+0x8000
  464. *
  465. * Adjust got2 pointers, no need to check for 0, this code
  466. * already puts a few entries in the table.
  467. */
  468. li r0,__got2_entries@sectoff@l
  469. la r3,GOT(_GOT2_TABLE_)
  470. lwz r11,GOT(_GOT2_TABLE_)
  471. mtctr r0
  472. sub r11,r3,r11
  473. addi r3,r3,-4
  474. 1: lwzu r0,4(r3)
  475. cmpwi r0,0
  476. beq- 2f
  477. add r0,r0,r11
  478. stw r0,0(r3)
  479. 2: bdnz 1b
  480. /*
  481. * Now adjust the fixups and the pointers to the fixups
  482. * in case we need to move ourselves again.
  483. */
  484. li r0,__fixup_entries@sectoff@l
  485. lwz r3,GOT(_FIXUP_TABLE_)
  486. cmpwi r0,0
  487. mtctr r0
  488. addi r3,r3,-4
  489. beq 4f
  490. 3: lwzu r4,4(r3)
  491. lwzux r0,r4,r11
  492. cmpwi r0,0
  493. add r0,r0,r11
  494. stw r4,0(r3)
  495. beq- 5f
  496. stw r0,0(r4)
  497. 5: bdnz 3b
  498. 4:
  499. clear_bss:
  500. /*
  501. * Now clear BSS segment
  502. */
  503. lwz r3,GOT(__bss_start)
  504. lwz r4,GOT(__bss_end__)
  505. cmplw 0, r3, r4
  506. beq 6f
  507. li r0, 0
  508. 5:
  509. stw r0, 0(r3)
  510. addi r3, r3, 4
  511. cmplw 0, r3, r4
  512. bne 5b
  513. 6:
  514. mr r3, r9 /* Global Data pointer */
  515. mr r4, r10 /* Destination Address */
  516. bl board_init_r
  517. /*
  518. * Copy exception vector code to low memory
  519. *
  520. * r3: dest_addr
  521. * r7: source address, r8: end address, r9: target address
  522. */
  523. .globl trap_init
  524. trap_init:
  525. mflr r4 /* save link register */
  526. GET_GOT
  527. lwz r7, GOT(_start)
  528. lwz r8, GOT(_end_of_vectors)
  529. li r9, 0x100 /* reset vector always at 0x100 */
  530. cmplw 0, r7, r8
  531. bgelr /* return if r7>=r8 - just in case */
  532. 1:
  533. lwz r0, 0(r7)
  534. stw r0, 0(r9)
  535. addi r7, r7, 4
  536. addi r9, r9, 4
  537. cmplw 0, r7, r8
  538. bne 1b
  539. /*
  540. * relocate `hdlr' and `int_return' entries
  541. */
  542. li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
  543. li r8, Alignment - _start + EXC_OFF_SYS_RESET
  544. 2:
  545. bl trap_reloc
  546. addi r7, r7, 0x100 /* next exception vector */
  547. cmplw 0, r7, r8
  548. blt 2b
  549. li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
  550. bl trap_reloc
  551. li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
  552. bl trap_reloc
  553. li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
  554. li r8, SystemCall - _start + EXC_OFF_SYS_RESET
  555. 3:
  556. bl trap_reloc
  557. addi r7, r7, 0x100 /* next exception vector */
  558. cmplw 0, r7, r8
  559. blt 3b
  560. li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
  561. li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
  562. 4:
  563. bl trap_reloc
  564. addi r7, r7, 0x100 /* next exception vector */
  565. cmplw 0, r7, r8
  566. blt 4b
  567. mtlr r4 /* restore link register */
  568. blr