Commit | Line | Data |
---|---|---|
bce495d8 RK |
1 | #include <linux/config.h> |
2 | #include <linux/init.h> | |
1da177e4 LT |
3 | #include <linux/linkage.h> |
4 | ||
5 | #include <asm/assembler.h> | |
6 | #include <asm/constants.h> | |
7 | #include <asm/errno.h> | |
bce495d8 | 8 | #include <asm/thread_info.h> |
1da177e4 LT |
9 | |
10 | @ Bad Abort numbers | |
11 | @ ----------------- | |
12 | @ | |
13 | #define BAD_PREFETCH 0 | |
14 | #define BAD_DATA 1 | |
15 | #define BAD_ADDREXCPTN 2 | |
16 | #define BAD_IRQ 3 | |
17 | #define BAD_UNDEFINSTR 4 | |
18 | ||
1da177e4 | 19 | @ |
925c8a1a RK |
20 | @ Most of the stack format comes from struct pt_regs, but with |
21 | @ the addition of 8 bytes for storing syscall args 5 and 6. | |
1da177e4 | 22 | @ |
1da177e4 LT |
23 | #define S_OFF 8 |
24 | ||
925c8a1a RK |
25 | /* |
26 | * The SWI code relies on the fact that R0 is at the bottom of the stack | |
27 | * (due to slow/fast restore user regs). | |
28 | */ | |
29 | #if S_R0 != 0 | |
30 | #error "Please fix" | |
31 | #endif | |
32 | ||
bce495d8 RK |
33 | .macro zero_fp |
34 | #ifdef CONFIG_FRAME_POINTER | |
35 | mov fp, #0 | |
36 | #endif | |
37 | .endm | |
38 | ||
1da177e4 | 39 | #if __LINUX_ARM_ARCH__ >= 6 |
1ec42c0c | 40 | .macro disable_irq |
1da177e4 LT |
41 | cpsid i |
42 | .endm | |
43 | ||
1ec42c0c | 44 | .macro enable_irq |
1da177e4 LT |
45 | cpsie i |
46 | .endm | |
47 | #else | |
1ec42c0c RK |
48 | .macro disable_irq |
49 | msr cpsr_c, #PSR_I_BIT | SVC_MODE | |
1da177e4 LT |
50 | .endm |
51 | ||
1ec42c0c RK |
52 | .macro enable_irq |
53 | msr cpsr_c, #SVC_MODE | |
1da177e4 LT |
54 | .endm |
55 | #endif | |
56 | ||
1da177e4 LT |
57 | .macro get_thread_info, rd |
58 | mov \rd, sp, lsr #13 | |
59 | mov \rd, \rd, lsl #13 | |
60 | .endm | |
61 | ||
62 | .macro alignment_trap, rbase, rtemp, sym | |
63 | #ifdef CONFIG_ALIGNMENT_TRAP | |
64 | #define OFF_CR_ALIGNMENT(x) cr_alignment - x | |
65 | ||
66 | ldr \rtemp, [\rbase, #OFF_CR_ALIGNMENT(\sym)] | |
67 | mcr p15, 0, \rtemp, c1, c0 | |
68 | #endif | |
69 | .endm | |
70 | ||
71 | ||
72 | /* | |
73 | * These are the registers used in the syscall handler, and allow us to | |
74 | * have in theory up to 7 arguments to a function - r0 to r6. | |
75 | * | |
76 | * r7 is reserved for the system call number for thumb mode. | |
77 | * | |
78 | * Note that tbl == why is intentional. | |
79 | * | |
80 | * We must set at least "tsk" and "why" when calling ret_with_reschedule. | |
81 | */ | |
82 | scno .req r7 @ syscall number | |
83 | tbl .req r8 @ syscall table pointer | |
84 | why .req r8 @ Linux syscall (!= 0) | |
85 | tsk .req r9 @ current thread_info |