fs_translating_port_proxy.hh revision 9850
12521SN/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 * 142521SN/A * Copyright (c) 2006 The Regents of The University of Michigan 152521SN/A * All rights reserved. 162521SN/A * 172521SN/A * Redistribution and use in source and binary forms, with or without 182521SN/A * modification, are permitted provided that the following conditions are 192521SN/A * met: redistributions of source code must retain the above copyright 202521SN/A * notice, this list of conditions and the following disclaimer; 212521SN/A * redistributions in binary form must reproduce the above copyright 222521SN/A * notice, this list of conditions and the following disclaimer in the 232521SN/A * documentation and/or other materials provided with the distribution; 242521SN/A * neither the name of the copyright holders nor the names of its 252521SN/A * contributors may be used to endorse or promote products derived from 262521SN/A * this software without specific prior written permission. 272521SN/A * 282521SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 292521SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 302521SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 312521SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 322521SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 332521SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 342521SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 352521SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 362521SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 372521SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 382521SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 392665SN/A * 402665SN/A * Authors: Ali Saidi 418706Sandreas.hansson@arm.com * Andreas Hansson 422521SN/A */ 432521SN/A 442521SN/A/** 452521SN/A * @file 468706Sandreas.hansson@arm.com * TranslatingPortProxy Object Declaration for FS. 478706Sandreas.hansson@arm.com * 488706Sandreas.hansson@arm.com * Port proxies are used when non structural entities need access to 498706Sandreas.hansson@arm.com * the memory system. Proxy objects replace the previous 508706Sandreas.hansson@arm.com * FunctionalPort, TranslatingPort and VirtualPort objects, which 518706Sandreas.hansson@arm.com * provided the same functionality as the proxies, but were instances 528706Sandreas.hansson@arm.com * of ports not corresponding to real structural ports of the 538706Sandreas.hansson@arm.com * simulated system. Via the port proxies all the accesses go through 548706Sandreas.hansson@arm.com * an actual port and thus are transparent to a potentially 558706Sandreas.hansson@arm.com * distributed memory and automatically adhere to the memory map of 568706Sandreas.hansson@arm.com * the system. 572521SN/A */ 582521SN/A 598706Sandreas.hansson@arm.com#ifndef __MEM_FS_PORT_PROXY_HH__ 608706Sandreas.hansson@arm.com#define __MEM_FS_PORT_PROXY_HH__ 612521SN/A 628706Sandreas.hansson@arm.com#include "mem/port_proxy.hh" 632521SN/A 649850Sandreas.hansson@arm.comclass ThreadContext; 659850Sandreas.hansson@arm.com 668706Sandreas.hansson@arm.com/** 678706Sandreas.hansson@arm.com * A TranslatingPortProxy in FS mode translates a virtual address to a 688706Sandreas.hansson@arm.com * physical address and then calls the read/write functions of the 698706Sandreas.hansson@arm.com * port. If a thread context is provided the address can alway be 708706Sandreas.hansson@arm.com * translated, If not it can only be translated if it is a simple 718706Sandreas.hansson@arm.com * address masking operation (such as alpha super page accesses). 722521SN/A */ 738706Sandreas.hansson@arm.comclass FSTranslatingPortProxy : public PortProxy 742521SN/A{ 752521SN/A private: 768706Sandreas.hansson@arm.com ThreadContext* _tc; 772521SN/A 782521SN/A public: 792521SN/A 808706Sandreas.hansson@arm.com FSTranslatingPortProxy(ThreadContext* tc); 818706Sandreas.hansson@arm.com 829814Sandreas.hansson@arm.com FSTranslatingPortProxy(MasterPort &port, unsigned int cacheLineSize); 838706Sandreas.hansson@arm.com 848706Sandreas.hansson@arm.com virtual ~FSTranslatingPortProxy(); 852521SN/A 862521SN/A /** Version of readblob that translates virt->phys and deals 872521SN/A * with page boundries. */ 888861Sandreas.hansson@arm.com virtual void readBlob(Addr addr, uint8_t *p, int size) const; 892521SN/A 902521SN/A /** Version of writeBlob that translates virt->phys and deals 912521SN/A * with page boundries. */ 928861Sandreas.hansson@arm.com virtual void writeBlob(Addr addr, uint8_t *p, int size) const; 938706Sandreas.hansson@arm.com 948706Sandreas.hansson@arm.com /** 958706Sandreas.hansson@arm.com * Fill size bytes starting at addr with byte value val. 968706Sandreas.hansson@arm.com */ 978861Sandreas.hansson@arm.com virtual void memsetBlob(Addr address, uint8_t v, int size) const; 982521SN/A}; 992521SN/A 1004070SN/Avoid CopyOut(ThreadContext *tc, void *dest, Addr src, size_t cplen); 1014070SN/Avoid CopyIn(ThreadContext *tc, Addr dest, void *source, size_t cplen); 1024070SN/Avoid CopyStringOut(ThreadContext *tc, char *dst, Addr vaddr, size_t maxlen); 1034070SN/Avoid CopyStringIn(ThreadContext *tc, char *src, Addr vaddr); 1044070SN/A 1058706Sandreas.hansson@arm.com#endif //__MEM_FS_PORT_PROXY_HH__ 106