patch-2.1.97 linux/arch/sparc/kernel/process.c

Next file: linux/arch/sparc/kernel/rtrap.S
Previous file: linux/arch/sparc/kernel/irq.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.96/linux/arch/sparc/kernel/process.c linux/arch/sparc/kernel/process.c
@@ -1,4 +1,4 @@
-/*  $Id: process.c,v 1.102 1997/12/01 03:36:31 davem Exp $
+/*  $Id: process.c,v 1.110 1998/04/08 16:15:51 jj Exp $
  *  linux/arch/sparc/kernel/process.c
  *
  *  Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -40,6 +40,7 @@
 #include <asm/elf.h>
 
 extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *);
+extern void srmmu_check_pgt_cache(void);
 
 struct task_struct *current_set[NR_CPUS] = {&init_task, };
 
@@ -62,7 +63,7 @@
 	current->priority = -100;
 	current->counter = -100;
 	for (;;) {
-		if (sparc_cpu_model == sun4c) {
+		if (ARCH_SUN4C_SUN4) {
 			static int count = HZ;
 			static unsigned long last_jiffies = 0;
 			static unsigned long last_faults = 0;
@@ -91,7 +92,9 @@
 				}
 			}
 			restore_flags(flags);
-		}
+			check_pgt_cache();
+		} else
+			srmmu_check_pgt_cache();
 		schedule();
 	}
 	ret = 0;
@@ -109,6 +112,7 @@
 
 	current->priority = -100;
 	while(1) {
+		srmmu_check_pgt_cache();
 		/*
 		 * tq_scheduler currently assumes we're running in a process
 		 * context (ie that we hold the kernel lock..)
@@ -187,12 +191,12 @@
 
 void show_regwindow(struct reg_window *rw)
 {
-	printk("l0: %08lx l1: %08lx l2: %08lx l3: %08lx\n"
+	printk("l0: %08lx l1: %08lx l2: %08lx l3: %08lx "
 	       "l4: %08lx l5: %08lx l6: %08lx l7: %08lx\n",
 	       rw->locals[0], rw->locals[1], rw->locals[2], rw->locals[3],
 	       rw->locals[4], rw->locals[5], rw->locals[6], rw->locals[7]);
-	printk("i0: %08lx i1: %08lx i2: %08lx i3: %08lx\n"
-	       "i4: %08lx i5: %08lx i6: %08lx i7: %08lx\n",
+	printk("i0: %08lx i1: %08lx i2: %08lx i3: %08lx "
+	       "i4: %08lx i5: %08lx fp: %08lx i7: %08lx\n",
 	       rw->ins[0], rw->ins[1], rw->ins[2], rw->ins[3],
 	       rw->ins[4], rw->ins[5], rw->ins[6], rw->ins[7]);
 }
@@ -201,15 +205,13 @@
 static spinlock_t sparc_backtrace_lock = SPIN_LOCK_UNLOCKED;
 #endif
 
-void show_backtrace(void)
+void __show_backtrace(unsigned long fp)
 {
 	struct reg_window *rw;
 	unsigned long flags;
-	unsigned long fp;
 	int cpu = smp_processor_id();
 
 	spin_lock_irqsave(&sparc_backtrace_lock, flags);
-	__asm__ __volatile__("mov %%i6, %0" : "=r" (fp));
 	rw = (struct reg_window *) fp;
 	while(rw) {
 		printk("CPU[%d]: ARGS[%08lx,%08lx,%08lx,%08lx,%08lx,%08lx] "
@@ -223,6 +225,31 @@
 	spin_unlock_irqrestore(&sparc_backtrace_lock, flags);
 }
 
+void show_backtrace(void)
+{
+	unsigned long fp;
+
+	__asm__ __volatile__(
+		"save %%sp, -64, %%sp\n\t"
+		"save %%sp, -64, %%sp\n\t"
+		"save %%sp, -64, %%sp\n\t"
+		"save %%sp, -64, %%sp\n\t"
+		"save %%sp, -64, %%sp\n\t"
+		"save %%sp, -64, %%sp\n\t"
+		"save %%sp, -64, %%sp\n\t"
+		"save %%sp, -64, %%sp\n\t"
+		"restore\n\t"
+		"restore\n\t"
+		"restore\n\t"
+		"restore\n\t"
+		"restore\n\t"
+		"restore\n\t"
+		"restore\n\t"
+		"restore\n\t"
+		"mov %%i6, %0" : "=r" (fp));
+	__show_backtrace(fp);
+}
+
 #ifdef __SMP__
 void smp_show_backtrace_all_cpus(void)
 {
@@ -236,15 +263,15 @@
 	unsigned long *stk;
 	int i;
 
-	printk("l0: %08lx l1: %08lx l2: %08lx l3: %08lx\n"
+	printk("l0: %08lx l1: %08lx l2: %08lx l3: %08lx "
 	       "l4: %08lx l5: %08lx l6: %08lx l7: %08lx\n",
 	       sf->locals[0], sf->locals[1], sf->locals[2], sf->locals[3],
 	       sf->locals[4], sf->locals[5], sf->locals[6], sf->locals[7]);
-	printk("i0: %08lx i1: %08lx i2: %08lx i3: %08lx\n"
-	       "i4: %08lx i5: %08lx fp: %08lx ret_pc: %08lx\n",
+	printk("i0: %08lx i1: %08lx i2: %08lx i3: %08lx "
+	       "i4: %08lx i5: %08lx fp: %08lx i7: %08lx\n",
 	       sf->ins[0], sf->ins[1], sf->ins[2], sf->ins[3],
 	       sf->ins[4], sf->ins[5], (unsigned long)sf->fp, sf->callers_pc);
-	printk("sp: %08lx x0: %08lx x1: %08lx x2: %08lx\n"
+	printk("sp: %08lx x0: %08lx x1: %08lx x2: %08lx "
 	       "x3: %08lx x4: %08lx x5: %08lx xx: %08lx\n",
 	       (unsigned long)sf->structptr, sf->xargs[0], sf->xargs[1],
 	       sf->xargs[2], sf->xargs[3], sf->xargs[4], sf->xargs[5],
@@ -265,36 +292,32 @@
 #endif
         printk("PSR: %08lx PC: %08lx NPC: %08lx Y: %08lx\n", regs->psr,
 	       regs->pc, regs->npc, regs->y);
-	printk("g0: %08lx g1: %08lx g2: %08lx g3: %08lx\n",
+	printk("g0: %08lx g1: %08lx g2: %08lx g3: %08lx ",
 	       regs->u_regs[0], regs->u_regs[1], regs->u_regs[2],
 	       regs->u_regs[3]);
 	printk("g4: %08lx g5: %08lx g6: %08lx g7: %08lx\n",
 	       regs->u_regs[4], regs->u_regs[5], regs->u_regs[6],
 	       regs->u_regs[7]);
-	printk("o0: %08lx o1: %08lx o2: %08lx o3: %08lx\n",
+	printk("o0: %08lx o1: %08lx o2: %08lx o3: %08lx ",
 	       regs->u_regs[8], regs->u_regs[9], regs->u_regs[10],
 	       regs->u_regs[11]);
-	printk("o4: %08lx o5: %08lx sp: %08lx ret_pc: %08lx\n",
+	printk("o4: %08lx o5: %08lx sp: %08lx o7: %08lx\n",
 	       regs->u_regs[12], regs->u_regs[13], regs->u_regs[14],
 	       regs->u_regs[15]);
 	show_regwindow((struct reg_window *)regs->u_regs[14]);
 }
 
+#if NOTUSED
 void show_thread(struct thread_struct *tss)
 {
 	int i;
 
-	printk("uwinmask:          0x%08lx\n", tss->uwinmask);
-	printk("kregs:             0x%08lx\n", (unsigned long)tss->kregs);
+	printk("uwinmask:          0x%08lx  kregs:             0x%08lx\n", tss->uwinmask, (unsigned long)tss->kregs);
 	show_regs(tss->kregs);
-	printk("sig_address:       0x%08lx\n", tss->sig_address);
-	printk("sig_desc:          0x%08lx\n", tss->sig_desc);
-	printk("ksp:               0x%08lx\n", tss->ksp);
-	printk("kpc:               0x%08lx\n", tss->kpc);
-	printk("kpsr:              0x%08lx\n", tss->kpsr);
-	printk("kwim:              0x%08lx\n", tss->kwim);
-	printk("fork_kpsr:         0x%08lx\n", tss->fork_kpsr);
-	printk("fork_kwim:         0x%08lx\n", tss->fork_kwim);
+	printk("sig_address:       0x%08lx  sig_desc:          0x%08lx\n", tss->sig_address, tss->sig_desc);
+	printk("ksp:               0x%08lx  kpc:               0x%08lx\n", tss->ksp, tss->kpc);
+	printk("kpsr:              0x%08lx  kwim:              0x%08lx\n", tss->kpsr, tss->kwim);
+	printk("fork_kpsr:         0x%08lx  fork_kwim:         0x%08lx\n", tss->fork_kpsr, tss->fork_kwim);
 
 	for (i = 0; i < NSWINS; i++) {
 		if (!tss->rwbuf_stkptrs[i])
@@ -306,19 +329,19 @@
 	printk("w_saved:           0x%08lx\n", tss->w_saved);
 
 	/* XXX missing: float_regs */
