1/* 2 * Copyright (c) 2011-2013, 2018 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 --- 45 unchanged lines hidden (view full) --- 54 * CPU, e.g. for threads) and thus are transparent to a potentially 55 * distributed memory and automatically adhere to the memory map of 56 * the system. 57 */ 58 59#ifndef __MEM_PORT_PROXY_HH__ 60#define __MEM_PORT_PROXY_HH__ 61 |
62#include <functional> |
63#include <limits> 64 65#include "mem/port.hh" 66#include "sim/byteswap.hh" 67 68/** |
69 * This object is a proxy for a port or other object which implements the 70 * functional response protocol, to be used for debug accesses. |
71 * 72 * This proxy object is used when non structural entities 73 * (e.g. thread contexts, object file loaders) need access to the 74 * memory system. It calls the corresponding functions on the underlying |
75 * protocol, and provides templatized convenience access functions. |
76 * 77 * The addresses are interpreted as physical addresses. 78 * 79 * @sa SETranslatingProxy 80 * @sa FSTranslatingProxy 81 */ |
82class PortProxy : FunctionalRequestProtocol |
83{ |
84 public: 85 typedef std::function<void(PacketPtr pkt)> SendFunctionalFunc; 86 |
87 private: |
88 SendFunctionalFunc sendFunctional; |
89 |
90 /** Granularity of any transactions issued through this proxy. */ 91 const unsigned int _cacheLineSize; 92 |
93 void 94 recvFunctionalSnoop(PacketPtr pkt) override 95 { 96 // Since port proxies aren't anyone else's peer, they should never 97 // receive snoops. 98 panic("Port proxies should never receive snoops."); 99 } 100 |
101 public: |
102 PortProxy(SendFunctionalFunc func, unsigned int cacheLineSize) : 103 sendFunctional(func), _cacheLineSize(cacheLineSize) |
104 {} |
105 PortProxy(const MasterPort &port, unsigned int cacheLineSize) : 106 sendFunctional([&port](PacketPtr pkt)->void { 107 port.sendFunctional(pkt); 108 }), _cacheLineSize(cacheLineSize) 109 {} |
110 virtual ~PortProxy() { } 111 112 113 114 /** Fixed functionality for use in base classes. */ 115 116 /** 117 * Read size bytes memory at physical address and store in p. --- 198 unchanged lines hidden --- |