isa.cc revision 8181
16313Sgblack@eecs.umich.edu/*
26313Sgblack@eecs.umich.edu * Copyright (c) 2009 The Regents of The University of Michigan
36313Sgblack@eecs.umich.edu * All rights reserved.
46313Sgblack@eecs.umich.edu *
56313Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
66313Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
76313Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
86313Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
96313Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
106313Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
116313Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
126313Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
136313Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
146313Sgblack@eecs.umich.edu * this software without specific prior written permission.
156313Sgblack@eecs.umich.edu *
166313Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
176313Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
186313Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
196313Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
206313Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
216313Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
226313Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
236313Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
246313Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
256313Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
266313Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
276313Sgblack@eecs.umich.edu *
286313Sgblack@eecs.umich.edu * Authors: Gabe Black
296313Sgblack@eecs.umich.edu */
306313Sgblack@eecs.umich.edu
317678Sgblack@eecs.umich.edu#include <cassert>
327678Sgblack@eecs.umich.edu
336313Sgblack@eecs.umich.edu#include "arch/alpha/isa.hh"
346330Sgblack@eecs.umich.edu#include "base/misc.hh"
356313Sgblack@eecs.umich.edu#include "cpu/thread_context.hh"
367680Sgblack@eecs.umich.edu#include "sim/serialize.hh"
376313Sgblack@eecs.umich.edu
386313Sgblack@eecs.umich.edunamespace AlphaISA
396313Sgblack@eecs.umich.edu{
406313Sgblack@eecs.umich.edu
416313Sgblack@eecs.umich.eduvoid
426678Sgblack@eecs.umich.eduISA::serialize(EventManager *em, std::ostream &os)
436313Sgblack@eecs.umich.edu{
446330Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(fpcr);
456330Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(uniq);
466330Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(lock_flag);
476330Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(lock_addr);
486330Sgblack@eecs.umich.edu    SERIALIZE_ARRAY(ipr, NumInternalProcRegs);
496313Sgblack@eecs.umich.edu}
506313Sgblack@eecs.umich.edu
516313Sgblack@eecs.umich.eduvoid
526678Sgblack@eecs.umich.eduISA::unserialize(EventManager *em, Checkpoint *cp, const std::string &section)
536313Sgblack@eecs.umich.edu{
546330Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(fpcr);
556330Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(uniq);
566330Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(lock_flag);
576330Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(lock_addr);
586330Sgblack@eecs.umich.edu    UNSERIALIZE_ARRAY(ipr, NumInternalProcRegs);
596330Sgblack@eecs.umich.edu}
606330Sgblack@eecs.umich.edu
616330Sgblack@eecs.umich.edu
626330Sgblack@eecs.umich.eduMiscReg
636330Sgblack@eecs.umich.eduISA::readMiscRegNoEffect(int misc_reg, ThreadID tid)
646330Sgblack@eecs.umich.edu{
656330Sgblack@eecs.umich.edu    switch (misc_reg) {
666330Sgblack@eecs.umich.edu      case MISCREG_FPCR:
676330Sgblack@eecs.umich.edu        return fpcr;
686330Sgblack@eecs.umich.edu      case MISCREG_UNIQ:
696330Sgblack@eecs.umich.edu        return uniq;
706330Sgblack@eecs.umich.edu      case MISCREG_LOCKFLAG:
716330Sgblack@eecs.umich.edu        return lock_flag;
726330Sgblack@eecs.umich.edu      case MISCREG_LOCKADDR:
736330Sgblack@eecs.umich.edu        return lock_addr;
746330Sgblack@eecs.umich.edu      case MISCREG_INTR:
756330Sgblack@eecs.umich.edu        return intr_flag;
766330Sgblack@eecs.umich.edu      default:
776330Sgblack@eecs.umich.edu        assert(misc_reg < NumInternalProcRegs);
786330Sgblack@eecs.umich.edu        return ipr[misc_reg];
796330Sgblack@eecs.umich.edu    }
806330Sgblack@eecs.umich.edu}
816330Sgblack@eecs.umich.edu
826330Sgblack@eecs.umich.eduMiscReg
836330Sgblack@eecs.umich.eduISA::readMiscReg(int misc_reg, ThreadContext *tc, ThreadID tid)
846330Sgblack@eecs.umich.edu{
856330Sgblack@eecs.umich.edu    switch (misc_reg) {
866330Sgblack@eecs.umich.edu      case MISCREG_FPCR:
876330Sgblack@eecs.umich.edu        return fpcr;
886330Sgblack@eecs.umich.edu      case MISCREG_UNIQ:
896330Sgblack@eecs.umich.edu        return uniq;
906330Sgblack@eecs.umich.edu      case MISCREG_LOCKFLAG:
916330Sgblack@eecs.umich.edu        return lock_flag;
926330Sgblack@eecs.umich.edu      case MISCREG_LOCKADDR:
936330Sgblack@eecs.umich.edu        return lock_addr;
946330Sgblack@eecs.umich.edu      case MISCREG_INTR:
956330Sgblack@eecs.umich.edu        return intr_flag;
966330Sgblack@eecs.umich.edu      default:
976330Sgblack@eecs.umich.edu        return readIpr(misc_reg, tc);
986330Sgblack@eecs.umich.edu    }
996330Sgblack@eecs.umich.edu}
1006330Sgblack@eecs.umich.edu
1016330Sgblack@eecs.umich.eduvoid
1026330Sgblack@eecs.umich.eduISA::setMiscRegNoEffect(int misc_reg, const MiscReg &val, ThreadID tid)
1036330Sgblack@eecs.umich.edu{
1046330Sgblack@eecs.umich.edu    switch (misc_reg) {
1056330Sgblack@eecs.umich.edu      case MISCREG_FPCR:
1066330Sgblack@eecs.umich.edu        fpcr = val;
1076330Sgblack@eecs.umich.edu        return;
1086330Sgblack@eecs.umich.edu      case MISCREG_UNIQ:
1096330Sgblack@eecs.umich.edu        uniq = val;
1106330Sgblack@eecs.umich.edu        return;
1116330Sgblack@eecs.umich.edu      case MISCREG_LOCKFLAG:
1126330Sgblack@eecs.umich.edu        lock_flag = val;
1136330Sgblack@eecs.umich.edu        return;
1146330Sgblack@eecs.umich.edu      case MISCREG_LOCKADDR:
1156330Sgblack@eecs.umich.edu        lock_addr = val;
1166330Sgblack@eecs.umich.edu        return;
1176330Sgblack@eecs.umich.edu      case MISCREG_INTR:
1186330Sgblack@eecs.umich.edu        intr_flag = val;
1196330Sgblack@eecs.umich.edu        return;
1206330Sgblack@eecs.umich.edu      default:
1216330Sgblack@eecs.umich.edu        assert(misc_reg < NumInternalProcRegs);
1226330Sgblack@eecs.umich.edu        ipr[misc_reg] = val;
1236330Sgblack@eecs.umich.edu        return;
1246330Sgblack@eecs.umich.edu    }
1256330Sgblack@eecs.umich.edu}
1266330Sgblack@eecs.umich.edu
1276330Sgblack@eecs.umich.eduvoid
1286330Sgblack@eecs.umich.eduISA::setMiscReg(int misc_reg, const MiscReg &val, ThreadContext *tc,
1296330Sgblack@eecs.umich.edu                ThreadID tid)
1306330Sgblack@eecs.umich.edu{
1316330Sgblack@eecs.umich.edu    switch (misc_reg) {
1326330Sgblack@eecs.umich.edu      case MISCREG_FPCR:
1336330Sgblack@eecs.umich.edu        fpcr = val;
1346330Sgblack@eecs.umich.edu        return;
1356330Sgblack@eecs.umich.edu      case MISCREG_UNIQ:
1366330Sgblack@eecs.umich.edu        uniq = val;
1376330Sgblack@eecs.umich.edu        return;
1386330Sgblack@eecs.umich.edu      case MISCREG_LOCKFLAG:
1396330Sgblack@eecs.umich.edu        lock_flag = val;
1406330Sgblack@eecs.umich.edu        return;
1416330Sgblack@eecs.umich.edu      case MISCREG_LOCKADDR:
1426330Sgblack@eecs.umich.edu        lock_addr = val;
1436330Sgblack@eecs.umich.edu        return;
1446330Sgblack@eecs.umich.edu      case MISCREG_INTR:
1456330Sgblack@eecs.umich.edu        intr_flag = val;
1466330Sgblack@eecs.umich.edu        return;
1476330Sgblack@eecs.umich.edu      default:
1486330Sgblack@eecs.umich.edu        setIpr(misc_reg, val, tc);
1496330Sgblack@eecs.umich.edu        return;
1506330Sgblack@eecs.umich.edu    }
1516313Sgblack@eecs.umich.edu}
1526313Sgblack@eecs.umich.edu
1536313Sgblack@eecs.umich.edu}
154