s390/kvm: Fix instruction decoding
authorChristian Borntraeger <borntraeger@de.ibm.com>
Fri, 25 Jan 2013 14:34:17 +0000 (15:34 +0100)
committerGleb Natapov <gleb@redhat.com>
Wed, 30 Jan 2013 10:35:59 +0000 (12:35 +0200)
commit0c29b2293b25527a1759cbd22b106f19258636b6
treefd9f0f38e9361aef6fd1d3f0f854fb0cbc47c67b
parentc98d3683ce675d689121147ed00e7c4af4737518
s390/kvm: Fix instruction decoding

Instructions with long displacement have a signed displacement.
Currently the sign bit is interpreted as 2^20: Lets fix it by doing the
sign extension from 20bit to 32bit and then use it as a signed variable
in the addition (see kvm_s390_get_base_disp_rsy).

Furthermore, there are lots of "int" in that code. This is problematic,
because shifting on a signed integer is undefined/implementation defined
if the bit value happens to be negative.
Fortunately the promotion rules will make the right hand side unsigned
anyway, so there is no real problem right now.
Let's convert them anyway to unsigned where appropriate to avoid
problems if the code is changed or copy/pasted later on.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
arch/s390/kvm/kvm-s390.h