1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 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; --- 165 unchanged lines hidden (view full) --- 174// 175// Translate the kernel debugger register format into 176// the GDB register format. 177void 178RemoteGDB::getregs() 179{ 180 memset(gdbregs.regs, 0, gdbregs.size); 181 |
182 PCState pc = context->pcState(); 183 |
184 if (context->readMiscReg(MISCREG_PSTATE) & 185 PSTATE::am) { 186 uint32_t *regs; 187 regs = (uint32_t*)gdbregs.regs; |
188 regs[Reg32Pc] = htobe((uint32_t)pc.pc()); 189 regs[Reg32Npc] = htobe((uint32_t)pc.npc()); |
190 for(int x = RegG0; x <= RegI0 + 7; x++) 191 regs[x] = htobe((uint32_t)context->readIntReg(x - RegG0)); 192 193 regs[Reg32Y] = htobe((uint32_t)context->readIntReg(NumIntArchRegs + 1)); 194 regs[Reg32Psr] = htobe((uint32_t)context->readMiscReg(MISCREG_PSTATE)); 195 regs[Reg32Fsr] = htobe((uint32_t)context->readMiscReg(MISCREG_FSR)); 196 regs[Reg32Csr] = htobe((uint32_t)context->readIntReg(NumIntArchRegs + 2)); 197 } else { |
198 gdbregs.regs[RegPc] = htobe(pc.pc()); 199 gdbregs.regs[RegNpc] = htobe(pc.npc()); |
200 for(int x = RegG0; x <= RegI0 + 7; x++) 201 gdbregs.regs[x] = htobe(context->readIntReg(x - RegG0)); 202 203 gdbregs.regs[RegFsr] = htobe(context->readMiscReg(MISCREG_FSR)); 204 gdbregs.regs[RegFprs] = htobe(context->readMiscReg(MISCREG_FPRS)); 205 gdbregs.regs[RegY] = htobe(context->readIntReg(NumIntArchRegs + 1)); 206 gdbregs.regs[RegState] = htobe( 207 context->readMiscReg(MISCREG_CWP) | --- 13 unchanged lines hidden (view full) --- 221// RemoteGDB::setregs 222// 223// Translate the GDB register format into the kernel 224// debugger register format. 225// 226void 227RemoteGDB::setregs() 228{ |
229 PCState pc; 230 pc.pc(gdbregs.regs[RegPc]); 231 pc.npc(gdbregs.regs[RegNpc]); 232 pc.nnpc(pc.npc() + sizeof(MachInst)); 233 pc.upc(0); 234 pc.nupc(1); 235 context->pcState(pc); |
236 for(int x = RegG0; x <= RegI0 + 7; x++) 237 context->setIntReg(x - RegG0, gdbregs.regs[x]); 238 //Only the integer registers, pc and npc are set in netbsd 239} 240 241void 242RemoteGDB::clearSingleStep() 243{ 244 if (nextBkpt) 245 clearTempBreakpoint(nextBkpt); 246} 247 248void 249RemoteGDB::setSingleStep() 250{ |
251 nextBkpt = context->pcState().npc(); |
252 setTempBreakpoint(nextBkpt); 253} |