ENTRY(debug)
        /*
-        * #DB can happen at the first instruction of
-        * entry_SYSENTER_32 or in Xen's SYSENTER prologue.  If this
-        * happens, then we will be running on a very small stack.  We
-        * need to detect this condition and switch to the thread
-        * stack before calling any C code at all.
-        *
-        * If you edit this code, keep in mind that NMIs can happen in here.
+        * Entry from sysenter is now handled in common_exception
         */
        ASM_CLAC
        pushl   $-1                             # mark this as an int
-
-       SAVE_ALL
-       ENCODE_FRAME_POINTER
-       xorl    %edx, %edx                      # error code 0
-       movl    %esp, %eax                      # pt_regs pointer
-
-       /* Are we currently on the SYSENTER stack? */
-       movl    PER_CPU_VAR(cpu_entry_area), %ecx
-       addl    $CPU_ENTRY_AREA_entry_stack + SIZEOF_entry_stack, %ecx
-       subl    %eax, %ecx      /* ecx = (end of entry_stack) - esp */
-       cmpl    $SIZEOF_entry_stack, %ecx
-       jb      .Ldebug_from_sysenter_stack
-
-       TRACE_IRQS_OFF
-       call    do_debug
-       jmp     ret_from_exception
-
-.Ldebug_from_sysenter_stack:
-       /* We're on the SYSENTER stack.  Switch off. */
-       movl    %esp, %ebx
-       movl    PER_CPU_VAR(cpu_current_top_of_stack), %esp
-       TRACE_IRQS_OFF
-       call    do_debug
-       movl    %ebx, %esp
-       jmp     ret_from_exception
+       pushl   $do_debug
+       jmp     common_exception
 END(debug)
 
 /*