]> git.proxmox.com Git - mirror_qemu.git/blobdiff - target-i386/helper.c
x86_64 linux user emulation
[mirror_qemu.git] / target-i386 / helper.c
index 0a75e8c33583aae202991ce6d2ee8f4fe0ef8f6e..841824fc9ae2382289a66259bc835485a92692e7 100644 (file)
@@ -971,6 +971,14 @@ static void do_interrupt64(int intno, int is_int, int error_code,
 }
 #endif
 
+#if defined(CONFIG_USER_ONLY)
+void helper_syscall(int next_eip_addend)
+{
+    env->exception_index = EXCP_SYSCALL;
+    env->exception_next_eip = env->eip + next_eip_addend;
+    cpu_loop_exit();
+}
+#else
 void helper_syscall(int next_eip_addend)
 {
     int selector;
@@ -1024,6 +1032,7 @@ void helper_syscall(int next_eip_addend)
         env->eip = (uint32_t)env->star;
     }
 }
+#endif
 
 void helper_sysret(int dflag)
 {
@@ -1143,18 +1152,23 @@ void do_interrupt_user(int intno, int is_int, int error_code,
 {
     SegmentCache *dt;
     target_ulong ptr;
-    int dpl, cpl;
+    int dpl, cpl, shift;
     uint32_t e2;
 
     dt = &env->idt;
-    ptr = dt->base + (intno * 8);
+    if (env->hflags & HF_LMA_MASK) {
+        shift = 4;
+    } else {
+        shift = 3;
+    }
+    ptr = dt->base + (intno << shift);
     e2 = ldl_kernel(ptr + 4);
 
     dpl = (e2 >> DESC_DPL_SHIFT) & 3;
     cpl = env->hflags & HF_CPL_MASK;
     /* check privledge if software int */
     if (is_int && dpl < cpl)
-        raise_exception_err(EXCP0D_GPF, intno * 8 + 2);
+        raise_exception_err(EXCP0D_GPF, (intno << shift) + 2);
 
     /* Since we emulate only user space, we cannot do more than
        exiting the emulation with the suitable exception and error