diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-12-04 03:58:56 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-12-04 03:58:56 +0000 |
commit | 1d67e90f19a7acfd9a05dc59678e7d0c5090bd0d (patch) | |
tree | 357efc7b93f8f5102110d20d293f41360ec212fc /arch/mips/kernel | |
parent | aea27b2e18d69af87e673972246e66657b4fa274 (diff) |
Merge with Linux 2.3.21.
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r-- | arch/mips/kernel/entry.S | 3 | ||||
-rw-r--r-- | arch/mips/kernel/head.S | 36 | ||||
-rw-r--r-- | arch/mips/kernel/ipc.c | 98 | ||||
-rw-r--r-- | arch/mips/kernel/irq.c | 4 | ||||
-rw-r--r-- | arch/mips/kernel/mips_ksyms.c | 7 | ||||
-rw-r--r-- | arch/mips/kernel/process.c | 46 | ||||
-rw-r--r-- | arch/mips/kernel/r4k_misc.S | 15 | ||||
-rw-r--r-- | arch/mips/kernel/scall_o32.S | 6 | ||||
-rw-r--r-- | arch/mips/kernel/syscall.c | 6 | ||||
-rw-r--r-- | arch/mips/kernel/sysirix.c | 50 | ||||
-rw-r--r-- | arch/mips/kernel/traps.c | 42 | ||||
-rw-r--r-- | arch/mips/kernel/unaligned.c | 13 |
12 files changed, 145 insertions, 181 deletions
diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S index 1f6533ead..96925837e 100644 --- a/arch/mips/kernel/entry.S +++ b/arch/mips/kernel/entry.S @@ -7,7 +7,7 @@ * * Copyright (C) 1994, 1995 by Ralf Baechle * - * $Id: entry.S,v 1.15 1999/07/26 19:42:40 harald Exp $ + * $Id: entry.S,v 1.16 1999/08/18 23:37:43 ralf Exp $ */ /* @@ -48,6 +48,7 @@ reschedule: jal schedule EXPORT(ret_from_sys_call) EXPORT(ret_from_irq) + .type ret_from_irq,@function lw t0,bh_mask lw t1,bh_active # unused delay slot and t0,t1 diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S index 7429a42bf..ed8140ba2 100644 --- a/arch/mips/kernel/head.S +++ b/arch/mips/kernel/head.S @@ -1,4 +1,4 @@ -/* $Id: head.S,v 1.15 1999/10/07 07:34:24 raiko Exp $ +/* $Id: head.S,v 1.16 1999/10/09 00:00:58 ralf Exp $ * * arch/mips/kernel/head.S * @@ -54,10 +54,8 @@ LEAF(except_vec0_r4000) .set mips3 mfc0 k0, CP0_BADVADDR # Get faulting address - _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 # get pgd only bits - lw k1, TASK_MM(k1) # get task pg_dir - lw k1, MM_PGD(k1) # get pgd pointer + lw k1, current_pgd # get pgd pointer sll k0, k0, 2 addu k1, k1, k0 # add in pgd offset mfc0 k0, CP0_CONTEXT # get context reg @@ -82,10 +80,8 @@ LEAF(except_vec0_r4600) .set mips3 mfc0 k0, CP0_BADVADDR - _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 - lw k1, TASK_MM(k1) - lw k1, MM_PGD(k1) # get pgd pointer + lw k1, current_pgd # get pgd pointer sll k0, k0, 2 addu k1, k1, k0 mfc0 k0, CP0_CONTEXT @@ -111,10 +107,8 @@ LEAF(except_vec0_nevada) .set mips3 mfc0 k0, CP0_BADVADDR # Get faulting address - _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 # get pgd only bits - lw k1, TASK_MM(k1) # get task pg_dir - lw k1, MM_PGD(k1) # get pgd pointer + lw k1, current_pgd # get pgd pointer sll k0, k0, 2 addu k1, k1, k0 # add in pgd offset lw k1, (k1) @@ -138,10 +132,8 @@ LEAF(except_vec0_r45k_bvahwbug) .set mips3 mfc0 k0, CP0_BADVADDR - _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 - lw k1, TASK_MM(k1) - lw k1, MM_PGD(k1) # get pgd pointer + lw k1, current_pgd # get pgd pointer sll k0, k0, 2 addu k1, k1, k0 mfc0 k0, CP0_CONTEXT @@ -170,10 +162,8 @@ LEAF(except_vec0_r4k_mphwbug) .set mips3 mfc0 k0, CP0_BADVADDR - _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 - lw k1, TASK_MM(k1) - lw k1, MM_PGD(k1) # get pgd pointer + lw k1, current_pgd # get pgd pointer sll k0, k0, 2 addu k1, k1, k0 mfc0 k0, CP0_CONTEXT @@ -202,10 +192,8 @@ LEAF(except_vec0_r4k_250MHZhwbug) .set mips3 mfc0 k0, CP0_BADVADDR - _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 - lw k1, TASK_MM(k1) - lw k1, MM_PGD(k1) # get pgd pointer + lw k1, current_pgd # get pgd pointer sll k0, k0, 2 addu k1, k1, k0 mfc0 k0, CP0_CONTEXT @@ -233,10 +221,8 @@ LEAF(except_vec0_r4k_MP250MHZhwbug) .set mips3 mfc0 k0, CP0_BADVADDR - _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 - lw k1, TASK_MM(k1) - lw k1, MM_PGD(k1) # get pgd pointer + lw k1, current_pgd # get pgd pointer sll k0, k0, 2 addu k1, k1, k0 mfc0 k0, CP0_CONTEXT @@ -268,10 +254,8 @@ .set noat .set mips1 mfc0 k0, CP0_BADVADDR - _GET_CURRENT(k1) # get current task ptr - lw k1, TASK_MM(k1) + lw k1, current_pgd # get pgd pointer srl k0, k0, 22 - lw k1, MM_PGD(k1) # get pgd pointer sll k0, k0, 2 addu k1, k1, k0 mfc0 k0, CP0_CONTEXT @@ -606,6 +590,8 @@ probe_done: EXPORT(kernelsp) PTR 0 +EXPORT(current_pgd) + PTR 0 .text .org 0x1000 diff --git a/arch/mips/kernel/ipc.c b/arch/mips/kernel/ipc.c index 2e764a607..8e48497f7 100644 --- a/arch/mips/kernel/ipc.c +++ b/arch/mips/kernel/ipc.c @@ -20,108 +20,94 @@ /* * sys_ipc() is the de-multiplexer for the SysV IPC calls.. * - * This is really horribly ugly. FIXME: Get rid of this wrapper. + * This is really horribly ugly. */ -asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth) +asmlinkage int sys_ipc (uint call, int first, int second, + int third, void *ptr, long fifth) { int version, ret; - lock_kernel(); version = call >> 16; /* hack for backward compatibility */ call &= 0xffff; if (call <= SEMCTL) switch (call) { case SEMOP: - ret = sys_semop (first, (struct sembuf *)ptr, second); - goto out; + return sys_semop (first, (struct sembuf *)ptr, second); case SEMGET: - ret = sys_semget (first, second, third); - goto out; + return sys_semget (first, second, third); case SEMCTL: { union semun fourth; - ret = -EINVAL; if (!ptr) - goto out; - ret = -EFAULT; + return -EINVAL; if (get_user(fourth.__pad, (void **) ptr)) - goto out; - ret = sys_semctl (first, second, third, fourth); - goto out; + return -EFAULT; + return sys_semctl (first, second, third, fourth); } default: - ret = -EINVAL; - goto out; + return -EINVAL; } + if (call <= MSGCTL) switch (call) { case MSGSND: - ret = sys_msgsnd (first, (struct msgbuf *) ptr, + return sys_msgsnd (first, (struct msgbuf *) ptr, second, third); - goto out; case MSGRCV: switch (version) { case 0: { struct ipc_kludge tmp; - ret = -EINVAL; if (!ptr) - goto out; - ret = -EFAULT; - if (copy_from_user(&tmp,(struct ipc_kludge *) ptr, - sizeof (tmp))) - goto out; - ret = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third); - goto out; + return -EINVAL; + + if (copy_from_user(&tmp, + (struct ipc_kludge *) ptr, + sizeof (tmp))) + return -EFAULT; + return sys_msgrcv (first, tmp.msgp, second, + tmp.msgtyp, third); } - case 1: default: - ret = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third); - goto out; + default: + return sys_msgrcv (first, + (struct msgbuf *) ptr, + second, fifth, third); } case MSGGET: - ret = sys_msgget ((key_t) first, second); - goto out; + return sys_msgget ((key_t) first, second); case MSGCTL: - ret = sys_msgctl (first, second, (struct msqid_ds *) ptr); - goto out; + return sys_msgctl (first, second, + (struct msqid_ds *) ptr); default: - ret = -EINVAL; - goto out; + return -EINVAL; } if (call <= SHMCTL) switch (call) { case SHMAT: switch (version) { - case 0: default: { + default: { ulong raddr; - ret = sys_shmat (first, (char *) ptr, second, &raddr); + ret = sys_shmat (first, (char *) ptr, + second, &raddr); if (ret) - goto out; - ret = put_user (raddr, (ulong *) third); - goto out; + return ret; + return put_user (raddr, (ulong *) third); } case 1: /* iBCS2 emulator entry point */ - ret = -EINVAL; if (!segment_eq(get_fs(), get_ds())) - goto out; - ret = sys_shmat (first, (char *) ptr, second, (ulong *) third); - goto out; + return -EINVAL; + return sys_shmat (first, (char *) ptr, + second, (ulong *) third); } case SHMDT: - ret = sys_shmdt ((char *)ptr); - goto out; + return sys_shmdt ((char *)ptr); case SHMGET: - ret = sys_shmget (first, second, third); - goto out; + return sys_shmget (first, second, third); case SHMCTL: - ret = sys_shmctl (first, second, (struct shmid_ds *) ptr); - goto out; + return sys_shmctl (first, second, + (struct shmid_ds *) ptr); default: - ret = -EINVAL; - goto out; + return -EINVAL; } - else - ret = -EINVAL; -out: - unlock_kernel(); - return ret; + + return -EINVAL; } diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c index b083e3686..c592503ff 100644 --- a/arch/mips/kernel/irq.c +++ b/arch/mips/kernel/irq.c @@ -1,4 +1,4 @@ -/* $Id: irq.c,v 1.15 1999/02/25 21:50:49 tsbogend Exp $ +/* $Id: irq.c,v 1.16 1999/09/28 22:25:46 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -123,8 +123,6 @@ int get_irq_list(char *buf) return len; } -atomic_t __mips_bh_counter; - static inline void i8259_mask_and_ack_irq(int irq) { cached_irq_mask |= 1 << irq; diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c index f66f3942e..2b12f0e34 100644 --- a/arch/mips/kernel/mips_ksyms.c +++ b/arch/mips/kernel/mips_ksyms.c @@ -1,4 +1,4 @@ -/* $Id: mips_ksyms.c,v 1.20 1999/08/20 21:59:02 ralf Exp $ +/* $Id: mips_ksyms.c,v 1.21 1999/10/21 00:23:04 ralf Exp $ * * Export MIPS-specific functions needed for loadable modules. * @@ -34,6 +34,8 @@ extern long __strncpy_from_user_asm(char *__to, const char *__from, long __len); extern long __strlen_user_nocheck_asm(const char *s); extern long __strlen_user_asm(const char *s); +extern long __strnlen_user_nocheck_asm(const char *s); +extern long __strnlen_user_asm(const char *s); EXPORT_SYMBOL(EISA_bus); @@ -54,7 +56,6 @@ EXPORT_SYMBOL_NOVERS(strtok); EXPORT_SYMBOL_NOVERS(strpbrk); EXPORT_SYMBOL(clear_page); -EXPORT_SYMBOL(__mips_bh_counter); EXPORT_SYMBOL(local_bh_count); EXPORT_SYMBOL(local_irq_count); EXPORT_SYMBOL(enable_irq); @@ -70,6 +71,8 @@ EXPORT_SYMBOL_NOVERS(__strncpy_from_user_nocheck_asm); EXPORT_SYMBOL_NOVERS(__strncpy_from_user_asm); EXPORT_SYMBOL_NOVERS(__strlen_user_nocheck_asm); EXPORT_SYMBOL_NOVERS(__strlen_user_asm); +EXPORT_SYMBOL_NOVERS(__strnlen_user_nocheck_asm); +EXPORT_SYMBOL_NOVERS(__strnlen_user_asm); /* Networking helper routines. */ diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index ffd9fd990..f0c346b61 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -1,4 +1,4 @@ -/* $Id: process.c,v 1.15 1999/09/28 22:25:47 ralf Exp $ +/* $Id: process.c,v 1.16 1999/10/09 00:00:58 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -31,45 +31,27 @@ #include <asm/elf.h> #include <asm/isadep.h> -asmlinkage int cpu_idle(void) +void cpu_idle(void) { - unsigned long start_idle = 0; - - if (current->pid != 0) - return -EPERM; - /* endless idle loop with no priority at all */ current->priority = 0; - current->counter = 0; - for (;;) { - /* - * R4[36]00 have wait, R4[04]00 don't. - * FIXME: We should save power by reducing the clock where - * possible. Thiss will cut down the power consuption - * of R4200 systems to about 1/16th of normal, the - * same for logic clocked with the processor generated - * clocks. - */ - if (!start_idle) { - check_pgt_cache(); - start_idle = jiffies; - } - if (wait_available && !current->need_resched) - __asm__(".set\tmips3\n\t" - "wait\n\t" - ".set\tmips0"); - run_task_queue(&tq_scheduler); - if (current->need_resched) - start_idle = 0; + current->counter = -100; + init_idle(); + + while (1) { + while (!current->need_resched) + if (wait_available) + __asm__(".set\tmips3\n\t" + "wait\n\t" + ".set\tmips0"); schedule(); + check_pgt_cache(); } - - return 0; } struct task_struct *last_task_used_math = NULL; -asmlinkage void ret_from_sys_call(void); +asmlinkage void ret_from_fork(void); void exit_thread(void) { @@ -127,7 +109,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, p->thread.current_ds = USER_DS; } p->thread.reg29 = (unsigned long) childregs; - p->thread.reg31 = (unsigned long) ret_from_sys_call; + p->thread.reg31 = (unsigned long) ret_from_fork; /* * New tasks loose permission to use the fpu. This accelerates context diff --git a/arch/mips/kernel/r4k_misc.S b/arch/mips/kernel/r4k_misc.S index 6e6ff5294..35493e182 100644 --- a/arch/mips/kernel/r4k_misc.S +++ b/arch/mips/kernel/r4k_misc.S @@ -1,4 +1,4 @@ -/* $Id: r4k_misc.S,v 1.7 1999/09/28 22:25:47 ralf Exp $ +/* $Id: r4k_misc.S,v 1.8 1999/10/09 00:00:58 ralf Exp $ * * r4k_misc.S: Misc. exception handling code for r4k. * @@ -20,7 +20,7 @@ #include <asm/regdef.h> #include <asm/stackframe.h> -#define NOTLB_OPTIMIZE /* If you are paranoid, define this. */ +#undef NOTLB_OPTIMIZE /* If you are paranoid, define this. */ /* ABUSE of CPP macros 101. */ @@ -31,11 +31,9 @@ #define LOAD_PTE(pte, ptr) \ mfc0 pte, CP0_BADVADDR; \ srl pte, pte, 22; \ - _GET_CURRENT(ptr); \ + lw ptr, current_pgd; \ sll pte, pte, 2; \ - lw ptr, TASK_MM(ptr); \ - lw ptr, MM_PGD(ptr); \ - addu ptr, pte, ptr; \ + addu ptr, ptr, pte; \ mfc0 pte, CP0_BADVADDR; \ lw ptr, (ptr); \ srl pte, pte, 10; \ @@ -59,7 +57,6 @@ #define DO_FAULT(write) \ .set noat; \ - .set macro; \ SAVE_ALL; \ mfc0 a2, CP0_BADVADDR; \ STI; \ @@ -69,8 +66,7 @@ li a1, write; \ j ret_from_sys_call; \ nop; \ - .set noat; \ - .set nomacro; + .set noat; /* Check is PTE is present, if not then jump to LABEL. * PTR points to the page table where this PTE is located, @@ -137,7 +133,6 @@ .align 5 NESTED(handle_tlbl, PT_SIZE, sp) .set noat - .set nomacro invalid_tlbl: #ifndef NOTLB_OPTIMIZE /* Test present bit in entry. */ diff --git a/arch/mips/kernel/scall_o32.S b/arch/mips/kernel/scall_o32.S index aa949f7ee..a6e4d2e90 100644 --- a/arch/mips/kernel/scall_o32.S +++ b/arch/mips/kernel/scall_o32.S @@ -1,4 +1,4 @@ -/* $Id: scall_o32.S,v 1.4 1998/06/25 20:01:01 ralf Exp $ +/* $Id: scall_o32.S,v 1.7 1999/07/26 19:42:40 harald Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -99,9 +99,9 @@ o32_reschedule: trace_a_syscall: SAVE_STATIC - sw t2,PT_R1(sp) + sw t2, PT_R1(sp) jal syscall_trace - lw t2,PT_R1(sp) + lw t2, PT_R1(sp) lw a0, PT_R4(sp) # Restore argument registers lw a1, PT_R5(sp) diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 05e1fea1e..fbf2539c5 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c @@ -1,4 +1,4 @@ -/* $Id: syscall.c,v 1.10 1999/02/15 02:16:52 ralf Exp $ +/* $Id: syscall.c,v 1.11 1999/10/09 00:00:58 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -61,6 +61,7 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, int prot, struct file * file = NULL; unsigned long error = -EFAULT; + down(¤t->mm->mmap_sem); lock_kernel(); if (!(flags & MAP_ANONYMOUS)) { error = -EBADF; @@ -69,11 +70,14 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, int prot, goto out; } flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); + error = do_mmap(file, addr, len, prot, flags, offset); if (file) fput(file); out: unlock_kernel(); + up(¤t->mm->mmap_sem); + return error; } diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index 7dd1a21af..db3a04665 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c @@ -1,4 +1,4 @@ -/* $Id: sysirix.c,v 1.20 1999/06/17 13:25:48 ralf Exp $ +/* $Id: sysirix.c,v 1.21 1999/10/09 00:00:58 ralf Exp $ * * sysirix.c: IRIX system call emulation. * @@ -47,7 +47,6 @@ asmlinkage int irix_sysmp(struct pt_regs *regs) int base = 0; int error = 0; - lock_kernel(); if(regs->regs[2] == 1000) base = 1; cmd = regs->regs[base + 4]; @@ -57,8 +56,7 @@ asmlinkage int irix_sysmp(struct pt_regs *regs) break; case MP_NPROCS: case MP_NAPROCS: - error = 1; - error = NR_CPUS; + error = smp_num_cpus; break; default: printk("SYSMP[%s:%ld]: Unsupported opcode %d\n", @@ -67,7 +65,6 @@ asmlinkage int irix_sysmp(struct pt_regs *regs) break; } - unlock_kernel(); return error; } @@ -1106,13 +1103,16 @@ asmlinkage unsigned long irix_mmap32(unsigned long addr, size_t len, int prot, struct file *file = NULL; unsigned long retval; + down(¤t->mm->mmap_sem); lock_kernel(); if(!(flags & MAP_ANONYMOUS)) { if(!(file = fget(fd))) { retval = -EBADF; goto out; } - /* Ok, bad taste hack follows, try to think in something else when reading this */ + + /* Ok, bad taste hack follows, try to think in something else + * when reading this. */ if (flags & IRIX_MAP_AUTOGROW){ unsigned long old_pos; long max_size = offset + len; @@ -1124,7 +1124,7 @@ asmlinkage unsigned long irix_mmap32(unsigned long addr, size_t len, int prot, } } } - + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); retval = do_mmap(file, addr, len, prot, flags, offset); @@ -1133,6 +1133,8 @@ asmlinkage unsigned long irix_mmap32(unsigned long addr, size_t len, int prot, out: unlock_kernel(); + up(¤t->mm->mmap_sem); + return retval; } @@ -1684,23 +1686,25 @@ out: return retval; } -extern asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, int prot, - int flags, int fd, off_t offset); +extern asmlinkage unsigned long +sys_mmap(unsigned long addr, size_t len, int prot, int flags, int fd, + off_t offset); asmlinkage int irix_mmap64(struct pt_regs *regs) { int len, prot, flags, fd, off1, off2, error, base = 0; unsigned long addr, *sp; struct file *file; - + + down(¤t->mm->mmap_sem); lock_kernel(); - if(regs->regs[2] == 1000) + if (regs->regs[2] == 1000) base = 1; sp = (unsigned long *) (regs->regs[29] + 16); addr = regs->regs[base + 4]; len = regs->regs[base + 5]; prot = regs->regs[base + 6]; - if(!base) { + if (!base) { flags = regs->regs[base + 7]; error = verify_area(VERIFY_READ, sp, (4 * sizeof(unsigned long))); if(error) @@ -1717,22 +1721,22 @@ asmlinkage int irix_mmap64(struct pt_regs *regs) __get_user(off1, &sp[2]); __get_user(off2, &sp[3]); } - if(off1) { + if (off1) { error = -EINVAL; goto out; } - if(!(flags & MAP_ANONYMOUS)) { + if (!(flags & MAP_ANONYMOUS)) { if(!(file = fcheck(fd))) { error = -EBADF; goto out; } - + /* Ok, bad taste hack follows, try to think in something else when reading this */ if (flags & IRIX_MAP_AUTOGROW){ unsigned long old_pos; long max_size = off2 + len; - + if (max_size > file->f_dentry->d_inode->i_size){ old_pos = sys_lseek (fd, max_size - 1, 0); sys_write (fd, "", 1); @@ -1750,30 +1754,27 @@ out: asmlinkage int irix_dmi(struct pt_regs *regs) { - lock_kernel(); printk("[%s:%ld] Wheee.. irix_dmi()\n", current->comm, current->pid); - unlock_kernel(); + return -EINVAL; } asmlinkage int irix_pread(int fd, char *buf, int cnt, int off64, int off1, int off2) { - lock_kernel(); printk("[%s:%ld] Wheee.. irix_pread(%d,%p,%d,%d,%d,%d)\n", current->comm, current->pid, fd, buf, cnt, off64, off1, off2); - unlock_kernel(); + return -EINVAL; } asmlinkage int irix_pwrite(int fd, char *buf, int cnt, int off64, int off1, int off2) { - lock_kernel(); printk("[%s:%ld] Wheee.. irix_pwrite(%d,%p,%d,%d,%d,%d)\n", current->comm, current->pid, fd, buf, cnt, off64, off1, off2); - unlock_kernel(); + return -EINVAL; } @@ -1781,12 +1782,11 @@ asmlinkage int irix_sgifastpath(int cmd, unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5) { - lock_kernel(); printk("[%s:%ld] Wheee.. irix_fastpath(%d,%08lx,%08lx,%08lx,%08lx," "%08lx,%08lx)\n", current->comm, current->pid, cmd, arg0, arg1, arg2, arg3, arg4, arg5); - unlock_kernel(); + return -EINVAL; } @@ -2414,12 +2414,10 @@ out: asmlinkage int irix_unimp(struct pt_regs *regs) { - lock_kernel(); printk("irix_unimp [%s:%ld] v0=%d v1=%d a0=%08lx a1=%08lx a2=%08lx " "a3=%08lx\n", current->comm, current->pid, (int) regs->regs[2], (int) regs->regs[3], regs->regs[4], regs->regs[5], regs->regs[6], regs->regs[7]); - unlock_kernel(); return -ENOSYS; } diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 4cc841d41..de981f1ae 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c @@ -1,4 +1,4 @@ -/* $Id: traps.c,v 1.24 1999/08/13 17:07:26 harald Exp $ +/* $Id: traps.c,v 1.25 1999/08/21 22:19:11 ralf Exp $ * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -14,6 +14,7 @@ #include <linux/sched.h> #include <linux/smp.h> #include <linux/smp_lock.h> +#include <linux/spinlock.h> #include <asm/branch.h> #include <asm/cachectl.h> @@ -25,10 +26,17 @@ #include <asm/system.h> #include <asm/uaccess.h> +extern int console_loglevel; + +static inline void console_silent(void) +{ + console_loglevel = 0; +} + static inline void console_verbose(void) { - extern int console_loglevel; - console_loglevel = 15; + if (console_loglevel) + console_loglevel = 15; } /* @@ -187,13 +195,17 @@ void show_code(unsigned int *pc) } } -void die(const char * str, struct pt_regs * regs, unsigned long err) -{ - if (user_mode(regs)) /* Just return if in user mode. */ - return; +spinlock_t die_lock; +extern void __die(const char * str, struct pt_regs * regs, const char *where, + unsigned long line) +{ console_verbose(); - printk("%s: %04lx\n", str, err & 0xffff); + spin_lock_irq(&die_lock); + printk("%s", str); + if (where) + printk(" in %s, line %ld", where, line); + printk(":\n"); show_regs(regs); printk("Process %s (pid: %ld, stackpage=%08lx)\n", current->comm, current->pid, (unsigned long) current); @@ -201,13 +213,16 @@ void die(const char * str, struct pt_regs * regs, unsigned long err) show_trace((unsigned int *) regs->regs[29]); show_code((unsigned int *) regs->cp0_epc); printk("\n"); +while(1); + spin_unlock_irq(&die_lock); do_exit(SIGSEGV); } -void die_if_kernel(const char * str, struct pt_regs * regs, unsigned long err) +void __die_if_kernel(const char * str, struct pt_regs * regs, const char *where, + unsigned long line) { if (!user_mode(regs)) - die(str, regs, err); + __die(str, regs, where, line); } static void default_be_board_handler(struct pt_regs *regs) @@ -674,10 +689,10 @@ void __init trap_init(void) if (vce_available) { memcpy((void *)(KSEG0 + 0x180), &except_vec3_r4000, - 0x180); + 0x80); } else { memcpy((void *)(KSEG0 + 0x180), &except_vec3_generic, - 0x100); + 0x80); } break; @@ -718,4 +733,7 @@ void __init trap_init(void) panic("Unknown CPU type"); } flush_icache_range(KSEG0, KSEG0 + 0x200); + + atomic_inc(&init_mm.mm_count); /* XXX UP? */ + current->active_mm = &init_mm; } diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c index 591c1a47b..2520b4e34 100644 --- a/arch/mips/kernel/unaligned.c +++ b/arch/mips/kernel/unaligned.c @@ -1,4 +1,5 @@ -/* +/* $Id: unaligned.c,v 1.8 1999/10/10 18:49:15 ralf Exp $ + * * Handle unaligned accesses by emulation. * * This file is subject to the terms and conditions of the GNU General Public @@ -7,7 +8,7 @@ * * Copyright (C) 1996, 1998 by Ralf Baechle * - * $Id: unaligned.c,v 1.5 1999/05/01 22:40:39 ralf Exp $ + * $Id: unaligned.c,v 1.6 1999/10/09 00:00:58 ralf Exp $ * * This file contains exception handler for address error exception with the * special capability to execute faulting instructions in software. The @@ -365,19 +366,13 @@ fault: return; } - lock_kernel(); send_sig(SIGSEGV, current, 1); - unlock_kernel(); return; sigbus: - lock_kernel(); send_sig(SIGBUS, current, 1); - unlock_kernel(); return; sigill: - lock_kernel(); send_sig(SIGILL, current, 1); - unlock_kernel(); return; } @@ -407,9 +402,7 @@ asmlinkage void do_ade(struct pt_regs *regs) return; sigbus: - lock_kernel(); force_sig(SIGBUS, current); - unlock_kernel(); return; } |