diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-03-10 10:24:54 +0000 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2009-03-10 10:24:54 +0000 |
commit | 77582cfa8a38fc71d1c46b3296a9f7ba4ad80275 (patch) | |
tree | 5d1e747b8d65aa5198d2203623800632e17685e9 /arch/arm/kernel | |
parent | 1745b660c1511279f83ec45e6404d484ba98e578 (diff) |
Thumb-2: Add IT instructions to the kernel assembly code
With modified GNU assembler, these instructions are automatically
generated. This patch is to be used if such gas isn't available.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/debug.S | 3 | ||||
-rw-r--r-- | arch/arm/kernel/entry-armv.S | 15 | ||||
-rw-r--r-- | arch/arm/kernel/entry-common.S | 10 | ||||
-rw-r--r-- | arch/arm/kernel/entry-header.S | 1 | ||||
-rw-r--r-- | arch/arm/kernel/head-common.S | 2 | ||||
-rw-r--r-- | arch/arm/kernel/head.S | 3 |
6 files changed, 33 insertions, 1 deletions
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S index f53c58290543..e95a5b6657f8 100644 --- a/arch/arm/kernel/debug.S +++ b/arch/arm/kernel/debug.S @@ -105,6 +105,7 @@ printhex: adr r2, hexbuf 1: and r1, r0, #15 mov r0, r0, lsr #4 cmp r1, #10 + ite lt addlt r1, r1, #'0' addge r1, r1, #'a' - 10 strb r1, [r3, #-1]! @@ -123,9 +124,11 @@ ENTRY(printascii) senduart r1, r3 busyuart r2, r3 teq r1, #'\n' + itt eq moveq r1, #'\r' beq 1b 2: teq r0, #0 + itt ne ldrneb r1, [r0], #1 teqne r1, #0 bne 1b diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 3ecaa2e0718c..9970015974f9 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -30,6 +30,7 @@ .macro irq_handler get_irqnr_preamble r5, lr 1: get_irqnr_and_base r0, r6, r5, lr + ittt ne movne r1, sp @ @ routine called with r0 = irq number, r1 = struct pt_regs * @@ -51,12 +52,14 @@ * preserved from get_irqnr_and_base above */ test_for_ipi r0, r6, r5, lr + ittt ne movne r0, sp adrne lr, BSYM(1b) bne do_IPI #ifdef CONFIG_LOCAL_TIMERS test_for_ltirq r0, r6, r5, lr + ittt ne movne r0, sp adrne lr, BSYM(1b) bne do_local_timer @@ -144,6 +147,7 @@ ENDPROC(__und_invalid) #else SPFIX( tst sp, #4 ) #endif + SPFIX( it eq ) SPFIX( subeq sp, sp, #4 ) stmia sp, {r1 - r12} @@ -151,6 +155,7 @@ ENDPROC(__und_invalid) add r5, sp, #S_SP - 4 @ here for interlock avoidance mov r4, #-1 @ "" "" "" "" add r0, sp, #(S_FRAME_SIZE + \stack_hole - 4) + SPFIX( it eq ) SPFIX( addeq r0, r0, #4 ) str r1, [sp, #-4]! @ save the "real" r0 copied @ from the exception stack @@ -178,6 +183,7 @@ __dabt_svc: @ mrs r9, cpsr tst r3, #PSR_I_BIT + it eq biceq r9, r9, #PSR_I_BIT @ @@ -236,8 +242,10 @@ __irq_svc: str r8, [tsk, #TI_PREEMPT] @ restore preempt count ldr r0, [tsk, #TI_FLAGS] @ get flags teq r8, #0 @ if preempt count != 0 + it ne movne r0, #0 @ force flags to 0 tst r0, #_TIF_NEED_RESCHED + it ne blne svc_preempt #endif ldr r2, [sp, #S_PSR] @ irqs are already disabled @@ -257,6 +265,7 @@ svc_preempt: 1: bl preempt_schedule_irq @ irq en/disable is done inside ldr r0, [tsk, #TI_FLAGS] @ get new tasks TI_FLAGS tst r0, #_TIF_NEED_RESCHED + it eq moveq pc, r8 @ go again b 1b #endif @@ -308,6 +317,7 @@ __pabt_svc: @ mrs r9, cpsr tst r3, #PSR_I_BIT + it eq biceq r9, r9, #PSR_I_BIT @ @@ -466,6 +476,7 @@ __irq_usr: ldr r0, [tsk, #TI_PREEMPT] str r8, [tsk, #TI_PREEMPT] teq r0, r7 + itt ne ARM( strne r0, [r0, -r0] ) THUMB( movne r0, #0 ) THUMB( strne r0, [r0] ) @@ -495,9 +506,9 @@ __und_usr: adr r9, BSYM(ret_from_exception) adr lr, BSYM(__und_usr_unknown) tst r3, #PSR_T_BIT @ Thumb mode? + itet eq subeq r4, r2, #4 @ ARM instr at LR - 4 subne r4, r2, #2 @ Thumb instr at LR - 2 - it eq @ explicit IT needed for the label 1: ldreqt r0, [r4] #ifdef CONFIG_CPU_ENDIAN_BE8 rev r0, r0 @ little endian instruction @@ -589,6 +600,7 @@ call_fpe: 1: #endif tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27 + ite ne tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2 #if defined(CONFIG_CPU_ARM610) || defined(CONFIG_CPU_ARM710) and r8, r0, #0x0f000000 @ mask out op-code bits @@ -974,6 +986,7 @@ kuser_cmpxchg_fixup: #endif 1: ldrex r3, [r2] subs r3, r3, r0 + it eq strexeq r3, r1, [r2] teqeq r3, #1 beq 1b diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index dee4cea60aa7..f89b9ca7f010 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -186,6 +186,7 @@ ENTRY(vector_swi) */ #ifdef CONFIG_ARM_THUMB tst r8, #PSR_T_BIT + ite ne movne r10, #0 @ no thumb OABI emulation ldreq r10, [lr, #-4] @ get SWI instruction #else @@ -244,6 +245,7 @@ ENTRY(vector_swi) * get the old ABI syscall table address. */ bics r10, r10, #0xff000000 + itt ne eorne scno, r10, #__NR_OABI_SYSCALL_BASE ldrne tbl, =sys_oabi_call_table #elif !defined(CONFIG_AEABI) @@ -257,6 +259,7 @@ ENTRY(vector_swi) cmp scno, #NR_syscalls @ check upper syscall limit adr lr, BSYM(ret_fast_syscall) @ return address + it cc ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine add r1, sp, #S_OFF @@ -281,6 +284,7 @@ __sys_trace: mov scno, r0 @ syscall number (possibly new) add r1, sp, #S_R0 + S_OFF @ pointer to regs cmp scno, #NR_syscalls @ check upper syscall limit + itt cc ldmccia r1, {r0 - r3} @ have to reload r0 - r3 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine b 2b @@ -326,11 +330,14 @@ ENTRY(sys_call_table) sys_syscall: bic scno, r0, #__NR_OABI_SYSCALL_BASE cmp scno, #__NR_syscall - __NR_SYSCALL_BASE + it ne cmpne scno, #NR_syscalls @ check range + itttt lo stmloia sp, {r5, r6} @ shuffle args movlo r0, r1 movlo r1, r2 movlo r2, r3 + itt lo movlo r3, r4 ldrlo pc, [tbl, scno, lsl #2] b sys_ni_syscall @@ -384,12 +391,14 @@ ENDPROC(sys_sigaltstack_wrapper) sys_statfs64_wrapper: teq r1, #88 + it eq moveq r1, #84 b sys_statfs64 ENDPROC(sys_statfs64_wrapper) sys_fstatfs64_wrapper: teq r1, #88 + it eq moveq r1, #84 b sys_fstatfs64 ENDPROC(sys_fstatfs64_wrapper) @@ -401,6 +410,7 @@ ENDPROC(sys_fstatfs64_wrapper) sys_mmap2: #if PAGE_SHIFT > 12 tst r5, #PGOFF_MASK + ittt eq moveq r5, r5, lsr #PAGE_SHIFT - 12 streq r5, [sp, #4] beq do_mmap2 diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S index 4f1dd91a4e09..84c16d241bf7 100644 --- a/arch/arm/kernel/entry-header.S +++ b/arch/arm/kernel/entry-header.S @@ -104,6 +104,7 @@ stmdb r0, {r1, \rpsr} @ rfe context ldmia sp, {r0 - r12} ldr lr, [sp, #S_LR] + ite eq addeq sp, sp, #S_FRAME_SIZE - 8 @ aligned addne sp, sp, #S_FRAME_SIZE - 4 @ not aligned rfeia sp! diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S index 53c403fa2c6d..81be5d6a933d 100644 --- a/arch/arm/kernel/head-common.S +++ b/arch/arm/kernel/head-common.S @@ -42,6 +42,7 @@ __mmap_switched: ldmia r3!, {r4, r5, r6, r7} cmp r4, r5 @ Copy data segment if needed + itttt ne 1: cmpne r5, r6 ldrne fp, [r4], #4 strne fp, [r5], #4 @@ -49,6 +50,7 @@ __mmap_switched: mov fp, #0 @ Clear BSS (and zero fp) 1: cmp r6, r7 + itt cc strcc fp, [r6],#4 bcc 1b diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 437df3a5ac4d..167bb4ef65ab 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -116,6 +116,7 @@ ENTRY(secondary_startup) mrc p15, 0, r9, c0, c0 @ get processor id bl __lookup_processor_type movs r10, r5 @ invalid processor? + it eq moveq r0, #'p' @ yes, error 'p' beq __error @@ -255,6 +256,7 @@ __create_page_tables: add r6, r4, r6, lsr #18 1: cmp r0, r6 add r3, r3, #1 << 20 + it ls strls r3, [r0], #4 bls 1b @@ -298,6 +300,7 @@ __create_page_tables: add r0, r4, r3 rsb r3, r3, #0x4000 @ PTRS_PER_PGD*sizeof(long) cmp r3, #0x0800 @ limit to 512MB + it hi movhi r3, #0x0800 add r6, r0, r3 ldr r3, [r8, #MACHINFO_PHYSIO] |