blob: 12ecc817be3f6b698a3d51b55b7cfaee167e1949 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/kernel/entry-armv.S
3 *
4 * Copyright (C) 1996,1997,1998 Russell King.
5 * ARM700 fix by Matthew Godbolt (linux-user@willothewisp.demon.co.uk)
Hyok S. Choiafeb90c2006-01-13 21:05:25 +00006 * nommu support by Hyok S. Choi (hyok.choi@samsung.com)
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * Low-level vector interface routines
13 *
14 * Note: there is a StrongARM bug in the STMIA rn, {regs}^ instruction that causes
15 * it to save wrong values... Be aware!
16 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
Nicolas Pitref09b9972005-10-29 21:44:55 +010018#include <asm/memory.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <asm/glue.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <asm/vfpmacros.h>
Russell Kingbce495d2005-04-26 15:21:02 +010021#include <asm/arch/entry-macro.S>
Russell Kingd6551e82006-06-21 13:31:52 +010022#include <asm/thread_notify.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
24#include "entry-header.S"
25
26/*
Russell King187a51a2005-05-21 18:14:44 +010027 * Interrupt handling. Preserves r7, r8, r9
28 */
29 .macro irq_handler
Dan Williamsf80dff92007-02-16 22:16:32 +010030 get_irqnr_preamble r5, lr
Russell King187a51a2005-05-21 18:14:44 +0100311: get_irqnr_and_base r0, r6, r5, lr
32 movne r1, sp
33 @
34 @ routine called with r0 = irq number, r1 = struct pt_regs *
35 @
36 adrne lr, 1b
37 bne asm_do_IRQ
Russell King791be9b2005-05-21 18:16:44 +010038
39#ifdef CONFIG_SMP
40 /*
41 * XXX
42 *
43 * this macro assumes that irqstat (r6) and base (r5) are
44 * preserved from get_irqnr_and_base above
45 */
46 test_for_ipi r0, r6, r5, lr
47 movne r0, sp
48 adrne lr, 1b
49 bne do_IPI
Russell King37ee16a2005-11-08 19:08:05 +000050
51#ifdef CONFIG_LOCAL_TIMERS
52 test_for_ltirq r0, r6, r5, lr
53 movne r0, sp
54 adrne lr, 1b
55 bne do_local_timer
56#endif
Russell King791be9b2005-05-21 18:16:44 +010057#endif
58
Russell King187a51a2005-05-21 18:14:44 +010059 .endm
60
61/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 * Invalid mode handlers
63 */
Russell Kingccea7a12005-05-31 22:22:32 +010064 .macro inv_entry, reason
65 sub sp, sp, #S_FRAME_SIZE
66 stmib sp, {r1 - lr}
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 mov r1, #\reason
68 .endm
69
70__pabt_invalid:
Russell Kingccea7a12005-05-31 22:22:32 +010071 inv_entry BAD_PREFETCH
72 b common_invalid
Linus Torvalds1da177e2005-04-16 15:20:36 -070073
74__dabt_invalid:
Russell Kingccea7a12005-05-31 22:22:32 +010075 inv_entry BAD_DATA
76 b common_invalid
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
78__irq_invalid:
Russell Kingccea7a12005-05-31 22:22:32 +010079 inv_entry BAD_IRQ
80 b common_invalid
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
82__und_invalid:
Russell Kingccea7a12005-05-31 22:22:32 +010083 inv_entry BAD_UNDEFINSTR
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
Russell Kingccea7a12005-05-31 22:22:32 +010085 @
86 @ XXX fall through to common_invalid
87 @
88
89@
90@ common_invalid - generic code for failed exception (re-entrant version of handlers)
91@
92common_invalid:
93 zero_fp
94
95 ldmia r0, {r4 - r6}
96 add r0, sp, #S_PC @ here for interlock avoidance
97 mov r7, #-1 @ "" "" "" ""
98 str r4, [sp] @ save preserved r0
99 stmia r0, {r5 - r7} @ lr_<exception>,
100 @ cpsr_<exception>, "old_r0"
101
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102 mov r0, sp
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 b bad_mode
104
105/*
106 * SVC mode handlers
107 */
Nicolas Pitre2dede2d2006-01-14 16:18:08 +0000108
109#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5)
110#define SPFIX(code...) code
111#else
112#define SPFIX(code...)
113#endif
114
Nicolas Pitred30a0c82007-12-14 15:56:01 -0500115 .macro svc_entry, stack_hole=0
116 sub sp, sp, #(S_FRAME_SIZE + \stack_hole)
Nicolas Pitre2dede2d2006-01-14 16:18:08 +0000117 SPFIX( tst sp, #4 )
118 SPFIX( bicne sp, sp, #4 )
Russell Kingccea7a12005-05-31 22:22:32 +0100119 stmib sp, {r1 - r12}
120
121 ldmia r0, {r1 - r3}
122 add r5, sp, #S_SP @ here for interlock avoidance
123 mov r4, #-1 @ "" "" "" ""
Nicolas Pitred30a0c82007-12-14 15:56:01 -0500124 add r0, sp, #(S_FRAME_SIZE + \stack_hole)
Nicolas Pitre2dede2d2006-01-14 16:18:08 +0000125 SPFIX( addne r0, r0, #4 )
Russell Kingccea7a12005-05-31 22:22:32 +0100126 str r1, [sp] @ save the "real" r0 copied
127 @ from the exception stack
128
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 mov r1, lr
130
131 @
132 @ We are now ready to fill in the remaining blanks on the stack:
133 @
134 @ r0 - sp_svc
135 @ r1 - lr_svc
136 @ r2 - lr_<exception>, already fixed up for correct return/restart
137 @ r3 - spsr_<exception>
138 @ r4 - orig_r0 (see pt_regs definition in ptrace.h)
139 @
140 stmia r5, {r0 - r4}
141 .endm
142
143 .align 5
144__dabt_svc:
Russell Kingccea7a12005-05-31 22:22:32 +0100145 svc_entry
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
147 @
148 @ get ready to re-enable interrupts if appropriate
149 @
150 mrs r9, cpsr
151 tst r3, #PSR_I_BIT
152 biceq r9, r9, #PSR_I_BIT
153
154 @
155 @ Call the processor-specific abort handler:
156 @
157 @ r2 - aborted context pc
158 @ r3 - aborted context cpsr
159 @
160 @ The abort handler must return the aborted address in r0, and
161 @ the fault status register in r1. r9 must be preserved.
162 @
163#ifdef MULTI_ABORT
164 ldr r4, .LCprocfns
165 mov lr, pc
166 ldr pc, [r4]
167#else
168 bl CPU_ABORT_HANDLER
169#endif
170
171 @
172 @ set desired IRQ state, then call main handler
173 @
174 msr cpsr_c, r9
175 mov r2, sp
176 bl do_DataAbort
177
178 @
179 @ IRQs off again before pulling preserved data off the stack
180 @
Russell King1ec42c02005-04-26 15:18:26 +0100181 disable_irq
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182
183 @
184 @ restore SPSR and restart the instruction
185 @
186 ldr r0, [sp, #S_PSR]
187 msr spsr_cxsf, r0
188 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
189
190 .align 5
191__irq_svc:
Russell Kingccea7a12005-05-31 22:22:32 +0100192 svc_entry
193
Russell King7ad1bcb2006-08-27 12:07:02 +0100194#ifdef CONFIG_TRACE_IRQFLAGS
195 bl trace_hardirqs_off
196#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197#ifdef CONFIG_PREEMPT
Russell King706fdd92005-05-21 18:15:45 +0100198 get_thread_info tsk
199 ldr r8, [tsk, #TI_PREEMPT] @ get preempt count
200 add r7, r8, #1 @ increment it
201 str r7, [tsk, #TI_PREEMPT]
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202#endif
Russell Kingccea7a12005-05-31 22:22:32 +0100203
Russell King187a51a2005-05-21 18:14:44 +0100204 irq_handler
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205#ifdef CONFIG_PREEMPT
Russell King706fdd92005-05-21 18:15:45 +0100206 ldr r0, [tsk, #TI_FLAGS] @ get flags
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 tst r0, #_TIF_NEED_RESCHED
208 blne svc_preempt
209preempt_return:
Russell King706fdd92005-05-21 18:15:45 +0100210 ldr r0, [tsk, #TI_PREEMPT] @ read preempt value
211 str r8, [tsk, #TI_PREEMPT] @ restore preempt count
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 teq r0, r7
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213 strne r0, [r0, -r0] @ bug()
214#endif
215 ldr r0, [sp, #S_PSR] @ irqs are already disabled
216 msr spsr_cxsf, r0
Russell King7ad1bcb2006-08-27 12:07:02 +0100217#ifdef CONFIG_TRACE_IRQFLAGS
218 tst r0, #PSR_I_BIT
219 bleq trace_hardirqs_on
220#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
222
223 .ltorg
224
225#ifdef CONFIG_PREEMPT
226svc_preempt:
Russell King706fdd92005-05-21 18:15:45 +0100227 teq r8, #0 @ was preempt count = 0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 ldreq r6, .LCirq_stat
229 movne pc, lr @ no
230 ldr r0, [r6, #4] @ local_irq_count
231 ldr r1, [r6, #8] @ local_bh_count
232 adds r0, r0, r1
233 movne pc, lr
234 mov r7, #0 @ preempt_schedule_irq
Russell King706fdd92005-05-21 18:15:45 +0100235 str r7, [tsk, #TI_PREEMPT] @ expects preempt_count == 0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002361: bl preempt_schedule_irq @ irq en/disable is done inside
Russell King706fdd92005-05-21 18:15:45 +0100237 ldr r0, [tsk, #TI_FLAGS] @ get new tasks TI_FLAGS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 tst r0, #_TIF_NEED_RESCHED
239 beq preempt_return @ go again
240 b 1b
241#endif
242
243 .align 5
244__und_svc:
Nicolas Pitred30a0c82007-12-14 15:56:01 -0500245#ifdef CONFIG_KPROBES
246 @ If a kprobe is about to simulate a "stmdb sp..." instruction,
247 @ it obviously needs free stack space which then will belong to
248 @ the saved context.
249 svc_entry 64
250#else
Russell Kingccea7a12005-05-31 22:22:32 +0100251 svc_entry
Nicolas Pitred30a0c82007-12-14 15:56:01 -0500252#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253
254 @
255 @ call emulation code, which returns using r9 if it has emulated
256 @ the instruction, or the more conventional lr if we are to treat
257 @ this as a real undefined instruction
258 @
259 @ r0 - instruction
260 @
261 ldr r0, [r2, #-4]
262 adr r9, 1f
263 bl call_fpe
264
265 mov r0, sp @ struct pt_regs *regs
266 bl do_undefinstr
267
268 @
269 @ IRQs off again before pulling preserved data off the stack
270 @
Russell King1ec42c02005-04-26 15:18:26 +01002711: disable_irq
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272
273 @
274 @ restore SPSR and restart the instruction
275 @
276 ldr lr, [sp, #S_PSR] @ Get SVC cpsr
277 msr spsr_cxsf, lr
278 ldmia sp, {r0 - pc}^ @ Restore SVC registers
279
280 .align 5
281__pabt_svc:
Russell Kingccea7a12005-05-31 22:22:32 +0100282 svc_entry
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283
284 @
285 @ re-enable interrupts if appropriate
286 @
287 mrs r9, cpsr
288 tst r3, #PSR_I_BIT
289 biceq r9, r9, #PSR_I_BIT
290 msr cpsr_c, r9
291
292 @
293 @ set args, then call main handler
294 @
295 @ r0 - address of faulting instruction
296 @ r1 - pointer to registers on stack
297 @
298 mov r0, r2 @ address (pc)
299 mov r1, sp @ regs
300 bl do_PrefetchAbort @ call abort handler
301
302 @
303 @ IRQs off again before pulling preserved data off the stack
304 @
Russell King1ec42c02005-04-26 15:18:26 +0100305 disable_irq
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306
307 @
308 @ restore SPSR and restart the instruction
309 @
310 ldr r0, [sp, #S_PSR]
311 msr spsr_cxsf, r0
312 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
313
314 .align 5
Russell King49f680e2005-05-31 18:02:00 +0100315.LCcralign:
316 .word cr_alignment
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317#ifdef MULTI_ABORT
318.LCprocfns:
319 .word processor
320#endif
321.LCfp:
322 .word fp_enter
323#ifdef CONFIG_PREEMPT
324.LCirq_stat:
325 .word irq_stat
326#endif
327
328/*
329 * User mode handlers
Nicolas Pitre2dede2d2006-01-14 16:18:08 +0000330 *
331 * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332 */
Nicolas Pitre2dede2d2006-01-14 16:18:08 +0000333
334#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5) && (S_FRAME_SIZE & 7)
335#error "sizeof(struct pt_regs) must be a multiple of 8"
336#endif
337
Russell Kingccea7a12005-05-31 22:22:32 +0100338 .macro usr_entry
339 sub sp, sp, #S_FRAME_SIZE
340 stmib sp, {r1 - r12}
341
342 ldmia r0, {r1 - r3}
343 add r0, sp, #S_PC @ here for interlock avoidance
344 mov r4, #-1 @ "" "" "" ""
345
346 str r1, [sp] @ save the "real" r0 copied
347 @ from the exception stack
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348
349 @
350 @ We are now ready to fill in the remaining blanks on the stack:
351 @
352 @ r2 - lr_<exception>, already fixed up for correct return/restart
353 @ r3 - spsr_<exception>
354 @ r4 - orig_r0 (see pt_regs definition in ptrace.h)
355 @
356 @ Also, separately save sp_usr and lr_usr
357 @
Russell Kingccea7a12005-05-31 22:22:32 +0100358 stmia r0, {r2 - r4}
359 stmdb r0, {sp, lr}^
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360
361 @
362 @ Enable the alignment trap while in kernel mode
363 @
Russell King49f680e2005-05-31 18:02:00 +0100364 alignment_trap r0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365
366 @
367 @ Clear FP to mark the first stack frame
368 @
369 zero_fp
370 .endm
371
Nicolas Pitreb49c0f22007-11-20 17:20:29 +0100372 .macro kuser_cmpxchg_check
373#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
374#ifndef CONFIG_MMU
375#warning "NPTL on non MMU needs fixing"
376#else
377 @ Make sure our user space atomic helper is restarted
378 @ if it was interrupted in a critical region. Here we
379 @ perform a quick test inline since it should be false
380 @ 99.9999% of the time. The rest is done out of line.
381 cmp r2, #TASK_SIZE
382 blhs kuser_cmpxchg_fixup
383#endif
384#endif
385 .endm
386
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387 .align 5
388__dabt_usr:
Russell Kingccea7a12005-05-31 22:22:32 +0100389 usr_entry
Nicolas Pitreb49c0f22007-11-20 17:20:29 +0100390 kuser_cmpxchg_check
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391
392 @
393 @ Call the processor-specific abort handler:
394 @
395 @ r2 - aborted context pc
396 @ r3 - aborted context cpsr
397 @
398 @ The abort handler must return the aborted address in r0, and
399 @ the fault status register in r1.
400 @
401#ifdef MULTI_ABORT
402 ldr r4, .LCprocfns
403 mov lr, pc
404 ldr pc, [r4]
405#else
406 bl CPU_ABORT_HANDLER
407#endif
408
409 @
410 @ IRQs on, then call the main handler
411 @
Russell King1ec42c02005-04-26 15:18:26 +0100412 enable_irq
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 mov r2, sp
414 adr lr, ret_from_exception
415 b do_DataAbort
416
417 .align 5
418__irq_usr:
Russell Kingccea7a12005-05-31 22:22:32 +0100419 usr_entry
Nicolas Pitreb49c0f22007-11-20 17:20:29 +0100420 kuser_cmpxchg_check
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421
Russell King7ad1bcb2006-08-27 12:07:02 +0100422#ifdef CONFIG_TRACE_IRQFLAGS
423 bl trace_hardirqs_off
424#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700425 get_thread_info tsk
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426#ifdef CONFIG_PREEMPT
Russell King706fdd92005-05-21 18:15:45 +0100427 ldr r8, [tsk, #TI_PREEMPT] @ get preempt count
428 add r7, r8, #1 @ increment it
429 str r7, [tsk, #TI_PREEMPT]
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430#endif
Russell Kingccea7a12005-05-31 22:22:32 +0100431
Russell King187a51a2005-05-21 18:14:44 +0100432 irq_handler
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433#ifdef CONFIG_PREEMPT
Russell King706fdd92005-05-21 18:15:45 +0100434 ldr r0, [tsk, #TI_PREEMPT]
435 str r8, [tsk, #TI_PREEMPT]
Linus Torvalds1da177e2005-04-16 15:20:36 -0700436 teq r0, r7
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 strne r0, [r0, -r0]
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438#endif
Russell King7ad1bcb2006-08-27 12:07:02 +0100439#ifdef CONFIG_TRACE_IRQFLAGS
440 bl trace_hardirqs_on
441#endif
Russell Kingccea7a12005-05-31 22:22:32 +0100442
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443 mov why, #0
444 b ret_to_user
445
446 .ltorg
447
448 .align 5
449__und_usr:
Russell Kingccea7a12005-05-31 22:22:32 +0100450 usr_entry
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451
452 tst r3, #PSR_T_BIT @ Thumb mode?
Russell Kingdb6ccbb2007-01-06 22:53:48 +0000453 bne __und_usr_unknown @ ignore FP
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 sub r4, r2, #4
455
456 @
457 @ fall through to the emulation code, which returns using r9 if
458 @ it has emulated the instruction, or the more conventional lr
459 @ if we are to treat this as a real undefined instruction
460 @
461 @ r0 - instruction
462 @
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463 adr r9, ret_from_exception
Russell Kingdb6ccbb2007-01-06 22:53:48 +0000464 adr lr, __und_usr_unknown
Nicolas Pitred28a1702007-11-23 22:38:54 +01004651: ldrt r0, [r4]
Linus Torvalds1da177e2005-04-16 15:20:36 -0700466 @
467 @ fallthrough to call_fpe
468 @
469
470/*
471 * The out of line fixup for the ldrt above.
472 */
473 .section .fixup, "ax"
4742: mov pc, r9
475 .previous
476 .section __ex_table,"a"
477 .long 1b, 2b
478 .previous
479
480/*
481 * Check whether the instruction is a co-processor instruction.
482 * If yes, we need to call the relevant co-processor handler.
483 *
484 * Note that we don't do a full check here for the co-processor
485 * instructions; all instructions with bit 27 set are well
486 * defined. The only instructions that should fault are the
487 * co-processor instructions. However, we have to watch out
488 * for the ARM6/ARM7 SWI bug.
489 *
490 * Emulators may wish to make use of the following registers:
491 * r0 = instruction opcode.
492 * r2 = PC+4
Russell Kingdb6ccbb2007-01-06 22:53:48 +0000493 * r9 = normal "successful" return address
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494 * r10 = this threads thread_info structure.
Russell Kingdb6ccbb2007-01-06 22:53:48 +0000495 * lr = unrecognised instruction return address
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496 */
497call_fpe:
498 tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27
499#if defined(CONFIG_CPU_ARM610) || defined(CONFIG_CPU_ARM710)
500 and r8, r0, #0x0f000000 @ mask out op-code bits
501 teqne r8, #0x0f000000 @ SWI (ARM6/7 bug)?
502#endif
503 moveq pc, lr
504 get_thread_info r10 @ get current thread
505 and r8, r0, #0x00000f00 @ mask out CP number
506 mov r7, #1
507 add r6, r10, #TI_USED_CP
508 strb r7, [r6, r8, lsr #8] @ set appropriate used_cp[]
509#ifdef CONFIG_IWMMXT
510 @ Test if we need to give access to iWMMXt coprocessors
511 ldr r5, [r10, #TI_FLAGS]
512 rsbs r7, r8, #(1 << 8) @ CP 0 or 1 only
513 movcss r7, r5, lsr #(TIF_USING_IWMMXT + 1)
514 bcs iwmmxt_task_enable
515#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516 add pc, pc, r8, lsr #6
517 mov r0, r0
518
519 mov pc, lr @ CP#0
520 b do_fpe @ CP#1 (FPE)
521 b do_fpe @ CP#2 (FPE)
522 mov pc, lr @ CP#3
Lennert Buytenhekc17fad12006-06-27 23:03:03 +0100523#ifdef CONFIG_CRUNCH
524 b crunch_task_enable @ CP#4 (MaverickCrunch)
525 b crunch_task_enable @ CP#5 (MaverickCrunch)
526 b crunch_task_enable @ CP#6 (MaverickCrunch)
527#else
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528 mov pc, lr @ CP#4
529 mov pc, lr @ CP#5
530 mov pc, lr @ CP#6
Lennert Buytenhekc17fad12006-06-27 23:03:03 +0100531#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700532 mov pc, lr @ CP#7
533 mov pc, lr @ CP#8
534 mov pc, lr @ CP#9
535#ifdef CONFIG_VFP
536 b do_vfp @ CP#10 (VFP)
537 b do_vfp @ CP#11 (VFP)
538#else
539 mov pc, lr @ CP#10 (VFP)
540 mov pc, lr @ CP#11 (VFP)
541#endif
542 mov pc, lr @ CP#12
543 mov pc, lr @ CP#13
544 mov pc, lr @ CP#14 (Debug)
545 mov pc, lr @ CP#15 (Control)
546
547do_fpe:
Russell King5d25ac02006-03-15 12:33:43 +0000548 enable_irq
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549 ldr r4, .LCfp
550 add r10, r10, #TI_FPSTATE @ r10 = workspace
551 ldr pc, [r4] @ Call FP module USR entry point
552
553/*
554 * The FP module is called with these registers set:
555 * r0 = instruction
556 * r2 = PC+4
557 * r9 = normal "successful" return address
558 * r10 = FP workspace
559 * lr = unrecognised FP instruction return address
560 */
561
562 .data
563ENTRY(fp_enter)
Russell Kingdb6ccbb2007-01-06 22:53:48 +0000564 .word no_fp
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 .text
566
Russell Kingdb6ccbb2007-01-06 22:53:48 +0000567no_fp: mov pc, lr
568
569__und_usr_unknown:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570 mov r0, sp
571 adr lr, ret_from_exception
572 b do_undefinstr
573
574 .align 5
575__pabt_usr:
Russell Kingccea7a12005-05-31 22:22:32 +0100576 usr_entry
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577
Russell King1ec42c02005-04-26 15:18:26 +0100578 enable_irq @ Enable interrupts
Linus Torvalds1da177e2005-04-16 15:20:36 -0700579 mov r0, r2 @ address (pc)
580 mov r1, sp @ regs
581 bl do_PrefetchAbort @ call abort handler
582 /* fall through */
583/*
584 * This is the return code to user mode for abort handlers
585 */
586ENTRY(ret_from_exception)
587 get_thread_info tsk
588 mov why, #0
589 b ret_to_user
590
591/*
592 * Register switch for ARMv3 and ARMv4 processors
593 * r0 = previous task_struct, r1 = previous thread_info, r2 = next thread_info
594 * previous and next are guaranteed not to be the same.
595 */
596ENTRY(__switch_to)
597 add ip, r1, #TI_CPU_SAVE
598 ldr r3, [r2, #TI_TP_VALUE]
599 stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack
Russell Kingd6551e82006-06-21 13:31:52 +0100600#ifdef CONFIG_MMU
601 ldr r6, [r2, #TI_CPU_DOMAIN]
Hyok S. Choiafeb90c2006-01-13 21:05:25 +0000602#endif
Russell Kingb8763862005-08-10 14:52:52 +0100603#if __LINUX_ARM_ARCH__ >= 6
Russell King43cc1982006-02-22 21:13:28 +0000604#ifdef CONFIG_CPU_32v6K
Russell Kingb8763862005-08-10 14:52:52 +0100605 clrex
606#else
Russell King73394322005-09-23 21:49:58 +0100607 strex r5, r4, [ip] @ Clear exclusive monitor
Russell Kingb8763862005-08-10 14:52:52 +0100608#endif
609#endif
Nicolas Pitre4b0e07a2005-05-05 23:24:45 +0100610#if defined(CONFIG_HAS_TLS_REG)
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100611 mcr p15, 0, r3, c13, c0, 3 @ set TLS register
Nicolas Pitre4b0e07a2005-05-05 23:24:45 +0100612#elif !defined(CONFIG_TLS_REG_EMUL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613 mov r4, #0xffff0fff
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100614 str r3, [r4, #-15] @ TLS val at 0xffff0ff0
615#endif
Hyok S. Choiafeb90c2006-01-13 21:05:25 +0000616#ifdef CONFIG_MMU
Linus Torvalds1da177e2005-04-16 15:20:36 -0700617 mcr p15, 0, r6, c3, c0, 0 @ Set domain register
Hyok S. Choiafeb90c2006-01-13 21:05:25 +0000618#endif
Russell Kingd6551e82006-06-21 13:31:52 +0100619 mov r5, r0
620 add r4, r2, #TI_CPU_SAVE
621 ldr r0, =thread_notify_head
622 mov r1, #THREAD_NOTIFY_SWITCH
623 bl atomic_notifier_call_chain
624 mov r0, r5
625 ldmia r4, {r4 - sl, fp, sp, pc} @ Load all regs saved previously
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626
627 __INIT
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100628
629/*
630 * User helpers.
631 *
632 * These are segment of kernel provided user code reachable from user space
633 * at a fixed address in kernel memory. This is used to provide user space
634 * with some operations which require kernel help because of unimplemented
635 * native feature and/or instructions in many ARM CPUs. The idea is for
636 * this code to be executed directly in user mode for best efficiency but
637 * which is too intimate with the kernel counter part to be left to user
638 * libraries. In fact this code might even differ from one CPU to another
639 * depending on the available instruction set and restrictions like on
640 * SMP systems. In other words, the kernel reserves the right to change
641 * this code as needed without warning. Only the entry points and their
642 * results are guaranteed to be stable.
643 *
644 * Each segment is 32-byte aligned and will be moved to the top of the high
645 * vector page. New segments (if ever needed) must be added in front of
646 * existing ones. This mechanism should be used only for things that are
647 * really small and justified, and not be abused freely.
648 *
649 * User space is expected to implement those things inline when optimizing
650 * for a processor that has the necessary native support, but only if such
651 * resulting binaries are already to be incompatible with earlier ARM
652 * processors due to the use of unsupported instructions other than what
653 * is provided here. In other words don't make binaries unable to run on
654 * earlier processors just for the sake of not using these kernel helpers
655 * if your compiled code is not going to use the new instructions for other
656 * purpose.
657 */
658
Nicolas Pitreba9b5d72006-08-18 17:20:15 +0100659 .macro usr_ret, reg
660#ifdef CONFIG_ARM_THUMB
661 bx \reg
662#else
663 mov pc, \reg
664#endif
665 .endm
666
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100667 .align 5
668 .globl __kuser_helper_start
669__kuser_helper_start:
670
671/*
672 * Reference prototype:
673 *
Nicolas Pitre7c612bf2005-12-19 22:20:51 +0000674 * void __kernel_memory_barrier(void)
675 *
676 * Input:
677 *
678 * lr = return address
679 *
680 * Output:
681 *
682 * none
683 *
684 * Clobbered:
685 *
Nicolas Pitreb49c0f22007-11-20 17:20:29 +0100686 * none
Nicolas Pitre7c612bf2005-12-19 22:20:51 +0000687 *
688 * Definition and user space usage example:
689 *
690 * typedef void (__kernel_dmb_t)(void);
691 * #define __kernel_dmb (*(__kernel_dmb_t *)0xffff0fa0)
692 *
693 * Apply any needed memory barrier to preserve consistency with data modified
694 * manually and __kuser_cmpxchg usage.
695 *
696 * This could be used as follows:
697 *
698 * #define __kernel_dmb() \
699 * asm volatile ( "mov r0, #0xffff0fff; mov lr, pc; sub pc, r0, #95" \
Paul Brook6896eec2006-03-28 22:19:29 +0100700 * : : : "r0", "lr","cc" )
Nicolas Pitre7c612bf2005-12-19 22:20:51 +0000701 */
702
703__kuser_memory_barrier: @ 0xffff0fa0
704
705#if __LINUX_ARM_ARCH__ >= 6 && defined(CONFIG_SMP)
706 mcr p15, 0, r0, c7, c10, 5 @ dmb
707#endif
Nicolas Pitreba9b5d72006-08-18 17:20:15 +0100708 usr_ret lr
Nicolas Pitre7c612bf2005-12-19 22:20:51 +0000709
710 .align 5
711
712/*
713 * Reference prototype:
714 *
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100715 * int __kernel_cmpxchg(int oldval, int newval, int *ptr)
716 *
717 * Input:
718 *
719 * r0 = oldval
720 * r1 = newval
721 * r2 = ptr
722 * lr = return address
723 *
724 * Output:
725 *
726 * r0 = returned value (zero or non-zero)
727 * C flag = set if r0 == 0, clear if r0 != 0
728 *
729 * Clobbered:
730 *
731 * r3, ip, flags
732 *
733 * Definition and user space usage example:
734 *
735 * typedef int (__kernel_cmpxchg_t)(int oldval, int newval, int *ptr);
736 * #define __kernel_cmpxchg (*(__kernel_cmpxchg_t *)0xffff0fc0)
737 *
738 * Atomically store newval in *ptr if *ptr is equal to oldval for user space.
739 * Return zero if *ptr was changed or non-zero if no exchange happened.
740 * The C flag is also set if *ptr was changed to allow for assembly
741 * optimization in the calling code.
742 *
Nicolas Pitre5964eae2006-02-08 21:19:37 +0000743 * Notes:
744 *
745 * - This routine already includes memory barriers as needed.
746 *
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100747 * For example, a user space atomic_add implementation could look like this:
748 *
749 * #define atomic_add(ptr, val) \
750 * ({ register unsigned int *__ptr asm("r2") = (ptr); \
751 * register unsigned int __result asm("r1"); \
752 * asm volatile ( \
753 * "1: @ atomic_add\n\t" \
754 * "ldr r0, [r2]\n\t" \
755 * "mov r3, #0xffff0fff\n\t" \
756 * "add lr, pc, #4\n\t" \
757 * "add r1, r0, %2\n\t" \
758 * "add pc, r3, #(0xffff0fc0 - 0xffff0fff)\n\t" \
759 * "bcc 1b" \
760 * : "=&r" (__result) \
761 * : "r" (__ptr), "rIL" (val) \
762 * : "r0","r3","ip","lr","cc","memory" ); \
763 * __result; })
764 */
765
766__kuser_cmpxchg: @ 0xffff0fc0
767
Nicolas Pitredcef1f62005-06-08 19:00:47 +0100768#if defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100769
Nicolas Pitredcef1f62005-06-08 19:00:47 +0100770 /*
771 * Poor you. No fast solution possible...
772 * The kernel itself must perform the operation.
773 * A special ghost syscall is used for that (see traps.c).
774 */
Nicolas Pitre5e097442006-01-18 22:38:49 +0000775 stmfd sp!, {r7, lr}
776 mov r7, #0xff00 @ 0xfff0 into r7 for EABI
777 orr r7, r7, #0xf0
Nicolas Pitredcef1f62005-06-08 19:00:47 +0100778 swi #0x9ffff0
Nicolas Pitre5e097442006-01-18 22:38:49 +0000779 ldmfd sp!, {r7, pc}
Nicolas Pitredcef1f62005-06-08 19:00:47 +0100780
781#elif __LINUX_ARM_ARCH__ < 6
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100782
Nicolas Pitre49bca4c2006-02-08 21:19:37 +0000783#ifdef CONFIG_MMU
Nicolas Pitreb49c0f22007-11-20 17:20:29 +0100784
785 /*
786 * The only thing that can break atomicity in this cmpxchg
787 * implementation is either an IRQ or a data abort exception
788 * causing another process/thread to be scheduled in the middle
789 * of the critical sequence. To prevent this, code is added to
790 * the IRQ and data abort exception handlers to set the pc back
791 * to the beginning of the critical section if it is found to be
792 * within that critical section (see kuser_cmpxchg_fixup).
793 */
7941: ldr r3, [r2] @ load current val
795 subs r3, r3, r0 @ compare with oldval
7962: streq r1, [r2] @ store newval if eq
797 rsbs r0, r3, #0 @ set return val and C flag
798 usr_ret lr
799
800 .text
801kuser_cmpxchg_fixup:
802 @ Called from kuser_cmpxchg_check macro.
803 @ r2 = address of interrupted insn (must be preserved).
804 @ sp = saved regs. r7 and r8 are clobbered.
805 @ 1b = first critical insn, 2b = last critical insn.
806 @ If r2 >= 1b and r2 <= 2b then saved pc_usr is set to 1b.
807 mov r7, #0xffff0fff
808 sub r7, r7, #(0xffff0fff - (0xffff0fc0 + (1b - __kuser_cmpxchg)))
809 subs r8, r2, r7
810 rsbcss r8, r8, #(2b - 1b)
811 strcs r7, [sp, #S_PC]
812 mov pc, lr
813 .previous
814
Nicolas Pitre49bca4c2006-02-08 21:19:37 +0000815#else
816#warning "NPTL on non MMU needs fixing"
817 mov r0, #-1
818 adds r0, r0, #0
Nicolas Pitreba9b5d72006-08-18 17:20:15 +0100819 usr_ret lr
Nicolas Pitreb49c0f22007-11-20 17:20:29 +0100820#endif
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100821
822#else
823
Nicolas Pitre7c612bf2005-12-19 22:20:51 +0000824#ifdef CONFIG_SMP
825 mcr p15, 0, r0, c7, c10, 5 @ dmb
826#endif
Nicolas Pitreb49c0f22007-11-20 17:20:29 +01008271: ldrex r3, [r2]
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100828 subs r3, r3, r0
829 strexeq r3, r1, [r2]
Nicolas Pitreb49c0f22007-11-20 17:20:29 +0100830 teqeq r3, #1
831 beq 1b
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100832 rsbs r0, r3, #0
Nicolas Pitreb49c0f22007-11-20 17:20:29 +0100833 /* beware -- each __kuser slot must be 8 instructions max */
Nicolas Pitre7c612bf2005-12-19 22:20:51 +0000834#ifdef CONFIG_SMP
Nicolas Pitreb49c0f22007-11-20 17:20:29 +0100835 b __kuser_memory_barrier
836#else
Nicolas Pitreba9b5d72006-08-18 17:20:15 +0100837 usr_ret lr
Nicolas Pitreb49c0f22007-11-20 17:20:29 +0100838#endif
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100839
840#endif
841
842 .align 5
843
844/*
845 * Reference prototype:
846 *
847 * int __kernel_get_tls(void)
848 *
849 * Input:
850 *
851 * lr = return address
852 *
853 * Output:
854 *
855 * r0 = TLS value
856 *
857 * Clobbered:
858 *
Nicolas Pitreb49c0f22007-11-20 17:20:29 +0100859 * none
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100860 *
861 * Definition and user space usage example:
862 *
863 * typedef int (__kernel_get_tls_t)(void);
864 * #define __kernel_get_tls (*(__kernel_get_tls_t *)0xffff0fe0)
865 *
866 * Get the TLS value as previously set via the __ARM_NR_set_tls syscall.
867 *
868 * This could be used as follows:
869 *
870 * #define __kernel_get_tls() \
871 * ({ register unsigned int __val asm("r0"); \
872 * asm( "mov r0, #0xffff0fff; mov lr, pc; sub pc, r0, #31" \
873 * : "=r" (__val) : : "lr","cc" ); \
874 * __val; })
875 */
876
877__kuser_get_tls: @ 0xffff0fe0
878
Nicolas Pitre4b0e07a2005-05-05 23:24:45 +0100879#if !defined(CONFIG_HAS_TLS_REG) && !defined(CONFIG_TLS_REG_EMUL)
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100880 ldr r0, [pc, #(16 - 8)] @ TLS stored at 0xffff0ff0
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100881#else
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100882 mrc p15, 0, r0, c13, c0, 3 @ read TLS register
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100883#endif
Nicolas Pitreba9b5d72006-08-18 17:20:15 +0100884 usr_ret lr
Nicolas Pitre2d2669b2005-04-29 22:08:33 +0100885
886 .rep 5
887 .word 0 @ pad up to __kuser_helper_version
888 .endr
889
890/*
891 * Reference declaration:
892 *
893 * extern unsigned int __kernel_helper_version;
894 *
895 * Definition and user space usage example:
896 *
897 * #define __kernel_helper_version (*(unsigned int *)0xffff0ffc)
898 *
899 * User space may read this to determine the curent number of helpers
900 * available.
901 */
902
903__kuser_helper_version: @ 0xffff0ffc
904 .word ((__kuser_helper_end - __kuser_helper_start) >> 5)
905
906 .globl __kuser_helper_end
907__kuser_helper_end:
908
909
Linus Torvalds1da177e2005-04-16 15:20:36 -0700910/*
911 * Vector stubs.
912 *
Russell King79335232005-04-26 15:17:42 +0100913 * This code is copied to 0xffff0200 so we can use branches in the
914 * vectors, rather than ldr's. Note that this code must not
915 * exceed 0x300 bytes.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700916 *
917 * Common stub entry macro:
918 * Enter in IRQ mode, spsr = SVC/USR CPSR, lr = SVC/USR PC
Russell Kingccea7a12005-05-31 22:22:32 +0100919 *
920 * SP points to a minimal amount of processor-private memory, the address
921 * of which is copied into r0 for the mode specific abort handler.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700922 */
Nicolas Pitreb7ec4792005-11-06 14:42:37 +0000923 .macro vector_stub, name, mode, correction=0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700924 .align 5
925
926vector_\name:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700927 .if \correction
928 sub lr, lr, #\correction
929 .endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700930
Russell Kingccea7a12005-05-31 22:22:32 +0100931 @
932 @ Save r0, lr_<exception> (parent PC) and spsr_<exception>
933 @ (parent CPSR)
934 @
935 stmia sp, {r0, lr} @ save r0, lr
936 mrs lr, spsr
937 str lr, [sp, #8] @ save spsr
938
939 @
940 @ Prepare for SVC32 mode. IRQs remain disabled.
941 @
942 mrs r0, cpsr
Nicolas Pitreb7ec4792005-11-06 14:42:37 +0000943 eor r0, r0, #(\mode ^ SVC_MODE)
Russell Kingccea7a12005-05-31 22:22:32 +0100944 msr spsr_cxsf, r0
945
946 @
947 @ the branch table must immediately follow this code
948 @
Russell Kingccea7a12005-05-31 22:22:32 +0100949 and lr, lr, #0x0f
Nicolas Pitreb7ec4792005-11-06 14:42:37 +0000950 mov r0, sp
Linus Torvalds1da177e2005-04-16 15:20:36 -0700951 ldr lr, [pc, lr, lsl #2]
Russell Kingccea7a12005-05-31 22:22:32 +0100952 movs pc, lr @ branch to handler in SVC mode
Linus Torvalds1da177e2005-04-16 15:20:36 -0700953 .endm
954
Russell King79335232005-04-26 15:17:42 +0100955 .globl __stubs_start
Linus Torvalds1da177e2005-04-16 15:20:36 -0700956__stubs_start:
957/*
958 * Interrupt dispatcher
959 */
Nicolas Pitreb7ec4792005-11-06 14:42:37 +0000960 vector_stub irq, IRQ_MODE, 4
Linus Torvalds1da177e2005-04-16 15:20:36 -0700961
962 .long __irq_usr @ 0 (USR_26 / USR_32)
963 .long __irq_invalid @ 1 (FIQ_26 / FIQ_32)
964 .long __irq_invalid @ 2 (IRQ_26 / IRQ_32)
965 .long __irq_svc @ 3 (SVC_26 / SVC_32)
966 .long __irq_invalid @ 4
967 .long __irq_invalid @ 5
968 .long __irq_invalid @ 6
969 .long __irq_invalid @ 7
970 .long __irq_invalid @ 8
971 .long __irq_invalid @ 9
972 .long __irq_invalid @ a
973 .long __irq_invalid @ b
974 .long __irq_invalid @ c
975 .long __irq_invalid @ d
976 .long __irq_invalid @ e
977 .long __irq_invalid @ f
978
979/*
980 * Data abort dispatcher
981 * Enter in ABT mode, spsr = USR CPSR, lr = USR PC
982 */
Nicolas Pitreb7ec4792005-11-06 14:42:37 +0000983 vector_stub dabt, ABT_MODE, 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700984
985 .long __dabt_usr @ 0 (USR_26 / USR_32)
986 .long __dabt_invalid @ 1 (FIQ_26 / FIQ_32)
987 .long __dabt_invalid @ 2 (IRQ_26 / IRQ_32)
988 .long __dabt_svc @ 3 (SVC_26 / SVC_32)
989 .long __dabt_invalid @ 4
990 .long __dabt_invalid @ 5
991 .long __dabt_invalid @ 6
992 .long __dabt_invalid @ 7
993 .long __dabt_invalid @ 8
994 .long __dabt_invalid @ 9
995 .long __dabt_invalid @ a
996 .long __dabt_invalid @ b
997 .long __dabt_invalid @ c
998 .long __dabt_invalid @ d
999 .long __dabt_invalid @ e
1000 .long __dabt_invalid @ f
1001
1002/*
1003 * Prefetch abort dispatcher
1004 * Enter in ABT mode, spsr = USR CPSR, lr = USR PC
1005 */
Nicolas Pitreb7ec4792005-11-06 14:42:37 +00001006 vector_stub pabt, ABT_MODE, 4
Linus Torvalds1da177e2005-04-16 15:20:36 -07001007
1008 .long __pabt_usr @ 0 (USR_26 / USR_32)
1009 .long __pabt_invalid @ 1 (FIQ_26 / FIQ_32)
1010 .long __pabt_invalid @ 2 (IRQ_26 / IRQ_32)
1011 .long __pabt_svc @ 3 (SVC_26 / SVC_32)
1012 .long __pabt_invalid @ 4
1013 .long __pabt_invalid @ 5
1014 .long __pabt_invalid @ 6
1015 .long __pabt_invalid @ 7
1016 .long __pabt_invalid @ 8
1017 .long __pabt_invalid @ 9
1018 .long __pabt_invalid @ a
1019 .long __pabt_invalid @ b
1020 .long __pabt_invalid @ c
1021 .long __pabt_invalid @ d
1022 .long __pabt_invalid @ e
1023 .long __pabt_invalid @ f
1024
1025/*
1026 * Undef instr entry dispatcher
1027 * Enter in UND mode, spsr = SVC/USR CPSR, lr = SVC/USR PC
1028 */
Nicolas Pitreb7ec4792005-11-06 14:42:37 +00001029 vector_stub und, UND_MODE
Linus Torvalds1da177e2005-04-16 15:20:36 -07001030
1031 .long __und_usr @ 0 (USR_26 / USR_32)
1032 .long __und_invalid @ 1 (FIQ_26 / FIQ_32)
1033 .long __und_invalid @ 2 (IRQ_26 / IRQ_32)
1034 .long __und_svc @ 3 (SVC_26 / SVC_32)
1035 .long __und_invalid @ 4
1036 .long __und_invalid @ 5
1037 .long __und_invalid @ 6
1038 .long __und_invalid @ 7
1039 .long __und_invalid @ 8
1040 .long __und_invalid @ 9
1041 .long __und_invalid @ a
1042 .long __und_invalid @ b
1043 .long __und_invalid @ c
1044 .long __und_invalid @ d
1045 .long __und_invalid @ e
1046 .long __und_invalid @ f
1047
1048 .align 5
1049
1050/*=============================================================================
1051 * Undefined FIQs
1052 *-----------------------------------------------------------------------------
1053 * Enter in FIQ mode, spsr = ANY CPSR, lr = ANY PC
1054 * MUST PRESERVE SVC SPSR, but need to switch to SVC mode to show our msg.
1055 * Basically to switch modes, we *HAVE* to clobber one register... brain
1056 * damage alert! I don't think that we can execute any code in here in any
1057 * other mode than FIQ... Ok you can switch to another mode, but you can't
1058 * get out of that mode without clobbering one register.
1059 */
1060vector_fiq:
1061 disable_fiq
1062 subs pc, lr, #4
1063
1064/*=============================================================================
1065 * Address exception handler
1066 *-----------------------------------------------------------------------------
1067 * These aren't too critical.
1068 * (they're not supposed to happen, and won't happen in 32-bit data mode).
1069 */
1070
1071vector_addrexcptn:
1072 b vector_addrexcptn
1073
1074/*
1075 * We group all the following data together to optimise
1076 * for CPUs with separate I & D caches.
1077 */
1078 .align 5
1079
1080.LCvswi:
1081 .word vector_swi
1082
Russell King79335232005-04-26 15:17:42 +01001083 .globl __stubs_end
Linus Torvalds1da177e2005-04-16 15:20:36 -07001084__stubs_end:
1085
Russell King79335232005-04-26 15:17:42 +01001086 .equ stubs_offset, __vectors_start + 0x200 - __stubs_start
Linus Torvalds1da177e2005-04-16 15:20:36 -07001087
Russell King79335232005-04-26 15:17:42 +01001088 .globl __vectors_start
1089__vectors_start:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001090 swi SYS_ERROR0
Russell King79335232005-04-26 15:17:42 +01001091 b vector_und + stubs_offset
1092 ldr pc, .LCvswi + stubs_offset
1093 b vector_pabt + stubs_offset
1094 b vector_dabt + stubs_offset
1095 b vector_addrexcptn + stubs_offset
1096 b vector_irq + stubs_offset
1097 b vector_fiq + stubs_offset
Linus Torvalds1da177e2005-04-16 15:20:36 -07001098
Russell King79335232005-04-26 15:17:42 +01001099 .globl __vectors_end
1100__vectors_end:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001101
1102 .data
1103
Linus Torvalds1da177e2005-04-16 15:20:36 -07001104 .globl cr_alignment
1105 .globl cr_no_alignment
1106cr_alignment:
1107 .space 4
1108cr_no_alignment:
1109 .space 4