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>
Showing
- meson.build 2 additions, 0 deletionsmeson.build
- target/i386/cpu.c 9 additions, 1 deletiontarget/i386/cpu.c
- target/i386/helper.h 1 addition, 1 deletiontarget/i386/helper.h
- target/i386/tcg/misc_helper.c 15 additions, 6 deletionstarget/i386/tcg/misc_helper.c
- target/i386/tcg/translate.c 19 additions, 5 deletionstarget/i386/tcg/translate.c
Loading
Please register or sign in to comment