]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/x86/xen/xen-asm_64.S
x86/xen/64: Fix the reported SS and CS in SYSCALL
[linux.git] / arch / x86 / xen / xen-asm_64.S
index c3df43141e7064477b1d2da432e7f8d0d81ea3f2..c5fee2680abc87989b2b18f7752eb2b5e949c04c 100644 (file)
@@ -82,34 +82,47 @@ RELOC(xen_sysret64, 1b+1)
  *     rip
  *     r11
  * rsp->rcx
- *
- * In all the entrypoints, we undo all that to make it look like a
- * CPU-generated syscall/sysenter and jump to the normal entrypoint.
  */
 
-.macro undo_xen_syscall
-       mov 0*8(%rsp), %rcx
-       mov 1*8(%rsp), %r11
-       mov 5*8(%rsp), %rsp
-.endm
-
 /* Normal 64-bit system call target */
 ENTRY(xen_syscall_target)
-       undo_xen_syscall
-       jmp entry_SYSCALL_64_after_swapgs
+       popq %rcx
+       popq %r11
+
+       /*
+        * Neither Xen nor the kernel really knows what the old SS and
+        * CS were.  The kernel expects __USER_DS and __USER_CS, so
+        * report those values even though Xen will guess its own values.
+        */
+       movq $__USER_DS, 4*8(%rsp)
+       movq $__USER_CS, 1*8(%rsp)
+
+       jmp entry_SYSCALL_64_after_hwframe
 ENDPROC(xen_syscall_target)
 
 #ifdef CONFIG_IA32_EMULATION
 
 /* 32-bit compat syscall target */
 ENTRY(xen_syscall32_target)
-       undo_xen_syscall
-       jmp entry_SYSCALL_compat
+       popq %rcx
+       popq %r11
+
+       /*
+        * Neither Xen nor the kernel really knows what the old SS and
+        * CS were.  The kernel expects __USER32_DS and __USER32_CS, so
+        * report those values even though Xen will guess its own values.
+        */
+       movq $__USER32_DS, 4*8(%rsp)
+       movq $__USER32_CS, 1*8(%rsp)
+
+       jmp entry_SYSCALL_compat_after_hwframe
 ENDPROC(xen_syscall32_target)
 
 /* 32-bit compat sysenter target */
 ENTRY(xen_sysenter_target)
-       undo_xen_syscall
+       mov 0*8(%rsp), %rcx
+       mov 1*8(%rsp), %r11
+       mov 5*8(%rsp), %rsp
        jmp entry_SYSENTER_compat
 ENDPROC(xen_sysenter_target)