Fixes register reading and writing for XMM8-15 on x86-64 (#1090)

Backports commit ae6e3c193d569180c6ada3ac2b01c11aef34e714 from unicorn
This commit is contained in:
Ryan Houdek 2019-08-08 20:01:15 -04:00 committed by Lioncash
parent 3b3e4fc4ca
commit deeeb1d0b9
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -769,6 +769,21 @@ int x86_reg_read(struct uc_struct *uc, unsigned int *regs, void **vals, int coun
case UC_X86_REG_MXCSR:
*(uint32_t *)value = X86_CPU(uc, mycpu)->env.mxcsr;
break;
case UC_X86_REG_XMM8:
case UC_X86_REG_XMM9:
case UC_X86_REG_XMM10:
case UC_X86_REG_XMM11:
case UC_X86_REG_XMM12:
case UC_X86_REG_XMM13:
case UC_X86_REG_XMM14:
case UC_X86_REG_XMM15:
{
float64 *dst = (float64*)value;
XMMReg *reg = &X86_CPU(uc, mycpu)->env.xmm_regs[regid - UC_X86_REG_XMM0];
dst[0] = reg->_d[0];
dst[1] = reg->_d[1];
break;
}
}
break;
#endif
@ -1045,6 +1060,21 @@ int x86_reg_write(struct uc_struct *uc, unsigned int *regs, void *const *vals, i
case UC_X86_REG_MXCSR:
cpu_set_mxcsr(&X86_CPU(uc, mycpu)->env, *(uint32_t *)value);
break;
case UC_X86_REG_XMM8:
case UC_X86_REG_XMM9:
case UC_X86_REG_XMM10:
case UC_X86_REG_XMM11:
case UC_X86_REG_XMM12:
case UC_X86_REG_XMM13:
case UC_X86_REG_XMM14:
case UC_X86_REG_XMM15:
{
float64 *src = (float64*)value;
XMMReg *reg = &X86_CPU(uc, mycpu)->env.xmm_regs[regid - UC_X86_REG_XMM0];
reg->_d[0] = src[0];
reg->_d[1] = src[1];
break;
}
}
break;