diff options
Diffstat (limited to 'arch/m32r')
| -rw-r--r-- | arch/m32r/include/asm/local.h | 25 | ||||
| -rw-r--r-- | arch/m32r/include/asm/ptrace.h | 2 | ||||
| -rw-r--r-- | arch/m32r/include/asm/tlbflush.h | 2 | ||||
| -rw-r--r-- | arch/m32r/include/asm/unistd.h | 1 | ||||
| -rw-r--r-- | arch/m32r/kernel/ptrace.c | 97 | ||||
| -rw-r--r-- | arch/m32r/kernel/sys_m32r.c | 92 | ||||
| -rw-r--r-- | arch/m32r/mm/fault-nommu.c | 2 | ||||
| -rw-r--r-- | arch/m32r/mm/fault.c | 6 |
8 files changed, 37 insertions, 190 deletions
diff --git a/arch/m32r/include/asm/local.h b/arch/m32r/include/asm/local.h index 22256d138630..734bca87018a 100644 --- a/arch/m32r/include/asm/local.h +++ b/arch/m32r/include/asm/local.h | |||
| @@ -338,29 +338,4 @@ static inline void local_set_mask(unsigned long mask, local_t *addr) | |||
| 338 | * a variable, not an address. | 338 | * a variable, not an address. |
| 339 | */ | 339 | */ |
| 340 | 340 | ||
| 341 | /* Need to disable preemption for the cpu local counters otherwise we could | ||
| 342 | still access a variable of a previous CPU in a non local way. */ | ||
| 343 | #define cpu_local_wrap_v(l) \ | ||
| 344 | ({ local_t res__; \ | ||
| 345 | preempt_disable(); \ | ||
| 346 | res__ = (l); \ | ||
| 347 | preempt_enable(); \ | ||
| 348 | res__; }) | ||
| 349 | #define cpu_local_wrap(l) \ | ||
| 350 | ({ preempt_disable(); \ | ||
| 351 | l; \ | ||
| 352 | preempt_enable(); }) \ | ||
| 353 | |||
| 354 | #define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var(l))) | ||
| 355 | #define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var(l), (i))) | ||
| 356 | #define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var(l))) | ||
| 357 | #define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var(l))) | ||
| 358 | #define cpu_local_add(i, l) cpu_local_wrap(local_add((i), &__get_cpu_var(l))) | ||
| 359 | #define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i), &__get_cpu_var(l))) | ||
| 360 | |||
| 361 | #define __cpu_local_inc(l) cpu_local_inc(l) | ||
| 362 | #define __cpu_local_dec(l) cpu_local_dec(l) | ||
| 363 | #define __cpu_local_add(i, l) cpu_local_add((i), (l)) | ||
| 364 | #define __cpu_local_sub(i, l) cpu_local_sub((i), (l)) | ||
| 365 | |||
| 366 | #endif /* __M32R_LOCAL_H */ | 341 | #endif /* __M32R_LOCAL_H */ |
diff --git a/arch/m32r/include/asm/ptrace.h b/arch/m32r/include/asm/ptrace.h index a0755b982028..840a1231edeb 100644 --- a/arch/m32r/include/asm/ptrace.h +++ b/arch/m32r/include/asm/ptrace.h | |||
| @@ -120,6 +120,8 @@ struct pt_regs { | |||
| 120 | 120 | ||
| 121 | #include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */ | 121 | #include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */ |
| 122 | 122 | ||
| 123 | #define arch_has_single_step() (1) | ||
| 124 | |||
| 123 | struct task_struct; | 125 | struct task_struct; |
| 124 | extern void init_debug_traps(struct task_struct *); | 126 | extern void init_debug_traps(struct task_struct *); |
| 125 | #define arch_ptrace_attach(child) \ | 127 | #define arch_ptrace_attach(child) \ |
diff --git a/arch/m32r/include/asm/tlbflush.h b/arch/m32r/include/asm/tlbflush.h index 0ef95307784e..92614b0ccf17 100644 --- a/arch/m32r/include/asm/tlbflush.h +++ b/arch/m32r/include/asm/tlbflush.h | |||
| @@ -92,6 +92,6 @@ static __inline__ void __flush_tlb_all(void) | |||
| 92 | ); | 92 | ); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); | 95 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); |
| 96 | 96 | ||
| 97 | #endif /* _ASM_M32R_TLBFLUSH_H */ | 97 | #endif /* _ASM_M32R_TLBFLUSH_H */ |
diff --git a/arch/m32r/include/asm/unistd.h b/arch/m32r/include/asm/unistd.h index cf701c933249..76125777483c 100644 --- a/arch/m32r/include/asm/unistd.h +++ b/arch/m32r/include/asm/unistd.h | |||
| @@ -339,6 +339,7 @@ | |||
| 339 | #define __ARCH_WANT_STAT64 | 339 | #define __ARCH_WANT_STAT64 |
| 340 | #define __ARCH_WANT_SYS_ALARM | 340 | #define __ARCH_WANT_SYS_ALARM |
| 341 | #define __ARCH_WANT_SYS_GETHOSTNAME | 341 | #define __ARCH_WANT_SYS_GETHOSTNAME |
| 342 | #define __ARCH_WANT_SYS_IPC | ||
| 342 | #define __ARCH_WANT_SYS_PAUSE | 343 | #define __ARCH_WANT_SYS_PAUSE |
| 343 | #define __ARCH_WANT_SYS_TIME | 344 | #define __ARCH_WANT_SYS_TIME |
| 344 | #define __ARCH_WANT_SYS_UTIME | 345 | #define __ARCH_WANT_SYS_UTIME |
diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c index 98682bba0ed9..e555091eb97c 100644 --- a/arch/m32r/kernel/ptrace.c +++ b/arch/m32r/kernel/ptrace.c | |||
| @@ -580,6 +580,35 @@ init_debug_traps(struct task_struct *child) | |||
| 580 | } | 580 | } |
| 581 | } | 581 | } |
| 582 | 582 | ||
| 583 | void user_enable_single_step(struct task_struct *child) | ||
| 584 | { | ||
| 585 | unsigned long next_pc; | ||
| 586 | unsigned long pc, insn; | ||
| 587 | |||
| 588 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
| 589 | |||
| 590 | /* Compute next pc. */ | ||
| 591 | pc = get_stack_long(child, PT_BPC); | ||
| 592 | |||
| 593 | if (access_process_vm(child, pc&~3, &insn, sizeof(insn), 0) | ||
| 594 | != sizeof(insn)) | ||
| 595 | break; | ||
| 596 | |||
| 597 | compute_next_pc(insn, pc, &next_pc, child); | ||
| 598 | if (next_pc & 0x80000000) | ||
| 599 | break; | ||
| 600 | |||
| 601 | if (embed_debug_trap(child, next_pc)) | ||
| 602 | break; | ||
| 603 | |||
| 604 | invalidate_cache(); | ||
| 605 | } | ||
| 606 | |||
| 607 | void user_disable_single_step(struct task_struct *child) | ||
| 608 | { | ||
| 609 | unregister_all_debug_traps(child); | ||
| 610 | invalidate_cache(); | ||
| 611 | } | ||
| 583 | 612 | ||
| 584 | /* | 613 | /* |
| 585 | * Called by kernel/ptrace.c when detaching.. | 614 | * Called by kernel/ptrace.c when detaching.. |
| @@ -630,74 +659,6 @@ arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
| 630 | ret = ptrace_write_user(child, addr, data); | 659 | ret = ptrace_write_user(child, addr, data); |
| 631 | break; | 660 | break; |
| 632 | 661 | ||
| 633 | /* | ||
| 634 | * continue/restart and stop at next (return from) syscall | ||
| 635 | */ | ||
| 636 | case PTRACE_SYSCALL: | ||
| 637 | case PTRACE_CONT: | ||
| 638 | ret = -EIO; | ||
| 639 | if (!valid_signal(data)) | ||
| 640 | break; | ||
| 641 | if (request == PTRACE_SYSCALL) | ||
| 642 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
| 643 | else | ||
| 644 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
| 645 | child->exit_code = data; | ||
| 646 | wake_up_process(child); | ||
| 647 | ret = 0; | ||
| 648 | break; | ||
| 649 | |||
| 650 | /* | ||
| 651 | * make the child exit. Best I can do is send it a sigkill. | ||
| 652 | * perhaps it should be put in the status that it wants to | ||
| 653 | * exit. | ||
| 654 | */ | ||
| 655 | case PTRACE_KILL: { | ||
| 656 | ret = 0; | ||
| 657 | unregister_all_debug_traps(child); | ||
| 658 | invalidate_cache(); | ||
| 659 | if (child->exit_state == EXIT_ZOMBIE) /* already dead */ | ||
| 660 | break; | ||
| 661 | child->exit_code = SIGKILL; | ||
| 662 | wake_up_process(child); | ||
| 663 | break; | ||
| 664 | } | ||
| 665 | |||
| 666 | /* | ||
| 667 | * execute single instruction. | ||
| 668 | */ | ||
| 669 | case PTRACE_SINGLESTEP: { | ||
| 670 | unsigned long next_pc; | ||
| 671 | unsigned long pc, insn; | ||
| 672 | |||
| 673 | ret = -EIO; | ||
| 674 | if (!valid_signal(data)) | ||
| 675 | break; | ||
| 676 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
| 677 | |||
| 678 | /* Compute next pc. */ | ||
| 679 | pc = get_stack_long(child, PT_BPC); | ||
| 680 | |||
| 681 | if (access_process_vm(child, pc&~3, &insn, sizeof(insn), 0) | ||
| 682 | != sizeof(insn)) | ||
| 683 | break; | ||
| 684 | |||
| 685 | compute_next_pc(insn, pc, &next_pc, child); | ||
| 686 | if (next_pc & 0x80000000) | ||
| 687 | break; | ||
| 688 | |||
| 689 | if (embed_debug_trap(child, next_pc)) | ||
| 690 | break; | ||
| 691 | |||
| 692 | invalidate_cache(); | ||
| 693 | child->exit_code = data; | ||
| 694 | |||
| 695 | /* give it a chance to run. */ | ||
| 696 | wake_up_process(child); | ||
| 697 | ret = 0; | ||
| 698 | break; | ||
| 699 | } | ||
| 700 | |||
| 701 | case PTRACE_GETREGS: | 662 | case PTRACE_GETREGS: |
| 702 | ret = ptrace_getregs(child, (void __user *)data); | 663 | ret = ptrace_getregs(child, (void __user *)data); |
| 703 | break; | 664 | break; |
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c index d3c865c5a6ba..0a00f467edfa 100644 --- a/arch/m32r/kernel/sys_m32r.c +++ b/arch/m32r/kernel/sys_m32r.c | |||
| @@ -76,98 +76,6 @@ asmlinkage int sys_tas(int __user *addr) | |||
| 76 | return oldval; | 76 | return oldval; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | /* | ||
| 80 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | ||
| 81 | * | ||
| 82 | * This is really horribly ugly. | ||
| 83 | */ | ||
| 84 | asmlinkage int sys_ipc(uint call, int first, int second, | ||
| 85 | int third, void __user *ptr, long fifth) | ||
| 86 | { | ||
| 87 | int version, ret; | ||
| 88 | |||
| 89 | version = call >> 16; /* hack for backward compatibility */ | ||
| 90 | call &= 0xffff; | ||
| 91 | |||
| 92 | switch (call) { | ||
| 93 | case SEMOP: | ||
| 94 | return sys_semtimedop(first, (struct sembuf __user *)ptr, | ||
| 95 | second, NULL); | ||
| 96 | case SEMTIMEDOP: | ||
| 97 | return sys_semtimedop(first, (struct sembuf __user *)ptr, | ||
| 98 | second, (const struct timespec __user *)fifth); | ||
| 99 | case SEMGET: | ||
| 100 | return sys_semget (first, second, third); | ||
| 101 | case SEMCTL: { | ||
| 102 | union semun fourth; | ||
| 103 | if (!ptr) | ||
| 104 | return -EINVAL; | ||
| 105 | if (get_user(fourth.__pad, (void __user * __user *) ptr)) | ||
| 106 | return -EFAULT; | ||
| 107 | return sys_semctl (first, second, third, fourth); | ||
| 108 | } | ||
| 109 | |||
| 110 | case MSGSND: | ||
| 111 | return sys_msgsnd (first, (struct msgbuf __user *) ptr, | ||
| 112 | second, third); | ||
| 113 | case MSGRCV: | ||
| 114 | switch (version) { | ||
| 115 | case 0: { | ||
| 116 | struct ipc_kludge tmp; | ||
| 117 | if (!ptr) | ||
| 118 | return -EINVAL; | ||
| 119 | |||
| 120 | if (copy_from_user(&tmp, | ||
| 121 | (struct ipc_kludge __user *) ptr, | ||
| 122 | sizeof (tmp))) | ||
| 123 | return -EFAULT; | ||
| 124 | return sys_msgrcv (first, tmp.msgp, second, | ||
| 125 | tmp.msgtyp, third); | ||
| 126 | } | ||
| 127 | default: | ||
| 128 | return sys_msgrcv (first, | ||
| 129 | (struct msgbuf __user *) ptr, | ||
| 130 | second, fifth, third); | ||
| 131 | } | ||
| 132 | case MSGGET: | ||
| 133 | return sys_msgget ((key_t) first, second); | ||
| 134 | case MSGCTL: | ||
| 135 | return sys_msgctl (first, second, | ||
| 136 | (struct msqid_ds __user *) ptr); | ||
| 137 | case SHMAT: { | ||
| 138 | ulong raddr; | ||
| 139 | |||
| 140 | if (!access_ok(VERIFY_WRITE, (ulong __user *) third, | ||
| 141 | sizeof(ulong))) | ||
| 142 | return -EFAULT; | ||
| 143 | ret = do_shmat (first, (char __user *) ptr, second, &raddr); | ||
| 144 | if (ret) | ||
| 145 | return ret; | ||
| 146 | return put_user (raddr, (ulong __user *) third); | ||
| 147 | } | ||
| 148 | case SHMDT: | ||
| 149 | return sys_shmdt ((char __user *)ptr); | ||
| 150 | case SHMGET: | ||
| 151 | return sys_shmget (first, second, third); | ||
| 152 | case SHMCTL: | ||
| 153 | return sys_shmctl (first, second, | ||
| 154 | (struct shmid_ds __user *) ptr); | ||
| 155 | default: | ||
| 156 | return -ENOSYS; | ||
| 157 | } | ||
| 158 | } | ||
| 159 | |||
| 160 | asmlinkage int sys_uname(struct old_utsname __user * name) | ||
| 161 | { | ||
| 162 | int err; | ||
| 163 | if (!name) | ||
| 164 | return -EFAULT; | ||
| 165 | down_read(&uts_sem); | ||
| 166 | err = copy_to_user(name, utsname(), sizeof (*name)); | ||
| 167 | up_read(&uts_sem); | ||
| 168 | return err?-EFAULT:0; | ||
| 169 | } | ||
| 170 | |||
| 171 | asmlinkage int sys_cacheflush(void *addr, int bytes, int cache) | 79 | asmlinkage int sys_cacheflush(void *addr, int bytes, int cache) |
| 172 | { | 80 | { |
| 173 | /* This should flush more selectively ... */ | 81 | /* This should flush more selectively ... */ |
diff --git a/arch/m32r/mm/fault-nommu.c b/arch/m32r/mm/fault-nommu.c index 88469178ea6b..888aab1157ed 100644 --- a/arch/m32r/mm/fault-nommu.c +++ b/arch/m32r/mm/fault-nommu.c | |||
| @@ -95,7 +95,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code, | |||
| 95 | * update_mmu_cache() | 95 | * update_mmu_cache() |
| 96 | *======================================================================*/ | 96 | *======================================================================*/ |
| 97 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, | 97 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, |
| 98 | pte_t pte) | 98 | pte_t *ptep) |
| 99 | { | 99 | { |
| 100 | BUG(); | 100 | BUG(); |
| 101 | } | 101 | } |
diff --git a/arch/m32r/mm/fault.c b/arch/m32r/mm/fault.c index 7274b47f4c22..28ee389e5f5a 100644 --- a/arch/m32r/mm/fault.c +++ b/arch/m32r/mm/fault.c | |||
| @@ -336,7 +336,7 @@ vmalloc_fault: | |||
| 336 | 336 | ||
| 337 | addr = (address & PAGE_MASK); | 337 | addr = (address & PAGE_MASK); |
| 338 | set_thread_fault_code(error_code); | 338 | set_thread_fault_code(error_code); |
| 339 | update_mmu_cache(NULL, addr, *pte_k); | 339 | update_mmu_cache(NULL, addr, pte_k); |
| 340 | set_thread_fault_code(0); | 340 | set_thread_fault_code(0); |
| 341 | return; | 341 | return; |
| 342 | } | 342 | } |
| @@ -349,7 +349,7 @@ vmalloc_fault: | |||
| 349 | #define ITLB_END (unsigned long *)(ITLB_BASE + (NR_TLB_ENTRIES * 8)) | 349 | #define ITLB_END (unsigned long *)(ITLB_BASE + (NR_TLB_ENTRIES * 8)) |
| 350 | #define DTLB_END (unsigned long *)(DTLB_BASE + (NR_TLB_ENTRIES * 8)) | 350 | #define DTLB_END (unsigned long *)(DTLB_BASE + (NR_TLB_ENTRIES * 8)) |
| 351 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr, | 351 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr, |
| 352 | pte_t pte) | 352 | pte_t *ptep) |
| 353 | { | 353 | { |
| 354 | volatile unsigned long *entry1, *entry2; | 354 | volatile unsigned long *entry1, *entry2; |
| 355 | unsigned long pte_data, flags; | 355 | unsigned long pte_data, flags; |
| @@ -365,7 +365,7 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr, | |||
| 365 | 365 | ||
| 366 | vaddr = (vaddr & PAGE_MASK) | get_asid(); | 366 | vaddr = (vaddr & PAGE_MASK) | get_asid(); |
| 367 | 367 | ||
| 368 | pte_data = pte_val(pte); | 368 | pte_data = pte_val(*ptep); |
| 369 | 369 | ||
| 370 | #ifdef CONFIG_CHIP_OPSP | 370 | #ifdef CONFIG_CHIP_OPSP |
| 371 | entry1 = (unsigned long *)ITLB_BASE; | 371 | entry1 = (unsigned long *)ITLB_BASE; |