-	printk("fsr:               0x%08lx\n", tss->fsr);
-	printk("fpqdepth:          0x%08lx\n", tss->fpqdepth);
+	printk("fsr:               0x%08lx  fpqdepth:          0x%08lx\n", tss->fsr, tss->fpqdepth);
 	/* XXX missing: fpqueue */
 
-	printk("sstk_info.stack:   0x%08lx\n",
-	        (unsigned long)tss->sstk_info.the_stack);
-	printk("sstk_info.status:  0x%08lx\n",
-	        (unsigned long)tss->sstk_info.cur_status);
-	printk("flags:             0x%08lx\n", tss->flags);
-	printk("current_ds:        0x%08x\n", tss->current_ds);
+	printk("sstk_info.stack:   0x%08lx  sstk_info.status:  0x%08lx\n", 
+								(unsigned long)tss->sstk_info.the_stack,
+							        (unsigned long)tss->sstk_info.cur_status);
+	printk("flags:             0x%08lx  current_ds:        0x%08lx\n", tss->flags, tss->current_ds.seg);
+	
+	show_regwindow((struct reg_window *)tss->ksp);
 
 	/* XXX missing: core_exec */
 }
+#endif
 
 /*
  * Free current thread data structures etc..
@@ -367,8 +390,11 @@
 	}
 
 	/* Now, this task is no longer a kernel thread. */
-	current->tss.flags &= ~SPARC_FLAG_KTHREAD;
 	current->tss.current_ds = USER_DS;
+	if (current->tss.flags & SPARC_FLAG_KTHREAD) {
+		current->tss.flags &= ~SPARC_FLAG_KTHREAD;
+		switch_to_context(current);
+	}
 }
 
 static __inline__ void copy_regs(struct pt_regs *dst, struct pt_regs *src)
@@ -475,7 +501,7 @@
 	}
 
 	/* Calculate offset to stack_frame & pt_regs */
-	stack_offset = ((PAGE_SIZE<<1) - TRACEREG_SZ);
+	stack_offset = TASK_UNION_SIZE - TRACEREG_SZ;
 
 	if(regs->psr & PSR_PS)
 		stack_offset -= REGWIN_SZ;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov