new tohost/fromhost semantics
authorAndrew Waterman <waterman@eecs.berkeley.edu>
Thu, 2 Aug 2012 05:55:02 +0000 (22:55 -0700)
committerAndrew Waterman <waterman@eecs.berkeley.edu>
Thu, 2 Aug 2012 05:55:02 +0000 (22:55 -0700)
riscv/insns/mtpcr.h
riscv/processor.cc

index 5cd0134e0ba933c08df7daebe9b953354508b747..9b0beba15661037b5a739d5921a3c7c2a4eda65c 100644 (file)
@@ -1,4 +1,5 @@
 require_supervisor;
 reg_t val = get_pcr(insn.rtype.rs1);
-set_pcr(insn.rtype.rs1, RS2);
+if (val == 0 || insn.rtype.rs1 != PCR_TOHOST)
+  set_pcr(insn.rtype.rs1, RS2);
 RD = val;
index c11657556f6e2b3539c3319500dde2ad4aff4978..070ec15345eb568ab6b1bf49c871d52b2afc14fc 100644 (file)
@@ -271,12 +271,10 @@ void processor_t::set_pcr(int which, reg_t val)
       vecbanks_count = __builtin_popcountll(vecbanks);
       break;
     case PCR_TOHOST:
-      fromhost = 0;
       tohost = val;
       break;
     case PCR_FROMHOST:
       fromhost = val;
-      tohost = 0;
       break;
   }
 }