On 09/02/2016 19:13, Richard Henderson wrote: >> >> +{ >> + if ((env->cr[4] & CR4_PKE_MASK) == 0) { >> + raise_exception_err_ra(env, EXCP06_ILLOP, 0, GETPC()); >> + return; >> + } > > The document I have says #GP for this case, not #UD.
The text says #GP, the "Protected Mode Exceptions" section says #UD. :( I think #UD is more likely, as it's similar to XSAVE. > If you make the change to return a 64-bit value, this would look like > > gen_helper_rdpkru(cpu_tmp1_i64, cpu_env); > tcg_gen_extr_i64_tl(cpu_regs[REG_EAX], cpu_regs[REG_EDX], cpu_tmp1_i64); Yup, I can steal all that's needed from xgetbv and xsetbv. Paolo