aboutsummaryrefslogtreecommitdiff
path: root/target/i386/helper.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2023-06-21 00:47:31 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2023-06-26 10:23:56 +0200
commit6750485bf42a9917a29487aec899687669104e07 (patch)
treef3041f5dcd012248e81091fb384e28767fe12195 /target/i386/helper.h
parent53b9b4cc9fb956279c6494bfa7d7ea61f07bb214 (diff)
target/i386: implement RDPID in TCG
RDPID corresponds to a RDMSR(TSC_AUX); however, it is unprivileged so for user-mode emulation we must provide the value that the kernel places in the MSR. For Linux, it is a combination of the current CPU and the current NUMA node, both of which can be retrieved with getcpu(2). Also try sched_getcpu(), which might be there on the BSDs. If there is no portable way to retrieve the current CPU id from userspace, return 0. RDTSCP is reimplemented as RDTSC + RDPID ECX; the differences in terms of serializability are not relevant to QEMU. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/helper.h')
-rw-r--r--target/i386/helper.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/target/i386/helper.h b/target/i386/helper.h
index 48609c210b..c93c1d6c8f 100644
--- a/target/i386/helper.h
+++ b/target/i386/helper.h
@@ -69,8 +69,8 @@ DEF_HELPER_2(into, void, env, int)
DEF_HELPER_FLAGS_1(single_step, TCG_CALL_NO_WG, noreturn, env)
DEF_HELPER_1(rechecking_single_step, void, env)
DEF_HELPER_1(cpuid, void, env)
+DEF_HELPER_FLAGS_1(rdpid, TCG_CALL_NO_WG, tl, env)
DEF_HELPER_1(rdtsc, void, env)
-DEF_HELPER_1(rdtscp, void, env)
DEF_HELPER_FLAGS_1(rdpmc, TCG_CALL_NO_WG, noreturn, env)
#ifndef CONFIG_USER_ONLY