Commit 0581b66d authored by Adam Wujek's avatar Adam Wujek

lib/util: add dump_mem function

Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 3fef7ad3
......@@ -272,6 +272,29 @@ int atoi(const char *s)
return res;
}
/* Quick and dirty function to be used for debugging to dump the memory */
void dump_mem(uint8_t *p, int size)
{
int i = 0;
uint8_t *end = p + size;
pp_printf("0x%x size 0x%x\n", (int) p, size);
while(1){
pp_printf("0x%x:", (unsigned int) p);
for (i = 0; i < 8; i++) {
pp_printf(" %02x", *p);
p++;
if (p >= end) {
pp_printf("\n");
return;
}
}
pp_printf("\n");
}
}
/* To save code, in the div of two int64 numbers
* use signed 64bit division, then correct the sign of the result */
long long __divdi3 (long long A, long long B)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment