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 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version 2
20 * of the License, or (at your option) any later version.
22 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
23 * KIND, either express or implied.
25 ****************************************************************************/
29 .section .init.text,"ax",%progbits
33 msr cpsr, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */
36 /* Copy exception handler code to address 0 */
37 ldr r2, =_vectorsstart
47 /* Disable data and instruction cache, high vectors (at 0xffff0000 instead of 0x00000000) */
48 mrc p15, 0, r0, c1, c0, 0
49 /* clear bits 13, 9:8 (--VI --RS) */
50 bic r0, r0, #0x00003300
51 /* clear bits 7, 2:0 (B--- -C-M) */
52 bic r0, r0, #0x00000085
53 /* make sure bit 2 (A) Align is set */
54 orr r0, r0, #0x00000002
55 mcr p15, 0, r0, c1, c0, 0
78 #endif /* !BOOTLOADER,!STUB */
81 /* Initialise bss section to zero */
90 /* Set up some stack and munge it with 0xdeadbeef */
100 /* Set up stack for IRQ mode */
101 msr cpsr_c, #0xd2 /* IRQ disabled, FIQ enabled */
103 /* Set up stack for FIQ mode */
104 msr cpsr_c, #0xd1 /* IRQ/FIQ disabled */
107 /* Let abort and undefined modes use IRQ stack */
108 msr cpsr_c, #0xd7 /* IRQ/FIQ disabled */
110 msr cpsr_c, #0xdb /* IRQ/FIQ disabled */
113 /* Switch to supervisor mode (no IRQ) */
117 #if defined(BOOTLOADER) && !defined(CREATIVE_ZVx)
118 /* get the high part of our execute address */
122 /* Copy bootloader to safe area - 0x01900000 */
125 sub r0, r6, r5 /* length of loader */
126 add r0, r4, r0 /* r0 points to start of loader */
133 ldr pc, =start_loc /* jump to the relocated start_loc: */
139 /* main() should never return */
141 /* Exception handlers. Will be copied to address 0 after memory remapping */
142 .section .vectors,"aw"
144 b undef_instr_handler
145 b software_int_handler
146 b prefetch_abort_handler
154 /* All illegal exceptions call into UIE with exception address as first
155 parameter. This is calculated differently depending on which exception
156 we're in. Second parameter is exception number, used for a string lookup
164 /* We run supervisor mode most of the time, and should never see a software
165 exception being thrown. Perhaps make it illegal and call UIE?
167 software_int_handler:
171 prefetch_abort_handler:
186 /* Align stacks to cache line boundary */
189 /* 256 words of IRQ stack */
193 /* 256 words of FIQ stack */