types.cc (10924:d02e9c239892) types.cc (11793:ef606668d247)
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 * Authors: Gabe Black
29 */
30
31#include "arch/x86/types.hh"
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 * Authors: Gabe Black
29 */
30
31#include "arch/x86/types.hh"
32
32#include "sim/serialize.hh"
33
34using namespace X86ISA;
35using namespace std;
36
37template <>
38void
39paramOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst)
40{
41 // Prefixes
42 paramOut(cp, name + ".legacy", (uint8_t)machInst.legacy);
43 paramOut(cp, name + ".rex", (uint8_t)machInst.rex);
44 paramOut(cp, name + ".vex", (uint32_t)machInst.vex);
45
46 // Opcode
47 paramOut(cp, name + ".opcode.type", (uint8_t)machInst.opcode.type);
48 paramOut(cp, name + ".opcode.op", (uint8_t)machInst.opcode.op);
49
50 // Modifier bytes
51 paramOut(cp, name + ".modRM", (uint8_t)machInst.modRM);
52 paramOut(cp, name + ".sib", (uint8_t)machInst.sib);
53
54 // Immediate fields
55 paramOut(cp, name + ".immediate", machInst.immediate);
56 paramOut(cp, name + ".displacement", machInst.displacement);
57
58 // Sizes
59 paramOut(cp, name + ".opSize", machInst.opSize);
60 paramOut(cp, name + ".addrSize", machInst.addrSize);
61 paramOut(cp, name + ".stackSize", machInst.stackSize);
62 paramOut(cp, name + ".dispSize", machInst.dispSize);
63
64 // Mode
65 paramOut(cp, name + ".mode", (uint8_t)machInst.mode);
66}
67
68template <>
69void
70paramIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst)
71{
72 uint8_t temp8;
73 // Prefixes
74 paramIn(cp, name + ".legacy", temp8);
75 machInst.legacy = temp8;
76 paramIn(cp, name + ".rex", temp8);
77 machInst.rex = temp8;
78
79 uint32_t temp32;
80 paramIn(cp, name + ".vex", temp32);
81 machInst.vex = temp32;
82
83 // Opcode
84 paramIn(cp, name + ".opcode.type", temp8);
85 machInst.opcode.type = (OpcodeType)temp8;
86 paramIn(cp, name + ".opcode.op", temp8);
87 machInst.opcode.op = temp8;
88
89 // Modifier bytes
90 paramIn(cp, name + ".modRM", temp8);
91 machInst.modRM = temp8;
92 paramIn(cp, name + ".sib", temp8);
93 machInst.sib = temp8;;
94
95 // Immediate fields
96 paramIn(cp, name + ".immediate", machInst.immediate);
97 paramIn(cp, name + ".displacement", machInst.displacement);
98
99 // Sizes
100 paramIn(cp, name + ".opSize", machInst.opSize);
101 paramIn(cp, name + ".addrSize", machInst.addrSize);
102 paramIn(cp, name + ".stackSize", machInst.stackSize);
103 paramIn(cp, name + ".dispSize", machInst.dispSize);
104
105 // Mode
106 paramIn(cp, name + ".mode", temp8);
107 machInst.mode = temp8;
108}
33#include "sim/serialize.hh"
34
35using namespace X86ISA;
36using namespace std;
37
38template <>
39void
40paramOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst)
41{
42 // Prefixes
43 paramOut(cp, name + ".legacy", (uint8_t)machInst.legacy);
44 paramOut(cp, name + ".rex", (uint8_t)machInst.rex);
45 paramOut(cp, name + ".vex", (uint32_t)machInst.vex);
46
47 // Opcode
48 paramOut(cp, name + ".opcode.type", (uint8_t)machInst.opcode.type);
49 paramOut(cp, name + ".opcode.op", (uint8_t)machInst.opcode.op);
50
51 // Modifier bytes
52 paramOut(cp, name + ".modRM", (uint8_t)machInst.modRM);
53 paramOut(cp, name + ".sib", (uint8_t)machInst.sib);
54
55 // Immediate fields
56 paramOut(cp, name + ".immediate", machInst.immediate);
57 paramOut(cp, name + ".displacement", machInst.displacement);
58
59 // Sizes
60 paramOut(cp, name + ".opSize", machInst.opSize);
61 paramOut(cp, name + ".addrSize", machInst.addrSize);
62 paramOut(cp, name + ".stackSize", machInst.stackSize);
63 paramOut(cp, name + ".dispSize", machInst.dispSize);
64
65 // Mode
66 paramOut(cp, name + ".mode", (uint8_t)machInst.mode);
67}
68
69template <>
70void
71paramIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst)
72{
73 uint8_t temp8;
74 // Prefixes
75 paramIn(cp, name + ".legacy", temp8);
76 machInst.legacy = temp8;
77 paramIn(cp, name + ".rex", temp8);
78 machInst.rex = temp8;
79
80 uint32_t temp32;
81 paramIn(cp, name + ".vex", temp32);
82 machInst.vex = temp32;
83
84 // Opcode
85 paramIn(cp, name + ".opcode.type", temp8);
86 machInst.opcode.type = (OpcodeType)temp8;
87 paramIn(cp, name + ".opcode.op", temp8);
88 machInst.opcode.op = temp8;
89
90 // Modifier bytes
91 paramIn(cp, name + ".modRM", temp8);
92 machInst.modRM = temp8;
93 paramIn(cp, name + ".sib", temp8);
94 machInst.sib = temp8;;
95
96 // Immediate fields
97 paramIn(cp, name + ".immediate", machInst.immediate);
98 paramIn(cp, name + ".displacement", machInst.displacement);
99
100 // Sizes
101 paramIn(cp, name + ".opSize", machInst.opSize);
102 paramIn(cp, name + ".addrSize", machInst.addrSize);
103 paramIn(cp, name + ".stackSize", machInst.stackSize);
104 paramIn(cp, name + ".dispSize", machInst.dispSize);
105
106 // Mode
107 paramIn(cp, name + ".mode", temp8);
108 machInst.mode = temp8;
109}