patch-2.4.3 linux/arch/sparc64/kernel/signal32.c

Next file: linux/arch/sparc64/kernel/smp.c
Previous file: linux/arch/sparc64/kernel/signal.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.2/linux/arch/sparc64/kernel/signal32.c linux/arch/sparc64/kernel/signal32.c
@@ -1,4 +1,4 @@
-/*  $Id: signal32.c,v 1.68 2001/01/24 21:05:13 davem Exp $
+/*  $Id: signal32.c,v 1.69 2001/03/21 11:46:20 davem Exp $
  *  arch/sparc64/kernel/signal32.c
  *
  *  Copyright (C) 1991, 1992  Linus Torvalds
@@ -155,6 +155,10 @@
 	
 	regs->tpc = regs->tnpc;
 	regs->tnpc += 4;
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc &= 0xffffffff;
+		regs->tnpc &= 0xffffffff;
+	}
 
 	/* Condition codes and return value where set here for sigpause,
 	 * and so got used by setup_frame, which again causes sigreturn()
@@ -206,6 +210,10 @@
 	
 	regs->tpc = regs->tnpc;
 	regs->tnpc += 4;
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc &= 0xffffffff;
+		regs->tnpc &= 0xffffffff;
+	}
 
 	/* Condition codes and return value where set here for sigpause,
 	 * and so got used by setup_frame, which again causes sigreturn()
@@ -268,6 +276,10 @@
 	if ((pc | npc) & 3)
 		goto segv;
 
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		pc &= 0xffffffff;
+		npc &= 0xffffffff;
+	}
 	regs->tpc = pc;
 	regs->tnpc = npc;
 
@@ -355,6 +367,10 @@
 	recalc_sigpending(current);
 	spin_unlock_irq(&current->sigmask_lock);
 	
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		pc &= 0xffffffff;
+		npc &= 0xffffffff;
+	}
 	regs->tpc = pc;
 	regs->tnpc = npc;
 	err = __get_user(regs->u_regs[UREG_FP], &scptr->sigc_sp);
@@ -398,6 +414,10 @@
 	if ((pc | npc) & 3)
 		goto segv;
 
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		pc &= 0xffffffff;
+		npc &= 0xffffffff;
+	}
 	regs->tpc = pc;
 	regs->tnpc = npc;
 
@@ -489,6 +509,11 @@
 #endif	
 	unsigned psr;
 
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		pc &= 0xffffffff;
+		npc &= 0xffffffff;
+	}
+
 	synchronize_user_stack();
 	save_and_clear_fpu();
 
@@ -615,6 +640,10 @@
 	regs->u_regs[UREG_FP] = (unsigned long) sframep;
 	regs->tpc = (unsigned long) sa->sa_handler;
 	regs->tnpc = (regs->tpc + 4);
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc &= 0xffffffff;
+		regs->tnpc &= 0xffffffff;
+	}
 	return;
 
 sigsegv:
@@ -678,6 +707,10 @@
 	}
 
 	/* 2. Save the current process state */
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc &= 0xffffffff;
+		regs->tnpc &= 0xffffffff;
+	}
 	err  = put_user(regs->tpc, &sf->info.si_regs.pc);
 	err |= __put_user(regs->tnpc, &sf->info.si_regs.npc);
 	err |= __put_user(regs->y, &sf->info.si_regs.y);
@@ -728,11 +761,15 @@
 	/* 4. signal handler */
 	regs->tpc = (unsigned long) ka->sa.sa_handler;
 	regs->tnpc = (regs->tpc + 4);
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc &= 0xffffffff;
+		regs->tnpc &= 0xffffffff;
+	}
 
 	/* 5. return to kernel instructions */
-	if (ka->ka_restorer)
+	if (ka->ka_restorer) {
 		regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer;
-	else {
+	} else {
 		/* Flush instruction space. */
 		unsigned long address = ((unsigned long)&(sf->insns[0]));
 		pgd_t *pgdp = pgd_offset(current->mm, address);
@@ -819,6 +856,10 @@
 		err |= __copy_to_user(&uc->sigmask, &setv, 2 * sizeof(unsigned));
 	
 	/* Store registers */
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc &= 0xffffffff;
+		regs->tnpc &= 0xffffffff;
+	}
 	err |= __put_user(regs->tpc, &((*gr) [SVR4_PC]));
 	err |= __put_user(regs->tnpc, &((*gr) [SVR4_NPC]));
 	psr = tstate_to_psr (regs->tstate);
@@ -883,6 +924,10 @@
 	regs->u_regs[UREG_FP] = (unsigned long) sfp;
 	regs->tpc = (unsigned long) sa->sa_handler;
 	regs->tnpc = (regs->tpc + 4);
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc &= 0xffffffff;
+		regs->tnpc &= 0xffffffff;
+	}
 
 #ifdef DEBUG_SIGNALS
 	printk ("Solaris-frame: %x %x\n", (int) regs->tpc, (int) regs->tnpc);
@@ -940,6 +985,10 @@
 		err |= __copy_to_user(&uc->sigmask, &setv, 2 * sizeof(unsigned));
 
 	/* Store registers */
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc &= 0xffffffff;
+		regs->tnpc &= 0xffffffff;
+	}
 	err |= __put_user(regs->tpc, &uc->mcontext.greg [SVR4_PC]);
 	err |= __put_user(regs->tnpc, &uc->mcontext.greg [SVR4_NPC]);
 #if 1
@@ -1037,6 +1086,10 @@
 	spin_unlock_irq(&current->sigmask_lock);
 	regs->tpc = pc;
 	regs->tnpc = npc | 1;
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc &= 0xffffffff;
+		regs->tnpc &= 0xffffffff;
+	}
 	err |= __get_user(regs->y, &((*gr) [SVR4_Y]));
 	err |= __get_user(psr, &((*gr) [SVR4_PSR]));
 	regs->tstate &= ~(TSTATE_ICC|TSTATE_XCC);
@@ -1095,6 +1148,10 @@
 	}
 
 	/* 2. Save the current process state */
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc &= 0xffffffff;
+		regs->tnpc &= 0xffffffff;
+	}
 	err  = put_user(regs->tpc, &sf->regs.pc);
 	err |= __put_user(regs->tnpc, &sf->regs.npc);
 	err |= __put_user(regs->y, &sf->regs.y);
@@ -1150,6 +1207,10 @@
 	/* 4. signal handler */
 	regs->tpc = (unsigned long) ka->sa.sa_handler;
 	regs->tnpc = (regs->tpc + 4);
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc &= 0xffffffff;
+		regs->tnpc &= 0xffffffff;
+	}
 
 	/* 5. return to kernel instructions */
 	if (ka->ka_restorer)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)