Remove all remaining SPL code. Replace the mtd_cpl field in the machine
[dragonfly.git] / sys / i386 / apic / apic_vector.s
index 8504156..6d2aea9 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *     from: vector.s, 386BSD 0.1 unknown origin
  * $FreeBSD: src/sys/i386/isa/apic_vector.s,v 1.47.2.5 2001/09/01 22:33:38 tegge Exp $
- * $DragonFly: src/sys/i386/apic/Attic/apic_vector.s,v 1.13 2003/08/25 19:50:32 dillon Exp $
+ * $DragonFly: src/sys/i386/apic/Attic/apic_vector.s,v 1.19 2005/06/16 21:12:47 dillon Exp $
  */
 
 
-#include <machine/apic.h>
+#include <machine/apicreg.h>
 #include <machine/smp.h>
 #include "i386/isa/intr_machdep.h"
 
  *     - Push the trap frame required by doreti
  *     - Mask the interrupt and reenable its source
  *     - If we cannot take the interrupt set its fpending bit and
- *       doreti.
+ *       doreti.  Note that we cannot mess with mp_lock at all
+ *       if we entered from a critical section!
  *     - If we can take the interrupt clear its fpending bit,
  *       call the handler, then unmask and doreti.
  *
@@ -152,12 +153,10 @@ IDTVEC(vec_name) ;                                                        \
        MASK_LEVEL_IRQ(irq_num) ;                                       \
        EOI_IRQ(irq_num) ;                                              \
        movl    PCPU(curthread),%ebx ;                                  \
-       movl    TD_CPL(%ebx),%eax ;                                     \
+       movl    $0,%eax ;       /* CURRENT CPL IN FRAME (REMOVED) */    \
        pushl   %eax ;                                                  \
        cmpl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
-       jge     1f ;                                                    \
-       testl   $IRQ_LBIT(irq_num), %eax ;                              \
-       jz      2f ;                                                    \
+       jl      2f ;                                                    \
 1: ;                                                                   \
        /* in critical section, make interrupt pending */               \
        /* set the pending bit and return, leave interrupt masked */    \
@@ -187,7 +186,7 @@ IDTVEC(vec_name) ;                                                  \
        MEXITCOUNT ;                                                    \
        jmp     doreti ;                                                \
 6: ;                                                                   \
-       /* could not get MP lock, forward the interrupt */              \
+       /* could not get the MP lock, forward the interrupt */          \
        movl    mp_lock, %eax ;          /* check race */               \
        cmpl    $MP_FREE_LOCK,%eax ;                                    \
        je      2b ;                                                    \
@@ -196,7 +195,7 @@ IDTVEC(vec_name) ;                                                  \
        movl    $irq_num,8(%esp) ;                                      \
        movl    $forward_fastint_remote,4(%esp) ;                       \
        movl    %eax,(%esp) ;                                           \
-       call    lwkt_send_ipiq ;                                        \
+       call    lwkt_send_ipiq_bycpu ;                                  \
        addl    $12,%esp ;                                              \
        jmp     5f ;                                                    \
 
@@ -242,7 +241,8 @@ IDTVEC(vec_name) ;                                                  \
  *     - If we cannot take the interrupt set its ipending bit and
  *       doreti.  In addition to checking for a critical section
  *       and cpl mask we also check to see if the thread is still
- *       running.
+ *       running.  Note that we cannot mess with mp_lock at all
+ *       if we entered from a critical section!
  *     - If we can take the interrupt clear its ipending bit
  *       and schedule the thread.  Leave interrupts masked and doreti.
  *
@@ -264,12 +264,10 @@ IDTVEC(vec_name) ;                                                        \
        MASK_LEVEL_IRQ(irq_num) ;                                       \
        EOI_IRQ(irq_num) ;                                              \
        movl    PCPU(curthread),%ebx ;                                  \
-       movl    TD_CPL(%ebx),%eax ;                                     \
+       movl    $0,%eax ;       /* CURRENT CPL IN FRAME (REMOVED) */    \
        pushl   %eax ;          /* cpl do restore */                    \
        cmpl    $TDPRI_CRIT,TD_PRI(%ebx) ;                              \
-       jge     1f ;                                                    \
-       testl   $IRQ_LBIT(irq_num),%eax ;                               \
-       jz      2f ;                                                    \
+       jl      2f ;                                                    \
 1: ;                                                                   \
        /* set the pending bit and return, leave the interrupt masked */ \
        orl     $IRQ_LBIT(irq_num), PCPU(ipending) ;                    \
@@ -336,69 +334,6 @@ Xinvltlb:
        iret
 
 
