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; --- 139 unchanged lines hidden (view full) --- 148// RemoteGDB::acc 149// 150// Determine if the mapping at va..(va+len) is valid. 151// 152bool 153RemoteGDB::acc(Addr va, size_t len) 154{ 155 //@Todo In NetBSD, this function checks if all addresses |
156 // from va to va + len have valid page map entries. Not 157 // sure how this will work for other OSes or in general. |
158#if FULL_SYSTEM 159 if (va) 160 return true; 161 return false; 162#else 163 TlbEntry entry; |
164 // Check to make sure the first byte is mapped into the processes address 165 // space. |
166 if (context->getProcessPtr()->pTable->lookup(va, entry)) 167 return true; 168 return false; 169#endif 170} 171 172/////////////////////////////////////////////////////////// 173// RemoteGDB::getregs --- 8 unchanged lines hidden (view full) --- 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) | 208 context->readMiscReg(MISCREG_PSTATE) << 8 | 209 context->readMiscReg(MISCREG_ASI) << 24 | 210 context->readIntReg(NumIntArchRegs + 2) << 32); 211 } 212 213 DPRINTF(GDBRead, "PC=%#x\n", gdbregs.regs[RegPc]); 214 |
215 // Floating point registers are left at 0 in netbsd 216 // All registers other than the pc, npc and int regs 217 // are ignored as well. |
218} 219 220/////////////////////////////////////////////////////////// 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} |