| Russell King | bce495d | 2005-04-26 15:21:02 +0100 | [diff] [blame] | 1 | #include <linux/config.h> | 
|  | 2 | #include <linux/init.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | #include <linux/linkage.h> | 
|  | 4 |  | 
|  | 5 | #include <asm/assembler.h> | 
|  | 6 | #include <asm/constants.h> | 
|  | 7 | #include <asm/errno.h> | 
| Russell King | bce495d | 2005-04-26 15:21:02 +0100 | [diff] [blame] | 8 | #include <asm/thread_info.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | @ | 
| Russell King | 925c8a1 | 2005-04-26 15:18:59 +0100 | [diff] [blame] | 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. | 
| 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 | #if __LINUX_ARM_ARCH__ >= 6 | 
| Russell King | 1ec42c0 | 2005-04-26 15:18:26 +0100 | [diff] [blame] | 40 | .macro	disable_irq | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | cpsid	i | 
|  | 42 | .endm | 
|  | 43 |  | 
| Russell King | 1ec42c0 | 2005-04-26 15:18:26 +0100 | [diff] [blame] | 44 | .macro	enable_irq | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | cpsie	i | 
|  | 46 | .endm | 
|  | 47 | #else | 
| Russell King | 1ec42c0 | 2005-04-26 15:18:26 +0100 | [diff] [blame] | 48 | .macro	disable_irq | 
|  | 49 | msr	cpsr_c, #PSR_I_BIT | SVC_MODE | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | .endm | 
|  | 51 |  | 
| Russell King | 1ec42c0 | 2005-04-26 15:18:26 +0100 | [diff] [blame] | 52 | .macro	enable_irq | 
|  | 53 | msr	cpsr_c, #SVC_MODE | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | .endm | 
|  | 55 | #endif | 
|  | 56 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | .macro	get_thread_info, rd | 
|  | 58 | mov	\rd, sp, lsr #13 | 
|  | 59 | mov	\rd, \rd, lsl #13 | 
|  | 60 | .endm | 
|  | 61 |  | 
| Russell King | 49f680e | 2005-05-31 18:02:00 +0100 | [diff] [blame] | 62 | .macro	alignment_trap, rtemp | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | #ifdef CONFIG_ALIGNMENT_TRAP | 
| Russell King | 49f680e | 2005-05-31 18:02:00 +0100 | [diff] [blame] | 64 | ldr	\rtemp, .LCcralign | 
|  | 65 | ldr	\rtemp, [\rtemp] | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | mcr	p15, 0, \rtemp, c1, c0 | 
|  | 67 | #endif | 
|  | 68 | .endm | 
|  | 69 |  | 
|  | 70 |  | 
|  | 71 | /* | 
|  | 72 | * These are the registers used in the syscall handler, and allow us to | 
|  | 73 | * have in theory up to 7 arguments to a function - r0 to r6. | 
|  | 74 | * | 
|  | 75 | * r7 is reserved for the system call number for thumb mode. | 
|  | 76 | * | 
|  | 77 | * Note that tbl == why is intentional. | 
|  | 78 | * | 
|  | 79 | * We must set at least "tsk" and "why" when calling ret_with_reschedule. | 
|  | 80 | */ | 
|  | 81 | scno	.req	r7		@ syscall number | 
|  | 82 | tbl	.req	r8		@ syscall table pointer | 
|  | 83 | why	.req	r8		@ Linux syscall (!= 0) | 
|  | 84 | tsk	.req	r9		@ current thread_info |