/* * convert the hex array pointed to by buf into binary to be placed in mem * return a pointer to the character AFTER the last byte written * may_fault is non-zero if we are reading from arbitrary memory, but is currently * not used. */ static char *hex2mem(char *buf, char *mem, int count, int may_fault) { int i; unsigned char ch; for (i=0; i<count; i++) { ch = hex(*buf++) << 4; ch |= hex(*buf++); if (kgdb_write_byte(ch, mem++) != 0) return 0; } return mem; }
/* * convert the hex array pointed to by buf into binary to be placed in mem * return a pointer to the character AFTER the last byte written * may_fault is non-zero if we are reading from arbitrary memory, but is currently * not used. */ static char *hex2mem(char *buf, char *mem, int count, int binary, int may_fault) { int i; unsigned char ch; for (i=0; i<count; i++) { if (binary) { ch = *buf++; if (ch == 0x7d) ch = 0x20 ^ *buf++; } else { ch = hex(*buf++) << 4; ch |= hex(*buf++); } if (kgdb_write_byte(ch, mem++) != 0) return 0; } return mem; }