blob: f54cd85f9f38ac5f5aff520b769182c8dbe043ec [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
Julius Werner7c6e4892014-01-24 16:23:08 -080030 .text
Ronald G. Minnichb21eaa72013-03-07 15:23:45 -080031
32 .align 6
33 .arm
34 .global exception_table
35exception_table:
36 b 1f
37 b 2f
38 b 3f
39 b 4f
40 b 5f
41 b 6f
42 b 7f
43 b 8f
44
451:
46 ldr sp, _not_used
47 b exception_common
482:
49 ldr sp, _undefined_instruction
50 b exception_common
513:
52 ldr sp, _software_interrupt
53 b exception_common
544:
55 ldr sp, _prefetch_abort
56 b exception_common
575:
58 ldr sp, _data_abort
59 b exception_common
606:
61 ldr sp, _not_used
62 b exception_common
637:
64 ldr sp, _irq
65 b exception_common
668:
67 ldr sp, _fiq
68 b exception_common
69
70exception_common:
71 str sp, exception_handler
72 ldr sp, exception_stack_end
73 push { lr }
Julius Werner985ff362013-09-18 14:39:50 -070074 stmfd sp, { sp, lr }^
Ronald G. Minnichb21eaa72013-03-07 15:23:45 -080075 sub sp, sp, $8
76 push { r0 - r12 }
77 mov r0, sp
78 mov lr, pc
79 ldr pc, exception_handler
80 pop { r0 - r12 }
81 add sp, sp, $8
Julius Werner985ff362013-09-18 14:39:50 -070082 ldmfd sp!, { pc }^
Ronald G. Minnichb21eaa72013-03-07 15:23:45 -080083
84
Julius Werner7c6e4892014-01-24 16:23:08 -080085 .align 2
Ronald G. Minnichb21eaa72013-03-07 15:23:45 -080086_undefined_instruction: .word exception_undefined_instruction
87_software_interrupt: .word exception_software_interrupt
88_prefetch_abort: .word exception_prefetch_abort
89_data_abort: .word exception_data_abort
90_not_used: .word exception_not_used
91_irq: .word exception_irq
92_fiq: .word exception_fiq
93
Julius Werner7c6e4892014-01-24 16:23:08 -080094 .global exception_stack_end
95exception_stack_end:
96 .word 0
97
98exception_handler:
99 .word 0
100
Ronald G. Minnichb21eaa72013-03-07 15:23:45 -0800101 .thumb
102 .global set_vbar
103 .thumb_func
104set_vbar:
105 mcr p15, 0, r0, c12, c0, 0
106 bx lr