]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/entry_32.S
Rename SMSC phy functions to be more generic
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / entry_32.S
index 290b7bc82da3c91d25c00aee470183f53a99c63c..9ba49a26dff8a25c5ad0e1adfb9c175e7cb3639e 100644 (file)
@@ -51,6 +51,7 @@
 #include <asm/desc.h>
 #include <asm/percpu.h>
 #include <asm/dwarf2.h>
+#include <asm/processor-flags.h>
 #include "irq_vectors.h"
 
 /*
@@ -58,7 +59,7 @@
  * for paravirtualization.  The following will never clobber any registers:
  *   INTERRUPT_RETURN (aka. "iret")
  *   GET_CR0_INTO_EAX (aka. "movl %cr0, %eax")
- *   ENABLE_INTERRUPTS_SYSEXIT (aka "sti; sysexit").
+ *   ENABLE_INTERRUPTS_SYSCALL_RET (aka "sti; sysexit").
  *
  * For DISABLE_INTERRUPTS/ENABLE_INTERRUPTS (aka "cli"/"sti"), you must
  * specify what registers can be overwritten (CLBR_NONE, CLBR_EAX/EDX/ECX/ANY).
 
 #define nr_syscalls ((syscall_table_size)/4)
 
-CF_MASK                = 0x00000001
-TF_MASK                = 0x00000100
-IF_MASK                = 0x00000200
-DF_MASK                = 0x00000400 
-NT_MASK                = 0x00004000
-VM_MASK                = 0x00020000
-
 #ifdef CONFIG_PREEMPT
 #define preempt_stop(clobbers) DISABLE_INTERRUPTS(clobbers); TRACE_IRQS_OFF
 #else
@@ -84,7 +78,7 @@ VM_MASK               = 0x00020000
 
 .macro TRACE_IRQS_IRET
 #ifdef CONFIG_TRACE_IRQFLAGS
-       testl $IF_MASK,PT_EFLAGS(%esp)     # interrupts off?
+       testl $X86_EFLAGS_IF,PT_EFLAGS(%esp)     # interrupts off?
        jz 1f
        TRACE_IRQS_ON
 1:
@@ -246,11 +240,12 @@ ret_from_intr:
 check_userspace:
        movl PT_EFLAGS(%esp), %eax      # mix EFLAGS and CS
        movb PT_CS(%esp), %al
-       andl $(VM_MASK | SEGMENT_RPL_MASK), %eax
+       andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax
        cmpl $USER_RPL, %eax
        jb resume_kernel                # not returning to v8086 or userspace
 
 ENTRY(resume_userspace)
+       LOCKDEP_SYS_EXIT
        DISABLE_INTERRUPTS(CLBR_ANY)    # make sure we don't miss an interrupt
                                        # setting need_resched or sigpending
                                        # between sampling and the iret
@@ -270,7 +265,7 @@ need_resched:
        movl TI_flags(%ebp), %ecx       # need_resched set ?
        testb $_TIF_NEED_RESCHED, %cl
        jz restore_all
-       testl $IF_MASK,PT_EFLAGS(%esp)  # interrupts off (exception path) ?
+       testl $X86_EFLAGS_IF,PT_EFLAGS(%esp)    # interrupts off (exception path) ?
        jz restore_all
        call preempt_schedule_irq
        jmp need_resched
@@ -282,18 +277,18 @@ END(resume_kernel)
    the vsyscall page.  See vsyscall-sysentry.S, which defines the symbol.  */
 
        # sysenter call handler stub
-ENTRY(sysenter_entry)
+ENTRY(ia32_sysenter_target)
        CFI_STARTPROC simple
        CFI_SIGNAL_FRAME
        CFI_DEF_CFA esp, 0
        CFI_REGISTER esp, ebp
-       movl TSS_sysenter_esp0(%esp),%esp
+       movl TSS_sysenter_sp0(%esp),%esp
 sysenter_past_esp:
        /*
-        * No need to follow this irqs on/off section: the syscall
-        * disabled irqs and here we enable it straight after entry:
+        * Interrupts are disabled here, but we can't trace it until
+        * enough kernel state to call TRACE_IRQS_OFF can be called - but
+        * we immediately enable interrupts at that point anyway.
         */
-       ENABLE_INTERRUPTS(CLBR_NONE)
        pushl $(__USER_DS)
        CFI_ADJUST_CFA_OFFSET 4
        /*CFI_REL_OFFSET ss, 0*/
@@ -301,6 +296,7 @@ sysenter_past_esp:
        CFI_ADJUST_CFA_OFFSET 4
        CFI_REL_OFFSET esp, 0
        pushfl
