1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 * Arm bootloader and startup code based on startup.s from the iPodLinux loader
14 * Copyright (c) 2003, Daniel Palffy (dpalffy (at) rainstorm.org)
15 * Copyright (c) 2005, Bernard Leach <leachbj@bouncycastle.org>
17 * All files in this archive are subject to the GNU General Public License.
18 * See the file COPYING in the source tree root for full license agreement.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ****************************************************************************/
27 .section .init.text,"ax",%progbits
31 .equ INTC_IRQ0, 0x00030508
32 .equ INTC_IRQ1, 0x0003050A
33 .equ INTC_IRQ2, 0x0003050C
34 .equ INTC_FIQ0, 0x00030500
35 .equ INTC_FIQ1, 0x00030502
36 .equ INTC_FIQ2, 0x00030504
37 .equ INTC_EINT0, 0x00030528
38 .equ INTC_EINT1, 0x0003052A
39 .equ INTC_EINT2, 0x0003052C
40 .equ INTC_FISEL0, 0x00030520
41 .equ INTC_FISEL1, 0x00030522
42 .equ INTC_FISEL2, 0x00030524
43 .equ INTC_MASK, 0xFFFFFFFF
45 msr cpsr, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */
47 /* Copy exception handler code to address 0 */
48 ldr r2, =_vectorsstart
57 /* Disable data and instruction cache, high vectors (at 0xffff0000 instead of 0x00000000) */
58 mrc p15, 0, r0, c1, c0, 0
59 /* clear bits 13, 9:8 (--VI --RS) */
60 bic r0, r0, #0x00003300
61 /* clear bits 7, 2:0 (B--- -C-M) */
62 bic r0, r0, #0x00000085
63 /* make sure bit 2 (A) Align is set */
64 orr r0, r0, #0x00000002
65 mcr p15, 0, r0, c1, c0, 0
98 #if !defined(BOOTLOADER) && !defined(STUB)
117 #endif /* !BOOTLOADER,!STUB */
119 /* Initialise bss section to zero */
128 /* Load stack munge value */
131 /* Set up some stack and munge it with 0xdeadbeef */
139 /* Set up stack for IRQ mode */
140 msr cpsr_c, #0x92 /* IRQ disabled, FIQ enabled */
142 /* Set up stack for FIQ mode */
143 msr cpsr_c, #0xd1 /* IRQ/FIQ disabled */
146 /* Let abort and undefined modes use IRQ stack */
147 msr cpsr_c, #0xd7 /* IRQ/FIQ disabled */
149 msr cpsr_c, #0xdb /* IRQ/FIQ disabled */
152 /* Switch to supervisor mode (no IRQ) */
157 /* get the high part of our execute address */
161 /* Copy bootloader to safe area - 0x01900000 */
164 sub r0, r6, r5 /* length of loader */
165 add r0, r4, r0 /* r0 points to start of loader */
172 ldr pc, =start_loc /* jump to the relocated start_loc: */
178 /* main() should never return */
180 /* Exception handlers. Will be copied to address 0 after memory remapping */
181 .section .vectors,"aw"
191 /* Exception vectors */
195 .word undef_instr_handler
196 .word software_int_handler
197 .word prefetch_abort_handler
198 .word data_abort_handler
199 .word reserved_handler
211 /* All illegal exceptions call into UIE with exception address as first
212 parameter. This is calculated differently depending on which exception
213 we're in. Second parameter is exception number, used for a string lookup
221 /* We run supervisor mode most of the time, and should never see a software
222 exception being thrown. Perhaps make it illegal and call UIE?
224 software_int_handler:
228 prefetch_abort_handler:
238 #if defined(STUB) || defined(BOOTLOADER)
243 /* Align stacks to cache line boundary */
246 /* 256 words of IRQ stack */
250 /* 256 words of FIQ stack */