Skip to contentSkip to conversation

target-tricore: fix depositing bits from PCXI into ICR

PATCH Applied Paolo Bonzini 2 participants 2 messages Jun 24, 2015 – Jun 25, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-tricore: fix depositing bits from PCXI into ICR

Spotted by Coverity, because (env->PCXI & MASK_PCXI_PCPN) >> 24 is always zero. The immediately preceding assignment is also wrong though.

---
 target-tricore/op_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target-tricore/op_helper.c +2 -2
index 10ed541..53edbda 100644
@@ -2545,10 +2545,10 @@ void helper_rfm(CPUTriCoreState *env)
     env->PC = (env->gpr_a[11] & ~0x1);
     /* ICR.IE = PCXI.PIE; */
     env->ICR = (env->ICR & ~MASK_ICR_IE) |
-               ((env->PCXI & ~MASK_PCXI_PIE) >> 15);
+               ((env->PCXI & MASK_PCXI_PIE) >> 15);
     /* ICR.CCPN = PCXI.PCPN; */
     env->ICR = (env->ICR & ~MASK_ICR_CCPN) |
-               ((env->PCXI & ~MASK_PCXI_PCPN) >> 24);
+               ((env->PCXI & MASK_PCXI_PCPN) >> 24);
     /* {PCXI, PSW, A[10], A[11]} = M(DCX, 4 * word); */
     env->PCXI = cpu_ldl_data(env, env->DCX);
     psw_write(env, cpu_ldl_data(env, env->DCX+4));
Signature · 1 line
2.4.3
#1 lore raw
Quoted 16 lines · Paolo Bonzini

Spotted by Coverity, because (env->PCXI & MASK_PCXI_PCPN) >> 24 is always zero. The immediately preceding assignment is also wrong though.

---
  target-tricore/op_helper.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
target-tricore/op_helper.c +0 -0
index 10ed541..53edbda 100644
@@ -2545,10 +2545,10 @@ void helper_rfm(CPUTriCoreState *env)
      env->PC = (env->gpr_a[11] & ~0x1);
      /* ICR.IE = PCXI.PIE; */

target-tricore/op_helper.c void helper_rfm(CPUTriCoreState *env) · line 2554

Quoted 10 lines
target-tricore/op_helper.c +2 -2
      env->ICR = (env->ICR & ~MASK_ICR_IE) |
-               ((env->PCXI & ~MASK_PCXI_PIE) >> 15);
+               ((env->PCXI & MASK_PCXI_PIE) >> 15);
      /* ICR.CCPN = PCXI.PCPN; */
      env->ICR = (env->ICR & ~MASK_ICR_CCPN) |
-               ((env->PCXI & ~MASK_PCXI_PCPN) >> 24);
+               ((env->PCXI & MASK_PCXI_PCPN) >> 24);
      /* {PCXI, PSW, A[10], A[11]} = M(DCX, 4 * word); */
      env->PCXI = cpu_ldl_data(env, env->DCX);
      psw_write(env, cpu_ldl_data(env, env->DCX+4));

Thanks, applied it to my tricore-next branch.

Cheers,
Bastian