X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_util.c;h=e6fd1fb494322b60cb26b9bb09de593501072c55;hb=4e43946f01f687361197dc9571b7df02ae20de30;hp=8fecd3cc9331116cc21e327c31e2430459303b30;hpb=4f0bb09709fcff0e08aef60c1f0253bbef91f608;p=palacios.git diff --git a/palacios/src/palacios/vmm_util.c b/palacios/src/palacios/vmm_util.c index 8fecd3c..e6fd1fb 100644 --- a/palacios/src/palacios/vmm_util.c +++ b/palacios/src/palacios/vmm_util.c @@ -19,26 +19,29 @@ #include #include - +#include void v3_dump_mem(uint8_t * start, int n) { int i, j; + char buf[128]; + if (!start) { + return; + } + for (i = 0; i < n; i += 16) { - V3_Print("%p", (void *)(start + i)); - for (j = i; (j < (i + 16)) && (j < n); j += 2) { - V3_Print(" "); - V3_Print("%x", *(uint8_t *)(start + j)); - if ((j + 1) < n) { - V3_Print("%x", *((uint8_t *)(start + j + 1))); - } - } - V3_Print(" "); - for (j = i; (j < (i + 16)) && (j < n); j++) { - V3_Print("%c", ((start[j] >= 32) && (start[j] <= 126)) ? start[j] : '.'); - } - V3_Print("\n"); + snprintf(buf, 128, "%p ", (void *)(start + i)); + for (j = i; (j < (i + 16)) && (j < n); j++) { + snprintf(buf+strlen(buf),128-strlen(buf),"%02x ", *(uint8_t *)(start + j)); + } + for (j = i; (j < (i + 16)) && (j < n); j++) { + snprintf(buf+strlen(buf),128-strlen(buf),"%c", ((start[j] >= 32) && (start[j] <= 126)) ? start[j] : '.'); + } + snprintf(buf+strlen(buf),128-strlen(buf), "\n"); + buf[strlen(buf)]=0; + V3_Print(VM_NONE, VCORE_NONE, "%s",buf); } + }