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> |
121 122#include <string> |
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 *tc) 146 : BaseRemoteGDB(_system, tc, KGDB_NUMREGS) |
147{ 148 memset(gdbregs.regs, 0, gdbregs.bytes()); 149} 150 |
151/* 152 * Determine if the mapping at va..(va+len) is valid. 153 */ |
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 |
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 */ |
185 186 if (PcPAL(va) || va < 0x10000) 187 return true; 188 189 Addr ptbr = context->readMiscRegNoEffect(IPR_PALtemp20); |
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 |
204/* 205 * Translate the kernel debugger register format into the GDB register 206 * format. 207 */ |
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 |
233/* 234 * Translate the GDB register format into the kernel debugger register 235 * format. 236 */ |
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 --- |