@@ -25,6 +25,7 @@
#include "operations.h"
#include "bitutils.h"
#include "debug.h"
+#include "sprs.h"
uint64_t mfspr(uint64_t reg, uint64_t spr)
{
@@ -559,16 +560,16 @@ int thread_getregs(struct pdbg_target *target, struct thread_regs *regs)
thread_getnia(target, ®s->nia);
printf("NIA : 0x%016" PRIx64 "\n", regs->nia);
- thread_getspr(target, 28, ®s->cfar);
+ thread_getspr(target, SPR_CFAR, ®s->cfar);
printf("CFAR : 0x%016" PRIx64 "\n", regs->cfar);
thread_getmsr(target, ®s->msr);
printf("MSR : 0x%016" PRIx64 "\n", regs->msr);
- thread_getspr(target, 8, ®s->lr);
+ thread_getspr(target, SPR_LR, ®s->lr);
printf("LR : 0x%016" PRIx64 "\n", regs->lr);
- thread_getspr(target, 9, ®s->ctr);
+ thread_getspr(target, SPR_CTR, ®s->ctr);
printf("CTR : 0x%016" PRIx64 "\n", regs->ctr);
thread_getspr(target, 815, ®s->tar);
@@ -588,85 +589,85 @@ int thread_getregs(struct pdbg_target *target, struct thread_regs *regs)
printf("\n");
}
- thread_getspr(target, 318, ®s->lpcr);
+ thread_getspr(target, SPR_LPCR, ®s->lpcr);
printf("LPCR : 0x%016" PRIx64 "\n", regs->lpcr);
- thread_getspr(target, 464, ®s->ptcr);
+ thread_getspr(target, SPR_PTCR, ®s->ptcr);
printf("PTCR : 0x%016" PRIx64 "\n", regs->ptcr);
- thread_getspr(target, 319, ®s->lpidr);
+ thread_getspr(target, SPR_LPIDR, ®s->lpidr);
printf("LPIDR : 0x%016" PRIx64 "\n", regs->lpidr);
- thread_getspr(target, 48, ®s->pidr);
+ thread_getspr(target, SPR_PIDR, ®s->pidr);
printf("PIDR : 0x%016" PRIx64 "\n", regs->pidr);
- thread_getspr(target, 190, ®s->hfscr);
+ thread_getspr(target, SPR_HFSCR, ®s->hfscr);
printf("HFSCR : 0x%016" PRIx64 "\n", regs->hfscr);
- thread_getspr(target, 306, &value);
+ thread_getspr(target, SPR_HDSISR, &value);
regs->hdsisr = value;
printf("HDSISR: 0x%08" PRIx32 "\n", regs->hdsisr);
- thread_getspr(target, 307, ®s->hdar);
+ thread_getspr(target, SPR_HDAR, ®s->hdar);
printf("HDAR : 0x%016" PRIx64 "\n", regs->hdar);
- thread_getspr(target, 339, &value);
+ thread_getspr(target, SPR_HEIR, &value);
regs->heir = value;
printf("HEIR : 0x%016" PRIx32 "\n", regs->heir);
- thread_getspr(target, 1008, ®s->hid);
+ thread_getspr(target, SPR_HID, ®s->hid);
printf("HID0 : 0x%016" PRIx64 "\n", regs->hid);
- thread_getspr(target, 314, ®s->hsrr0);
+ thread_getspr(target, SPR_HSRR0, ®s->hsrr0);
printf("HSRR0 : 0x%016" PRIx64 "\n", regs->hsrr0);
- thread_getspr(target, 315, ®s->hsrr1);
+ thread_getspr(target, SPR_HSRR1, ®s->hsrr1);
printf("HSRR1 : 0x%016" PRIx64 "\n", regs->hsrr1);
- thread_getspr(target, 310, ®s->hdec);
+ thread_getspr(target, SPR_HDEC, ®s->hdec);
printf("HDEC : 0x%016" PRIx64 "\n", regs->hdec);
- thread_getspr(target, 304, ®s->hsprg0);
+ thread_getspr(target, SPR_HSPRG0, ®s->hsprg0);
printf("HSPRG0: 0x%016" PRIx64 "\n", regs->hsprg0);
- thread_getspr(target, 305, ®s->hsprg1);
+ thread_getspr(target, SPR_HSPRG1, ®s->hsprg1);
printf("HSPRG1: 0x%016" PRIx64 "\n", regs->hsprg1);
- thread_getspr(target, 153, ®s->fscr);
+ thread_getspr(target, SPR_FSCR, ®s->fscr);
printf("FSCR : 0x%016" PRIx64 "\n", regs->fscr);
- thread_getspr(target, 18, &value);
+ thread_getspr(target, SPR_DSISR, &value);
regs->dsisr = value;
printf("DSISR : 0x%08" PRIx32 "\n", regs->dsisr);
- thread_getspr(target, 19, ®s->dar);
+ thread_getspr(target, SPR_DAR, ®s->dar);
printf("DAR : 0x%016" PRIx64 "\n", regs->dar);
- thread_getspr(target, 26, ®s->srr0);
+ thread_getspr(target, SPR_SRR0, ®s->srr0);
printf("SRR0 : 0x%016" PRIx64 "\n", regs->srr0);
- thread_getspr(target, 27, ®s->srr1);
+ thread_getspr(target, SPR_SRR1, ®s->srr1);
printf("SRR1 : 0x%016" PRIx64 "\n", regs->srr1);
- thread_getspr(target, 22, ®s->dec);
+ thread_getspr(target, SPR_DEC, ®s->dec);
printf("DEC : 0x%016" PRIx64 "\n", regs->dec);
- thread_getspr(target, 268, ®s->tb);
+ thread_getspr(target, SPR_TB, ®s->tb);
printf("TB : 0x%016" PRIx64 "\n", regs->tb);
- thread_getspr(target, 272, ®s->sprg0);
+ thread_getspr(target, SPR_SPRG0, ®s->sprg0);
printf("SPRG0 : 0x%016" PRIx64 "\n", regs->sprg0);
- thread_getspr(target, 273, ®s->sprg1);
+ thread_getspr(target, SPR_SPRG1, ®s->sprg1);
printf("SPRG1 : 0x%016" PRIx64 "\n", regs->sprg1);
- thread_getspr(target, 274, ®s->sprg2);
+ thread_getspr(target, SPR_SPRG2, ®s->sprg2);
printf("SPRG2 : 0x%016" PRIx64 "\n", regs->sprg2);
- thread_getspr(target, 275, ®s->sprg3);
+ thread_getspr(target, SPR_SPRG3, ®s->sprg3);
printf("SPRG3 : 0x%016" PRIx64 "\n", regs->sprg3);
- thread_getspr(target, 896, ®s->ppr);
+ thread_getspr(target, SPR_PPR, ®s->ppr);
printf("PPR : 0x%016" PRIx64 "\n", regs->ppr);
CHECK_ERR(thread->ram_destroy(thread));
@@ -25,6 +25,7 @@
#include "operations.h"
#include "bitutils.h"
#include "debug.h"
+#include "sprs.h"
#define RAS_STATUS_TIMEOUT 100
@@ -509,9 +510,6 @@ static int p8_ram_putxer(struct thread *thread, uint64_t value)
return 0;
}
-#define SPR_SRR0 0x01a
-#define SPR_SRR1 0x01b
-
#define HID0_HILE PPC_BIT(19)
#define MSR_HV PPC_BIT(3) /* Hypervisor mode */
@@ -24,6 +24,7 @@
#include "operations.h"
#include "bitutils.h"
#include "debug.h"
+#include "sprs.h"
/*
* NOTE!
@@ -406,14 +407,14 @@ static int p9_ram_destroy(struct thread *thread)
static int p9_ram_getxer(struct thread *thread, uint64_t *value)
{
- CHECK_ERR(thread_getspr(&thread->target, 1, value));
+ CHECK_ERR(thread_getspr(&thread->target, SPR_XER, value));
return 0;
}
static int p9_ram_putxer(struct thread *thread, uint64_t value)
{
- CHECK_ERR(thread_putspr(&thread->target, 1, value));
+ CHECK_ERR(thread_putspr(&thread->target, SPR_XER, value));
return 0;
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- libpdbg/chip.c | 59 ++++++++++++++++++++++++------------------------ libpdbg/p8chip.c | 4 +--- libpdbg/p9chip.c | 5 ++-- 3 files changed, 34 insertions(+), 34 deletions(-)