+       orl $X86_EFLAGS_IF, (%esp)
        CFI_ADJUST_CFA_OFFSET 4
        pushl $(__USER_CS)
        CFI_ADJUST_CFA_OFFSET 4
@@ -314,6 +310,11 @@ sysenter_past_esp:
        CFI_ADJUST_CFA_OFFSET 4
        CFI_REL_OFFSET eip, 0
 
+       pushl %eax
+       CFI_ADJUST_CFA_OFFSET 4
+       SAVE_ALL
+       ENABLE_INTERRUPTS(CLBR_NONE)
+
 /*
  * Load the potential sixth argument from user stack.
  * Careful about security.
@@ -321,14 +322,12 @@ sysenter_past_esp:
        cmpl $__PAGE_OFFSET-3,%ebp
        jae syscall_fault
 1:     movl (%ebp),%ebp
+       movl %ebp,PT_EBP(%esp)
 .section __ex_table,"a"
        .align 4
        .long 1b,syscall_fault
 .previous
 
-       pushl %eax
-       CFI_ADJUST_CFA_OFFSET 4
-       SAVE_ALL
        GET_THREAD_INFO(%ebp)
 
        /* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
@@ -338,6 +337,7 @@ sysenter_past_esp:
        jae syscall_badsys
        call *sys_call_table(,%eax,4)
        movl %eax,PT_EAX(%esp)
+       LOCKDEP_SYS_EXIT
        DISABLE_INTERRUPTS(CLBR_ANY)
        TRACE_IRQS_OFF
        movl TI_flags(%ebp), %ecx
@@ -349,7 +349,7 @@ sysenter_past_esp:
        xorl %ebp,%ebp
        TRACE_IRQS_ON
 1:     mov  PT_FS(%esp), %fs
-       ENABLE_INTERRUPTS_SYSEXIT
+       ENABLE_INTERRUPTS_SYSCALL_RET
        CFI_ENDPROC
 .pushsection .fixup,"ax"
 2:     movl $0,PT_FS(%esp)
@@ -358,7 +358,7 @@ sysenter_past_esp:
        .align 4
        .long 1b,2b
 .popsection
-ENDPROC(sysenter_entry)
+ENDPROC(ia32_sysenter_target)
 
        # system call handler stub
 ENTRY(system_call)
@@ -377,11 +377,12 @@ syscall_call:
        call *sys_call_table(,%eax,4)
        movl %eax,PT_EAX(%esp)          # store the return value
 syscall_exit:
+       LOCKDEP_SYS_EXIT
        DISABLE_INTERRUPTS(CLBR_ANY)    # make sure we don't miss an interrupt
                                        # setting need_resched or sigpending
                                        # between sampling and the iret
        TRACE_IRQS_OFF
-       testl $TF_MASK,PT_EFLAGS(%esp)  # If tracing set singlestep flag on exit
+       testl $X86_EFLAGS_TF,PT_EFLAGS(%esp)    # If tracing set singlestep flag on exit
        jz no_singlestep
        orl $_TIF_SINGLESTEP,TI_flags(%ebp)
 no_singlestep:
@@ -396,7 +397,7 @@ restore_all:
        # See comments in process.c:copy_thread() for details.
        movb PT_OLDSS(%esp), %ah
        movb PT_CS(%esp), %al
-       andl $(VM_MASK | (SEGMENT_TI_MASK << 8) | SEGMENT_RPL_MASK), %eax
+       andl $(X86_EFLAGS_VM | (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
@@ -406,7 +407,8 @@ restore_nocheck_notrace:
        RESTORE_REGS
        addl $4, %esp                   # skip orig_eax/error_code
        CFI_ADJUST_CFA_OFFSET -4
-1:     INTERRUPT_RETURN
+irq_return:
+       INTERRUPT_RETURN
 .section .fixup,"ax"
 iret_exc:
        pushl $0                        # no error code
@@ -415,7 +417,7 @@ iret_exc:
 .previous
 .section __ex_table,"a"
        .align 4
-       .long 1b,iret_exc
+       .long irq_return,iret_exc
 .previous
 
        CFI_RESTORE_STATE
@@ -434,7 +436,7 @@ ldt_ss:
         * is still available to implement the setting of the high
         * 16-bits in the INTERRUPT_RETURN paravirt-op.
         */
-       cmpl $0, paravirt_ops+PARAVIRT_enabled
+       cmpl $0, pv_info+PARAVIRT_enabled
        jne restore_nocheck
 #endif
 
