1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2011 by Amaury Pouly
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
24 .section .vectors,"ax",%progbits
26 /* most handlers are in DRAM which is too far away for a relative jump */
28 ldr pc, =undef_instr_handler
29 ldr pc, =software_int_handler
30 ldr pc, =prefetch_abort_handler
31 ldr pc, =data_abort_handler
32 ldr pc, =reserved_handler
41 msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */
52 /* must be done before bss is zeroed */
62 /* Initialise bss section to zero */
72 /* Set up some stack and munge it with 0xdeadbeef */
81 /* Set up stack for IRQ mode */
85 /* Set up stack for FIQ mode */
89 /* Let abort and undefined modes use IRQ stack */
95 /* Switch back to supervisor mode */
98 /* Disable MMU, disable caching and buffering;
99 * use low exception range address (the core uses high range by default) */
100 mrc p15, 0, r0, c1, c0, 0
103 mcr p15, 0, r0, c1, c0, 0
111 /* All illegal exceptions call into UIE with exception address as first
112 * parameter. This is calculated differently depending on which exception
113 * we're in. Second parameter is exception number, used for a string lookup
116 sub r0, lr, #4 @ r0 points to the faulty ARM instruction
119 tst r1, #(1<<5) @ T bit set ?
120 subne r0, lr, #2 @ if yes, r0 points to the faulty THUMB instruction
121 #endif /* USE_THUMB */
125 /* We run supervisor mode most of the time, and should never see a software
126 * exception being thrown. Perhaps make it illegal and call UIE? */
127 software_int_handler:
131 prefetch_abort_handler:
141 /* 256 words of IRQ stack */
145 /* 256 words of FIQ stack */