On 12/22/21 22:47, Yang Zhong wrote:
+ /* Trigger #NM exception */
+ __tileloadd(tiledata);
+ GUEST_SYNC(10);
+
+ GUEST_DONE();
+}
+
+void guest_nm_handler(struct ex_regs *regs)
+{
+ /* Check if #NM is triggered by XFEATURE_MASK_XTILEDATA */
+ GUEST_SYNC(7);
+ GUEST_ASSERT(rdmsr(MSR_IA32_XFD_ERR) == XFEATURE_MASK_XTILEDATA);
+ GUEST_SYNC(8);
+ GUEST_ASSERT(rdmsr(MSR_IA32_XFD_ERR) == XFEATURE_MASK_XTILEDATA);
+ /* Clear xfd_err */
+ wrmsr(MSR_IA32_XFD_ERR, 0);
+ regs->rip += 3;
+ GUEST_SYNC(9);
+}
I don't understand why "regs->rip += 3" is needed though.
My idea was that, after GUEST_SYNC(9) and IRET, the guest would execute
__tileloadd again; this time without generating #NM, so that after
GUEST_SYNC(10) the host sees the loaded data in TMM0.
Thanks,
Paolo