[Pdbg] [PATCH 3/3] libpdbg: Wrappers for cache inhibited adu_getmem and adu_putmem
Alistair Popple
alistair at popple.id.au
Wed May 23 15:02:06 AEST 2018
> diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
> index 97d2e131ce51..1aa851ab1c72 100644
> --- a/libpdbg/libpdbg.h
> +++ b/libpdbg/libpdbg.h
> @@ -171,8 +171,12 @@ int htm_status(struct pdbg_target *target);
> int htm_reset(struct pdbg_target *target, uint64_t *base, uint64_t *size);
> int htm_dump(struct pdbg_target *target, uint64_t size, const char *filename);
>
> -int adu_getmem(struct pdbg_target *target, uint64_t addr, uint8_t *ouput, uint64_t size, bool ci);
> -int adu_putmem(struct pdbg_target *target, uint64_t addr, uint8_t *input, uint64_t size, bool ci);
> +int adu_getmem(struct pdbg_target *target, uint64_t addr, uint8_t *ouput, uint64_t size);
> +int adu_putmem(struct pdbg_target *target, uint64_t addr, uint8_t *input, uint64_t size);
> +int adu_getmem_ci(struct pdbg_target *target, uint64_t addr, uint8_t *ouput, uint64_t size);
> +int adu_putmem_ci(struct pdbg_target *target, uint64_t addr, uint8_t *input, uint64_t size);
> +int __adu_getmem(struct pdbg_target *target, uint64_t addr, uint8_t *ouput, uint64_t size, bool ci);
> +int __adu_putmem(struct pdbg_target *target, uint64_t addr, uint8_t *input, uint64_t size, bool ci);
Do you think we should maintain these as a user callable library API? Or should
we just remove it and refactor the existing code to use the _ci versions
instead?
- Alistair
> int opb_read(struct pdbg_target *target, uint32_t addr, uint32_t *data);
> int opb_write(struct pdbg_target *target, uint32_t addr, uint32_t data);
> diff --git a/src/mem.c b/src/mem.c
> index 9c2c09687b53..22680b6a99f4 100644
> --- a/src/mem.c
> +++ b/src/mem.c
> @@ -40,7 +40,7 @@ static int getmem(uint64_t addr, uint64_t size, bool ci)
>
> pdbg_set_progress_tick(progress_tick);
> progress_init();
> - if (!adu_getmem(target, addr, buf, size, ci)) {
> + if (!__adu_getmem(target, addr, buf, size, ci)) {
> if (write(STDOUT_FILENO, buf, size) < 0)
> PR_ERROR("Unable to write stdout.\n");
> else
> @@ -73,7 +73,7 @@ static int putmem(uint64_t addr, bool ci)
> progress_init();
> do {
> read_size = read(STDIN_FILENO, buf, PUTMEM_BUF_SIZE);
> - if (adu_putmem(adu_target, addr, buf, read_size, ci)) {
> + if (__adu_putmem(adu_target, addr, buf, read_size, ci)) {
> rc = 0;
> printf("Unable to write memory.\n");
> break;
> @@ -97,7 +97,7 @@ static bool is_real_address(struct thread_regs *regs, uint64_t addr)
>
> static int load8(struct pdbg_target *target, uint64_t addr, uint64_t *value)
> {
> - if (adu_getmem(target, addr, (uint8_t *)value, 8, false)) {
> + if (adu_getmem(target, addr, (uint8_t *)value, 8)) {
> PR_ERROR("Unable to read memory address=%016" PRIx64 ".\n", addr);
> return 0;
> }
>
More information about the Pdbg
mailing list