diff options
-rw-r--r-- | arch/s390/kvm/kvm-s390.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h index 3e05deff21b6..4d89d64a8161 100644 --- a/arch/s390/kvm/kvm-s390.h +++ b/arch/s390/kvm/kvm-s390.h | |||
@@ -67,8 +67,8 @@ static inline void kvm_s390_set_prefix(struct kvm_vcpu *vcpu, u32 prefix) | |||
67 | 67 | ||
68 | static inline u64 kvm_s390_get_base_disp_s(struct kvm_vcpu *vcpu) | 68 | static inline u64 kvm_s390_get_base_disp_s(struct kvm_vcpu *vcpu) |
69 | { | 69 | { |
70 | int base2 = vcpu->arch.sie_block->ipb >> 28; | 70 | u32 base2 = vcpu->arch.sie_block->ipb >> 28; |
71 | int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16); | 71 | u32 disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16); |
72 | 72 | ||
73 | return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; | 73 | return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; |
74 | } | 74 | } |
@@ -76,10 +76,10 @@ static inline u64 kvm_s390_get_base_disp_s(struct kvm_vcpu *vcpu) | |||
76 | static inline void kvm_s390_get_base_disp_sse(struct kvm_vcpu *vcpu, | 76 | static inline void kvm_s390_get_base_disp_sse(struct kvm_vcpu *vcpu, |
77 | u64 *address1, u64 *address2) | 77 | u64 *address1, u64 *address2) |
78 | { | 78 | { |
79 | int base1 = (vcpu->arch.sie_block->ipb & 0xf0000000) >> 28; | 79 | u32 base1 = (vcpu->arch.sie_block->ipb & 0xf0000000) >> 28; |
80 | int disp1 = (vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16; | 80 | u32 disp1 = (vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16; |
81 | int base2 = (vcpu->arch.sie_block->ipb & 0xf000) >> 12; | 81 | u32 base2 = (vcpu->arch.sie_block->ipb & 0xf000) >> 12; |
82 | int disp2 = vcpu->arch.sie_block->ipb & 0x0fff; | 82 | u32 disp2 = vcpu->arch.sie_block->ipb & 0x0fff; |
83 | 83 | ||
84 | *address1 = (base1 ? vcpu->run->s.regs.gprs[base1] : 0) + disp1; | 84 | *address1 = (base1 ? vcpu->run->s.regs.gprs[base1] : 0) + disp1; |
85 | *address2 = (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; | 85 | *address2 = (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; |
@@ -87,17 +87,20 @@ static inline void kvm_s390_get_base_disp_sse(struct kvm_vcpu *vcpu, | |||
87 | 87 | ||
88 | static inline u64 kvm_s390_get_base_disp_rsy(struct kvm_vcpu *vcpu) | 88 | static inline u64 kvm_s390_get_base_disp_rsy(struct kvm_vcpu *vcpu) |
89 | { | 89 | { |
90 | int base2 = vcpu->arch.sie_block->ipb >> 28; | 90 | u32 base2 = vcpu->arch.sie_block->ipb >> 28; |
91 | int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16) + | 91 | u32 disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16) + |
92 | ((vcpu->arch.sie_block->ipb & 0xff00) << 4); | 92 | ((vcpu->arch.sie_block->ipb & 0xff00) << 4); |
93 | /* The displacement is a 20bit _SIGNED_ value */ | ||
94 | if (disp2 & 0x80000) | ||
95 | disp2+=0xfff00000; | ||
93 | 96 | ||
94 | return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; | 97 | return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + (long)(int)disp2; |
95 | } | 98 | } |
96 | 99 | ||
97 | static inline u64 kvm_s390_get_base_disp_rs(struct kvm_vcpu *vcpu) | 100 | static inline u64 kvm_s390_get_base_disp_rs(struct kvm_vcpu *vcpu) |
98 | { | 101 | { |
99 | int base2 = vcpu->arch.sie_block->ipb >> 28; | 102 | u32 base2 = vcpu->arch.sie_block->ipb >> 28; |
100 | int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16); | 103 | u32 disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16); |
101 | 104 | ||
102 | return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; | 105 | return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; |
103 | } | 106 | } |