arguments.cc revision 2
1695SN/A/* 29262Ssascha.bischoff@arm.com * Copyright (c) 2003 The Regents of The University of Michigan 39262Ssascha.bischoff@arm.com * All rights reserved. 49262Ssascha.bischoff@arm.com * 59262Ssascha.bischoff@arm.com * Redistribution and use in source and binary forms, with or without 69262Ssascha.bischoff@arm.com * modification, are permitted provided that the following conditions are 79262Ssascha.bischoff@arm.com * met: redistributions of source code must retain the above copyright 89262Ssascha.bischoff@arm.com * notice, this list of conditions and the following disclaimer; 99262Ssascha.bischoff@arm.com * redistributions in binary form must reproduce the above copyright 109262Ssascha.bischoff@arm.com * notice, this list of conditions and the following disclaimer in the 119262Ssascha.bischoff@arm.com * documentation and/or other materials provided with the distribution; 129262Ssascha.bischoff@arm.com * neither the name of the copyright holders nor the names of its 139262Ssascha.bischoff@arm.com * contributors may be used to endorse or promote products derived from 141762SN/A * this software without specific prior written permission. 159983Sstever@gmail.com * 169983Sstever@gmail.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17695SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18695SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19695SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20695SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21695SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22695SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23695SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24695SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25695SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26695SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27695SN/A */ 28695SN/A 29695SN/A#include "arguments.hh" 30695SN/A#include "exec_context.hh" 31695SN/A#include "physical_memory.hh" 32695SN/A#include "vtophys.hh" 33695SN/A 34695SN/AAlphaArguments::Data::~Data() 35695SN/A{ 36695SN/A while (!data.empty()) { 37695SN/A delete [] data.front(); 38695SN/A data.pop_front(); 39695SN/A } 40695SN/A} 412665Ssaidi@eecs.umich.edu 422665Ssaidi@eecs.umich.educhar * 439262Ssascha.bischoff@arm.comAlphaArguments::Data::alloc(size_t size) 44695SN/A{ 45695SN/A char *buf = new char[size]; 46695SN/A data.push_back(buf); 47695SN/A return buf; 48695SN/A} 49695SN/A 50695SN/Auint64_t 51695SN/AAlphaArguments::getArg(bool fp) 52695SN/A{ 53695SN/A if (number < 6) { 54695SN/A if (fp) 55695SN/A return xc->regs.floatRegFile.q[16 + number]; 56695SN/A else 571717SN/A return xc->regs.intRegFile[16 + number]; 589983Sstever@gmail.com } else { 597822Ssteve.reinhardt@amd.com Addr sp = xc->regs.intRegFile[30]; 60695SN/A Addr paddr = vtophys(xc, sp + (number-6) * sizeof(uint64_t)); 61695SN/A return xc->physmem->phys_read_qword(paddr); 62695SN/A } 63729SN/A} 647068Snate@binkert.org 658720SAli.Saidi@ARM.com