remote_gdb.cc (12031:46116545e745) remote_gdb.cc (12449:2260f4a68210)
1/*
2 * Copyright 2014 Google, Inc.
3 * Copyright (c) 2002-2005 The Regents of The University of Michigan
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

--- 130 unchanged lines hidden (view full) ---

139#include "mem/physical.hh"
140#include "mem/port.hh"
141#include "sim/full_system.hh"
142#include "sim/system.hh"
143
144using namespace std;
145using namespace AlphaISA;
146
1/*
2 * Copyright 2014 Google, Inc.
3 * Copyright (c) 2002-2005 The Regents of The University of Michigan
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

--- 130 unchanged lines hidden (view full) ---

139#include "mem/physical.hh"
140#include "mem/port.hh"
141#include "sim/full_system.hh"
142#include "sim/system.hh"
143
144using namespace std;
145using namespace AlphaISA;
146
147RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc)
148 : BaseRemoteGDB(_system, tc)
147RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc, int _port)
148 : BaseRemoteGDB(_system, tc, _port)
149{
149{
150 warn_once("Breakpoints do not work in Alpha PAL mode.\n"
151 " See PCEventQueue::doService() in cpu/pc_event.cc.\n");
150}
151
152/*
153 * Determine if the mapping at va..(va+len) is valid.
154 */
155bool
156RemoteGDB::acc(Addr va, size_t len)
157{
158 if (!FullSystem)
159 panic("acc function needs to be rewritten for SE mode\n");
160
161 Addr last_va;
162
163 va = TruncPage(va);
164 last_va = RoundPage(va + len);
165
166 do {
167 if (IsK0Seg(va)) {
152}
153
154/*
155 * Determine if the mapping at va..(va+len) is valid.
156 */
157bool
158RemoteGDB::acc(Addr va, size_t len)
159{
160 if (!FullSystem)
161 panic("acc function needs to be rewritten for SE mode\n");
162
163 Addr last_va;
164
165 va = TruncPage(va);
166 last_va = RoundPage(va + len);
167
168 do {
169 if (IsK0Seg(va)) {
168 if (va < (K0SegBase + system->memSize())) {
170 if (va < (K0SegBase + system()->memSize())) {
169 DPRINTF(GDBAcc, "acc: Mapping is valid K0SEG <= "
170 "%#x < K0SEG + size\n", va);
171 return true;
172 } else {
173 DPRINTF(GDBAcc, "acc: Mapping invalid %#x "
174 "> K0SEG + size\n", va);
175 return false;
176 }

--- 5 unchanged lines hidden (view full) ---

182 * because palcode is accessed physically. At some point this
183 * should probably be cleaned up but there is no easy way to
184 * do it.
185 */
186
187 if (PcPAL(va) || va < 0x10000)
188 return true;
189
171 DPRINTF(GDBAcc, "acc: Mapping is valid K0SEG <= "
172 "%#x < K0SEG + size\n", va);
173 return true;
174 } else {
175 DPRINTF(GDBAcc, "acc: Mapping invalid %#x "
176 "> K0SEG + size\n", va);
177 return false;
178 }

--- 5 unchanged lines hidden (view full) ---

184 * because palcode is accessed physically. At some point this
185 * should probably be cleaned up but there is no easy way to
186 * do it.
187 */
188
189 if (PcPAL(va) || va < 0x10000)
190 return true;
191
190 Addr ptbr = context->readMiscRegNoEffect(IPR_PALtemp20);
192 Addr ptbr = context()->readMiscRegNoEffect(IPR_PALtemp20);
191 PageTableEntry pte =
193 PageTableEntry pte =
192 kernel_pte_lookup(context->getPhysProxy(), ptbr, va);
194 kernel_pte_lookup(context()->getPhysProxy(), ptbr, va);
193 if (!pte.valid()) {
194 DPRINTF(GDBAcc, "acc: %#x pte is invalid\n", va);
195 return false;
196 }
197 va += PageBytes;
198 } while (va < last_va);
199
200 DPRINTF(GDBAcc, "acc: %#x mapping is valid\n", va);

--- 41 unchanged lines hidden (view full) ---

242#ifdef KGDB_FP_REGS
243 for (int i = 0; i < NumFloatArchRegs; ++i) {
244 context->setFloatRegBits(i, gdbregs.regs64[i + KGDB_REG_F0]);
245 }
246#endif
247 context->pcState(r.pc);
248}
249
195 if (!pte.valid()) {
196 DPRINTF(GDBAcc, "acc: %#x pte is invalid\n", va);
197 return false;
198 }
199 va += PageBytes;
200 } while (va < last_va);
201
202 DPRINTF(GDBAcc, "acc: %#x mapping is valid\n", va);

--- 41 unchanged lines hidden (view full) ---

244#ifdef KGDB_FP_REGS
245 for (int i = 0; i < NumFloatArchRegs; ++i) {
246 context->setFloatRegBits(i, gdbregs.regs64[i + KGDB_REG_F0]);
247 }
248#endif
249 context->pcState(r.pc);
250}
251
250// Write bytes to kernel address space for debugger.
251bool
252RemoteGDB::write(Addr vaddr, size_t size, const char *data)
253{
254 if (BaseRemoteGDB::write(vaddr, size, data)) {
255#ifdef IMB
256 alpha_pal_imb();
257#endif
258 return true;
259 } else {
260 return false;
261 }
262}
263
252
264
265void
266RemoteGDB::insertHardBreak(Addr addr, size_t len)
253BaseGdbRegCache*
254RemoteGDB::gdbRegs()
267{
255{
268 warn_once("Breakpoints do not work in Alpha PAL mode.\n"
269 " See PCEventQueue::doService() in cpu/pc_event.cc.\n");
270 BaseRemoteGDB::insertHardBreak(addr, len);
256 return new AlphaGdbRegCache(this);
271}
272
257}
258
273RemoteGDB::BaseGdbRegCache*
274RemoteGDB::gdbRegs() {
275 return new AlphaGdbRegCache(this);
276}
277