mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 05:32:25 +00:00
Make readBytes pure virtual. Every real implementation has it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221758 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
67a38a848e
commit
ccb2a0e99a
@ -51,7 +51,8 @@ public:
|
|||||||
/// and large enough to hold size bytes.
|
/// and large enough to hold size bytes.
|
||||||
/// @result - 0 if successful; -1 if not. Failure may be due to a
|
/// @result - 0 if successful; -1 if not. Failure may be due to a
|
||||||
/// bounds violation or an implementation-specific error.
|
/// bounds violation or an implementation-specific error.
|
||||||
virtual int readBytes(uint64_t address, uint64_t size, uint8_t *buf) const;
|
virtual int readBytes(uint64_t address, uint64_t size,
|
||||||
|
uint8_t *buf) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,22 +12,3 @@ using namespace llvm;
|
|||||||
|
|
||||||
MemoryObject::~MemoryObject() {
|
MemoryObject::~MemoryObject() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int MemoryObject::readBytes(uint64_t address,
|
|
||||||
uint64_t size,
|
|
||||||
uint8_t* buf) const {
|
|
||||||
uint64_t current = address;
|
|
||||||
uint64_t limit = getExtent();
|
|
||||||
|
|
||||||
if (current + size > limit)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
while (current - address < size) {
|
|
||||||
if (readByte(current, &buf[(current - address)]))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
current++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user