]> git.proxmox.com Git - qemu.git/commit
target-mips: Sign-extend the result of LWR
authorRichard Sandiford <rdsandiford@googlemail.com>
Sun, 20 Jan 2013 19:30:54 +0000 (19:30 +0000)
committerAurelien Jarno <aurelien@aurel32.net>
Thu, 31 Jan 2013 22:40:52 +0000 (23:40 +0100)
commitc728154bbbc1a86465a0fd6bfc839bc9710ac374
treed2011cf8167adb8939c5d464958cbac9fe46ec4e
parent17e8fef1af2db3a13613a311db2ec2f7a69645a1
target-mips: Sign-extend the result of LWR

Sign-extend the result of LWR, as is already done for LWL.  This is necessary
in the case where LWR loads the full word (i.e. the address is actually
aligned).  In the other cases, it is implementation defined whether the
upper 32 bits of the result are unchanged or a copy of bit 31.  The latter
seems easier to implement.

Previously the code used:

    (oldval & (0xfffffffe << (31 - bitshift))) | (newval >> bitshift)

which zeroed the upper bits of the register, losing any previous sign
extension in the unaligned cases.

Signed-off-by: Richard Sandiford <rdsandiford@googlemail.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-mips/translate.c