arguments.cc revision 1762
16145Snate@binkert.org/* 26145Snate@binkert.org * Copyright (c) 2003-2005 The Regents of The University of Michigan 36145Snate@binkert.org * All rights reserved. 46145Snate@binkert.org * 56145Snate@binkert.org * Redistribution and use in source and binary forms, with or without 66145Snate@binkert.org * modification, are permitted provided that the following conditions are 76145Snate@binkert.org * met: redistributions of source code must retain the above copyright 86145Snate@binkert.org * notice, this list of conditions and the following disclaimer; 96145Snate@binkert.org * redistributions in binary form must reproduce the above copyright 106145Snate@binkert.org * notice, this list of conditions and the following disclaimer in the 116145Snate@binkert.org * documentation and/or other materials provided with the distribution; 126145Snate@binkert.org * neither the name of the copyright holders nor the names of its 136145Snate@binkert.org * contributors may be used to endorse or promote products derived from 146145Snate@binkert.org * this software without specific prior written permission. 156145Snate@binkert.org * 166145Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 176145Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 186145Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 196145Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 206145Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 216145Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 226145Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 236145Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 246145Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 256145Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 266145Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 276145Snate@binkert.org */ 286145Snate@binkert.org 296145Snate@binkert.org#include "arch/alpha/arguments.hh" 307054Snate@binkert.org#include "arch/alpha/vtophys.hh" 317054Snate@binkert.org#include "cpu/exec_context.hh" 327054Snate@binkert.org#include "mem/functional/physical.hh" 337054Snate@binkert.org 347054Snate@binkert.orgAlphaArguments::Data::~Data() 357054Snate@binkert.org{ 367054Snate@binkert.org while (!data.empty()) { 377054Snate@binkert.org delete [] data.front(); 387054Snate@binkert.org data.pop_front(); 396145Snate@binkert.org } 407054Snate@binkert.org} 417054Snate@binkert.org 426145Snate@binkert.orgchar * 437055Snate@binkert.orgAlphaArguments::Data::alloc(size_t size) 447055Snate@binkert.org{ 457454Snate@binkert.org char *buf = new char[size]; 467055Snate@binkert.org data.push_back(buf); 478257SBrad.Beckmann@amd.com return buf; 487054Snate@binkert.org} 498645Snilay@cs.wisc.edu 509594Snilay@cs.wisc.eduuint64_t 519594Snilay@cs.wisc.eduAlphaArguments::getArg(bool fp) 527054Snate@binkert.org{ 539465Snilay@cs.wisc.edu if (number < 6) { 546145Snate@binkert.org if (fp) 556145Snate@binkert.org return xc->regs.floatRegFile.q[16 + number]; 566145Snate@binkert.org else 576145Snate@binkert.org return xc->regs.intRegFile[16 + number]; 586145Snate@binkert.org } else { 599465Snilay@cs.wisc.edu Addr sp = xc->regs.intRegFile[30]; 607054Snate@binkert.org Addr paddr = vtophys(xc, sp + (number-6) * sizeof(uint64_t)); 617054Snate@binkert.org return xc->physmem->phys_read_qword(paddr); 626876Ssteve.reinhardt@amd.com } 636876Ssteve.reinhardt@amd.com} 647054Snate@binkert.org 659594Snilay@cs.wisc.edu