2 * Copyright (c) 2009 The Regents of The University of Michigan
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef __ARCH_X86_ISA_HH__
32 #define __ARCH_X86_ISA_HH__
37 #include "arch/x86/regs/float.hh"
38 #include "arch/x86/regs/misc.hh"
39 #include "arch/x86/registers.hh"
40 #include "base/types.hh"
41 #include "cpu/reg_class.hh"
42 #include "sim/sim_object.hh"
51 class ISA : public SimObject
54 MiscReg regVal[NUM_MISCREGS];
55 void updateHandyM5Reg(Efer efer, CR0 cr0,
56 SegAttr csAttr, SegAttr ssAttr, RFLAGS rflags,
60 typedef X86ISAParams Params;
65 const Params *params() const;
67 MiscReg readMiscRegNoEffect(int miscReg) const;
68 MiscReg readMiscReg(int miscReg, ThreadContext *tc);
70 void setMiscRegNoEffect(int miscReg, MiscReg val);
71 void setMiscReg(int miscReg, MiscReg val, ThreadContext *tc);
74 flattenRegId(const RegId& regId) const
76 switch (regId.classValue()) {
78 return RegId(IntRegClass, flattenIntIndex(regId.index()));
80 return RegId(FloatRegClass, flattenFloatIndex(regId.index()));
82 return RegId(CCRegClass, flattenCCIndex(regId.index()));
84 return RegId(MiscRegClass, flattenMiscIndex(regId.index()));
90 flattenIntIndex(int reg) const
92 return reg & ~IntFoldBit;
96 flattenFloatIndex(int reg) const
98 if (reg >= NUM_FLOATREGS) {
99 reg = FLOATREG_STACK(reg - NUM_FLOATREGS,
100 regVal[MISCREG_X87_TOP]);
106 flattenCCIndex(int reg) const
112 flattenMiscIndex(int reg) const
117 void serialize(CheckpointOut &cp) const override;
118 void unserialize(CheckpointIn &cp) override;
120 void startup(ThreadContext *tc);
122 /// Explicitly import the otherwise hidden startup
123 using SimObject::startup;