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

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

diff -u --recursive --new-file v2.4.2/linux/arch/sparc64/kernel/signal.c linux/arch/sparc64/kernel/signal.c
@@ -1,4 +1,4 @@
-/*  $Id: signal.c,v 1.55 2001/01/24 21:05:13 davem Exp $
+/*  $Id: signal.c,v 1.56 2001/03/21 11:46:20 davem Exp $
  *  arch/sparc64/kernel/signal.c
  *
  *  Copyright (C) 1991, 1992  Linus Torvalds
@@ -108,6 +108,10 @@
 		recalc_sigpending(current);
 		spin_unlock_irq(&current->sigmask_lock);
 	}
+	if ((tp->flags & SPARC_FLAG_32BIT) != 0) {
+		pc &= 0xffffffff;
+		npc &= 0xffffffff;
+	}
 	regs->tpc = pc;
 	regs->tnpc = npc;
 	err |= __get_user(regs->y, &((*grp)[MC_Y]));
@@ -190,9 +194,13 @@
 	grp = &mcp->mc_gregs;
 
 	/* Skip over the trap instruction, first. */
-	regs->tpc   = regs->tnpc;
-	regs->tnpc += 4;
-
+	if ((tp->flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc   = (regs->tnpc & 0xffffffff);
+		regs->tnpc  = (regs->tnpc + 4) & 0xffffffff;
+	} else {
+		regs->tpc   = regs->tnpc;
+		regs->tnpc += 4;
+	}
 	err = 0;
 	if (_NSIG_WORDS == 1)
 		err |= __put_user(current->blocked.sig[0],
@@ -289,8 +297,13 @@
 	recalc_sigpending(current);
 	spin_unlock_irq(&current->sigmask_lock);
 	
-	regs->tpc = regs->tnpc;
-	regs->tnpc += 4;
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc = (regs->tnpc & 0xffffffff);
+		regs->tnpc = (regs->tnpc + 4) & 0xffffffff;
+	} else {
+		regs->tpc = regs->tnpc;
+		regs->tnpc += 4;
+	}
 
 	/* Condition codes and return value where set here for sigpause,
 	 * and so got used by setup_frame, which again causes sigreturn()
@@ -344,8 +357,13 @@
 	recalc_sigpending(current);
 	spin_unlock_irq(&current->sigmask_lock);
 	
-	regs->tpc = regs->tnpc;
-	regs->tnpc += 4;
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		regs->tpc = (regs->tnpc & 0xffffffff);
+		regs->tnpc = (regs->tnpc + 4) & 0xffffffff;
+	} else {
+		regs->tpc = regs->tnpc;
+		regs->tnpc += 4;
+	}
 
 	/* Condition codes and return value where set here for sigpause,
 	 * and so got used by setup_frame, which again causes sigreturn()
@@ -407,6 +425,10 @@
 
 	err = get_user(tpc, &sf->regs.tpc);
 	err |= __get_user(tnpc, &sf->regs.tnpc);
+	if ((current->thread.flags & SPARC_FLAG_32BIT) != 0) {
+		tpc &= 0xffffffff;
+		tnpc &= 0xffffffff;
+	}
 	err |= ((tpc | tnpc) & 3);
 
 	/* 2. Restore the state */
@@ -555,7 +577,10 @@
 	/* 5. 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;
+	}
 	/* 4. return to kernel instructions */
 	regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer;
 	return;

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