Merge tag 'vfio-v4.8-rc1' of git://github.com/awilliam/linux-vfio
[cascardo/linux.git] / arch / x86 / entry / entry_32.S
index 10868aa..0b56666 100644 (file)
 ENTRY(ret_from_fork)
        pushl   %eax
        call    schedule_tail
-       GET_THREAD_INFO(%ebp)
        popl    %eax
-       pushl   $0x0202                         # Reset kernel eflags
-       popfl
 
        /* When we fork, we trace the syscall return in the child, too. */
        movl    %esp, %eax
@@ -221,10 +218,7 @@ END(ret_from_fork)
 ENTRY(ret_from_kernel_thread)
        pushl   %eax
        call    schedule_tail
-       GET_THREAD_INFO(%ebp)
        popl    %eax
-       pushl   $0x0202                         # Reset kernel eflags
-       popfl
        movl    PT_EBP(%esp), %eax
        call    *PT_EBX(%esp)
        movl    $0, PT_EAX(%esp)
@@ -251,7 +245,6 @@ ENDPROC(ret_from_kernel_thread)
 ret_from_exception:
        preempt_stop(CLBR_ANY)
 ret_from_intr:
-       GET_THREAD_INFO(%ebp)
 #ifdef CONFIG_VM86
        movl    PT_EFLAGS(%esp), %eax           # mix EFLAGS and CS
        movb    PT_CS(%esp), %al
@@ -1160,3 +1153,14 @@ ENTRY(async_page_fault)
        jmp     error_code
 END(async_page_fault)
 #endif
+
+ENTRY(rewind_stack_do_exit)
+       /* Prevent any naive code from trying to unwind to our caller. */
+       xorl    %ebp, %ebp
+
+       movl    PER_CPU_VAR(cpu_current_top_of_stack), %esi
+       leal    -TOP_OF_KERNEL_STACK_PADDING-PTREGS_SIZE(%esi), %esp
+
+       call    do_exit
+1:     jmp 1b
+END(rewind_stack_do_exit)