diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index a6e587b589..a32d91aa01 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -207,6 +207,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) CPUS390XState *env = &cpu->env; struct kvm_sregs sregs; struct kvm_regs regs; + struct kvm_fpu fpu; int r; int i; @@ -229,6 +230,17 @@ int kvm_arch_put_registers(CPUState *cs, int level) } } + /* Floating point */ + for (i = 0; i < 16; i++) { + fpu.fprs[i] = env->fregs[i].ll; + } + fpu.fpc = env->fpc; + + r = kvm_vcpu_ioctl(cs, KVM_SET_FPU, &fpu); + if (r < 0) { + return r; + } + /* Do we need to save more than that? */ if (level == KVM_PUT_RUNTIME_STATE) { return 0; @@ -296,6 +308,7 @@ int kvm_arch_get_registers(CPUState *cs) CPUS390XState *env = &cpu->env; struct kvm_sregs sregs; struct kvm_regs regs; + struct kvm_fpu fpu; int i, r; /* get the PSW */ @@ -336,6 +349,16 @@ int kvm_arch_get_registers(CPUState *cs) } } + /* Floating point */ + r = kvm_vcpu_ioctl(cs, KVM_GET_FPU, &fpu); + if (r < 0) { + return r; + } + for (i = 0; i < 16; i++) { + env->fregs[i].ll = fpu.fprs[i]; + } + env->fpc = fpu.fpc; + /* The prefix */ if (cap_sync_regs && cs->kvm_run->kvm_valid_regs & KVM_SYNC_PREFIX) { env->psa = cs->kvm_run->s.regs.prefix;