Deleted Added
sdiff udiff text old ( 9374:227a38f9d98c ) new ( 10037:5cac77888310 )
full compact
1/*
2 * Copyright (c) 2010 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

133#include <unistd.h>
134
135#include <string>
136
137#include "arch/arm/decoder.hh"
138#include "arch/arm/pagetable.hh"
139#include "arch/arm/registers.hh"
140#include "arch/arm/remote_gdb.hh"
141#include "arch/arm/utility.hh"
142#include "arch/arm/vtophys.hh"
143#include "base/intmath.hh"
144#include "base/remote_gdb.hh"
145#include "base/socket.hh"
146#include "base/trace.hh"
147#include "cpu/static_inst.hh"
148#include "cpu/thread_context.hh"

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

154#include "mem/port.hh"
155#include "sim/full_system.hh"
156#include "sim/system.hh"
157
158using namespace std;
159using namespace ArmISA;
160
161RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc)
162 : BaseRemoteGDB(_system, tc, NUMREGS)
163{
164}
165
166/*
167 * Determine if the mapping at va..(va+len) is valid.
168 */
169bool
170RemoteGDB::acc(Addr va, size_t len)

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

199 */
200void
201RemoteGDB::getregs()
202{
203 DPRINTF(GDBAcc, "getregs in remotegdb \n");
204
205 memset(gdbregs.regs, 0, gdbregs.bytes());
206
207 // R0-R15 supervisor mode
208 // arm registers are 32 bits wide, gdb registers are 64 bits wide
209 // two arm registers are packed into one gdb register (little endian)
210 gdbregs.regs[REG_R0 + 0] = context->readIntReg(INTREG_R1) << 32 |
211 context->readIntReg(INTREG_R0);
212 gdbregs.regs[REG_R0 + 1] = context->readIntReg(INTREG_R3) << 32 |
213 context->readIntReg(INTREG_R2);
214 gdbregs.regs[REG_R0 + 2] = context->readIntReg(INTREG_R5) << 32 |
215 context->readIntReg(INTREG_R4);
216 gdbregs.regs[REG_R0 + 3] = context->readIntReg(INTREG_R7) << 32 |
217 context->readIntReg(INTREG_R6);
218 gdbregs.regs[REG_R0 + 4] = context->readIntReg(INTREG_R9) << 32 |
219 context->readIntReg(INTREG_R8);
220 gdbregs.regs[REG_R0 + 5] = context->readIntReg(INTREG_R11) << 32|
221 context->readIntReg(INTREG_R10);
222 gdbregs.regs[REG_R0 + 6] = context->readIntReg(INTREG_SP) << 32 |
223 context->readIntReg(INTREG_R12);
224 gdbregs.regs[REG_R0 + 7] = context->pcState().pc() << 32 |
225 context->readIntReg(INTREG_LR);
226
227 // CPSR
228 gdbregs.regs[REG_CPSR] = context->readMiscRegNoEffect(MISCREG_CPSR);
229
230 // vfpv3/neon floating point registers (32 double or 64 float)
231
232 gdbregs.regs[REG_F0] =
233 static_cast(context->readFloatRegBits(0)) << 32 |
234 gdbregs.regs[REG_CPSR];
235
236 for (int i = 1; i < (NumFloatArchRegs>>1); ++i) {
237 gdbregs.regs[i + REG_F0] =
238 static_cast(context->readFloatRegBits(2*i)) << 32 |
239 context->readFloatRegBits(2*i-1);
240 }
241
242 // FPSCR
243 gdbregs.regs[REG_FPSCR] =
244 static_cast<uint64_t>(context->readMiscRegNoEffect(MISCREG_FPSCR)) << 32 |
245 context->readFloatRegBits(NumFloatArchRegs - 1);
246}
247
248/*
249 * Translate the GDB register format into the kernel debugger register
250 * format.
251 */
252void
253RemoteGDB::setregs()
254{
255
256 DPRINTF(GDBAcc, "setregs in remotegdb \n");
257
258 // R0-R15 supervisor mode
259 // arm registers are 32 bits wide, gdb registers are 64 bits wide
260 // two arm registers are packed into one gdb register (little endian)
261 context->setIntReg(INTREG_R0 , bits(gdbregs.regs[REG_R0 + 0], 31, 0));
262 context->setIntReg(INTREG_R1 , bits(gdbregs.regs[REG_R0 + 0], 63, 32));
263 context->setIntReg(INTREG_R2 , bits(gdbregs.regs[REG_R0 + 1], 31, 0));
264 context->setIntReg(INTREG_R3 , bits(gdbregs.regs[REG_R0 + 1], 63, 32));
265 context->setIntReg(INTREG_R4 , bits(gdbregs.regs[REG_R0 + 2], 31, 0));
266 context->setIntReg(INTREG_R5 , bits(gdbregs.regs[REG_R0 + 2], 63, 32));
267 context->setIntReg(INTREG_R6 , bits(gdbregs.regs[REG_R0 + 3], 31, 0));
268 context->setIntReg(INTREG_R7 , bits(gdbregs.regs[REG_R0 + 3], 63, 32));
269 context->setIntReg(INTREG_R8 , bits(gdbregs.regs[REG_R0 + 4], 31, 0));
270 context->setIntReg(INTREG_R9 , bits(gdbregs.regs[REG_R0 + 4], 63, 32));
271 context->setIntReg(INTREG_R10, bits(gdbregs.regs[REG_R0 + 5], 31, 0));
272 context->setIntReg(INTREG_R11, bits(gdbregs.regs[REG_R0 + 5], 63, 32));
273 context->setIntReg(INTREG_R12, bits(gdbregs.regs[REG_R0 + 6], 31, 0));
274 context->setIntReg(INTREG_SP , bits(gdbregs.regs[REG_R0 + 6], 63, 32));
275 context->setIntReg(INTREG_LR , bits(gdbregs.regs[REG_R0 + 7], 31, 0));
276 context->pcState(bits(gdbregs.regs[REG_R0 + 7], 63, 32));
277
278 //CPSR
279 context->setMiscRegNoEffect(MISCREG_CPSR, gdbregs.regs[REG_CPSR]);
280
281 //vfpv3/neon floating point registers (32 double or 64 float)
282 context->setFloatRegBits(0, gdbregs.regs[REG_F0]>>32);
283
284 for (int i = 1; i < NumFloatArchRegs; ++i) {
285 if(i%2){
286 int j = (i+1)/2;
287 context->setFloatRegBits(i, bits(gdbregs.regs[j + REG_F0], 31, 0));
288 }
289 else{
290 int j = i/2;
291 context->setFloatRegBits(i, gdbregs.regs[j + REG_F0]>>32);
292 }
293 }
294
295 //FPSCR
296 context->setMiscReg(MISCREG_FPSCR, gdbregs.regs[REG_FPSCR]>>32);
297}
298
299void
300RemoteGDB::clearSingleStep()
301{
302 DPRINTF(GDBMisc, "clearSingleStep bt_addr=%#x nt_addr=%#x\n",
303 takenBkpt, notTakenBkpt);
304

--- 41 unchanged lines hidden ---