locked_mem.hh (8229:78bf55f23338) locked_mem.hh (9383:55fa95053ee8)
1/*
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * Copyright (c) 2007-2008 The Florida State University
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;

--- 26 unchanged lines hidden (view full) ---

36
37/**
38 * @file
39 *
40 * ISA-specific helper functions for locked memory accesses.
41 */
42
43#include "arch/arm/miscregs.hh"
14 * Copyright (c) 2006 The Regents of The University of Michigan
15 * Copyright (c) 2007-2008 The Florida State University
16 * All rights reserved.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions are
20 * met: redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer;

--- 26 unchanged lines hidden (view full) ---

48
49/**
50 * @file
51 *
52 * ISA-specific helper functions for locked memory accesses.
53 */
54
55#include "arch/arm/miscregs.hh"
56#include "mem/packet.hh"
44#include "mem/request.hh"
45
46namespace ArmISA
47{
48template <class XC>
49inline void
57#include "mem/request.hh"
58
59namespace ArmISA
60{
61template <class XC>
62inline void
63handleLockedSnoop(XC *xc, PacketPtr pkt, Addr cacheBlockMask)
64{
65 if (!xc->readMiscReg(MISCREG_LOCKFLAG))
66 return;
67
68 Addr locked_addr = xc->readMiscReg(MISCREG_LOCKADDR) & cacheBlockMask;
69 Addr snoop_addr = pkt->getAddr();
70
71 assert((cacheBlockMask & snoop_addr) == snoop_addr);
72
73 if (locked_addr == snoop_addr)
74 xc->setMiscReg(MISCREG_LOCKFLAG, false);
75}
76
77template <class XC>
78inline void
50handleLockedRead(XC *xc, Request *req)
51{
52 xc->setMiscReg(MISCREG_LOCKADDR, req->getPaddr() & ~0xf);
53 xc->setMiscReg(MISCREG_LOCKFLAG, true);
54}
55
56
57template <class XC>

--- 38 unchanged lines hidden ---
79handleLockedRead(XC *xc, Request *req)
80{
81 xc->setMiscReg(MISCREG_LOCKADDR, req->getPaddr() & ~0xf);
82 xc->setMiscReg(MISCREG_LOCKFLAG, true);
83}
84
85
86template <class XC>

--- 38 unchanged lines hidden ---