diff options
author | David Edmondson <david.edmondson@oracle.com> | 2021-07-05 11:46:28 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-07-06 07:54:53 +0200 |
commit | c0198c5f87b6db25712672292e01ab710d6ef631 (patch) | |
tree | 02d5f74c30df3fc21fd78d3a75875f7c99992305 /target/i386/kvm | |
parent | fde74821006472f40fee9a094e6da86cd39b5623 (diff) |
target/i386: Pass buffer and length to XSAVE helper
In preparation for removing assumptions about XSAVE area offsets, pass
a buffer pointer and buffer length to the XSAVE helper functions.
Signed-off-by: David Edmondson <david.edmondson@oracle.com>
Message-Id: <20210705104632.2902400-5-david.edmondson@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/kvm')
-rw-r--r-- | target/i386/kvm/kvm.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 3ab1d71775..41b0764ab7 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -1888,8 +1888,9 @@ int kvm_arch_init_vcpu(CPUState *cs) } if (has_xsave) { - env->xsave_buf = qemu_memalign(4096, sizeof(struct kvm_xsave)); - memset(env->xsave_buf, 0, sizeof(struct kvm_xsave)); + env->xsave_buf_len = sizeof(struct kvm_xsave); + env->xsave_buf = qemu_memalign(4096, env->xsave_buf_len); + memset(env->xsave_buf, 0, env->xsave_buf_len); } max_nested_state_len = kvm_max_nested_state_length(); @@ -2469,12 +2470,12 @@ static int kvm_put_fpu(X86CPU *cpu) static int kvm_put_xsave(X86CPU *cpu) { CPUX86State *env = &cpu->env; - X86XSaveArea *xsave = env->xsave_buf; + void *xsave = env->xsave_buf; if (!has_xsave) { return kvm_put_fpu(cpu); } - x86_cpu_xsave_all_areas(cpu, xsave); + x86_cpu_xsave_all_areas(cpu, xsave, env->xsave_buf_len); return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_XSAVE, xsave); } @@ -3119,7 +3120,7 @@ static int kvm_get_fpu(X86CPU *cpu) static int kvm_get_xsave(X86CPU *cpu) { CPUX86State *env = &cpu->env; - X86XSaveArea *xsave = env->xsave_buf; + void *xsave = env->xsave_buf; int ret; if (!has_xsave) { @@ -3130,7 +3131,7 @@ static int kvm_get_xsave(X86CPU *cpu) if (ret < 0) { return ret; } - x86_cpu_xrstor_all_areas(cpu, xsave); + x86_cpu_xrstor_all_areas(cpu, xsave, env->xsave_buf_len); return 0; } |