forgot to set clroffset
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 18 Oct 2018 17:14:36 +0000 (18:14 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 18 Oct 2018 17:14:36 +0000 (18:14 +0100)
riscv/processor.cc

index d87da2521c3ccbf4fbda771c736375d7e097bafd..4431dcdc05979479303775560f85d7af3c062dbd 100644 (file)
@@ -375,11 +375,12 @@ void processor_t::set_csr(int which, reg_t val)
       // lower 16 bits go into even, upper into odd...
       state.sv_csrs[tbidx].u = get_field(val, 0xffff);
       state.sv_csrs[tbidx+1].u = get_field(val, 0xffff<<16);
-      int clroffset = 0;
+      int clroffset = 2;
       if (xlen == 64)
       {
           state.sv_csrs[tbidx+2].u = get_field(val, 0xffff<<32);
           state.sv_csrs[tbidx+3].u = get_field(val, 0xffff<<48);
+        clroffset = 4;
       }
       // clear out all CSRs above the one(s) being set: this ensures that
       // when it comes to context-switching, it's clear what needs to be saved
@@ -435,11 +436,12 @@ void processor_t::set_csr(int which, reg_t val)
       int tbidx = (which - CSR_SVPREDCFG0) * 2;
       state.sv_pred_csrs[tbidx].u = get_field(val, 0xffff);
       state.sv_pred_csrs[tbidx+1].u = get_field(val, 0xffff0000);
-      int clroffset = 0;
+      int clroffset = 2;
       if (xlen == 64)
       {
           state.sv_pred_csrs[tbidx+2].u = get_field(val, 0xffff<<32);
           state.sv_pred_csrs[tbidx+3].u = get_field(val, 0xffff<<48);
+          clroffset = 4;
       }
       for (int i = tbidx+clroffset; i < 16; i++)
       {