PERFORCE change 64659 for review

Peter Wemm peter at FreeBSD.org
Mon Nov 8 17:50:03 PST 2004


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

Change 64659 by peter at peter_daintree on 2004/11/09 01:49:57

	converge towards i386.  I don't understand this stuff.

Affected files ...

.. //depot/projects/hammer/sys/amd64/amd64/gdb_machdep.c#4 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/amd64/gdb_machdep.c#4 (text+ko) ====

@@ -36,6 +36,7 @@
 
 #include <machine/frame.h>
 #include <machine/gdb_machdep.h>
+#include <machine/pcb.h>
 #include <machine/psl.h>
 #include <machine/reg.h>
 #include <machine/trap.h>
@@ -47,40 +48,45 @@
 void *
 gdb_cpu_getreg(int regnum, size_t *regsz)
 {
-	struct trapframe *tf = kdb_frame;
 
 	*regsz = gdb_cpu_regsz(regnum);
 
-	/* XXX this stuff is mighty suspicious */
 	if (kdb_thread  == curthread) {
 		switch (regnum) {
-		case 0:	return (&tf->tf_rax);
-		case 1:	return (&tf->tf_rcx);
-		case 2:	return (&tf->tf_rdx);
+		case 0:	return (&kdb_frame->tf_rax);
+		case 1:	return (&kdb_frame->tf_rcx);
+		case 2:	return (&kdb_frame->tf_rdx);
 		}
 	}
-	/* i386 uses kdb_thrctx, a pcb for these */
 	switch (regnum) {
-	case 0:  return (&tf->tf_rax);
-	case 1:  return (&tf->tf_rbx);
-	case 2:  return (&tf->tf_rcx);
-	case 3:  return (&tf->tf_rdx);
-	case 4:  return (&tf->tf_rsi);
-	case 5:  return (&tf->tf_rdi);
-	case 6:  return (&tf->tf_rbp);
-	case 7:  return (&tf->tf_rsp);
-	case 8:  return (&tf->tf_r8);
-	case 9:  return (&tf->tf_r9);
-	case 10: return (&tf->tf_r10);
-	case 11: return (&tf->tf_r11);
-	case 12: return (&tf->tf_r12);
-	case 13: return (&tf->tf_r13);
-	case 14: return (&tf->tf_r14);
-	case 15: return (&tf->tf_r15);
-	case 16: return (&tf->tf_rip);
-	case 17: return (&tf->tf_rflags);
-	case 18: return (&tf->tf_cs);
-	case 19: return (&tf->tf_ss);
+#if 0
+	case 0:  return (&kdb_thrctx->pcb_rax);
+#endif
+	case 1:  return (&kdb_thrctx->pcb_rbx);
+#if 0
+	case 2:  return (&kdb_thrctx->pcb_rcx);
+	case 3:  return (&kdb_thrctx->pcb_rdx);
+	case 4:  return (&kdb_thrctx->pcb_rsi);
+	case 5:  return (&kdb_thrctx->pcb_rdi);
+#endif
+	case 6:  return (&kdb_thrctx->pcb_rbp);
+	case 7:  return (&kdb_thrctx->pcb_rsp);
+#if 0
+	case 8:  return (&kdb_thrctx->pcb_r8);
+	case 9:  return (&kdb_thrctx->pcb_r9);
+	case 10: return (&kdb_thrctx->pcb_r10);
+	case 11: return (&kdb_thrctx->pcb_r11);
+#endif
+	case 12: return (&kdb_thrctx->pcb_r12);
+	case 13: return (&kdb_thrctx->pcb_r13);
+	case 14: return (&kdb_thrctx->pcb_r14);
+	case 15: return (&kdb_thrctx->pcb_r15);
+	case 16: return (&kdb_thrctx->pcb_rip);
+	case 17: return (&kdb_thrctx->pcb_rflags);
+#if 0
+	case 18: return (&kdb_thrctx->pcb_cs);
+	case 19: return (&kdb_thrctx->pcb_ss);
+#endif
 	}
 	return (NULL);
 }
@@ -88,12 +94,12 @@
 void
 gdb_cpu_setreg(int regnum, register_t val)
 {
-	struct trapframe *tf = kdb_frame;
 
 	val = __bswap64(val);
 	switch (regnum) {
 	case GDB_REG_PC:
+		kdb_thrctx->pcb_rip = val;
 		if (kdb_thread  == curthread)
-			tf->tf_rip = val;
+			kdb_frame->tf_rip = val;
 	}
 }


More information about the p4-projects mailing list