summaryrefslogtreecommitdiff
path: root/src/arch/mips/locked_mem.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/mips/locked_mem.hh')
-rw-r--r--src/arch/mips/locked_mem.hh29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/arch/mips/locked_mem.hh b/src/arch/mips/locked_mem.hh
index 60df8252a..b4003fea9 100644
--- a/src/arch/mips/locked_mem.hh
+++ b/src/arch/mips/locked_mem.hh
@@ -1,4 +1,16 @@
/*
+ * Copyright (c) 2012 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder. You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
* Copyright (c) 2006-2007 The Regents of The University of Michigan
* All rights reserved.
*
@@ -41,10 +53,27 @@
#include "base/misc.hh"
#include "base/trace.hh"
#include "debug/LLSC.hh"
+#include "mem/packet.hh"
#include "mem/request.hh"
namespace MipsISA
{
+template <class XC>
+inline void
+handleLockedSnoop(XC *xc, PacketPtr pkt, Addr cacheBlockMask)
+{
+ if (!xc->readMiscReg(MISCREG_LLFLAG))
+ return;
+
+ Addr locked_addr = xc->readMiscReg(MISCREG_LLADDR) & cacheBlockMask;
+ Addr snoop_addr = pkt->getAddr();
+
+ assert((cacheBlockMask & snoop_addr) == snoop_addr);
+
+ if (locked_addr == snoop_addr)
+ xc->setMiscReg(MISCREG_LLFLAG, false);
+}
+
template <class XC>
inline void