remote_gdb.cc (5568:d14250d688d2) | remote_gdb.cc (5569:baeee670d4ce) |
---|---|
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; --- 103 unchanged lines hidden (view full) --- 112 * $NetBSD: kgdb_stub.c,v 1.8 2001/07/07 22:58:00 wdk Exp $ 113 * 114 * Taken from NetBSD 115 * 116 * "Stub" to allow remote cpu to debug over a serial line using gdb. 117 */ 118 119#include <sys/signal.h> | 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; --- 103 unchanged lines hidden (view full) --- 112 * $NetBSD: kgdb_stub.c,v 1.8 2001/07/07 22:58:00 wdk Exp $ 113 * 114 * Taken from NetBSD 115 * 116 * "Stub" to allow remote cpu to debug over a serial line using gdb. 117 */ 118 119#include <sys/signal.h> |
120#include <unistd.h> |
|
120 121#include <string> | 121 122#include <string> |
122#include <unistd.h> | |
123 124#include "config/full_system.hh" 125#if FULL_SYSTEM 126#include "arch/alpha/vtophys.hh" 127#endif 128 129#include "arch/alpha/kgdb.h" 130#include "arch/alpha/utility.hh" --- 6 unchanged lines hidden (view full) --- 137#include "cpu/static_inst.hh" 138#include "mem/physical.hh" 139#include "mem/port.hh" 140#include "sim/system.hh" 141 142using namespace std; 143using namespace AlphaISA; 144 | 123 124#include "config/full_system.hh" 125#if FULL_SYSTEM 126#include "arch/alpha/vtophys.hh" 127#endif 128 129#include "arch/alpha/kgdb.h" 130#include "arch/alpha/utility.hh" --- 6 unchanged lines hidden (view full) --- 137#include "cpu/static_inst.hh" 138#include "mem/physical.hh" 139#include "mem/port.hh" 140#include "sim/system.hh" 141 142using namespace std; 143using namespace AlphaISA; 144 |
145RemoteGDB::RemoteGDB(System *_system, ThreadContext *c) 146 : BaseRemoteGDB(_system, c, KGDB_NUMREGS) | 145RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc) 146 : BaseRemoteGDB(_system, tc, KGDB_NUMREGS) |
147{ 148 memset(gdbregs.regs, 0, gdbregs.bytes()); 149} 150 | 147{ 148 memset(gdbregs.regs, 0, gdbregs.bytes()); 149} 150 |
151/////////////////////////////////////////////////////////// 152// RemoteGDB::acc 153// 154// Determine if the mapping at va..(va+len) is valid. 155// | 151/* 152 * Determine if the mapping at va..(va+len) is valid. 153 */ |
156bool 157RemoteGDB::acc(Addr va, size_t len) 158{ 159#if !FULL_SYSTEM 160 panic("acc function needs to be rewritten for SE mode\n"); 161#else 162 Addr last_va; 163 --- 8 unchanged lines hidden (view full) --- 172 return true; 173 } else { 174 DPRINTF(GDBAcc, "acc: Mapping invalid %#x > K0SEG + size\n", 175 va); 176 return false; 177 } 178 } 179 | 154bool 155RemoteGDB::acc(Addr va, size_t len) 156{ 157#if !FULL_SYSTEM 158 panic("acc function needs to be rewritten for SE mode\n"); 159#else 160 Addr last_va; 161 --- 8 unchanged lines hidden (view full) --- 170 return true; 171 } else { 172 DPRINTF(GDBAcc, "acc: Mapping invalid %#x > K0SEG + size\n", 173 va); 174 return false; 175 } 176 } 177 |
180 /** 181 * This code says that all accesses to palcode (instruction and data) 182 * are valid since there isn't a va->pa mapping because palcode is 183 * accessed physically. At some point this should probably be cleaned up 184 * but there is no easy way to do it. 185 */ | 178 /** 179 * This code says that all accesses to palcode (instruction 180 * and data) are valid since there isn't a va->pa mapping 181 * because palcode is accessed physically. At some point this 182 * should probably be cleaned up but there is no easy way to 183 * do it. 184 */ |
186 187 if (PcPAL(va) || va < 0x10000) 188 return true; 189 190 Addr ptbr = context->readMiscRegNoEffect(IPR_PALtemp20); | 185 186 if (PcPAL(va) || va < 0x10000) 187 return true; 188 189 Addr ptbr = context->readMiscRegNoEffect(IPR_PALtemp20); |
191 PageTableEntry pte = kernel_pte_lookup(context->getPhysPort(), ptbr, va); | 190 PageTableEntry pte = 191 kernel_pte_lookup(context->getPhysPort(), ptbr, va); |
192 if (!pte.valid()) { 193 DPRINTF(GDBAcc, "acc: %#x pte is invalid\n", va); 194 return false; 195 } 196 va += PageBytes; 197 } while (va < last_va); 198 199 DPRINTF(GDBAcc, "acc: %#x mapping is valid\n", va); 200 return true; 201#endif 202} 203 | 192 if (!pte.valid()) { 193 DPRINTF(GDBAcc, "acc: %#x pte is invalid\n", va); 194 return false; 195 } 196 va += PageBytes; 197 } while (va < last_va); 198 199 DPRINTF(GDBAcc, "acc: %#x mapping is valid\n", va); 200 return true; 201#endif 202} 203 |
204/////////////////////////////////////////////////////////// 205// RemoteGDB::getregs 206// 207// Translate the kernel debugger register format into 208// the GDB register format. | 204/* 205 * Translate the kernel debugger register format into the GDB register 206 * format. 207 */ |
209void 210RemoteGDB::getregs() 211{ 212 memset(gdbregs.regs, 0, gdbregs.bytes()); 213 214 gdbregs.regs[KGDB_REG_PC] = context->readPC(); 215 216 // @todo: Currently this is very Alpha specific. --- 9 unchanged lines hidden (view full) --- 226 227#ifdef KGDB_FP_REGS 228 for (int i = 0; i < NumFloatArchRegs; ++i) { 229 gdbregs.regs[i + KGDB_REG_F0] = context->readFloatRegBits(i); 230 } 231#endif 232} 233 | 208void 209RemoteGDB::getregs() 210{ 211 memset(gdbregs.regs, 0, gdbregs.bytes()); 212 213 gdbregs.regs[KGDB_REG_PC] = context->readPC(); 214 215 // @todo: Currently this is very Alpha specific. --- 9 unchanged lines hidden (view full) --- 225 226#ifdef KGDB_FP_REGS 227 for (int i = 0; i < NumFloatArchRegs; ++i) { 228 gdbregs.regs[i + KGDB_REG_F0] = context->readFloatRegBits(i); 229 } 230#endif 231} 232 |
234/////////////////////////////////////////////////////////// 235// RemoteGDB::setregs 236// 237// Translate the GDB register format into the kernel 238// debugger register format. 239// | 233/* 234 * Translate the GDB register format into the kernel debugger register 235 * format. 236 */ |
240void 241RemoteGDB::setregs() 242{ 243 // @todo: Currently this is very Alpha specific. 244 if (PcPAL(gdbregs.regs[KGDB_REG_PC])) { 245 for (int i = 0; i < NumIntArchRegs; ++i) { 246 context->setIntReg(reg_redir[i], gdbregs.regs[i]); 247 } --- 70 unchanged lines hidden --- | 237void 238RemoteGDB::setregs() 239{ 240 // @todo: Currently this is very Alpha specific. 241 if (PcPAL(gdbregs.regs[KGDB_REG_PC])) { 242 for (int i = 0; i < NumIntArchRegs; ++i) { 243 context->setIntReg(reg_redir[i], gdbregs.regs[i]); 244 } --- 70 unchanged lines hidden --- |