summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/remote_gdb.cc16
-rw-r--r--src/base/types.hh22
2 files changed, 28 insertions, 10 deletions
diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index 68747b3d1..4a06ff307 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -645,8 +645,8 @@ BaseRemoteGDB::trap(int type)
bufferSize = gdbregs.bytes() * 2 + 256;
buffer = (char*)malloc(bufferSize);
- DPRINTF(GDBMisc, "trap: PC=%#x NPC=%#x\n",
- context->readPC(), context->readNextPC());
+ TheISA::PCState pc = context->pcState();
+ DPRINTF(GDBMisc, "trap: PC=%s\n", pc);
clearSingleStep();
@@ -806,8 +806,7 @@ BaseRemoteGDB::trap(int type)
subcmd = hex2i(&p);
if (*p++ == ';') {
val = hex2i(&p);
- context->setPC(val);
- context->setNextPC(val + sizeof(MachInst));
+ context->pcState(val);
}
clearSingleStep();
goto out;
@@ -815,8 +814,7 @@ BaseRemoteGDB::trap(int type)
case GDBCont:
if (p - data < (ptrdiff_t)datalen) {
val = hex2i(&p);
- context->setPC(val);
- context->setNextPC(val + sizeof(MachInst));
+ context->pcState(val);
}
clearSingleStep();
goto out;
@@ -825,8 +823,7 @@ BaseRemoteGDB::trap(int type)
subcmd = hex2i(&p);
if (*p++ == ';') {
val = hex2i(&p);
- context->setPC(val);
- context->setNextPC(val + sizeof(MachInst));
+ context->pcState(val);
}
setSingleStep();
goto out;
@@ -834,8 +831,7 @@ BaseRemoteGDB::trap(int type)
case GDBStep:
if (p - data < (ptrdiff_t)datalen) {
val = hex2i(&p);
- context->setPC(val);
- context->setNextPC(val + sizeof(MachInst));
+ context->pcState(val);
}
setSingleStep();
goto out;
diff --git a/src/base/types.hh b/src/base/types.hh
index 30b2d9258..5ce778572 100644
--- a/src/base/types.hh
+++ b/src/base/types.hh
@@ -67,6 +67,28 @@ const Tick MaxTick = LL(0x7fffffffffffffff);
*/
typedef uint64_t Addr;
+typedef uint16_t MicroPC;
+
+static const MicroPC MicroPCRomBit = 1 << (sizeof(MicroPC) * 8 - 1);
+
+static inline MicroPC
+romMicroPC(MicroPC upc)
+{
+ return upc | MicroPCRomBit;
+}
+
+static inline MicroPC
+normalMicroPC(MicroPC upc)
+{
+ return upc & ~MicroPCRomBit;
+}
+
+static inline bool
+isRomMicroPC(MicroPC upc)
+{
+ return MicroPCRomBit & upc;
+}
+
const Addr MaxAddr = (Addr)-1;
/**