remote_gdb.cc (8706:b1838faf3bcc) | remote_gdb.cc (8780:89e0822462a1) |
---|---|
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; --- 107 unchanged lines hidden (view full) --- 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 | 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; --- 107 unchanged lines hidden (view full) --- 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/regredir.hh" 131#include "arch/alpha/remote_gdb.hh" 132#include "arch/alpha/utility.hh" | 124 125#include "arch/alpha/kgdb.h" 126#include "arch/alpha/regredir.hh" 127#include "arch/alpha/remote_gdb.hh" 128#include "arch/alpha/utility.hh" |
129#include "arch/alpha/vtophys.hh" |
|
133#include "base/intmath.hh" 134#include "base/remote_gdb.hh" 135#include "base/socket.hh" 136#include "base/trace.hh" 137#include "cpu/decode.hh" 138#include "cpu/static_inst.hh" 139#include "cpu/thread_context.hh" 140#include "debug/GDBAcc.hh" 141#include "debug/GDBMisc.hh" 142#include "mem/physical.hh" 143#include "mem/port.hh" 144#include "sim/system.hh" | 130#include "base/intmath.hh" 131#include "base/remote_gdb.hh" 132#include "base/socket.hh" 133#include "base/trace.hh" 134#include "cpu/decode.hh" 135#include "cpu/static_inst.hh" 136#include "cpu/thread_context.hh" 137#include "debug/GDBAcc.hh" 138#include "debug/GDBMisc.hh" 139#include "mem/physical.hh" 140#include "mem/port.hh" 141#include "sim/system.hh" |
142#include "sim/full_system.hh" |
|
145 146using namespace std; 147using namespace AlphaISA; 148 149RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc) 150 : BaseRemoteGDB(_system, tc, KGDB_NUMREGS) 151{ 152 memset(gdbregs.regs, 0, gdbregs.bytes()); 153} 154 155/* 156 * Determine if the mapping at va..(va+len) is valid. 157 */ 158bool 159RemoteGDB::acc(Addr va, size_t len) 160{ | 143 144using namespace std; 145using namespace AlphaISA; 146 147RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc) 148 : BaseRemoteGDB(_system, tc, KGDB_NUMREGS) 149{ 150 memset(gdbregs.regs, 0, gdbregs.bytes()); 151} 152 153/* 154 * Determine if the mapping at va..(va+len) is valid. 155 */ 156bool 157RemoteGDB::acc(Addr va, size_t len) 158{ |
161#if !FULL_SYSTEM 162 panic("acc function needs to be rewritten for SE mode\n"); 163#else 164 Addr last_va; | 159 if (FullSystem) { 160 Addr last_va; |
165 | 161 |
166 va = TruncPage(va); 167 last_va = RoundPage(va + len); | 162 va = TruncPage(va); 163 last_va = RoundPage(va + len); |
168 | 164 |
169 do { 170 if (IsK0Seg(va)) { 171 if (va < (K0SegBase + pmem->size())) { 172 DPRINTF(GDBAcc, "acc: Mapping is valid K0SEG <= " 173 "%#x < K0SEG + size\n", va); 174 return true; 175 } else { 176 DPRINTF(GDBAcc, "acc: Mapping invalid %#x > K0SEG + size\n", 177 va); 178 return false; | 165 do { 166 if (IsK0Seg(va)) { 167 if (va < (K0SegBase + pmem->size())) { 168 DPRINTF(GDBAcc, "acc: Mapping is valid K0SEG <= " 169 "%#x < K0SEG + size\n", va); 170 return true; 171 } else { 172 DPRINTF(GDBAcc, "acc: Mapping invalid %#x " 173 "> K0SEG + size\n", va); 174 return false; 175 } |
179 } | 176 } |
180 } | |
181 | 177 |
182 /** 183 * This code says that all accesses to palcode (instruction 184 * and data) are valid since there isn't a va->pa mapping 185 * because palcode is accessed physically. At some point this 186 * should probably be cleaned up but there is no easy way to 187 * do it. 188 */ | 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 */ |
189 | 185 |
190 if (PcPAL(va) || va < 0x10000) 191 return true; | 186 if (PcPAL(va) || va < 0x10000) 187 return true; |
192 | 188 |
193 Addr ptbr = context->readMiscRegNoEffect(IPR_PALtemp20); 194 PageTableEntry pte = 195 kernel_pte_lookup(context->getPhysProxy(), ptbr, va); 196 if (!pte.valid()) { 197 DPRINTF(GDBAcc, "acc: %#x pte is invalid\n", va); 198 return false; 199 } 200 va += PageBytes; 201 } while (va < last_va); | 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); |
202 | 198 |
203 DPRINTF(GDBAcc, "acc: %#x mapping is valid\n", va); 204 return true; 205#endif | 199 DPRINTF(GDBAcc, "acc: %#x mapping is valid\n", va); 200 return true; 201 } else { 202 panic("acc function needs to be rewritten for SE mode\n"); 203 } |
206} 207 208/* 209 * Translate the kernel debugger register format into the GDB register 210 * format. 211 */ 212void 213RemoteGDB::getregs() --- 95 unchanged lines hidden (view full) --- 309 alpha_pal_imb(); 310#endif 311 return true; 312 } else { 313 return false; 314 } 315} 316 | 204} 205 206/* 207 * Translate the kernel debugger register format into the GDB register 208 * format. 209 */ 210void 211RemoteGDB::getregs() --- 95 unchanged lines hidden (view full) --- 307 alpha_pal_imb(); 308#endif 309 return true; 310 } else { 311 return false; 312 } 313} 314 |
317 318bool 319RemoteGDB::insertHardBreak(Addr addr, size_t len) 320{ 321 warn_once("Breakpoints do not work in Alpha PAL mode.\n" 322 " See PCEventQueue::doService() in cpu/pc_event.cc.\n"); 323 return BaseRemoteGDB::insertHardBreak(addr, len); 324} | |