fs_translating_port_proxy.hh revision 8706
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
628229SN/A#include "arch/vtophys.hh"
638706Sandreas.hansson@arm.com#include "mem/port_proxy.hh"
642521SN/A
658706Sandreas.hansson@arm.com/**
668706Sandreas.hansson@arm.com * A TranslatingPortProxy in FS mode translates a virtual address to a
678706Sandreas.hansson@arm.com * physical address and then calls the read/write functions of the
688706Sandreas.hansson@arm.com * port. If a thread context is provided the address can alway be
698706Sandreas.hansson@arm.com * translated, If not it can only be translated if it is a simple
708706Sandreas.hansson@arm.com * address masking operation (such as alpha super page accesses).
712521SN/A */
728706Sandreas.hansson@arm.comclass FSTranslatingPortProxy : public PortProxy
732521SN/A{
742521SN/A  private:
758706Sandreas.hansson@arm.com    ThreadContext* _tc;
762521SN/A
772521SN/A  public:
782521SN/A
798706Sandreas.hansson@arm.com    FSTranslatingPortProxy(ThreadContext* tc);
808706Sandreas.hansson@arm.com
818706Sandreas.hansson@arm.com    FSTranslatingPortProxy(Port &port);
828706Sandreas.hansson@arm.com
838706Sandreas.hansson@arm.com    virtual ~FSTranslatingPortProxy();
842521SN/A
852521SN/A    /** Version of readblob that translates virt->phys and deals
862521SN/A      * with page boundries. */
872521SN/A    virtual void readBlob(Addr addr, uint8_t *p, int size);
882521SN/A
892521SN/A    /** Version of writeBlob that translates virt->phys and deals
902521SN/A      * with page boundries. */
912521SN/A    virtual void writeBlob(Addr addr, uint8_t *p, int size);
928706Sandreas.hansson@arm.com
938706Sandreas.hansson@arm.com    /**
948706Sandreas.hansson@arm.com     * Fill size bytes starting at addr with byte value val.
958706Sandreas.hansson@arm.com     */
968706Sandreas.hansson@arm.com    virtual void memsetBlob(Addr address, uint8_t  v, int size);
972521SN/A};
982521SN/A
994070SN/Avoid CopyOut(ThreadContext *tc, void *dest, Addr src, size_t cplen);
1004070SN/Avoid CopyIn(ThreadContext *tc, Addr dest, void *source, size_t cplen);
1014070SN/Avoid CopyStringOut(ThreadContext *tc, char *dst, Addr vaddr, size_t maxlen);
1024070SN/Avoid CopyStringIn(ThreadContext *tc, char *src, Addr vaddr);
1034070SN/A
1048706Sandreas.hansson@arm.com#endif //__MEM_FS_PORT_PROXY_HH__
105