[PATCH] ssb fix for KDB

Nitin Vashisth nitin at in.ibm.com
Thu Apr 8 16:05:40 EST 2004


Hello,

Here is a patch to fix single step till branch command in kdb.


Best Regards,

Nitin.
--
Nitin Vashisth
Linux Technology Center
IBM Software Lab
Bangalore, INDIA

Direct 91-80-2504 4611
Board 91-80-2526 2355 / 7117 Extension 3611.

diff -Narup ameslab/arch/ppc64/kdb/kdba_bp.c
ameslab-new/arch/ppc64/kdb/kdba_bp.c
--- ameslab/arch/ppc64/kdb/kdba_bp.c	2004-03-22 14:17:52.000000000 +0530
+++ ameslab-new/arch/ppc64/kdb/kdba_bp.c	2004-04-06 13:32:53.000000000
+0530
@@ -152,27 +152,27 @@ kdba_db_trap(kdb_eframe_t ef, int error_
 		/* single step */
 		rv = KDB_DB_SS;		/* Indicate single step */
 		if (KDB_STATE(DOING_SSB)) {
-		    unsigned long instruction;
+			unsigned long instruction;

 			kdb_id1(ef->nip);
 			kdb_getarea(instruction,ef->nip);
-			primary=instruction & 0xfc000000;
-			extended=instruction & 0x000007fe;
-			if (kdb_getarea(instruction, ef->nip) ||   /* read failure */
-/* branch conditional */
-			    (primary==16 )||
-/* branch */
-			    (primary==18 )||
-/* branch conditional to LR, or branch conditional to CR */
-			    (primary==19 && (extended==16 || extended == 528)
-			     )) {
+			primary=instruction & 0xfc00000000000000;
+			extended=instruction & 0x000007fe00000000;
+			if ((primary == 0x4800000000000000) ||
+					(primary == 0x4000000000000000) ||
+					((primary == 0x4c00000000000000) &&
+					((extended == 0x0000042000000000) ||
+					 (extended == 0x0000002000000000)))) {
 				/*
 				 * End the ssb command here.
 				 */
-			    KDB_STATE_CLEAR(DOING_SSB);
-			    KDB_STATE_CLEAR(DOING_SS);
-			    }
-			rv = KDB_DB_SSB; /* Indicate ssb - dismiss immediately */
+				KDB_STATE_CLEAR(DOING_SSB);
+				KDB_STATE_CLEAR(DOING_SS);
+			} else {
+				char *argv[] = {"ssb", NULL};
+				rv = KDB_DB_SSB; /* Indicate ssb - dismiss immediately */
+				kdb_ss(0, (char **)argv, NULL, ef);
+			}
 		} else {
 			/*
 			 * Print current insn
diff -Narup ameslab/arch/ppc64/kdb/kdbasupport.c
ameslab-new/arch/ppc64/kdb/kdbasupport.c
--- ameslab/arch/ppc64/kdb/kdbasupport.c	2004-03-22 14:17:52.000000000
+0530
+++ ameslab-new/arch/ppc64/kdb/kdbasupport.c	2004-04-06
12:02:59.000000000 +0530
@@ -548,8 +548,9 @@ kdba_setsinglestep(struct pt_regs *regs)
 void
 kdba_clearsinglestep(struct pt_regs *regs)
 {
-
-	regs->msr &= ~MSR_SE;
+	if (!KDB_STATE(DOING_SSB)) {
+		regs->msr &= ~MSR_SE;
+	}
 }

 int


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list