gem5  v21.1.0.2
types.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 Advanced Micro Devices, Inc.
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 #include "arch/x86/types.hh"
30 
31 #include "sim/serialize.hh"
32 
33 namespace gem5
34 {
35 
36 using namespace X86ISA;
37 
38 template <>
39 void
40 paramOut(CheckpointOut &cp, const std::string &name,
41  ExtMachInst const &machInst)
42 {
43  // Prefixes
44  paramOut(cp, name + ".legacy", (uint8_t)machInst.legacy);
45  paramOut(cp, name + ".rex", (uint8_t)machInst.rex);
46  paramOut(cp, name + ".vex", (uint32_t)machInst.vex);
47 
48  // Opcode
49  paramOut(cp, name + ".opcode.type", (uint8_t)machInst.opcode.type);
50  paramOut(cp, name + ".opcode.op", (uint8_t)machInst.opcode.op);
51 
52  // Modifier bytes
53  paramOut(cp, name + ".modRM", (uint8_t)machInst.modRM);
54  paramOut(cp, name + ".sib", (uint8_t)machInst.sib);
55 
56  // Immediate fields
57  paramOut(cp, name + ".immediate", machInst.immediate);
58  paramOut(cp, name + ".displacement", machInst.displacement);
59 
60  // Sizes
61  paramOut(cp, name + ".opSize", machInst.opSize);
62  paramOut(cp, name + ".addrSize", machInst.addrSize);
63  paramOut(cp, name + ".stackSize", machInst.stackSize);
64  paramOut(cp, name + ".dispSize", machInst.dispSize);
65 
66  // Mode
67  paramOut(cp, name + ".mode", (uint8_t)machInst.mode);
68 }
69 
70 template <>
71 void
72 paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst)
73 {
74  uint8_t temp8;
75  // Prefixes
76  paramIn(cp, name + ".legacy", temp8);
77  machInst.legacy = temp8;
78  paramIn(cp, name + ".rex", temp8);
79  machInst.rex = temp8;
80 
81  uint32_t temp32;
82  paramIn(cp, name + ".vex", temp32);
83  machInst.vex = temp32;
84 
85  // Opcode
86  paramIn(cp, name + ".opcode.type", temp8);
87  machInst.opcode.type = (OpcodeType)temp8;
88  paramIn(cp, name + ".opcode.op", temp8);
89  machInst.opcode.op = temp8;
90 
91  // Modifier bytes
92  paramIn(cp, name + ".modRM", temp8);
93  machInst.modRM = temp8;
94  paramIn(cp, name + ".sib", temp8);
95  machInst.sib = temp8;;
96 
97  // Immediate fields
98  paramIn(cp, name + ".immediate", machInst.immediate);
99  paramIn(cp, name + ".displacement", machInst.displacement);
100 
101  // Sizes
102  paramIn(cp, name + ".opSize", machInst.opSize);
103  paramIn(cp, name + ".addrSize", machInst.addrSize);
104  paramIn(cp, name + ".stackSize", machInst.stackSize);
105  paramIn(cp, name + ".dispSize", machInst.dispSize);
106 
107  // Mode
108  paramIn(cp, name + ".mode", temp8);
109  machInst.mode = temp8;
110 }
111 
112 } // namespace gem5
gem5::X86ISA::ExtMachInst::op
Opcode op
Definition: types.hh:220
serialize.hh
gem5::X86ISA::ExtMachInst::modRM
ModRM modRM
Definition: types.hh:223
gem5::CheckpointIn
Definition: serialize.hh:68
gem5::X86ISA::ExtMachInst::opSize
uint8_t opSize
Definition: types.hh:230
gem5::X86ISA::ExtMachInst::mode
OperatingMode mode
Definition: types.hh:239
gem5::X86ISA::ExtMachInst::opcode
struct gem5::X86ISA::ExtMachInst::@19 opcode
gem5::X86ISA::ExtMachInst::stackSize
uint8_t stackSize
Definition: types.hh:234
gem5::X86ISA::ExtMachInst::rex
Rex rex
Definition: types.hh:212
gem5::X86ISA::ExtMachInst::type
OpcodeType type
Definition: types.hh:218
gem5::X86ISA::ExtMachInst::legacy
LegacyPrefixVector legacy
Definition: types.hh:211
gem5::X86ISA::ExtMachInst::vex
VexInfo vex
Definition: types.hh:213
gem5::X86ISA::ExtMachInst::addrSize
uint8_t addrSize
Definition: types.hh:232
name
const std::string & name()
Definition: trace.cc:49
gem5::X86ISA::ExtMachInst::dispSize
uint8_t dispSize
Definition: types.hh:236
gem5::X86ISA::ExtMachInst::sib
Sib sib
Definition: types.hh:224
gem5::X86ISA::ExtMachInst
Definition: types.hh:206
gem5::X86ISA::ExtMachInst::displacement
uint64_t displacement
Definition: types.hh:227
gem5::X86ISA::ExtMachInst::immediate
uint64_t immediate
Definition: types.hh:226
gem5::paramOut
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
Definition: types.cc:40
gem5::paramIn
void paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst)
Definition: types.cc:72
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
types.hh

Generated on Tue Sep 21 2021 12:24:52 for gem5 by doxygen 1.8.17