2 * Copyright (c) 1989, 1990 William F. Jolitz.
3 * Copyright (c) 1990 The Regents of the University of California.
6 * This code is derived from software contributed to Berkeley by
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
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.
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
45 * Vector interrupt control section
51 * void doreti(struct trapframe)
53 * Handle return from interrupts, traps and syscalls.
56 .type _doreti,@function
58 FAKE_MCOUNT(_bintr) /* init "from" _bintr -> _doreti */
60 /* Check for ASTs that can be handled now. */
61 testl $AST_PENDING,PCPU(ASTPENDING)
62 je doreti_exit /* no AST, exit */
63 testb $SEL_RPL_MASK,TF_CS(%esp) /* are we in user mode? */
64 jne doreti_ast /* yes, do it now. */
65 testl $PSL_VM,TF_EFLAGS(%esp) /* kernel mode */
66 je doreti_exit /* and not VM86 mode, defer */
67 cmpl $1,_in_vm86call /* are we in a VM86 call? */
68 jne doreti_ast /* yes, we can do it */
71 * doreti_exit: release MP lock, pop registers, iret.
73 * Note that the syscall trap shortcuts to doreti_syscall_ret.
74 * The segment register pop is a special case, since it may
75 * fault if (for example) a sigreturn specifies bad segment
76 * registers. The fault is handled in trap.c.
82 .globl doreti_syscall_ret
99 * doreti_iret_fault and friends. Alternative return code for
100 * the case where we get a fault in the doreti_exit code
101 * above. trap() (i386/i386/trap.c) catches this specific
102 * case, sends the process a signal and continues in the
103 * corresponding place in the code below.
106 .globl doreti_iret_fault
111 .globl doreti_popl_ds_fault
112 doreti_popl_ds_fault:
114 .globl doreti_popl_es_fault
115 doreti_popl_es_fault:
117 .globl doreti_popl_fs_fault
118 doreti_popl_fs_fault:
119 movl $0,TF_ERR(%esp) /* XXX should be the error code */
120 movl $T_PROTFLT,TF_TRAPNO(%esp)
121 jmp alltraps_with_regs_pushed
125 andl $~AST_PENDING,PCPU(ASTPENDING)
127 movl $T_ASTFLT,TF_TRAPNO(%esp)
132 #include "i386/isa/apic_ipl.s"
134 #include "i386/isa/icu_ipl.s"