summaryrefslogtreecommitdiff
path: root/src/mem/ruby/common
diff options
context:
space:
mode:
authorPolina Dudnik <pdudnik@gmail.com>2009-07-13 11:13:29 -0500
committerPolina Dudnik <pdudnik@gmail.com>2009-07-13 11:13:29 -0500
commit226981b2a65ee4c544bc595d7718de8225fda0b0 (patch)
treeab93913f1a164fe035c3ecdc98dc374508a9bd11 /src/mem/ruby/common
parent60577eb4caff66a756f260bff6bf3bf8cb7edcba (diff)
downloadgem5-226981b2a65ee4c544bc595d7718de8225fda0b0.tar.xz
Reintegrated Derek's functional implementation of atomics with a minor change: don't clear lock on failure
Diffstat (limited to 'src/mem/ruby/common')
-rw-r--r--src/mem/ruby/common/DataBlock.hh18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mem/ruby/common/DataBlock.hh b/src/mem/ruby/common/DataBlock.hh
index 2a0811f76..c7dba8ae8 100644
--- a/src/mem/ruby/common/DataBlock.hh
+++ b/src/mem/ruby/common/DataBlock.hh
@@ -56,6 +56,9 @@ class DataBlock {
uint8 getByte(int whichByte) const;
const uint8* getData(int offset, int len) const;
void setByte(int whichByte, uint8 data);
+ const uint8* getBlock() const;
+ uint8* copyData(uint8* dest, int offset, int size) const;
+ void setBlock(uint8* data) { setData(data, 0, System::getBlockSizeBytes()); }
void setData(uint8* data, int offset, int len);
void copyPartial(const DataBlock & dblk, int offset, int len);
bool equal(const DataBlock& obj) const;
@@ -146,6 +149,21 @@ void DataBlock::copyPartial(const DataBlock & dblk, int offset, int len)
setData(&dblk.m_data[offset], offset, len);
}
+inline
+const uint8* DataBlock::getBlock() const
+{
+ return m_data;
+}
+
+inline
+uint8* DataBlock::copyData(uint8* dest, int offset, int size) const
+{
+ assert(offset + size <= RubySystem::getBlockSizeBytes());
+ memcpy(dest, m_data + offset, size);
+ return dest;
+}
+
+
// ******************* Definitions *******************
// Output operator definition