fs_translating_port_proxy.hh revision 8922:17f037ad8918
19277Sandreas.hansson@arm.com/* 22SN/A * Copyright (c) 2011 ARM Limited 32SN/A * All rights reserved 42SN/A * 52SN/A * The license below extends only to copyright in the software and shall 62SN/A * not be construed as granting a license to any other intellectual 72SN/A * property including but not limited to intellectual property relating 82SN/A * to a hardware implementation of the functionality of the software 92SN/A * licensed hereunder. You may use the software subject to the license 102SN/A * terms below provided that you ensure that this notice is replicated 112SN/A * unmodified and in its entirety in all distributions of the software, 122SN/A * modified or unmodified, in source code or in binary form. 132SN/A * 14694SN/A * Copyright (c) 2006 The Regents of The University of Michigan 152SN/A * All rights reserved. 162SN/A * 179277Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without 189277Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are 199277Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright 209277Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer; 219277Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright 229277Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the 239277Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution; 249277Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its 252SN/A * contributors may be used to endorse or promote products derived from 262SN/A * this software without specific prior written permission. 272SN/A * 289277Sandreas.hansson@arm.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 292SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 302SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 312SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 322SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 332SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 342SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 352SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 362SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 372SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 382SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 392SN/A * 402SN/A * Authors: Ali Saidi 412982Sstever@eecs.umich.edu * Andreas Hansson 422SN/A */ 439277Sandreas.hansson@arm.com 449277Sandreas.hansson@arm.com/** 459277Sandreas.hansson@arm.com * @file 469277Sandreas.hansson@arm.com * TranslatingPortProxy Object Declaration for FS. 479277Sandreas.hansson@arm.com * 489277Sandreas.hansson@arm.com * Port proxies are used when non structural entities need access to 499277Sandreas.hansson@arm.com * the memory system. Proxy objects replace the previous 509277Sandreas.hansson@arm.com * FunctionalPort, TranslatingPort and VirtualPort objects, which 519277Sandreas.hansson@arm.com * provided the same functionality as the proxies, but were instances 522SN/A * of ports not corresponding to real structural ports of the 532SN/A * simulated system. Via the port proxies all the accesses go through 542SN/A * an actual port and thus are transparent to a potentially 552SN/A * distributed memory and automatically adhere to the memory map of 562SN/A * the system. 572SN/A */ 58694SN/A 592SN/A#ifndef __MEM_FS_PORT_PROXY_HH__ 602SN/A#define __MEM_FS_PORT_PROXY_HH__ 612SN/A 622SN/A#include "arch/vtophys.hh" 63694SN/A#include "mem/port_proxy.hh" 64694SN/A 65694SN/A/** 66694SN/A * A TranslatingPortProxy in FS mode translates a virtual address to a 67694SN/A * physical address and then calls the read/write functions of the 68694SN/A * port. If a thread context is provided the address can alway be 69694SN/A * translated, If not it can only be translated if it is a simple 709277Sandreas.hansson@arm.com * address masking operation (such as alpha super page accesses). 719277Sandreas.hansson@arm.com */ 729277Sandreas.hansson@arm.comclass FSTranslatingPortProxy : public PortProxy 73694SN/A{ 74694SN/A private: 75694SN/A ThreadContext* _tc; 76694SN/A 779277Sandreas.hansson@arm.com public: 789277Sandreas.hansson@arm.com 799277Sandreas.hansson@arm.com FSTranslatingPortProxy(ThreadContext* tc); 809277Sandreas.hansson@arm.com 819277Sandreas.hansson@arm.com FSTranslatingPortProxy(MasterPort &port); 829277Sandreas.hansson@arm.com 839277Sandreas.hansson@arm.com virtual ~FSTranslatingPortProxy(); 849277Sandreas.hansson@arm.com 859277Sandreas.hansson@arm.com /** Version of readblob that translates virt->phys and deals 86694SN/A * with page boundries. */ 879277Sandreas.hansson@arm.com virtual void readBlob(Addr addr, uint8_t *p, int size) const; 88694SN/A 89694SN/A /** Version of writeBlob that translates virt->phys and deals 90694SN/A * with page boundries. */ 91694SN/A virtual void writeBlob(Addr addr, uint8_t *p, int size) const; 92694SN/A 93694SN/A /** 94694SN/A * Fill size bytes starting at addr with byte value val. 959277Sandreas.hansson@arm.com */ 969277Sandreas.hansson@arm.com virtual void memsetBlob(Addr address, uint8_t v, int size) const; 979277Sandreas.hansson@arm.com}; 989277Sandreas.hansson@arm.com 99694SN/Avoid CopyOut(ThreadContext *tc, void *dest, Addr src, size_t cplen); 100694SN/Avoid CopyIn(ThreadContext *tc, Addr dest, void *source, size_t cplen); 101694SN/Avoid CopyStringOut(ThreadContext *tc, char *dst, Addr vaddr, size_t maxlen); 102694SN/Avoid CopyStringIn(ThreadContext *tc, char *src, Addr vaddr); 103694SN/A 104694SN/A#endif //__MEM_FS_PORT_PROXY_HH__ 105694SN/A