arguments.cc revision 2107
1955SN/A/*
2955SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan
31762SN/A * All rights reserved.
4955SN/A *
5955SN/A * Redistribution and use in source and binary forms, with or without
6955SN/A * modification, are permitted provided that the following conditions are
7955SN/A * met: redistributions of source code must retain the above copyright
8955SN/A * notice, this list of conditions and the following disclaimer;
9955SN/A * redistributions in binary form must reproduce the above copyright
10955SN/A * notice, this list of conditions and the following disclaimer in the
11955SN/A * documentation and/or other materials provided with the distribution;
12955SN/A * neither the name of the copyright holders nor the names of its
13955SN/A * contributors may be used to endorse or promote products derived from
14955SN/A * this software without specific prior written permission.
15955SN/A *
16955SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17955SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18955SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19955SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20955SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21955SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22955SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23955SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24955SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25955SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26955SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27955SN/A */
282665Ssaidi@eecs.umich.edu
294762Snate@binkert.org#include "arch/alpha/arguments.hh"
30955SN/A#include "arch/alpha/vtophys.hh"
315522Snate@binkert.org#include "cpu/exec_context.hh"
324762Snate@binkert.org#include "mem/functional/physical.hh"
335522Snate@binkert.org
34955SN/Ausing namespace AlphaISA;
355522Snate@binkert.org
36955SN/AAlphaArguments::Data::~Data()
375522Snate@binkert.org{
384202Sbinkertn@umich.edu    while (!data.empty()) {
395742Snate@binkert.org        delete [] data.front();
40955SN/A        data.pop_front();
414381Sbinkertn@umich.edu    }
424381Sbinkertn@umich.edu}
43955SN/A
44955SN/Achar *
45955SN/AAlphaArguments::Data::alloc(size_t size)
464202Sbinkertn@umich.edu{
47955SN/A    char *buf = new char[size];
484382Sbinkertn@umich.edu    data.push_back(buf);
494382Sbinkertn@umich.edu    return buf;
504382Sbinkertn@umich.edu}
515517Snate@binkert.org
525517Snate@binkert.orguint64_t
534762Snate@binkert.orgAlphaArguments::getArg(bool fp)
544762Snate@binkert.org{
554762Snate@binkert.org    if (number < 6) {
564762Snate@binkert.org        if (fp)
574762Snate@binkert.org            return xc->regs.floatRegFile.q[16 + number];
584762Snate@binkert.org        else
594762Snate@binkert.org            return xc->regs.intRegFile[16 + number];
604762Snate@binkert.org    } else {
614762Snate@binkert.org        Addr sp = xc->regs.intRegFile[30];
624762Snate@binkert.org        Addr paddr = vtophys(xc, sp + (number-6) * sizeof(uint64_t));
635522Snate@binkert.org        return xc->physmem->phys_read_qword(paddr);
645604Snate@binkert.org    }
655604Snate@binkert.org}
665604Snate@binkert.org
674762Snate@binkert.org