[Pdbg] [PATCH 2/3] libpdbg: Make get/putmem ci argument a boolean
Joel Stanley
joel at jms.id.au
Fri May 18 17:02:01 AEST 2018
In some places it's declared as one, others it's not. It's used as one,
so lets do it.
Signed-off-by: Joel Stanley <joel at jms.id.au>
---
libpdbg/adu.c | 4 ++--
libpdbg/libpdbg.h | 6 ++++--
src/mem.c | 8 ++++----
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/libpdbg/adu.c b/libpdbg/adu.c
index 953615198fa5..4b9e8cea739d 100644
--- a/libpdbg/adu.c
+++ b/libpdbg/adu.c
@@ -83,7 +83,7 @@
#define FBC_ALTD_DATA_DONE PPC_BIT(3)
#define FBC_ALTD_PBINIT_MISSING PPC_BIT(18)
-int adu_getmem(struct pdbg_target *adu_target, uint64_t start_addr, uint8_t *output, uint64_t size, int ci)
+int adu_getmem(struct pdbg_target *adu_target, uint64_t start_addr, uint8_t *output, uint64_t size, bool ci)
{
struct adu *adu;
int rc = 0;
@@ -120,7 +120,7 @@ int adu_getmem(struct pdbg_target *adu_target, uint64_t start_addr, uint8_t *out
return rc;
}
-int adu_putmem(struct pdbg_target *adu_target, uint64_t start_addr, uint8_t *input, uint64_t size, int ci)
+int adu_putmem(struct pdbg_target *adu_target, uint64_t start_addr, uint8_t *input, uint64_t size, bool ci)
{
struct adu *adu;
int rc = 0, tsize;
diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
index 50d1f370bd6b..97d2e131ce51 100644
--- a/libpdbg/libpdbg.h
+++ b/libpdbg/libpdbg.h
@@ -1,6 +1,8 @@
#ifndef __LIBPDBG_H
#define __LIBPDBG_H
+#include <stdbool.h>
+
extern bool pdbg_expert_mode;
struct pdbg_target;
@@ -169,8 +171,8 @@ 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, int ci);
-int adu_putmem(struct pdbg_target *target, uint64_t addr, uint8_t *input, uint64_t size, int ci);
+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 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 ff22500082d7..9c2c09687b53 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -27,7 +27,7 @@
#include "progress.h"
#define PUTMEM_BUF_SIZE 1024
-static int getmem(uint64_t addr, uint64_t size, int ci)
+static int getmem(uint64_t addr, uint64_t size, bool ci)
{
struct pdbg_target *target;
uint8_t *buf;
@@ -55,7 +55,7 @@ static int getmem(uint64_t addr, uint64_t size, int ci)
return rc;
}
-static int putmem(uint64_t addr, int ci)
+static int putmem(uint64_t addr, bool ci)
{
uint8_t *buf;
int read_size, rc = 0;
@@ -142,7 +142,7 @@ int handle_mem(int optind, int argc, char *argv[])
{
uint64_t addr;
char *endptr;
- int ci = 0;
+ bool ci = false;
if (optind + 1 >= argc) {
printf("%s: command '%s' requires an address\n", argv[0], argv[optind]);
@@ -153,7 +153,7 @@ int handle_mem(int optind, int argc, char *argv[])
if (strcmp(argv[optind +1], "-ci") == 0) {
/* Set cache-inhibited flag */
- ci = 1;
+ ci = true;
}
addr = strtoull(argv[optind + 1 + ci], &endptr, 0);
--
2.17.0
More information about the Pdbg
mailing list