Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jun 2004 01:15:23 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 54879 for review
Message-ID:  <200406140115.i5E1FNO4022598@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=54879

Change 54879 by marcel@marcel_nfs on 2004/06/14 01:15:08

	Port ia64 to the PCB world. This uses the new convencience foo
	in md_var.h, as well as the support for synthesized info.

Affected files ...

.. //depot/projects/gdb/usr.bin/kgdb/md_ia64.c#5 edit

Differences ...

==== //depot/projects/gdb/usr.bin/kgdb/md_ia64.c#5 (text+ko) ====

@@ -37,9 +37,11 @@
 #include <kvm.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
-#include <machine/frame.h>
 #include <machine/gdb_machdep.h>
+#include <machine/md_var.h>
+#include <machine/pcb.h>
 #include <machine/vmparam.h>
 
 #include "kgdb.h"
@@ -56,91 +58,63 @@
 void *
 gdb_cpu_getreg(int regnum, size_t *regsz)
 {
-	static uint64_t synth;
-	struct trapframe *tf = curkthr->td_frame;
-	uint64_t bspstore;
+	uint64_t bsp, cfm;
 
 	*regsz = gdb_cpu_regsz(regnum);
 	switch (regnum) {
 	/* Registers 0-127: general registers. */
-	case 1:  return (&tf->tf_special.gp);
-	case 2:  return (&tf->tf_scratch.gr2);
-	case 3:  return (&tf->tf_scratch.gr3);
-	case 8:  return (&tf->tf_scratch.gr8);
-	case 9:  return (&tf->tf_scratch.gr9);
-	case 10: return (&tf->tf_scratch.gr10);
-	case 11: return (&tf->tf_scratch.gr11);
-	case 12: return (&tf->tf_special.sp);
-	case 13: return (&tf->tf_special.tp);
-	case 14: return (&tf->tf_scratch.gr14);
-	case 15: return (&tf->tf_scratch.gr15);
-	case 16: return (&tf->tf_scratch.gr16);
-	case 17: return (&tf->tf_scratch.gr17);
-	case 18: return (&tf->tf_scratch.gr18);
-	case 19: return (&tf->tf_scratch.gr19);
-	case 20: return (&tf->tf_scratch.gr20);
-	case 21: return (&tf->tf_scratch.gr21);
-	case 22: return (&tf->tf_scratch.gr22);
-	case 23: return (&tf->tf_scratch.gr23);
-	case 24: return (&tf->tf_scratch.gr24);
-	case 25: return (&tf->tf_scratch.gr25);
-	case 26: return (&tf->tf_scratch.gr26);
-	case 27: return (&tf->tf_scratch.gr27);
-	case 28: return (&tf->tf_scratch.gr28);
-	case 29: return (&tf->tf_scratch.gr29);
-	case 30: return (&tf->tf_scratch.gr30);
-	case 31: return (&tf->tf_scratch.gr31);
+	case 1:  return (&curkthr->td_pcb->pcb_special.gp);
+	case 4:  return (&curkthr->td_pcb->pcb_preserved.gr4);
+	case 5:  return (&curkthr->td_pcb->pcb_preserved.gr5);
+	case 6:  return (&curkthr->td_pcb->pcb_preserved.gr6);
+	case 7:  return (&curkthr->td_pcb->pcb_preserved.gr7);
+	case 12: return (&curkthr->td_pcb->pcb_special.sp);
+	case 13: return (&curkthr->td_pcb->pcb_special.tp);
 	/* Registers 128-255: floating-point registers. */
-	case 134: return (&tf->tf_scratch_fp.fr6);
-	case 135: return (&tf->tf_scratch_fp.fr7);
-	case 136: return (&tf->tf_scratch_fp.fr8);
-	case 137: return (&tf->tf_scratch_fp.fr9);
-	case 138: return (&tf->tf_scratch_fp.fr10);
-	case 139: return (&tf->tf_scratch_fp.fr11);
-	case 140: return (&tf->tf_scratch_fp.fr12);
-	case 141: return (&tf->tf_scratch_fp.fr13);
-	case 142: return (&tf->tf_scratch_fp.fr14);
-	case 143: return (&tf->tf_scratch_fp.fr15);
+	case 130: return (&curkthr->td_pcb->pcb_preserved_fp.fr2);
+	case 131: return (&curkthr->td_pcb->pcb_preserved_fp.fr3);
+	case 132: return (&curkthr->td_pcb->pcb_preserved_fp.fr4);
+	case 133: return (&curkthr->td_pcb->pcb_preserved_fp.fr5);
+	case 144: return (&curkthr->td_pcb->pcb_preserved_fp.fr16);
+	case 145: return (&curkthr->td_pcb->pcb_preserved_fp.fr17);
+	case 146: return (&curkthr->td_pcb->pcb_preserved_fp.fr18);
+	case 147: return (&curkthr->td_pcb->pcb_preserved_fp.fr19);
+	case 148: return (&curkthr->td_pcb->pcb_preserved_fp.fr20);
+	case 149: return (&curkthr->td_pcb->pcb_preserved_fp.fr21);
+	case 150: return (&curkthr->td_pcb->pcb_preserved_fp.fr22);
+	case 151: return (&curkthr->td_pcb->pcb_preserved_fp.fr23);
+	case 152: return (&curkthr->td_pcb->pcb_preserved_fp.fr24);
+	case 153: return (&curkthr->td_pcb->pcb_preserved_fp.fr25);
+	case 154: return (&curkthr->td_pcb->pcb_preserved_fp.fr26);
+	case 155: return (&curkthr->td_pcb->pcb_preserved_fp.fr27);
+	case 156: return (&curkthr->td_pcb->pcb_preserved_fp.fr28);
+	case 157: return (&curkthr->td_pcb->pcb_preserved_fp.fr29);
+	case 158: return (&curkthr->td_pcb->pcb_preserved_fp.fr30);
+	case 159: return (&curkthr->td_pcb->pcb_preserved_fp.fr31);
 	/* Registers 320-327: branch registers. */
-	case 320: return (&tf->tf_special.rp);
-	case 326: return (&tf->tf_scratch.br6);
-	case 327: return (&tf->tf_scratch.br7);
+	case 321: return (&curkthr->td_pcb->pcb_preserved.br1);
+	case 322: return (&curkthr->td_pcb->pcb_preserved.br2);
+	case 323: return (&curkthr->td_pcb->pcb_preserved.br3);
+	case 324: return (&curkthr->td_pcb->pcb_preserved.br4);
+	case 325: return (&curkthr->td_pcb->pcb_preserved.br5);
 	/* Registers 328-333: misc. other registers. */
-	case 330: return (&tf->tf_special.pr);
-	case 331: return (&tf->tf_special.iip);
-	case 332: return (&tf->tf_special.psr);
-	case 333: return (&tf->tf_special.cfm);
+	case 330: return (&curkthr->td_pcb->pcb_special.pr);
+	case 331: return (&curkthr->td_pcb->pcb_special.rp);
+	case 333: return (&curkthr->td_pcb->pcb_special.pfs);
 	/* Registers 334-461: application registers. */
-	case 350: return (&tf->tf_special.rsc);
-	case 353: return (&tf->tf_special.rnat);
-	case 359: return (&tf->tf_scratch.csd);
-	case 360: return (&tf->tf_scratch.ssd);
-	case 366: return (&tf->tf_scratch.ccv);
-	case 370: return (&tf->tf_special.unat);
-	case 374: return (&tf->tf_special.fpsr);
-	case 398: return (&tf->tf_special.pfs);
-	/* Synthesized registers. */	
+	case 350: return (&curkthr->td_pcb->pcb_special.rsc);
 	case 351: /* bsp */
-		/*
-		 * If the trapframe belongs to a kernel entry from user
-		 * space, setup bspstore to point to the base of the
-		 * kernel stack.
-		 */
-		bspstore = getreg(&tf->tf_special.bspstore);
-		synth = (bspstore >= IA64_RR_BASE(5)) ? bspstore :
-		    (curkthr->td_kstack + (bspstore & 0x1ffUL));
-		synth += getreg(&tf->tf_special.ndirty);
-		return (&synth);
-	case 352: /* bspstore. */
-		/*
-		 * If the trapframe belongs to a kernel entry from user
-		 * space, setup bacpstore to point to the base of the
-		 * kernel stack.
-		 */
-		bspstore = getreg(&tf->tf_special.bspstore);
-		synth = (bspstore >= IA64_RR_BASE(5)) ? bspstore :
-		    (curkthr->td_kstack + (bspstore & 0x1ffUL));
-		return (&synth);
+	case 352: /* bspstore */
+		bsp = getreg(&curkthr->td_pcb->pcb_special.bspstore);
+		cfm = getreg(&curkthr->td_pcb->pcb_special.pfs);
+		bsp = ia64_bsp_adjust(bsp,
+		    IA64_CFM_SOF(cfm) - IA64_CFM_SOL(cfm));
+		memcpy(gdb_membuf, &bsp, sizeof(bsp));
+		return (gdb_membuf);
+	case 353: return (&curkthr->td_pcb->pcb_special.rnat);
+	case 370: return (&curkthr->td_pcb->pcb_special.unat);
+	case 374: return (&curkthr->td_pcb->pcb_special.fpsr);
+	case 399: return (&curkthr->td_pcb->pcb_preserved.lc);
 	}
 	return (NULL);
 }
@@ -157,7 +131,9 @@
 int
 gdb_cpu_query(void)
 {
+#if 0
 	uint64_t bspstore, *kstack;
+#endif
 	uintmax_t slot;
 
 	if (!gdb_rx_equal("Part:dirty:read::"))
@@ -168,6 +144,10 @@
 		return (-1);
 	}
 
+	gdb_tx_err(EINVAL);
+	return (-1);
+
+#if 0
 	/* slot is unsigned. No need to test for negative values. */
 	if (slot >= (getreg(&curkthr->td_frame->tf_special.ndirty) >> 3)) {
 		gdb_tx_err(EINVAL);
@@ -186,4 +166,5 @@
 	gdb_tx_mem((void*)(kstack + slot), 8);
 	gdb_tx_end();
 	return (1);
+#endif
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406140115.i5E1FNO4022598>