diff options
Diffstat (limited to 'arch/arm/kernel/traps.c')
-rw-r--r-- | arch/arm/kernel/traps.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 1621e5327b2a..cda78d59aa31 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <asm/unistd.h> | 30 | #include <asm/unistd.h> |
31 | #include <asm/traps.h> | 31 | #include <asm/traps.h> |
32 | #include <asm/unwind.h> | 32 | #include <asm/unwind.h> |
33 | #include <asm/tls.h> | ||
33 | 34 | ||
34 | #include "ptrace.h" | 35 | #include "ptrace.h" |
35 | #include "signal.h" | 36 | #include "signal.h" |
@@ -518,17 +519,20 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) | |||
518 | 519 | ||
519 | case NR(set_tls): | 520 | case NR(set_tls): |
520 | thread->tp_value = regs->ARM_r0; | 521 | thread->tp_value = regs->ARM_r0; |
521 | #if defined(CONFIG_HAS_TLS_REG) | 522 | if (tls_emu) |
522 | asm ("mcr p15, 0, %0, c13, c0, 3" : : "r" (regs->ARM_r0) ); | 523 | return 0; |
523 | #elif !defined(CONFIG_TLS_REG_EMUL) | 524 | if (has_tls_reg) { |
524 | /* | 525 | asm ("mcr p15, 0, %0, c13, c0, 3" |
525 | * User space must never try to access this directly. | 526 | : : "r" (regs->ARM_r0)); |
526 | * Expect your app to break eventually if you do so. | 527 | } else { |
527 | * The user helper at 0xffff0fe0 must be used instead. | 528 | /* |
528 | * (see entry-armv.S for details) | 529 | * User space must never try to access this directly. |
529 | */ | 530 | * Expect your app to break eventually if you do so. |
530 | *((unsigned int *)0xffff0ff0) = regs->ARM_r0; | 531 | * The user helper at 0xffff0fe0 must be used instead. |
531 | #endif | 532 | * (see entry-armv.S for details) |
533 | */ | ||
534 | *((unsigned int *)0xffff0ff0) = regs->ARM_r0; | ||
535 | } | ||
532 | return 0; | 536 | return 0; |
533 | 537 | ||
534 | #ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG | 538 | #ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG |
@@ -743,6 +747,16 @@ void __init trap_init(void) | |||
743 | return; | 747 | return; |
744 | } | 748 | } |
745 | 749 | ||
750 | static void __init kuser_get_tls_init(unsigned long vectors) | ||
751 | { | ||
752 | /* | ||
753 | * vectors + 0xfe0 = __kuser_get_tls | ||
754 | * vectors + 0xfe8 = hardware TLS instruction at 0xffff0fe8 | ||
755 | */ | ||
756 | if (tls_emu || has_tls_reg) | ||
757 | memcpy((void *)vectors + 0xfe0, (void *)vectors + 0xfe8, 4); | ||
758 | } | ||
759 | |||
746 | void __init early_trap_init(void) | 760 | void __init early_trap_init(void) |
747 | { | 761 | { |
748 | unsigned long vectors = CONFIG_VECTORS_BASE; | 762 | unsigned long vectors = CONFIG_VECTORS_BASE; |
@@ -761,6 +775,11 @@ void __init early_trap_init(void) | |||
761 | memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz); | 775 | memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz); |
762 | 776 | ||
763 | /* | 777 | /* |
778 | * Do processor specific fixups for the kuser helpers | ||
779 | */ | ||
780 | kuser_get_tls_init(vectors); | ||
781 | |||
782 | /* | ||
764 | * Copy signal return handlers into the vector page, and | 783 | * Copy signal return handlers into the vector page, and |
765 | * set sigreturn to be a pointer to these. | 784 | * set sigreturn to be a pointer to these. |
766 | */ | 785 | */ |