[Pdbg] [PATCH v3 5/5] main: Add getmempba/putmempba

Amitay Isaacs amitay at ozlabs.org
Thu Nov 7 13:30:44 AEDT 2019


Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 src/main.c |  6 +++++-
 src/mem.c  | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/main.c b/src/main.c
index cd5975b..785dc26 100644
--- a/src/main.c
+++ b/src/main.c
@@ -72,6 +72,7 @@ extern struct optcmd_cmd
 	optcmd_getring, optcmd_start, optcmd_stop, optcmd_step,
 	optcmd_threadstatus, optcmd_sreset, optcmd_regs, optcmd_probe,
 	optcmd_getmem, optcmd_putmem, optcmd_getmemio, optcmd_putmemio,
+	optcmd_getmempba, optcmd_putmempba,
 	optcmd_getxer, optcmd_putxer, optcmd_getcr, optcmd_putcr,
 	optcmd_gdbserver, optcmd_istep;
 
@@ -82,6 +83,7 @@ static struct optcmd_cmd *cmds[] = {
 	&optcmd_getring, &optcmd_start, &optcmd_stop, &optcmd_step,
 	&optcmd_threadstatus, &optcmd_sreset, &optcmd_regs, &optcmd_probe,
 	&optcmd_getmem, &optcmd_putmem, &optcmd_getmemio, &optcmd_putmemio,
+	&optcmd_getmempba, &optcmd_putmempba,
 	&optcmd_getxer, &optcmd_putxer, &optcmd_getcr, &optcmd_putcr,
 	&optcmd_gdbserver, &optcmd_istep,
 };
@@ -118,8 +120,10 @@ static struct action actions[] = {
 	{ "getscom", "<address>", "Read system scom" },
 	{ "putscom", "<address> <value> [<mask>]", "Write system scom" },
 	{ "getmem",  "<address> <count> [--ci] [--raw]", "Read system memory" },
+	{ "getmempba",  "<address> <count> [--ci] [--raw]", "Read system memory" },
 	{ "getmemio", "<address> <count> <block size> [--raw]", "Read memory cache inhibited with specified transfer size" },
-	{ "putmem",  "<address>", "Write to system memory" },
+	{ "putmem",  "<address> [--ci]", "Write to system memory" },
+	{ "putmempba",  "<address> [--ci]", "Write to system memory" },
 	{ "putmemio", "<address> <block size>", "Write system memory cache inhibited with specified transfer size" },
 	{ "threadstatus", "", "Print the status of a thread" },
 	{ "sreset",  "", "Reset" },
diff --git a/src/mem.c b/src/mem.c
index 0d5eb20..99a673f 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -146,6 +146,16 @@ static int getmem(uint64_t addr, uint64_t size, struct mem_flags flags)
 OPTCMD_DEFINE_CMD_WITH_FLAGS(getmem, getmem, (ADDRESS, DATA),
 			     mem_flags, (MEM_CI_FLAG, MEM_RAW_FLAG));
 
+static int getmempba(uint64_t addr, uint64_t size, struct mem_flags flags)
+{
+	if (flags.ci)
+		return _getmem("mempba", addr, size, 0, true, flags.raw);
+	else
+		return _getmem("mempba", addr, size, 0, false, flags.raw);
+}
+OPTCMD_DEFINE_CMD_WITH_FLAGS(getmempba, getmempba, (ADDRESS, DATA),
+			     mem_flags, (MEM_CI_FLAG, MEM_RAW_FLAG));
+
 static int getmemio(uint64_t addr, uint64_t size, uint8_t block_size, struct mem_io_flags flags)
 {
 	return _getmem("mem", addr, size, block_size, true, flags.raw);
@@ -206,6 +216,15 @@ static int putmem(uint64_t addr, struct mem_flags flags)
 }
 OPTCMD_DEFINE_CMD_WITH_FLAGS(putmem, putmem, (ADDRESS), mem_flags, (MEM_CI_FLAG));
 
+static int putmempba(uint64_t addr, struct mem_flags flags)
+{
+	if (flags.ci)
+		return _putmem("mempba", addr, 0, true);
+	else
+		return _putmem("mempba", addr, 0, false);
+}
+OPTCMD_DEFINE_CMD_WITH_FLAGS(putmempba, putmempba, (ADDRESS), mem_flags, (MEM_CI_FLAG));
+
 static int putmemio(uint64_t addr, uint8_t block_size)
 {
 	return _putmem("mem", addr, block_size, true);
-- 
2.21.0



More information about the Pdbg mailing list