diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2011-10-27 19:26:02 +0200 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2011-12-22 14:53:00 -0200 |
commit | 6b42494b219a3beb755bc52419c731aa70efe93d (patch) | |
tree | 79e72e63ff514b4493012e4d0d8721f021d1932b /target-i386 | |
parent | 03ecd2c80a64d030a22fe67cc7a60f24e17ff211 (diff) |
kvm: x86: Use symbols for all xsave field
Field 0 (FCW+FSW) and 1 (FTW+FOP) were hard-coded so far.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'target-i386')
-rw-r--r-- | target-i386/kvm.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 5bfc21fc53..d2f70f9100 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -759,6 +759,8 @@ static int kvm_put_fpu(CPUState *env) return kvm_vcpu_ioctl(env, KVM_SET_FPU, &fpu); } +#define XSAVE_FCW_FSW 0 +#define XSAVE_FTW_FOP 1 #define XSAVE_CWD_RIP 2 #define XSAVE_CWD_RDP 4 #define XSAVE_MXCSR 6 @@ -786,8 +788,8 @@ static int kvm_put_xsave(CPUState *env) for (i = 0; i < 8; ++i) { twd |= (!env->fptags[i]) << i; } - xsave->region[0] = (uint32_t)(swd << 16) + cwd; - xsave->region[1] = (uint32_t)(env->fpop << 16) + twd; + xsave->region[XSAVE_FCW_FSW] = (uint32_t)(swd << 16) + cwd; + xsave->region[XSAVE_FTW_FOP] = (uint32_t)(env->fpop << 16) + twd; memcpy(&xsave->region[XSAVE_CWD_RIP], &env->fpip, sizeof(env->fpip)); memcpy(&xsave->region[XSAVE_CWD_RDP], &env->fpdp, sizeof(env->fpdp)); memcpy(&xsave->region[XSAVE_ST_SPACE], env->fpregs, @@ -991,10 +993,10 @@ static int kvm_get_xsave(CPUState *env) return ret; } - cwd = (uint16_t)xsave->region[0]; - swd = (uint16_t)(xsave->region[0] >> 16); - twd = (uint16_t)xsave->region[1]; - env->fpop = (uint16_t)(xsave->region[1] >> 16); + cwd = (uint16_t)xsave->region[XSAVE_FCW_FSW]; + swd = (uint16_t)(xsave->region[XSAVE_FCW_FSW] >> 16); + twd = (uint16_t)xsave->region[XSAVE_FTW_FOP]; + env->fpop = (uint16_t)(xsave->region[XSAVE_FTW_FOP] >> 16); env->fpstt = (swd >> 11) & 7; env->fpus = swd; env->fpuc = cwd; |