blob: e46f4bcf6b673c6407d480da7854595631254219 [file] [log] [blame]
Ronald G. Minnichb21eaa72013-03-07 15:23:45 -08001/*
2 * This file is part of the libpayload project.
3 *
4 * Copyright 2013 Google Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30exception_stack:
31 .align 5
32 .skip 0x2000, 0xa5
33exception_stack_end:
34 .word exception_stack_end
35
36exception_handler:
37 .word 0
38
39
40 .align 6
41 .arm
42 .global exception_table
43exception_table:
44 b 1f
45 b 2f
46 b 3f
47 b 4f
48 b 5f
49 b 6f
50 b 7f
51 b 8f
52
531:
54 ldr sp, _not_used
55 b exception_common
562:
57 ldr sp, _undefined_instruction
58 b exception_common
593:
60 ldr sp, _software_interrupt
61 b exception_common
624:
63 ldr sp, _prefetch_abort
64 b exception_common
655:
66 ldr sp, _data_abort
67 b exception_common
686:
69 ldr sp, _not_used
70 b exception_common
717:
72 ldr sp, _irq
73 b exception_common
748:
75 ldr sp, _fiq
76 b exception_common
77
78exception_common:
79 str sp, exception_handler
80 ldr sp, exception_stack_end
81 push { lr }
82 sub sp, sp, $8
83 push { r0 - r12 }
84 mov r0, sp
85 mov lr, pc
86 ldr pc, exception_handler
87 pop { r0 - r12 }
88 add sp, sp, $8
89 ldm sp!, { pc }^
90
91
92_undefined_instruction: .word exception_undefined_instruction
93_software_interrupt: .word exception_software_interrupt
94_prefetch_abort: .word exception_prefetch_abort
95_data_abort: .word exception_data_abort
96_not_used: .word exception_not_used
97_irq: .word exception_irq
98_fiq: .word exception_fiq
99
100 .thumb
101 .global set_vbar
102 .thumb_func
103set_vbar:
104 mcr p15, 0, r0, c12, c0, 0
105 bx lr
106
107 .global exception_test
108 .thumb_func
109exception_test:
110 mov r1, $1
111 mov r0, pc
112 add r0, $3
113 ldr r1, [r1]
114 bx lr
115