Russell King | bce495d | 2005-04-26 15:21:02 +0100 | [diff] [blame] | 1 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | #include <linux/linkage.h> |
| 3 | |
| 4 | #include <asm/assembler.h> |
Sam Ravnborg | e6ae744 | 2005-09-09 21:08:59 +0200 | [diff] [blame] | 5 | #include <asm/asm-offsets.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | #include <asm/errno.h> |
Russell King | bce495d | 2005-04-26 15:21:02 +0100 | [diff] [blame] | 7 | #include <asm/thread_info.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | |
| 9 | @ Bad Abort numbers |
| 10 | @ ----------------- |
| 11 | @ |
| 12 | #define BAD_PREFETCH 0 |
| 13 | #define BAD_DATA 1 |
| 14 | #define BAD_ADDREXCPTN 2 |
| 15 | #define BAD_IRQ 3 |
| 16 | #define BAD_UNDEFINSTR 4 |
| 17 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | @ |
Russell King | 925c8a1 | 2005-04-26 15:18:59 +0100 | [diff] [blame] | 19 | @ Most of the stack format comes from struct pt_regs, but with |
| 20 | @ the addition of 8 bytes for storing syscall args 5 and 6. |
Nicolas Pitre | 2dede2d | 2006-01-14 16:18:08 +0000 | [diff] [blame] | 21 | @ This _must_ remain a multiple of 8 for EABI. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | @ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #define S_OFF 8 |
| 24 | |
Russell King | 925c8a1 | 2005-04-26 15:18:59 +0100 | [diff] [blame] | 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 | |
Russell King | bce495d | 2005-04-26 15:21:02 +0100 | [diff] [blame] | 33 | .macro zero_fp |
| 34 | #ifdef CONFIG_FRAME_POINTER |
| 35 | mov fp, #0 |
| 36 | #endif |
| 37 | .endm |
| 38 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | .macro get_thread_info, rd |
| 40 | mov \rd, sp, lsr #13 |
| 41 | mov \rd, \rd, lsl #13 |
| 42 | .endm |
| 43 | |
Russell King | 49f680e | 2005-05-31 18:02:00 +0100 | [diff] [blame] | 44 | .macro alignment_trap, rtemp |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #ifdef CONFIG_ALIGNMENT_TRAP |
Russell King | 49f680e | 2005-05-31 18:02:00 +0100 | [diff] [blame] | 46 | ldr \rtemp, .LCcralign |
| 47 | ldr \rtemp, [\rtemp] |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | mcr p15, 0, \rtemp, c1, c0 |
| 49 | #endif |
| 50 | .endm |
| 51 | |
| 52 | |
| 53 | /* |
| 54 | * These are the registers used in the syscall handler, and allow us to |
| 55 | * have in theory up to 7 arguments to a function - r0 to r6. |
| 56 | * |
| 57 | * r7 is reserved for the system call number for thumb mode. |
| 58 | * |
| 59 | * Note that tbl == why is intentional. |
| 60 | * |
| 61 | * We must set at least "tsk" and "why" when calling ret_with_reschedule. |
| 62 | */ |
| 63 | scno .req r7 @ syscall number |
| 64 | tbl .req r8 @ syscall table pointer |
| 65 | why .req r8 @ Linux syscall (!= 0) |
| 66 | tsk .req r9 @ current thread_info |