From 1eba429e3988b84fe1b095defdbeac37a480c25f Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 17 Feb 2009 23:14:25 -0500 Subject: Add hexdump() output helper function. --- src/output.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/output.c') diff --git a/src/output.c b/src/output.c index 2e6246b..5cda9c1 100644 --- a/src/output.c +++ b/src/output.c @@ -257,6 +257,26 @@ printf(const char *fmt, ...) va_end(args); } +void +hexdump(void *d, int len) +{ + int count=0; + while (len) { + if (count % 8 == 0) { + putc(0, '\n'); + puthex(0, count*4); + putc(0, ':'); + } else { + putc(0, ' '); + } + puthex(0, *(u32*)d); + count++; + len-=4; + d+=4; + } + putc(0, '\n'); +} + static void dump_regs(struct bregs *regs) { -- cgit v1.1