aboutsummaryrefslogtreecommitdiff
path: root/target-i386/helper.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-07-10 19:53:04 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-07-10 19:53:04 +0000
commit3d7374c5dab5670891e34d6f5752d6c3e23259dc (patch)
tree9eadbbcd05302aebe1a5522fee441608b2364faa /target-i386/helper.c
parent4f2092904d80257dfc9be7569cdf58ffbe0182a8 (diff)
monitor/mwait support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2044 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-i386/helper.c')
-rw-r--r--target-i386/helper.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/target-i386/helper.c b/target-i386/helper.c
index d7b41ea0b4..70e9fae3b0 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -3408,6 +3408,34 @@ void helper_bswapq_T0(void)
}
#endif
+void helper_hlt(void)
+{
+ env->hflags &= ~HF_INHIBIT_IRQ_MASK; /* needed if sti is just before */
+ env->hflags |= HF_HALTED_MASK;
+ env->exception_index = EXCP_HLT;
+ cpu_loop_exit();
+}
+
+void helper_monitor(void)
+{
+ if (ECX != 0)
+ raise_exception(EXCP0D_GPF);
+ /* XXX: store address ? */
+}
+
+void helper_mwait(void)
+{
+ if (ECX != 0)
+ raise_exception(EXCP0D_GPF);
+ /* XXX: not complete but not completely erroneous */
+ if (env->cpu_index != 0 || env->next_cpu != NULL) {
+ /* more than one CPU: do not sleep because another CPU may
+ wake this one */
+ } else {
+ helper_hlt();
+ }
+}
+
float approx_rsqrt(float a)
{
return 1.0 / sqrt(a);