hack to get hrfid not to alter msr 51
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 14 Aug 2020 19:43:56 +0000 (20:43 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 14 Aug 2020 19:43:56 +0000 (20:43 +0100)
src/soc/fu/trap/main_stage.py

index 24dbc718224d2e85498f3f3355b3fb5451aba6fd..fa802a6bb0fa732de99a4a24c3cafe3fa3df3a50 100644 (file)
@@ -256,8 +256,6 @@ class TrapMainStage(PipeModBase):
             # RFID.  v3.0B p955
 
             with m.Case(MicrOp.OP_RFID):
-                # XXX f_out.virt_mode <= b_in(MSR.IR) or b_in(MSR.PR);
-                # XXX f_out.priv_mode <= not b_in(MSR.PR);
 
                 # return addr was in srr0
                 comb += nia_o.data.eq(br_ext(srr0_i[2:]))
@@ -266,10 +264,11 @@ class TrapMainStage(PipeModBase):
                 # MSR was in srr1: copy it over, however *caveats below*
                 comb += msr_copy(msr_o.data, srr1_i, zero_me=False) # don't zero
 
-                with m.If(field(msr_i, 3)): # HV
-                    comb += field(msr_o, 51).eq(field(srr1_i, 51)) # ME
-                with m.Else():
-                    comb += field(msr_o, 51).eq(field(msr_i, 51)) # ME
+                with m.If(~self.i.ctx.op.insn[9]): # XXX BAD HACK! (hrfid)
+                    with m.If(field(msr_i, 3)): # HV
+                        comb += field(msr_o, 51).eq(field(srr1_i, 51)) # ME
+                    with m.Else():
+                        comb += field(msr_o, 51).eq(field(msr_i, 51)) # ME
 
                 # check problem state
                 msr_check_pr(m, msr_o.data)