3 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@gmail.com)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * Thanks for lk project maintained by Geist for usefully parts of code
23 /* Just make it simplier - EXP create new function accesible from C */
24 #define EXP(f) .global f; f:
26 /* handler for undefined exceptions */
28 stmfd sp!, { r0-r12, r14 }
32 stmia r0, { r1, r13-r14 }^
33 b arm_undefined_handler
36 /* handler for system calls */
38 stmfd sp!, { r0-r12, r14 }
42 stmia r0, { r1, r13-r14 }^
46 /* handler for prefetch abortion */
47 EXP(arm_prefetch_abort)
48 stmfd sp!, { r0-r12, r14 }
52 stmia r0, { r1, r13-r14 }^
53 b arm_prefetch_abort_handler
56 /* handler for data abortion */
58 stmfd sp!, { r0-r12, r14 }
62 stmia r0, { r1, r13-r14 }^
63 b arm_data_abort_handler
66 /* handler for reserved exception */
71 /* save r4-r6 and use as a temporary place to save while we switch into supervisor mode */
77 /* move into supervisor mode. irq/fiq disabled */
78 msr cpsr_c, #(3<<6 | 0x13)
80 /* save the return address */
83 /* save C trashed regs, supervisor lr */
84 stmfd sp!, { r0-r3, r12, lr }
92 /* increment the global critical section count */
93 ldr r1, =arm_critical_section
98 /* call into higher level code */
99 mov r0, sp /* iframe */
102 /* reschedule if the handler returns nonzero */
104 blne arch_task_preempt
106 /* decrement the global critical section count */
107 ldr r1, =arm_critical_section
116 /* restore back to where we came from */
117 ldmfd sp!, { r0-r3, r12, lr, pc }^
123 .global irq_save_spot
132 stmfd sp!, { r0-r3, r12, lr }
136 ldmfd sp!, { r0-r3, r12, pc }^