blob: 956af0bff3ff5c8e76d8e6d68a88139b6e69f829 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#include <linux/config.h> /* for CONFIG_ARCH_xxxx */
2#include <linux/linkage.h>
3
4#include <asm/assembler.h>
5#include <asm/constants.h>
6#include <asm/errno.h>
7#include <asm/hardware.h>
8#include <asm/arch/irqs.h>
9#include <asm/arch/entry-macro.S>
10
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 .macro zero_fp
12#ifdef CONFIG_FRAME_POINTER
13 mov fp, #0
14#endif
15 .endm
16
17 .text
18
19@ Bad Abort numbers
20@ -----------------
21@
22#define BAD_PREFETCH 0
23#define BAD_DATA 1
24#define BAD_ADDREXCPTN 2
25#define BAD_IRQ 3
26#define BAD_UNDEFINSTR 4
27
Linus Torvalds1da177e2005-04-16 15:20:36 -070028@
Russell King925c8a12005-04-26 15:18:59 +010029@ Most of the stack format comes from struct pt_regs, but with
30@ the addition of 8 bytes for storing syscall args 5 and 6.
Linus Torvalds1da177e2005-04-16 15:20:36 -070031@
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#define S_OFF 8
33
Russell King925c8a12005-04-26 15:18:59 +010034/*
35 * The SWI code relies on the fact that R0 is at the bottom of the stack
36 * (due to slow/fast restore user regs).
37 */
38#if S_R0 != 0
39#error "Please fix"
40#endif
41
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#if __LINUX_ARM_ARCH__ >= 6
Russell King1ec42c02005-04-26 15:18:26 +010043 .macro disable_irq
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 cpsid i
45 .endm
46
Russell King1ec42c02005-04-26 15:18:26 +010047 .macro enable_irq
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 cpsie i
49 .endm
50#else
Russell King1ec42c02005-04-26 15:18:26 +010051 .macro disable_irq
52 msr cpsr_c, #PSR_I_BIT | SVC_MODE
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 .endm
54
Russell King1ec42c02005-04-26 15:18:26 +010055 .macro enable_irq
56 msr cpsr_c, #SVC_MODE
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 .endm
58#endif
59
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 .macro get_thread_info, rd
61 mov \rd, sp, lsr #13
62 mov \rd, \rd, lsl #13
63 .endm
64
65 .macro alignment_trap, rbase, rtemp, sym
66#ifdef CONFIG_ALIGNMENT_TRAP
67#define OFF_CR_ALIGNMENT(x) cr_alignment - x
68
69 ldr \rtemp, [\rbase, #OFF_CR_ALIGNMENT(\sym)]
70 mcr p15, 0, \rtemp, c1, c0
71#endif
72 .endm
73
74
75/*
76 * These are the registers used in the syscall handler, and allow us to
77 * have in theory up to 7 arguments to a function - r0 to r6.
78 *
79 * r7 is reserved for the system call number for thumb mode.
80 *
81 * Note that tbl == why is intentional.
82 *
83 * We must set at least "tsk" and "why" when calling ret_with_reschedule.
84 */
85scno .req r7 @ syscall number
86tbl .req r8 @ syscall table pointer
87why .req r8 @ Linux syscall (!= 0)
88tsk .req r9 @ current thread_info