summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-03-22 23:27:12 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-03-22 23:27:12 +0000
commit6dd778f9528c1acc17dbfca685f51bd5c3750d45 (patch)
tree45c8be9edc454b787dd06d3d4aee79dccea0a979 /arch
parentf1382dc4850bb459d24a81c6cb0ef93ea7bd4a79 (diff)
o Fix handling of interrupted syscalls.
o Just count missed heartbeats on Indys but don't print a messages. This was a bug by itself. o Fix a crash in exit_mmap(). o Fix scanmem(). o Fix clear_active_bh(), a ~ was missing causing weak performance. o Remove experimental cache instructions from stackframe.h. It wasn't improving performance as I was hoping. o Shrink the size of the exception handler routines in uaccess.h. o Cleanup, remove dead code in various files.
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/kernel/irq.c4
-rw-r--r--arch/mips/kernel/process.c15
-rw-r--r--arch/mips/kernel/signal.c23
-rw-r--r--arch/mips/kernel/traps.c45
-rw-r--r--arch/mips/mm/andes.c11
-rw-r--r--arch/mips/mm/init.c59
-rw-r--r--arch/mips/mm/loadmmu.c4
-rw-r--r--arch/mips/mm/r2300.c8
-rw-r--r--arch/mips/mm/r4xx0.c10
-rw-r--r--arch/mips/mm/r6000.c9
-rw-r--r--arch/mips/mm/tfp.c10
-rw-r--r--arch/mips/sgi/kernel/indyIRQ.S4
-rw-r--r--arch/mips/sgi/kernel/indy_timer.c8
13 files changed, 100 insertions, 110 deletions
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 55e7227e0..728af4cc9 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -4,7 +4,7 @@
* Copyright (C) 1992 Linus Torvalds
* Copyright (C) 1994, 1995, 1996, 1997 Ralf Baechle
*
- * $Id: irq.c,v 1.7 1997/12/29 11:29:33 tsbogend Exp $
+ * $Id: irq.c,v 1.8 1998/03/17 22:07:35 ralf Exp $
*/
#include <linux/errno.h>
#include <linux/init.h>
@@ -163,7 +163,7 @@ asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
} while (action);
if (do_random & SA_SAMPLE_RANDOM)
add_interrupt_randomness(irq);
- unmask_irq (irq);
+ unmask_irq (irq);
__cli();
}
irq_exit(cpu, irq);
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 941abec8f..14e896c51 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -1,13 +1,13 @@
/*
- * linux/arch/mips/kernel/process.c
+ * linux/arch/mips/kernel/process.c
*
- * Copyright (C) 1995 Ralf Baechle
+ * 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
+ * for more details.
*
- * Modified for R3000/DECStation support by Paul M. Antoine 1995, 1996
+ * Copyright (C) 1994 - 1998 by Ralf Baechle and others.
*
- * This file handles the architecture-dependent parts of initialization,
- * though it does not yet currently fully support the DECStation,
- * or R3000 - PMA.
+ * $Id: process.c,v 1.6 1998/03/21 22:37:05 ralf Exp $
*/
#include <linux/config.h>
#include <linux/errno.h>
@@ -32,9 +32,6 @@
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/elf.h>
-#ifdef CONFIG_SGI
-#include <asm/sgialib.h>
-#endif
mm_segment_t active_ds = USER_DS;
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 390c3ef2b..0e7a24766 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -4,7 +4,7 @@
* Copyright (C) 1991, 1992 Linus Torvalds
* Copyright (C) 1994, 1995, 1996 Ralf Baechle
*
- * $Id: signal.c,v 1.8 1997/12/16 05:34:37 ralf Exp $
+ * $Id: signal.c,v 1.9 1998/03/17 22:07:36 ralf Exp $
*/
#include <linux/config.h>
#include <linux/sched.h>
@@ -347,11 +347,10 @@ static inline void handle_signal(unsigned long sig, struct k_sigaction *ka,
}
}
-static inline void syscall_restart(unsigned long r0, unsigned long or2,
- unsigned long or7, struct pt_regs *regs,
- struct sigaction *sa)
+static inline void syscall_restart(unsigned long or2, unsigned long or7,
+ struct pt_regs *regs, struct sigaction *sa)
{
- switch(r0) {
+ switch(regs->regs[0]) {
case ERESTARTNOHAND:
no_system_call_restart:
regs->regs[0] = regs->regs[2] = EINTR;
@@ -371,7 +370,6 @@ extern int do_irix_signal(sigset_t *oldset, struct pt_regs *regs);
asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs)
{
- unsigned long r0 = regs->regs[0];
unsigned long r7 = regs->orig_reg7;
struct k_sigaction *ka;
siginfo_t info;
@@ -479,8 +477,8 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs)
}
}
- if (r0)
- syscall_restart(r0, regs->orig_reg2, r7, regs, &ka->sa);
+ if (regs->regs[0])
+ syscall_restart(regs->orig_reg2, r7, regs, &ka->sa);
/* Whee! Actually deliver the signal. */
handle_signal(signr, ka, &info, oldset, regs);
return 1;
@@ -491,13 +489,14 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs)
* dies here!!! The li instruction, a single machine instruction,
* must directly be followed by the syscall instruction.
*/
- if (r0 &&
- (regs->regs[2] == ERESTARTNOHAND ||
- regs->regs[2] == ERESTARTSYS ||
- regs->regs[2] == ERESTARTNOINTR)) {
+ if (regs->regs[0]) {
+ if (regs->regs[2] == ERESTARTNOHAND ||
+ regs->regs[2] == ERESTARTSYS ||
+ regs->regs[2] == ERESTARTNOINTR) {
regs->regs[0] = regs->regs[2] = regs->orig_reg2;
regs->regs[7] = r7;
regs->cp0_epc -= 8;
+ }
}
return 0;
}
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 2632e4d2d..f2ad107fa 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -8,7 +8,7 @@
* Copyright 1994, 1995, 1996, 1997 by Ralf Baechle
* Modified for R3000 by Paul M. Antoine, 1995, 1996
*
- * $Id: traps.c,v 1.6 1997/12/16 05:34:39 ralf Exp $
+ * $Id: traps.c,v 1.7 1998/03/17 22:07:38 ralf Exp $
*/
#include <linux/config.h>
#include <linux/init.h>
@@ -27,10 +27,6 @@
#include <asm/system.h>
#include <asm/uaccess.h>
-#ifdef CONFIG_SGI
-#include <asm/sgialib.h>
-#endif
-
#undef CONF_DEBUG_EXCEPTIONS
static inline void console_verbose(void)
@@ -167,18 +163,9 @@ void show_registers(char * str, struct pt_regs * regs, long err)
void die_if_kernel(const char * str, struct pt_regs * regs, long err)
{
- /*
- * Just return if in user mode.
- * XXX
- */
-#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2)
- if (!((regs)->cp0_status & 0x4))
+ if (user_mode(regs)) /* Just return if in user mode. */
return;
-#endif
-#if (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4)
- if (regs->cp0_status & ST0_KSU == KSU_USER)
- return;
-#endif
+
console_verbose();
printk("%s: %04lx\n", str, err & 0xffff);
show_regs(regs);
@@ -240,7 +227,7 @@ int unregister_fpe(void (*handler)(struct pt_regs *regs, unsigned int fcr31))
}
#endif
-void do_fpe(struct pt_regs *regs, unsigned int fcr31)
+void do_fpe(struct pt_regs *regs, unsigned long fcr31)
{
#ifdef CONFIG_MIPS_FPE_MODULE
if (fpe_handler != NULL) {
@@ -252,8 +239,20 @@ void do_fpe(struct pt_regs *regs, unsigned int fcr31)
#ifdef CONF_DEBUG_EXCEPTIONS
show_regs(regs);
#endif
- printk("Caught floating exception at epc == %08lx, fcr31 == %08x\n",
- regs->cp0_epc, fcr31);
+ if (fcr31 & 0x20000) {
+ printk("Unimplemented exception at 0x%08lx in %s.\n",
+ regs->cp0_epc, current->comm);
+ /* Retry instruction with flush to zero ... */
+ if (!(fcr31 & (1<<24))) {
+ printk("Setting flush to zero ...\n");
+ fcr31 |= (1<<24);
+ __asm__ __volatile__(
+ "ctc1\t%0,$31"
+ : /* No outputs */
+ : "r" (fcr31));
+ goto out;
+ }
+ }
if (compute_return_epc(regs))
goto out;
force_sig(SIGFPE, current);
@@ -350,16 +349,16 @@ void do_cpu(struct pt_regs *regs)
{
unsigned int cpid;
- lock_kernel();
cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
- if (cpid == 1)
- {
+ if (cpid == 1) {
regs->cp0_status |= ST0_CU1;
goto out;
}
+
+ lock_kernel();
force_sig(SIGILL, current);
-out:
unlock_kernel();
+out:
}
void do_vcei(struct pt_regs *regs)
diff --git a/arch/mips/mm/andes.c b/arch/mips/mm/andes.c
index 4ef02dfa0..529c12465 100644
--- a/arch/mips/mm/andes.c
+++ b/arch/mips/mm/andes.c
@@ -1,7 +1,9 @@
-/* $Id: andes.c,v 1.1.1.1 1997/06/01 03:16:38 ralf Exp $
+/*
* andes.c: MMU and cache operations for the R10000 (ANDES).
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ *
+ * $Id: andes.c,v 1.3 1998/03/21 08:03:53 ralf Exp $
*/
#include <linux/kernel.h>
@@ -85,6 +87,11 @@ static void andes_add_wired_entry(unsigned long entrylo0, unsigned long entrylo1
/* XXX */
}
+static void andes_user_mode(struct pt_regs *regs)
+{
+ return regs->cp0_status & ST0_KSU == KSU_USER;
+}
+
void ld_mmu_andes(void)
{
flush_cache_all = andes_flush_cache_all;
@@ -101,6 +108,8 @@ void ld_mmu_andes(void)
add_wired_entry = andes_add_wired_entry;
+ user_mode = andes_user_mode;
+
load_pgd = andes_load_pgd;
pgd_init = andes_pgd_init;
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 9cb47cefa..3e309e438 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -1,8 +1,11 @@
/*
- * arch/mips/mm/init.c
+ * 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
+ * for more details.
*
- * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
- * Ported to MIPS by Ralf Baechle
+ * Copyright (C) 1994, 1995, 1996 by Ralf Baechle
+ *
+ * $Id: init.c,v 1.4 1998/03/21 08:01:45 ralf Exp $
*/
#include <linux/config.h>
#include <linux/signal.h>
@@ -113,58 +116,12 @@ pte_t * __bad_pagetable(void)
return (pte_t *)page;
}
-static inline void
-__zeropage(unsigned long page)
-{
- unsigned long dummy1, dummy2;
-
-#if (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4)
- /*
- * Use 64bit code even for Linux/MIPS 32bit on R4000
- */
- __asm__ __volatile__(
- ".set\tnoreorder\n"
- ".set\tnoat\n\t"
- ".set\tmips3\n"
- "1:\tsd\t$0,(%0)\n\t"
- "subu\t%1,1\n\t"
- "bnez\t%1,1b\n\t"
- "addiu\t%0,8\n\t"
- ".set\tmips0\n\t"
- ".set\tat\n"
- ".set\treorder"
- :"=r" (dummy1),
- "=r" (dummy2)
- :"0" (page),
- "1" (PAGE_SIZE/8));
-#else /* (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) */
- __asm__ __volatile__(
- ".set\tnoreorder\n"
- "1:\tsw\t$0,(%0)\n\t"
- "subu\t%1,1\n\t"
- "bnez\t%1,1b\n\t"
- "addiu\t%0,4\n\t"
- ".set\treorder"
- :"=r" (dummy1),
- "=r" (dummy2)
- :"0" (page),
- "1" (PAGE_SIZE/4));
-#endif
-}
-
-static inline void
-zeropage(unsigned long page)
-{
- flush_page_to_ram(page);
- __zeropage(page);
-}
-
pte_t __bad_page(void)
{
extern char empty_bad_page[PAGE_SIZE];
unsigned long page = (unsigned long)empty_bad_page;
- zeropage(page);
+ clear_page(page);
return pte_mkdirty(mk_pte(page, PAGE_SHARED));
}
@@ -221,7 +178,7 @@ void mem_init(unsigned long start_mem, unsigned long end_mem)
high_memory = (void *)end_mem;
/* clear the zero-page */
- memset(empty_zero_page, 0, PAGE_SIZE);
+ clear_page(empty_zero_page);
/* mark usable pages in the mem_map[] */
start_mem = PAGE_ALIGN(start_mem);
diff --git a/arch/mips/mm/loadmmu.c b/arch/mips/mm/loadmmu.c
index 2f9312ab9..9f4624ba6 100644
--- a/arch/mips/mm/loadmmu.c
+++ b/arch/mips/mm/loadmmu.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
*
- * $Id: loadmmu.c,v 1.5 1998/01/13 04:39:35 ralf Exp $
+ * $Id: loadmmu.c,v 1.5 1998/03/03 16:57:25 ralf Exp $
*/
#include <linux/kernel.h>
@@ -51,6 +51,8 @@ void (*show_regs)(struct pt_regs *);
void (*add_wired_entry)(unsigned long entrylo0, unsigned long entrylo1,
unsigned long entryhi, unsigned long pagemask);
+int (*user_mode)(struct pt_regs *);
+
asmlinkage void (*resume)(void *tsk);
extern void ld_mmu_r2300(void);
diff --git a/arch/mips/mm/r2300.c b/arch/mips/mm/r2300.c
index 98dbaaf5c..822cb1a1a 100644
--- a/arch/mips/mm/r2300.c
+++ b/arch/mips/mm/r2300.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
*
- * $Id: r2300.c,v 1.2 1997/07/01 09:00:49 ralf Exp $
+ * $Id: r2300.c,v 1.3 1997/07/29 22:54:51 tsbogend Exp $
*/
#include <linux/kernel.h>
@@ -253,6 +253,11 @@ static void r2300_add_wired_entry(unsigned long entrylo0, unsigned long entrylo1
*/
}
+static int r2300_user_mode(struct pt_regs *regs)
+{
+ return !(regs->cp0_status & 0x4);
+}
+
void ld_mmu_r2300(void)
{
clear_page = r2300_clear_page;
@@ -278,5 +283,6 @@ void ld_mmu_r2300(void)
add_wired_entry = r2300_add_wired_entry;
+ user_mode = r2300_user_mode;
flush_tlb_all();
}
diff --git a/arch/mips/mm/r4xx0.c b/arch/mips/mm/r4xx0.c
index e86f3e4eb..2cd1c9236 100644
--- a/arch/mips/mm/r4xx0.c
+++ b/arch/mips/mm/r4xx0.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
*
- * $Id: r4xx0.c,v 1.12 1998/03/03 16:57:26 ralf Exp $
+ * $Id: r4xx0.c,v 1.13 1998/03/18 17:18:13 ralf Exp $
*
* To do:
*
@@ -2631,6 +2631,12 @@ static inline void setup_scache(unsigned int config)
setup_noscache_funcs();
}
+static int r4k_user_mode(struct pt_regs *regs)
+{
+ return (regs->cp0_status & ST0_KSU) == KSU_USER;
+}
+
+
void ld_mmu_r4xx0(void)
{
unsigned long config = read_32bit_cp0_register(CP0_CONFIG);
@@ -2669,6 +2675,8 @@ void ld_mmu_r4xx0(void)
add_wired_entry = r4k_add_wired_entry;
+ user_mode = r4k_user_mode;
+
flush_cache_all();
write_32bit_cp0_register(CP0_WIRED, 0);
diff --git a/arch/mips/mm/r6000.c b/arch/mips/mm/r6000.c
index 4f792fcd6..d656c897c 100644
--- a/arch/mips/mm/r6000.c
+++ b/arch/mips/mm/r6000.c
@@ -1,4 +1,4 @@
-/* $Id: r6000.c,v 1.1.1.1 1997/06/01 03:16:38 ralf Exp $
+/* $Id: r6000.c,v 1.2 1997/07/29 22:54:52 tsbogend Exp $
* r6000.c: MMU and cache routines for the R6000 processors.
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
@@ -162,6 +162,11 @@ static void r6000_add_wired_entry(unsigned long entrylo0, unsigned long entrylo1
/* XXX */
}
+static int r6000_user_mode(struct pt_regs *regs)
+{
+ return !(regs->cp0_status & 0x4);
+}
+
void ld_mmu_r6000(void)
{
flush_cache_all = r6000_flush_cache_all;
@@ -184,6 +189,8 @@ void ld_mmu_r6000(void)
add_wired_entry = r6000_add_wired_entry;
+ user_mode = r6000_user_mode;
+
flush_cache_all();
flush_tlb_all();
}
diff --git a/arch/mips/mm/tfp.c b/arch/mips/mm/tfp.c
index 04db52b98..931661f82 100644
--- a/arch/mips/mm/tfp.c
+++ b/arch/mips/mm/tfp.c
@@ -1,4 +1,4 @@
-/* $Id: tfp.c,v 1.1.1.1 1997/06/01 03:16:38 ralf Exp $
+/* $Id: tfp.c,v 1.2 1997/07/29 22:54:53 tsbogend Exp $
* tfp.c: MMU and cache routines specific to the r8000 (TFP).
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
@@ -85,6 +85,11 @@ static void tfp_add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
/* XXX */
}
+static int tfp_user_mode(struct pt_regs *regs)
+{
+ return regs->cp0_status & ST0_KSU == KSU_USER;
+}
+
void ld_mmu_tfp(void)
{
flush_cache_all = tfp_flush_cache_all;
@@ -101,10 +106,11 @@ void ld_mmu_tfp(void)
add_wired_entry = tfp_add_wired_entry;
+ user_mode = tfp_user_mode;
+
load_pgd = tfp_load_pgd;
pgd_init = tfp_pgd_init;
flush_cache_all();
flush_tlb_all();
}
-
diff --git a/arch/mips/sgi/kernel/indyIRQ.S b/arch/mips/sgi/kernel/indyIRQ.S
index 3820a172d..d6b72dfcb 100644
--- a/arch/mips/sgi/kernel/indyIRQ.S
+++ b/arch/mips/sgi/kernel/indyIRQ.S
@@ -1,4 +1,4 @@
-/* $Id: indyIRQ.S,v 1.2 1997/09/20 19:20:14 root Exp $
+/* $Id: indyIRQ.S,v 1.2 1997/12/01 17:57:37 ralf Exp $
* indyIRQ.S: Interrupt exception dispatch code for FullHouse and
* Guiness.
*
@@ -68,7 +68,6 @@
/* Wheee, a timer interrupt. */
move a0, sp
- addiu t0, s7, 1
jal indy_timer_interrupt
nop # delay slot
@@ -117,7 +116,6 @@
*/
andi a0, s0, (CAUSEF_IP4 | CAUSEF_IP5)
beq a0, zero, 1f
- addiu t0, s7, 1
/* Must be one of the 8254 timers... */
move a0, sp
diff --git a/arch/mips/sgi/kernel/indy_timer.c b/arch/mips/sgi/kernel/indy_timer.c
index 198851eed..7d9e041f3 100644
--- a/arch/mips/sgi/kernel/indy_timer.c
+++ b/arch/mips/sgi/kernel/indy_timer.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
*
- * $Id: indy_timer.c,v 1.5 1998/03/11 15:21:44 ralf Exp $
+ * $Id: indy_timer.c,v 1.6 1998/03/17 22:07:41 ralf Exp $
*/
#include <linux/errno.h>
@@ -98,6 +98,7 @@ static int set_rtc_mmss(unsigned long nowtime)
}
static long last_rtc_update = 0;
+unsigned long missed_heart_beats = 0;
void indy_timer_interrupt(struct pt_regs *regs)
{
@@ -106,9 +107,10 @@ void indy_timer_interrupt(struct pt_regs *regs)
/* Ack timer and compute new compare. */
count = read_32bit_cp0_register(CP0_COUNT);
+ /* This has races. */
if ((count - r4k_cur) >= r4k_offset) {
- printk("missed heartbeat: r4k_cur[0x%lx] count[0x%lx]\n",
- r4k_cur, count);
+ /* If this happens to often we'll need to compensate. */
+ missed_heart_beats++;
r4k_cur = count + r4k_offset;
}
else