-#if 0
-#ifdef BETTER_CLOCK
-
-/*
- * Executed by a CPU when it receives an Xcpucheckstate IPI from another CPU,
- *
- *  - Stores current cpu state in checkstate_cpustate[cpuid]
- *      0 == user, 1 == sys, 2 == intr
- *  - Stores current process in checkstate_curproc[cpuid]
- *
- *  - Signals its receipt by setting bit cpuid in checkstate_probed_cpus.
- *
- * stack: 0->ds, 4->fs, 8->ebx, 12->eax, 16->eip, 20->cs, 24->eflags
- */
-
-       .text
-       SUPERALIGN_TEXT
-       .globl Xcpucheckstate
-       .globl checkstate_cpustate
-       .globl checkstate_curproc
-       .globl checkstate_pc
-Xcpucheckstate:
-       pushl   %eax
-       pushl   %ebx            
-       pushl   %ds                     /* save current data segment */
-       pushl   %fs
-
-       movl    $KDSEL, %eax
-       mov     %ax, %ds                /* use KERNEL data segment */
-       movl    $KPSEL, %eax
-       mov     %ax, %fs
-
-       movl    $0, lapic_eoi           /* End Of Interrupt to APIC */
-
-       movl    $0, %ebx                
-       movl    20(%esp), %eax  
-       andl    $3, %eax
-       cmpl    $3, %eax
-       je      1f
-       testl   $PSL_VM, 24(%esp)
-       jne     1f
-       incl    %ebx                    /* system or interrupt */
-1:     
-       movl    PCPU(cpuid), %eax
-       movl    %ebx, checkstate_cpustate(,%eax,4)
-       movl    PCPU(curthread), %ebx
-       movl    TD_PROC(%ebx),%ebx
-       movl    %ebx, checkstate_curproc(,%eax,4)
-       movl    16(%esp), %ebx
-       movl    %ebx, checkstate_pc(,%eax,4)
-
-       lock                            /* checkstate_probed_cpus |= (1<<id) */
-       btsl    %eax, checkstate_probed_cpus
-
-       popl    %fs
-       popl    %ds                     /* restore previous data segment */
-       popl    %ebx
-       popl    %eax
-       iret
-
-#endif /* BETTER_CLOCK */
-#endif
-
 /*
  * Executed by a CPU when it receives an Xcpustop IPI from another CPU,
  *
@@ -482,12 +417,14 @@ Xipiq:
        movl    PCPU(curthread),%ebx
        cmpl    $TDPRI_CRIT,TD_PRI(%ebx)
        jge     1f
+       subl    $8,%esp                 /* make same as interrupt frame */
        incl    PCPU(intr_nesting_level)
        addl    $TDPRI_CRIT,TD_PRI(%ebx)
-       call    lwkt_process_ipiq
+       call    lwkt_process_ipiq_frame
        subl    $TDPRI_CRIT,TD_PRI(%ebx)
        decl    PCPU(intr_nesting_level)
-       pushl   TD_CPL(%ebx)
+       addl    $8,%esp
+       pushl   $0                      /* CPL for frame (REMOVED) */
        MEXITCOUNT
        jmp     doreti
 1:
@@ -523,12 +460,8 @@ MCOUNT_LABEL(bintr)
        FAST_INTR(23,fastintr23)
        
        /* YYY what is this garbage? */
-#define        CLKINTR_PENDING                                                 \
-       call    clock_lock ;                                            \
-       movl $1,CNAME(clkintr_pending) ;                                \
-       call    clock_unlock ;                                          \
 
-       INTR(0,intr0, CLKINTR_PENDING)
+       INTR(0,intr0,)
        INTR(1,intr1,)
        INTR(2,intr2,)
        INTR(3,intr3,)
@@ -604,39 +537,6 @@ Xrendezvous:
        
        .data
 
-#if 0
-/*
- * Addresses of interrupt handlers.
- *  XresumeNN: Resumption addresses for HWIs.
- */
-       .globl _ihandlers
-_ihandlers:
-/*
- * used by:
- *  ipl.s:     doreti_unpend
- */
-       .long   Xresume0,  Xresume1,  Xresume2,  Xresume3 
-       .long   Xresume4,  Xresume5,  Xresume6,  Xresume7
-       .long   Xresume8,  Xresume9,  Xresume10, Xresume11
-       .long   Xresume12, Xresume13, Xresume14, Xresume15 
-       .long   Xresume16, Xresume17, Xresume18, Xresume19
-       .long   Xresume20, Xresume21, Xresume22, Xresume23
-/*
- * used by:
- *  ipl.s:     doreti_unpend
- *  apic_ipl.s:        splz_unpend
- */
-       .long   _swi_null, swi_net, _swi_null, _swi_null
-       .long   _swi_vm, _swi_null, _softclock
-
-imasks:                                /* masks for interrupt handlers */
-       .space  NHWI*4          /* padding; HWI masks are elsewhere */
-
-       .long   SWI_TTY_MASK, SWI_NET_MASK, SWI_CAMNET_MASK, SWI_CAMBIO_MASK
-       .long   SWI_VM_MASK, SWI_TQ_MASK, SWI_CLOCK_MASK
-#endif /* 0 */
-
-
 #ifdef COUNT_XINVLTLB_HITS
        .globl  xhits
 xhits:
@@ -650,11 +550,6 @@ stopped_cpus:
 started_cpus:
        .long   0
 
-#ifdef BETTER_CLOCK
-       .globl checkstate_probed_cpus
-checkstate_probed_cpus:
-       .long   0       
-#endif /* BETTER_CLOCK */
        .globl CNAME(cpustop_restartfunc)
 CNAME(cpustop_restartfunc):
        .long 0