• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

linux-3.0.x for AP-SH4A-0A Board


コミットメタ情報

リビジョンee49866febeac921a878088c58da1fdc0c0073f6 (tree)
日時2011-08-23 01:29:12
作者Dave Martin <dave.martin@lina...>
コミッターNicolas Pitre

ログメッセージ

ARM: 7031/1: entry: Fix Thumb-2 undef handling for multi-CPU kernels

When v6 and >=v7 boards are supported in the same kernel, the
und_usr code currently makes a build-time assumption that Thumb-2
instructions occurring in userspace don't need to be supported.
Strictly speaking this is incorrect.

This patch fixes the above case by doing a run-time check on the
CPU architecture in these cases. This only affects kernels which
support v6 and >=v7 CPUs together: plain v6 and plain v7 kernels
are unaffected.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
Reviewed-by: Jon Medhurst <tixy@yxit.co.uk>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
(cherry picked from commit 07ed43553f9ceefe5e3cbd25da0f6ff912b4fedb)

変更サマリ

差分

--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -24,6 +24,7 @@
2424 #include <asm/unwind.h>
2525 #include <asm/unistd.h>
2626 #include <asm/tls.h>
27+#include <asm/system.h>
2728
2829 #include "entry-header.S"
2930 #include <asm/entry-macro-multi.S>
@@ -439,7 +440,27 @@ __und_usr:
439440 #endif
440441 beq call_fpe
441442 @ Thumb instruction
442-#if __LINUX_ARM_ARCH__ >= 7
443+#if CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7
444+/*
445+ * Thumb-2 instruction handling. Note that because pre-v6 and >= v6 platforms
446+ * can never be supported in a single kernel, this code is not applicable at
447+ * all when __LINUX_ARM_ARCH__ < 6. This allows simplifying assumptions to be
448+ * made about .arch directives.
449+ */
450+#if __LINUX_ARM_ARCH__ < 7
451+/* If the target CPU may not be Thumb-2-capable, a run-time check is needed: */
452+#define NEED_CPU_ARCHITECTURE
453+ ldr r5, .LCcpu_architecture
454+ ldr r5, [r5]
455+ cmp r5, #CPU_ARCH_ARMv7
456+ blo __und_usr_unknown
457+/*
458+ * The following code won't get run unless the running CPU really is v7, so
459+ * coding round the lack of ldrht on older arches is pointless. Temporarily
460+ * override the assembler target arch with the minimum required instead:
461+ */
462+ .arch armv6t2
463+#endif
443464 2:
444465 ARM( ldrht r5, [r4], #2 )
445466 THUMB( ldrht r5, [r4] )
@@ -449,7 +470,16 @@ __und_usr:
449470 3: ldrht r0, [r4]
450471 add r2, r2, #2 @ r2 is PC + 2, make it PC + 4
451472 orr r0, r0, r5, lsl #16
473+
474+#if __LINUX_ARM_ARCH__ < 7
475+/* If the target arch was overridden, change it back: */
476+#ifdef CONFIG_CPU_32v6K
477+ .arch armv6k
452478 #else
479+ .arch armv6
480+#endif
481+#endif /* __LINUX_ARM_ARCH__ < 7 */
482+#else /* !(CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7) */
453483 b __und_usr_unknown
454484 #endif
455485 UNWIND(.fnend )
@@ -576,6 +606,12 @@ call_fpe:
576606 movw_pc lr @ CP#14 (Debug)
577607 movw_pc lr @ CP#15 (Control)
578608
609+#ifdef NEED_CPU_ARCHITECTURE
610+ .align 2
611+.LCcpu_architecture:
612+ .word __cpu_architecture
613+#endif
614+
579615 #ifdef CONFIG_NEON
580616 .align 6
581617