[Pdbg] [PATCH 1/3] libpdbg: Replace register api with consistent naming

Alistair Popple alistair at popple.id.au
Thu Jul 4 14:19:18 AEST 2019


Thanks for taking this on.

Reviewed-by: Alistair Popple <alistair at popple.id.au>

On Wednesday, 3 July 2019 5:20:24 PM AEST Amitay Isaacs wrote:
> All functions to get/put registers are per thread and renamed as such.
> 
> Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
> ---
>  libpdbg/chip.c    | 98 +++++++++++++++++++++++------------------------
>  libpdbg/libpdbg.h | 29 +++++++-------
>  libpdbg/p8chip.c  | 12 +++---
>  libpdbg/p9chip.c  |  4 +-
>  src/pdbgproxy.c   | 20 +++++-----
>  src/reg.c         | 24 ++++++------
>  6 files changed, 95 insertions(+), 92 deletions(-)
> 
> diff --git a/libpdbg/chip.c b/libpdbg/chip.c
> index 10630fb..01185f6 100644
> --- a/libpdbg/chip.c
> +++ b/libpdbg/chip.c
> @@ -227,7 +227,7 @@ int ram_instructions(struct pdbg_target *thread_target,
> uint64_t *opcodes, /*
>   * Get gpr value. Chip must be stopped.
>   */
> -int ram_getgpr(struct pdbg_target *thread, int gpr, uint64_t *value)
> +int thread_getgpr(struct pdbg_target *thread, int gpr, uint64_t *value)
>  {
>  	uint64_t opcodes[] = {mtspr(277, gpr)};
>  	uint64_t results[] = {0};
> @@ -237,7 +237,7 @@ int ram_getgpr(struct pdbg_target *thread, int gpr,
> uint64_t *value) return 0;
>  }
> 
> -int ram_putgpr(struct pdbg_target *thread, int gpr, uint64_t value)
> +int thread_putgpr(struct pdbg_target *thread, int gpr, uint64_t value)
>  {
>  	uint64_t opcodes[] = {mfspr(gpr, 277)};
>  	uint64_t results[] = {value};
> @@ -247,7 +247,7 @@ int ram_putgpr(struct pdbg_target *thread, int gpr,
> uint64_t value) return 0;
>  }
> 
> -int ram_getnia(struct pdbg_target *thread, uint64_t *value)
> +int thread_getnia(struct pdbg_target *thread, uint64_t *value)
>  {
>  	uint64_t opcodes[] = {mfnia(0), mtspr(277, 0)};
>  	uint64_t results[] = {0, 0};
> @@ -264,7 +264,7 @@ int ram_getnia(struct pdbg_target *thread, uint64_t
> *value) * This is a hack and should be made much cleaner once we have
> target * specific putspr commands.
>   */
> -int ram_putnia(struct pdbg_target *thread, uint64_t value)
> +int thread_putnia(struct pdbg_target *thread, uint64_t value)
>  {
>  	uint64_t opcodes[] = {	mfspr(1, 8),	/* mflr r1 */
>  				mfspr(0, 277),	/* value -> r0 */
> @@ -277,7 +277,7 @@ int ram_putnia(struct pdbg_target *thread, uint64_t
> value) return 0;
>  }
> 
> -int ram_getspr(struct pdbg_target *thread, int spr, uint64_t *value)
> +int thread_getspr(struct pdbg_target *thread, int spr, uint64_t *value)
>  {
>  	uint64_t opcodes[] = {mfspr(0, spr), mtspr(277, 0)};
>  	uint64_t results[] = {0, 0};
> @@ -287,7 +287,7 @@ int ram_getspr(struct pdbg_target *thread, int spr,
> uint64_t *value) return 0;
>  }
> 
> -int ram_putspr(struct pdbg_target *thread, int spr, uint64_t value)
> +int thread_putspr(struct pdbg_target *thread, int spr, uint64_t value)
>  {
>  	uint64_t opcodes[] = {mfspr(0, 277), mtspr(spr, 0)};
>  	uint64_t results[] = {value, 0};
> @@ -296,7 +296,7 @@ int ram_putspr(struct pdbg_target *thread, int spr,
> uint64_t value) return 0;
>  }
> 
> -int ram_getmsr(struct pdbg_target *thread, uint64_t *value)
> +int thread_getmsr(struct pdbg_target *thread, uint64_t *value)
>  {
>  	uint64_t opcodes[] = {mfmsr(0), mtspr(277, 0)};
>  	uint64_t results[] = {0, 0};
> @@ -306,7 +306,7 @@ int ram_getmsr(struct pdbg_target *thread, uint64_t
> *value) return 0;
>  }
> 
> -int ram_getcr(struct pdbg_target *thread, uint32_t *value)
> +int thread_getcr(struct pdbg_target *thread, uint32_t *value)
>  {
> 
>  	uint64_t opcodes[] = {mfocrf(0, 0), mtspr(277, 0), mfocrf(0, 1),
> mtspr(277, 0), @@ -328,7 +328,7 @@ int ram_getcr(struct pdbg_target
> *thread, uint32_t *value) return 0;
>  }
> 
> -int ram_putcr(struct pdbg_target *thread, uint32_t value)
> +int thread_putcr(struct pdbg_target *thread, uint32_t value)
>  {
>  	uint64_t opcodes[] = {mfspr(0, 277), mtocrf(0, 0), mtocrf(1, 0),
>  			      mtocrf(2, 0), mtocrf(3, 0), mtocrf(4, 0),
> @@ -340,7 +340,7 @@ int ram_putcr(struct pdbg_target *thread, uint32_t
> value) return 0;
>  }
> 
> -int ram_putmsr(struct pdbg_target *thread, uint64_t value)
> +int thread_putmsr(struct pdbg_target *thread, uint64_t value)
>  {
>  	uint64_t opcodes[] = {mfspr(0, 277), mtmsr(0)};
>  	uint64_t results[] = {value, 0};
> @@ -349,7 +349,7 @@ int ram_putmsr(struct pdbg_target *thread, uint64_t
> value) return 0;
>  }
> 
> -int ram_getmem(struct pdbg_target *thread, uint64_t addr, uint64_t *value)
> +int thread_getmem(struct pdbg_target *thread, uint64_t addr, uint64_t
> *value) {
>  	uint64_t opcodes[] = {mfspr(0, 277), mfspr(1, 277), ld(0, 0, 1),
> mtspr(277, 0)}; uint64_t results[] = {0xdeaddeaddeaddead, addr, 0, 0};
> @@ -359,7 +359,7 @@ int ram_getmem(struct pdbg_target *thread, uint64_t
> addr, uint64_t *value) return 0;
>  }
> 
> -int ram_getxer(struct pdbg_target *thread_target, uint64_t *value)
> +int thread_getxer(struct pdbg_target *thread_target, uint64_t *value)
>  {
> 
>  	struct thread *thread;
> @@ -372,7 +372,7 @@ int ram_getxer(struct pdbg_target *thread_target,
> uint64_t *value) return 0;
>  }
> 
> -int ram_putxer(struct pdbg_target *thread_target, uint64_t value)
> +int thread_putxer(struct pdbg_target *thread_target, uint64_t value)
>  {
>  	struct thread *thread;
> 
> @@ -396,7 +396,7 @@ int getring(struct pdbg_target *chiplet_target, uint64_t
> ring_addr, uint64_t rin return chiplet->getring(chiplet, ring_addr,
> ring_len, result);
>  }
> 
> -int ram_state_thread(struct pdbg_target *thread, struct thread_regs *regs)
> +int thread_getregs(struct pdbg_target *thread, struct thread_regs *regs)
>  {
>  	struct thread_regs _regs;
>  	struct thread *t;
> @@ -417,117 +417,117 @@ int ram_state_thread(struct pdbg_target *thread,
> struct thread_regs *regs) * can help to diagnose checkstop issues with
> ramming to print as * we go. Once it's more robust and tested, maybe.
>  	 */
> -	ram_getnia(thread, &regs->nia);
> +	thread_getnia(thread, &regs->nia);
>  	printf("NIA   : 0x%016" PRIx64 "\n", regs->nia);
> 
> -	ram_getspr(thread, 28, &regs->cfar);
> +	thread_getspr(thread, 28, &regs->cfar);
>  	printf("CFAR  : 0x%016" PRIx64 "\n", regs->cfar);
> 
> -	ram_getmsr(thread, &regs->msr);
> +	thread_getmsr(thread, &regs->msr);
>  	printf("MSR   : 0x%016" PRIx64 "\n", regs->msr);
> 
> -	ram_getspr(thread, 8, &regs->lr);
> +	thread_getspr(thread, 8, &regs->lr);
>  	printf("LR    : 0x%016" PRIx64 "\n", regs->lr);
> 
> -	ram_getspr(thread, 9, &regs->ctr);
> +	thread_getspr(thread, 9, &regs->ctr);
>  	printf("CTR   : 0x%016" PRIx64 "\n", regs->ctr);
> 
> -	ram_getspr(thread, 815, &regs->tar);
> +	thread_getspr(thread, 815, &regs->tar);
>  	printf("TAR   : 0x%016" PRIx64 "\n", regs->tar);
> 
> -	ram_getcr(thread, &regs->cr);
> +	thread_getcr(thread, &regs->cr);
>  	printf("CR    : 0x%08" PRIx32 "\n", regs->cr);
> 
> -	ram_getxer(thread, &regs->xer);
> +	thread_getxer(thread, &regs->xer);
>  	printf("XER   : 0x%08" PRIx64 "\n", regs->xer);
> 
>  	printf("GPRS  :\n");
>  	for (i = 0; i < 32; i++) {
> -		ram_getgpr(thread, i, &regs->gprs[i]);
> +		thread_getgpr(thread, i, &regs->gprs[i]);
>  		printf(" 0x%016" PRIx64 "", regs->gprs[i]);
>  		if (i % 4 == 3)
>  			printf("\n");
>  	}
> 
> -	ram_getspr(thread, 318, &regs->lpcr);
> +	thread_getspr(thread, 318, &regs->lpcr);
>  	printf("LPCR  : 0x%016" PRIx64 "\n", regs->lpcr);
> 
> -	ram_getspr(thread, 464, &regs->ptcr);
> +	thread_getspr(thread, 464, &regs->ptcr);
>  	printf("PTCR  : 0x%016" PRIx64 "\n", regs->ptcr);
> 
> -	ram_getspr(thread, 319, &regs->lpidr);
> +	thread_getspr(thread, 319, &regs->lpidr);
>  	printf("LPIDR : 0x%016" PRIx64 "\n", regs->lpidr);
> 
> -	ram_getspr(thread, 48, &regs->pidr);
> +	thread_getspr(thread, 48, &regs->pidr);
>  	printf("PIDR  : 0x%016" PRIx64 "\n", regs->pidr);
> 
> -	ram_getspr(thread, 190, &regs->hfscr);
> +	thread_getspr(thread, 190, &regs->hfscr);
>  	printf("HFSCR : 0x%016" PRIx64 "\n", regs->hfscr);
> 
> -	ram_getspr(thread, 306, &value);
> +	thread_getspr(thread, 306, &value);
>  	regs->hdsisr = value;
>  	printf("HDSISR: 0x%08" PRIx32 "\n", regs->hdsisr);
> 
> -	ram_getspr(thread, 307, &regs->hdar);
> +	thread_getspr(thread, 307, &regs->hdar);
>  	printf("HDAR  : 0x%016" PRIx64 "\n", regs->hdar);
> 
> -	ram_getspr(thread, 339, &value);
> +	thread_getspr(thread, 339, &value);
>  	regs->heir = value;
>  	printf("HEIR : 0x%016" PRIx32 "\n", regs->heir);
> 
> -	ram_getspr(thread, 1008, &regs->hid);
> +	thread_getspr(thread, 1008, &regs->hid);
>  	printf("HID0 : 0x%016" PRIx64 "\n", regs->hid);
> 
> -	ram_getspr(thread, 314, &regs->hsrr0);
> +	thread_getspr(thread, 314, &regs->hsrr0);
>  	printf("HSRR0 : 0x%016" PRIx64 "\n", regs->hsrr0);
> 
> -	ram_getspr(thread, 315, &regs->hsrr1);
> +	thread_getspr(thread, 315, &regs->hsrr1);
>  	printf("HSRR1 : 0x%016" PRIx64 "\n", regs->hsrr1);
> 
> -	ram_getspr(thread, 310, &regs->hdec);
> +	thread_getspr(thread, 310, &regs->hdec);
>  	printf("HDEC  : 0x%016" PRIx64 "\n", regs->hdec);
> 
> -	ram_getspr(thread, 304, &regs->hsprg0);
> +	thread_getspr(thread, 304, &regs->hsprg0);
>  	printf("HSPRG0: 0x%016" PRIx64 "\n", regs->hsprg0);
> 
> -	ram_getspr(thread, 305, &regs->hsprg1);
> +	thread_getspr(thread, 305, &regs->hsprg1);
>  	printf("HSPRG1: 0x%016" PRIx64 "\n", regs->hsprg1);
> 
> -	ram_getspr(thread, 153, &regs->fscr);
> +	thread_getspr(thread, 153, &regs->fscr);
>  	printf("FSCR  : 0x%016" PRIx64 "\n", regs->fscr);
> 
> -	ram_getspr(thread, 18, &value);
> +	thread_getspr(thread, 18, &value);
>  	regs->dsisr = value;
>  	printf("DSISR : 0x%08" PRIx32 "\n", regs->dsisr);
> 
> -	ram_getspr(thread, 19, &regs->dar);
> +	thread_getspr(thread, 19, &regs->dar);
>  	printf("DAR   : 0x%016" PRIx64 "\n", regs->dar);
> 
> -	ram_getspr(thread, 26, &regs->srr0);
> +	thread_getspr(thread, 26, &regs->srr0);
>  	printf("SRR0  : 0x%016" PRIx64 "\n", regs->srr0);
> 
> -	ram_getspr(thread, 27, &regs->srr1);
> +	thread_getspr(thread, 27, &regs->srr1);
>  	printf("SRR1  : 0x%016" PRIx64 "\n", regs->srr1);
> 
> -	ram_getspr(thread, 22, &regs->dec);
> +	thread_getspr(thread, 22, &regs->dec);
>  	printf("DEC   : 0x%016" PRIx64 "\n", regs->dec);
> 
> -	ram_getspr(thread, 268, &regs->tb);
> +	thread_getspr(thread, 268, &regs->tb);
>  	printf("TB    : 0x%016" PRIx64 "\n", regs->tb);
> 
> -	ram_getspr(thread, 272, &regs->sprg0);
> +	thread_getspr(thread, 272, &regs->sprg0);
>  	printf("SPRG0 : 0x%016" PRIx64 "\n", regs->sprg0);
> 
> -	ram_getspr(thread, 273, &regs->sprg1);
> +	thread_getspr(thread, 273, &regs->sprg1);
>  	printf("SPRG1 : 0x%016" PRIx64 "\n", regs->sprg1);
> 
> -	ram_getspr(thread, 274, &regs->sprg2);
> +	thread_getspr(thread, 274, &regs->sprg2);
>  	printf("SPRG2 : 0x%016" PRIx64 "\n", regs->sprg2);
> 
> -	ram_getspr(thread, 275, &regs->sprg3);
> +	thread_getspr(thread, 275, &regs->sprg3);
>  	printf("SPRG3 : 0x%016" PRIx64 "\n", regs->sprg3);
> 
> -	ram_getspr(thread, 896, &regs->ppr);
> +	thread_getspr(thread, 896, &regs->ppr);
>  	printf("PPR   : 0x%016" PRIx64 "\n", regs->ppr);
> 
>  	CHECK_ERR(t->ram_destroy(t));
> diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
> index 14a41ab..ffc741a 100644
> --- a/libpdbg/libpdbg.h
> +++ b/libpdbg/libpdbg.h
> @@ -166,25 +166,28 @@ struct thread_regs {
>  	uint64_t ppr;
>  };
> 
> -int ram_putmsr(struct pdbg_target *target, uint64_t val);
> -int ram_getmem(struct pdbg_target *thread, uint64_t addr, uint64_t *value);
> -int ram_putnia(struct pdbg_target *target, uint64_t val);
> -int ram_putspr(struct pdbg_target *target, int spr, uint64_t val);
> -int ram_putgpr(struct pdbg_target *target, int spr, uint64_t val);
> -int ram_getmsr(struct pdbg_target *target, uint64_t *val);
> -int ram_getcr(struct pdbg_target *thread,  uint32_t *value);
> -int ram_putcr(struct pdbg_target *thread,  uint32_t value);
> -int ram_getnia(struct pdbg_target *target, uint64_t *val);
> -int ram_getspr(struct pdbg_target *target, int spr, uint64_t *val);
> -int ram_getgpr(struct pdbg_target *target, int gpr, uint64_t *val);
> +int thread_putmsr(struct pdbg_target *target, uint64_t val);
> +int thread_getmem(struct pdbg_target *thread, uint64_t addr, uint64_t
> *value); +int thread_putnia(struct pdbg_target *target, uint64_t val);
> +int thread_putspr(struct pdbg_target *target, int spr, uint64_t val);
> +int thread_putgpr(struct pdbg_target *target, int spr, uint64_t val);
> +int thread_getmsr(struct pdbg_target *target, uint64_t *val);
> +int thread_getcr(struct pdbg_target *thread,  uint32_t *value);
> +int thread_putcr(struct pdbg_target *thread,  uint32_t value);
> +int thread_getnia(struct pdbg_target *target, uint64_t *val);
> +int thread_getspr(struct pdbg_target *target, int spr, uint64_t *val);
> +int thread_getgpr(struct pdbg_target *target, int gpr, uint64_t *val);
> +int thread_getxer(struct pdbg_target *thread, uint64_t *value);
> +int thread_putxer(struct pdbg_target *thread, uint64_t value);
> +int thread_getregs(struct pdbg_target *target, struct thread_regs *regs);
> +
>  int ram_start_thread(struct pdbg_target *target);
>  int ram_step_thread(struct pdbg_target *target, int steps);
>  int ram_stop_thread(struct pdbg_target *target);
>  int ram_sreset_thread(struct pdbg_target *target);
>  int ram_state_thread(struct pdbg_target *target, struct thread_regs *regs);
> struct thread_state thread_status(struct pdbg_target *target);
> -int ram_getxer(struct pdbg_target *thread, uint64_t *value);
> -int ram_putxer(struct pdbg_target *thread, uint64_t value);
> +
>  int getring(struct pdbg_target *chiplet_target, uint64_t ring_addr,
> uint64_t ring_len, uint32_t result[]);
> 
>  enum pdbg_sleep_state {PDBG_THREAD_STATE_RUN, PDBG_THREAD_STATE_DOZE,
> diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c
> index ab3c142..1bf71e8 100644
> --- a/libpdbg/p8chip.c
> +++ b/libpdbg/p8chip.c
> @@ -535,8 +535,8 @@ static int emulate_sreset(struct thread *thread)
>  	printf("emulate sreset begin\n");
>  	CHECK_ERR(p8_get_hid0(chip, &hid0));
>  	printf("emulate sreset HILE=%d\n", !!(hid0 & HID0_HILE));
> -	CHECK_ERR(ram_getnia(&thread->target, &old_nia));
> -	CHECK_ERR(ram_getmsr(&thread->target, &old_msr));
> +	CHECK_ERR(thread_getnia(&thread->target, &old_nia));
> +	CHECK_ERR(thread_getmsr(&thread->target, &old_msr));
>  	new_nia = 0x100;
>  	new_msr = (old_msr & ~(MSR_PR | MSR_IR | MSR_DR | MSR_FE0 | MSR_FE1 |
> MSR_EE | MSR_RI)) | MSR_HV; if (hid0 & HID0_HILE)
> @@ -545,10 +545,10 @@ static int emulate_sreset(struct thread *thread)
>  		new_msr &= ~MSR_LE;
>  	printf("emulate sreset old NIA: 0x%016" PRIx64 " MSR: 0x%016" PRIx64 
"\n",
> old_nia, old_msr); printf("emulate sreset new NIA: 0x%016" PRIx64 " MSR:
> 0x%016" PRIx64 "\n", new_nia, new_msr);
> -	CHECK_ERR(ram_putspr(&thread->target, SPR_SRR0, old_nia));
> -	CHECK_ERR(ram_putspr(&thread->target, SPR_SRR1, old_msr));
> -	CHECK_ERR(ram_putnia(&thread->target, new_nia));
> -	CHECK_ERR(ram_putmsr(&thread->target, new_msr));
> +	CHECK_ERR(thread_putspr(&thread->target, SPR_SRR0, old_nia));
> +	CHECK_ERR(thread_putspr(&thread->target, SPR_SRR1, old_msr));
> +	CHECK_ERR(thread_putnia(&thread->target, new_nia));
> +	CHECK_ERR(thread_putmsr(&thread->target, new_msr));
>  	printf("emulate sreset done\n");
> 
>  	return 0;
> diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
> index 2933de8..f86a529 100644
> --- a/libpdbg/p9chip.c
> +++ b/libpdbg/p9chip.c
> @@ -410,14 +410,14 @@ static int p9_ram_destroy(struct thread *thread)
> 
>  static int p9_ram_getxer(struct pdbg_target *thread, uint64_t *value)
>  {
> -	CHECK_ERR(ram_getspr(thread, 1, value));
> +	CHECK_ERR(thread_getspr(thread, 1, value));
> 
>  	return 0;
>  }
> 
>  static int p9_ram_putxer(struct pdbg_target *thread, uint64_t value)
>  {
> -	CHECK_ERR(ram_putspr(thread, 1, value));
> +	CHECK_ERR(thread_putspr(thread, 1, value));
> 
>  	return 0;
> 
> diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
> index 5aabe04..c16abc8 100644
> --- a/src/pdbgproxy.c
> +++ b/src/pdbgproxy.c
> @@ -110,7 +110,7 @@ static void get_gprs(uint64_t *stack, void *priv)
>  	struct thread_regs regs;
>  	int i;
> 
> -	if(ram_state_thread(thread_target, &regs))
> +	if(thread_getregs(thread_target, &regs))
>  		PR_ERROR("Error reading gprs\n");
> 
>  	for (i = 0; i < 32; i++) {
> @@ -129,7 +129,7 @@ static void get_spr(uint64_t *stack, void *priv)
>  	switch (stack[0]) {
>  	case 0x40:
>  		/* Get PC/NIA */
> -		if (ram_getnia(thread_target, &value))
> +		if (thread_getnia(thread_target, &value))
>  			PR_ERROR("Error reading NIA\n");
>  		snprintf(data, REG_DATA_SIZE, "%016" PRIx64 , be64toh(value));
>  		send_response(fd, data);
> @@ -137,7 +137,7 @@ static void get_spr(uint64_t *stack, void *priv)
> 
>  	case 0x41:
>  		/* Get MSR */
> -		if (ram_getmsr(thread_target, &value))
> +		if (thread_getmsr(thread_target, &value))
>  			PR_ERROR("Error reading MSR\n");
>  		snprintf(data, REG_DATA_SIZE, "%016" PRIx64 , be64toh(value));
>  		send_response(fd, data);
> @@ -145,7 +145,7 @@ static void get_spr(uint64_t *stack, void *priv)
> 
>  	case 0x42:
>  		/* Get CR */
> -		if (ram_getcr(thread_target, (uint32_t *)&value))
> +		if (thread_getcr(thread_target, (uint32_t *)&value))
>  			PR_ERROR("Error reading CR \n");
>  		snprintf(data, REG_DATA_SIZE, "%016" PRIx64 , be64toh(value));
>  		send_response(fd, data);
> @@ -153,7 +153,7 @@ static void get_spr(uint64_t *stack, void *priv)
> 
>  	case 0x43:
>  		/* Get LR */
> -		if (ram_getspr(thread_target, 8, &value))
> +		if (thread_getspr(thread_target, 8, &value))
>  			PR_ERROR("Error reading LR\n");
>  		snprintf(data, REG_DATA_SIZE, "%016" PRIx64 , be64toh(value));
>  		send_response(fd, data);
> @@ -161,7 +161,7 @@ static void get_spr(uint64_t *stack, void *priv)
> 
>  	case 0x44:
>  		/* Get CTR */
> -		if (ram_getspr(thread_target, 9, &value))
> +		if (thread_getspr(thread_target, 9, &value))
>  			PR_ERROR("Error reading CTR\n");
>  		snprintf(data, REG_DATA_SIZE, "%016" PRIx64 , be64toh(value));
>  		send_response(fd, data);
> @@ -230,7 +230,7 @@ static void get_mem(uint64_t *stack, void *priv)
>  	} else {
>  		/* Virtual address */
>  		for (i = 0; i < len; i += sizeof(uint64_t)) {
> -			if (ram_getmem(thread_target, addr, &data[i/sizeof(uint64_t)])) {
> +			if (thread_getmem(thread_target, addr, &data[i/sizeof(uint64_t)])) 
{
>  				PR_ERROR("Fault reading memory\n");
>  				err = 2;
>  				break;
> @@ -353,9 +353,9 @@ static void poll(void)
>  		}
> 
>  		/* Restore NIA */
> -		if (ram_getnia(thread_target, &nia))
> +		if (thread_getnia(thread_target, &nia))
>  			PR_ERROR("Error during getnia\n");
> -		if (ram_putnia(thread_target, nia - 4))
> +		if (thread_putnia(thread_target, nia - 4))
>  			PR_ERROR("Error during putnia\n");
>  		send_response(fd, TRAP);
>  		break;
> @@ -524,7 +524,7 @@ static int gdbserver(uint16_t port)
>  	}
> 
>  	/* Check endianess in MSR */
> -	rc = ram_getmsr(thread, &msr);
> +	rc = thread_getmsr(thread, &msr);
>  	if (rc) {
>  		PR_ERROR("Couldn't read the MSR. Are all threads on this chiplet
> quiesced?\n"); return 1;
> diff --git a/src/reg.c b/src/reg.c
> index 8fdb386..cab8d4d 100644
> --- a/src/reg.c
> +++ b/src/reg.c
> @@ -69,18 +69,18 @@ static int putprocreg(struct pdbg_target *target, int
> reg, uint64_t *value) int rc;
> 
>  	if (reg == REG_MSR)
> -		rc = ram_putmsr(target, *value);
> +		rc = thread_putmsr(target, *value);
>  	else if (reg == REG_NIA)
> -		rc = ram_putnia(target, *value);
> +		rc = thread_putnia(target, *value);
>  	else if (reg == REG_XER)
> -		rc = ram_putxer(target, *value);
> +		rc = thread_putxer(target, *value);
>  	else if (reg == REG_CR) {
>  		u32 = *value;
> -		rc = ram_putcr(target, u32);
> +		rc = thread_putcr(target, u32);
>  	} else if (reg > REG_R31)
> -		rc = ram_putspr(target, reg - REG_R31, *value);
> +		rc = thread_putspr(target, reg - REG_R31, *value);
>  	else if (reg >= 0 && reg <= 31)
> -		rc = ram_putgpr(target, reg, *value);
> +		rc = thread_putgpr(target, reg, *value);
>  	else
>  		assert(0);
> 
> @@ -93,18 +93,18 @@ static int getprocreg(struct pdbg_target *target,
> uint32_t reg, uint64_t *value) int rc;
> 
>  	if (reg == REG_MSR)
> -		rc = ram_getmsr(target, value);
> +		rc = thread_getmsr(target, value);
>  	else if (reg == REG_NIA)
> -		rc = ram_getnia(target, value);
> +		rc = thread_getnia(target, value);
>  	else if (reg == REG_XER)
> -		rc = ram_getxer(target, value);
> +		rc = thread_getxer(target, value);
>  	else if (reg == REG_CR) {
> -		rc = ram_getcr(target, &u32);
> +		rc = thread_getcr(target, &u32);
>  		*value = u32;
>  	} else if (reg > REG_R31)
> -		rc = ram_getspr(target, reg - REG_R31, value);
> +		rc = thread_getspr(target, reg - REG_R31, value);
>  	else if (reg >= 0 && reg <= 31)
> -		rc = ram_getgpr(target, reg, value);
> +		rc = thread_getgpr(target, reg, value);
>  	else
>  		assert(0);




More information about the Pdbg mailing list