.s -> .S rename. New files: vector.S and spl.S, they have been split
off from locore.s, plus parts of isa/vector.s and isa/icu.s
This commit is contained in:
parent
71a8119df8
commit
c403116289
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: apmcall.s,v 1.10 2002/10/14 02:08:38 takemura Exp $ */
|
||||
/* $NetBSD: apmcall.S,v 1.1 2002/11/22 15:01:16 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -43,7 +43,7 @@
|
|||
|
||||
#include "opt_apm.h"
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: apmcall.s,v 1.10 2002/10/14 02:08:38 takemura Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: apmcall.S,v 1.1 2002/11/22 15:01:16 fvdl Exp $");
|
||||
|
||||
/* LINTSTUB: include <machine/bioscall.h> */
|
||||
/* LINTSTUB: include <machine/apmvar.h> */
|
|
@ -0,0 +1,90 @@
|
|||
/* $NetBSD: bioscall.S,v 1.1 2002/11/22 15:01:16 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by John Kohl.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#include <machine/param.h>
|
||||
#include <machine/bioscall.h>
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
/* LINTSTUB: include <sys/types.h> */
|
||||
/* LINTSTUB: include <machine/bioscall.h> */
|
||||
|
||||
.globl _C_LABEL(PTDpaddr) /* from locore.s */
|
||||
|
||||
_C_LABEL(biostramp_image):
|
||||
.globl _C_LABEL(biostramp_image)
|
||||
|
||||
8:
|
||||
#include "i386/bioscall/biostramp.inc"
|
||||
9:
|
||||
|
||||
.globl _C_LABEL(biostramp_image_size)
|
||||
_C_LABEL(biostramp_image_size):
|
||||
.long 9b - 8b
|
||||
|
||||
/*
|
||||
* void bioscall(int function, struct bioscallregs *regs):
|
||||
* call the BIOS interrupt "function" from real mode with
|
||||
* registers as specified in "regs"
|
||||
* for the flags, though, only these flags are passed to the BIOS--
|
||||
* the remainder come from the flags register at the time of the call:
|
||||
* (PSL_C|PSL_PF|PSL_AF|PSL_Z|PSL_N|PSL_D|PSL_V)
|
||||
*
|
||||
* Fills in *regs with registers as returned by BIOS.
|
||||
*/
|
||||
/* LINTSTUB: Func: void bioscall(int function, struct bioscallregs *regs) */
|
||||
NENTRY(bioscall)
|
||||
pushl %ebp
|
||||
movl %esp,%ebp /* set up frame ptr */
|
||||
|
||||
movl %cr3,%eax /* save PTDB register */
|
||||
pushl %eax
|
||||
|
||||
movl _C_LABEL(PTDpaddr),%eax /* install proc0 PTD */
|
||||
movl %eax,%cr3
|
||||
|
||||
movl $(BIOSTRAMP_BASE),%eax /* address of trampoline area */
|
||||
pushl 12(%ebp)
|
||||
pushl 8(%ebp)
|
||||
call *%eax /* machdep.c initializes it */
|
||||
addl $8,%esp /* clear args from stack */
|
||||
|
||||
popl %eax
|
||||
movl %eax,%cr3 /* restore PTDB register */
|
||||
|
||||
leave
|
||||
ret
|
|
@ -0,0 +1,192 @@
|
|||
/* $NetBSD: db_dbgreg.S,v 1.1 2002/11/22 15:01:16 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1995 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
/* LINTSTUB: Empty */
|
||||
|
||||
#include <i386/include/asm.h>
|
||||
#define S_ARG0 4(%esp)
|
||||
#define S_ARG1 8(%esp)
|
||||
#define S_ARG2 12(%esp)
|
||||
#define S_ARG3 16(%esp)
|
||||
|
||||
#define B_ARG0 8(%ebp)
|
||||
#define B_ARG1 12(%ebp)
|
||||
#define B_ARG2 16(%ebp)
|
||||
#define B_ARG3 20(%ebp)
|
||||
|
||||
/*
|
||||
* void outb(unsigned char *io_port,
|
||||
* unsigned char byte)
|
||||
*
|
||||
* Output a byte to an IO port.
|
||||
*/
|
||||
ENTRY(outb)
|
||||
movl S_ARG0,%edx /* IO port address */
|
||||
movl S_ARG1,%eax /* data to output */
|
||||
outb %al,%dx /* send it out */
|
||||
ret
|
||||
|
||||
/*
|
||||
* unsigned char inb(unsigned char *io_port)
|
||||
*
|
||||
* Input a byte from an IO port.
|
||||
*/
|
||||
ENTRY(inb)
|
||||
movl S_ARG0,%edx /* IO port address */
|
||||
xor %eax,%eax /* clear high bits of register */
|
||||
inb %dx,%al /* get the byte */
|
||||
ret
|
||||
|
||||
/*
|
||||
* void outw(unsigned short *io_port,
|
||||
* unsigned short word)
|
||||
*
|
||||
* Output a word to an IO port.
|
||||
*/
|
||||
ENTRY(outw)
|
||||
movl S_ARG0,%edx /* IO port address */
|
||||
movl S_ARG1,%eax /* data to output */
|
||||
outw %ax,%dx /* send it out */
|
||||
ret
|
||||
|
||||
/*
|
||||
* unsigned short inw(unsigned short *io_port)
|
||||
*
|
||||
* Input a word from an IO port.
|
||||
*/
|
||||
ENTRY(inw)
|
||||
movl S_ARG0,%edx /* IO port address */
|
||||
xor %eax,%eax /* clear high bits of register */
|
||||
inw %dx,%ax /* get the word */
|
||||
ret
|
||||
|
||||
/*
|
||||
* void outl(unsigned int *io_port,
|
||||
* unsigned int byte)
|
||||
*
|
||||
* Output an int to an IO port.
|
||||
*/
|
||||
ENTRY(outl)
|
||||
movl S_ARG0,%edx /* IO port address */
|
||||
movl S_ARG1,%eax /* data to output */
|
||||
outl %eax,%dx /* send it out */
|
||||
ret
|
||||
|
||||
/*
|
||||
* unsigned int inl(unsigned int *io_port)
|
||||
*
|
||||
* Input an int from an IO port.
|
||||
*/
|
||||
ENTRY(inl)
|
||||
movl S_ARG0,%edx /* IO port address */
|
||||
inl %dx,%eax /* get the int */
|
||||
ret
|
||||
|
||||
|
||||
ENTRY(dr6)
|
||||
movl %db6, %eax
|
||||
ret
|
||||
|
||||
/* dr<i>(address, type, len, persistence)
|
||||
* type:
|
||||
* 00 execution (use len 00)
|
||||
* 01 data write
|
||||
* 11 data read/write
|
||||
* len:
|
||||
* 00 one byte
|
||||
* 01 two bytes
|
||||
* 11 four bytes
|
||||
*/
|
||||
ENTRY(dr0)
|
||||
movl S_ARG0, %eax
|
||||
movl %eax,_C_LABEL(dr_addr)
|
||||
movl %eax, %db0
|
||||
movl $0, %ecx
|
||||
jmp 0f
|
||||
ENTRY(dr1)
|
||||
movl S_ARG0, %eax
|
||||
movl %eax,_C_LABEL(dr_addr)+1*4
|
||||
movl %eax, %db1
|
||||
movl $2, %ecx
|
||||
jmp 0f
|
||||
ENTRY(dr2)
|
||||
movl S_ARG0, %eax
|
||||
movl %eax,_C_LABEL(dr_addr)+2*4
|
||||
movl %eax, %db2
|
||||
movl $4, %ecx
|
||||
jmp 0f
|
||||
|
||||
ENTRY(dr3)
|
||||
movl S_ARG0, %eax
|
||||
movl %eax,_C_LABEL(dr_addr)+3*4
|
||||
movl %eax, %db3
|
||||
movl $6, %ecx
|
||||
|
||||
0:
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
|
||||
movl %db7, %edx
|
||||
movl %edx,_C_LABEL(dr_addr)+4*4
|
||||
andl dr_msk(,%ecx,2),%edx /* clear out new entry */
|
||||
movl %edx,_C_LABEL(dr_addr)+5*4
|
||||
movzbl B_ARG3, %eax
|
||||
andb $3, %al
|
||||
shll %cl, %eax
|
||||
orl %eax, %edx
|
||||
|
||||
shll $1, %ecx
|
||||
|
||||
movzbl B_ARG1, %eax
|
||||
andb $3, %al
|
||||
addb $0x10, %cl
|
||||
shll %cl, %eax
|
||||
orl %eax, %edx
|
||||
|
||||
movzbl B_ARG2, %eax
|
||||
andb $3, %al
|
||||
addb $0x2, %cl
|
||||
shll %cl, %eax
|
||||
orl %eax, %edx
|
||||
|
||||
movl %edx, %db7
|
||||
movl %edx,_C_LABEL(dr_addr)+7*4
|
||||
movl %edx, %eax
|
||||
leave
|
||||
ret
|
||||
|
||||
.data
|
||||
dr_msk:
|
||||
.long ~0x000f0003
|
||||
.long ~0x00f0000c
|
||||
.long ~0x0f000030
|
||||
.long ~0xf00000c0
|
||||
_C_LABEL(dr_addr):
|
||||
.long 0,0,0,0
|
||||
.long 0,0,0,0
|
||||
.text
|
|
@ -0,0 +1,100 @@
|
|||
/* $NetBSD: freebsd_sigcode.S,v 1.1 2002/11/22 15:01:16 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
*/
|
||||
|
||||
#include "assym.h"
|
||||
|
||||
#include <sys/errno.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#include <compat/freebsd/freebsd_syscall.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
/*
|
||||
* Signal trampoline; copied to top of user stack.
|
||||
*/
|
||||
/* LINTSTUB: Var: char freebsd_sigcode[1], freebsd_esigcode[1]; */
|
||||
NENTRY(freebsd_sigcode)
|
||||
call *FREEBSD_SIGF_HANDLER(%esp)
|
||||
leal FREEBSD_SIGF_SC(%esp),%eax # scp (the call may have clobbered
|
||||
# the copy at SIGF_SCP(%esp))
|
||||
pushl %eax
|
||||
pushl %eax # junk to fake return address
|
||||
movl $FREEBSD_SYS_sigreturn,%eax
|
||||
int $0x80 # enter kernel with args on stack
|
||||
movl $FREEBSD_SYS_exit,%eax
|
||||
int $0x80 # exit if sigreturn fails
|
||||
.globl _C_LABEL(freebsd_esigcode)
|
||||
_C_LABEL(freebsd_esigcode):
|
|
@ -0,0 +1,100 @@
|
|||
/* $NetBSD: ibcs2_sigcode.S,v 1.1 2002/11/22 15:01:16 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
*/
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_vm86.h"
|
||||
#endif
|
||||
|
||||
#include "assym.h"
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <compat/ibcs2/ibcs2_syscall.h>
|
||||
|
||||
/* LINTSTUB: Var: char ibcs2_sigcode[1], ibcs2_esigcode[1]; */
|
||||
NENTRY(ibcs2_sigcode)
|
||||
/*
|
||||
* Handler has returned here as if we called it. The sigcontext
|
||||
* is on the stack after the 3 args "we" pushed.
|
||||
*/
|
||||
leal 12(%esp),%eax # get pointer to sigcontext
|
||||
movl %eax,4(%esp) # put it in the argument slot
|
||||
# fake return address already there
|
||||
movl $IBCS2_SYS_sigreturn,%eax
|
||||
int $0x80 # enter kernel with args on stack
|
||||
movl $IBCS2_SYS_exit,%eax
|
||||
int $0x80 # exit if sigreturn fails
|
||||
.globl _C_LABEL(ibcs2_esigcode)
|
||||
_C_LABEL(ibcs2_esigcode):
|
|
@ -0,0 +1,440 @@
|
|||
/* $NetBSD: in_cksum.S,v 1.1 2002/11/22 15:01:16 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Charles M. Hannum.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include "assym.h"
|
||||
|
||||
/* LINTSTUB: include <sys/types.h> */
|
||||
/* LINTSTUB: include <machine/param.h> */
|
||||
/* LINTSTUB: include <sys/mbuf.h> */
|
||||
/* LINTSTUB: include <netinet/in.h> */
|
||||
|
||||
/*
|
||||
* Checksum routine for Internet Protocol family headers.
|
||||
*
|
||||
* in_cksum(m, len)
|
||||
*
|
||||
* Registers used:
|
||||
* %eax = sum
|
||||
* %ebx = m->m_data
|
||||
* %cl = rotation count to unswap
|
||||
* %edx = m->m_len
|
||||
* %ebp = m
|
||||
* %esi = len
|
||||
*/
|
||||
|
||||
#define SWAP \
|
||||
roll $8, %eax ; \
|
||||
xorb $8, %cl
|
||||
|
||||
#define UNSWAP \
|
||||
roll %cl, %eax
|
||||
|
||||
#define MOP \
|
||||
adcl $0, %eax
|
||||
|
||||
#define ADVANCE(n) \
|
||||
leal n(%ebx), %ebx ; \
|
||||
leal -n(%edx), %edx ; \
|
||||
|
||||
#define ADDBYTE \
|
||||
SWAP ; \
|
||||
addb (%ebx), %ah
|
||||
|
||||
#define ADDWORD \
|
||||
addw (%ebx), %ax
|
||||
|
||||
#define ADD(n) \
|
||||
addl n(%ebx), %eax
|
||||
|
||||
#define ADC(n) \
|
||||
adcl n(%ebx), %eax
|
||||
|
||||
#define REDUCE \
|
||||
movzwl %ax, %edx ; \
|
||||
shrl $16, %eax ; \
|
||||
addw %dx, %ax ; \
|
||||
adcw $0, %ax
|
||||
|
||||
|
||||
/*
|
||||
* XXX KAME handles link-local scopes in a way which causes us great pain.
|
||||
* we need to special-case link-local addresses and not include the scope id
|
||||
* as part of the transport-layer pseudoheader.
|
||||
* Both ff02::/16 and fe80::/10 get this treatment.
|
||||
*
|
||||
* so, big-endian, this would be:
|
||||
* (s6_addr32[0] & 0xffc00000) == 0xfe800000
|
||||
* (s6_addr32[0] & 0xff0f) == 0xff020000
|
||||
* since we're little-endian,
|
||||
* (s6_addr32[0] & 0x0000c0ff) == 0x000080fe
|
||||
* (s6_addr32[0] & 0x00000fff) == 0x000002ff
|
||||
*/
|
||||
|
||||
#define ADD6SCOPE(n) \
|
||||
movw n(%ebx), %cx ; \
|
||||
addl %ecx,%eax ; \
|
||||
andl $0xc0ff,%ecx ; \
|
||||
cmpl $0x80fe,%ecx ; \
|
||||
je 1f ; \
|
||||
movw n(%ebx), %cx ; \
|
||||
andl $0xfff,%ecx ; \
|
||||
cmpl $0x2ff,%ecx ; \
|
||||
je 1f ; \
|
||||
movw n+2(%ebx),%cx ; \
|
||||
addl %ecx,%eax ; \
|
||||
1:
|
||||
|
||||
#if defined(INET6) && defined(INET6_MD_CKSUM)
|
||||
/*
|
||||
* XXX does not deal with jumbograms.
|
||||
*/
|
||||
/* LINTSTUB: Func: int in6_cksum(struct mbuf *m, u_int8_t nxt, u_int32_t off, u_int32_t len) */
|
||||
ENTRY(in6_cksum)
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
|
||||
movl 16(%esp), %ebp
|
||||
movzbl 20(%esp), %eax /* sum = nxt */
|
||||
movl 24(%esp), %edx /* %edx = off */
|
||||
movl 28(%esp), %esi /* %esi = len */
|
||||
testl %eax, %eax
|
||||
jz .Lmbuf_loop_0 /* skip if nxt == 0 */
|
||||
movl M_DATA(%ebp), %ebx
|
||||
addl %esi, %eax /* sum += len */
|
||||
shll $8, %eax /* sum = htons(sum) */
|
||||
xorl %ecx,%ecx
|
||||
ADD6SCOPE(IP6_SRC)
|
||||
ADD6SCOPE(IP6_DST)
|
||||
ADD(IP6_SRC+4) /* sum += ip6->ip6_src */
|
||||
ADC(IP6_SRC+8) /* sum += ip6->ip6_src */
|
||||
ADC(IP6_SRC+12) /* sum += ip6->ip6_src */
|
||||
ADC(IP6_DST+4) /* sum += ip6->ip_dst */
|
||||
ADC(IP6_DST+8) /* sum += ip6->ip_dst */
|
||||
ADC(IP6_DST+12) /* sum += ip6->ip_dst */
|
||||
|
||||
MOP
|
||||
#ifdef INET
|
||||
jmp .Lmbuf_loop_0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef INET
|
||||
/* LINTSTUB: Func: int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len) */
|
||||
ENTRY(in4_cksum)
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
|
||||
movl 16(%esp), %ebp
|
||||
movzbl 20(%esp), %eax /* sum = nxt */
|
||||
movl 24(%esp), %edx /* %edx = off */
|
||||
movl 28(%esp), %esi /* %esi = len */
|
||||
testl %eax, %eax
|
||||
jz .Lmbuf_loop_0 /* skip if nxt == 0 */
|
||||
movl M_DATA(%ebp), %ebx
|
||||
addl %esi, %eax /* sum += len */
|
||||
shll $8, %eax /* sum = htons(sum) */
|
||||
|
||||
ADD(IP_SRC) /* sum += ip->ip_src */
|
||||
ADC(IP_DST) /* sum += ip->ip_dst */
|
||||
MOP
|
||||
#endif
|
||||
.Lmbuf_loop_0:
|
||||
testl %ebp, %ebp
|
||||
jz .Lout_of_mbufs
|
||||
|
||||
movl M_DATA(%ebp), %ebx /* %ebx = m_data */
|
||||
movl M_LEN(%ebp), %ecx /* %ecx = m_len */
|
||||
movl M_NEXT(%ebp), %ebp
|
||||
|
||||
subl %ecx, %edx /* %edx = off - m_len */
|
||||
jnb .Lmbuf_loop_0
|
||||
|
||||
addl %edx, %ebx /* %ebx = m_data + off - m_len */
|
||||
negl %edx /* %edx = m_len - off */
|
||||
addl %ecx, %ebx /* %ebx = m_data + off */
|
||||
xorb %cl, %cl
|
||||
|
||||
/*
|
||||
* The len == 0 case is handled really inefficiently, by going through
|
||||
* the whole short_mbuf path once to get back to mbuf_loop_1 -- but
|
||||
* this case never happens in practice, so it's sufficient that it
|
||||
* doesn't explode.
|
||||
*/
|
||||
jmp .Lin4_entry
|
||||
|
||||
|
||||
/* LINTSTUB: Func: int in_cksum(struct mbuf *m, int len) */
|
||||
ENTRY(in_cksum)
|
||||
pushl %ebp
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
|
||||
movl 16(%esp), %ebp
|
||||
movl 20(%esp), %esi
|
||||
xorl %eax, %eax
|
||||
xorb %cl, %cl
|
||||
|
||||
.Lmbuf_loop_1:
|
||||
testl %esi, %esi
|
||||
jz .Ldone
|
||||
|
||||
.Lmbuf_loop_2:
|
||||
testl %ebp, %ebp
|
||||
jz .Lout_of_mbufs
|
||||
|
||||
movl M_DATA(%ebp), %ebx
|
||||
movl M_LEN(%ebp), %edx
|
||||
movl M_NEXT(%ebp), %ebp
|
||||
|
||||
.Lin4_entry:
|
||||
cmpl %esi, %edx
|
||||
jbe 1f
|
||||
movl %esi, %edx
|
||||
|
||||
1:
|
||||
subl %edx, %esi
|
||||
|
||||
cmpl $32, %edx
|
||||
jb .Lshort_mbuf
|
||||
|
||||
testb $3, %bl
|
||||
jz .Ldword_aligned
|
||||
|
||||
testb $1, %bl
|
||||
jz .Lbyte_aligned
|
||||
|
||||
ADDBYTE
|
||||
ADVANCE(1)
|
||||
MOP
|
||||
|
||||
testb $2, %bl
|
||||
jz .Lword_aligned
|
||||
|
||||
.Lbyte_aligned:
|
||||
ADDWORD
|
||||
ADVANCE(2)
|
||||
MOP
|
||||
|
||||
.Lword_aligned:
|
||||
.Ldword_aligned:
|
||||
testb $4, %bl
|
||||
jnz .Lqword_aligned
|
||||
|
||||
ADD(0)
|
||||
ADVANCE(4)
|
||||
MOP
|
||||
|
||||
.Lqword_aligned:
|
||||
testb $8, %bl
|
||||
jz .Loword_aligned
|
||||
|
||||
ADD(0)
|
||||
ADC(4)
|
||||
ADVANCE(8)
|
||||
MOP
|
||||
|
||||
.Loword_aligned:
|
||||
subl $128, %edx
|
||||
jb .Lfinished_128
|
||||
|
||||
.Lloop_128:
|
||||
ADD(12)
|
||||
ADC(0)
|
||||
ADC(4)
|
||||
ADC(8)
|
||||
ADC(28)
|
||||
ADC(16)
|
||||
ADC(20)
|
||||
ADC(24)
|
||||
ADC(44)
|
||||
ADC(32)
|
||||
ADC(36)
|
||||
ADC(40)
|
||||
ADC(60)
|
||||
ADC(48)
|
||||
ADC(52)
|
||||
ADC(56)
|
||||
ADC(76)
|
||||
ADC(64)
|
||||
ADC(68)
|
||||
ADC(72)
|
||||
ADC(92)
|
||||
ADC(80)
|
||||
ADC(84)
|
||||
ADC(88)
|
||||
ADC(108)
|
||||
ADC(96)
|
||||
ADC(100)
|
||||
ADC(104)
|
||||
ADC(124)
|
||||
ADC(112)
|
||||
ADC(116)
|
||||
ADC(120)
|
||||
leal 128(%ebx), %ebx
|
||||
MOP
|
||||
|
||||
subl $128, %edx
|
||||
jnb .Lloop_128
|
||||
|
||||
.Lfinished_128:
|
||||
subl $32-128, %edx
|
||||
jb .Lfinished_32
|
||||
|
||||
.Lloop_32:
|
||||
ADD(12)
|
||||
ADC(0)
|
||||
ADC(4)
|
||||
ADC(8)
|
||||
ADC(28)
|
||||
ADC(16)
|
||||
ADC(20)
|
||||
ADC(24)
|
||||
leal 32(%ebx), %ebx
|
||||
MOP
|
||||
|
||||
subl $32, %edx
|
||||
jnb .Lloop_32
|
||||
|
||||
.Lfinished_32:
|
||||
.Lshort_mbuf:
|
||||
testb $16, %dl
|
||||
jz .Lfinished_16
|
||||
|
||||
ADD(12)
|
||||
ADC(0)
|
||||
ADC(4)
|
||||
ADC(8)
|
||||
leal 16(%ebx), %ebx
|
||||
MOP
|
||||
|
||||
.Lfinished_16:
|
||||
testb $8, %dl
|
||||
jz .Lfinished_8
|
||||
|
||||
ADD(0)
|
||||
ADC(4)
|
||||
leal 8(%ebx), %ebx
|
||||
MOP
|
||||
|
||||
.Lfinished_8:
|
||||
testb $4, %dl
|
||||
jz .Lfinished_4
|
||||
|
||||
ADD(0)
|
||||
leal 4(%ebx), %ebx
|
||||
MOP
|
||||
|
||||
.Lfinished_4:
|
||||
testb $3, %dl
|
||||
jz .Lmbuf_loop_1
|
||||
|
||||
testb $2, %dl
|
||||
jz .Lfinished_2
|
||||
|
||||
ADDWORD
|
||||
leal 2(%ebx), %ebx
|
||||
MOP
|
||||
|
||||
testb $1, %dl
|
||||
jz .Lfinished_1
|
||||
|
||||
.Lfinished_2:
|
||||
ADDBYTE
|
||||
MOP
|
||||
|
||||
.Lfinished_1:
|
||||
.Lmbuf_done:
|
||||
testl %esi, %esi
|
||||
jnz .Lmbuf_loop_2
|
||||
|
||||
.Ldone:
|
||||
UNSWAP
|
||||
REDUCE
|
||||
notw %ax
|
||||
|
||||
.Lreturn:
|
||||
popl %esi
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
.Lout_of_mbufs:
|
||||
pushl $1f
|
||||
call _C_LABEL(printf)
|
||||
leal 4(%esp), %esp
|
||||
jmp .Lreturn
|
||||
1:
|
||||
.asciz "cksum: out of data\n"
|
|
@ -0,0 +1,183 @@
|
|||
/* $NetBSD: kvm86call.S,v 1.1 2002/11/22 15:01:16 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 Jonathan Lemon
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2002
|
||||
* Matthias Drochner. All rights reserved.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
|
||||
*
|
||||
* $FreeBSD: src/sys/i386/i386/vm86bios.s,v 1.28 2001/12/11 23:33:40 jhb Exp $
|
||||
*/
|
||||
|
||||
#include <machine/param.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
#include "assym.h"
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: kvm86call.S,v 1.1 2002/11/22 15:01:16 fvdl Exp $");
|
||||
|
||||
.data
|
||||
.align 4
|
||||
|
||||
/* flag for trap() */
|
||||
.globl kvm86_incall
|
||||
kvm86_incall: .long 0
|
||||
|
||||
/* XXX arguments for kvm86call() */
|
||||
.globl vm86pcb, vm86newptd, vm86frame, vm86pgtableva
|
||||
.globl vm86tssd0, vm86tssd1
|
||||
vm86pcb: .long 0
|
||||
vm86newptd: .long 0
|
||||
vm86frame: .long 0
|
||||
vm86pgtableva: .long 0
|
||||
vm86tssd0: .long 0
|
||||
vm86tssd1: .long 0
|
||||
|
||||
/* locals */
|
||||
SCRARGFRAME: .long 0
|
||||
SCRSTACK: .long 0
|
||||
SCRTSS0: .long 0
|
||||
SCRTSS1: .long 0
|
||||
|
||||
.text
|
||||
|
||||
/* int kvm86_call(struct trapframe *) */
|
||||
ENTRY(kvm86_call)
|
||||
pushl %ebp
|
||||
movl %esp,%ebp /* set up frame ptr */
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
pushl %ebx
|
||||
pushl %fs
|
||||
pushl %gs
|
||||
|
||||
movl 8(%ebp),%eax
|
||||
movl %eax,SCRARGFRAME /* save argument pointer */
|
||||
|
||||
movl vm86frame,%edi /* target frame location */
|
||||
movl SCRARGFRAME,%esi /* source (set on entry) */
|
||||
movl $FRAMESIZE/4,%ecx /* sizeof(struct trapframe)/4 */
|
||||
cld
|
||||
rep
|
||||
movsl /* copy frame to new stack */
|
||||
|
||||
movl _C_LABEL(cpu_info_primary)+CPU_INFO_CURPROC,%ecx
|
||||
movl P_ADDR(%ecx),%eax
|
||||
pushl %eax /* save curpcb */
|
||||
movl vm86pcb,%eax
|
||||
movl %eax,P_ADDR(%ecx) /* set curpcb to vm86pcb */
|
||||
|
||||
movl _C_LABEL(gdt),%eax
|
||||
movl P_MD_TSS_SEL(%ecx),%edi
|
||||
|
||||
andl $~0x0200,4(%eax,%edi,1) /* reset "task busy" */
|
||||
|
||||
movl 0(%eax,%edi,1),%edx
|
||||
movl %edx,SCRTSS0 /* save first word */
|
||||
movl 4(%eax,%edi,1),%edx
|
||||
movl %edx,SCRTSS1 /* save second word */
|
||||
|
||||
movl vm86tssd0,%edx /* vm86 tssd entry */
|
||||
movl %edx,0(%eax,%edi,1)
|
||||
movl vm86tssd1,%edx /* vm86 tssd entry */
|
||||
movl %edx,4(%eax,%edi,1)
|
||||
ltr %di
|
||||
|
||||
movl %cr3,%eax
|
||||
pushl %eax /* save address space */
|
||||
movl PTDpaddr,%ecx
|
||||
movl %ecx,%ebx
|
||||
addl $KERNBASE,%ebx /* va of Idle PTD */
|
||||
movl 0(%ebx),%eax
|
||||
pushl %eax /* old pde */
|
||||
pushl %ebx /* keep address for reuse */
|
||||
|
||||
movl %esp,SCRSTACK /* save current stack location */
|
||||
|
||||
movl vm86newptd,%eax /* mapping for vm86 page table */
|
||||
movl %eax,0(%ebx) /* ... install as PTD entry 0 */
|
||||
|
||||
movl %ecx,%cr3 /* new page tables */
|
||||
movl vm86frame,%esp /* switch to new stack */
|
||||
|
||||
movl $1,kvm86_incall /* set flag for trap() */
|
||||
|
||||
/* INTRFASTEXIT */
|
||||
popl %gs
|
||||
popl %fs
|
||||
popl %es
|
||||
popl %ds
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebp
|
||||
popl %ebx
|
||||
popl %edx
|
||||
popl %ecx
|
||||
popl %eax
|
||||
addl $8,%esp
|
||||
iret
|
||||
|
||||
|
||||
/* void kvm86_ret(struct trapframe *, int) */
|
||||
ENTRY(kvm86_ret)
|
||||
pushl %ebp
|
||||
movl %esp,%ebp /* set up frame ptr */
|
||||
|
||||
movl 8(%ebp),%esi /* source */
|
||||
movl SCRARGFRAME,%edi /* destination */
|
||||
movl $FRAMESIZE/4,%ecx /* size */
|
||||
cld
|
||||
rep
|
||||
movsl /* copy frame to original frame */
|
||||
|
||||
movl SCRSTACK,%esp /* back to old stack */
|
||||
popl %ebx /* saved va of Idle PTD */
|
||||
popl %eax
|
||||
movl %eax,0(%ebx) /* restore old pde */
|
||||
popl %eax
|
||||
movl %eax,%cr3 /* install old page table */
|
||||
|
||||
movl $0,kvm86_incall /* reset trapflag */
|
||||
|
||||
movl _C_LABEL(gdt),%eax
|
||||
movl _C_LABEL(cpu_info_primary)+CPU_INFO_CURPROC,%ecx
|
||||
movl P_MD_TSS_SEL(%ecx),%edi
|
||||
movl SCRTSS0, %edx
|
||||
movl %edx, 0(%eax,%edi,1) /* restore first word */
|
||||
movl SCRTSS1, %edx
|
||||
movl %edx, 4(%eax,%edi,1) /* restore second word */
|
||||
ltr %di
|
||||
|
||||
popl %eax /* restore curpcb */
|
||||
movl %eax, P_ADDR(%ecx)
|
||||
|
||||
movl 12(%ebp), %eax /* will be kvm86_call()'s retval */
|
||||
|
||||
popl %gs
|
||||
popl %fs
|
||||
popl %ebx
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebp
|
||||
ret /* back to kvm86_call()'s caller */
|
|
@ -0,0 +1,117 @@
|
|||
/* $NetBSD: linux_sigcode.S,v 1.1 2002/11/22 15:01:16 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
*/
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_vm86.h"
|
||||
#endif
|
||||
|
||||
#include "assym.h"
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <machine/psl.h>
|
||||
|
||||
#include <compat/linux/linux_syscall.h>
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Signal trampoline; copied to top of user stack.
|
||||
*/
|
||||
/* LINTSTUB: Var: char linux_sigcode[1], linux_esigcode[1]; */
|
||||
NENTRY(linux_sigcode)
|
||||
call *LINUX_SIGF_HANDLER(%esp)
|
||||
leal LINUX_SIGF_SC(%esp),%ebx # scp (the call may have clobbered the
|
||||
# copy at SIGF_SCP(%esp))
|
||||
pushl %eax # junk to fake return address
|
||||
movl $LINUX_SYS_sigreturn,%eax
|
||||
int $0x80 # enter kernel with args on stack
|
||||
movl $LINUX_SYS_exit,%eax
|
||||
int $0x80 # exit if sigreturn fails
|
||||
.globl _C_LABEL(linux_esigcode)
|
||||
_C_LABEL(linux_esigcode):
|
||||
|
||||
/* LINTSTUB: Var: char linux_rt_sigcode[1], linux_rt_esigcode[1]; */
|
||||
NENTRY(linux_rt_sigcode)
|
||||
call *LINUX_SIGF_HANDLER(%esp)
|
||||
leal LINUX_SIGF_SC(%esp),%ebx # scp (the call may have clobbered the
|
||||
# copy at SIGF_SCP(%esp))
|
||||
pushl %eax # junk to fake return address
|
||||
movl $LINUX_SYS_rt_sigreturn,%eax
|
||||
int $0x80 # enter kernel with args on stack
|
||||
movl $LINUX_SYS_exit,%eax
|
||||
int $0x80 # exit if sigreturn fails
|
||||
.globl _C_LABEL(linux_rt_esigcode)
|
||||
_C_LABEL(linux_rt_esigcode):
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,190 @@
|
|||
/* $NetBSD: mach_sigcode.S,v 1.1 2002/11/22 15:01:17 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
*/
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_vm86.h"
|
||||
#endif
|
||||
|
||||
#include "assym.h"
|
||||
|
||||
#include <machine/psl.h>
|
||||
#include <machine/segments.h>
|
||||
#include <machine/trap.h>
|
||||
#include <compat/mach/mach_syscall.h>
|
||||
|
||||
/*
|
||||
* override user-land alignment before including asm.h
|
||||
*/
|
||||
#ifdef __ELF__
|
||||
#define ALIGN_DATA .align 4
|
||||
#define ALIGN_TEXT .align 4,0x90 /* 4-byte boundaries, NOP-filled */
|
||||
#define SUPERALIGN_TEXT .align 16,0x90 /* 16-byte boundaries better for 486 */
|
||||
#else
|
||||
#define ALIGN_DATA .align 2
|
||||
#define ALIGN_TEXT .align 2,0x90 /* 4-byte boundaries, NOP-filled */
|
||||
#define SUPERALIGN_TEXT .align 4,0x90 /* 16-byte boundaries better for 486 */
|
||||
#endif
|
||||
#define _ALIGN_TEXT ALIGN_TEXT
|
||||
#include <machine/asm.h>
|
||||
|
||||
/*
|
||||
* These are used on interrupt or trap entry or exit.
|
||||
*/
|
||||
#define INTRENTRY \
|
||||
pushl %eax ; \
|
||||
pushl %ecx ; \
|
||||
pushl %edx ; \
|
||||
pushl %ebx ; \
|
||||
movl $GSEL(GDATA_SEL, SEL_KPL),%eax ; \
|
||||
pushl %ebp ; \
|
||||
pushl %esi ; \
|
||||
pushl %edi ; \
|
||||
pushl %ds ; \
|
||||
pushl %es ; \
|
||||
movl %eax,%ds ; \
|
||||
movl %eax,%es ; \
|
||||
pushl %fs ; \
|
||||
pushl %gs ; \
|
||||
movl %eax,%gs ; \
|
||||
movl $GSEL(GCPU_SEL, SEL_KPL),%eax ; \
|
||||
movl %eax,%fs
|
||||
|
||||
#define INTRFASTEXIT \
|
||||
popl %gs ; \
|
||||
popl %fs ; \
|
||||
popl %es ; \
|
||||
popl %ds ; \
|
||||
popl %edi ; \
|
||||
popl %esi ; \
|
||||
popl %ebp ; \
|
||||
popl %ebx ; \
|
||||
popl %edx ; \
|
||||
popl %ecx ; \
|
||||
popl %eax ; \
|
||||
addl $8,%esp ; \
|
||||
iret
|
||||
|
||||
#define _CONCAT(a,b) a/**/b
|
||||
|
||||
#if defined(MULTIPROCESSOR)
|
||||
#define CPUVAR(off) %fs:_CONCAT(CPU_INFO_,off)
|
||||
#else
|
||||
#define CPUVAR(off) _C_LABEL(cpu_info_primary)+_CONCAT(CPU_INFO_,off)
|
||||
#endif
|
||||
#define CHECK_ASTPENDING() cmpl $0,CPUVAR(ASTPENDING)
|
||||
#define CLEAR_ASTPENDING() movl $0,CPUVAR(ASTPENDING)
|
||||
|
||||
/*
|
||||
* Signal trampoline; copied to top of user stack.
|
||||
*/
|
||||
/* LINTSTUB: Var: char mach_sigcode[1], mach_esigcode[1]; */
|
||||
NENTRY(mach_sigcode)
|
||||
/*
|
||||
call MACH_SIGF_HANDLER(%esp)
|
||||
leal MACH_SIGF_UC(%esp),%eax # ucp (the call may have clobbered the
|
||||
# copy at SIGF_UCP(%esp))
|
||||
pushl %eax
|
||||
pushl $1 # setcontext(p) == syscontext(1, p)
|
||||
pushl %eax # junk to fake return address
|
||||
movl $MACH_SYS_context,%eax
|
||||
int $0x80 # enter kernel with args on stack
|
||||
movl $MACH_SYS_exit,%eax
|
||||
int $0x80 # exit if sigreturn fails
|
||||
*/
|
||||
.globl _C_LABEL(mach_esigcode)
|
||||
_C_LABEL(mach_esigcode):
|
||||
|
||||
IDTVEC(mach_trap)
|
||||
/* Set eflags in trap frame. */
|
||||
pushfl
|
||||
popl 8(%esp)
|
||||
pushl $7 # size of instruction for restart
|
||||
pushl $T_ASTFLT # trap # for doing ASTs
|
||||
INTRENTRY
|
||||
movl CPUVAR(CURPROC),%edx
|
||||
movl %esp,P_MD_REGS(%edx) # save pointer to frame
|
||||
call _C_LABEL(mach_trap)
|
||||
2: /* Check for ASTs on exit to user mode. */
|
||||
cli
|
||||
CHECK_ASTPENDING()
|
||||
je 1f
|
||||
/* Always returning to user mode here. */
|
||||
CLEAR_ASTPENDING()
|
||||
sti
|
||||
/* Pushed T_ASTFLT into tf_trapno on entry. */
|
||||
call _C_LABEL(trap)
|
||||
jmp 2b
|
||||
1: INTRFASTEXIT
|
|
@ -0,0 +1,115 @@
|
|||
/* $NetBSD: microtime.S,v 1.1 2002/11/22 15:01:17 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <dev/isa/isareg.h>
|
||||
#include <dev/ic/i8253reg.h>
|
||||
|
||||
/* LINTSTUB: include <sys/time.h> */
|
||||
|
||||
#define IRQ_BIT(irq_num) (1 << ((irq_num) % 8))
|
||||
#define IRQ_BYTE(irq_num) ((irq_num) >> 3)
|
||||
|
||||
/* LINTSTUB: Func: void i8254_microtime(struct timeval *tv) */
|
||||
ENTRY(i8254_microtime)
|
||||
# clear registers and do whatever we can up front
|
||||
pushl %edi
|
||||
pushl %ebx
|
||||
xorl %edx,%edx
|
||||
movl $(TIMER_SEL0|TIMER_LATCH),%eax
|
||||
|
||||
cli # disable interrupts
|
||||
|
||||
# select timer 0 and latch its counter
|
||||
outb %al,$IO_TIMER1+TIMER_MODE
|
||||
inb $IO_ICU1,%al # as close to timer latch as possible
|
||||
movb %al,%ch # %ch is current ICU mask
|
||||
|
||||
# Read counter value into [%al %dl], LSB first
|
||||
inb $IO_TIMER1+TIMER_CNTR0,%al
|
||||
movb %al,%dl # %dl has LSB
|
||||
inb $IO_TIMER1+TIMER_CNTR0,%al # %al has MSB
|
||||
|
||||
# save state of IIR in ICU, and of ipending, for later perusal
|
||||
movb _C_LABEL(ipending) + IRQ_BYTE(0),%cl # %cl is interrupt pending
|
||||
|
||||
# save the current value of _time
|
||||
movl _C_LABEL(time),%edi # get time.tv_sec
|
||||
movl _C_LABEL(time)+4,%ebx # and time.tv_usec
|
||||
|
||||
sti # enable interrupts, we're done
|
||||
|
||||
# At this point we've collected all the state we need to
|
||||
# compute the time. First figure out if we've got a pending
|
||||
# interrupt. If the IRQ0 bit is set in ipending we've taken
|
||||
# a clock interrupt without incrementing time, so we bump
|
||||
# time.tv_usec by a tick. Otherwise if the ICU shows a pending
|
||||
# interrupt for IRQ0 we (or the caller) may have blocked an interrupt
|
||||
# with the cli. If the counter is not a very small value (3 as
|
||||
# a heuristic), i.e. in pre-interrupt state, we add a tick to
|
||||
# time.tv_usec
|
||||
|
||||
testb $IRQ_BIT(0),%cl # pending interrupt?
|
||||
jnz 1f # yes, increment count
|
||||
|
||||
testb $IRQ_BIT(0),%ch # hardware interrupt pending?
|
||||
jz 2f # no, continue
|
||||
testb %al,%al # MSB zero?
|
||||
jnz 1f # no, add a tick
|
||||
cmpb $3,%dl # is this small number?
|
||||
jbe 2f # yes, continue
|
||||
1: addl _C_LABEL(isa_timer_tick),%ebx # add a tick
|
||||
|
||||
# We've corrected for pending interrupts. Now do a table lookup
|
||||
# based on each of the high and low order counter bytes to increment
|
||||
# time.tv_usec
|
||||
2: movw _C_LABEL(isa_timer_msb_table)(,%eax,2),%ax
|
||||
subw _C_LABEL(isa_timer_lsb_table)(,%edx,2),%ax
|
||||
addl %eax,%ebx # add msb increment
|
||||
|
||||
# Normalize the struct timeval. We know the previous increments
|
||||
# will be less than a second, so we'll only need to adjust accordingly
|
||||
cmpl $1000000,%ebx # carry in timeval?
|
||||
jb 3f
|
||||
subl $1000000,%ebx # adjust usec
|
||||
incl %edi # bump sec
|
||||
|
||||
3: movl 12(%esp),%ecx # load timeval pointer arg
|
||||
movl %edi,(%ecx) # tvp->tv_sec = sec
|
||||
movl %ebx,4(%ecx) # tvp->tv_usec = usec
|
||||
|
||||
popl %ebx
|
||||
popl %edi
|
||||
ret
|
|
@ -0,0 +1,264 @@
|
|||
/* $NetBSD: mptramp.S,v 1.1 2002/11/22 15:01:18 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by RedBack Networks Inc.
|
||||
*
|
||||
* Author: Bill Sommerfeld
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Stefan Grefen
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR AND 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.
|
||||
*/
|
||||
/*
|
||||
* MP startup ...
|
||||
* the stuff from cpu_spinup_trampoline to mp_startup
|
||||
* is copied into the first 640 KB
|
||||
*
|
||||
* We startup the processors now when the kthreads become ready.
|
||||
* The steps are:
|
||||
* 1) Get the processors running kernel-code from a special
|
||||
* page-table and stack page, do chip identification.
|
||||
* 2) halt the processors waiting for them to be enabled
|
||||
* by a idle-thread
|
||||
*/
|
||||
|
||||
#include "opt_mpbios.h" /* for MPDEBUG */
|
||||
|
||||
#include "assym.h"
|
||||
#include <machine/param.h>
|
||||
#include <machine/asm.h>
|
||||
#include <machine/specialreg.h>
|
||||
#include <machine/segments.h>
|
||||
#include <machine/mpbiosvar.h>
|
||||
#include <machine/i82489reg.h>
|
||||
#include <machine/gdt.h>
|
||||
|
||||
#define GDTE(a,b) .byte 0xff,0xff,0x0,0x0,0x0,a,b,0x0
|
||||
#define _RELOC(x) ((x) - KERNBASE)
|
||||
#define RELOC(x) _RELOC(_C_LABEL(x))
|
||||
|
||||
#define _TRMP_LABEL(a) a = . - _C_LABEL(cpu_spinup_trampoline) + MP_TRAMPOLINE
|
||||
|
||||
#ifdef MPDEBUG
|
||||
|
||||
/*
|
||||
* Debug code to stop aux. processors in various stages based on the
|
||||
* value in cpu_trace.
|
||||
*
|
||||
* %edi points at cpu_trace; cpu_trace[0] is the "hold point";
|
||||
* cpu_trace[1] is the point which the cpu has reached.
|
||||
* cpu_trace[2] is the last value stored by HALTT.
|
||||
*/
|
||||
|
||||
#define HALT(x) 1: movl (%edi),%ebx;cmpl $ x,%ebx ; jle 1b ; movl $x,4(%edi)
|
||||
#define HALTT(x,y) movl y,8(%edi); HALT(x)
|
||||
#else
|
||||
#define HALT(x) /**/
|
||||
#define HALTT(x,y) /**/
|
||||
#endif
|
||||
|
||||
.globl _C_LABEL(cpu),_C_LABEL(cpu_id),_C_LABEL(cpu_vendor)
|
||||
.globl _C_LABEL(cpuid_level),_C_LABEL(cpu_feature)
|
||||
.globl _C_LABEL(mpidle)
|
||||
|
||||
.global _C_LABEL(cpu_spinup_trampoline)
|
||||
.global _C_LABEL(cpu_spinup_trampoline_end)
|
||||
.global _C_LABEL(cpu_hatch)
|
||||
.global _C_LABEL(mp_pdirpa)
|
||||
.global _C_LABEL(gdt), _C_LABEL(local_apic)
|
||||
|
||||
.text
|
||||
.align 4,0x0
|
||||
.code16
|
||||
_C_LABEL(cpu_spinup_trampoline):
|
||||
cli
|
||||
xorw %ax,%ax
|
||||
movw %ax, %ds
|
||||
movw %ax, %es
|
||||
movw %ax, %ss
|
||||
data32 addr32 lgdt (gdt_desc) # load flat descriptor table
|
||||
movl %cr0, %eax # get cr0
|
||||
orl $0x1, %eax # enable protected mode
|
||||
movl %eax, %cr0 # doit
|
||||
movl $0x10, %eax # data segment
|
||||
movw %ax, %ds
|
||||
movw %ax, %ss
|
||||
movw %ax, %es
|
||||
movw %ax, %fs
|
||||
movw %ax, %gs
|
||||
ljmpl $0x8, $mp_startup
|
||||
.code32
|
||||
|
||||
_TRMP_LABEL(mp_startup)
|
||||
movl $ (MP_TRAMPOLINE+NBPG-16),%esp # bootstrap stack end,
|
||||
# with scratch space..
|
||||
|
||||
#ifdef MPDEBUG
|
||||
leal RELOC(cpu_trace),%edi
|
||||
#endif
|
||||
|
||||
HALT(0x1)
|
||||
/* First, reset the PSL. */
|
||||
pushl $PSL_MBO
|
||||
popfl
|
||||
|
||||
movl RELOC(mp_pdirpa),%ecx
|
||||
HALTT(0x5,%ecx)
|
||||
|
||||
/* Load base of page directory and enable mapping. */
|
||||
movl %ecx,%cr3 # load ptd addr into mmu
|
||||
movl %cr0,%eax # get control word
|
||||
# enable paging & NPX emulation
|
||||
orl $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_EM|CR0_MP|CR0_WP),%eax
|
||||
movl %eax,%cr0 # and let's page NOW!
|
||||
|
||||
#ifdef MPDEBUG
|
||||
leal _C_LABEL(cpu_trace),%edi
|
||||
#endif
|
||||
HALT(0x6)
|
||||
|
||||
# ok, we're now running with paging enabled and sharing page tables with cpu0.
|
||||
# figure out which processor we really are, what stack we should be on, etc.
|
||||
|
||||
movl _C_LABEL(local_apic)+LAPIC_ID,%ecx
|
||||
shrl $LAPIC_ID_SHIFT,%ecx
|
||||
leal 0(,%ecx,4),%ecx
|
||||
movl _C_LABEL(cpu_info)(%ecx),%ecx
|
||||
|
||||
HALTT(0x7, %ecx)
|
||||
|
||||
# %ecx points at our cpu_info structure..
|
||||
|
||||
movw $((MAXGDTSIZ*8) - 1), 6(%esp) # prepare segment descriptor
|
||||
movl CPU_INFO_GDT(%ecx), %eax # for our real gdt
|
||||
movl %eax, 8(%esp)
|
||||
lgdt 6(%esp)
|
||||
HALT(0x8)
|
||||
jmp 1f
|
||||
nop
|
||||
1:
|
||||
HALT(0x12)
|
||||
movl $GSEL(GDATA_SEL, SEL_KPL),%eax #switch to new segment
|
||||
movl %eax,%ds
|
||||
movl %eax,%es
|
||||
movl %eax,%ss
|
||||
HALT(0x13)
|
||||
pushl $GSEL(GCODE_SEL, SEL_KPL)
|
||||
pushl $mp_cont
|
||||
HALT(0x14)
|
||||
lret
|
||||
.align 4,0x0
|
||||
_TRMP_LABEL(gdt_table)
|
||||
.word 0x0,0x0,0x0,0x0 # null GDTE
|
||||
GDTE(0x9f,0xcf) # Kernel text
|
||||
GDTE(0x93,0xcf) # Kernel data
|
||||
_TRMP_LABEL(gdt_desc)
|
||||
.word 0x17 # limit 3 entries
|
||||
.long gdt_table # base of gdt
|
||||
|
||||
_C_LABEL(cpu_spinup_trampoline_end): #end of code copied to MP_TRAMPOLINE
|
||||
mp_cont:
|
||||
HALT(0x15)
|
||||
|
||||
movl CPU_INFO_IDLE_PCB(%ecx),%esi
|
||||
|
||||
# %esi now points at our PCB.
|
||||
|
||||
HALTT(0x19, %esi)
|
||||
|
||||
movl PCB_ESP(%esi),%esp
|
||||
movl PCB_EBP(%esi),%ebp
|
||||
|
||||
HALT(0x20)
|
||||
/* Switch address space. */
|
||||
movl PCB_CR3(%esi),%eax
|
||||
HALTT(0x22, %eax)
|
||||
movl %eax,%cr3
|
||||
HALT(0x25)
|
||||
/* load segment registers. */
|
||||
movl $GSEL(GCPU_SEL, SEL_KPL),%eax
|
||||
HALTT(0x26,%eax)
|
||||
movl %eax,%fs
|
||||
xorl %eax,%eax
|
||||
HALTT(0x27,%eax)
|
||||
movl %eax,%gs
|
||||
movl PCB_CR0(%esi),%eax
|
||||
HALTT(0x28,%eax)
|
||||
movl %eax,%cr0
|
||||
HALTT(0x30,%ecx)
|
||||
pushl %ecx
|
||||
call _C_LABEL(cpu_hatch)
|
||||
HALT(0x33)
|
||||
xorl %esi,%esi
|
||||
jmp _C_LABEL(mpidle)
|
||||
|
||||
.data
|
||||
_C_LABEL(mp_pdirpa):
|
||||
.long 0
|
||||
#ifdef MPDEBUG
|
||||
.global _C_LABEL(cpu_trace)
|
||||
_C_LABEL(cpu_trace):
|
||||
.long 0x40
|
||||
.long 0xff
|
||||
.long 0xff
|
||||
#endif
|
|
@ -0,0 +1,146 @@
|
|||
/* $NetBSD: spl.S,v 1.1 2002/11/22 15:01:18 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "opt_vm86.h"
|
||||
#include <machine/asm.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/segments.h>
|
||||
#include <machine/frameasm.h>
|
||||
|
||||
#include "assym.h"
|
||||
|
||||
.data
|
||||
.globl _C_LABEL(netisr)
|
||||
#ifndef MULTIPROCESSOR
|
||||
.globl _C_LABEL(astpending)
|
||||
#endif
|
||||
.text
|
||||
|
||||
#if 0
|
||||
#if defined(PROF) || defined(GPROF)
|
||||
/*
|
||||
* XXXX TODO
|
||||
*/
|
||||
.globl _C_LABEL(splhigh), _C_LABEL(splx)
|
||||
|
||||
ALIGN_TEXT
|
||||
_C_LABEL(splhigh):
|
||||
movl $IPL_HIGH,%eax
|
||||
xchgl %eax,CPUVAR(ILEVEL)
|
||||
ret
|
||||
|
||||
ALIGN_TEXT
|
||||
_C_LABEL(splx):
|
||||
movl 4(%esp),%eax
|
||||
movl %eax,CPUVAR(ILEVEL)
|
||||
testl %eax,%eax
|
||||
jnz _C_LABEL(Xspllower)
|
||||
ret
|
||||
#endif /* PROF || GPROF */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Process pending interrupts.
|
||||
*
|
||||
* Important registers:
|
||||
* ebx - cpl
|
||||
* esi - address to resume loop at
|
||||
* edi - scratch for Xsoftnet
|
||||
*/
|
||||
IDTVEC(spllower)
|
||||
pushl %ebx
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
movl CPUVAR(ILEVEL),%ebx # save priority
|
||||
movl $1f,%esi # address to resume loop at
|
||||
1: movl %ebx,%eax # get cpl
|
||||
movl CPUVAR(IUNMASK)(,%eax,4),%eax
|
||||
andl CPUVAR(IPENDING),%eax # any non-masked bits left?
|
||||
jz 2f
|
||||
bsfl %eax,%eax
|
||||
btrl %eax,CPUVAR(IPENDING)
|
||||
jnc 1b
|
||||
movl CPUVAR(ISOURCES)(,%eax,4),%eax
|
||||
jmp *IS_RECURSE(%eax)
|
||||
2: popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
ret
|
||||
|
||||
/*
|
||||
* Handle return from interrupt after device handler finishes.
|
||||
*
|
||||
* Important registers:
|
||||
* ebx - cpl to restore
|
||||
* esi - address to resume loop at
|
||||
* edi - scratch for Xsoftnet
|
||||
*/
|
||||
IDTVEC(doreti)
|
||||
popl %ebx # get previous priority
|
||||
movl %ebx,CPUVAR(ILEVEL)
|
||||
decl CPUVAR(IDEPTH)
|
||||
movl $1f,%esi # address to resume loop at
|
||||
1: movl %ebx,%eax
|
||||
movl CPUVAR(IUNMASK)(,%eax,4),%eax
|
||||
andl CPUVAR(IPENDING),%eax
|
||||
jz 2f
|
||||
bsfl %eax,%eax # slow, but not worth optimizing
|
||||
btrl %eax,CPUVAR(IPENDING)
|
||||
jnc 1b # some intr cleared the in-memory bit
|
||||
movl CPUVAR(ISOURCES)(,%eax, 4),%eax
|
||||
jmp *IS_RESUME(%eax)
|
||||
2: /* Check for ASTs on exit to user mode. */
|
||||
CHECK_ASTPENDING()
|
||||
cli
|
||||
je 3f
|
||||
testb $SEL_RPL,TF_CS(%esp)
|
||||
#ifdef VM86
|
||||
jnz 4f
|
||||
testl $PSL_VM,TF_EFLAGS(%esp)
|
||||
#endif
|
||||
jz 3f
|
||||
4: CLEAR_ASTPENDING()
|
||||
sti
|
||||
movl $T_ASTFLT,TF_TRAPNO(%esp) /* XXX undo later.. */
|
||||
/* Pushed T_ASTFLT into tf_trapno on entry. */
|
||||
call _C_LABEL(trap)
|
||||
cli
|
||||
jmp 2b
|
||||
3:
|
||||
INTRFASTEXIT
|
|
@ -0,0 +1,179 @@
|
|||
/* $NetBSD: svr4_sigcode.S,v 1.1 2002/11/22 15:01:18 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
*/
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_vm86.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
#endif
|
||||
|
||||
#include "assym.h"
|
||||
|
||||
#include <machine/psl.h>
|
||||
#include <machine/segments.h>
|
||||
#include <machine/trap.h>
|
||||
#include <compat/svr4/svr4_syscall.h>
|
||||
|
||||
/*
|
||||
* override user-land alignment before including asm.h
|
||||
*/
|
||||
#ifdef __ELF__
|
||||
#define ALIGN_DATA .align 4
|
||||
#define ALIGN_TEXT .align 4,0x90 /* 4-byte boundaries, NOP-filled */
|
||||
#define SUPERALIGN_TEXT .align 16,0x90 /* 16-byte boundaries better for 486 */
|
||||
#else
|
||||
#define ALIGN_DATA .align 2
|
||||
#define ALIGN_TEXT .align 2,0x90 /* 4-byte boundaries, NOP-filled */
|
||||
#define SUPERALIGN_TEXT .align 4,0x90 /* 16-byte boundaries better for 486 */
|
||||
#endif
|
||||
#define _ALIGN_TEXT ALIGN_TEXT
|
||||
#include <machine/asm.h>
|
||||
|
||||
/*
|
||||
* These are used on interrupt or trap entry or exit.
|
||||
*/
|
||||
#define INTRENTRY \
|
||||
pushl %eax ; \
|
||||
pushl %ecx ; \
|
||||
pushl %edx ; \
|
||||
pushl %ebx ; \
|
||||
movl $GSEL(GDATA_SEL, SEL_KPL),%eax ; \
|
||||
pushl %ebp ; \
|
||||
pushl %esi ; \
|
||||
pushl %edi ; \
|
||||
pushl %ds ; \
|
||||
pushl %es ; \
|
||||
movw %ax,%ds ; \
|
||||
movw %ax,%es ; \
|
||||
pushl %fs ; \
|
||||
pushl %gs ; \
|
||||
movw %ax,%gs ; \
|
||||
movw $GSEL(GCPU_SEL, SEL_KPL),%ax ; \
|
||||
movw %ax,%fs
|
||||
|
||||
#define INTRFASTEXIT \
|
||||
popl %gs ; \
|
||||
popl %fs ; \
|
||||
popl %es ; \
|
||||
popl %ds ; \
|
||||
popl %edi ; \
|
||||
popl %esi ; \
|
||||
popl %ebp ; \
|
||||
popl %ebx ; \
|
||||
popl %edx ; \
|
||||
popl %ecx ; \
|
||||
popl %eax ; \
|
||||
addl $8,%esp ; \
|
||||
iret
|
||||
|
||||
#define _CONCAT(a,b) a/**/b
|
||||
|
||||
#define CHECK_ASTPENDING() cmpl $0,CPUVAR(ASTPENDING)
|
||||
#define CLEAR_ASTPENDING() movl $0,CPUVAR(ASTPENDING)
|
||||
|
||||
/*
|
||||
* Signal trampoline; copied to top of user stack.
|
||||
*/
|
||||
/* LINTSTUB: Var: char svr4_sigcode[1], svr4_esigcode[1]; */
|
||||
NENTRY(svr4_sigcode)
|
||||
call *SVR4_SIGF_HANDLER(%esp)
|
||||
leal SVR4_SIGF_UC(%esp),%eax # ucp (the call may have clobbered the
|
||||
# copy at SIGF_UCP(%esp))
|
||||
pushl %eax
|
||||
pushl $1 # setcontext(p) == syscontext(1, p)
|
||||
pushl %eax # junk to fake return address
|
||||
movl $SVR4_SYS_context,%eax
|
||||
int $0x80 # enter kernel with args on stack
|
||||
movl $SVR4_SYS_exit,%eax
|
||||
int $0x80 # exit if sigreturn fails
|
||||
.globl _C_LABEL(svr4_esigcode)
|
||||
_C_LABEL(svr4_esigcode):
|
||||
|
||||
IDTVEC(svr4_fasttrap)
|
||||
pushl $2 # size of instruction for restart
|
||||
pushl $T_ASTFLT # trap # for doing ASTs
|
||||
INTRENTRY
|
||||
call _C_LABEL(svr4_fasttrap)
|
||||
2: /* Check for ASTs on exit to user mode. */
|
||||
cli
|
||||
CHECK_ASTPENDING()
|
||||
je 1f
|
||||
/* Always returning to user mode here. */
|
||||
CLEAR_ASTPENDING()
|
||||
sti
|
||||
/* Pushed T_ASTFLT into tf_trapno on entry. */
|
||||
call _C_LABEL(trap)
|
||||
jmp 2b
|
||||
1: INTRFASTEXIT
|
|
@ -0,0 +1,903 @@
|
|||
/* $NetBSD: vector.S,v 1.1 2002/11/22 15:01:18 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 (c) Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Frank van der Linden for Wasabi Systems, Inc.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
#include "opt_ipkdb.h"
|
||||
|
||||
#include <machine/i8259.h>
|
||||
#include <machine/i82093reg.h>
|
||||
#include <machine/i82489reg.h>
|
||||
#include <machine/asm.h>
|
||||
#include <machine/frameasm.h>
|
||||
#include <machine/segments.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/psl.h>
|
||||
|
||||
#include <net/netisr.h>
|
||||
|
||||
#include "ioapic.h"
|
||||
#include "lapic.h"
|
||||
|
||||
#include "npx.h"
|
||||
#include "assym.h"
|
||||
|
||||
#define __HAVE_GENERIC_SOFT_INTERRUPTS /* XXX */
|
||||
|
||||
|
||||
/*
|
||||
* Macros for interrupt entry, call to handler, and exit.
|
||||
*
|
||||
* XXX
|
||||
* The interrupt frame is set up to look like a trap frame. This may be a
|
||||
* waste. The only handler which needs a frame is the clock handler, and it
|
||||
* only needs a few bits. Xdoreti() needs a trap frame for handling ASTs, but
|
||||
* it could easily convert the frame on demand.
|
||||
*
|
||||
* The direct costs of setting up a trap frame are two pushl's (error code and
|
||||
* trap number), an addl to get rid of these, and pushing and popping the
|
||||
* callee-saved registers %esi, %edi, %ebx, and %ebp twice.
|
||||
*
|
||||
* If the interrupt frame is made more flexible, INTR can push %eax first and
|
||||
* decide the ipending case with less overhead, e.g., by avoiding loading the
|
||||
* segment registers.
|
||||
*
|
||||
*/
|
||||
|
||||
#define MY_COUNT _C_LABEL(uvmexp)
|
||||
|
||||
/* XXX See comment in locore.s */
|
||||
#ifdef __ELF__
|
||||
#define XINTR(name,num) Xintr_/**/name/**/num
|
||||
#define XSTRAY(name,num) Xstray_/**/name/**/num
|
||||
#define XINTR_TSS(irq_num) Xintr_tss_ ## irq_num
|
||||
#else
|
||||
#define XINTR(name,num) _Xintr_/**/name/**/num
|
||||
#define XSTRAY(name,num) _Xstray_/**/name/**/num
|
||||
#define XINTR_TSS(irq_num) Xintr_tss_/**/irq_num
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Store address of TSS in %eax, given a selector in %eax.
|
||||
* Clobbers %eax, %ecx, %edx, but that's ok for its usage.
|
||||
* This is a bit complicated, but it's done to make as few
|
||||
* assumptions as possible about the validity of the environment.
|
||||
* The GDT and the current and previous TSS are known to be OK,
|
||||
* otherwise we would not be here. The only other thing that needs
|
||||
* to be OK is the cpu_info structure for the current CPU.
|
||||
*/
|
||||
#define GET_TSS \
|
||||
andl $0xfff8,%eax ;\
|
||||
addl CPUVAR(GDT),%eax ;\
|
||||
movl 2(%eax),%edx ;\
|
||||
andl $0xffffff,%edx ;\
|
||||
movzbl 7(%eax),%eax ;\
|
||||
shl $24,%eax ;\
|
||||
orl %edx,%eax
|
||||
|
||||
|
||||
#if NLAPIC > 0
|
||||
IDTVEC(recurse_lapic_ipi)
|
||||
pushfl
|
||||
pushl %cs
|
||||
pushl %esi
|
||||
pushl $0
|
||||
pushl $T_ASTFLT
|
||||
INTRENTRY
|
||||
IDTVEC(resume_lapic_ipi)
|
||||
cli
|
||||
jmp 1f
|
||||
IDTVEC(intr_lapic_ipi)
|
||||
pushl $0
|
||||
pushl $T_ASTFLT
|
||||
INTRENTRY
|
||||
movl $0,_C_LABEL(local_apic)+LAPIC_EOI
|
||||
movl CPUVAR(ILEVEL),%ebx
|
||||
cmpl $IPL_IPI,%ebx
|
||||
jae 2f
|
||||
1:
|
||||
incl CPUVAR(IDEPTH)
|
||||
movl $IPL_IPI,CPUVAR(ILEVEL)
|
||||
sti
|
||||
pushl %ebx
|
||||
call _C_LABEL(i386_ipi_handler)
|
||||
jmp _C_LABEL(Xdoreti)
|
||||
2:
|
||||
orl $(1 << LIR_IPI),CPUVAR(IPENDING)
|
||||
sti
|
||||
INTRFASTEXIT
|
||||
|
||||
#if defined(DDB) && defined(MULTIPROCESSOR)
|
||||
IDTVEC(intrddbipi)
|
||||
1:
|
||||
str %ax
|
||||
GET_TSS
|
||||
movzwl (%eax),%eax
|
||||
GET_TSS
|
||||
pushl %eax
|
||||
movl $0xff,_C_LABEL(lapic_tpr)
|
||||
movl $0,_C_LABEL(local_apic)+LAPIC_EOI
|
||||
sti
|
||||
call _C_LABEL(ddb_ipi_tss)
|
||||
addl $4,%esp
|
||||
movl $0,_C_LABEL(lapic_tpr)
|
||||
iret
|
||||
jmp 1b
|
||||
#endif /* DDB && MULTIPROCESSOR */
|
||||
|
||||
/*
|
||||
* Interrupt from the local APIC timer.
|
||||
*/
|
||||
IDTVEC(recurse_lapic_ltimer)
|
||||
pushfl
|
||||
pushl %cs
|
||||
pushl %esi
|
||||
pushl $0
|
||||
pushl $T_ASTFLT
|
||||
INTRENTRY
|
||||
IDTVEC(resume_lapic_ltimer)
|
||||
cli
|
||||
jmp 1f
|
||||
IDTVEC(intr_lapic_ltimer)
|
||||
pushl $0
|
||||
pushl $T_ASTFLT
|
||||
INTRENTRY
|
||||
movl $0,_C_LABEL(local_apic)+LAPIC_EOI
|
||||
movl CPUVAR(ILEVEL),%ebx
|
||||
cmpl $IPL_CLOCK,%ebx
|
||||
jae 2f
|
||||
1:
|
||||
incl CPUVAR(IDEPTH)
|
||||
movl $IPL_CLOCK,CPUVAR(ILEVEL)
|
||||
sti
|
||||
pushl %ebx
|
||||
pushl $0
|
||||
call _C_LABEL(lapic_clockintr)
|
||||
addl $4,%esp
|
||||
jmp _C_LABEL(Xdoreti)
|
||||
2:
|
||||
orl $(1 << LIR_TIMER),CPUVAR(IPENDING)
|
||||
sti
|
||||
INTRFASTEXIT
|
||||
#endif
|
||||
|
||||
#ifdef MULTIPROCESSOR
|
||||
#define LOCK_KERNEL call _C_LABEL(i386_intlock)
|
||||
#define UNLOCK_KERNEL call _C_LABEL(i386_intunlock)
|
||||
#else
|
||||
#define LOCK_KERNEL
|
||||
#define UNLOCK_KERNEL
|
||||
#endif
|
||||
|
||||
#define voidop(num)
|
||||
|
||||
|
||||
/*
|
||||
* This macro defines the generic stub code. Its arguments modifiy it
|
||||
* for specific PICs.
|
||||
*/
|
||||
|
||||
#define INTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_check) \
|
||||
IDTVEC(recurse_/**/name/**/num) ;\
|
||||
pushfl ;\
|
||||
pushl %cs ;\
|
||||
pushl %esi ;\
|
||||
pushl $0 /* dummy error code */ ;\
|
||||
pushl $T_ASTFLT /* trap # for doing ASTs */ ;\
|
||||
INTRENTRY ;\
|
||||
IDTVEC(resume_/**/name/**/num) \
|
||||
movl CPUVAR(ISOURCES) + (num) * 4, %ebp ;\
|
||||
pushl %ebx ;\
|
||||
movl %ebx,%esi ;\
|
||||
jmp 1f ;\
|
||||
IDTVEC(intr_/**/name/**/num) ;\
|
||||
pushl $0 /* dummy error code */ ;\
|
||||
pushl $T_ASTFLT /* trap # for doing ASTs */ ;\
|
||||
INTRENTRY ;\
|
||||
movl CPUVAR(ISOURCES) + (num) * 4, %ebp ;\
|
||||
mask(num) /* mask it in hardware */ ;\
|
||||
early_ack(num) /* and allow other intrs */ ;\
|
||||
testl %ebp,%ebp ;\
|
||||
jz 9f /* stray */ ;\
|
||||
movl IS_MAXLEVEL(%ebp),%ebx ;\
|
||||
movl CPUVAR(ILEVEL),%esi ;\
|
||||
cmpl %ebx,%esi ;\
|
||||
jae 10f /* currently masked; hold it */ ;\
|
||||
pushl %esi ;\
|
||||
movl %ebx,CPUVAR(ILEVEL) ;\
|
||||
incl MY_COUNT+V_INTR /* statistical info */ ;\
|
||||
addl $1,IS_EVCNTLO(%ebp) /* inc event counter */ ;\
|
||||
adcl $0,IS_EVCNTHI(%ebp) ;\
|
||||
1: \
|
||||
sti ;\
|
||||
incl CPUVAR(IDEPTH) ;\
|
||||
movl IS_HANDLERS(%ebp),%ebx ;\
|
||||
LOCK_KERNEL ;\
|
||||
6: \
|
||||
movl IH_LEVEL(%ebx),%edi ;\
|
||||
cmpl %esi,%edi ;\
|
||||
jle 7f ;\
|
||||
pushl IH_ARG(%ebx) ;\
|
||||
movl %edi,CPUVAR(ILEVEL) ;\
|
||||
call *IH_FUN(%ebx) /* call it */ ;\
|
||||
addl $4,%esp /* toss the arg */ ;\
|
||||
level_check(num) ;\
|
||||
movl IH_NEXT(%ebx),%ebx /* next handler in chain */ ;\
|
||||
testl %ebx,%ebx ;\
|
||||
jnz 6b ;\
|
||||
5: \
|
||||
UNLOCK_KERNEL ;\
|
||||
unmask(num) /* unmask it in hardware */ ;\
|
||||
late_ack(num) ;\
|
||||
sti ;\
|
||||
jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
|
||||
7: \
|
||||
UNLOCK_KERNEL ;\
|
||||
orl $(1 << num),CPUVAR(IPENDING) ;\
|
||||
late_ack(num) ;\
|
||||
sti ;\
|
||||
jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
|
||||
10: \
|
||||
orl $(1 << num),CPUVAR(IPENDING) ;\
|
||||
late_ack(num) ;\
|
||||
sti ;\
|
||||
INTRFASTEXIT ;\
|
||||
9: \
|
||||
unmask(num) ;\
|
||||
late_ack(num) ;\
|
||||
sti ;\
|
||||
INTRFASTEXIT
|
||||
|
||||
#define ICUADDR IO_ICU1
|
||||
|
||||
INTRSTUB(legacy,0,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,1,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,2,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,3,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,4,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,5,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,6,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,7,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
#undef ICUADDR
|
||||
#define ICUADDR IO_ICU2
|
||||
|
||||
INTRSTUB(legacy,8,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,9,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,10,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,11,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,12,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,13,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,14,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
INTRSTUB(legacy,15,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
|
||||
voidop)
|
||||
|
||||
#if NIOAPIC > 0
|
||||
|
||||
INTRSTUB(ioapic,0,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,1,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,2,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,3,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,4,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,5,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,6,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,7,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,8,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,9,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,10,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,11,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,12,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,13,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,14,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,15,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,16,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,17,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,18,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,19,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,20,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,21,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,22,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,23,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,24,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,25,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,26,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,27,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,28,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,29,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,30,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
INTRSTUB(ioapic,31,voidop,ioapic_asm_ack,voidop,voidop,voidop)
|
||||
|
||||
#endif
|
||||
|
||||
.globl _C_LABEL(i8259_stubs)
|
||||
_C_LABEL(i8259_stubs):
|
||||
.long _C_LABEL(Xintr_legacy0), _C_LABEL(Xrecurse_legacy0)
|
||||
.long _C_LABEL(Xresume_legacy0)
|
||||
.long _C_LABEL(Xintr_legacy1), _C_LABEL(Xrecurse_legacy1)
|
||||
.long _C_LABEL(Xresume_legacy1)
|
||||
.long _C_LABEL(Xintr_legacy2), _C_LABEL(Xrecurse_legacy2)
|
||||
.long _C_LABEL(Xresume_legacy2)
|
||||
.long _C_LABEL(Xintr_legacy3), _C_LABEL(Xrecurse_legacy3)
|
||||
.long _C_LABEL(Xresume_legacy3)
|
||||
.long _C_LABEL(Xintr_legacy4), _C_LABEL(Xrecurse_legacy4)
|
||||
.long _C_LABEL(Xresume_legacy4)
|
||||
.long _C_LABEL(Xintr_legacy5), _C_LABEL(Xrecurse_legacy5)
|
||||
.long _C_LABEL(Xresume_legacy5)
|
||||
.long _C_LABEL(Xintr_legacy6), _C_LABEL(Xrecurse_legacy6)
|
||||
.long _C_LABEL(Xresume_legacy6)
|
||||
.long _C_LABEL(Xintr_legacy7), _C_LABEL(Xrecurse_legacy7)
|
||||
.long _C_LABEL(Xresume_legacy7)
|
||||
.long _C_LABEL(Xintr_legacy8), _C_LABEL(Xrecurse_legacy8)
|
||||
.long _C_LABEL(Xresume_legacy8)
|
||||
.long _C_LABEL(Xintr_legacy9), _C_LABEL(Xrecurse_legacy9)
|
||||
.long _C_LABEL(Xresume_legacy9)
|
||||
.long _C_LABEL(Xintr_legacy10), _C_LABEL(Xrecurse_legacy10)
|
||||
.long _C_LABEL(Xresume_legacy10)
|
||||
.long _C_LABEL(Xintr_legacy11), _C_LABEL(Xrecurse_legacy11)
|
||||
.long _C_LABEL(Xresume_legacy11)
|
||||
.long _C_LABEL(Xintr_legacy12), _C_LABEL(Xrecurse_legacy12)
|
||||
.long _C_LABEL(Xresume_legacy12)
|
||||
.long _C_LABEL(Xintr_legacy13), _C_LABEL(Xrecurse_legacy13)
|
||||
.long _C_LABEL(Xresume_legacy13)
|
||||
.long _C_LABEL(Xintr_legacy14), _C_LABEL(Xrecurse_legacy14)
|
||||
.long _C_LABEL(Xresume_legacy14)
|
||||
.long _C_LABEL(Xintr_legacy15), _C_LABEL(Xrecurse_legacy15)
|
||||
.long _C_LABEL(Xresume_legacy15)
|
||||
|
||||
#if NIOAPIC > 0
|
||||
.globl _C_LABEL(ioapic_stubs)
|
||||
_C_LABEL(ioapic_stubs):
|
||||
.long _C_LABEL(Xintr_ioapic0), _C_LABEL(Xrecurse_ioapic0)
|
||||
.long _C_LABEL(Xresume_ioapic0)
|
||||
.long _C_LABEL(Xintr_ioapic1), _C_LABEL(Xrecurse_ioapic1)
|
||||
.long _C_LABEL(Xresume_ioapic1)
|
||||
.long _C_LABEL(Xintr_ioapic2), _C_LABEL(Xrecurse_ioapic2)
|
||||
.long _C_LABEL(Xresume_ioapic2)
|
||||
.long _C_LABEL(Xintr_ioapic3), _C_LABEL(Xrecurse_ioapic3)
|
||||
.long _C_LABEL(Xresume_ioapic3)
|
||||
.long _C_LABEL(Xintr_ioapic4), _C_LABEL(Xrecurse_ioapic4)
|
||||
.long _C_LABEL(Xresume_ioapic4)
|
||||
.long _C_LABEL(Xintr_ioapic5), _C_LABEL(Xrecurse_ioapic5)
|
||||
.long _C_LABEL(Xresume_ioapic5)
|
||||
.long _C_LABEL(Xintr_ioapic6), _C_LABEL(Xrecurse_ioapic6)
|
||||
.long _C_LABEL(Xresume_ioapic6)
|
||||
.long _C_LABEL(Xintr_ioapic7), _C_LABEL(Xrecurse_ioapic7)
|
||||
.long _C_LABEL(Xresume_ioapic7)
|
||||
.long _C_LABEL(Xintr_ioapic8), _C_LABEL(Xrecurse_ioapic8)
|
||||
.long _C_LABEL(Xresume_ioapic8)
|
||||
.long _C_LABEL(Xintr_ioapic9), _C_LABEL(Xrecurse_ioapic9)
|
||||
.long _C_LABEL(Xresume_ioapic9)
|
||||
.long _C_LABEL(Xintr_ioapic10), _C_LABEL(Xrecurse_ioapic10)
|
||||
.long _C_LABEL(Xresume_ioapic10)
|
||||
.long _C_LABEL(Xintr_ioapic11), _C_LABEL(Xrecurse_ioapic11)
|
||||
.long _C_LABEL(Xresume_ioapic11)
|
||||
.long _C_LABEL(Xintr_ioapic12), _C_LABEL(Xrecurse_ioapic12)
|
||||
.long _C_LABEL(Xresume_ioapic12)
|
||||
.long _C_LABEL(Xintr_ioapic13), _C_LABEL(Xrecurse_ioapic13)
|
||||
.long _C_LABEL(Xresume_ioapic13)
|
||||
.long _C_LABEL(Xintr_ioapic14), _C_LABEL(Xrecurse_ioapic14)
|
||||
.long _C_LABEL(Xresume_ioapic14)
|
||||
.long _C_LABEL(Xintr_ioapic15), _C_LABEL(Xrecurse_ioapic15)
|
||||
.long _C_LABEL(Xresume_ioapic15)
|
||||
.long _C_LABEL(Xintr_ioapic16), _C_LABEL(Xrecurse_ioapic16)
|
||||
.long _C_LABEL(Xresume_ioapic16)
|
||||
.long _C_LABEL(Xintr_ioapic17), _C_LABEL(Xrecurse_ioapic17)
|
||||
.long _C_LABEL(Xresume_ioapic17)
|
||||
.long _C_LABEL(Xintr_ioapic18), _C_LABEL(Xrecurse_ioapic18)
|
||||
.long _C_LABEL(Xresume_ioapic18)
|
||||
.long _C_LABEL(Xintr_ioapic19), _C_LABEL(Xrecurse_ioapic19)
|
||||
.long _C_LABEL(Xresume_ioapic19)
|
||||
.long _C_LABEL(Xintr_ioapic20), _C_LABEL(Xrecurse_ioapic20)
|
||||
.long _C_LABEL(Xresume_ioapic20)
|
||||
.long _C_LABEL(Xintr_ioapic21), _C_LABEL(Xrecurse_ioapic21)
|
||||
.long _C_LABEL(Xresume_ioapic21)
|
||||
.long _C_LABEL(Xintr_ioapic22), _C_LABEL(Xrecurse_ioapic22)
|
||||
.long _C_LABEL(Xresume_ioapic22)
|
||||
.long _C_LABEL(Xintr_ioapic23), _C_LABEL(Xrecurse_ioapic23)
|
||||
.long _C_LABEL(Xresume_ioapic23)
|
||||
.long _C_LABEL(Xintr_ioapic24), _C_LABEL(Xrecurse_ioapic24)
|
||||
.long _C_LABEL(Xresume_ioapic24)
|
||||
.long _C_LABEL(Xintr_ioapic25), _C_LABEL(Xrecurse_ioapic25)
|
||||
.long _C_LABEL(Xresume_ioapic25)
|
||||
.long _C_LABEL(Xintr_ioapic26), _C_LABEL(Xrecurse_ioapic26)
|
||||
.long _C_LABEL(Xresume_ioapic26)
|
||||
.long _C_LABEL(Xintr_ioapic27), _C_LABEL(Xrecurse_ioapic27)
|
||||
.long _C_LABEL(Xresume_ioapic27)
|
||||
.long _C_LABEL(Xintr_ioapic28), _C_LABEL(Xrecurse_ioapic28)
|
||||
.long _C_LABEL(Xresume_ioapic28)
|
||||
.long _C_LABEL(Xintr_ioapic29), _C_LABEL(Xrecurse_ioapic29)
|
||||
.long _C_LABEL(Xresume_ioapic29)
|
||||
.long _C_LABEL(Xintr_ioapic30), _C_LABEL(Xrecurse_ioapic30)
|
||||
.long _C_LABEL(Xresume_ioapic30)
|
||||
.long _C_LABEL(Xintr_ioapic31), _C_LABEL(Xrecurse_ioapic31)
|
||||
.long _C_LABEL(Xresume_ioapic31)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Symbols that vmstat -i wants, even though they're not used.
|
||||
*/
|
||||
.globl _C_LABEL(intrnames)
|
||||
_C_LABEL(intrnames):
|
||||
.globl _C_LABEL(eintrnames)
|
||||
_C_LABEL(eintrnames):
|
||||
|
||||
.globl _C_LABEL(intrcnt)
|
||||
_C_LABEL(intrcnt):
|
||||
.globl _C_LABEL(eintrcnt)
|
||||
_C_LABEL(eintrcnt):
|
||||
|
||||
/*
|
||||
* Soft interrupt handlers
|
||||
*/
|
||||
|
||||
IDTVEC(softserial)
|
||||
movl $IPL_SOFTSERIAL, CPUVAR(ILEVEL)
|
||||
incl CPUVAR(IDEPTH)
|
||||
#ifdef MULTIPROCESSOR
|
||||
call _C_LABEL(i386_intlock)
|
||||
#endif
|
||||
movl CPUVAR(ISOURCES) + SIR_SERIAL * 4, %edi
|
||||
addl $1,IS_EVCNTLO(%edi)
|
||||
adcl $0,IS_EVCNTHI(%edi)
|
||||
pushl $I386_SOFTINTR_SOFTSERIAL
|
||||
call _C_LABEL(softintr_dispatch)
|
||||
addl $4,%esp
|
||||
#ifdef MULTIPROCESSOR
|
||||
call _C_LABEL(i386_intunlock)
|
||||
#endif
|
||||
decl CPUVAR(IDEPTH)
|
||||
movl %ebx,CPUVAR(ILEVEL)
|
||||
jmp *%esi
|
||||
|
||||
IDTVEC(softnet)
|
||||
movl $IPL_SOFTNET, CPUVAR(ILEVEL)
|
||||
incl CPUVAR(IDEPTH)
|
||||
#ifdef MULTIPROCESSOR
|
||||
call _C_LABEL(i386_intlock)
|
||||
#endif
|
||||
movl CPUVAR(ISOURCES) + SIR_NET * 4, %edi
|
||||
addl $1,IS_EVCNTLO(%edi)
|
||||
adcl $0,IS_EVCNTHI(%edi)
|
||||
|
||||
xorl %edi,%edi
|
||||
xchgl _C_LABEL(netisr),%edi
|
||||
|
||||
/* XXX Do the legacy netisrs here for now. */
|
||||
#define DONETISR(s, c) \
|
||||
.globl _C_LABEL(c) ;\
|
||||
testl $(1 << s),%edi ;\
|
||||
jz 1f ;\
|
||||
call _C_LABEL(c) ;\
|
||||
1:
|
||||
#include <net/netisr_dispatch.h>
|
||||
|
||||
pushl $I386_SOFTINTR_SOFTNET
|
||||
call _C_LABEL(softintr_dispatch)
|
||||
addl $4,%esp
|
||||
#ifdef MULTIPROCESSOR
|
||||
call _C_LABEL(i386_intunlock)
|
||||
#endif
|
||||
decl CPUVAR(IDEPTH)
|
||||
movl %ebx,CPUVAR(ILEVEL)
|
||||
jmp *%esi
|
||||
|
||||
IDTVEC(softclock)
|
||||
movl $IPL_SOFTCLOCK, CPUVAR(ILEVEL)
|
||||
incl CPUVAR(IDEPTH)
|
||||
#ifdef MULTIPROCESSOR
|
||||
call _C_LABEL(i386_intlock)
|
||||
#endif
|
||||
movl CPUVAR(ISOURCES) + SIR_CLOCK * 4, %edi
|
||||
addl $1,IS_EVCNTLO(%edi)
|
||||
adcl $0,IS_EVCNTHI(%edi)
|
||||
|
||||
pushl $I386_SOFTINTR_SOFTCLOCK
|
||||
call _C_LABEL(softintr_dispatch)
|
||||
addl $4,%esp
|
||||
#ifdef MULTIPROCESSOR
|
||||
call _C_LABEL(i386_intunlock)
|
||||
#endif
|
||||
decl CPUVAR(IDEPTH)
|
||||
movl %ebx,CPUVAR(ILEVEL)
|
||||
jmp *%esi
|
||||
|
||||
/*
|
||||
* Trap and fault vector routines
|
||||
*
|
||||
* On exit from the kernel to user mode, we always need to check for ASTs. In
|
||||
* addition, we need to do this atomically; otherwise an interrupt may occur
|
||||
* which causes an AST, but it won't get processed until the next kernel entry
|
||||
* (possibly the next clock tick). Thus, we disable interrupt before checking,
|
||||
* and only enable them again on the final `iret' or before calling the AST
|
||||
* handler.
|
||||
*/
|
||||
|
||||
#define TRAP(a) pushl $(a) ; jmp _C_LABEL(alltraps)
|
||||
#define ZTRAP(a) pushl $0 ; TRAP(a)
|
||||
|
||||
#ifdef IPKDB
|
||||
#define BPTTRAP(a) pushl $0; pushl $(a); jmp _C_LABEL(bpttraps)
|
||||
#else
|
||||
#define BPTTRAP(a) ZTRAP(a)
|
||||
#endif
|
||||
|
||||
|
||||
.text
|
||||
IDTVEC(trap00)
|
||||
ZTRAP(T_DIVIDE)
|
||||
IDTVEC(trap01)
|
||||
BPTTRAP(T_TRCTRAP)
|
||||
IDTVEC(trap02)
|
||||
ZTRAP(T_NMI)
|
||||
IDTVEC(trap03)
|
||||
BPTTRAP(T_BPTFLT)
|
||||
IDTVEC(trap04)
|
||||
ZTRAP(T_OFLOW)
|
||||
IDTVEC(trap05)
|
||||
ZTRAP(T_BOUND)
|
||||
IDTVEC(trap06)
|
||||
ZTRAP(T_PRIVINFLT)
|
||||
IDTVEC(trap07)
|
||||
#if NNPX > 0
|
||||
pushl $0 # dummy error code
|
||||
pushl $T_DNA
|
||||
INTRENTRY
|
||||
pushl CPUVAR(SELF)
|
||||
call *_C_LABEL(npxdna_func)
|
||||
addl $4,%esp
|
||||
testl %eax,%eax
|
||||
jz calltrap
|
||||
INTRFASTEXIT
|
||||
#else
|
||||
ZTRAP(T_DNA)
|
||||
#endif
|
||||
IDTVEC(trap08)
|
||||
ZTRAP(T_DOUBLEFLT)
|
||||
IDTVEC(trap09)
|
||||
ZTRAP(T_FPOPFLT)
|
||||
IDTVEC(trap0a)
|
||||
TRAP(T_TSSFLT)
|
||||
IDTVEC(trap0b)
|
||||
TRAP(T_SEGNPFLT)
|
||||
IDTVEC(trap0c)
|
||||
TRAP(T_STKFLT)
|
||||
IDTVEC(trap0d)
|
||||
TRAP(T_PROTFLT)
|
||||
IDTVEC(trap0e)
|
||||
#ifndef I586_CPU
|
||||
TRAP(T_PAGEFLT)
|
||||
#else
|
||||
pushl $T_PAGEFLT
|
||||
INTRENTRY
|
||||
testb $PGEX_U,TF_ERR(%esp)
|
||||
jnz calltrap
|
||||
movl %cr2,%eax
|
||||
subl _C_LABEL(pentium_idt),%eax
|
||||
cmpl $(6*8),%eax
|
||||
jne calltrap
|
||||
movb $T_PRIVINFLT,TF_TRAPNO(%esp)
|
||||
jmp calltrap
|
||||
#endif
|
||||
|
||||
IDTVEC(intrspurious)
|
||||
IDTVEC(trap0f)
|
||||
/*
|
||||
* The Pentium Pro local APIC may erroneously call this vector for a
|
||||
* default IR7. Just ignore it.
|
||||
*
|
||||
* (The local APIC does this when CPL is raised while it's on the
|
||||
* way to delivering an interrupt.. presumably enough has been set
|
||||
* up that it's inconvenient to abort delivery completely..)
|
||||
*/
|
||||
iret
|
||||
|
||||
IDTVEC(trap10)
|
||||
#if NNPX > 0
|
||||
/*
|
||||
* Handle like an interrupt so that we can call npxintr to clear the
|
||||
* error. It would be better to handle npx interrupts as traps but
|
||||
* this is difficult for nested interrupts.
|
||||
*/
|
||||
pushl $0 # dummy error code
|
||||
pushl $T_ASTFLT
|
||||
INTRENTRY
|
||||
pushl CPUVAR(ILEVEL)
|
||||
pushl %esp
|
||||
incl _C_LABEL(uvmexp)+V_TRAP
|
||||
call _C_LABEL(npxintr)
|
||||
addl $8,%esp
|
||||
INTRFASTEXIT
|
||||
#else
|
||||
ZTRAP(T_ARITHTRAP)
|
||||
#endif
|
||||
IDTVEC(trap11)
|
||||
ZTRAP(T_ALIGNFLT)
|
||||
IDTVEC(trap12)
|
||||
IDTVEC(trap13)
|
||||
IDTVEC(trap14)
|
||||
IDTVEC(trap15)
|
||||
IDTVEC(trap16)
|
||||
IDTVEC(trap17)
|
||||
IDTVEC(trap18)
|
||||
IDTVEC(trap19)
|
||||
IDTVEC(trap1a)
|
||||
IDTVEC(trap1b)
|
||||
IDTVEC(trap1c)
|
||||
IDTVEC(trap1d)
|
||||
IDTVEC(trap1e)
|
||||
IDTVEC(trap1f)
|
||||
/* 18 - 31 reserved for future exp */
|
||||
ZTRAP(T_RESERVED)
|
||||
|
||||
IDTVEC(exceptions)
|
||||
.long _C_LABEL(Xtrap00), _C_LABEL(Xtrap01)
|
||||
.long _C_LABEL(Xtrap02), _C_LABEL(Xtrap03)
|
||||
.long _C_LABEL(Xtrap04), _C_LABEL(Xtrap05)
|
||||
.long _C_LABEL(Xtrap06), _C_LABEL(Xtrap07)
|
||||
.long _C_LABEL(Xtrap08), _C_LABEL(Xtrap09)
|
||||
.long _C_LABEL(Xtrap0a), _C_LABEL(Xtrap0b)
|
||||
.long _C_LABEL(Xtrap0c), _C_LABEL(Xtrap0d)
|
||||
.long _C_LABEL(Xtrap0e), _C_LABEL(Xtrap0f)
|
||||
.long _C_LABEL(Xtrap10), _C_LABEL(Xtrap11)
|
||||
.long _C_LABEL(Xtrap12), _C_LABEL(Xtrap13)
|
||||
.long _C_LABEL(Xtrap14), _C_LABEL(Xtrap15)
|
||||
.long _C_LABEL(Xtrap16), _C_LABEL(Xtrap17)
|
||||
.long _C_LABEL(Xtrap18), _C_LABEL(Xtrap19)
|
||||
.long _C_LABEL(Xtrap1a), _C_LABEL(Xtrap1b)
|
||||
.long _C_LABEL(Xtrap1c), _C_LABEL(Xtrap1d)
|
||||
.long _C_LABEL(Xtrap1e), _C_LABEL(Xtrap1f)
|
||||
|
||||
|
||||
IDTVEC(tss_trap08)
|
||||
1:
|
||||
str %ax
|
||||
GET_TSS
|
||||
movzwl (%eax),%eax
|
||||
GET_TSS
|
||||
pushl $T_DOUBLEFLT
|
||||
pushl %eax
|
||||
call _C_LABEL(trap_tss)
|
||||
addl $12,%esp
|
||||
iret
|
||||
jmp 1b
|
||||
|
||||
/* LINTSTUB: Ignore */
|
||||
NENTRY(alltraps)
|
||||
INTRENTRY
|
||||
calltrap:
|
||||
#ifdef DIAGNOSTIC
|
||||
movl CPUVAR(ILEVEL),%ebx
|
||||
#endif /* DIAGNOSTIC */
|
||||
call _C_LABEL(trap)
|
||||
2: /* Check for ASTs on exit to user mode. */
|
||||
cli
|
||||
CHECK_ASTPENDING()
|
||||
je 1f
|
||||
testb $SEL_RPL,TF_CS(%esp)
|
||||
#ifdef VM86
|
||||
jnz 5f
|
||||
testl $PSL_VM,TF_EFLAGS(%esp)
|
||||
#endif
|
||||
jz 1f
|
||||
5: CLEAR_ASTPENDING()
|
||||
sti
|
||||
movl $T_ASTFLT,TF_TRAPNO(%esp)
|
||||
call _C_LABEL(trap)
|
||||
jmp 2b
|
||||
#ifndef DIAGNOSTIC
|
||||
1: INTRFASTEXIT
|
||||
#else
|
||||
1: cmpl CPUVAR(ILEVEL),%ebx
|
||||
jne 3f
|
||||
INTRFASTEXIT
|
||||
3: sti
|
||||
pushl $4f
|
||||
call _C_LABEL(printf)
|
||||
addl $4,%esp
|
||||
#ifdef DDB
|
||||
int $3
|
||||
#endif /* DDB */
|
||||
movl %ebx,CPUVAR(ILEVEL)
|
||||
jmp 2b
|
||||
4: .asciz "WARNING: SPL NOT LOWERED ON TRAP EXIT\n"
|
||||
#endif /* DIAGNOSTIC */
|
||||
|
||||
#ifdef IPKDB
|
||||
/* LINTSTUB: Ignore */
|
||||
NENTRY(bpttraps)
|
||||
INTRENTRY
|
||||
call _C_LABEL(ipkdb_trap_glue)
|
||||
testl %eax,%eax
|
||||
jz calltrap
|
||||
INTRFASTEXIT
|
||||
|
||||
ipkdbsetup:
|
||||
popl %ecx
|
||||
|
||||
/* Disable write protection: */
|
||||
movl %cr0,%eax
|
||||
pushl %eax
|
||||
andl $~CR0_WP,%eax
|
||||
movl %eax,%cr0
|
||||
|
||||
/* Substitute Protection & Page Fault handlers: */
|
||||
movl _C_LABEL(idt),%edx
|
||||
pushl 13*8(%edx)
|
||||
pushl 13*8+4(%edx)
|
||||
pushl 14*8(%edx)
|
||||
pushl 14*8+4(%edx)
|
||||
movl $fault,%eax
|
||||
movw %ax,13*8(%edx)
|
||||
movw %ax,14*8(%edx)
|
||||
shrl $16,%eax
|
||||
movw %ax,13*8+6(%edx)
|
||||
movw %ax,14*8+6(%edx)
|
||||
|
||||
pushl %ecx
|
||||
ret
|
||||
|
||||
ipkdbrestore:
|
||||
popl %ecx
|
||||
|
||||
/* Restore Protection & Page Fault handlers: */
|
||||
movl _C_LABEL(idt),%edx
|
||||
popl 14*8+4(%edx)
|
||||
popl 14*8(%edx)
|
||||
popl 13*8+4(%edx)
|
||||
popl 13*8(%edx)
|
||||
|
||||
/* Restore write protection: */
|
||||
popl %edx
|
||||
movl %edx,%cr0
|
||||
|
||||
pushl %ecx
|
||||
ret
|
||||
#endif /* IPKDB */
|
||||
|
||||
|
||||
/*
|
||||
* If an error is detected during trap, syscall, or interrupt exit, trap() will
|
||||
* change %eip to point to one of these labels. We clean up the stack, if
|
||||
* necessary, and resume as if we were handling a general protection fault.
|
||||
* This will cause the process to get a SIGBUS.
|
||||
*/
|
||||
/* LINTSTUB: Var: char resume_iret[1]; */
|
||||
NENTRY(resume_iret)
|
||||
ZTRAP(T_PROTFLT)
|
||||
/* LINTSTUB: Var: char resume_pop_ds[1]; */
|
||||
NENTRY(resume_pop_ds)
|
||||
pushl %es
|
||||
movl $GSEL(GDATA_SEL, SEL_KPL),%eax
|
||||
movw %ax,%es
|
||||
/* LINTSTUB: Var: char resume_pop_es[1]; */
|
||||
NENTRY(resume_pop_es)
|
||||
pushl %fs
|
||||
movl $GSEL(GDATA_SEL, SEL_KPL),%eax
|
||||
movw %ax,%fs
|
||||
/* LINTSTUB: Var: char resume_pop_fs[1]; */
|
||||
NENTRY(resume_pop_fs)
|
||||
pushl %gs
|
||||
movl $GSEL(GDATA_SEL, SEL_KPL),%eax
|
||||
movw %ax,%gs
|
||||
/* LINTSTUB: Var: char resume_pop_gs[1]; */
|
||||
NENTRY(resume_pop_gs)
|
||||
movl $T_PROTFLT,TF_TRAPNO(%esp)
|
||||
jmp calltrap
|
||||
|
||||
#ifdef IPKDB
|
||||
/* LINTSTUB: Func: int ipkdbfbyte(u_char *c) */
|
||||
NENTRY(ipkdbfbyte)
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
call ipkdbsetup
|
||||
movl 8(%ebp),%edx
|
||||
movzbl (%edx),%eax
|
||||
faultexit:
|
||||
call ipkdbrestore
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
/* LINTSTUB: Func: int ipkdbsbyte(u_char *c, int i) */
|
||||
NENTRY(ipkdbsbyte)
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
call ipkdbsetup
|
||||
movl 8(%ebp),%edx
|
||||
movl 12(%ebp),%eax
|
||||
movb %al,(%edx)
|
||||
call ipkdbrestore
|
||||
popl %ebp
|
||||
ret
|
||||
|
||||
fault:
|
||||
popl %eax /* error code */
|
||||
movl $faultexit,%eax
|
||||
movl %eax,(%esp)
|
||||
movl $-1,%eax
|
||||
iret
|
||||
#endif /* IPKDB */
|
Loading…
Reference in New Issue