remote_gdb.cc (8799:dac1e33e07b0) remote_gdb.cc (8806:669e93d79ed9)
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;

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

151}
152
153/*
154 * Determine if the mapping at va..(va+len) is valid.
155 */
156bool
157RemoteGDB::acc(Addr va, size_t len)
158{
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;

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

151}
152
153/*
154 * Determine if the mapping at va..(va+len) is valid.
155 */
156bool
157RemoteGDB::acc(Addr va, size_t len)
158{
159 if (FullSystem) {
160 Addr last_va;
159 if (!FullSystem)
160 panic("acc function needs to be rewritten for SE mode\n");
161
161
162 va = TruncPage(va);
163 last_va = RoundPage(va + len);
162 Addr last_va;
164
163
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 }
176 }
164 va = TruncPage(va);
165 last_va = RoundPage(va + len);
177
166
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)
167 do {
168 if (IsK0Seg(va)) {
169 if (va < (K0SegBase + pmem->size())) {
170 DPRINTF(GDBAcc, "acc: Mapping is valid K0SEG <= "
171 "%#x < K0SEG + size\n", va);
187 return true;
172 return true;
188
189 Addr ptbr = context->readMiscRegNoEffect(IPR_PALtemp20);
190 PageTableEntry pte =
191 kernel_pte_lookup(context->getPhysProxy(), ptbr, va);
192 if (!pte.valid()) {
193 DPRINTF(GDBAcc, "acc: %#x pte is invalid\n", va);
173 } else {
174 DPRINTF(GDBAcc, "acc: Mapping invalid %#x "
175 "> K0SEG + size\n", va);
194 return false;
195 }
176 return false;
177 }
196 va += PageBytes;
197 } while (va < last_va);
178 }
198
179
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 }
180 /**
181 * This code says that all accesses to palcode (instruction
182 * and data) are valid since there isn't a va->pa mapping
183 * because palcode is accessed physically. At some point this
184 * should probably be cleaned up but there is no easy way to
185 * do it.
186 */
187
188 if (PcPAL(va) || va < 0x10000)
189 return true;
190
191 Addr ptbr = context->readMiscRegNoEffect(IPR_PALtemp20);
192 PageTableEntry pte =
193 kernel_pte_lookup(context->getPhysProxy(), ptbr, va);
194 if (!pte.valid()) {
195 DPRINTF(GDBAcc, "acc: %#x pte is invalid\n", va);
196 return false;
197 }
198 va += PageBytes;
199 } while (va < last_va);
200
201 DPRINTF(GDBAcc, "acc: %#x mapping is valid\n", va);
202 return true;
204}
205
206/*
207 * Translate the kernel debugger register format into the GDB register
208 * format.
209 */
210void
211RemoteGDB::getregs()

--- 111 unchanged lines hidden ---
203}
204
205/*
206 * Translate the kernel debugger register format into the GDB register
207 * format.
208 */
209void
210RemoteGDB::getregs()

--- 111 unchanged lines hidden ---