summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorAlexandru Dutu <alexandru.dutu@amd.com>2014-11-23 18:01:08 -0800
committerAlexandru Dutu <alexandru.dutu@amd.com>2014-11-23 18:01:08 -0800
commitadbaa4dfde96d5aaf84adf0ae4989ef880aad726 (patch)
treed0f597266fc27c9b7bfa36312fee1de1fea6c450 /src/sim
parent335514dfdc63c6f8e34cc172e2582ceca548a07c (diff)
downloadgem5-adbaa4dfde96d5aaf84adf0ae4989ef880aad726.tar.xz
kvm, x86: Adding support for SE mode execution
This patch adds methods in KvmCPU model to handle KVM exits caused by syscall instructions and page faults. These types of exits will be encountered if KvmCPU is run in SE mode.
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/pseudo_inst.cc11
-rw-r--r--src/sim/system.cc10
2 files changed, 21 insertions, 0 deletions
diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc
index e85e3d19a..80737003c 100644
--- a/src/sim/pseudo_inst.cc
+++ b/src/sim/pseudo_inst.cc
@@ -52,6 +52,7 @@
#include "arch/kernel_stats.hh"
#include "arch/utility.hh"
#include "arch/vtophys.hh"
+#include "arch/pseudo_inst.hh"
#include "base/debug.hh"
#include "base/output.hh"
#include "config/the_isa.hh"
@@ -64,6 +65,7 @@
#include "debug/WorkItems.hh"
#include "params/BaseCPU.hh"
#include "sim/full_system.hh"
+#include "sim/process.hh"
#include "sim/pseudo_inst.hh"
#include "sim/serialize.hh"
#include "sim/sim_events.hh"
@@ -198,6 +200,15 @@ pseudoInst(ThreadContext *tc, uint8_t func, uint8_t subfunc)
warn("Unimplemented m5 op (0x%x)\n", func);
break;
+ /* SE mode functions */
+ case 0x60: // syscall_func
+ m5Syscall(tc);
+ break;
+
+ case 0x61: // pagefault_func
+ m5PageFault(tc);
+ break;
+
default:
warn("Unhandled m5 op: 0x%x\n", func);
break;
diff --git a/src/sim/system.cc b/src/sim/system.cc
index 1f63dbf33..c311d65b9 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -324,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;