2000-07-02 08:40:33 +04:00
|
|
|
/* $NetBSD: icu.s,v 1.63 2000/07/02 04:40:37 cgd Exp $ */
|
1994-10-27 07:14:23 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*-
|
1998-08-15 08:57:50 +04:00
|
|
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Charles M. Hannum.
|
1993-03-21 12:45:37 +03:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
1994-04-07 10:48:19 +04:00
|
|
|
* notice, this list of conditions and the following disclaimer.
|
1993-03-21 12:45:37 +03:00
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
1994-04-07 10:48:19 +04:00
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
1993-03-21 12:45:37 +03:00
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
1994-04-07 10:48:19 +04:00
|
|
|
* must display the following acknowledgement:
|
1998-08-15 08:57:50 +04:00
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
1993-03-21 12:45:37 +03:00
|
|
|
*
|
1998-08-15 08:57:50 +04:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
|
1998-01-16 01:25:52 +03:00
|
|
|
#include "opt_vm86.h"
|
|
|
|
|
1993-12-17 03:10:06 +03:00
|
|
|
#include <net/netisr.h>
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
.data
|
1998-12-01 07:30:59 +03:00
|
|
|
.globl _C_LABEL(imen),_C_LABEL(cpl),_C_LABEL(ipending)
|
|
|
|
.globl _C_LABEL(astpending),_C_LABEL(netisr)
|
|
|
|
_C_LABEL(imen):
|
1993-12-17 03:10:06 +03:00
|
|
|
.long 0xffff # interrupt mask enable (all off)
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
.text
|
1993-06-06 08:14:01 +04:00
|
|
|
|
1994-05-13 15:11:42 +04:00
|
|
|
#if defined(PROF) || defined(GPROF)
|
1998-12-01 07:30:59 +03:00
|
|
|
.globl _C_LABEL(splhigh), _C_LABEL(splx)
|
1994-05-13 15:11:42 +04:00
|
|
|
|
|
|
|
ALIGN_TEXT
|
1998-12-01 07:30:59 +03:00
|
|
|
_C_LABEL(splhigh):
|
1994-05-13 15:11:42 +04:00
|
|
|
movl $-1,%eax
|
1998-12-01 07:30:59 +03:00
|
|
|
xchgl %eax,_C_LABEL(cpl)
|
1994-05-13 15:11:42 +04:00
|
|
|
ret
|
|
|
|
|
|
|
|
ALIGN_TEXT
|
1998-12-01 07:30:59 +03:00
|
|
|
_C_LABEL(splx):
|
1994-05-13 15:11:42 +04:00
|
|
|
movl 4(%esp),%eax
|
1998-12-01 07:30:59 +03:00
|
|
|
movl %eax,_C_LABEL(cpl)
|
1994-05-13 15:11:42 +04:00
|
|
|
testl %eax,%eax
|
1998-12-01 07:30:59 +03:00
|
|
|
jnz _C_LABEL(Xspllower)
|
1994-05-13 15:11:42 +04:00
|
|
|
ret
|
|
|
|
#endif /* PROF || GPROF */
|
|
|
|
|
1993-06-06 08:14:01 +04:00
|
|
|
/*
|
1994-04-07 10:48:19 +04:00
|
|
|
* Process pending interrupts.
|
|
|
|
*
|
|
|
|
* Important registers:
|
|
|
|
* ebx - cpl
|
1995-04-22 04:54:21 +04:00
|
|
|
* esi - address to resume loop at
|
1994-04-07 10:48:19 +04:00
|
|
|
* edi - scratch for Xsoftnet
|
1993-06-06 08:14:01 +04:00
|
|
|
*/
|
1994-05-13 15:11:42 +04:00
|
|
|
IDTVEC(spllower)
|
1994-04-07 10:48:19 +04:00
|
|
|
pushl %ebx
|
|
|
|
pushl %esi
|
|
|
|
pushl %edi
|
1998-12-01 07:30:59 +03:00
|
|
|
movl _C_LABEL(cpl),%ebx # save priority
|
1995-04-22 04:54:21 +04:00
|
|
|
movl $1f,%esi # address to resume loop at
|
1994-04-07 10:48:19 +04:00
|
|
|
1: movl %ebx,%eax
|
1993-06-06 08:14:01 +04:00
|
|
|
notl %eax
|
1998-12-01 07:30:59 +03:00
|
|
|
andl _C_LABEL(ipending),%eax
|
1994-04-07 10:48:19 +04:00
|
|
|
jz 2f
|
|
|
|
bsfl %eax,%eax
|
1998-12-01 07:30:59 +03:00
|
|
|
btrl %eax,_C_LABEL(ipending)
|
1994-04-07 10:48:19 +04:00
|
|
|
jnc 1b
|
1998-12-01 07:30:59 +03:00
|
|
|
jmp *_C_LABEL(Xrecurse)(,%eax,4)
|
1994-04-07 10:48:19 +04:00
|
|
|
2: popl %edi
|
|
|
|
popl %esi
|
|
|
|
popl %ebx
|
|
|
|
ret
|
1993-06-06 08:14:01 +04:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
1994-04-07 10:48:19 +04:00
|
|
|
* Handle return from interrupt after device handler finishes.
|
|
|
|
*
|
|
|
|
* Important registers:
|
|
|
|
* ebx - cpl to restore
|
1995-04-22 04:54:21 +04:00
|
|
|
* esi - address to resume loop at
|
1994-04-07 10:48:19 +04:00
|
|
|
* edi - scratch for Xsoftnet
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
1994-04-07 10:48:19 +04:00
|
|
|
IDTVEC(doreti)
|
|
|
|
popl %ebx # get previous priority
|
1999-01-26 17:28:05 +03:00
|
|
|
movl %ebx,_C_LABEL(cpl)
|
1995-04-22 04:54:21 +04:00
|
|
|
movl $1f,%esi # address to resume loop at
|
1994-04-07 10:48:19 +04:00
|
|
|
1: movl %ebx,%eax
|
1993-06-06 08:14:01 +04:00
|
|
|
notl %eax
|
1998-12-01 07:30:59 +03:00
|
|
|
andl _C_LABEL(ipending),%eax
|
1993-12-17 03:10:06 +03:00
|
|
|
jz 2f
|
1994-04-07 10:48:19 +04:00
|
|
|
bsfl %eax,%eax # slow, but not worth optimizing
|
1998-12-01 07:30:59 +03:00
|
|
|
btrl %eax,_C_LABEL(ipending)
|
1994-04-07 10:48:19 +04:00
|
|
|
jnc 1b # some intr cleared the in-memory bit
|
1998-12-01 07:30:59 +03:00
|
|
|
jmp *_C_LABEL(Xresume)(,%eax,4)
|
1994-05-05 12:44:53 +04:00
|
|
|
2: /* Check for ASTs on exit to user mode. */
|
|
|
|
cli
|
1998-12-01 07:30:59 +03:00
|
|
|
cmpb $0,_C_LABEL(astpending)
|
1995-01-15 03:36:37 +03:00
|
|
|
je 3f
|
1995-05-01 12:25:30 +04:00
|
|
|
testb $SEL_RPL,TF_CS(%esp)
|
1995-10-11 07:19:29 +03:00
|
|
|
#ifdef VM86
|
|
|
|
jnz 4f
|
|
|
|
testl $PSL_VM,TF_EFLAGS(%esp)
|
|
|
|
#endif
|
1994-04-07 10:48:19 +04:00
|
|
|
jz 3f
|
1998-12-01 07:30:59 +03:00
|
|
|
4: movb $0,_C_LABEL(astpending)
|
1994-05-05 12:44:53 +04:00
|
|
|
sti
|
1995-01-15 03:36:37 +03:00
|
|
|
/* Pushed T_ASTFLT into tf_trapno on entry. */
|
1998-12-01 07:30:59 +03:00
|
|
|
call _C_LABEL(trap)
|
1996-08-15 19:34:03 +04:00
|
|
|
jmp 2b
|
1994-04-07 10:48:19 +04:00
|
|
|
3: INTRFASTEXIT
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*
|
1994-04-07 10:48:19 +04:00
|
|
|
* Soft interrupt handlers
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
|
1997-02-28 19:24:03 +03:00
|
|
|
IDTVEC(softserial)
|
1998-12-01 07:30:59 +03:00
|
|
|
movl _C_LABEL(imask) + IPL_SOFTSERIAL * 4,%eax
|
|
|
|
movl %eax,_C_LABEL(cpl)
|
1997-02-28 19:24:03 +03:00
|
|
|
#include "com.h"
|
|
|
|
#if NCOM > 0
|
1998-12-01 07:30:59 +03:00
|
|
|
call _C_LABEL(comsoft)
|
1997-02-28 19:24:03 +03:00
|
|
|
#endif
|
1998-12-01 07:30:59 +03:00
|
|
|
movl %ebx,_C_LABEL(cpl)
|
1994-04-07 10:48:19 +04:00
|
|
|
jmp %esi
|
1994-03-09 10:58:39 +03:00
|
|
|
|
1994-04-07 10:48:19 +04:00
|
|
|
IDTVEC(softnet)
|
1998-12-01 07:30:59 +03:00
|
|
|
movl _C_LABEL(imask) + IPL_SOFTNET * 4,%eax
|
|
|
|
movl %eax,_C_LABEL(cpl)
|
1994-04-09 00:46:18 +04:00
|
|
|
xorl %edi,%edi
|
1998-12-01 07:30:59 +03:00
|
|
|
xchgl _C_LABEL(netisr),%edi
|
2000-02-21 23:38:46 +03:00
|
|
|
|
|
|
|
#define DONETISR(s, c) \
|
|
|
|
.globl _C_LABEL(c) ;\
|
|
|
|
testl $(1 << s),%edi ;\
|
|
|
|
jz 1f ;\
|
|
|
|
call _C_LABEL(c) ;\
|
|
|
|
1:
|
|
|
|
|
2000-07-02 08:40:33 +04:00
|
|
|
#include <net/netisr_dispatch.h>
|
2000-02-21 23:38:46 +03:00
|
|
|
|
|
|
|
#undef DONETISR
|
|
|
|
|
1998-12-01 07:30:59 +03:00
|
|
|
movl %ebx,_C_LABEL(cpl)
|
1994-04-07 10:48:19 +04:00
|
|
|
jmp %esi
|
1993-06-06 09:06:50 +04:00
|
|
|
|
1994-04-07 10:48:19 +04:00
|
|
|
IDTVEC(softclock)
|
1998-12-01 07:30:59 +03:00
|
|
|
movl _C_LABEL(imask) + IPL_SOFTCLOCK * 4,%eax
|
|
|
|
movl %eax,_C_LABEL(cpl)
|
|
|
|
call _C_LABEL(softclock)
|
|
|
|
movl %ebx,_C_LABEL(cpl)
|
1994-04-07 10:48:19 +04:00
|
|
|
jmp %esi
|