summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2008-03-17 00:46:52 +0000
committermarcel <marcel@FreeBSD.org>2008-03-17 00:46:52 +0000
commit380d312794fa282be783dd18924d3981aef81a7e (patch)
tree91c8d94ee8facd026d3407cb3d94dcc541920400
parent573f4ecf0d6922848232c40dd73db9663194db95 (diff)
downloadFreeBSD-src-380d312794fa282be783dd18924d3981aef81a7e.zip
FreeBSD-src-380d312794fa282be783dd18924d3981aef81a7e.tar.gz
Make remote GDB work for AIM processors. For BookE, the kernel
will have a special section, named .PPC.EMB.apuinfo, which will tell GDB that a BookE processor is targeted and which will result in GDB using a different register definition. In order to support remote GDB for BookE, we need the GDB stub in the kernel look for that section and use the BookE definitions.
-rw-r--r--sys/powerpc/include/gdb_machdep.h18
-rw-r--r--sys/powerpc/powerpc/gdb_machdep.c52
2 files changed, 27 insertions, 43 deletions
diff --git a/sys/powerpc/include/gdb_machdep.h b/sys/powerpc/include/gdb_machdep.h
index e8c5055..7e36e97 100644
--- a/sys/powerpc/include/gdb_machdep.h
+++ b/sys/powerpc/include/gdb_machdep.h
@@ -29,20 +29,32 @@
#ifndef _MACHINE_GDB_MACHDEP_H_
#define _MACHINE_GDB_MACHDEP_H_
-#define GDB_NREGS 153
+#define PPC_GDB_NREGS4 (32 + 7 + 2)
+#define PPC_GDB_NREGS8 32
+#define PPC_GDB_NREGS16 32
+
+#define GDB_NREGS (PPC_GDB_NREGS4 + PPC_GDB_NREGS8 + PPC_GDB_NREGS16)
#define GDB_REG_PC 64
-#define GDB_BUFSZ (GDB_NREGS*4)
+#define GDB_BUFSZ (PPC_GDB_NREGS4 * 8 + \
+ PPC_GDB_NREGS8 * 16 + \
+ PPC_GDB_NREGS16 * 32)
static __inline size_t
gdb_cpu_regsz(int regnum)
{
- return (sizeof(int));
+
+ if (regnum >= 32 && regnum <= 63)
+ return (8);
+ if (regnum >= 71 && regnum <= 102)
+ return (16);
+ return (4);
}
static __inline int
gdb_cpu_query(void)
{
+
return (0);
}
diff --git a/sys/powerpc/powerpc/gdb_machdep.c b/sys/powerpc/powerpc/gdb_machdep.c
index a29ff5d..ebe1250 100644
--- a/sys/powerpc/powerpc/gdb_machdep.c
+++ b/sys/powerpc/powerpc/gdb_machdep.c
@@ -53,48 +53,20 @@ gdb_cpu_getreg(int regnum, size_t *regsz)
*regsz = gdb_cpu_regsz(regnum);
if (kdb_thread == curthread) {
- switch (regnum) {
- case 0: return (&kdb_frame->fixreg[0]);
- case 2: return (&kdb_frame->fixreg[2]);
- case 3: return (&kdb_frame->fixreg[3]);
- case 4: return (&kdb_frame->fixreg[4]);
- case 5: return (&kdb_frame->fixreg[5]);
- case 6: return (&kdb_frame->fixreg[6]);
- case 7: return (&kdb_frame->fixreg[7]);
- case 8: return (&kdb_frame->fixreg[8]);
- case 9: return (&kdb_frame->fixreg[9]);
- case 10: return (&kdb_frame->fixreg[10]);
- case 11: return (&kdb_frame->fixreg[11]);
- case 12: return (&kdb_frame->fixreg[12]);
- case 13: return (&kdb_frame->fixreg[13]);
- case 64: return (&kdb_frame->srr0);
- case 67: return (&kdb_frame->lr);
-
- }
+ if (regnum == 0 || (regnum >= 2 && regnum <= 31))
+ return (kdb_frame->fixreg + regnum);
+ if (regnum == 64)
+ return (&kdb_frame->srr0);
+ if (regnum == 67)
+ return (&kdb_frame->lr);
}
- switch (regnum) {
- case 1: return (&kdb_thrctx->pcb_sp);
- case 14: return (&kdb_thrctx->pcb_context[0]);
- case 15: return (&kdb_thrctx->pcb_context[1]);
- case 16: return (&kdb_thrctx->pcb_context[2]);
- case 17: return (&kdb_thrctx->pcb_context[3]);
- case 18: return (&kdb_thrctx->pcb_context[4]);
- case 19: return (&kdb_thrctx->pcb_context[5]);
- case 20: return (&kdb_thrctx->pcb_context[6]);
- case 21: return (&kdb_thrctx->pcb_context[7]);
- case 22: return (&kdb_thrctx->pcb_context[8]);
- case 23: return (&kdb_thrctx->pcb_context[9]);
- case 24: return (&kdb_thrctx->pcb_context[10]);
- case 25: return (&kdb_thrctx->pcb_context[11]);
- case 26: return (&kdb_thrctx->pcb_context[12]);
- case 27: return (&kdb_thrctx->pcb_context[13]);
- case 28: return (&kdb_thrctx->pcb_context[14]);
- case 29: return (&kdb_thrctx->pcb_context[15]);
- case 30: return (&kdb_thrctx->pcb_context[16]);
- case 31: return (&kdb_thrctx->pcb_context[17]);
- case 64: return (&kdb_thrctx->pcb_lr);
- }
+ if (regnum == 1)
+ return (&kdb_thrctx->pcb_sp);
+ if (regnum >= 14 && regnum <= 31)
+ return (kdb_thrctx->pcb_context + (regnum - 14));
+ if (regnum == 64)
+ return (&kdb_thrctx->pcb_lr);
return (NULL);
}
OpenPOWER on IntegriCloud