Deleted Added
sdiff udiff text old ( 5568:d14250d688d2 ) new ( 5569:baeee670d4ce )
full compact
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
121#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
145RemoteGDB::RemoteGDB(System *_system, ThreadContext *c)
146 : BaseRemoteGDB(_system, c, KGDB_NUMREGS)
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//
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
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 */
186
187 if (PcPAL(va) || va < 0x10000)
188 return true;
189
190 Addr ptbr = context->readMiscRegNoEffect(IPR_PALtemp20);
191 PageTableEntry pte = 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// RemoteGDB::getregs
206//
207// Translate the kernel debugger register format into
208// the GDB register format.
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
234///////////////////////////////////////////////////////////
235// RemoteGDB::setregs
236//
237// Translate the GDB register format into the kernel
238// debugger register format.
239//
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 ---