- /// @result - The number of bytes copied if successful; (uintptr_t)-1
- /// if not.
- /// Failure may be due to a bounds violation or an
- /// implementation-specific error.
- virtual uintptr_t readBytes(uintptr_t address,
- uintptr_t size,
- uint8_t* buf) const {
- uintptr_t current = address;
- uintptr_t limit = getBase() + getExtent();
-
- while(current - address < size && current < limit) {
- if(readByte(current, &buf[(current - address)]))
- return (uintptr_t)-1;
-
- current++;
- }
-
- return current - address;
- }
+ /// @param Size - The number of bytes to copy.
+ /// @param Address - The address of the first byte, in the same space as
+ /// getBase().
+ /// @result - The number of bytes read.
+ virtual uint64_t readBytes(uint8_t *Buf, uint64_t Size,
+ uint64_t Address) const = 0;
+
+ /// Ensures that the requested data is in memory, and returns a pointer to it.
+ /// More efficient than using readBytes if the data is already in memory. May
+ /// block until (address - base + size) bytes have been read
+ /// @param address - address of the byte, in the same space as getBase()
+ /// @param size - amount of data that must be available on return
+ /// @result - valid pointer to the requested data
+ virtual const uint8_t *getPointer(uint64_t address, uint64_t size) const = 0;
+
+ /// Returns true if the address is within the object (i.e. between base and
+ /// base + extent - 1 inclusive). May block until (address - base) bytes have
+ /// been read
+ /// @param address - address of the byte, in the same space as getBase()
+ /// @result - true if the address may be read with readByte()
+ virtual bool isValidAddress(uint64_t address) const = 0;