2013-01-24 04:03:16 +04:00
|
|
|
DEF_HELPER_FLAGS_4(cc_compute_all, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl, int)
|
|
|
|
DEF_HELPER_FLAGS_4(cc_compute_c, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl, int)
|
2008-02-01 13:50:11 +03:00
|
|
|
|
2012-04-29 16:45:34 +04:00
|
|
|
DEF_HELPER_3(write_eflags, void, env, tl, i32)
|
|
|
|
DEF_HELPER_1(read_eflags, tl, env)
|
2012-04-29 18:11:56 +04:00
|
|
|
DEF_HELPER_2(divb_AL, void, env, tl)
|
|
|
|
DEF_HELPER_2(idivb_AL, void, env, tl)
|
|
|
|
DEF_HELPER_2(divw_AX, void, env, tl)
|
|
|
|
DEF_HELPER_2(idivw_AX, void, env, tl)
|
|
|
|
DEF_HELPER_2(divl_EAX, void, env, tl)
|
|
|
|
DEF_HELPER_2(idivl_EAX, void, env, tl)
|
2008-05-13 02:05:13 +04:00
|
|
|
#ifdef TARGET_X86_64
|
2012-04-29 18:11:56 +04:00
|
|
|
DEF_HELPER_2(divq_EAX, void, env, tl)
|
|
|
|
DEF_HELPER_2(idivq_EAX, void, env, tl)
|
2008-05-13 02:05:13 +04:00
|
|
|
#endif
|
2015-11-18 14:55:47 +03:00
|
|
|
DEF_HELPER_FLAGS_2(cr4_testbit, TCG_CALL_NO_WG, void, env, i32)
|
2008-05-13 02:05:13 +04:00
|
|
|
|
2015-07-06 21:37:00 +03:00
|
|
|
DEF_HELPER_FLAGS_2(bndck, TCG_CALL_NO_WG, void, env, i32)
|
2015-07-07 16:08:41 +03:00
|
|
|
DEF_HELPER_FLAGS_3(bndldx32, TCG_CALL_NO_WG, i64, env, tl, tl)
|
|
|
|
DEF_HELPER_FLAGS_3(bndldx64, TCG_CALL_NO_WG, i64, env, tl, tl)
|
|
|
|
DEF_HELPER_FLAGS_5(bndstx32, TCG_CALL_NO_WG, void, env, tl, tl, i64, i64)
|
|
|
|
DEF_HELPER_FLAGS_5(bndstx64, TCG_CALL_NO_WG, void, env, tl, tl, i64, i64)
|
2015-07-07 16:38:58 +03:00
|
|
|
DEF_HELPER_1(bnd_jmp, void, env)
|
2015-07-06 21:37:00 +03:00
|
|
|
|
2012-04-29 18:11:56 +04:00
|
|
|
DEF_HELPER_2(aam, void, env, int)
|
|
|
|
DEF_HELPER_2(aad, void, env, int)
|
|
|
|
DEF_HELPER_1(aaa, void, env)
|
|
|
|
DEF_HELPER_1(aas, void, env)
|
|
|
|
DEF_HELPER_1(daa, void, env)
|
|
|
|
DEF_HELPER_1(das, void, env)
|
2008-05-13 02:05:13 +04:00
|
|
|
|
2012-04-29 23:47:06 +04:00
|
|
|
DEF_HELPER_2(lsl, tl, env, tl)
|
|
|
|
DEF_HELPER_2(lar, tl, env, tl)
|
|
|
|
DEF_HELPER_2(verr, void, env, tl)
|
|
|
|
DEF_HELPER_2(verw, void, env, tl)
|
|
|
|
DEF_HELPER_2(lldt, void, env, int)
|
|
|
|
DEF_HELPER_2(ltr, void, env, int)
|
|
|
|
DEF_HELPER_3(load_seg, void, env, int, int)
|
2015-07-10 12:57:36 +03:00
|
|
|
DEF_HELPER_4(ljmp_protected, void, env, int, tl, tl)
|
2012-04-29 23:47:06 +04:00
|
|
|
DEF_HELPER_5(lcall_real, void, env, int, tl, int, int)
|
2015-07-10 12:57:36 +03:00
|
|
|
DEF_HELPER_5(lcall_protected, void, env, int, tl, int, tl)
|
2012-04-29 23:47:06 +04:00
|
|
|
DEF_HELPER_2(iret_real, void, env, int)
|
|
|
|
DEF_HELPER_3(iret_protected, void, env, int, int)
|
|
|
|
DEF_HELPER_3(lret_protected, void, env, int, int)
|
2012-04-29 22:42:47 +04:00
|
|
|
DEF_HELPER_2(read_crN, tl, env, int)
|
|
|
|
DEF_HELPER_3(write_crN, void, env, int, tl)
|
|
|
|
DEF_HELPER_2(lmsw, void, env, tl)
|
2012-04-29 16:45:34 +04:00
|
|
|
DEF_HELPER_1(clts, void, env)
|
2015-09-15 21:45:13 +03:00
|
|
|
DEF_HELPER_FLAGS_3(set_dr, TCG_CALL_NO_WG, void, env, int, tl)
|
|
|
|
DEF_HELPER_FLAGS_2(get_dr, TCG_CALL_NO_WG, tl, env, int)
|
2012-04-29 22:42:47 +04:00
|
|
|
DEF_HELPER_2(invlpg, void, env, tl)
|
2008-05-13 02:05:13 +04:00
|
|
|
|
2012-04-29 23:47:06 +04:00
|
|
|
DEF_HELPER_1(sysenter, void, env)
|
|
|
|
DEF_HELPER_2(sysexit, void, env, int)
|
2008-05-13 02:05:13 +04:00
|
|
|
#ifdef TARGET_X86_64
|
2012-04-29 23:47:06 +04:00
|
|
|
DEF_HELPER_2(syscall, void, env, int)
|
|
|
|
DEF_HELPER_2(sysret, void, env, int)
|
2008-05-13 02:05:13 +04:00
|
|
|
#endif
|
2012-04-29 22:42:47 +04:00
|
|
|
DEF_HELPER_2(hlt, void, env, int)
|
|
|
|
DEF_HELPER_2(monitor, void, env, tl)
|
|
|
|
DEF_HELPER_2(mwait, void, env, int)
|
target-i386: yield to another VCPU on PAUSE
After commit b1bbfe7 (aio / timers: On timer modification, qemu_notify
or aio_notify, 2013-08-21) FreeBSD guests report a huge slowdown.
The problem shows up as soon as FreeBSD turns out its periodic (~1 ms)
tick, but the timers are only the trigger for a pre-existing problem.
Before the offending patch, setting a timer did a timer_settime system call.
After, setting the timer exits the event loop (which uses poll) and
reenters it with a new deadline. This does not cause any slowdown; the
difference is between one system call (timer_settime and a signal
delivery (SIGALRM) before the patch, and two system calls afterwards
(write to a pipe or eventfd + calling poll again when re-entering the
event loop).
Unfortunately, the exit/enter causes the main loop to grab the iothread
lock, which in turns kicks the VCPU thread out of execution. This
causes TCG to execute the next VCPU in its round-robin scheduling of
VCPUS. When the second VCPU is mostly unused, FreeBSD runs a "pause"
instruction in its idle loop which only burns cycles without any
progress. As soon as the timer tick expires, the first VCPU runs
the interrupt handler but very soon it sets it again---and QEMU
then goes back doing nothing in the second VCPU.
The fix is to make the pause instruction do "cpu_loop_exit".
Cc: Richard Henderson <rth@twiddle.net>
Reported-by: Luigi Rizzo <rizzo@iet.unipi.it>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-id: 1384948442-24217-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-11-20 15:54:02 +04:00
|
|
|
DEF_HELPER_2(pause, void, env, int)
|
2012-04-29 22:42:47 +04:00
|
|
|
DEF_HELPER_1(debug, void, env)
|
2012-04-29 16:45:34 +04:00
|
|
|
DEF_HELPER_1(reset_rf, void, env)
|
2012-04-28 23:35:10 +04:00
|
|
|
DEF_HELPER_3(raise_interrupt, void, env, int, int)
|
|
|
|
DEF_HELPER_2(raise_exception, void, env, int)
|
2012-04-29 16:45:34 +04:00
|
|
|
DEF_HELPER_1(cli, void, env)
|
|
|
|
DEF_HELPER_1(sti, void, env)
|
2012-09-27 00:18:43 +04:00
|
|
|
DEF_HELPER_1(clac, void, env)
|
|
|
|
DEF_HELPER_1(stac, void, env)
|
2012-04-30 00:35:48 +04:00
|
|
|
DEF_HELPER_3(boundw, void, env, tl, int)
|
|
|
|
DEF_HELPER_3(boundl, void, env, tl, int)
|
2012-04-29 21:54:21 +04:00
|
|
|
DEF_HELPER_1(rsm, void, env)
|
2012-04-29 22:42:47 +04:00
|
|
|
DEF_HELPER_2(into, void, env, int)
|
2016-06-27 22:01:51 +03:00
|
|
|
DEF_HELPER_2(cmpxchg8b_unlocked, void, env, tl)
|
2012-04-30 00:35:48 +04:00
|
|
|
DEF_HELPER_2(cmpxchg8b, void, env, tl)
|
2008-05-22 13:52:38 +04:00
|
|
|
#ifdef TARGET_X86_64
|
2016-06-27 22:01:51 +03:00
|
|
|
DEF_HELPER_2(cmpxchg16b_unlocked, void, env, tl)
|
2012-04-30 00:35:48 +04:00
|
|
|
DEF_HELPER_2(cmpxchg16b, void, env, tl)
|
2008-05-22 13:52:38 +04:00
|
|
|
#endif
|
2012-04-29 22:42:47 +04:00
|
|
|
DEF_HELPER_1(single_step, void, env)
|
2016-12-07 02:06:30 +03:00
|
|
|
DEF_HELPER_1(rechecking_single_step, void, env)
|
2012-04-29 22:42:47 +04:00
|
|
|
DEF_HELPER_1(cpuid, void, env)
|
|
|
|
DEF_HELPER_1(rdtsc, void, env)
|
|
|
|
DEF_HELPER_1(rdtscp, void, env)
|
|
|
|
DEF_HELPER_1(rdpmc, void, env)
|
|
|
|
DEF_HELPER_1(rdmsr, void, env)
|
|
|
|
DEF_HELPER_1(wrmsr, void, env)
|
2008-05-13 02:05:13 +04:00
|
|
|
|
2012-04-29 22:42:47 +04:00
|
|
|
DEF_HELPER_2(check_iob, void, env, i32)
|
|
|
|
DEF_HELPER_2(check_iow, void, env, i32)
|
|
|
|
DEF_HELPER_2(check_iol, void, env, i32)
|
2015-04-08 15:45:53 +03:00
|
|
|
DEF_HELPER_3(outb, void, env, i32, i32)
|
|
|
|
DEF_HELPER_2(inb, tl, env, i32)
|
|
|
|
DEF_HELPER_3(outw, void, env, i32, i32)
|
|
|
|
DEF_HELPER_2(inw, tl, env, i32)
|
|
|
|
DEF_HELPER_3(outl, void, env, i32, i32)
|
|
|
|
DEF_HELPER_2(inl, tl, env, i32)
|
2015-10-19 20:14:35 +03:00
|
|
|
DEF_HELPER_FLAGS_4(bpt_io, TCG_CALL_NO_WG, void, env, i32, i32, tl)
|
2008-05-15 20:46:30 +04:00
|
|
|
|
2012-04-29 19:51:49 +04:00
|
|
|
DEF_HELPER_3(svm_check_intercept_param, void, env, i32, i64)
|
|
|
|
DEF_HELPER_4(svm_check_io, void, env, i32, i32, i32)
|
|
|
|
DEF_HELPER_3(vmrun, void, env, int, int)
|
|
|
|
DEF_HELPER_1(vmmcall, void, env)
|
|
|
|
DEF_HELPER_2(vmload, void, env, int)
|
|
|
|
DEF_HELPER_2(vmsave, void, env, int)
|
|
|
|
DEF_HELPER_1(stgi, void, env)
|
|
|
|
DEF_HELPER_1(clgi, void, env)
|
|
|
|
DEF_HELPER_1(skinit, void, env)
|
|
|
|
DEF_HELPER_2(invlpga, void, env, int)
|
2008-05-12 23:10:44 +04:00
|
|
|
|
|
|
|
/* x86 FPU */
|
|
|
|
|
2012-04-29 01:28:09 +04:00
|
|
|
DEF_HELPER_2(flds_FT0, void, env, i32)
|
|
|
|
DEF_HELPER_2(fldl_FT0, void, env, i64)
|
|
|
|
DEF_HELPER_2(fildl_FT0, void, env, s32)
|
|
|
|
DEF_HELPER_2(flds_ST0, void, env, i32)
|
|
|
|
DEF_HELPER_2(fldl_ST0, void, env, i64)
|
|
|
|
DEF_HELPER_2(fildl_ST0, void, env, s32)
|
|
|
|
DEF_HELPER_2(fildll_ST0, void, env, s64)
|
|
|
|
DEF_HELPER_1(fsts_ST0, i32, env)
|
|
|
|
DEF_HELPER_1(fstl_ST0, i64, env)
|
|
|
|
DEF_HELPER_1(fist_ST0, s32, env)
|
|
|
|
DEF_HELPER_1(fistl_ST0, s32, env)
|
|
|
|
DEF_HELPER_1(fistll_ST0, s64, env)
|
|
|
|
DEF_HELPER_1(fistt_ST0, s32, env)
|
|
|
|
DEF_HELPER_1(fisttl_ST0, s32, env)
|
|
|
|
DEF_HELPER_1(fisttll_ST0, s64, env)
|
|
|
|
DEF_HELPER_2(fldt_ST0, void, env, tl)
|
|
|
|
DEF_HELPER_2(fstt_ST0, void, env, tl)
|
|
|
|
DEF_HELPER_1(fpush, void, env)
|
|
|
|
DEF_HELPER_1(fpop, void, env)
|
|
|
|
DEF_HELPER_1(fdecstp, void, env)
|
|
|
|
DEF_HELPER_1(fincstp, void, env)
|
|
|
|
DEF_HELPER_2(ffree_STN, void, env, int)
|
|
|
|
DEF_HELPER_1(fmov_ST0_FT0, void, env)
|
|
|
|
DEF_HELPER_2(fmov_FT0_STN, void, env, int)
|
|
|
|
DEF_HELPER_2(fmov_ST0_STN, void, env, int)
|
|
|
|
DEF_HELPER_2(fmov_STN_ST0, void, env, int)
|
|
|
|
DEF_HELPER_2(fxchg_ST0_STN, void, env, int)
|
|
|
|
DEF_HELPER_1(fcom_ST0_FT0, void, env)
|
|
|
|
DEF_HELPER_1(fucom_ST0_FT0, void, env)
|
|
|
|
DEF_HELPER_1(fcomi_ST0_FT0, void, env)
|
|
|
|
DEF_HELPER_1(fucomi_ST0_FT0, void, env)
|
|
|
|
DEF_HELPER_1(fadd_ST0_FT0, void, env)
|
|
|
|
DEF_HELPER_1(fmul_ST0_FT0, void, env)
|
|
|
|
DEF_HELPER_1(fsub_ST0_FT0, void, env)
|
|
|
|
DEF_HELPER_1(fsubr_ST0_FT0, void, env)
|
|
|
|
DEF_HELPER_1(fdiv_ST0_FT0, void, env)
|
|
|
|
DEF_HELPER_1(fdivr_ST0_FT0, void, env)
|
|
|
|
DEF_HELPER_2(fadd_STN_ST0, void, env, int)
|
|
|
|
DEF_HELPER_2(fmul_STN_ST0, void, env, int)
|
|
|
|
DEF_HELPER_2(fsub_STN_ST0, void, env, int)
|
|
|
|
DEF_HELPER_2(fsubr_STN_ST0, void, env, int)
|
|
|
|
DEF_HELPER_2(fdiv_STN_ST0, void, env, int)
|
|
|
|
DEF_HELPER_2(fdivr_STN_ST0, void, env, int)
|
|
|
|
DEF_HELPER_1(fchs_ST0, void, env)
|
|
|
|
DEF_HELPER_1(fabs_ST0, void, env)
|
|
|
|
DEF_HELPER_1(fxam_ST0, void, env)
|
|
|
|
DEF_HELPER_1(fld1_ST0, void, env)
|
|
|
|
DEF_HELPER_1(fldl2t_ST0, void, env)
|
|
|
|
DEF_HELPER_1(fldl2e_ST0, void, env)
|
|
|
|
DEF_HELPER_1(fldpi_ST0, void, env)
|
|
|
|
DEF_HELPER_1(fldlg2_ST0, void, env)
|
|
|
|
DEF_HELPER_1(fldln2_ST0, void, env)
|
|
|
|
DEF_HELPER_1(fldz_ST0, void, env)
|
|
|
|
DEF_HELPER_1(fldz_FT0, void, env)
|
|
|
|
DEF_HELPER_1(fnstsw, i32, env)
|
|
|
|
DEF_HELPER_1(fnstcw, i32, env)
|
|
|
|
DEF_HELPER_2(fldcw, void, env, i32)
|
|
|
|
DEF_HELPER_1(fclex, void, env)
|
|
|
|
DEF_HELPER_1(fwait, void, env)
|
|
|
|
DEF_HELPER_1(fninit, void, env)
|
|
|
|
DEF_HELPER_2(fbld_ST0, void, env, tl)
|
|
|
|
DEF_HELPER_2(fbst_ST0, void, env, tl)
|
|
|
|
DEF_HELPER_1(f2xm1, void, env)
|
|
|
|
DEF_HELPER_1(fyl2x, void, env)
|
|
|
|
DEF_HELPER_1(fptan, void, env)
|
|
|
|
DEF_HELPER_1(fpatan, void, env)
|
|
|
|
DEF_HELPER_1(fxtract, void, env)
|
|
|
|
DEF_HELPER_1(fprem1, void, env)
|
|
|
|
DEF_HELPER_1(fprem, void, env)
|
|
|
|
DEF_HELPER_1(fyl2xp1, void, env)
|
|
|
|
DEF_HELPER_1(fsqrt, void, env)
|
|
|
|
DEF_HELPER_1(fsincos, void, env)
|
|
|
|
DEF_HELPER_1(frndint, void, env)
|
|
|
|
DEF_HELPER_1(fscale, void, env)
|
|
|
|
DEF_HELPER_1(fsin, void, env)
|
|
|
|
DEF_HELPER_1(fcos, void, env)
|
|
|
|
DEF_HELPER_3(fstenv, void, env, tl, int)
|
|
|
|
DEF_HELPER_3(fldenv, void, env, tl, int)
|
|
|
|
DEF_HELPER_3(fsave, void, env, tl, int)
|
|
|
|
DEF_HELPER_3(frstor, void, env, tl, int)
|
2015-07-01 15:01:50 +03:00
|
|
|
DEF_HELPER_FLAGS_2(fxsave, TCG_CALL_NO_WG, void, env, tl)
|
|
|
|
DEF_HELPER_FLAGS_2(fxrstor, TCG_CALL_NO_WG, void, env, tl)
|
2015-07-02 16:53:40 +03:00
|
|
|
DEF_HELPER_FLAGS_3(xsave, TCG_CALL_NO_WG, void, env, tl, i64)
|
2015-07-02 17:21:23 +03:00
|
|
|
DEF_HELPER_FLAGS_3(xsaveopt, TCG_CALL_NO_WG, void, env, tl, i64)
|
2015-07-02 16:53:40 +03:00
|
|
|
DEF_HELPER_FLAGS_3(xrstor, TCG_CALL_NO_WG, void, env, tl, i64)
|
|
|
|
DEF_HELPER_FLAGS_2(xgetbv, TCG_CALL_NO_WG, i64, env, i32)
|
|
|
|
DEF_HELPER_FLAGS_3(xsetbv, TCG_CALL_NO_WG, void, env, i32, i64)
|
2016-02-09 16:14:28 +03:00
|
|
|
DEF_HELPER_FLAGS_2(rdpkru, TCG_CALL_NO_WG, i64, env, i32)
|
|
|
|
DEF_HELPER_FLAGS_3(wrpkru, TCG_CALL_NO_WG, void, env, i32, i64)
|
2013-01-24 06:09:43 +04:00
|
|
|
|
|
|
|
DEF_HELPER_FLAGS_2(pdep, TCG_CALL_NO_RWG_SE, tl, tl, tl)
|
|
|
|
DEF_HELPER_FLAGS_2(pext, TCG_CALL_NO_RWG_SE, tl, tl, tl)
|
2008-05-12 23:10:44 +04:00
|
|
|
|
|
|
|
/* MMX/SSE */
|
|
|
|
|
2012-04-29 01:28:09 +04:00
|
|
|
DEF_HELPER_2(ldmxcsr, void, env, i32)
|
|
|
|
DEF_HELPER_1(enter_mmx, void, env)
|
|
|
|
DEF_HELPER_1(emms, void, env)
|
|
|
|
DEF_HELPER_3(movq, void, env, ptr, ptr)
|
2008-05-12 20:47:36 +04:00
|
|
|
|
|
|
|
#define SHIFT 0
|
|
|
|
#include "ops_sse_header.h"
|
|
|
|
#define SHIFT 1
|
|
|
|
#include "ops_sse_header.h"
|
|
|
|
|
2012-04-29 18:11:56 +04:00
|
|
|
DEF_HELPER_3(rclb, tl, env, tl, tl)
|
|
|
|
DEF_HELPER_3(rclw, tl, env, tl, tl)
|
|
|
|
DEF_HELPER_3(rcll, tl, env, tl, tl)
|
|
|
|
DEF_HELPER_3(rcrb, tl, env, tl, tl)
|
|
|
|
DEF_HELPER_3(rcrw, tl, env, tl, tl)
|
|
|
|
DEF_HELPER_3(rcrl, tl, env, tl, tl)
|
2008-05-17 16:44:31 +04:00
|
|
|
#ifdef TARGET_X86_64
|
2012-04-29 18:11:56 +04:00
|
|
|
DEF_HELPER_3(rclq, tl, env, tl, tl)
|
|
|
|
DEF_HELPER_3(rcrq, tl, env, tl, tl)
|
2008-05-17 16:44:31 +04:00
|
|
|
#endif
|
2019-03-15 06:01:42 +03:00
|
|
|
|
|
|
|
DEF_HELPER_1(rdrand, tl, env)
|