fs_translating_port_proxy.cc revision 2521
12100SN/A/*
22100SN/A * Copyright (c) 2006 The Regents of The University of Michigan
35268Sksewell@umich.edu * All rights reserved.
45268Sksewell@umich.edu *
55268Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without
65268Sksewell@umich.edu * modification, are permitted provided that the following conditions are
75268Sksewell@umich.edu * met: redistributions of source code must retain the above copyright
85268Sksewell@umich.edu * notice, this list of conditions and the following disclaimer;
95268Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright
105268Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the
115268Sksewell@umich.edu * documentation and/or other materials provided with the distribution;
125268Sksewell@umich.edu * neither the name of the copyright holders nor the names of its
135268Sksewell@umich.edu * contributors may be used to endorse or promote products derived from
145268Sksewell@umich.edu * this software without specific prior written permission.
155268Sksewell@umich.edu *
165268Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
175268Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
185268Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
195268Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
205268Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
215268Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
225268Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
235268Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
245268Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
255268Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
265268Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
275268Sksewell@umich.edu */
285268Sksewell@umich.edu
295268Sksewell@umich.edu/**
305268Sksewell@umich.edu * @file Port object definitions.
315268Sksewell@umich.edu */
322706Sksewell@umich.edu
332100SN/A#include "base/chunk_generator.hh"
342124SN/A#include "mem/vport.hh"
352124SN/A
362124SN/Avoid
372124SN/AVirtualPort::readBlob(Addr addr, uint8_t *p, int size)
382124SN/A{
392124SN/A    Addr paddr;
402124SN/A    for (ChunkGenerator gen(addr, size, TheISA::PageBytes); !gen.done();
412124SN/A            gen.next())
422124SN/A    {
432124SN/A        if (xc)
442124SN/A            paddr = TheISA::vtophys(xc,gen.addr());
452124SN/A        else
462124SN/A            paddr = TheISA::vtophys(gen.addr());
472124SN/A
482124SN/A        FunctionalPort::readBlob(paddr, p, gen.size());
492124SN/A        p += gen.size();
503953Sstever@eecs.umich.edu    }
513953Sstever@eecs.umich.edu}
523953Sstever@eecs.umich.edu
533953Sstever@eecs.umich.eduvoid
543953Sstever@eecs.umich.eduVirtualPort::writeBlob(Addr addr, uint8_t *p, int size)
553953Sstever@eecs.umich.edu{
563953Sstever@eecs.umich.edu    Addr paddr;
573953Sstever@eecs.umich.edu    for (ChunkGenerator gen(addr, size, TheISA::PageBytes); !gen.done();
583953Sstever@eecs.umich.edu            gen.next())
593953Sstever@eecs.umich.edu    {
603953Sstever@eecs.umich.edu        if (xc)
613953Sstever@eecs.umich.edu            paddr = TheISA::vtophys(xc,gen.addr());
622124SN/A        else
632124SN/A            paddr = TheISA::vtophys(gen.addr());
642124SN/A
652124SN/A        FunctionalPort::writeBlob(paddr, p, gen.size());
662124SN/A        p += gen.size();
672124SN/A    }
682124SN/A}
692935Sksewell@umich.edu
704056Sstever@eecs.umich.edu