diff --git a/sys/arch/i386/i386/bioscall.s b/sys/arch/i386/i386/bioscall.s deleted file mode 100644 index 21c014ffd062..000000000000 --- a/sys/arch/i386/i386/bioscall.s +++ /dev/null @@ -1,90 +0,0 @@ -/* $NetBSD: bioscall.s,v 1.8 2002/10/23 00:58:28 christos 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 -#include - -#include - -/* LINTSTUB: include */ -/* LINTSTUB: include */ - - .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 diff --git a/sys/arch/i386/i386/db_dbgreg.s b/sys/arch/i386/i386/db_dbgreg.s deleted file mode 100644 index d8e654ba304a..000000000000 --- a/sys/arch/i386/i386/db_dbgreg.s +++ /dev/null @@ -1,192 +0,0 @@ -/* $NetBSD: db_dbgreg.s,v 1.5 2002/10/23 00:12:27 perry 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 -#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(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 diff --git a/sys/arch/i386/i386/freebsd_sigcode.s b/sys/arch/i386/i386/freebsd_sigcode.s deleted file mode 100644 index f01febf37767..000000000000 --- a/sys/arch/i386/i386/freebsd_sigcode.s +++ /dev/null @@ -1,100 +0,0 @@ -/* $NetBSD: freebsd_sigcode.s,v 1.3 2001/09/26 09:58:39 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 -#include - -#include -#include - -/* - * 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): diff --git a/sys/arch/i386/i386/ibcs2_sigcode.s b/sys/arch/i386/i386/ibcs2_sigcode.s deleted file mode 100644 index a0d6e0810c43..000000000000 --- a/sys/arch/i386/i386/ibcs2_sigcode.s +++ /dev/null @@ -1,100 +0,0 @@ -/* $NetBSD: ibcs2_sigcode.s,v 1.8 2002/10/01 12:56:52 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 -#include - -/* 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): diff --git a/sys/arch/i386/i386/in_cksum.s b/sys/arch/i386/i386/in_cksum.s deleted file mode 100644 index 91cd799df66d..000000000000 --- a/sys/arch/i386/i386/in_cksum.s +++ /dev/null @@ -1,440 +0,0 @@ -/* $NetBSD: in_cksum.s,v 1.18 2002/10/23 00:13:14 perry 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 -#include "assym.h" - -/* LINTSTUB: include */ -/* LINTSTUB: include */ -/* LINTSTUB: include */ -/* LINTSTUB: include */ - -/* - * 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" diff --git a/sys/arch/i386/i386/kvm86call.s b/sys/arch/i386/i386/kvm86call.s deleted file mode 100644 index 85f6beef6299..000000000000 --- a/sys/arch/i386/i386/kvm86call.s +++ /dev/null @@ -1,183 +0,0 @@ -/* $NetBSD: kvm86call.s,v 1.2 2002/10/02 15:23:31 drochner 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 -#include - -#include "assym.h" - -__KERNEL_RCSID(0, "$NetBSD: kvm86call.s,v 1.2 2002/10/02 15:23:31 drochner 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 */ diff --git a/sys/arch/i386/i386/linux_sigcode.s b/sys/arch/i386/i386/linux_sigcode.s deleted file mode 100644 index 0e89a0436925..000000000000 --- a/sys/arch/i386/i386/linux_sigcode.s +++ /dev/null @@ -1,117 +0,0 @@ -/* $NetBSD: linux_sigcode.s,v 1.5 2001/09/26 09:58:39 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 -#include - -#include - -/*****************************************************************************/ - -/* - * 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): diff --git a/sys/arch/i386/i386/mach_sigcode.s b/sys/arch/i386/i386/mach_sigcode.s deleted file mode 100644 index 566429a3a519..000000000000 --- a/sys/arch/i386/i386/mach_sigcode.s +++ /dev/null @@ -1,190 +0,0 @@ -/* $NetBSD: mach_sigcode.s,v 1.4 2002/10/30 15:03:42 christos 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 -#include -#include -#include - -/* - * 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 - -/* - * 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 diff --git a/sys/arch/i386/i386/microtime.s b/sys/arch/i386/i386/microtime.s deleted file mode 100644 index b4e95ee524fb..000000000000 --- a/sys/arch/i386/i386/microtime.s +++ /dev/null @@ -1,115 +0,0 @@ -/* $NetBSD: microtime.s,v 1.22 2002/10/01 12:56:57 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 -#include -#include - -/* LINTSTUB: include */ - -#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 diff --git a/sys/arch/i386/i386/svr4_sigcode.s b/sys/arch/i386/i386/svr4_sigcode.s deleted file mode 100644 index 59418c84dcff..000000000000 --- a/sys/arch/i386/i386/svr4_sigcode.s +++ /dev/null @@ -1,185 +0,0 @@ -/* $NetBSD: svr4_sigcode.s,v 1.8 2002/10/01 12:57:00 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 -#include -#include -#include - -/* - * 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 - -/* - * 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 - -#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 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