arguments.cc revision 2680
14486Sbinkertn@umich.edu/*
24486Sbinkertn@umich.edu * Copyright (c) 2003-2005 The Regents of The University of Michigan
34486Sbinkertn@umich.edu * All rights reserved.
44486Sbinkertn@umich.edu *
54486Sbinkertn@umich.edu * Redistribution and use in source and binary forms, with or without
64486Sbinkertn@umich.edu * modification, are permitted provided that the following conditions are
74486Sbinkertn@umich.edu * met: redistributions of source code must retain the above copyright
84486Sbinkertn@umich.edu * notice, this list of conditions and the following disclaimer;
94486Sbinkertn@umich.edu * redistributions in binary form must reproduce the above copyright
104486Sbinkertn@umich.edu * notice, this list of conditions and the following disclaimer in the
114486Sbinkertn@umich.edu * documentation and/or other materials provided with the distribution;
124486Sbinkertn@umich.edu * neither the name of the copyright holders nor the names of its
134486Sbinkertn@umich.edu * contributors may be used to endorse or promote products derived from
144486Sbinkertn@umich.edu * this software without specific prior written permission.
154486Sbinkertn@umich.edu *
164486Sbinkertn@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
174486Sbinkertn@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
184486Sbinkertn@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
194486Sbinkertn@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
204486Sbinkertn@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
214486Sbinkertn@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
224486Sbinkertn@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
234486Sbinkertn@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
244486Sbinkertn@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
254486Sbinkertn@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
264486Sbinkertn@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
274486Sbinkertn@umich.edu *
284486Sbinkertn@umich.edu * Authors: Nathan Binkert
296654Snate@binkert.org */
303102SN/A
313102SN/A#include "arch/alpha/arguments.hh"
321681SN/A#include "arch/alpha/vtophys.hh"
333223SN/A#include "cpu/thread_context.hh"
348887Sgeoffrey.blake@arm.com#include "mem/vport.hh"
354486Sbinkertn@umich.edu
362817SN/Ausing namespace AlphaISA;
372817SN/A
382932SN/AAlphaArguments::Data::~Data()
391681SN/A{
404597Sbinkertn@umich.edu    while (!data.empty()) {
411681SN/A        delete [] data.front();
422932SN/A        data.pop_front();
432932SN/A    }
442932SN/A}
452932SN/A
462932SN/Achar *
472932SN/AAlphaArguments::Data::alloc(size_t size)
482932SN/A{
492932SN/A    char *buf = new char[size];
502932SN/A    data.push_back(buf);
511681SN/A    return buf;
522932SN/A}
532932SN/A
542932SN/Auint64_t
551681SN/AAlphaArguments::getArg(bool fp)
562932SN/A{
571681SN/A    if (number < 6) {
582932SN/A        if (fp)
592932SN/A            return tc->readFloatRegBits(16 + number);
602932SN/A        else
611681SN/A            return tc->readIntReg(16 + number);
622932SN/A    } else {
632932SN/A        Addr sp = tc->readIntReg(30);
642932SN/A        VirtualPort *vp = tc->getVirtPort(tc);
652932SN/A        uint64_t arg = vp->read<uint64_t>(sp + (number-6) * sizeof(uint64_t));
662932SN/A        tc->delVirtPort(vp);
672932SN/A        return arg;
682932SN/A    }
692932SN/A}
702932SN/A
712932SN/A