Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee13...
[pandora-kernel.git] / arch / i386 / kernel / entry.S
index 3872fca..5a63d6f 100644 (file)
@@ -183,18 +183,21 @@ VM_MASK           = 0x00020000
 
 #define RING0_INT_FRAME \
        CFI_STARTPROC simple;\
+       CFI_SIGNAL_FRAME;\
        CFI_DEF_CFA esp, 3*4;\
        /*CFI_OFFSET cs, -2*4;*/\
        CFI_OFFSET eip, -3*4
 
 #define RING0_EC_FRAME \
        CFI_STARTPROC simple;\
+       CFI_SIGNAL_FRAME;\
        CFI_DEF_CFA esp, 4*4;\
        /*CFI_OFFSET cs, -2*4;*/\
        CFI_OFFSET eip, -3*4
 
 #define RING0_PTREGS_FRAME \
        CFI_STARTPROC simple;\
+       CFI_SIGNAL_FRAME;\
        CFI_DEF_CFA esp, OLDESP-EBX;\
        /*CFI_OFFSET cs, CS-OLDESP;*/\
        CFI_OFFSET eip, EIP-OLDESP;\
@@ -240,8 +243,9 @@ ret_from_intr:
 check_userspace:
        movl EFLAGS(%esp), %eax         # mix EFLAGS and CS
        movb CS(%esp), %al
-       testl $(VM_MASK | 3), %eax
-       jz resume_kernel
+       andl $(VM_MASK | SEGMENT_RPL_MASK), %eax
+       cmpl $USER_RPL, %eax
+       jb resume_kernel                # not returning to v8086 or userspace
 ENTRY(resume_userspace)
        DISABLE_INTERRUPTS              # make sure we don't miss an interrupt
                                        # setting need_resched or sigpending
@@ -274,6 +278,7 @@ need_resched:
        # sysenter call handler stub
 ENTRY(sysenter_entry)
        CFI_STARTPROC simple
+       CFI_SIGNAL_FRAME
        CFI_DEF_CFA esp, 0
        CFI_REGISTER esp, ebp
        movl TSS_sysenter_esp0(%esp),%esp
@@ -377,8 +382,8 @@ restore_all:
        # See comments in process.c:copy_thread() for details.
        movb OLDSS(%esp), %ah
        movb CS(%esp), %al
-       andl $(VM_MASK | (4 << 8) | 3), %eax
-       cmpl $((4 << 8) | 3), %eax
+       andl $(VM_MASK | (SEGMENT_TI_MASK << 8) | SEGMENT_RPL_MASK), %eax
+       cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax
        CFI_REMEMBER_STATE
        je ldt_ss                       # returning to user-space with LDT SS
 restore_nocheck: