vserver 1.9.5.x5
[linux-2.6.git] / arch / i386 / kernel / entry.S
index 6387a7e..0e7e68b 100644 (file)
@@ -131,7 +131,7 @@ VM_MASK             = 0x00020000
        movl $(__USER_DS), %edx; \
        movl %edx, %ds; \
        movl %edx, %es; \
-       pushl $11;      \
+       movl $11,%eax;  \
        call do_exit;   \
 .previous;             \
 .section __ex_table,"a";\
@@ -140,40 +140,6 @@ VM_MASK            = 0x00020000
 .previous
 
 
-
-ENTRY(lcall7)
-       pushfl                  # We get a different stack layout with call
-                               # gates, which has to be cleaned up later..
-       pushl %eax
-       SAVE_ALL
-       movl %esp, %ebp
-       pushl %ebp
-       pushl $0x7
-do_lcall:
-       movl EIP(%ebp), %eax    # due to call gates, this is eflags, not eip..
-       movl CS(%ebp), %edx     # this is eip..
-       movl EFLAGS(%ebp), %ecx # and this is cs..
-       movl %eax,EFLAGS(%ebp)  #
-       movl %edx,EIP(%ebp)     # Now we move them to their "normal" places
-       movl %ecx,CS(%ebp)      #
-       GET_THREAD_INFO_WITH_ESP(%ebp)  # GET_THREAD_INFO
-       movl TI_exec_domain(%ebp), %edx # Get the execution domain
-       call *EXEC_DOMAIN_handler(%edx) # Call the handler for the domain
-       addl $4, %esp
-       popl %eax
-       jmp resume_userspace
-
-ENTRY(lcall27)
-       pushfl                  # We get a different stack layout with call
-                               # gates, which has to be cleaned up later..
-       pushl %eax
-       SAVE_ALL
-       movl %esp, %ebp
-       pushl %ebp
-       pushl $0x27
-       jmp do_lcall
-
-
 ENTRY(ret_from_fork)
        pushl %eax
        call schedule_tail
@@ -210,6 +176,7 @@ ENTRY(resume_userspace)
 
 #ifdef CONFIG_PREEMPT
 ENTRY(resume_kernel)
+       cli
        cmpl $0,TI_preempt_count(%ebp)  # non-zero preempt_count ?
        jnz restore_all
 need_resched:
@@ -218,11 +185,7 @@ need_resched:
        jz restore_all
        testl $IF_MASK,EFLAGS(%esp)     # interrupts off (exception path) ?
        jz restore_all
-       movl $PREEMPT_ACTIVE,TI_preempt_count(%ebp)
-       sti
-       call schedule
-       movl $0,TI_preempt_count(%ebp)
-       cli
+       call preempt_schedule_irq
        jmp need_resched
 #endif
 
@@ -255,11 +218,11 @@ sysenter_past_esp:
        pushl %eax
        SAVE_ALL
        GET_THREAD_INFO(%ebp)
-       cmpl $(nr_syscalls), %eax
-       jae syscall_badsys
 
        testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
        jnz syscall_trace_entry
+       cmpl $(nr_syscalls), %eax
+       jae syscall_badsys
        call *sys_call_table(,%eax,4)
        movl %eax,EAX(%esp)
        cli
@@ -269,6 +232,7 @@ sysenter_past_esp:
 /* if something modifies registers it must also disable sysexit */
        movl EIP(%esp), %edx
        movl OLDESP(%esp), %ecx
+       xorl %ebp,%ebp
        sti
        sysexit
 
@@ -278,11 +242,11 @@ ENTRY(system_call)
        pushl %eax                      # save orig_eax
        SAVE_ALL
        GET_THREAD_INFO(%ebp)
-       cmpl $(nr_syscalls), %eax
-       jae syscall_badsys
                                        # system call tracing in operation
        testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
        jnz syscall_trace_entry
+       cmpl $(nr_syscalls), %eax
+       jae syscall_badsys
 syscall_call:
        call *sys_call_table(,%eax,4)
        movl %eax,EAX(%esp)             # store the return value
@@ -325,8 +289,8 @@ work_notifysig:                             # deal with pending signals and
 
        ALIGN
 work_notifysig_v86:
