remote_gdb.cc (13469:3090dae4115b) remote_gdb.cc (13471:f41c4625aa79)
1/*
2 * Copyright 2015 LabWare
3 * Copyright 2014 Google Inc.
4 * Copyright (c) 2010, 2013, 2016 ARM Limited
5 * All rights reserved
6 *
7 * The license below extends only to copyright in the software and shall
8 * not be construed as granting a license to any other intellectual

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

198 DPRINTF(GDBAcc, "getRegs in remotegdb \n");
199
200 for (int i = 0; i < 31; ++i)
201 r.x[i] = context->readIntReg(INTREG_X0 + i);
202 r.spx = context->readIntReg(INTREG_SPX);
203 r.pc = context->pcState().pc();
204 r.cpsr = context->readMiscRegNoEffect(MISCREG_CPSR);
205
1/*
2 * Copyright 2015 LabWare
3 * Copyright 2014 Google Inc.
4 * Copyright (c) 2010, 2013, 2016 ARM Limited
5 * All rights reserved
6 *
7 * The license below extends only to copyright in the software and shall
8 * not be construed as granting a license to any other intellectual

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

198 DPRINTF(GDBAcc, "getRegs in remotegdb \n");
199
200 for (int i = 0; i < 31; ++i)
201 r.x[i] = context->readIntReg(INTREG_X0 + i);
202 r.spx = context->readIntReg(INTREG_SPX);
203 r.pc = context->pcState().pc();
204 r.cpsr = context->readMiscRegNoEffect(MISCREG_CPSR);
205
206 for (int i = 0; i < 32*4; i += 4) {
207 r.v[i + 0] = context->readFloatRegBits(i + 2);
208 r.v[i + 1] = context->readFloatRegBits(i + 3);
209 r.v[i + 2] = context->readFloatRegBits(i + 0);
210 r.v[i + 3] = context->readFloatRegBits(i + 1);
206 size_t base = 0;
207 for (int i = 0; i < NumVecV8ArchRegs; i++) {
208 auto v = (context->readVecReg(RegId(VecRegClass, i))).as<VecElem>();
209 for (size_t j = 0; j < NumVecElemPerVecReg; j++) {
210 r.v[base] = v[j];
211 base++;
212 }
211 }
212}
213
214void
215RemoteGDB::AArch64GdbRegCache::setRegs(ThreadContext *context) const
216{
217 DPRINTF(GDBAcc, "setRegs in remotegdb \n");
218
219 for (int i = 0; i < 31; ++i)
220 context->setIntReg(INTREG_X0 + i, r.x[i]);
221 auto pc_state = context->pcState();
222 pc_state.set(r.pc);
223 context->pcState(pc_state);
224 context->setMiscRegNoEffect(MISCREG_CPSR, r.cpsr);
225 // Update the stack pointer. This should be done after
226 // updating CPSR/PSTATE since that might affect how SPX gets
227 // mapped.
228 context->setIntReg(INTREG_SPX, r.spx);
229
213 }
214}
215
216void
217RemoteGDB::AArch64GdbRegCache::setRegs(ThreadContext *context) const
218{
219 DPRINTF(GDBAcc, "setRegs in remotegdb \n");
220
221 for (int i = 0; i < 31; ++i)
222 context->setIntReg(INTREG_X0 + i, r.x[i]);
223 auto pc_state = context->pcState();
224 pc_state.set(r.pc);
225 context->pcState(pc_state);
226 context->setMiscRegNoEffect(MISCREG_CPSR, r.cpsr);
227 // Update the stack pointer. This should be done after
228 // updating CPSR/PSTATE since that might affect how SPX gets
229 // mapped.
230 context->setIntReg(INTREG_SPX, r.spx);
231
230 for (int i = 0; i < 32*4; i += 4) {
231 context->setFloatRegBits(i + 2, r.v[i + 0]);
232 context->setFloatRegBits(i + 3, r.v[i + 1]);
233 context->setFloatRegBits(i + 0, r.v[i + 2]);
234 context->setFloatRegBits(i + 1, r.v[i + 3]);
232 size_t base = 0;
233 for (int i = 0; i < NumVecV8ArchRegs; i++) {
234 auto v = (context->getWritableVecReg(
235 RegId(VecRegClass, i))).as<VecElem>();
236 for (size_t j = 0; j < NumVecElemPerVecReg; j++) {
237 v[j] = r.v[base];
238 base++;
239 }
235 }
236}
237
238void
239RemoteGDB::AArch32GdbRegCache::getRegs(ThreadContext *context)
240{
241 DPRINTF(GDBAcc, "getRegs in remotegdb \n");
242

--- 62 unchanged lines hidden ---
240 }
241}
242
243void
244RemoteGDB::AArch32GdbRegCache::getRegs(ThreadContext *context)
245{
246 DPRINTF(GDBAcc, "getRegs in remotegdb \n");
247

--- 62 unchanged lines hidden ---