• Christian Borntraeger's avatar
    s390/kvm: Fix instruction decoding · 0c29b229
    Christian Borntraeger authored
    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: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
    Reviewed-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
    Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
    0c29b229
kvm-s390.h 4.4 KB