isa.cc revision 6376
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 316313Sgblack@eecs.umich.edu#include "arch/alpha/isa.hh" 326330Sgblack@eecs.umich.edu#include "base/misc.hh" 336313Sgblack@eecs.umich.edu#include "cpu/thread_context.hh" 346313Sgblack@eecs.umich.edu 356313Sgblack@eecs.umich.edunamespace AlphaISA 366313Sgblack@eecs.umich.edu{ 376313Sgblack@eecs.umich.edu 386313Sgblack@eecs.umich.eduvoid 396313Sgblack@eecs.umich.eduISA::serialize(std::ostream &os) 406313Sgblack@eecs.umich.edu{ 416330Sgblack@eecs.umich.edu SERIALIZE_SCALAR(fpcr); 426330Sgblack@eecs.umich.edu SERIALIZE_SCALAR(uniq); 436330Sgblack@eecs.umich.edu SERIALIZE_SCALAR(lock_flag); 446330Sgblack@eecs.umich.edu SERIALIZE_SCALAR(lock_addr); 456330Sgblack@eecs.umich.edu SERIALIZE_ARRAY(ipr, NumInternalProcRegs); 466313Sgblack@eecs.umich.edu} 476313Sgblack@eecs.umich.edu 486313Sgblack@eecs.umich.eduvoid 496313Sgblack@eecs.umich.eduISA::unserialize(Checkpoint *cp, const std::string §ion) 506313Sgblack@eecs.umich.edu{ 516330Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(fpcr); 526330Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(uniq); 536330Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(lock_flag); 546330Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(lock_addr); 556330Sgblack@eecs.umich.edu UNSERIALIZE_ARRAY(ipr, NumInternalProcRegs); 566330Sgblack@eecs.umich.edu} 576330Sgblack@eecs.umich.edu 586330Sgblack@eecs.umich.edu 596330Sgblack@eecs.umich.eduMiscReg 606330Sgblack@eecs.umich.eduISA::readMiscRegNoEffect(int misc_reg, ThreadID tid) 616330Sgblack@eecs.umich.edu{ 626330Sgblack@eecs.umich.edu switch (misc_reg) { 636330Sgblack@eecs.umich.edu case MISCREG_FPCR: 646330Sgblack@eecs.umich.edu return fpcr; 656330Sgblack@eecs.umich.edu case MISCREG_UNIQ: 666330Sgblack@eecs.umich.edu return uniq; 676330Sgblack@eecs.umich.edu case MISCREG_LOCKFLAG: 686330Sgblack@eecs.umich.edu return lock_flag; 696330Sgblack@eecs.umich.edu case MISCREG_LOCKADDR: 706330Sgblack@eecs.umich.edu return lock_addr; 716330Sgblack@eecs.umich.edu case MISCREG_INTR: 726330Sgblack@eecs.umich.edu return intr_flag; 736330Sgblack@eecs.umich.edu default: 746330Sgblack@eecs.umich.edu assert(misc_reg < NumInternalProcRegs); 756330Sgblack@eecs.umich.edu return ipr[misc_reg]; 766330Sgblack@eecs.umich.edu } 776330Sgblack@eecs.umich.edu} 786330Sgblack@eecs.umich.edu 796330Sgblack@eecs.umich.eduMiscReg 806330Sgblack@eecs.umich.eduISA::readMiscReg(int misc_reg, ThreadContext *tc, ThreadID tid) 816330Sgblack@eecs.umich.edu{ 826330Sgblack@eecs.umich.edu switch (misc_reg) { 836330Sgblack@eecs.umich.edu case MISCREG_FPCR: 846330Sgblack@eecs.umich.edu return fpcr; 856330Sgblack@eecs.umich.edu case MISCREG_UNIQ: 866330Sgblack@eecs.umich.edu return uniq; 876330Sgblack@eecs.umich.edu case MISCREG_LOCKFLAG: 886330Sgblack@eecs.umich.edu return lock_flag; 896330Sgblack@eecs.umich.edu case MISCREG_LOCKADDR: 906330Sgblack@eecs.umich.edu return lock_addr; 916330Sgblack@eecs.umich.edu case MISCREG_INTR: 926330Sgblack@eecs.umich.edu return intr_flag; 936330Sgblack@eecs.umich.edu default: 946330Sgblack@eecs.umich.edu return readIpr(misc_reg, tc); 956330Sgblack@eecs.umich.edu } 966330Sgblack@eecs.umich.edu} 976330Sgblack@eecs.umich.edu 986330Sgblack@eecs.umich.eduvoid 996330Sgblack@eecs.umich.eduISA::setMiscRegNoEffect(int misc_reg, const MiscReg &val, ThreadID tid) 1006330Sgblack@eecs.umich.edu{ 1016330Sgblack@eecs.umich.edu switch (misc_reg) { 1026330Sgblack@eecs.umich.edu case MISCREG_FPCR: 1036330Sgblack@eecs.umich.edu fpcr = val; 1046330Sgblack@eecs.umich.edu return; 1056330Sgblack@eecs.umich.edu case MISCREG_UNIQ: 1066330Sgblack@eecs.umich.edu uniq = val; 1076330Sgblack@eecs.umich.edu return; 1086330Sgblack@eecs.umich.edu case MISCREG_LOCKFLAG: 1096330Sgblack@eecs.umich.edu lock_flag = val; 1106330Sgblack@eecs.umich.edu return; 1116330Sgblack@eecs.umich.edu case MISCREG_LOCKADDR: 1126330Sgblack@eecs.umich.edu lock_addr = val; 1136330Sgblack@eecs.umich.edu return; 1146330Sgblack@eecs.umich.edu case MISCREG_INTR: 1156330Sgblack@eecs.umich.edu intr_flag = val; 1166330Sgblack@eecs.umich.edu return; 1176330Sgblack@eecs.umich.edu default: 1186330Sgblack@eecs.umich.edu assert(misc_reg < NumInternalProcRegs); 1196330Sgblack@eecs.umich.edu ipr[misc_reg] = val; 1206330Sgblack@eecs.umich.edu return; 1216330Sgblack@eecs.umich.edu } 1226330Sgblack@eecs.umich.edu} 1236330Sgblack@eecs.umich.edu 1246330Sgblack@eecs.umich.eduvoid 1256330Sgblack@eecs.umich.eduISA::setMiscReg(int misc_reg, const MiscReg &val, ThreadContext *tc, 1266330Sgblack@eecs.umich.edu ThreadID tid) 1276330Sgblack@eecs.umich.edu{ 1286330Sgblack@eecs.umich.edu switch (misc_reg) { 1296330Sgblack@eecs.umich.edu case MISCREG_FPCR: 1306330Sgblack@eecs.umich.edu fpcr = val; 1316330Sgblack@eecs.umich.edu return; 1326330Sgblack@eecs.umich.edu case MISCREG_UNIQ: 1336330Sgblack@eecs.umich.edu uniq = val; 1346330Sgblack@eecs.umich.edu return; 1356330Sgblack@eecs.umich.edu case MISCREG_LOCKFLAG: 1366330Sgblack@eecs.umich.edu lock_flag = val; 1376330Sgblack@eecs.umich.edu return; 1386330Sgblack@eecs.umich.edu case MISCREG_LOCKADDR: 1396330Sgblack@eecs.umich.edu lock_addr = val; 1406330Sgblack@eecs.umich.edu return; 1416330Sgblack@eecs.umich.edu case MISCREG_INTR: 1426330Sgblack@eecs.umich.edu intr_flag = val; 1436330Sgblack@eecs.umich.edu return; 1446330Sgblack@eecs.umich.edu default: 1456330Sgblack@eecs.umich.edu setIpr(misc_reg, val, tc); 1466330Sgblack@eecs.umich.edu return; 1476330Sgblack@eecs.umich.edu } 1486313Sgblack@eecs.umich.edu} 1496313Sgblack@eecs.umich.edu 1506313Sgblack@eecs.umich.edu} 151