Skip to content

Commit

Permalink
[UPSTREAM][MIPS] Fix ll/sc after 7dd547e
Browse files Browse the repository at this point in the history
After 7dd547e the env->llval value is
loaded as an unsigned value (instead of sign-extended as before).
Therefore, the CMPXCHG in gen_st_cond() in translate.c fails if the sign
bit is set in the loaded value.

I discovered this issue because FreeBSD MIPS64 was looping forever in an
atomic helper function when trying to start /sbin/init.

Feel free to apply this patch upstream, as I cannot submit the patch
myself due to the complicated contribution process.

Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
  • Loading branch information
arichardson committed Feb 2, 2020
1 parent 74b2081 commit a18d80c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion target/mips/op_helper.c
Expand Up @@ -422,7 +422,7 @@ target_ulong helper_##name(CPUMIPSState *env, target_ulong arg, int mem_idx) \
env->llval = cpu_##insn##_mmuidx_ra(env, arg, mem_idx, GETPC()); \
return env->llval; \
}
HELPER_LD_ATOMIC(ll, ldl, 0x3)
HELPER_LD_ATOMIC(ll, ldsw, 0x3)
#ifdef TARGET_MIPS64
HELPER_LD_ATOMIC(lld, ldq, 0x7)
#endif
Expand Down

0 comments on commit a18d80c

Please sign in to comment.