aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/traps.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-29 18:06:00 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-29 18:06:00 -0400
commitdd96a8e056e7b3e480197ff2cdf106b46455d779 (patch)
tree7958f4d6fb3714f585e13e2e9ecb3dfa6d8a8223 /arch/arm/kernel/traps.c
parenta879cbbb34cbecfa9707fbb6e5a00c503ac1ecb9 (diff)
parent53e173f62c318e65e6ae13524b04c5cf38c1bc3c (diff)
Merge of master.kernel.org:/home/rmk/linux-2.6-rmk.git
Diffstat (limited to 'arch/arm/kernel/traps.c')
-rw-r--r--arch/arm/kernel/traps.c58
1 files changed, 50 insertions, 8 deletions
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 0078aeb85737..3a001fe5540b 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -450,13 +450,17 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
450 450
451 case NR(set_tls): 451 case NR(set_tls):
452 thread->tp_value = regs->ARM_r0; 452 thread->tp_value = regs->ARM_r0;
453#ifdef CONFIG_HAS_TLS_REG
454 asm ("mcr p15, 0, %0, c13, c0, 3" : : "r" (regs->ARM_r0) );
455#else
453 /* 456 /*
454 * Our user accessible TLS ptr is located at 0xffff0ffc. 457 * User space must never try to access this directly.
455 * On SMP read access to this address must raise a fault 458 * Expect your app to break eventually if you do so.
456 * and be emulated from the data abort handler. 459 * The user helper at 0xffff0fe0 must be used instead.
457 * m 460 * (see entry-armv.S for details)
458 */ 461 */
459 *((unsigned long *)0xffff0ffc) = thread->tp_value; 462 *((unsigned int *)0xffff0ff0) = regs->ARM_r0;
463#endif
460 return 0; 464 return 0;
461 465
462 default: 466 default:
@@ -493,6 +497,41 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
493 return 0; 497 return 0;
494} 498}
495 499
500#if defined(CONFIG_CPU_32v6) && !defined(CONFIG_HAS_TLS_REG)
501
502/*
503 * We might be running on an ARMv6+ processor which should have the TLS
504 * register, but for some reason we can't use it and have to emulate it.
505 */
506
507static int get_tp_trap(struct pt_regs *regs, unsigned int instr)
508{
509 int reg = (instr >> 12) & 15;
510 if (reg == 15)
511 return 1;
512 regs->uregs[reg] = current_thread_info()->tp_value;
513 regs->ARM_pc += 4;
514 return 0;
515}
516
517static struct undef_hook arm_mrc_hook = {
518 .instr_mask = 0x0fff0fff,
519 .instr_val = 0x0e1d0f70,
520 .cpsr_mask = PSR_T_BIT,
521 .cpsr_val = 0,
522 .fn = get_tp_trap,
523};
524
525static int __init arm_mrc_hook_init(void)
526{
527 register_undef_hook(&arm_mrc_hook);
528 return 0;
529}
530
531late_initcall(arm_mrc_hook_init);
532
533#endif
534
496void __bad_xchg(volatile void *ptr, int size) 535void __bad_xchg(volatile void *ptr, int size)
497{ 536{
498 printk("xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n", 537 printk("xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n",
@@ -580,14 +619,17 @@ void __init trap_init(void)
580{ 619{
581 extern char __stubs_start[], __stubs_end[]; 620 extern char __stubs_start[], __stubs_end[];
582 extern char __vectors_start[], __vectors_end[]; 621 extern char __vectors_start[], __vectors_end[];
622 extern char __kuser_helper_start[], __kuser_helper_end[];
623 int kuser_sz = __kuser_helper_end - __kuser_helper_start;
583 624
584 /* 625 /*
585 * Copy the vectors and stubs (in entry-armv.S) into the 626 * Copy the vectors, stubs and kuser helpers (in entry-armv.S)
586 * vector page, mapped at 0xffff0000, and ensure these are 627 * into the vector page, mapped at 0xffff0000, and ensure these
587 * visible to the instruction stream. 628 * are visible to the instruction stream.
588 */ 629 */
589 memcpy((void *)0xffff0000, __vectors_start, __vectors_end - __vectors_start); 630 memcpy((void *)0xffff0000, __vectors_start, __vectors_end - __vectors_start);
590 memcpy((void *)0xffff0200, __stubs_start, __stubs_end - __stubs_start); 631 memcpy((void *)0xffff0200, __stubs_start, __stubs_end - __stubs_start);
632 memcpy((void *)0xffff1000 - kuser_sz, __kuser_helper_start, kuser_sz);
591 flush_icache_range(0xffff0000, 0xffff0000 + PAGE_SIZE); 633 flush_icache_range(0xffff0000, 0xffff0000 + PAGE_SIZE);
592 modify_domain(DOMAIN_USER, DOMAIN_CLIENT); 634 modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
593} 635}