POWER: Add support for the Power ISA
[gem5.git] / src / arch / sparc / remote_gdb.cc
index 85b0c03a3a09e12924658a30d6b273f506abd995..615c5b55168da8d6424b2bc4394fb7da892e64cb 100644 (file)
@@ -30,7 +30,7 @@
 
 /*
  * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
+ *      The Regents of the University of California.  All rights reserved.
  *
  * This software was developed by the Computer Systems Engineering group
  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
@@ -38,8 +38,8 @@
  *
  * All advertising materials mentioning features or use of this software
  * must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Lawrence Berkeley Laboratories.
+ *      This product includes software developed by the University of
+ *      California, Lawrence Berkeley Laboratories.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -51,8 +51,8 @@
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
+ *      This product includes software developed by the University of
+ *      California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -69,7 +69,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *     @(#)kgdb_stub.c 8.4 (Berkeley) 1/12/94
+ *      @(#)kgdb_stub.c 8.4 (Berkeley) 1/12/94
  */
 
 /*-
@@ -89,8 +89,8 @@
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
- *     This product includes software developed by the NetBSD
- *     Foundation, Inc. and its contributors.
+ *      This product includes software developed by the NetBSD
+ *      Foundation, Inc. and its contributors.
  * 4. Neither the name of The NetBSD Foundation nor the names of its
  *    contributors may be used to endorse or promote products derived
  *    from this software without specific prior written permission.
 #include "config/full_system.hh"
 #include "cpu/thread_context.hh"
 #include "cpu/static_inst.hh"
+#include "mem/page_table.hh"
 #include "mem/physical.hh"
 #include "mem/port.hh"
+#include "sim/process.hh"
 #include "sim/system.hh"
 
 using namespace std;
-using namespace TheISA;
+using namespace SparcISA;
 
 RemoteGDB::RemoteGDB(System *_system, ThreadContext *c)
     : BaseRemoteGDB(_system, c, NumGDBRegs), nextBkpt(0)
@@ -144,24 +146,33 @@ RemoteGDB::RemoteGDB(System *_system, ThreadContext *c)
 ///////////////////////////////////////////////////////////
 // RemoteGDB::acc
 //
-//     Determine if the mapping at va..(va+len) is valid.
+//      Determine if the mapping at va..(va+len) is valid.
 //
 bool
 RemoteGDB::acc(Addr va, size_t len)
 {
     //@Todo In NetBSD, this function checks if all addresses
-    //from va to va + len have valid page mape entries. Not
+    //from va to va + len have valid page map entries. Not
     //sure how this will work for other OSes or in general.
+#if FULL_SYSTEM
     if (va)
         return true;
     return false;
+#else
+    TlbEntry entry;
+    //Check to make sure the first byte is mapped into the processes address
+    //space.
+    if (context->getProcessPtr()->pTable->lookup(va, entry))
+        return true;
+    return false;
+#endif
 }
 
 ///////////////////////////////////////////////////////////
 // RemoteGDB::getregs
 //
-//     Translate the kernel debugger register format into
-//     the GDB register format.
+//      Translate the kernel debugger register format into
+//      the GDB register format.
 void
 RemoteGDB::getregs()
 {
@@ -206,8 +217,8 @@ RemoteGDB::getregs()
 ///////////////////////////////////////////////////////////
 // RemoteGDB::setregs
 //
-//     Translate the GDB register format into the kernel
-//     debugger register format.
+//      Translate the GDB register format into the kernel
+//      debugger register format.
 //
 void
 RemoteGDB::setregs()