PERFORCE change 30748 for review

Marcel Moolenaar marcel at FreeBSD.org
Wed May 7 22:56:56 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=30748

Change 30748 by marcel at marcel_nfs on 2003/05/07 22:56:19

	Re-implement db_get_rse_reg() and db_register_value().

Affected files ...

.. //depot/projects/ia64_epc/sys/ia64/ia64/db_interface.c#6 edit

Differences ...

==== //depot/projects/ia64_epc/sys/ia64/ia64/db_interface.c#6 (text+ko) ====

@@ -228,33 +228,28 @@
 static int
 db_get_rse_reg(struct db_variable *vp, db_expr_t *valuep, int op)
 {
-	int sof = ddb_regs.tf_special.cfm & 0x7f;
-	int regno = (db_expr_t) vp->valuep;
-#if 0
-	u_int64_t *bsp;
 	u_int64_t *reg;
-#endif
+	uint64_t bsp;
+	int nats, regno, sof;
+
+	bsp = ddb_regs.tf_special.bspstore + ddb_regs.tf_special.ndirty;
+	regno = (db_expr_t)vp->valuep - 32;
+	sof = ddb_regs.tf_special.cfm & 0x7f;
+	nats = (sof - regno + 62 - ((bsp >> 3) & 0x3f)) / 63;
+
+	reg = (void*)(bsp - ((sof - regno + nats) << 3));
 
-	if (regno - 32 >= sof) {
-		if (op == DB_VAR_GET)
-			*valuep = 0xdeadbeefdeadbeef;
-	} else {
-#if 0
-		bsp = (u_int64_t *)(ddb_regs.tf_special.bspstore +
-		    ddb_regs.tf_special.ndirty);
-		bsp = ia64_rse_previous_frame(bsp, sof);
-		reg = ia64_rse_register_address(bsp, regno);
+	if (regno < sof) {
 		if (op == DB_VAR_GET)
 			*valuep = *reg;
 		else
 			*reg = *valuep;
-#else
+	} else {
 		if (op == DB_VAR_GET)
 			*valuep = 0xdeadbeefdeadbeef;
-#endif
 	}
 
-	return 0;
+	return (0);
 }
 
 static int
@@ -451,36 +446,38 @@
 	db_regs_t *regs;
 	int regno;
 {
-
-	if (regno > 127 || regno < 0) {
-		db_printf(" **** STRANGE REGISTER NUMBER %d **** ", regno);
-		return (0);
-	}
+	uint64_t *rsp;
+	uint64_t bsp;
+	int nats, sof;
 
 	if (regno == 0)
 		return (0);
+	if (regno == 1)
+		return (regs->tf_special.gp);
+	if (regno >= 2 && regno <= 3)
+		return ((&regs->tf_scratch.gr2)[regno - 2]);
+	if (regno >= 8 && regno <= 11)
+		return ((&regs->tf_scratch.gr8)[regno - 8]);
+	if (regno == 12)
+		return (regs->tf_special.sp);
+	if (regno == 13)
+		return (regs->tf_special.tp);
+	if (regno >= 14 && regno <= 31)
+		return ((&regs->tf_scratch.gr14)[regno - 14]);
 
-	if (regno < 32) {
+	if (regno > 0 && regno < 128) {
+		bsp = regs->tf_special.bspstore + regs->tf_special.ndirty;
+		regno -= 32;
+		sof = regs->tf_special.cfm & 0x7f;
+		nats = (sof - regno + 62 - ((bsp >> 3) & 0x3f)) / 63;
+		rsp = (void*)(bsp - ((sof - regno + nats) << 3));
+		if (regno < sof)
+			return (*rsp);
 		return (0xdeadbeefdeadbeef);
-		/* return (regs->tf_r[regno - 1]); */
-	} else {
-#if 0
-		int sof = ddb_regs.tf_special.cfm & 0x7f;
-		u_int64_t *bsp = (u_int64_t *)(ddb_regs.tf_special.bspstore +
-		    ddb_regs.tf_special.ndirty);
-		u_int64_t *reg;
+	}
 
-		if (regno - 32 >= sof) {
-			return 0xdeadbeefdeadbeef;
-		} else {
-			bsp = ia64_rse_previous_frame(bsp, sof);
-			reg = ia64_rse_register_address(bsp, regno);
-			return *reg;
-		}
-#else
-		return 0xdeadbeefdeadbeef;
-#endif
-	}
+	db_printf(" **** STRANGE REGISTER NUMBER %d **** ", regno + 32);
+	return (0);
 }
 
 void


More information about the p4-projects mailing list