From: Magnus Damm <magnus.damm@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/08] ARM: Move entry-header.S to asm/
Date: Wed, 06 Oct 2010 07:17:40 +0000 [thread overview]
Message-ID: <20101006071740.28048.45621.sendpatchset@t400s> (raw)
In-Reply-To: <20101006071731.28048.89938.sendpatchset@t400s>
From: Magnus Damm <damm@opensource.se>
This patch moves the file arch/arm/kernel/entry-header.S
to arch/arm/include/asm/entry-header.S. The reason for
this move is to allow per-mach assembly IRQ demux code.
The #includes in entry-armv.S and entry-common.S are
updated to reflect the new file location. The actual code
logic is untouched by this patch.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/include/asm/entry-header.S | 181 +++++++++++++++++++++++++++++++++++
arch/arm/kernel/entry-armv.S | 3
arch/arm/kernel/entry-common.S | 3
arch/arm/kernel/entry-header.S | 181 -----------------------------------
4 files changed, 183 insertions(+), 185 deletions(-)
--- /dev/null
+++ work/arch/arm/include/asm/entry-header.S 2010-09-16 17:22:01.000000000 +0900
@@ -0,0 +1,181 @@
+#include <linux/init.h>
+#include <linux/linkage.h>
+
+#include <asm/assembler.h>
+#include <asm/asm-offsets.h>
+#include <asm/errno.h>
+#include <asm/thread_info.h>
+
+@ Bad Abort numbers
+@ -----------------
+@
+#define BAD_PREFETCH 0
+#define BAD_DATA 1
+#define BAD_ADDREXCPTN 2
+#define BAD_IRQ 3
+#define BAD_UNDEFINSTR 4
+
+@
+@ Most of the stack format comes from struct pt_regs, but with
+@ the addition of 8 bytes for storing syscall args 5 and 6.
+@ This _must_ remain a multiple of 8 for EABI.
+@
+#define S_OFF 8
+
+/*
+ * The SWI code relies on the fact that R0 is at the bottom of the stack
+ * (due to slow/fast restore user regs).
+ */
+#if S_R0 != 0
+#error "Please fix"
+#endif
+
+ .macro zero_fp
+#ifdef CONFIG_FRAME_POINTER
+ mov fp, #0
+#endif
+ .endm
+
+ .macro alignment_trap, rtemp
+#ifdef CONFIG_ALIGNMENT_TRAP
+ ldr \rtemp, .LCcralign
+ ldr \rtemp, [\rtemp]
+ mcr p15, 0, \rtemp, c1, c0
+#endif
+ .endm
+
+ @
+ @ Store/load the USER SP and LR registers by switching to the SYS
+ @ mode. Useful in Thumb-2 mode where "stm/ldm rd, {sp, lr}^" is not
+ @ available. Should only be called from SVC mode
+ @
+ .macro store_user_sp_lr, rd, rtemp, offset = 0
+ mrs \rtemp, cpsr
+ eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
+ msr cpsr_c, \rtemp @ switch to the SYS mode
+
+ str sp, [\rd, #\offset] @ save sp_usr
+ str lr, [\rd, #\offset + 4] @ save lr_usr
+
+ eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
+ msr cpsr_c, \rtemp @ switch back to the SVC mode
+ .endm
+
+ .macro load_user_sp_lr, rd, rtemp, offset = 0
+ mrs \rtemp, cpsr
+ eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
+ msr cpsr_c, \rtemp @ switch to the SYS mode
+
+ ldr sp, [\rd, #\offset] @ load sp_usr
+ ldr lr, [\rd, #\offset + 4] @ load lr_usr
+
+ eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
+ msr cpsr_c, \rtemp @ switch back to the SVC mode
+ .endm
+
+#ifndef CONFIG_THUMB2_KERNEL
+ .macro svc_exit, rpsr
+ msr spsr_cxsf, \rpsr
+#if defined(CONFIG_CPU_32v6K)
+ clrex @ clear the exclusive monitor
+ ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
+#elif defined (CONFIG_CPU_V6)
+ ldr r0, [sp]
+ strex r1, r2, [sp] @ clear the exclusive monitor
+ ldmib sp, {r1 - pc}^ @ load r1 - pc, cpsr
+#else
+ ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
+#endif
+ .endm
+
+ .macro restore_user_regs, fast = 0, offset = 0
+ ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
+ ldr lr, [sp, #\offset + S_PC]! @ get pc
+ msr spsr_cxsf, r1 @ save in spsr_svc
+#if defined(CONFIG_CPU_32v6K)
+ clrex @ clear the exclusive monitor
+#elif defined (CONFIG_CPU_V6)
+ strex r1, r2, [sp] @ clear the exclusive monitor
+#endif
+ .if \fast
+ ldmdb sp, {r1 - lr}^ @ get calling r1 - lr
+ .else
+ ldmdb sp, {r0 - lr}^ @ get calling r0 - lr
+ .endif
+ mov r0, r0 @ ARMv5T and earlier require a nop
+ @ after ldm {}^
+ add sp, sp, #S_FRAME_SIZE - S_PC
+ movs pc, lr @ return & move spsr_svc into cpsr
+ .endm
+
+ .macro get_thread_info, rd
+ mov \rd, sp, lsr #13
+ mov \rd, \rd, lsl #13
+ .endm
+
+ @
+ @ 32-bit wide "mov pc, reg"
+ @
+ .macro movw_pc, reg
+ mov pc, \reg
+ .endm
+#else /* CONFIG_THUMB2_KERNEL */
+ .macro svc_exit, rpsr
+ clrex @ clear the exclusive monitor
+ ldr r0, [sp, #S_SP] @ top of the stack
+ ldr r1, [sp, #S_PC] @ return address
+ tst r0, #4 @ orig stack 8-byte aligned?
+ stmdb r0, {r1, \rpsr} @ rfe context
+ ldmia sp, {r0 - r12}
+ ldr lr, [sp, #S_LR]
+ addeq sp, sp, #S_FRAME_SIZE - 8 @ aligned
+ addne sp, sp, #S_FRAME_SIZE - 4 @ not aligned
+ rfeia sp!
+ .endm
+
+ .macro restore_user_regs, fast = 0, offset = 0
+ clrex @ clear the exclusive monitor
+ mov r2, sp
+ load_user_sp_lr r2, r3, \offset + S_SP @ calling sp, lr
+ ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
+ ldr lr, [sp, #\offset + S_PC] @ get pc
+ add sp, sp, #\offset + S_SP
+ msr spsr_cxsf, r1 @ save in spsr_svc
+ .if \fast
+ ldmdb sp, {r1 - r12} @ get calling r1 - r12
+ .else
+ ldmdb sp, {r0 - r12} @ get calling r0 - r12
+ .endif
+ add sp, sp, #S_FRAME_SIZE - S_SP
+ movs pc, lr @ return & move spsr_svc into cpsr
+ .endm
+
+ .macro get_thread_info, rd
+ mov \rd, sp
+ lsr \rd, \rd, #13
+ mov \rd, \rd, lsl #13
+ .endm
+
+ @
+ @ 32-bit wide "mov pc, reg"
+ @
+ .macro movw_pc, reg
+ mov pc, \reg
+ nop
+ .endm
+#endif /* !CONFIG_THUMB2_KERNEL */
+
+/*
+ * These are the registers used in the syscall handler, and allow us to
+ * have in theory up to 7 arguments to a function - r0 to r6.
+ *
+ * r7 is reserved for the system call number for thumb mode.
+ *
+ * Note that tbl = why is intentional.
+ *
+ * We must set at least "tsk" and "why" when calling ret_with_reschedule.
+ */
+scno .req r7 @ syscall number
+tbl .req r8 @ syscall table pointer
+why .req r8 @ Linux syscall (!= 0)
+tsk .req r9 @ current thread_info
--- 0001/arch/arm/kernel/entry-armv.S
+++ work/arch/arm/kernel/entry-armv.S 2010-10-05 20:03:00.000000000 +0900
@@ -23,8 +23,7 @@
#include <asm/unwind.h>
#include <asm/unistd.h>
#include <asm/tls.h>
-
-#include "entry-header.S"
+#include <asm/entry-header.S>
/*
* Interrupt handling. Preserves r7, r8, r9
--- 0001/arch/arm/kernel/entry-common.S
+++ work/arch/arm/kernel/entry-common.S 2010-10-05 20:03:14.000000000 +0900
@@ -12,8 +12,7 @@
#include <asm/ftrace.h>
#include <mach/entry-macro.S>
#include <asm/unwind.h>
-
-#include "entry-header.S"
+#include <asm/entry-header.S>
.align 5
--- 0001/arch/arm/kernel/entry-header.S
+++ /dev/null 2010-09-30 18:32:39.608254290 +0900
@@ -1,181 +0,0 @@
-#include <linux/init.h>
-#include <linux/linkage.h>
-
-#include <asm/assembler.h>
-#include <asm/asm-offsets.h>
-#include <asm/errno.h>
-#include <asm/thread_info.h>
-
-@ Bad Abort numbers
-@ -----------------
-@
-#define BAD_PREFETCH 0
-#define BAD_DATA 1
-#define BAD_ADDREXCPTN 2
-#define BAD_IRQ 3
-#define BAD_UNDEFINSTR 4
-
-@
-@ Most of the stack format comes from struct pt_regs, but with
-@ the addition of 8 bytes for storing syscall args 5 and 6.
-@ This _must_ remain a multiple of 8 for EABI.
-@
-#define S_OFF 8
-
-/*
- * The SWI code relies on the fact that R0 is at the bottom of the stack
- * (due to slow/fast restore user regs).
- */
-#if S_R0 != 0
-#error "Please fix"
-#endif
-
- .macro zero_fp
-#ifdef CONFIG_FRAME_POINTER
- mov fp, #0
-#endif
- .endm
-
- .macro alignment_trap, rtemp
-#ifdef CONFIG_ALIGNMENT_TRAP
- ldr \rtemp, .LCcralign
- ldr \rtemp, [\rtemp]
- mcr p15, 0, \rtemp, c1, c0
-#endif
- .endm
-
- @
- @ Store/load the USER SP and LR registers by switching to the SYS
- @ mode. Useful in Thumb-2 mode where "stm/ldm rd, {sp, lr}^" is not
- @ available. Should only be called from SVC mode
- @
- .macro store_user_sp_lr, rd, rtemp, offset = 0
- mrs \rtemp, cpsr
- eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
- msr cpsr_c, \rtemp @ switch to the SYS mode
-
- str sp, [\rd, #\offset] @ save sp_usr
- str lr, [\rd, #\offset + 4] @ save lr_usr
-
- eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
- msr cpsr_c, \rtemp @ switch back to the SVC mode
- .endm
-
- .macro load_user_sp_lr, rd, rtemp, offset = 0
- mrs \rtemp, cpsr
- eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
- msr cpsr_c, \rtemp @ switch to the SYS mode
-
- ldr sp, [\rd, #\offset] @ load sp_usr
- ldr lr, [\rd, #\offset + 4] @ load lr_usr
-
- eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
- msr cpsr_c, \rtemp @ switch back to the SVC mode
- .endm
-
-#ifndef CONFIG_THUMB2_KERNEL
- .macro svc_exit, rpsr
- msr spsr_cxsf, \rpsr
-#if defined(CONFIG_CPU_32v6K)
- clrex @ clear the exclusive monitor
- ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
-#elif defined (CONFIG_CPU_V6)
- ldr r0, [sp]
- strex r1, r2, [sp] @ clear the exclusive monitor
- ldmib sp, {r1 - pc}^ @ load r1 - pc, cpsr
-#else
- ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
-#endif
- .endm
-
- .macro restore_user_regs, fast = 0, offset = 0
- ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
- ldr lr, [sp, #\offset + S_PC]! @ get pc
- msr spsr_cxsf, r1 @ save in spsr_svc
-#if defined(CONFIG_CPU_32v6K)
- clrex @ clear the exclusive monitor
-#elif defined (CONFIG_CPU_V6)
- strex r1, r2, [sp] @ clear the exclusive monitor
-#endif
- .if \fast
- ldmdb sp, {r1 - lr}^ @ get calling r1 - lr
- .else
- ldmdb sp, {r0 - lr}^ @ get calling r0 - lr
- .endif
- mov r0, r0 @ ARMv5T and earlier require a nop
- @ after ldm {}^
- add sp, sp, #S_FRAME_SIZE - S_PC
- movs pc, lr @ return & move spsr_svc into cpsr
- .endm
-
- .macro get_thread_info, rd
- mov \rd, sp, lsr #13
- mov \rd, \rd, lsl #13
- .endm
-
- @
- @ 32-bit wide "mov pc, reg"
- @
- .macro movw_pc, reg
- mov pc, \reg
- .endm
-#else /* CONFIG_THUMB2_KERNEL */
- .macro svc_exit, rpsr
- clrex @ clear the exclusive monitor
- ldr r0, [sp, #S_SP] @ top of the stack
- ldr r1, [sp, #S_PC] @ return address
- tst r0, #4 @ orig stack 8-byte aligned?
- stmdb r0, {r1, \rpsr} @ rfe context
- ldmia sp, {r0 - r12}
- ldr lr, [sp, #S_LR]
- addeq sp, sp, #S_FRAME_SIZE - 8 @ aligned
- addne sp, sp, #S_FRAME_SIZE - 4 @ not aligned
- rfeia sp!
- .endm
-
- .macro restore_user_regs, fast = 0, offset = 0
- clrex @ clear the exclusive monitor
- mov r2, sp
- load_user_sp_lr r2, r3, \offset + S_SP @ calling sp, lr
- ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
- ldr lr, [sp, #\offset + S_PC] @ get pc
- add sp, sp, #\offset + S_SP
- msr spsr_cxsf, r1 @ save in spsr_svc
- .if \fast
- ldmdb sp, {r1 - r12} @ get calling r1 - r12
- .else
- ldmdb sp, {r0 - r12} @ get calling r0 - r12
- .endif
- add sp, sp, #S_FRAME_SIZE - S_SP
- movs pc, lr @ return & move spsr_svc into cpsr
- .endm
-
- .macro get_thread_info, rd
- mov \rd, sp
- lsr \rd, \rd, #13
- mov \rd, \rd, lsl #13
- .endm
-
- @
- @ 32-bit wide "mov pc, reg"
- @
- .macro movw_pc, reg
- mov pc, \reg
- nop
- .endm
-#endif /* !CONFIG_THUMB2_KERNEL */
-
-/*
- * These are the registers used in the syscall handler, and allow us to
- * have in theory up to 7 arguments to a function - r0 to r6.
- *
- * r7 is reserved for the system call number for thumb mode.
- *
- * Note that tbl = why is intentional.
- *
- * We must set at least "tsk" and "why" when calling ret_with_reschedule.
- */
-scno .req r7 @ syscall number
-tbl .req r8 @ syscall table pointer
-why .req r8 @ Linux syscall (!= 0)
-tsk .req r9 @ current thread_info
WARNING: multiple messages have this Message-ID (diff)
From: magnus.damm@gmail.com (Magnus Damm)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/08] ARM: Move entry-header.S to asm/
Date: Wed, 06 Oct 2010 16:17:40 +0900 [thread overview]
Message-ID: <20101006071740.28048.45621.sendpatchset@t400s> (raw)
In-Reply-To: <20101006071731.28048.89938.sendpatchset@t400s>
From: Magnus Damm <damm@opensource.se>
This patch moves the file arch/arm/kernel/entry-header.S
to arch/arm/include/asm/entry-header.S. The reason for
this move is to allow per-mach assembly IRQ demux code.
The #includes in entry-armv.S and entry-common.S are
updated to reflect the new file location. The actual code
logic is untouched by this patch.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/include/asm/entry-header.S | 181 +++++++++++++++++++++++++++++++++++
arch/arm/kernel/entry-armv.S | 3
arch/arm/kernel/entry-common.S | 3
arch/arm/kernel/entry-header.S | 181 -----------------------------------
4 files changed, 183 insertions(+), 185 deletions(-)
--- /dev/null
+++ work/arch/arm/include/asm/entry-header.S 2010-09-16 17:22:01.000000000 +0900
@@ -0,0 +1,181 @@
+#include <linux/init.h>
+#include <linux/linkage.h>
+
+#include <asm/assembler.h>
+#include <asm/asm-offsets.h>
+#include <asm/errno.h>
+#include <asm/thread_info.h>
+
+@ Bad Abort numbers
+@ -----------------
+@
+#define BAD_PREFETCH 0
+#define BAD_DATA 1
+#define BAD_ADDREXCPTN 2
+#define BAD_IRQ 3
+#define BAD_UNDEFINSTR 4
+
+@
+@ Most of the stack format comes from struct pt_regs, but with
+@ the addition of 8 bytes for storing syscall args 5 and 6.
+@ This _must_ remain a multiple of 8 for EABI.
+@
+#define S_OFF 8
+
+/*
+ * The SWI code relies on the fact that R0 is at the bottom of the stack
+ * (due to slow/fast restore user regs).
+ */
+#if S_R0 != 0
+#error "Please fix"
+#endif
+
+ .macro zero_fp
+#ifdef CONFIG_FRAME_POINTER
+ mov fp, #0
+#endif
+ .endm
+
+ .macro alignment_trap, rtemp
+#ifdef CONFIG_ALIGNMENT_TRAP
+ ldr \rtemp, .LCcralign
+ ldr \rtemp, [\rtemp]
+ mcr p15, 0, \rtemp, c1, c0
+#endif
+ .endm
+
+ @
+ @ Store/load the USER SP and LR registers by switching to the SYS
+ @ mode. Useful in Thumb-2 mode where "stm/ldm rd, {sp, lr}^" is not
+ @ available. Should only be called from SVC mode
+ @
+ .macro store_user_sp_lr, rd, rtemp, offset = 0
+ mrs \rtemp, cpsr
+ eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
+ msr cpsr_c, \rtemp @ switch to the SYS mode
+
+ str sp, [\rd, #\offset] @ save sp_usr
+ str lr, [\rd, #\offset + 4] @ save lr_usr
+
+ eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
+ msr cpsr_c, \rtemp @ switch back to the SVC mode
+ .endm
+
+ .macro load_user_sp_lr, rd, rtemp, offset = 0
+ mrs \rtemp, cpsr
+ eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
+ msr cpsr_c, \rtemp @ switch to the SYS mode
+
+ ldr sp, [\rd, #\offset] @ load sp_usr
+ ldr lr, [\rd, #\offset + 4] @ load lr_usr
+
+ eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
+ msr cpsr_c, \rtemp @ switch back to the SVC mode
+ .endm
+
+#ifndef CONFIG_THUMB2_KERNEL
+ .macro svc_exit, rpsr
+ msr spsr_cxsf, \rpsr
+#if defined(CONFIG_CPU_32v6K)
+ clrex @ clear the exclusive monitor
+ ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
+#elif defined (CONFIG_CPU_V6)
+ ldr r0, [sp]
+ strex r1, r2, [sp] @ clear the exclusive monitor
+ ldmib sp, {r1 - pc}^ @ load r1 - pc, cpsr
+#else
+ ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
+#endif
+ .endm
+
+ .macro restore_user_regs, fast = 0, offset = 0
+ ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
+ ldr lr, [sp, #\offset + S_PC]! @ get pc
+ msr spsr_cxsf, r1 @ save in spsr_svc
+#if defined(CONFIG_CPU_32v6K)
+ clrex @ clear the exclusive monitor
+#elif defined (CONFIG_CPU_V6)
+ strex r1, r2, [sp] @ clear the exclusive monitor
+#endif
+ .if \fast
+ ldmdb sp, {r1 - lr}^ @ get calling r1 - lr
+ .else
+ ldmdb sp, {r0 - lr}^ @ get calling r0 - lr
+ .endif
+ mov r0, r0 @ ARMv5T and earlier require a nop
+ @ after ldm {}^
+ add sp, sp, #S_FRAME_SIZE - S_PC
+ movs pc, lr @ return & move spsr_svc into cpsr
+ .endm
+
+ .macro get_thread_info, rd
+ mov \rd, sp, lsr #13
+ mov \rd, \rd, lsl #13
+ .endm
+
+ @
+ @ 32-bit wide "mov pc, reg"
+ @
+ .macro movw_pc, reg
+ mov pc, \reg
+ .endm
+#else /* CONFIG_THUMB2_KERNEL */
+ .macro svc_exit, rpsr
+ clrex @ clear the exclusive monitor
+ ldr r0, [sp, #S_SP] @ top of the stack
+ ldr r1, [sp, #S_PC] @ return address
+ tst r0, #4 @ orig stack 8-byte aligned?
+ stmdb r0, {r1, \rpsr} @ rfe context
+ ldmia sp, {r0 - r12}
+ ldr lr, [sp, #S_LR]
+ addeq sp, sp, #S_FRAME_SIZE - 8 @ aligned
+ addne sp, sp, #S_FRAME_SIZE - 4 @ not aligned
+ rfeia sp!
+ .endm
+
+ .macro restore_user_regs, fast = 0, offset = 0
+ clrex @ clear the exclusive monitor
+ mov r2, sp
+ load_user_sp_lr r2, r3, \offset + S_SP @ calling sp, lr
+ ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
+ ldr lr, [sp, #\offset + S_PC] @ get pc
+ add sp, sp, #\offset + S_SP
+ msr spsr_cxsf, r1 @ save in spsr_svc
+ .if \fast
+ ldmdb sp, {r1 - r12} @ get calling r1 - r12
+ .else
+ ldmdb sp, {r0 - r12} @ get calling r0 - r12
+ .endif
+ add sp, sp, #S_FRAME_SIZE - S_SP
+ movs pc, lr @ return & move spsr_svc into cpsr
+ .endm
+
+ .macro get_thread_info, rd
+ mov \rd, sp
+ lsr \rd, \rd, #13
+ mov \rd, \rd, lsl #13
+ .endm
+
+ @
+ @ 32-bit wide "mov pc, reg"
+ @
+ .macro movw_pc, reg
+ mov pc, \reg
+ nop
+ .endm
+#endif /* !CONFIG_THUMB2_KERNEL */
+
+/*
+ * These are the registers used in the syscall handler, and allow us to
+ * have in theory up to 7 arguments to a function - r0 to r6.
+ *
+ * r7 is reserved for the system call number for thumb mode.
+ *
+ * Note that tbl == why is intentional.
+ *
+ * We must set at least "tsk" and "why" when calling ret_with_reschedule.
+ */
+scno .req r7 @ syscall number
+tbl .req r8 @ syscall table pointer
+why .req r8 @ Linux syscall (!= 0)
+tsk .req r9 @ current thread_info
--- 0001/arch/arm/kernel/entry-armv.S
+++ work/arch/arm/kernel/entry-armv.S 2010-10-05 20:03:00.000000000 +0900
@@ -23,8 +23,7 @@
#include <asm/unwind.h>
#include <asm/unistd.h>
#include <asm/tls.h>
-
-#include "entry-header.S"
+#include <asm/entry-header.S>
/*
* Interrupt handling. Preserves r7, r8, r9
--- 0001/arch/arm/kernel/entry-common.S
+++ work/arch/arm/kernel/entry-common.S 2010-10-05 20:03:14.000000000 +0900
@@ -12,8 +12,7 @@
#include <asm/ftrace.h>
#include <mach/entry-macro.S>
#include <asm/unwind.h>
-
-#include "entry-header.S"
+#include <asm/entry-header.S>
.align 5
--- 0001/arch/arm/kernel/entry-header.S
+++ /dev/null 2010-09-30 18:32:39.608254290 +0900
@@ -1,181 +0,0 @@
-#include <linux/init.h>
-#include <linux/linkage.h>
-
-#include <asm/assembler.h>
-#include <asm/asm-offsets.h>
-#include <asm/errno.h>
-#include <asm/thread_info.h>
-
-@ Bad Abort numbers
-@ -----------------
-@
-#define BAD_PREFETCH 0
-#define BAD_DATA 1
-#define BAD_ADDREXCPTN 2
-#define BAD_IRQ 3
-#define BAD_UNDEFINSTR 4
-
-@
-@ Most of the stack format comes from struct pt_regs, but with
-@ the addition of 8 bytes for storing syscall args 5 and 6.
-@ This _must_ remain a multiple of 8 for EABI.
-@
-#define S_OFF 8
-
-/*
- * The SWI code relies on the fact that R0 is at the bottom of the stack
- * (due to slow/fast restore user regs).
- */
-#if S_R0 != 0
-#error "Please fix"
-#endif
-
- .macro zero_fp
-#ifdef CONFIG_FRAME_POINTER
- mov fp, #0
-#endif
- .endm
-
- .macro alignment_trap, rtemp
-#ifdef CONFIG_ALIGNMENT_TRAP
- ldr \rtemp, .LCcralign
- ldr \rtemp, [\rtemp]
- mcr p15, 0, \rtemp, c1, c0
-#endif
- .endm
-
- @
- @ Store/load the USER SP and LR registers by switching to the SYS
- @ mode. Useful in Thumb-2 mode where "stm/ldm rd, {sp, lr}^" is not
- @ available. Should only be called from SVC mode
- @
- .macro store_user_sp_lr, rd, rtemp, offset = 0
- mrs \rtemp, cpsr
- eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
- msr cpsr_c, \rtemp @ switch to the SYS mode
-
- str sp, [\rd, #\offset] @ save sp_usr
- str lr, [\rd, #\offset + 4] @ save lr_usr
-
- eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
- msr cpsr_c, \rtemp @ switch back to the SVC mode
- .endm
-
- .macro load_user_sp_lr, rd, rtemp, offset = 0
- mrs \rtemp, cpsr
- eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
- msr cpsr_c, \rtemp @ switch to the SYS mode
-
- ldr sp, [\rd, #\offset] @ load sp_usr
- ldr lr, [\rd, #\offset + 4] @ load lr_usr
-
- eor \rtemp, \rtemp, #(SVC_MODE ^ SYSTEM_MODE)
- msr cpsr_c, \rtemp @ switch back to the SVC mode
- .endm
-
-#ifndef CONFIG_THUMB2_KERNEL
- .macro svc_exit, rpsr
- msr spsr_cxsf, \rpsr
-#if defined(CONFIG_CPU_32v6K)
- clrex @ clear the exclusive monitor
- ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
-#elif defined (CONFIG_CPU_V6)
- ldr r0, [sp]
- strex r1, r2, [sp] @ clear the exclusive monitor
- ldmib sp, {r1 - pc}^ @ load r1 - pc, cpsr
-#else
- ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
-#endif
- .endm
-
- .macro restore_user_regs, fast = 0, offset = 0
- ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
- ldr lr, [sp, #\offset + S_PC]! @ get pc
- msr spsr_cxsf, r1 @ save in spsr_svc
-#if defined(CONFIG_CPU_32v6K)
- clrex @ clear the exclusive monitor
-#elif defined (CONFIG_CPU_V6)
- strex r1, r2, [sp] @ clear the exclusive monitor
-#endif
- .if \fast
- ldmdb sp, {r1 - lr}^ @ get calling r1 - lr
- .else
- ldmdb sp, {r0 - lr}^ @ get calling r0 - lr
- .endif
- mov r0, r0 @ ARMv5T and earlier require a nop
- @ after ldm {}^
- add sp, sp, #S_FRAME_SIZE - S_PC
- movs pc, lr @ return & move spsr_svc into cpsr
- .endm
-
- .macro get_thread_info, rd
- mov \rd, sp, lsr #13
- mov \rd, \rd, lsl #13
- .endm
-
- @
- @ 32-bit wide "mov pc, reg"
- @
- .macro movw_pc, reg
- mov pc, \reg
- .endm
-#else /* CONFIG_THUMB2_KERNEL */
- .macro svc_exit, rpsr
- clrex @ clear the exclusive monitor
- ldr r0, [sp, #S_SP] @ top of the stack
- ldr r1, [sp, #S_PC] @ return address
- tst r0, #4 @ orig stack 8-byte aligned?
- stmdb r0, {r1, \rpsr} @ rfe context
- ldmia sp, {r0 - r12}
- ldr lr, [sp, #S_LR]
- addeq sp, sp, #S_FRAME_SIZE - 8 @ aligned
- addne sp, sp, #S_FRAME_SIZE - 4 @ not aligned
- rfeia sp!
- .endm
-
- .macro restore_user_regs, fast = 0, offset = 0
- clrex @ clear the exclusive monitor
- mov r2, sp
- load_user_sp_lr r2, r3, \offset + S_SP @ calling sp, lr
- ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
- ldr lr, [sp, #\offset + S_PC] @ get pc
- add sp, sp, #\offset + S_SP
- msr spsr_cxsf, r1 @ save in spsr_svc
- .if \fast
- ldmdb sp, {r1 - r12} @ get calling r1 - r12
- .else
- ldmdb sp, {r0 - r12} @ get calling r0 - r12
- .endif
- add sp, sp, #S_FRAME_SIZE - S_SP
- movs pc, lr @ return & move spsr_svc into cpsr
- .endm
-
- .macro get_thread_info, rd
- mov \rd, sp
- lsr \rd, \rd, #13
- mov \rd, \rd, lsl #13
- .endm
-
- @
- @ 32-bit wide "mov pc, reg"
- @
- .macro movw_pc, reg
- mov pc, \reg
- nop
- .endm
-#endif /* !CONFIG_THUMB2_KERNEL */
-
-/*
- * These are the registers used in the syscall handler, and allow us to
- * have in theory up to 7 arguments to a function - r0 to r6.
- *
- * r7 is reserved for the system call number for thumb mode.
- *
- * Note that tbl == why is intentional.
- *
- * We must set at least "tsk" and "why" when calling ret_with_reschedule.
- */
-scno .req r7 @ syscall number
-tbl .req r8 @ syscall table pointer
-why .req r8 @ Linux syscall (!= 0)
-tsk .req r9 @ current thread_info
next prev parent reply other threads:[~2010-10-06 7:17 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-06 7:17 [PATCH 00/08] ARM: Dynamic IRQ demux support Magnus Damm
2010-10-06 7:17 ` Magnus Damm
2010-10-06 7:17 ` Magnus Damm [this message]
2010-10-06 7:17 ` [PATCH 01/08] ARM: Move entry-header.S to asm/ Magnus Damm
2010-10-06 7:17 ` [PATCH 02/08] ARM: Move macros from entry-armv.S Magnus Damm
2010-10-06 7:17 ` Magnus Damm
2010-10-06 7:17 ` [PATCH 03/08] ARM: Make alignment_trap macro self-contained Magnus Damm
2010-10-06 7:17 ` Magnus Damm
2010-10-06 7:18 ` [PATCH 04/08] ARM: Convert __irq_svc and __usr_svc to macros Magnus Damm
2010-10-06 7:18 ` Magnus Damm
2010-10-06 7:18 ` [PATCH 05/08] ARM: Move the unwind header to entry-header.S Magnus Damm
2010-10-06 7:18 ` Magnus Damm
2010-10-06 7:18 ` [PATCH 06/08] ARM: Add setup_irq_stubs() function Magnus Damm
2010-10-06 7:18 ` Magnus Damm
2010-10-06 7:18 ` [PATCH 07/08] ARM: Add CONFIG_DEFAULT_IRQ_DEMUX Magnus Damm
2010-10-06 7:18 ` Magnus Damm
2010-10-06 7:18 ` [PATCH 08/08] ARM: Dynamic IRQ demux for SH-Mobile Magnus Damm
2010-10-06 7:18 ` Magnus Damm
2010-10-06 13:06 ` [PATCH 00/08] ARM: Dynamic IRQ demux support Eric Miao
2010-10-06 13:06 ` Eric Miao
2010-10-06 14:58 ` Grant Likely
2010-10-06 14:58 ` Grant Likely
2010-10-06 15:06 ` Eric Miao
2010-10-06 15:06 ` Eric Miao
2010-10-06 15:11 ` Eric Miao
2010-10-06 15:11 ` Eric Miao
2010-10-06 15:26 ` Grant Likely
2010-10-06 15:26 ` Grant Likely
2010-10-06 15:38 ` Eric Miao
2010-10-06 15:38 ` Eric Miao
2010-10-07 6:39 ` Magnus Damm
2010-10-07 6:39 ` Magnus Damm
2010-10-08 7:09 ` Eric Miao
2010-10-08 7:09 ` Eric Miao
2010-10-14 10:50 ` Magnus Damm
2010-10-14 10:50 ` Magnus Damm
2010-10-16 3:53 ` Grant Likely
2010-10-16 3:53 ` Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101006071740.28048.45621.sendpatchset@t400s \
--to=magnus.damm@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.