utility.cc revision 5647
14826Ssaidi@eecs.umich.edu/* 24826Ssaidi@eecs.umich.edu * Copyright (c) 2003-2005 The Regents of The University of Michigan 34826Ssaidi@eecs.umich.edu * All rights reserved. 44826Ssaidi@eecs.umich.edu * 54826Ssaidi@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 64826Ssaidi@eecs.umich.edu * modification, are permitted provided that the following conditions are 74826Ssaidi@eecs.umich.edu * met: redistributions of source code must retain the above copyright 84826Ssaidi@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 94826Ssaidi@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 104826Ssaidi@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 114826Ssaidi@eecs.umich.edu * documentation and/or other materials provided with the distribution; 124826Ssaidi@eecs.umich.edu * neither the name of the copyright holders nor the names of its 134826Ssaidi@eecs.umich.edu * contributors may be used to endorse or promote products derived from 144826Ssaidi@eecs.umich.edu * this software without specific prior written permission. 154826Ssaidi@eecs.umich.edu * 164826Ssaidi@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 174826Ssaidi@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 184826Ssaidi@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 194826Ssaidi@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 204826Ssaidi@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 214826Ssaidi@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224826Ssaidi@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 234826Ssaidi@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244826Ssaidi@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254826Ssaidi@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264826Ssaidi@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274826Ssaidi@eecs.umich.edu * 284826Ssaidi@eecs.umich.edu * Authors: Nathan Binkert 294826Ssaidi@eecs.umich.edu * Ali Saidi 304826Ssaidi@eecs.umich.edu */ 314826Ssaidi@eecs.umich.edu 324826Ssaidi@eecs.umich.edu#include "arch/alpha/utility.hh" 334826Ssaidi@eecs.umich.edu 344826Ssaidi@eecs.umich.edu#if FULL_SYSTEM 354826Ssaidi@eecs.umich.edu#include "arch/alpha/vtophys.hh" 364826Ssaidi@eecs.umich.edu#include "mem/vport.hh" 374826Ssaidi@eecs.umich.edu#endif 384826Ssaidi@eecs.umich.edu 395569Snate@binkert.orgnamespace AlphaISA { 404826Ssaidi@eecs.umich.edu 415569Snate@binkert.orguint64_t 425569Snate@binkert.orggetArgument(ThreadContext *tc, int number, bool fp) 434826Ssaidi@eecs.umich.edu{ 444826Ssaidi@eecs.umich.edu#if FULL_SYSTEM 454826Ssaidi@eecs.umich.edu if (number < NumArgumentRegs) { 464826Ssaidi@eecs.umich.edu if (fp) 474826Ssaidi@eecs.umich.edu return tc->readFloatRegBits(ArgumentReg[number]); 484826Ssaidi@eecs.umich.edu else 494826Ssaidi@eecs.umich.edu return tc->readIntReg(ArgumentReg[number]); 504826Ssaidi@eecs.umich.edu } else { 514826Ssaidi@eecs.umich.edu Addr sp = tc->readIntReg(StackPointerReg); 525498Ssaidi@eecs.umich.edu VirtualPort *vp = tc->getVirtPort(); 534826Ssaidi@eecs.umich.edu uint64_t arg = vp->read<uint64_t>(sp + 544826Ssaidi@eecs.umich.edu (number-NumArgumentRegs) * sizeof(uint64_t)); 554826Ssaidi@eecs.umich.edu return arg; 564826Ssaidi@eecs.umich.edu } 574826Ssaidi@eecs.umich.edu#else 584826Ssaidi@eecs.umich.edu panic("getArgument() is Full system only\n"); 595569Snate@binkert.org M5_DUMMY_RETURN; 604826Ssaidi@eecs.umich.edu#endif 614826Ssaidi@eecs.umich.edu} 624826Ssaidi@eecs.umich.edu 634826Ssaidi@eecs.umich.edu} // namespace AlphaISA 644826Ssaidi@eecs.umich.edu 65