-       pushl %ecx
-       call save_v86_state
+       pushl %ecx                      # save ti_flags for do_notify_resume
+       call save_v86_state             # %eax contains pt_regs pointer
        popl %ecx
        movl %eax, %esp
        xorl %edx, %edx
@@ -348,7 +312,7 @@ syscall_trace_entry:
        # perform syscall exit tracing
        ALIGN
 syscall_exit_work:
-       testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT), %cl
+       testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP), %cl
        jz work_pending
        sti                             # could let do_syscall_trace() call
                                        # schedule() instead
@@ -393,6 +357,7 @@ vector=vector+1
        ALIGN
 common_interrupt:
        SAVE_ALL
+       movl %esp,%eax
        call do_IRQ
        jmp ret_from_intr
 
@@ -400,7 +365,8 @@ common_interrupt:
 ENTRY(name)                            \
        pushl $nr-256;                  \
        SAVE_ALL                        \
-       call smp_/**/name;      \
+       movl %esp,%eax;                 \
+       call smp_/**/name;              \
        jmp ret_from_intr;
 
 /* The include is where all of the SMP etc. interrupts come from */
@@ -423,18 +389,15 @@ error_code:
        pushl %ebx
        cld
        movl %es, %ecx
-       movl ORIG_EAX(%esp), %esi       # get the error code
        movl ES(%esp), %edi             # get the function address
+       movl ORIG_EAX(%esp), %edx       # get the error code
        movl %eax, ORIG_EAX(%esp)
        movl %ecx, ES(%esp)
-       movl %esp, %edx
-       pushl %esi                      # push the error code
-       pushl %edx                      # push the pt_regs pointer
-       movl $(__USER_DS), %edx
-       movl %edx, %ds
-       movl %edx, %es
+       movl $(__USER_DS), %ecx
+       movl %ecx, %ds
+       movl %ecx, %es
+       movl %esp,%eax                  # pt_regs pointer
        call *%edi
-       addl $8, %esp
        jmp ret_from_exception
 
 ENTRY(coprocessor_error)
@@ -489,9 +452,14 @@ ENTRY(debug)
        jne debug_stack_correct
        FIX_STACK(12, debug_stack_correct, debug_esp_fix_insn)
 debug_stack_correct:
-       pushl $0
-       pushl $do_debug
-       jmp error_code
+       pushl $-1                       # mark this as an int
+       SAVE_ALL
+       xorl %edx,%edx                  # error code 0
+       movl %esp,%eax                  # pt_regs pointer
+       call do_debug
+       testl %eax,%eax
+       jnz restore_all
+       jmp ret_from_exception
 
 /*
  * NMI is doubly nasty. It can happen _while_ we're handling
@@ -518,11 +486,9 @@ ENTRY(nmi)
 nmi_stack_correct:
        pushl %eax
        SAVE_ALL
-       movl %esp, %edx
-       pushl $0
-       pushl %edx
+       xorl %edx,%edx          # zero error code
+       movl %esp,%eax          # pt_regs pointer
        call do_nmi
-       addl $8, %esp
        RESTORE_ALL
 
 nmi_stack_fixup:
@@ -540,9 +506,14 @@ nmi_debug_stack_fixup:
        jmp nmi_stack_correct
 
 ENTRY(int3)
-       pushl $0
-       pushl $do_int3
-       jmp error_code
+       pushl $-1                       # mark this as an int
+       SAVE_ALL
+       xorl %edx,%edx          # zero error code
+       movl %esp,%eax          # pt_regs pointer
+       call do_int3
+       testl %eax,%eax
+       jnz restore_all
+       jmp ret_from_exception
 
 ENTRY(overflow)
        pushl $0
@@ -886,5 +857,10 @@ ENTRY(sys_call_table)
        .long sys_mq_notify
        .long sys_mq_getsetattr
        .long sys_ni_syscall            /* reserved for kexec */
+       .long sys_waitid
+       .long sys_ni_syscall            /* 285 */ /* available */
+       .long sys_add_key
+       .long sys_request_key
+       .long sys_keyctl
 
 syscall_table_size=(.-sys_call_table)