thread_context.cc (9920:028e4da64b42) thread_context.cc (10905:a6ca6831e775)
1/*
2 * Copyright (c) 2012 ARM Limited
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

--- 90 unchanged lines hidden (view full) ---

99 id2 = two->contextId();
100 if (id1 != id2)
101 panic("Context ids don't match, one: %d, two: %d", id1, id2);
102
103
104}
105
106void
1/*
2 * Copyright (c) 2012 ARM Limited
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

--- 90 unchanged lines hidden (view full) ---

99 id2 = two->contextId();
100 if (id1 != id2)
101 panic("Context ids don't match, one: %d, two: %d", id1, id2);
102
103
104}
105
106void
107serialize(ThreadContext &tc, std::ostream &os)
107serialize(ThreadContext &tc, CheckpointOut &cp)
108{
109 using namespace TheISA;
110
111 FloatRegBits floatRegs[NumFloatRegs];
112 for (int i = 0; i < NumFloatRegs; ++i)
113 floatRegs[i] = tc.readFloatRegBitsFlat(i);
114 // This is a bit ugly, but needed to maintain backwards
115 // compatibility.
108{
109 using namespace TheISA;
110
111 FloatRegBits floatRegs[NumFloatRegs];
112 for (int i = 0; i < NumFloatRegs; ++i)
113 floatRegs[i] = tc.readFloatRegBitsFlat(i);
114 // This is a bit ugly, but needed to maintain backwards
115 // compatibility.
116 arrayParamOut(os, "floatRegs.i", floatRegs, NumFloatRegs);
116 arrayParamOut(cp, "floatRegs.i", floatRegs, NumFloatRegs);
117
118 IntReg intRegs[NumIntRegs];
119 for (int i = 0; i < NumIntRegs; ++i)
120 intRegs[i] = tc.readIntRegFlat(i);
121 SERIALIZE_ARRAY(intRegs, NumIntRegs);
122
123#ifdef ISA_HAS_CC_REGS
124 CCReg ccRegs[NumCCRegs];
125 for (int i = 0; i < NumCCRegs; ++i)
126 ccRegs[i] = tc.readCCRegFlat(i);
127 SERIALIZE_ARRAY(ccRegs, NumCCRegs);
128#endif
129
117
118 IntReg intRegs[NumIntRegs];
119 for (int i = 0; i < NumIntRegs; ++i)
120 intRegs[i] = tc.readIntRegFlat(i);
121 SERIALIZE_ARRAY(intRegs, NumIntRegs);
122
123#ifdef ISA_HAS_CC_REGS
124 CCReg ccRegs[NumCCRegs];
125 for (int i = 0; i < NumCCRegs; ++i)
126 ccRegs[i] = tc.readCCRegFlat(i);
127 SERIALIZE_ARRAY(ccRegs, NumCCRegs);
128#endif
129
130 tc.pcState().serialize(os);
130 tc.pcState().serialize(cp);
131
132 // thread_num and cpu_id are deterministic from the config
133}
134
135void
131
132 // thread_num and cpu_id are deterministic from the config
133}
134
135void
136unserialize(ThreadContext &tc, Checkpoint *cp, const std::string &section)
136unserialize(ThreadContext &tc, CheckpointIn &cp)
137{
138 using namespace TheISA;
139
140 FloatRegBits floatRegs[NumFloatRegs];
141 // This is a bit ugly, but needed to maintain backwards
142 // compatibility.
137{
138 using namespace TheISA;
139
140 FloatRegBits floatRegs[NumFloatRegs];
141 // This is a bit ugly, but needed to maintain backwards
142 // compatibility.
143 arrayParamIn(cp, section, "floatRegs.i", floatRegs, NumFloatRegs);
143 arrayParamIn(cp, "floatRegs.i", floatRegs, NumFloatRegs);
144 for (int i = 0; i < NumFloatRegs; ++i)
145 tc.setFloatRegBitsFlat(i, floatRegs[i]);
146
147 IntReg intRegs[NumIntRegs];
148 UNSERIALIZE_ARRAY(intRegs, NumIntRegs);
149 for (int i = 0; i < NumIntRegs; ++i)
150 tc.setIntRegFlat(i, intRegs[i]);
151
152#ifdef ISA_HAS_CC_REGS
153 CCReg ccRegs[NumCCRegs];
154 UNSERIALIZE_ARRAY(ccRegs, NumCCRegs);
155 for (int i = 0; i < NumCCRegs; ++i)
156 tc.setCCRegFlat(i, ccRegs[i]);
157#endif
158
159 PCState pcState;
144 for (int i = 0; i < NumFloatRegs; ++i)
145 tc.setFloatRegBitsFlat(i, floatRegs[i]);
146
147 IntReg intRegs[NumIntRegs];
148 UNSERIALIZE_ARRAY(intRegs, NumIntRegs);
149 for (int i = 0; i < NumIntRegs; ++i)
150 tc.setIntRegFlat(i, intRegs[i]);
151
152#ifdef ISA_HAS_CC_REGS
153 CCReg ccRegs[NumCCRegs];
154 UNSERIALIZE_ARRAY(ccRegs, NumCCRegs);
155 for (int i = 0; i < NumCCRegs; ++i)
156 tc.setCCRegFlat(i, ccRegs[i]);
157#endif
158
159 PCState pcState;
160 pcState.unserialize(cp, section);
160 pcState.unserialize(cp);
161 tc.pcState(pcState);
162
163 // thread_num and cpu_id are deterministic from the config
164}
165
166void
167takeOverFrom(ThreadContext &ntc, ThreadContext &otc)
168{

--- 30 unchanged lines hidden ---
161 tc.pcState(pcState);
162
163 // thread_num and cpu_id are deterministic from the config
164}
165
166void
167takeOverFrom(ThreadContext &ntc, ThreadContext &otc)
168{

--- 30 unchanged lines hidden ---