The m and M packets
respectively read and write blocks of memory, with the data
represented as hexadecimal characters. The processing is provided by
rsp_read_mem ()
and
rsp_write_mem ()
.
The syntax of the packet is
m,addr,len:. sscanf ()
is used to break out the address and length fields (both in hex).
The reply packet is a stream of bytes, starting from the lowest
address, each represented as a pair of hex characters. Each byte
is read from memory using the simulator function
eval_direct8 ()
, having first verified
the memory area is valid using
verify_memoryarea ()
.
The packet is only sent if all bytes are read
satisfactorily. Otherwise an error packet,
"E01"
is sent. The actual error number does not
matter—it is not used by the client.
The syntax of the packet is m,addr,len:
followed by the data to be written as a stream of bytes, starting
from the lowest address, each represented as a pair of hex
characters. sscanf ()
is used to break
out the address and length fields (both in hex).
Each byte is written to memory using
set_program8 ()
(which ignores any read
only constraints on the modeled memory), having first verified
that the memory address is valid using
verify_memoryarea ()
.
If all bytes are written successfully, a reply packet
"OK"
is sent. Otherwise an error reply,
"E01"
is sent. The actual error number does not
matter—it is not used by the client.