/* Copy the binary array pointed to by buf into mem. Fix $, #, and 0x7d escaped with 0x7d. Return a pointer to the character after the last byte written.  */
static int kgdb_ebin2mem(char *buf, char *mem, int count)
/* Copy the binary array pointed to by buf into mem. Fix $, #, and 0x7d escaped with 0x7d. Return a pointer to the character after the last byte written.  */
static int kgdb_ebin2mem(char *buf, char *mem, int count)
{
	int err = 0;
	char c;
	while (count-- > 0) {
		c = *buf++;
		if (c == 0x7d)
			c = *buf++ ^ 0x20;
		err = probe_kernel_write(mem, &c, 1);
		if (err)
			break;
		mem++;
	}
	return err;
}