/* Convert the memory pointed to by mem into hex, placing result in buf. Return a pointer to the last char put in buf (null). May return an error.  */
int kgdb_mem2hex(char *mem, char *buf, int count)
/* Convert the memory pointed to by mem into hex, placing result in buf. Return a pointer to the last char put in buf (null). May return an error.  */
int kgdb_mem2hex(char *mem, char *buf, int count)
{
	char *tmp;
	int err;
	tmp = buf + count;
	err = probe_kernel_read(tmp, mem, count);
	if (!err) {
		while (count > 0) {
			buf = pack_hex_byte(buf, *tmp);
			tmp++;
			count--;
		}
		*buf = 0;
	}
	return err;
}