Thank you all for the feedback!
(I should also mention that Jason helped a lot coming up with the ideas both here and in the original proposal)
The first private API proposal was mostly trying to match existing style, but
I’m glad to hear there is support for something a bit more modern. I’ve
included an updated proposal below (the original post is intact) with these
changes:
- Removed the
0xaddress prefixes. - Specified base-16 for all addresses and numbers of bytes.
- Reordered reply specification so that all numbers of bytes read come first.
- Included an “options” tag.
- Made the private API nicer to use.
- Decided to use a
Range<addr_t, size_t>. AddressRangeis designed to be used with Sections, which is not
applicable here.VMRangeseems to be functionally the same as aRange
- Decided to use a
Updated packet specification:
Name: MultiMemRead
Request syntax: MultiMemRead:options:<options>;ranges:<base_addr1>,<num_bytes1>;<base_addr2>,<num_bytes2>;...;
Reply syntax: <num_bytes_read1>,<num_bytes_read2>,...;<bytes1><bytes2>...;
Where:
<options>is an arbitrary string of options. Theoptions:<options>field
is optional; if present, it may have an empty<options>component.<base_addr>,<num_bytes>and<num_bytes_read>are given in base-16.- An error code is also an acceptable reply.
Example:
send: MultiMemRead:ranges:100a00,4;200200,a0;400000,4;
receive: 4,0,2;<binary encoding of abcd1000><binary encoding of eeff>
In the example above, the first read produced abcd1000, the read of a0 bytes from address 200200 failed and the third read produced two bytes – eeff – out of the four requested.
Updated private API specification:
struct VectorizedReadResult {
MutableArrayRef<uint8_t> getResult(unsigned index) const;
unsigned getNumResults() const;
};
virtual Expected<VectorizedReadResult> ReadMemoryVectorized(
ArrayRef<Range<addr_t, size_t>> vm_addrs,
MutableArrayRef<uint8_t> buf);