remote_gdb.cc (4060:aa97f9f77e2a) remote_gdb.cc (4070:74449a198a44)
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;

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

147// Determine if the mapping at va..(va+len) is valid.
148//
149bool
150RemoteGDB::acc(Addr va, size_t len)
151{
152 //@Todo In NetBSD, this function checks if all addresses
153 //from va to va + len have valid page mape entries. Not
154 //sure how this will work for other OSes or in general.
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;

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

147// Determine if the mapping at va..(va+len) is valid.
148//
149bool
150RemoteGDB::acc(Addr va, size_t len)
151{
152 //@Todo In NetBSD, this function checks if all addresses
153 //from va to va + len have valid page mape entries. Not
154 //sure how this will work for other OSes or in general.
155 return true;
155 if (va)
156 return true;
157 return false;
156}
157
158///////////////////////////////////////////////////////////
159// RemoteGDB::getregs
160//
161// Translate the kernel debugger register format into
162// the GDB register format.
163void
164RemoteGDB::getregs()
165{
166 memset(gdbregs.regs, 0, gdbregs.size);
167
168 if (context->readMiscRegWithEffect(MISCREG_PSTATE) &
158}
159
160///////////////////////////////////////////////////////////
161// RemoteGDB::getregs
162//
163// Translate the kernel debugger register format into
164// the GDB register format.
165void
166RemoteGDB::getregs()
167{
168 memset(gdbregs.regs, 0, gdbregs.size);
169
170 if (context->readMiscRegWithEffect(MISCREG_PSTATE) &
169 PSTATE::am)
170 panic("In 32bit mode\n");
171 PSTATE::am) {
172 uint32_t *regs;
173 regs = (uint32_t*)gdbregs.regs;
174 regs[Reg32Pc] = htobe((uint32_t)context->readPC());
175 regs[Reg32Npc] = htobe((uint32_t)context->readNextPC());
176 for(int x = RegG0; x <= RegI0 + 7; x++)
177 regs[x] = htobe((uint32_t)context->readIntReg(x - RegG0));
171
178
172 gdbregs.regs[RegPc] = htobe(context->readPC());
173 gdbregs.regs[RegNpc] = htobe(context->readNextPC());
174 for(int x = RegG0; x <= RegI0 + 7; x++)
175 gdbregs.regs[x] = htobe(context->readIntReg(x - RegG0));
179 regs[Reg32Y] = htobe((uint32_t)context->readIntReg(NumIntArchRegs + 1));
180 regs[Reg32Psr] = htobe((uint32_t)context->readMiscRegWithEffect(MISCREG_PSTATE));
181 regs[Reg32Fsr] = htobe((uint32_t)context->readMiscRegWithEffect(MISCREG_FSR));
182 regs[Reg32Csr] = htobe((uint32_t)context->readIntReg(NumIntArchRegs + 2));
183 } else {
184 gdbregs.regs[RegPc] = htobe(context->readPC());
185 gdbregs.regs[RegNpc] = htobe(context->readNextPC());
186 for(int x = RegG0; x <= RegI0 + 7; x++)
187 gdbregs.regs[x] = htobe(context->readIntReg(x - RegG0));
176
188
177 gdbregs.regs[RegFsr] = htobe(context->readMiscRegWithEffect(MISCREG_FSR));
178 gdbregs.regs[RegFprs] = htobe(context->readMiscRegWithEffect(MISCREG_FPRS));
179 gdbregs.regs[RegY] = htobe(context->readIntReg(NumIntArchRegs + 1));
180 gdbregs.regs[RegState] = htobe(
181 context->readMiscRegWithEffect(MISCREG_CWP) |
182 context->readMiscRegWithEffect(MISCREG_PSTATE) << 8 |
183 context->readMiscRegWithEffect(MISCREG_ASI) << 24 |
184 context->readIntReg(NumIntArchRegs + 2) << 32);
189 gdbregs.regs[RegFsr] = htobe(context->readMiscRegWithEffect(MISCREG_FSR));
190 gdbregs.regs[RegFprs] = htobe(context->readMiscRegWithEffect(MISCREG_FPRS));
191 gdbregs.regs[RegY] = htobe(context->readIntReg(NumIntArchRegs + 1));
192 gdbregs.regs[RegState] = htobe(
193 context->readMiscRegWithEffect(MISCREG_CWP) |
194 context->readMiscRegWithEffect(MISCREG_PSTATE) << 8 |
195 context->readMiscRegWithEffect(MISCREG_ASI) << 24 |
196 context->readIntReg(NumIntArchRegs + 2) << 32);
197 }
185
198
186
187 DPRINTF(GDBRead, "PC=%#x\n", gdbregs.regs[RegPc]);
188
189 //Floating point registers are left at 0 in netbsd
190 //All registers other than the pc, npc and int regs
191 //are ignored as well.
192}
193
194///////////////////////////////////////////////////////////

--- 28 unchanged lines hidden ---
199 DPRINTF(GDBRead, "PC=%#x\n", gdbregs.regs[RegPc]);
200
201 //Floating point registers are left at 0 in netbsd
202 //All registers other than the pc, npc and int regs
203 //are ignored as well.
204}
205
206///////////////////////////////////////////////////////////

--- 28 unchanged lines hidden ---