fxsave
fxsave(&vtl0->fx_state);
extern void convert_to_fxsr(struct fxregs_state *fxsave,
struct fxregs_state fxsave;
fxsave(&fpu->fpstate->regs.fxsave);
fxrstor(&fpstate->regs.fxsave);
memcpy(&ustate->fxsave, &kstate->regs.fxsave,
sizeof(ustate->fxsave));
if (ustate->fxsave.mxcsr & ~mxcsr_feature_mask)
memcpy(&kstate->regs.fxsave, &ustate->fxsave, sizeof(ustate->fxsave));
fpstate->regs.fxsave.cwd = 0x37f;
fpstate->regs.fxsave.mxcsr = MXCSR_DEFAULT;
fxrstor(&init_fpstate.regs.fxsave);
cwd = fpu->fpstate->regs.fxsave.cwd;
swd = fpu->fpstate->regs.fxsave.swd;
mxcsr = fpu->fpstate->regs.fxsave.mxcsr;
return user_insn(fxsave %[fx], [fx] "=m" (*fx), "m" (*fx));
memcpy(&fpu->fpstate->regs.fxsave, &newstate, sizeof(newstate));
BUILD_BUG_ON(sizeof(fpu->__fpstate.regs.fxsave.xmm_space) != 16 * 16);
memset(&fpu->fpstate->regs.fxsave.xmm_space[8*4], 0, 8 * 16);
static inline u32 twd_fxsr_to_i387(struct fxregs_state *fxsave)
u32 tos = (fxsave->swd >> 11) & 7;
u32 twd = (unsigned long) fxsave->twd;
st = FPREG_ADDR(fxsave, (i - tos) & 7);
struct fxregs_state *fxsave)
struct _fpxreg *from = (struct _fpxreg *) &fxsave->st_space[0];
env->cwd = fxsave->cwd | 0xffff0000u;
env->swd = fxsave->swd | 0xffff0000u;
env->twd = twd_fxsr_to_i387(fxsave);
env->fip = fxsave->rip;
env->foo = fxsave->rdp;
env->fip = fxsave->fip;
env->fcs = (u16) fxsave->fcs | ((u32) fxsave->fop << 16);
env->foo = fxsave->foo;
env->fos = fxsave->fos;
__convert_from_fxsr(env, tsk, &x86_task_fpu(tsk)->fpstate->regs.fxsave);
void convert_to_fxsr(struct fxregs_state *fxsave,
struct _fpxreg *to = (struct _fpxreg *) &fxsave->st_space[0];
fxsave->cwd = env->cwd;
fxsave->swd = env->swd;
fxsave->twd = twd_i387_to_fxsr(env->twd);
fxsave->fop = (u16) ((u32) env->fcs >> 16);
fxsave->rip = env->fip;
fxsave->rdp = env->foo;
fxsave->fip = env->fip;
fxsave->fcs = (env->fcs & 0xffff);
fxsave->foo = env->foo;
fxsave->fos = env->fos;
struct fxregs_state fxsave, *fx;
struct membuf mb = { .p = &fxsave, .left = sizeof(fxsave) };
fx = &fxsave;
fx = &fpu->fpstate->regs.fxsave;
convert_to_fxsr(&fpu->fpstate->regs.fxsave, &env);
return membuf_write(&to, &fpu->fpstate->regs.fxsave,
sizeof(fpu->fpstate->regs.fxsave));
if (__copy_from_user(&fpregs->fxsave, buf_fx,
sizeof(fpregs->fxsave)))
if (fpregs->fxsave.mxcsr & ~mxcsr_feature_mask)
fpregs->fxsave.mxcsr &= mxcsr_feature_mask;
convert_to_fxsr(&fpregs->fxsave, &env);
success = !fxrstor_safe(&fpregs->fxsave);
fxsave(&x86_task_fpu(tsk)->fpstate->regs.fxsave);
fxsave(&init_fpstate.regs.fxsave);
struct fxregs_state *fxsave;
fxsave = &vcpu->arch.guest_fpu.fpstate->regs.fxsave;
memcpy(fpu->fpr, fxsave->st_space, 128);
fpu->fcw = fxsave->cwd;
fpu->fsw = fxsave->swd;
fpu->ftwx = fxsave->twd;
fpu->last_opcode = fxsave->fop;
fpu->last_ip = fxsave->rip;
fpu->last_dp = fxsave->rdp;
memcpy(fpu->xmm, fxsave->xmm_space, sizeof(fxsave->xmm_space));
struct fxregs_state *fxsave;
fxsave = &vcpu->arch.guest_fpu.fpstate->regs.fxsave;
memcpy(fxsave->st_space, fpu->fpr, 128);
fxsave->cwd = fpu->fcw;
fxsave->swd = fpu->fsw;
fxsave->twd = fpu->ftwx;
fxsave->fop = fpu->last_opcode;
fxsave->rip = fpu->last_ip;
fxsave->rdp = fpu->last_dp;
memcpy(fxsave->xmm_space, fpu->xmm, sizeof(fxsave->xmm_space));
const struct _fpstate_64 *fxsave);
int um_fxsr_from_i387(struct _fpstate_64 *fxsave,
const struct user_fxsr_struct *fxsave);
const struct user_fxsr_struct *fxsave)
return _um_i387_from_fxsr(to, fxsave);
struct user_fxsr_struct *fxsave = (void *)target->thread.regs.regs.fp;
return _um_i387_from_fxsr(to, fxsave);
int um_fxsr_from_i387(struct user_fxsr_struct *fxsave,
int um_fxsr_from_i387(struct user_fxsr_struct *fxsave,
fxsave->cwd = (unsigned short)(from->cwd & 0xffff);
fxsave->swd = (unsigned short)(from->swd & 0xffff);
fxsave->twd = twd_i387_to_fxsr((unsigned short)(from->twd & 0xffff));
fxsave->fip = from->fip;
fxsave->fop = (unsigned short)((from->fcs & 0xffff0000ul) >> 16);
fxsave->fcs = (from->fcs & 0xffff);
fxsave->foo = from->foo;
fxsave->fos = from->fos;
memcpy((void *)fxsave->st_space + i * 16,
struct user_fxsr_struct *fxsave = (void *)target->thread.regs.regs.fp;
return um_fxsr_from_i387(fxsave, from);
twd_fxsr_to_i387(const struct user_fxsr_struct *fxsave)
unsigned long twd = (unsigned long) fxsave->twd;
st = (struct _fpxreg *) FPREG_ADDR(fxsave, i);
const struct user_fxsr_struct *fxsave)
membuf_store(&to, (unsigned long)fxsave->cwd | 0xffff0000ul);
membuf_store(&to, (unsigned long)fxsave->swd | 0xffff0000ul);
membuf_store(&to, twd_fxsr_to_i387(fxsave));
membuf_store(&to, fxsave->fip);
membuf_store(&to, fxsave->fcs | ((unsigned long)fxsave->fop << 16));
membuf_store(&to, fxsave->foo);
membuf_store(&to, fxsave->fos);
membuf_write(&to, (void *)fxsave->st_space + i * 16, 10);