summaryrefslogtreecommitdiff
path: root/src/mem
diff options
context:
space:
mode:
authorPolina Dudnik <pdudnik@gmail.com>2009-07-13 11:34:38 -0500
committerPolina Dudnik <pdudnik@gmail.com>2009-07-13 11:34:38 -0500
commitfaf823f947f2318687f9c9e2e05ba6ab919abe14 (patch)
tree165709cf8e0edc623bfc04ff83f1a71cd87d0946 /src/mem
parent86ce60e5cd9524b4130d361e1f7ea0a2ba266e5b (diff)
downloadgem5-faf823f947f2318687f9c9e2e05ba6ab919abe14.tar.xz
Moved the lock check and clearing the lock into makeRequest
Diffstat (limited to 'src/mem')
-rw-r--r--src/mem/ruby/system/Sequencer.cc23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/mem/ruby/system/Sequencer.cc b/src/mem/ruby/system/Sequencer.cc
index dc65d6fc6..db60bb11a 100644
--- a/src/mem/ruby/system/Sequencer.cc
+++ b/src/mem/ruby/system/Sequencer.cc
@@ -264,19 +264,6 @@ void Sequencer::writeCallback(const Address& address, DataBlock& data) {
if (request->ruby_request.type == RubyRequestType_RMW_Read) {
m_dataCache_ptr->setLocked(address, m_version);
}
- else if (request->ruby_request.type == RubyRequestType_RMW_Write) {
- if (m_dataCache_ptr->isLocked(address, m_version)) {
- // if we are holding the lock for this
- request->ruby_request.atomic_success = true;
- m_dataCache_ptr->clearLocked(address);
- }
- else {
- // if we are not holding the lock for this
- request->ruby_request.atomic_success = false;
- }
-
- // can have livelock
- }
hitCallback(request, data);
}
@@ -367,6 +354,8 @@ bool Sequencer::empty() const {
return (m_writeRequestTable.size() == 0) && (m_readRequestTable.size() == 0);
}
+
+// -2 means that the LLSC failed
int64_t Sequencer::makeRequest(const RubyRequest & request)
{
assert(Address(request.paddr).getOffset() + request.len <= RubySystem::getBlockSizeBytes());
@@ -375,6 +364,14 @@ int64_t Sequencer::makeRequest(const RubyRequest & request)
SequencerRequest *srequest = new SequencerRequest(request, id, g_eventQueue_ptr->getTime());
bool found = insertRequest(srequest);
if (!found)
+ if (request.type == RubyRequestType_RMW_Write) {
+ if (!m_dataCache_ptr->isLocked(line_address(Address(request.paddr)), m_version)) {
+ return -2;
+ }
+ else {
+ m_dataCache_ptr->clearLocked(line_address(Address(request.paddr)));
+ }
+ }
issueRequest(request);
// TODO: issue hardware prefetches here