diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-02-09 14:14:28 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-03-24 14:01:08 +0100 |
commit | 0f70ed4759a29ca932af1e9525729f4f455642f8 (patch) | |
tree | c5a8fb95b4971c83ba998045d43b73e926b084ef /target-i386/misc_helper.c | |
parent | cf7cc9291bf7f2f6470815db876ed28eb474ea52 (diff) | |
download | qemu-0f70ed4759a29ca932af1e9525729f4f455642f8.tar.gz qemu-0f70ed4759a29ca932af1e9525729f4f455642f8.tar.bz2 qemu-0f70ed4759a29ca932af1e9525729f4f455642f8.zip |
target-i386: implement PKE for TCG
Tested with kvm-unit-tests.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target-i386/misc_helper.c')
-rw-r--r-- | target-i386/misc_helper.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/target-i386/misc_helper.c b/target-i386/misc_helper.c index 5fbab8fd0c..e31ec976a4 100644 --- a/target-i386/misc_helper.c +++ b/target-i386/misc_helper.c @@ -609,3 +609,30 @@ void helper_debug(CPUX86State *env) cs->exception_index = EXCP_DEBUG; cpu_loop_exit(cs); } + +uint64_t helper_rdpkru(CPUX86State *env, uint32_t ecx) +{ + if ((env->cr[4] & CR4_PKE_MASK) == 0) { + raise_exception_err_ra(env, EXCP06_ILLOP, 0, GETPC()); + } + if (ecx != 0) { + raise_exception_err_ra(env, EXCP0D_GPF, 0, GETPC()); + } + + return env->pkru; +} + +void helper_wrpkru(CPUX86State *env, uint32_t ecx, uint64_t val) +{ + CPUState *cs = CPU(x86_env_get_cpu(env)); + + if ((env->cr[4] & CR4_PKE_MASK) == 0) { + raise_exception_err_ra(env, EXCP06_ILLOP, 0, GETPC()); + } + if (ecx != 0 || (val & 0xFFFFFFFF00000000ull)) { + raise_exception_err_ra(env, EXCP0D_GPF, 0, GETPC()); + } + + env->pkru = val; + tlb_flush(cs, 1); +} |