patch-2.4.22 linux-2.4.22/arch/sh/kernel/ptrace.c

Next file: linux-2.4.22/arch/sh/kernel/rtc-snapgear.c
Previous file: linux-2.4.22/arch/sh/kernel/process.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/arch/sh/kernel/ptrace.c linux-2.4.22/arch/sh/kernel/ptrace.c
@@ -1,4 +1,4 @@
-/* $Id: ptrace.c,v 1.13 2001/10/01 02:21:50 gniibe Exp $
+/* $Id: ptrace.c,v 1.1.1.1.2.1 2002/11/12 02:24:19 jzs Exp $
  *
  * linux/arch/sh/kernel/ptrace.c
  *
@@ -71,6 +71,8 @@
 	/* bra & bsr */
 	if (nib[0] == 0xa || nib[0] == 0xb) {
 		*pc1 = regs->pc + 4 + ((short) ((inst & 0xfff) << 4) >> 3);
+		if(*pc1 == regs->pc + 2)
+			*pc1 = regs->pc + 4;
 		*pc2 = (unsigned long) -1;
 		return;
 	}
@@ -85,7 +87,12 @@
 	/* bt/s & bf/s */
 	if (nib[0] == 0x8 && (nib[1] == 0xd || nib[1] == 0xf)) {
 		*pc1 = regs->pc + 4 + ((char) (inst & 0xff) << 1);
-		*pc2 = regs->pc + 4;
+		if(*pc1 == regs->pc + 2) {
+			*pc1 = regs->pc + 4;
+			*pc2 = (unsigned long) -1;
+		}
+		else
+			*pc2 = regs->pc + 4;
 		return;
 	}
 
@@ -93,6 +100,8 @@
 	if (nib[0] == 0x4 && nib[3] == 0xb
 	    && (nib[2] == 0x0 || nib[2] == 0x2)) {
 		*pc1 = regs->regs[nib[1]];
+		if(*pc1 == regs->pc + 2)
+			*pc1 = regs->pc + 4;
 		*pc2 = (unsigned long) -1;
 		return;
 	}
@@ -101,12 +110,16 @@
 	if (nib[0] == 0x0 && nib[3] == 0x3
 	    && (nib[2] == 0x0 || nib[2] == 0x2)) {
 		*pc1 = regs->pc + 4 + regs->regs[nib[1]];
+		if(*pc1 == regs->pc + 2)
+			*pc1 = regs->pc + 4;
 		*pc2 = (unsigned long) -1;
 		return;
 	}
 
 	if (inst == 0x000b) {
 		*pc1 = regs->pr;
+		if(*pc1 == regs->pc + 2)
+			*pc1 = regs->pc + 4;
 		*pc2 = (unsigned long) -1;
 		return;
 	}
@@ -116,37 +129,6 @@
 	return;
 }
 
-/* Tracing by user break controller.  */
-static void
-ubc_set_tracing(int asid, unsigned long nextpc1, unsigned nextpc2)
-{
-	ctrl_outl(nextpc1, UBC_BARA);
-	ctrl_outb(asid, UBC_BASRA);
-	if(UBC_TYPE_SH7729){
-		ctrl_outl(0x0fff, UBC_BAMRA);
-		ctrl_outw(BBR_INST | BBR_READ | BBR_CPU, UBC_BBRA);
-	}else{
-		ctrl_outb(BAMR_12, UBC_BAMRA);
-		ctrl_outw(BBR_INST | BBR_READ, UBC_BBRA);
-	}
-
-	if (nextpc2 != (unsigned long) -1) {
-		ctrl_outl(nextpc2, UBC_BARB);
-		ctrl_outb(asid, UBC_BASRB);
-		if(UBC_TYPE_SH7729){
-			ctrl_outl(0x0fff, UBC_BAMRB);
-			ctrl_outw(BBR_INST | BBR_READ | BBR_CPU, UBC_BBRB);
-		}else{
-			ctrl_outb(BAMR_12, UBC_BAMRB);
-			ctrl_outw(BBR_INST | BBR_READ, UBC_BBRB);
-		}
-	}
-	if(UBC_TYPE_SH7729)
-		ctrl_outl(BRCR_PCBA | BRCR_PCBB | BRCR_PCTE, UBC_BRCR);
-	else
-		ctrl_outw(BRCR_PCBA | BRCR_PCBB, UBC_BRCR);
-}
-
 /*
  * Called by kernel/ptrace.c when detaching..
  *
@@ -342,8 +324,11 @@
 		if (nextpc2 != (unsigned long) -1 && (nextpc2 & 0x80000000))
 			break;
 
-		ubc_set_tracing(child->mm->context & MMU_CONTEXT_ASID_MASK,
-				nextpc1, nextpc2);
+		/* Next scheduling will set up UBC */
+		if (child->thread.ubc_pc1 == 0)
+			ubc_usercnt += 1;
+		child->thread.ubc_pc1 = nextpc1;
+		child->thread.ubc_pc2 = nextpc2;
 
 		child->exit_code = data;
 		/* give it a chance to run. */

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