fs_translating_port_proxy.cc revision 2665
12199SN/A/*
22199SN/A * Copyright (c) 2006 The Regents of The University of Michigan
32199SN/A * All rights reserved.
42199SN/A *
52199SN/A * Redistribution and use in source and binary forms, with or without
62199SN/A * modification, are permitted provided that the following conditions are
72199SN/A * met: redistributions of source code must retain the above copyright
82199SN/A * notice, this list of conditions and the following disclaimer;
92199SN/A * redistributions in binary form must reproduce the above copyright
102199SN/A * notice, this list of conditions and the following disclaimer in the
112199SN/A * documentation and/or other materials provided with the distribution;
122199SN/A * neither the name of the copyright holders nor the names of its
132199SN/A * contributors may be used to endorse or promote products derived from
142199SN/A * this software without specific prior written permission.
152199SN/A *
162199SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172199SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182199SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192199SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202199SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212199SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222199SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232199SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242199SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252199SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262199SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Ali Saidi
292199SN/A */
302199SN/A
312202SN/A/**
322202SN/A * @file Port object definitions.
332199SN/A */
342584SN/A
352980Sgblack@eecs.umich.edu#include "base/chunk_generator.hh"
362474SN/A#include "mem/vport.hh"
372199SN/A
382199SN/Avoid
392474SN/AVirtualPort::readBlob(Addr addr, uint8_t *p, int size)
402199SN/A{
414111Sgblack@eecs.umich.edu    Addr paddr;
424111Sgblack@eecs.umich.edu    for (ChunkGenerator gen(addr, size, TheISA::PageBytes); !gen.done();
434111Sgblack@eecs.umich.edu            gen.next())
444111Sgblack@eecs.umich.edu    {
454111Sgblack@eecs.umich.edu        if (xc)
464111Sgblack@eecs.umich.edu            paddr = TheISA::vtophys(xc,gen.addr());
474111Sgblack@eecs.umich.edu        else
484111Sgblack@eecs.umich.edu            paddr = TheISA::vtophys(gen.addr());
494111Sgblack@eecs.umich.edu
504111Sgblack@eecs.umich.edu        FunctionalPort::readBlob(paddr, p, gen.size());
514111Sgblack@eecs.umich.edu        p += gen.size();
524188Sgblack@eecs.umich.edu    }
534188Sgblack@eecs.umich.edu}
544188Sgblack@eecs.umich.edu
554188Sgblack@eecs.umich.eduvoid
564111Sgblack@eecs.umich.eduVirtualPort::writeBlob(Addr addr, uint8_t *p, int size)
574188Sgblack@eecs.umich.edu{
584111Sgblack@eecs.umich.edu    Addr paddr;
594111Sgblack@eecs.umich.edu    for (ChunkGenerator gen(addr, size, TheISA::PageBytes); !gen.done();
604188Sgblack@eecs.umich.edu            gen.next())
614111Sgblack@eecs.umich.edu    {
624111Sgblack@eecs.umich.edu        if (xc)
632202SN/A            paddr = TheISA::vtophys(xc,gen.addr());
644111Sgblack@eecs.umich.edu        else
652199SN/A            paddr = TheISA::vtophys(gen.addr());
662199SN/A
672199SN/A        FunctionalPort::writeBlob(paddr, p, gen.size());
685154Sgblack@eecs.umich.edu        p += gen.size();
692199SN/A    }
704111Sgblack@eecs.umich.edu}
714111Sgblack@eecs.umich.edu
724188Sgblack@eecs.umich.edu