diff mbox

[1/2] s390x/kvm: Fix opcode decoding for eb instruction handler

Message ID 1415025034-24918-2-git-send-email-cornelia.huck@de.ibm.com
State New
Headers show

Commit Message

Cornelia Huck Nov. 3, 2014, 2:30 p.m. UTC
From: Frank Blaschka <blaschka@linux.vnet.ibm.com>

The second byte of the opcode is encoded in the lowest byte of the ipb
field, not the lowest byte of the ipa field.

Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 target-s390x/kvm.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Thomas Huth Nov. 3, 2014, 2:42 p.m. UTC | #1
On Mon,  3 Nov 2014 15:30:33 +0100
Cornelia Huck <cornelia.huck@de.ibm.com> wrote:

> From: Frank Blaschka <blaschka@linux.vnet.ibm.com>
> 
> The second byte of the opcode is encoded in the lowest byte of the ipb
> field, not the lowest byte of the ipa field.
> 
> Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> ---
>  target-s390x/kvm.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
> index 5b10a25..690cb71 100644
> --- a/target-s390x/kvm.c
> +++ b/target-s390x/kvm.c
> @@ -827,18 +827,18 @@ static int handle_b9(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)
>      return r;
>  }
> 
> -static int handle_eb(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)
> +static int handle_eb(S390CPU *cpu, struct kvm_run *run, uint8_t ipbl)
>  {
>      int r = 0;
> 
> -    switch (ipa1) {
> +    switch (ipbl) {
>      case PRIV_EB_SQBS:
>          /* just inject exception */
>          r = -1;
>          break;
>      default:
>          r = -1;
> -        DPRINTF("KVM: unhandled PRIV: 0xeb%x\n", ipa1);
> +        DPRINTF("KVM: unhandled PRIV: 0xeb%x\n", ipbl);
>          break;
>      }
> 
> @@ -1039,7 +1039,7 @@ static int handle_instruction(S390CPU *cpu, struct kvm_run *run)
>          r = handle_b9(cpu, run, ipa1);
>          break;
>      case IPA0_EB:
> -        r = handle_eb(cpu, run, ipa1);
> +        r = handle_eb(cpu, run, run->s390_sieic.ipb & 0xff);
>          break;
>      case IPA0_DIAG:
>          r = handle_diag(cpu, run, run->s390_sieic.ipb);

Looks right!

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
diff mbox

Patch

diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 5b10a25..690cb71 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -827,18 +827,18 @@  static int handle_b9(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)
     return r;
 }
 
-static int handle_eb(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)
+static int handle_eb(S390CPU *cpu, struct kvm_run *run, uint8_t ipbl)
 {
     int r = 0;
 
-    switch (ipa1) {
+    switch (ipbl) {
     case PRIV_EB_SQBS:
         /* just inject exception */
         r = -1;
         break;
     default:
         r = -1;
-        DPRINTF("KVM: unhandled PRIV: 0xeb%x\n", ipa1);
+        DPRINTF("KVM: unhandled PRIV: 0xeb%x\n", ipbl);
         break;
     }
 
@@ -1039,7 +1039,7 @@  static int handle_instruction(S390CPU *cpu, struct kvm_run *run)
         r = handle_b9(cpu, run, ipa1);
         break;
     case IPA0_EB:
-        r = handle_eb(cpu, run, ipa1);
+        r = handle_eb(cpu, run, run->s390_sieic.ipb & 0xff);
         break;
     case IPA0_DIAG:
         r = handle_diag(cpu, run, run->s390_sieic.ipb);