/* Same as target_write_memory, but report an error if can't write. */
void
-write_memory (CORE_ADDR memaddr, char *myaddr, int len)
+write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len)
{
int status;
-
- status = target_write_memory (memaddr, myaddr, len);
+ bfd_byte *bytes = alloca (len);
+
+ memcpy (bytes, myaddr, len);
+ status = target_write_memory (memaddr, bytes, len);
if (status != 0)
memory_error (status, memaddr);
}