diff rvinterf/etmsync/memcmd.c @ 977:ce0ded19a769

rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Thu, 10 Dec 2015 04:00:08 +0000
parents f50c71442d50
children
line wrap: on
line diff
--- a/rvinterf/etmsync/memcmd.c	Sun Nov 29 05:22:41 2015 +0000
+++ b/rvinterf/etmsync/memcmd.c	Thu Dec 10 04:00:08 2015 +0000
@@ -8,6 +8,7 @@
 #include <string.h>
 #include <strings.h>
 #include "etm.h"
+#include "tm3.h"
 #include "limits.h"
 #include "localtypes.h"
 #include "exitcodes.h"
@@ -58,6 +59,27 @@
 	return(0);
 }
 
+cmd_omemdump(argc, argv)
+	char **argv;
+{
+	u_char databuf[TM3_MEMREAD_MAX];
+	u32 memaddr;
+	int rc, sz, off, l;
+
+	memaddr = strtoul(argv[1], 0, 16);
+	sz = strtoul(argv[2], 0, 16);
+	rc = do_memory_read_tm3(memaddr, databuf, sz);
+	if (rc)
+		return(rc);
+	for (off = 0; off < sz; off += 16) {
+		l = sz - off;
+		if (l > 16)
+			l = 16;
+		memdump_line(memaddr + off, databuf + off, l);
+	}
+	return(0);
+}
+
 cmd_dieid()
 {
 	u_char buf[8];