utility.cc revision 5499:8bfc7650c344
111388Ssteve.reinhardt@amd.com/*
211388Ssteve.reinhardt@amd.com * Copyright (c) 2003-2005 The Regents of The University of Michigan
38673SN/A * All rights reserved.
48673SN/A *
55729SN/A * Redistribution and use in source and binary forms, with or without
611960Sgabeblack@google.com * modification, are permitted provided that the following conditions are
711960Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
811960Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
911960Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1011388Ssteve.reinhardt@amd.com * notice, this list of conditions and the following disclaimer in the
115729SN/A * documentation and/or other materials provided with the distribution;
125729SN/A * neither the name of the copyright holders nor the names of its
1311960Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
145729SN/A * this software without specific prior written permission.
155729SN/A *
165729SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
175729SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
185729SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
195729SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
205729SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
215729SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
225729SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
235729SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
245729SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
255729SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
265729SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
275729SN/A *
285729SN/A * Authors: Nathan Binkert
295729SN/A *          Ali Saidi
305729SN/A */
315729SN/A
325729SN/A#include "arch/alpha/utility.hh"
335729SN/A
345729SN/A#if FULL_SYSTEM
355729SN/A#include "arch/alpha/vtophys.hh"
365729SN/A#include "mem/vport.hh"
375729SN/A#endif
385729SN/A
395729SN/Anamespace AlphaISA
405729SN/A{
415729SN/A
425729SN/Auint64_t getArgument(ThreadContext *tc, int number, bool fp)
435729SN/A{
445729SN/A#if FULL_SYSTEM
455729SN/A    if (number < NumArgumentRegs) {
465729SN/A        if (fp)
475729SN/A            return tc->readFloatRegBits(ArgumentReg[number]);
485729SN/A        else
495729SN/A            return tc->readIntReg(ArgumentReg[number]);
505729SN/A    } else {
515729SN/A        Addr sp = tc->readIntReg(StackPointerReg);
525729SN/A        VirtualPort *vp = tc->getVirtPort();
535729SN/A        uint64_t arg = vp->read<uint64_t>(sp +
545729SN/A                           (number-NumArgumentRegs) * sizeof(uint64_t));
555729SN/A        return arg;
565729SN/A    }
575729SN/A#else
585729SN/A    panic("getArgument() is Full system only\n");
595729SN/A    M5_DUMMY_RETURN
605729SN/A#endif
615729SN/A}
625729SN/A
635729SN/A} // namespace AlphaISA
645729SN/A
655729SN/A