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 "mem/port.hh" 63#include "sim/byteswap.hh" 64 65/** 66 * This object is a proxy for a structural port, to be used for debug 67 * accesses. 68 * 69 * This proxy object is used when non structural entities --- 13 unchanged lines hidden (view full) --- 83 /** The actual physical port used by this proxy. */ 84 MasterPort &_port; 85 86 /** Granularity of any transactions issued through this proxy. */ 87 const unsigned int _cacheLineSize; 88 89 public: 90 PortProxy(MasterPort &port, unsigned int cacheLineSize) : |
91 _port(port), _cacheLineSize(cacheLineSize) 92 {} |
93 virtual ~PortProxy() { } 94 95 /** 96 * Read size bytes memory at address and store in p. 97 */ |
98 virtual void 99 readBlob(Addr addr, uint8_t* p, int size) const 100 { |
101 readBlobPhys(addr, 0, p, size); 102 } 103 104 /** 105 * Write size bytes from p to address. 106 */ |
107 virtual void 108 writeBlob(Addr addr, const uint8_t* p, int size) const 109 { |
110 writeBlobPhys(addr, 0, p, size); 111 } 112 113 /** 114 * Fill size bytes starting at addr with byte value val. 115 */ |
116 virtual void 117 memsetBlob(Addr addr, uint8_t v, int size) const 118 { |
119 memsetBlobPhys(addr, 0, v, size); 120 } 121 122 /** 123 * Read size bytes memory at physical address and store in p. 124 */ 125 void readBlobPhys(Addr addr, Request::Flags flags, 126 uint8_t* p, int size) const; --- 19 unchanged lines hidden (view full) --- 146 /** 147 * Write object T to address. Writes sizeof(T) bytes. 148 */ 149 template <typename T> 150 void write(Addr address, T data) const; 151 152 /** 153 * Read sizeof(T) bytes from address and return as object T. |
154 * Performs endianness conversion from the selected guest to host order. |
155 */ 156 template <typename T> |
157 T read(Addr address, ByteOrder guest_byte_order) const; |
158 159 /** 160 * Write object T to address. Writes sizeof(T) bytes. |
161 * Performs endianness conversion from host to the selected guest order. |
162 */ 163 template <typename T> |
164 void write(Addr address, T data, ByteOrder guest_byte_order) const; |
165}; 166 167 168/** 169 * This object is a proxy for a structural port, to be used for debug 170 * accesses to secure memory. 171 * 172 * The addresses are interpreted as physical addresses to secure memory. --- 22 unchanged lines hidden (view full) --- 195void 196PortProxy::write(Addr address, T data) const 197{ 198 writeBlob(address, (uint8_t*)&data, sizeof(T)); 199} 200 201template <typename T> 202T |
203PortProxy::read(Addr address, ByteOrder byte_order) const |
204{ 205 T data; 206 readBlob(address, (uint8_t*)&data, sizeof(T)); 207 return gtoh(data, byte_order); 208} 209 210template <typename T> 211void |
212PortProxy::write(Addr address, T data, ByteOrder byte_order) const |
213{ 214 data = htog(data, byte_order); 215 writeBlob(address, (uint8_t*)&data, sizeof(T)); 216} 217 |
218#endif // __MEM_PORT_PROXY_HH__ |