gem5  v22.1.0.0
isa.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 The Regents of The University of Michigan
3  * All rights reserved.
4  *
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.
15  *
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.
27  */
28 
29 #ifndef __ARCH_X86_ISA_HH__
30 #define __ARCH_X86_ISA_HH__
31 
32 #include <iostream>
33 #include <string>
34 
35 #include "arch/generic/isa.hh"
36 #include "arch/x86/pcstate.hh"
37 #include "arch/x86/regs/ccr.hh"
38 #include "arch/x86/regs/float.hh"
39 #include "arch/x86/regs/int.hh"
40 #include "arch/x86/regs/misc.hh"
41 #include "base/types.hh"
42 #include "cpu/reg_class.hh"
43 
44 namespace gem5
45 {
46 
47 class ThreadContext;
48 struct X86ISAParams;
49 
50 namespace X86ISA
51 {
52 
53 class ISA : public BaseISA
54 {
55  private:
57  void updateHandyM5Reg(Efer efer, CR0 cr0,
58  SegAttr csAttr, SegAttr ssAttr, RFLAGS rflags);
59 
60  std::string vendorString;
61 
62  public:
63  void clear() override;
64 
65  PCStateBase *
66  newPCState(Addr new_inst_addr=0) const override
67  {
68  return new PCState(new_inst_addr);
69  }
70 
71  using Params = X86ISAParams;
72 
73  ISA(const Params &p);
74 
75  RegVal readMiscRegNoEffect(RegIndex idx) const override;
76  RegVal readMiscReg(RegIndex idx) override;
77 
78  void setMiscRegNoEffect(RegIndex idx, RegVal val) override;
79  void setMiscReg(RegIndex idx, RegVal val) override;
80 
81  bool
82  inUserMode() const override
83  {
84  HandyM5Reg m5reg = readMiscRegNoEffect(misc_reg::M5Reg);
85  return m5reg.cpl == 3;
86  }
87 
88  void copyRegsFrom(ThreadContext *src) override;
89 
90  void serialize(CheckpointOut &cp) const override;
91  void unserialize(CheckpointIn &cp) override;
92 
93  void setThreadContext(ThreadContext *_tc) override;
94 
95  std::string getVendorString() const;
96 };
97 
98 } // namespace X86ISA
99 } // namespace gem5
100 
101 #endif
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
ThreadContext is the external interface to all thread state for anything outside of the CPU.
bool inUserMode() const override
Definition: isa.hh:82
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: isa.cc:479
std::string vendorString
Definition: isa.hh:60
PCStateBase * newPCState(Addr new_inst_addr=0) const override
Definition: isa.hh:66
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: isa.cc:485
RegVal readMiscReg(RegIndex idx) override
Definition: isa.cc:216
void updateHandyM5Reg(Efer efer, CR0 cr0, SegAttr csAttr, SegAttr ssAttr, RFLAGS rflags)
Definition: isa.cc:50
std::string getVendorString() const
Definition: isa.cc:503
ISA(const Params &p)
Definition: isa.cc:152
void setMiscReg(RegIndex idx, RegVal val) override
Definition: isa.cc:280
void setThreadContext(ThreadContext *_tc) override
Definition: isa.cc:496
void setMiscRegNoEffect(RegIndex idx, RegVal val) override
Definition: isa.cc:238
X86ISAParams Params
Definition: isa.hh:71
void clear() override
Definition: isa.cc:111
RegVal readMiscRegNoEffect(RegIndex idx) const override
Definition: isa.cc:205
void copyRegsFrom(ThreadContext *src) override
Definition: isa.cc:189
RegVal regVal[misc_reg::NumRegs]
Definition: isa.hh:56
GenericISA::DelaySlotPCState< 4 > PCState
Definition: pcstate.hh:40
Bitfield< 63 > val
Definition: misc.hh:776
Bitfield< 0 > p
Definition: pagetable.hh:151
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint16_t RegIndex
Definition: types.hh:176
std::ostream CheckpointOut
Definition: serialize.hh:66
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
uint64_t RegVal
Definition: types.hh:173

Generated on Wed Dec 21 2022 10:22:24 for gem5 by doxygen 1.9.1