isa.hh revision 10844
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#ifndef __ARCH_X86_ISA_HH__
326313Sgblack@eecs.umich.edu#define __ARCH_X86_ISA_HH__
336313Sgblack@eecs.umich.edu
348229Snate@binkert.org#include <iostream>
358229Snate@binkert.org#include <string>
368229Snate@binkert.org
376335Sgblack@eecs.umich.edu#include "arch/x86/regs/float.hh"
386313Sgblack@eecs.umich.edu#include "arch/x86/regs/misc.hh"
396335Sgblack@eecs.umich.edu#include "arch/x86/registers.hh"
4012106SRekai.GonzalezAlberquilla@arm.com#include "base/types.hh"
419384SAndreas.Sandberg@arm.com#include "sim/sim_object.hh"
426335Sgblack@eecs.umich.edu
436313Sgblack@eecs.umich.educlass Checkpoint;
446313Sgblack@eecs.umich.educlass EventManager;
459384SAndreas.Sandberg@arm.comclass ThreadContext;
466335Sgblack@eecs.umich.edustruct X86ISAParams;
476313Sgblack@eecs.umich.edu
486313Sgblack@eecs.umich.edunamespace X86ISA
496313Sgblack@eecs.umich.edu{
509384SAndreas.Sandberg@arm.com    class ISA : public SimObject
517741Sgblack@eecs.umich.edu    {
527741Sgblack@eecs.umich.edu      protected:
536335Sgblack@eecs.umich.edu        MiscReg regVal[NUM_MISCREGS];
547741Sgblack@eecs.umich.edu        void updateHandyM5Reg(Efer efer, CR0 cr0,
557741Sgblack@eecs.umich.edu                SegAttr csAttr, SegAttr ssAttr, RFLAGS rflags,
567741Sgblack@eecs.umich.edu                ThreadContext *tc);
577741Sgblack@eecs.umich.edu
587741Sgblack@eecs.umich.edu      public:
597741Sgblack@eecs.umich.edu        typedef X86ISAParams Params;
607741Sgblack@eecs.umich.edu
617741Sgblack@eecs.umich.edu        void clear();
627741Sgblack@eecs.umich.edu
637741Sgblack@eecs.umich.edu        ISA(Params *p);
647741Sgblack@eecs.umich.edu        const Params *params() const;
656335Sgblack@eecs.umich.edu
666335Sgblack@eecs.umich.edu        MiscReg readMiscRegNoEffect(int miscReg) const;
677741Sgblack@eecs.umich.edu        MiscReg readMiscReg(int miscReg, ThreadContext *tc);
687741Sgblack@eecs.umich.edu
697741Sgblack@eecs.umich.edu        void setMiscRegNoEffect(int miscReg, MiscReg val);
707741Sgblack@eecs.umich.edu        void setMiscReg(int miscReg, MiscReg val, ThreadContext *tc);
717741Sgblack@eecs.umich.edu
727741Sgblack@eecs.umich.edu        int
737741Sgblack@eecs.umich.edu        flattenIntIndex(int reg) const
747741Sgblack@eecs.umich.edu        {
757741Sgblack@eecs.umich.edu            return reg & ~IntFoldBit;
766335Sgblack@eecs.umich.edu        }
778829Sgblack@eecs.umich.edu
787741Sgblack@eecs.umich.edu        int
797741Sgblack@eecs.umich.edu        flattenFloatIndex(int reg) const
807741Sgblack@eecs.umich.edu        {
817741Sgblack@eecs.umich.edu            if (reg >= NUM_FLOATREGS) {
827741Sgblack@eecs.umich.edu                reg = FLOATREG_STACK(reg - NUM_FLOATREGS,
837741Sgblack@eecs.umich.edu                                     regVal[MISCREG_X87_TOP]);
847741Sgblack@eecs.umich.edu            }
857741Sgblack@eecs.umich.edu            return reg;
867741Sgblack@eecs.umich.edu        }
876335Sgblack@eecs.umich.edu
887741Sgblack@eecs.umich.edu        int
898829Sgblack@eecs.umich.edu        flattenCCIndex(int reg) const
907741Sgblack@eecs.umich.edu        {
917741Sgblack@eecs.umich.edu            return reg;
927741Sgblack@eecs.umich.edu        }
937741Sgblack@eecs.umich.edu
946335Sgblack@eecs.umich.edu        int
957741Sgblack@eecs.umich.edu        flattenMiscIndex(int reg) const
966335Sgblack@eecs.umich.edu        {
977741Sgblack@eecs.umich.edu            return reg;
987741Sgblack@eecs.umich.edu        }
996335Sgblack@eecs.umich.edu
1007741Sgblack@eecs.umich.edu        void serialize(std::ostream &os);
1017741Sgblack@eecs.umich.edu        void unserialize(Checkpoint *cp, const std::string &section);
1027741Sgblack@eecs.umich.edu        void startup(ThreadContext *tc);
1037741Sgblack@eecs.umich.edu
1047741Sgblack@eecs.umich.edu        /// Explicitly import the otherwise hidden startup
1056335Sgblack@eecs.umich.edu        using SimObject::startup;
1067741Sgblack@eecs.umich.edu
1076335Sgblack@eecs.umich.edu    };
1087741Sgblack@eecs.umich.edu}
1097741Sgblack@eecs.umich.edu
1107741Sgblack@eecs.umich.edu#endif
1117741Sgblack@eecs.umich.edu