]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/i386/isa/ipl.s
Don't enable interrupts before calling sched_ithd for threaded interrupts.
[FreeBSD/FreeBSD.git] / sys / i386 / isa / ipl.s
1 /*-
2  * Copyright (c) 1989, 1990 William F. Jolitz.
3  * Copyright (c) 1990 The Regents of the University of California.
4  * All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * William Jolitz.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *      This product includes software developed by the University of
20  *      California, Berkeley and its contributors.
21  * 4. Neither the name of the University nor the names of its contributors
22  *    may be used to endorse or promote products derived from this software
23  *    without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  *
37  *      @(#)ipl.s
38  *
39  * $FreeBSD$
40  */
41
42
43 /*
44  * AT/386
45  * Vector interrupt control section
46  */
47
48         .text
49
50 /*
51  * void doreti(struct trapframe)
52  *
53  * Handle return from interrupts, traps and syscalls.
54  */
55         SUPERALIGN_TEXT
56         .type   doreti,@function
57 doreti:
58
59         FAKE_MCOUNT(bintr)              /* init "from" bintr -> doreti */
60 doreti_next:
61         /* Check for ASTs that can be handled now. */
62         testb   $SEL_RPL_MASK,TF_CS(%esp)  /* are we in user mode? */
63         jne     doreti_ast              /* yes, do it now. */
64         testl   $PSL_VM,TF_EFLAGS(%esp) /* kernel mode */
65         je      doreti_exit             /* and not VM86 mode, defer */
66         cmpl    $1,in_vm86call          /* are we in a VM86 call? */
67         je      doreti_exit             /* no, defer */
68
69 doreti_ast:
70         pushl   %esp                    /* pass a pointer to the trapframe */
71         call    ast
72         add     $4, %esp
73
74         /*
75          * doreti_exit: pop registers, iret.
76          *
77          *      The segment register pop is a special case, since it may
78          *      fault if (for example) a sigreturn specifies bad segment
79          *      registers.  The fault is handled in trap.c.
80          */
81 doreti_exit:
82         MEXITCOUNT
83
84         .globl  doreti_popl_fs
85 doreti_popl_fs:
86         popl    %fs
87         .globl  doreti_popl_es
88 doreti_popl_es:
89         popl    %es
90         .globl  doreti_popl_ds
91 doreti_popl_ds:
92         popl    %ds
93         popal
94         addl    $8,%esp
95         .globl  doreti_iret
96 doreti_iret:
97         iret
98
99         /*
100          * doreti_iret_fault and friends.  Alternative return code for
101          * the case where we get a fault in the doreti_exit code
102          * above.  trap() (i386/i386/trap.c) catches this specific
103          * case, sends the process a signal and continues in the
104          * corresponding place in the code below.
105          */
106         ALIGN_TEXT
107         .globl  doreti_iret_fault
108 doreti_iret_fault:
109         subl    $8,%esp
110         pushal
111         pushl   %ds
112         .globl  doreti_popl_ds_fault
113 doreti_popl_ds_fault:
114         pushl   %es
115         .globl  doreti_popl_es_fault
116 doreti_popl_es_fault:
117         pushl   %fs
118         .globl  doreti_popl_fs_fault
119 doreti_popl_fs_fault:
120         movl    $0,TF_ERR(%esp) /* XXX should be the error code */
121         movl    $T_PROTFLT,TF_TRAPNO(%esp)
122         jmp     alltraps_with_regs_pushed
123
124 #ifdef APIC_IO
125 #include "i386/isa/apic_ipl.s"
126 #else
127 #include "i386/isa/icu_ipl.s"
128 #endif /* APIC_IO */