kvm, x86: Adding support for SE mode execution
[gem5.git] / src / sim / system.cc
index 61c6decf7301e6dc0c82a6f734e04002f9f7b91f..c311d65b92bd3e3c82bd2b05d8f5c0af30e5ebd9 100644 (file)
@@ -54,7 +54,6 @@
 #include "cpu/thread_context.hh"
 #include "debug/Loader.hh"
 #include "debug/WorkItems.hh"
-#include "kern/kernel_stats.hh"
 #include "mem/abstract_mem.hh"
 #include "mem/physical.hh"
 #include "params/System.hh"
 #include "sim/full_system.hh"
 #include "sim/system.hh"
 
+/**
+ * To avoid linking errors with LTO, only include the header if we
+ * actually have a definition.
+ */
+#if THE_ISA != NULL_ISA
+#include "kern/kernel_stats.hh"
+#endif
+
 using namespace std;
 using namespace TheISA;
 
@@ -317,6 +324,16 @@ System::allocPhysPages(int npages)
 {
     Addr return_addr = pagePtr << PageShift;
     pagePtr += npages;
+
+    Addr next_return_addr = pagePtr << PageShift;
+
+    AddrRange m5opRange(0xffff0000, 0xffffffff);
+    if (m5opRange.contains(next_return_addr)) {
+        warn("Reached m5ops MMIO region\n");
+        return_addr = 0xffffffff;
+        pagePtr = 0xffffffff >> PageShift;
+    }
+
     if ((pagePtr << PageShift) > physmem.totalSize())
         fatal("Out of memory, please increase size of physical memory.");
     return return_addr;