FreeCalypso > hg > freecalypso-sw
comparison 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 |
comparison
equal
deleted
inserted
replaced
976:ca65f5adf1af | 977:ce0ded19a769 |
---|---|
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <strings.h> | 9 #include <strings.h> |
10 #include "etm.h" | 10 #include "etm.h" |
11 #include "tm3.h" | |
11 #include "limits.h" | 12 #include "limits.h" |
12 #include "localtypes.h" | 13 #include "localtypes.h" |
13 #include "exitcodes.h" | 14 #include "exitcodes.h" |
14 | 15 |
15 static void | 16 static void |
56 memdump_line(memaddr + off, databuf + off, l); | 57 memdump_line(memaddr + off, databuf + off, l); |
57 } | 58 } |
58 return(0); | 59 return(0); |
59 } | 60 } |
60 | 61 |
62 cmd_omemdump(argc, argv) | |
63 char **argv; | |
64 { | |
65 u_char databuf[TM3_MEMREAD_MAX]; | |
66 u32 memaddr; | |
67 int rc, sz, off, l; | |
68 | |
69 memaddr = strtoul(argv[1], 0, 16); | |
70 sz = strtoul(argv[2], 0, 16); | |
71 rc = do_memory_read_tm3(memaddr, databuf, sz); | |
72 if (rc) | |
73 return(rc); | |
74 for (off = 0; off < sz; off += 16) { | |
75 l = sz - off; | |
76 if (l > 16) | |
77 l = 16; | |
78 memdump_line(memaddr + off, databuf + off, l); | |
79 } | |
80 return(0); | |
81 } | |
82 | |
61 cmd_dieid() | 83 cmd_dieid() |
62 { | 84 { |
63 u_char buf[8]; | 85 u_char buf[8]; |
64 int rc; | 86 int rc; |
65 | 87 |