Merge zizzer.eecs.umich.edu:/bk/m5
[gem5.git] / base / remote_gdb.cc
index 7b73d60e9a9f754371fbb20f5e6926514d3a0e20..c3590920a8f8558ac6860e40539203aec654b2f1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2002-2004 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 
 #include <sys/signal.h>
 
-#include <unistd.h>
-
 #include <cstdio>
 #include <string>
+#include <unistd.h>
 
-#include "cpu/exec_context.hh"
 #include "base/intmath.hh"
 #include "base/kgdb.h"
-
-#include "mem/functional_mem/physical_memory.hh"
 #include "base/remote_gdb.hh"
 #include "base/socket.hh"
 #include "base/trace.hh"
-#include "targetarch/vtophys.hh"
-#include "sim/system.hh"
+#include "cpu/exec_context.hh"
 #include "cpu/static_inst.hh"
+#include "mem/functional/physical.hh"
+#include "sim/system.hh"
+#include "targetarch/vtophys.hh"
 
 using namespace std;
 
@@ -326,14 +324,13 @@ bool
 RemoteGDB::acc(Addr va, size_t len)
 {
     Addr last_va;
-    Addr pte;
 
-    va = alpha_trunc_page(va);
-    last_va = alpha_round_page(va + len);
+    va = TheISA::TruncPage(va);
+    last_va = TheISA::RoundPage(va + len);
 
     do  {
-        if (va >= ALPHA_K0SEG_BASE && va < ALPHA_K1SEG_BASE) {
-            if (va < (ALPHA_K0SEG_BASE + pmem->size())) {
+        if (TheISA::IsK0Seg(va)) {
+            if (va < (TheISA::K0SegBase + pmem->size())) {
                 DPRINTF(GDBAcc, "acc:   Mapping is valid  K0SEG <= "
                         "%#x < K0SEG + size\n", va);
                 return true;
@@ -344,16 +341,23 @@ RemoteGDB::acc(Addr va, size_t len)
             }
         }
 
-        if (PC_PAL(va) || va < 0x10000)
+    /**
+     * This code says that all accesses to palcode (instruction and data)
+     * are valid since there isn't a va->pa mapping because palcode is
+     * accessed physically. At some point this should probably be cleaned up
+     * but there is no easy way to do it.
+     */
+
+        if (AlphaISA::PcPAL(va) || va < 0x10000)
             return true;
 
         Addr ptbr = context->regs.ipr[AlphaISA::IPR_PALtemp20];
-        pte = kernel_pte_lookup(pmem, ptbr, va);
-        if (!pte || !entry_valid(pmem->phys_read_qword(pte))) {
+        TheISA::PageTableEntry pte = kernel_pte_lookup(pmem, ptbr, va);
+        if (!pte.valid()) {
             DPRINTF(GDBAcc, "acc:   %#x pte is invalid\n", va);
             return false;
         }
-        va += ALPHA_PGBYTES;
+        va += TheISA::PageBytes;
     } while (va < last_va);
 
     DPRINTF(GDBAcc, "acc:   %#x mapping is valid\n", va);