gem5 v24.0.0.0
Loading...
Searching...
No Matches
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/cpuid.hh"
37#include "arch/x86/pcstate.hh"
38#include "arch/x86/regs/ccr.hh"
40#include "arch/x86/regs/int.hh"
41#include "arch/x86/regs/misc.hh"
42#include "base/types.hh"
43#include "cpu/reg_class.hh"
44
45namespace gem5
46{
47
48class ThreadContext;
49struct X86ISAParams;
50
51namespace X86ISA
52{
53
54class ISA : public BaseISA
55{
56 private:
58 void updateHandyM5Reg(Efer efer, CR0 cr0,
59 SegAttr csAttr, SegAttr ssAttr, RFLAGS rflags);
60
61 std::string vendorString;
62
63 public:
64 void clear() override;
65
67 newPCState(Addr new_inst_addr=0) const override
68 {
69 return new PCState(new_inst_addr);
70 }
71
72 using Params = X86ISAParams;
73
74 ISA(const Params &p);
75
76 RegVal readMiscRegNoEffect(RegIndex idx) const override;
77 RegVal readMiscReg(RegIndex idx) override;
78
79 void setMiscRegNoEffect(RegIndex idx, RegVal val) override;
80 void setMiscReg(RegIndex idx, RegVal val) override;
81
82 bool
83 inUserMode() const override
84 {
85 HandyM5Reg m5reg = readMiscRegNoEffect(misc_reg::M5Reg);
86 return m5reg.cpl == 3;
87 }
88
89 void copyRegsFrom(ThreadContext *src) override;
90
91 void serialize(CheckpointOut &cp) const override;
92 void unserialize(CheckpointIn &cp) override;
93
94 void setThreadContext(ThreadContext *_tc) override;
95
96 std::string getVendorString() const;
97
98 std::unique_ptr<X86CPUID> cpuid;
99};
100
101} // namespace X86ISA
102} // namespace gem5
103
104#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:83
std::unique_ptr< X86CPUID > cpuid
Definition isa.hh:98
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition isa.cc:498
std::string vendorString
Definition isa.hh:61
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition isa.cc:506
RegVal readMiscReg(RegIndex idx) override
Definition isa.cc:229
void updateHandyM5Reg(Efer efer, CR0 cr0, SegAttr csAttr, SegAttr ssAttr, RFLAGS rflags)
Definition isa.cc:51
std::string getVendorString() const
Definition isa.cc:524
ISA(const Params &p)
Definition isa.cc:154
void setMiscReg(RegIndex idx, RegVal val) override
Definition isa.cc:297
PCStateBase * newPCState(Addr new_inst_addr=0) const override
Definition isa.hh:67
void setThreadContext(ThreadContext *_tc) override
Definition isa.cc:517
void setMiscRegNoEffect(RegIndex idx, RegVal val) override
Definition isa.cc:255
X86ISAParams Params
Definition isa.hh:72
void clear() override
Definition isa.cc:112
RegVal readMiscRegNoEffect(RegIndex idx) const override
Definition isa.cc:218
void copyRegsFrom(ThreadContext *src) override
Definition isa.cc:202
RegVal regVal[misc_reg::NumRegs]
Definition isa.hh:57
GenericISA::DelaySlotPCState< 4 > PCState
Definition pcstate.hh:40
Bitfield< 63 > val
Definition misc.hh:804
Bitfield< 0 > p
Definition pagetable.hh:151
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint16_t RegIndex
Definition types.hh:176
uint64_t RegVal
Definition types.hh:173
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

Generated on Tue Jun 18 2024 16:23:57 for gem5 by doxygen 1.11.0