diff options
author | Sean Callanan <scallanan@apple.com> | 2009-09-09 22:49:13 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2009-09-09 22:49:13 +0000 |
commit | 1358fb7feb90b938410b437c2879ea5c226e2344 (patch) | |
tree | 1b01fc3c65691344fc9e849abe4c84bd0024c18a /llvm/lib/Support | |
parent | 3c7b9ca4bf3da1bc1f35e8bcd060bb8fc358c6f4 (diff) | |
download | bcm5719-llvm-1358fb7feb90b938410b437c2879ea5c226e2344.tar.gz bcm5719-llvm-1358fb7feb90b938410b437c2879ea5c226e2344.zip |
Added an abstract superclass, MCDisassembler, for
all disassemblers.
Modified the MemoryObject to support 64-bit address
spaces, regardless of the LLVM process's address
width.
Modified the Target class to allow extraction of a
MCDisassembler.
llvm-svn: 81392
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/MemoryObject.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/lib/Support/MemoryObject.cpp b/llvm/lib/Support/MemoryObject.cpp new file mode 100644 index 00000000000..08e5fb75b3a --- /dev/null +++ b/llvm/lib/Support/MemoryObject.cpp @@ -0,0 +1,37 @@ +//===- MemoryObject.cpp - Abstract memory interface -------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Support/MemoryObject.h" + +namespace llvm { + + MemoryObject::~MemoryObject() { + } + + int MemoryObject::readBytes(uint64_t address, + uint64_t size, + uint8_t* buf, + uint64_t* copied) const { + uint64_t current = address; + uint64_t limit = getBase() + getExtent(); + + while (current - address < size && current < limit) { + if (readByte(current, &buf[(current - address)])) + return -1; + + current++; + } + + if (copied) + *copied = current - address; + + return 0; + } + +} |