@@ -467,6 +469,7 @@ work_pending:
        jz work_notifysig
 work_resched:
        call schedule
+       LOCKDEP_SYS_EXIT
        DISABLE_INTERRUPTS(CLBR_ANY)    # make sure we don't miss an interrupt
                                        # setting need_resched or sigpending
                                        # between sampling and the iret
@@ -481,7 +484,7 @@ work_resched:
 work_notifysig:                                # deal with pending signals and
                                        # notify-resume requests
 #ifdef CONFIG_VM86
-       testl $VM_MASK, PT_EFLAGS(%esp)
+       testl $X86_EFLAGS_VM, PT_EFLAGS(%esp)
        movl %esp, %eax
        jne work_notifysig_v86          # returning to kernel-space or
                                        # vm86-space
@@ -538,9 +541,6 @@ END(syscall_exit_work)
 
        RING0_INT_FRAME                 # can't unwind into user space anyway
 syscall_fault:
-       pushl %eax                      # save orig_eax
-       CFI_ADJUST_CFA_OFFSET 4
-       SAVE_ALL
        GET_THREAD_INFO(%ebp)
        movl $-EFAULT,PT_EAX(%esp)
        jmp resume_userspace
@@ -579,7 +579,7 @@ END(syscall_badsys)
  * Build the entry stubs and pointer table with
  * some assembler magic.
  */
-.data
+.section .rodata,"a"
 ENTRY(interrupt)
 .text
 
@@ -739,7 +739,7 @@ END(device_not_available)
  * that sets up the real kernel stack. Check here, since we can't
  * allow the wrong stack to be used.
  *
- * "TSS_sysenter_esp0+12" is because the NMI/debug handler will have
+ * "TSS_sysenter_sp0+12" is because the NMI/debug handler will have
  * already pushed 3 words if it hits on the sysenter instruction:
  * eflags, cs and eip.
  *
@@ -751,7 +751,7 @@ END(device_not_available)
        cmpw $__KERNEL_CS,4(%esp);              \
        jne ok;                                 \
 label:                                         \
-       movl TSS_sysenter_esp0+offset(%esp),%esp;       \
+       movl TSS_sysenter_sp0+offset(%esp),%esp;        \
        CFI_DEF_CFA esp, 0;                     \
        CFI_UNDEFINED eip;                      \
        pushfl;                                 \
@@ -764,7 +764,7 @@ label:                                              \
 
 KPROBE_ENTRY(debug)
        RING0_INT_FRAME
-       cmpl $sysenter_entry,(%esp)
+       cmpl $ia32_sysenter_target,(%esp)
        jne debug_stack_correct
        FIX_STACK(12, debug_stack_correct, debug_esp_fix_insn)
 debug_stack_correct:
@@ -795,7 +795,7 @@ KPROBE_ENTRY(nmi)
        popl %eax
        CFI_ADJUST_CFA_OFFSET -4
        je nmi_espfix_stack
-       cmpl $sysenter_entry,(%esp)
+       cmpl $ia32_sysenter_target,(%esp)
        je nmi_stack_fixup
        pushl %eax
        CFI_ADJUST_CFA_OFFSET 4
@@ -808,7 +808,7 @@ KPROBE_ENTRY(nmi)
        popl %eax
        CFI_ADJUST_CFA_OFFSET -4
        jae nmi_stack_correct
-       cmpl $sysenter_entry,12(%esp)
+       cmpl $ia32_sysenter_target,12(%esp)
        je nmi_debug_stack_check
 nmi_stack_correct:
        /* We have a RING0_INT_FRAME here */
@@ -861,27 +861,23 @@ nmi_espfix_stack:
        RESTORE_REGS
        lss 12+4(%esp), %esp            # back to espfix stack
        CFI_ADJUST_CFA_OFFSET -24
-1:     INTERRUPT_RETURN
+       jmp irq_return
        CFI_ENDPROC
-.section __ex_table,"a"
-       .align 4
-       .long 1b,iret_exc
-.previous
 KPROBE_END(nmi)
 
 #ifdef CONFIG_PARAVIRT
 ENTRY(native_iret)
-1:     iret
+       iret
 .section __ex_table,"a"
        .align 4
-       .long 1b,iret_exc
+       .long native_iret, iret_exc
 .previous
 END(native_iret)
 
-ENTRY(native_irq_enable_sysexit)
+ENTRY(native_irq_enable_syscall_ret)
        sti
        sysexit
-END(native_irq_enable_sysexit)
+END(native_irq_enable_syscall_ret)
 #endif
 
 KPROBE_ENTRY(int3)