add BSD license
[riscv-isa-sim.git] / riscv / interactive.cc
index 5ba6d234b03711b95c2a095427d8c20405df85ee..3f029109cebb5624982e88ad8c2e78d447b16660 100644 (file)
@@ -1,3 +1,5 @@
+// See LICENSE for license details.
+
 #include "sim.h"
 #include "htif.h"
 #include <sys/mman.h>
@@ -62,10 +64,10 @@ void sim_t::interactive_run_silent(const std::string& cmd, const std::vector<std
 
 void sim_t::interactive_run(const std::string& cmd, const std::vector<std::string>& args, bool noisy)
 {
-  if(args.size())
-    step_all(atoll(args[0].c_str()),1,noisy);
+  if (args.size())
+    step_all(atoll(args[0].c_str()), 1, noisy);
   else
-    while(1) step_all(1,1,noisy);
+    while (1) step_all(1, 1, noisy);
 }
 
 void sim_t::interactive_run_proc_noisy(const std::string& cmd, const std::vector<std::string>& args)
@@ -90,12 +92,12 @@ void sim_t::interactive_run_proc(const std::string& cmd, const std::vector<std::
   if(a.size() == 2)
     procs[p]->step(atoi(a[1].c_str()),noisy);
   else
-    while(1) procs[p]->step(1,noisy);
+    while (1) procs[p]->step(1, noisy);
 }
 
 void sim_t::interactive_quit(const std::string& cmd, const std::vector<std::string>& args)
 {
-  stop();
+  exit(0);
 }
 
 reg_t sim_t::get_pc(const std::vector<std::string>& args)
@@ -173,7 +175,7 @@ reg_t sim_t::get_mem(const std::vector<std::string>& args)
     int p = atoi(args[0].c_str());
     if(p >= (int)num_cores())
       throw trap_illegal_instruction;
-    mmu->set_vm_enabled(!!(procs[p]->sr & SR_VM));
+    mmu->set_sr(procs[p]->sr);
     mmu->set_ptbr(procs[p]->mmu.get_ptbr());
     addr_str = args[1];
   }
@@ -233,7 +235,7 @@ void sim_t::interactive_until(const std::string& cmd, const std::vector<std::str
   std::vector<std::string> args2;
   args2 = std::vector<std::string>(args.begin()+1,args.end()-1);
 
-  while(1)
+  while (1)
   {
     reg_t current;
     if(scmd == "reg")