se_translating_port_proxy.hh revision 8706
12400SN/A/* 28706Sandreas.hansson@arm.com * Copyright (c) 2011 ARM Limited 38706Sandreas.hansson@arm.com * All rights reserved 48706Sandreas.hansson@arm.com * 58706Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall 68706Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual 78706Sandreas.hansson@arm.com * property including but not limited to intellectual property relating 88706Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software 98706Sandreas.hansson@arm.com * licensed hereunder. You may use the software subject to the license 108706Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated 118706Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software, 128706Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form. 138706Sandreas.hansson@arm.com * 142400SN/A * Copyright (c) 2001-2005 The Regents of The University of Michigan 152400SN/A * All rights reserved. 162400SN/A * 172400SN/A * Redistribution and use in source and binary forms, with or without 182400SN/A * modification, are permitted provided that the following conditions are 192400SN/A * met: redistributions of source code must retain the above copyright 202400SN/A * notice, this list of conditions and the following disclaimer; 212400SN/A * redistributions in binary form must reproduce the above copyright 222400SN/A * notice, this list of conditions and the following disclaimer in the 232400SN/A * documentation and/or other materials provided with the distribution; 242400SN/A * neither the name of the copyright holders nor the names of its 252400SN/A * contributors may be used to endorse or promote products derived from 262400SN/A * this software without specific prior written permission. 272400SN/A * 282400SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 292400SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 302400SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 312400SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 322400SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 332400SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 342400SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 352400SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 362400SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 372400SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 382400SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 392665SN/A * 402665SN/A * Authors: Ron Dreslinski 412665SN/A * Ali Saidi 428706Sandreas.hansson@arm.com * Andreas Hansson 432400SN/A */ 442400SN/A 458706Sandreas.hansson@arm.com#ifndef __MEM_SE_TRANSLATING_PORT_PROXY_HH__ 468706Sandreas.hansson@arm.com#define __MEM_SE_TRANSLATING_PORT_PROXY_HH__ 472400SN/A 488706Sandreas.hansson@arm.com#include "mem/page_table.hh" 498706Sandreas.hansson@arm.com#include "mem/port_proxy.hh" 508706Sandreas.hansson@arm.com#include "sim/process.hh" 512519SN/A 528706Sandreas.hansson@arm.com/** 538706Sandreas.hansson@arm.com * @file 548706Sandreas.hansson@arm.com * TranslatingPortProxy Object Declaration for SE. 558706Sandreas.hansson@arm.com * 568706Sandreas.hansson@arm.com * Port proxies are used when non structural entities need access to 578706Sandreas.hansson@arm.com * the memory system. Proxy objects replace the previous 588706Sandreas.hansson@arm.com * FunctionalPort, TranslatingPort and VirtualPort objects, which 598706Sandreas.hansson@arm.com * provided the same functionality as the proxies, but were instances 608706Sandreas.hansson@arm.com * of ports not corresponding to real structural ports of the 618706Sandreas.hansson@arm.com * simulated system. Via the port proxies all the accesses go through 628706Sandreas.hansson@arm.com * an actual port and thus are transparent to a potentially 638706Sandreas.hansson@arm.com * distributed memory and automatically adhere to the memory map of 648706Sandreas.hansson@arm.com * the system. 658706Sandreas.hansson@arm.com */ 668706Sandreas.hansson@arm.comclass SETranslatingPortProxy : public PortProxy 678706Sandreas.hansson@arm.com{ 682400SN/A 694434SN/A public: 704434SN/A enum AllocType { 714434SN/A Always, 724434SN/A Never, 734434SN/A NextPage 744434SN/A }; 754434SN/A 762400SN/A private: 772400SN/A PageTable *pTable; 784434SN/A Process *process; 794434SN/A AllocType allocating; 802400SN/A 812400SN/A public: 828706Sandreas.hansson@arm.com SETranslatingPortProxy(Port& port, Process* p, AllocType alloc); 838706Sandreas.hansson@arm.com virtual ~SETranslatingPortProxy(); 842400SN/A 852461SN/A bool tryReadBlob(Addr addr, uint8_t *p, int size); 862519SN/A bool tryWriteBlob(Addr addr, uint8_t *p, int size); 872519SN/A bool tryMemsetBlob(Addr addr, uint8_t val, int size); 882461SN/A bool tryWriteString(Addr addr, const char *str); 892461SN/A bool tryReadString(std::string &str, Addr addr); 902445SN/A 912519SN/A virtual void readBlob(Addr addr, uint8_t *p, int size); 922519SN/A virtual void writeBlob(Addr addr, uint8_t *p, int size); 932519SN/A virtual void memsetBlob(Addr addr, uint8_t val, int size); 942640SN/A 952461SN/A void writeString(Addr addr, const char *str); 962461SN/A void readString(std::string &str, Addr addr); 972400SN/A}; 982400SN/A 998706Sandreas.hansson@arm.com#endif // __MEM_SE_TRANSLATING_PORT_PROXY_HH__ 100