isa.hh revision 7404
12381SN/A/*
22592SN/A * Copyright (c) 2009 The Regents of The University of Michigan
32381SN/A * All rights reserved.
42381SN/A *
52381SN/A * Redistribution and use in source and binary forms, with or without
62381SN/A * modification, are permitted provided that the following conditions are
72381SN/A * met: redistributions of source code must retain the above copyright
82381SN/A * notice, this list of conditions and the following disclaimer;
92381SN/A * redistributions in binary form must reproduce the above copyright
102381SN/A * notice, this list of conditions and the following disclaimer in the
112381SN/A * documentation and/or other materials provided with the distribution;
122381SN/A * neither the name of the copyright holders nor the names of its
132381SN/A * contributors may be used to endorse or promote products derived from
142381SN/A * this software without specific prior written permission.
152381SN/A *
162381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Gabe Black
292665Ssaidi@eecs.umich.edu */
302665Ssaidi@eecs.umich.edu
312381SN/A#ifndef __ARCH_X86_ISA_HH__
322381SN/A#define __ARCH_X86_ISA_HH__
332381SN/A
342381SN/A#include "arch/x86/floatregs.hh"
352662Sstever@eecs.umich.edu#include "arch/x86/miscregs.hh"
362381SN/A#include "arch/x86/registers.hh"
372381SN/A#include "base/types.hh"
382381SN/A
392381SN/A#include <string>
402381SN/A#include <iostream>
413348Sbinkertn@umich.edu
423348Sbinkertn@umich.educlass Checkpoint;
433348Sbinkertn@umich.educlass EventManager;
442392SN/Aclass ThreadContext;
452980Sgblack@eecs.umich.edu
462394SN/Anamespace X86ISA
472394SN/A{
482394SN/A    class ISA
492394SN/A    {
502394SN/A      protected:
512812Srdreslin@umich.edu        MiscReg regVal[NUM_MISCREGS];
522812Srdreslin@umich.edu        void updateHandyM5Reg(Efer efer, CR0 cr0,
532812Srdreslin@umich.edu                SegAttr csAttr, SegAttr ssAttr, RFLAGS rflags);
542812Srdreslin@umich.edu
552812Srdreslin@umich.edu      public:
562812Srdreslin@umich.edu        void clear();
572813Srdreslin@umich.edu
582813Srdreslin@umich.edu        ISA()
592813Srdreslin@umich.edu        {
603074Srdreslin@umich.edu            clear();
612382SN/A        }
623208Srdreslin@umich.edu
633214Srdreslin@umich.edu        MiscReg readMiscRegNoEffect(int miscReg);
642381SN/A        MiscReg readMiscReg(int miscReg, ThreadContext *tc);
652662Sstever@eecs.umich.edu
662662Sstever@eecs.umich.edu        void setMiscRegNoEffect(int miscReg, MiscReg val);
672662Sstever@eecs.umich.edu        void setMiscReg(int miscReg, MiscReg val, ThreadContext *tc);
682662Sstever@eecs.umich.edu
692662Sstever@eecs.umich.edu        int
702381SN/A        flattenIntIndex(int reg)
712641Sstever@eecs.umich.edu        {
722381SN/A            return reg & ~IntFoldBit;
732813Srdreslin@umich.edu        }
742813Srdreslin@umich.edu
752813Srdreslin@umich.edu        int
762813Srdreslin@umich.edu        flattenFloatIndex(int reg)
772566SN/A        {
782662Sstever@eecs.umich.edu            if (reg >= NUM_FLOATREGS) {
792662Sstever@eecs.umich.edu                reg = FLOATREG_STACK(reg - NUM_FLOATREGS,
802662Sstever@eecs.umich.edu                                     regVal[MISCREG_X87_TOP]);
812662Sstever@eecs.umich.edu            }
822662Sstever@eecs.umich.edu            return reg;
832566SN/A        }
842566SN/A
852566SN/A        void serialize(EventManager *em, std::ostream &os);
862662Sstever@eecs.umich.edu        void unserialize(EventManager *em, Checkpoint *cp,
872662Sstever@eecs.umich.edu                const std::string &section);
882566SN/A    };
892662Sstever@eecs.umich.edu}
902662Sstever@eecs.umich.edu
912566SN/A#endif
922662Sstever@eecs.umich.edu