Clean up deleted files.

This commit is contained in:
mycroft 1993-10-10 00:32:42 +00:00
parent 2f0fca8e20
commit cc73d66b19
71 changed files with 0 additions and 4689 deletions

View File

@ -1,8 +0,0 @@
?sys_nerr?
.-2,.+1m0
.+1,$g/\.data/s//\.text/
0a
.data
.
w
q

View File

@ -1,54 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*
* from: @(#)DEFS.h 5.1 (Berkeley) 5/12/90
* $Id: DEFS.h,v 1.2 1993/08/01 18:41:01 mycroft Exp $
*/
#ifdef PROF
#ifdef __GNUC__
#define ENTRY(x) \
.globl _/**/x; .even; _/**/x:; .data; PROF/**/x:; .long 0; .text; \
link a6,#0; lea PROF/**/x,a0; jsr mcount; unlk a6
#else
#define ENTRY(x) \
.globl _/**/x; .even; _/**/x:; .data; PROF/**/x:; .long 0; .text; \
lea PROF/**/x,a0; jsr mcount
#endif
#else
#define ENTRY(x) \
.globl _/**/x; .even; _/**/x:
#endif

View File

@ -1,62 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*
* from: @(#)SYS.h 5.5 (Berkeley) 5/7/91
* $Id: SYS.h,v 1.2 1993/08/01 18:40:59 mycroft Exp $
*/
#include <sys/syscall.h>
#ifdef PROF
#ifdef __GNUC__
#define ENTRY(x) .globl _/**/x; .even; _/**/x:; .data; PROF/**/x:; \
.long 0; .text; link a6,#0; lea PROF/**/x,a0; \
jbsr mcount; unlk a6
#else
#define ENTRY(x) .globl _/**/x; .even; _/**/x:; .data; PROF/**/x:; \
.long 0; .text; lea PROF/**/x,a0; jbsr mcount
#endif
#else
#define ENTRY(x) .globl _/**/x; .even; _/**/x:
#endif PROF
#define SYSCALL(x) .even; err: jmp cerror; ENTRY(x); movl #SYS_/**/x,d0; \
trap #0; jcs err
#define RSYSCALL(x) SYSCALL(x); rts
#define PSEUDO(x,y) ENTRY(x); movl #SYS_/**/y,d0; trap #0; rts
#define ASMSTR .asciz
.globl cerror

View File

@ -1,88 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)_setjmp.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: _setjmp.s,v 1.3 1993/08/26 02:11:52 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
/*
* C library -- _setjmp, _longjmp
*
* _longjmp(a,v)
* will generate a "return(v)" from
* the last call to
* _setjmp(a)
* by restoring registers from the stack,
* The previous signal state is NOT restored.
*/
#include "DEFS.h"
ENTRY(_setjmp)
movl sp@(4),a0 /* save area pointer */
clrl a0@+ /* no old onstack */
clrl a0@+ /* no old sigmask */
movl sp,a0@+ /* save old SP */
movl a6,a0@+ /* save old FP */
clrl a0@+ /* no old AP */
movl sp@,a0@+ /* save old PC */
clrl a0@+ /* clear PS */
moveml #0x3CFC,a0@ /* save other non-scratch regs */
clrl d0 /* return zero */
rts
ENTRY(_longjmp)
movl sp@(4),a0 /* save area pointer */
addql #8,a0 /* skip onstack/sigmask */
tstl a0@ /* ensure non-zero SP */
jeq botch /* oops! */
movl sp@(8),d0 /* grab return value */
jne ok /* non-zero ok */
moveq #1,d0 /* else make non-zero */
ok:
movl a0@+,sp /* restore SP */
movl a0@+,a6 /* restore FP */
addql #4,a0 /* skip AP */
movl a0@+,sp@ /* restore PC */
moveml a0@(4),#0x3CFC /* restore non-scratch regs */
rts
botch:
jsr _longjmperror
stop #0

View File

@ -1,53 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)adddf3.s 5.1 (Berkeley) 6/7/90"*/
.asciz "$Id: adddf3.s,v 1.3 1993/08/26 02:11:54 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
/* double + double */
ENTRY(__adddf3)
fmoved sp@(4),fp0
faddd sp@(12),fp0
fmoved fp0,sp@-
movel sp@+,d0
movel sp@+,d1
rts

View File

@ -1,51 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)addsf3.s 5.1 (Berkeley) 6/7/90"*/
.asciz "$Id: addsf3.s,v 1.3 1993/08/26 02:11:55 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
/* single + single */
ENTRY(__addsf3)
fmoves sp@(4),fp0
fadds sp@(8),fp0
fmoves fp0,d0
rts

View File

@ -1,56 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)alloca.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: alloca.s,v 1.3 1993/08/26 02:11:55 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
/* like alloc, but automatic free in return */
#include "DEFS.h"
ENTRY(alloca)
movl sp@,a0 /* save return addr */
movl sp,d0 /* get current SP value */
subl sp@(4),d0 /* allocate requested space */
andb #~3,d0 /* longword align for efficiency */
addql #8,d0 /* reuse space of call frame */
movl d0,sp /* set new SP value */
lea sp@(-4),sp /* account for argument pop in caller */
jmp a0@ /* funny return */

View File

@ -1,51 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)ashlsi3.s 5.1 (Berkeley) 6/7/90"*/
.asciz "$Id: ashlsi3.s,v 1.3 1993/08/26 02:11:56 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
/* int << int */
ENTRY(__ashlsi3)
movel sp@(8),d1
movel sp@(4),d0
asll d1,d0
rts

View File

@ -1,51 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)ashrsi3.s 5.1 (Berkeley) 6/7/90"*/
.asciz "$Id: ashrsi3.s,v 1.3 1993/08/26 02:11:57 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
/* int >> int */
ENTRY(__ashrsi3)
movel sp@(8),d1
movel sp@(4),d0
asrl d1,d0
rts

View File

@ -1,50 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)htonl.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: htonl.s,v 1.3 1993/08/26 02:12:33 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
/* netorder = htonl(hostorder) */
#include "DEFS.h"
ENTRY(htonl)
movl sp@(4),d0
rts

View File

@ -1,51 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)htons.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: htons.s,v 1.3 1993/08/26 02:12:34 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
/* hostorder = htons(netorder) */
#include "DEFS.h"
ENTRY(htons)
clrl d0
movw sp@(6),d0
rts

View File

@ -1,50 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)ntohl.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: ntohl.s,v 1.3 1993/08/26 02:12:35 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
/* hostorder = ntohl(netorder) */
#include "DEFS.h"
ENTRY(ntohl)
movl sp@(4),d0
rts

View File

@ -1,51 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)ntohs.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: ntohs.s,v 1.3 1993/08/26 02:12:36 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
/* hostorder = ntohs(netorder) */
#include "DEFS.h"
ENTRY(ntohs)
clrl d0
movw sp@(6),d0
rts

View File

@ -1,53 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)abs.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: abs.s,v 1.3 1993/08/26 02:12:42 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
/* abs - int absolute value */
#include "DEFS.h"
ENTRY(abs)
movl sp@(4),d0
jge L1
negl d0
L1:
rts

View File

@ -1,150 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char sccsid[] = "from: @(#)atof.c 5.2 (Berkeley) 4/12/91";*/
static char rcsid[] = "$Id: atof.c,v 1.2 1993/08/01 18:41:45 mycroft Exp $";
#endif /* LIBC_SCCS and not lint */
/*
* simple atof() for IEEE 754 architectures
*/
#include <machine/endian.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
static double twoemax = 9007199254740992.; /*2^53*/
/* attempt to be as exact as possible */
static struct {
long low_word;
long high_word;
} exp5[] = {
#if BYTE_ORDER == BIG_ENDIAN
{ 0x40140000, 0x00000000 }, /* 5 */
{ 0x40390000, 0x00000000 }, /* 25 */
{ 0x40838800, 0x00000000 }, /* 625 */
{ 0x4117d784, 0x00000000 }, /* 390625 */
{ 0x4241c379, 0x37e08000 }, /* 152587890625 */
{ 0x4493b8b5, 0xb5056e17 }, /* 2.3283064365387e+022 */
{ 0x49384f03, 0xe93ff9f6 }, /* 5.42101086242753e+044 */
{ 0x52827748, 0xf9301d33 }, /* 2.93873587705572e+089 */
{ 0x65154fdd, 0x7f73bf3f } /* 8.63616855509445e+178 */
#else /* BYTE_ORDER == LITTLE_ENDIAN */
{ 0x00000000, 0x40140000 }, /* 5 */
{ 0x00000000, 0x40390000 }, /* 25 */
{ 0x00000000, 0x40838800 }, /* 625 */
{ 0x00000000, 0x4117d784 }, /* 390625 */
{ 0x37e08000, 0x4241c379 }, /* 152587890625 */
{ 0xb5056e17, 0x4493b8b5 }, /* 2.3283064365387e+022 */
{ 0xe93ff9f6, 0x49384f03 }, /* 5.42101086242753e+044 */
{ 0xf9301d33, 0x52827748 }, /* 2.93873587705572e+089 */
{ 0x7f73bf3f, 0x65154fdd } /* 8.63616855509445e+178 */
#endif
};
double
atof(p)
register const char *p;
{
register int c;
register int exp = 0;
register int eexp = 0;
double fl = 0;
double flexp = 1.0;
int bexp;
int neg = 1;
int negexp = 1;
while (isspace(*p))
++p;
if ((c = *p++) == '-')
neg = -1;
else if (c == '+')
/* skip it */;
else
--p;
while ((c = *p++) && isdigit(c))
if (fl < twoemax)
fl = 10 * fl + (c-'0');
else
++exp;
if (c == '.')
while ((c = *p++) && isdigit(c))
if (fl < twoemax) {
fl = 10 * fl + (c-'0');
--exp;
}
if (c == 'E' || c == 'e') {
if ((c = *p++) == '-')
negexp = -1;
else if (c == '+')
/* skip it */;
else
--p;
while ((c = *p++) && isdigit(c))
eexp = 10 * eexp + (c-'0');
if (negexp < 0)
eexp = -eexp;
exp += eexp;
}
bexp = exp;
if (exp < 0)
exp = -exp;
for (c = 0; exp && c < sizeof exp5 / sizeof exp5[0]; ++c) {
if (exp & 1)
flexp *= *(double *)&exp5[c];
exp >>= 1;
}
if (bexp < 0)
fl /= flexp;
else
fl *= flexp;
fl = ldexp(fl, bexp);
return neg < 0 ? -fl : fl;
}

View File

@ -1,91 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)bcmp.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: bcmp.s,v 1.3 1993/08/26 02:12:48 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
/* bcmp(s1, s2, n) */
#include "DEFS.h"
/*
* This is probably not the best we can do, but it is still 2-10 times
* faster than the C version in the portable gen directory.
*
* Things that might help:
* - longword align when possible (only on the 68020)
* - use nested DBcc instructions or use one and limit size to 64K
*/
ENTRY(bcmp)
movl sp@(4),a0 /* string 1 */
movl sp@(8),a1 /* string 2 */
movl sp@(12),d0 /* length */
jeq bcdone /* if zero, nothing to do */
movl a0,d1
btst #0,d1 /* string 1 address odd? */
jeq bceven /* no, skip alignment */
cmpmb a0@+,a1@+ /* yes, compare a byte */
jne bcnoteq /* not equal, return non-zero */
subql #1,d0 /* adjust count */
jeq bcdone /* count 0, reutrn zero */
bceven:
movl a1,d1
btst #0,d1 /* string 2 address odd? */
jne bcbloop /* yes, no hope for alignment, compare bytes */
movl d0,d1 /* no, both even */
lsrl #2,d1 /* convert count to longword count */
jeq bcbloop /* count 0, skip longword loop */
bclloop:
cmpml a0@+,a1@+ /* compare a longword */
jne bcnoteq /* not equal, return non-zero */
subql #1,d1 /* adjust count */
jne bclloop /* still more, keep comparing */
andl #3,d0 /* what remains */
jeq bcdone /* nothing, all done */
bcbloop:
cmpmb a0@+,a1@+ /* compare a byte */
jne bcnoteq /* not equal, return non-zero */
subql #1,d0 /* adjust count */
jne bcbloop /* still more, keep going */
rts
bcnoteq:
moveq #1,d0
bcdone:
rts

View File

@ -1,114 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)bcopy.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: bcopy.s,v 1.3 1993/08/26 02:12:49 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
/*
* This is probably not the best we can do, but it is still 2-10 times
* faster than the C version in the portable gen directory.
*
* Things that might help:
* - unroll the longword copy loop (might not be good for a 68020)
* - longword align when possible (only on the 68020)
* - use nested DBcc instructions or use one and limit size to 64K
*/
ENTRY(bcopy)
movl sp@(12),d1 /* check count */
jle bcdone /* <= 0, don't do anything */
movl sp@(4),a0 /* src address */
movl sp@(8),a1 /* dest address */
cmpl a1,a0 /* src after dest? */
jlt bcback /* yes, must copy backwards */
movl a0,d0
btst #0,d0 /* src address odd? */
jeq bcfeven /* no, skip alignment */
movb a0@+,a1@+ /* yes, copy a byte */
subql #1,d1 /* adjust count */
jeq bcdone /* count 0, all done */
bcfeven:
movl a1,d0
btst #0,d0 /* dest address odd? */
jne bcfbloop /* yes, no hope for alignment, copy bytes */
movl d1,d0 /* no, both even */
lsrl #2,d0 /* convert count to longword count */
jeq bcfbloop /* count 0, skip longword loop */
bcflloop:
movl a0@+,a1@+ /* copy a longword */
subql #1,d0 /* adjust count */
jne bcflloop /* still more, keep copying */
andl #3,d1 /* what remains */
jeq bcdone /* nothing, all done */
bcfbloop:
movb a0@+,a1@+ /* copy a byte */
subql #1,d1 /* adjust count */
jne bcfbloop /* still more, keep going */
bcdone:
rts
bcback:
addl d1,a0 /* src pointer to end */
addl d1,a1 /* dest pointer to end */
movl a0,d0
btst #0,d0 /* src address odd? */
jeq bcbeven /* no, skip alignment */
movb a0@-,a1@- /* yes, copy a byte */
subql #1,d1 /* adjust count */
jeq bcdone /* count 0, all done */
bcbeven:
movl a1,d0
btst #0,d0 /* dest address odd? */
jne bcbbloop /* yes, no hope for alignment, copy bytes */
movl d1,d0 /* no, both even */
lsrl #2,d0 /* convert count to longword count */
jeq bcbbloop /* count 0, skip longword loop */
bcblloop:
movl a0@-,a1@- /* copy a longword */
subql #1,d0 /* adjust count */
jne bcblloop /* still more, keep copying */
andl #3,d1 /* what remains */
jeq bcdone /* nothing, all done */
bcbbloop:
movb a0@-,a1@- /* copy a byte */
subql #1,d1 /* adjust count */
jne bcbbloop /* still more, keep going */
rts

View File

@ -1,80 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)bzero.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: bzero.s,v 1.3 1993/08/26 02:12:50 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
/*
* This is probably not the best we can do, but it is still much
* faster than the C version in the portable gen directory.
*
* Things that might help:
* - unroll the longword loop (might not be good for a 68020)
* - longword, as opposed to word, align when possible (only on the 68020)
* - use nested DBcc instructions or use one and limit size to 64K
*/
ENTRY(bzero)
movl sp@(4),a0 /* destination */
movl sp@(8),d0 /* count */
jeq bzdone /* nothing to do */
movl a0,d1
btst #0,d1 /* address odd? */
jeq bzeven /* no, skip alignment */
clrb a0@+ /* yes, clear a byte */
subql #1,d0 /* adjust count */
jeq bzdone /* if zero, all done */
bzeven:
movl d0,d1
lsrl #2,d1 /* convert to longword count */
jeq bzbloop /* no longwords, skip loop */
bzlloop:
clrl a0@+ /* clear a longword */
subql #1,d1 /* adjust count */
jne bzlloop /* still more, keep going */
andl #3,d0 /* what remains */
jeq bzdone /* nothing, all done */
bzbloop:
clrb a0@+ /* clear a byte */
subql #1,d0 /* adjust count */
jne bzbloop /* still more, keep going */
bzdone:
rts

View File

@ -1,58 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)ffs.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: ffs.s,v 1.3 1993/08/26 02:12:51 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
/* bit = ffs(value) */
#include "DEFS.h"
ENTRY(ffs)
moveq #-1,d0
movl sp@(4),d1
beq done
again:
addql #1,d0
btst d0,d1
beq again
done:
addql #1,d0
rts

View File

@ -1,58 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)index.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: index.s,v 1.3 1993/08/26 02:12:51 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
ENTRY(index)
movl sp@(4),a0 /* string */
movb sp@(11),d0 /* char to look for */
ixloop:
cmpb a0@,d0 /* found our char? */
jeq ixfound /* yes, break out */
tstb a0@+ /* null? */
jne ixloop /* no, keep going */
moveq #0,d0 /* not found, return null */
rts
ixfound:
movl a0,d0 /* found, return pointer */
rts

View File

@ -1,58 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)rindex.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: rindex.s,v 1.3 1993/08/26 02:12:52 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
ENTRY(rindex)
movl sp@(4),a0 /* string */
movb sp@(11),d0 /* char to look for */
subl a1,a1 /* clear rindex pointer */
rixloop:
cmpb a0@,d0 /* found our char? */
jne rixnope /* no, check for null */
movl a0,a1 /* yes, remember location */
rixnope:
tstb a0@+ /* null? */
jne rixloop /* no, keep going */
movl a1,d0 /* return value */
rts

View File

@ -1,66 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.text
/*.asciz "from: @(#)strcmp.s 5.1 (Berkeley) 5/12/90"*/
.asciz "$Id: strcmp.s,v 1.3 1993/08/26 02:12:53 mycroft Exp $"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
/*
* NOTE: this guy returns result compatible with the VAX assembly version.
* The C version on the portable gen directory returns different results
* (different signs!) when comparing chars with the high bit on. Who is
* right??
*/
ENTRY(strcmp)
movl sp@(4),a0 /* a0 = string1 */
movl sp@(8),a1 /* a1 = string2 */
scloop:
movb a0@+,d0 /* get *string1 */
cmpb a1@+,d0 /* compare a byte */
jne scexit /* not equal, break out */
tstb d0 /* at end of string1? */
jne scloop /* no, keep going */
moveq #0,d0 /* strings are equal */
rts
scexit:
subb a1@-,d0 /* *string1 - *string2 */
extbl d0
rts

View File

@ -1,52 +0,0 @@
/*-
* 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.
*
* @(#)DEFS.h 5.1 (Berkeley) 4/23/90
*
* $Id: DEFS.h,v 1.1.1.1 1993/09/17 18:43:47 phil Exp $
*
* Modified for the ns532 by Phil Nelson, 12/1/92
*
*/
#ifdef PROF
#define ENTRY(x) .globl _/**/x; _/**/x: \
.data; 1:; .long 0; .text; addr 1b,tos ; bsr mcount
#define ASENTRY(x) .globl x; x: \
.data; 1:; .long 0; .text; addr 1b,tos ; bsr mcount
#else
#define ENTRY(x) .globl _/**/x; _/**/x:
#define ASENTRY(x) .globl x; x:
#endif

View File

@ -1,69 +0,0 @@
/*-
* 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.
*
* @(#)SYS.h 5.5 (Berkeley) 5/7/91
*
* $Id: SYS.h,v 1.1.1.1 1993/09/17 18:43:46 phil Exp $
*
* Modified for the ns532 by Phil Nelson, 12/1/92
*
*/
#include <sys/syscall.h>
#ifdef PROF
#define ENTRY(x) .globl _/**/x; \
.data; 1:; .long 0; .text; .align 1; _/**/x: \
addr $1b,tos; bsr mcount
#else
#define ENTRY(x) .globl _/**/x; .text; .align 1; _/**/x:
#endif PROF
#define SYSCALL(x) ENTRY(x); movd SYS_/**/x, r0; svc; bcs cerror
#define RSYSCALL(x) SYSCALL(x); ret 0
#define PSEUDO(x,y) ENTRY(x); movd SYS_/**/y, r0; svc; ret 0
#define CALL(x,y) bsr _/**/y; adjspd -4*x
#define ASMSTR .asciz
.globl cerror
#define SVC svc
#define S_ARG0 4(sp)
#define S_ARG1 8(sp)
#define S_ARG2 12(sp)
#define S_ARG3 16(sp)

View File

@ -1 +0,0 @@
__main(){}

View File

@ -1,64 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: _setjmp.s,v 1.1.1.1 1993/09/17 18:43:47 phil Exp $
*
*/
#include <machine/asm.h>
#include <machine/jmpbuf.h>
ENTRY(_setjmp)
movd 4(sp), r2 /* jmp_buf */
movd 0(sp), JMP_BUF_PC(r2) /* pc of caller */
sprd sp, JMP_BUF_SP(r2)
sprd fp, JMP_BUF_FP(r2)
sprd sb, JMP_BUF_SB(r2)
movd r3, JMP_BUF_R3(r2) /* save registers r3-r7 */
movd r4, JMP_BUF_R4(r2)
movd r5, JMP_BUF_R5(r2)
movd r6, JMP_BUF_R6(r2)
movd r7, JMP_BUF_R7(r2)
movqd 0, r0
ret 0
ENTRY(_longjmp)
movd 4(sp), r2 /* jmp_buf */
movd 8(sp), r0 /* value */
lprd sp, JMP_BUF_SP(r2)
lprd fp, JMP_BUF_FP(r2)
lprd sb, JMP_BUF_SB(r2)
movd JMP_BUF_R3(r2), r3 /* load registers r3-r7 */
movd JMP_BUF_R4(r2), r4
movd JMP_BUF_R5(r2), r5
movd JMP_BUF_R6(r2), r6
movd JMP_BUF_R7(r2), r7
movd JMP_BUF_PC(r2), 0(sp) /* patch return pc */
cmpqd 0, r0
bne nonzero
movqd 1, r0
nonzero:
ret 0

View File

@ -1,37 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: alloca.s,v 1.1.1.1 1993/09/17 18:43:47 phil Exp $
*/
/*
* Note: Saved registers are accessed through the frame pointer so
* no special magic is required here.
*/
#include <machine/asm.h>
ENTRY(alloca)
movd tos,r2 /* get return address */
movd tos,r1 /* get length */
sprd sp,r0
subd r1,r0
lprd sp,r0
movd r1,tos
jump 0(r2)

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: fabs.s,v 1.1.1.1 1993/09/17 18:43:47 phil Exp $
*/
#include <machine/asm.h>
ENTRY(fabs)
absl S_ARG0,f0
ret 0

View File

@ -1,62 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 29-Apr-92 Tero Kivinen (kivinen) at Helsinki University of Technology
* Created.
*
* $Id: frexp.s,v 1.1.1.1 1993/09/17 18:43:47 phil Exp $
*/
/*
double frexp(value, eptr)
double value;
int *eptr;
The frexp subroutine returns the mantissa of a double value
as a double quantity, x, of magnitude less than one and
greater than or equal to 0.5 (0.5 <= |x| < 1) and stores an
integer n such that value = x*2**n indirectly through eptr.
One exception: if the given value is 0, then x and *eptr are made
zero.
*/
#include <machine/asm.h>
ENTRY(frexp)
enter [],8
movd 12(fp),r1 /* value, high 32 bit */
cmpd 0,r1 /* check if 0 */
beq frexp_zero /* we do not support denormalized values */
movd r1,r2
bicd 0x7ff00000,r2 /* clear exponent */
ord 0x3fe00000,r2 /* set it to 1024 == exponent -11 == .5-1 */
lshd -20,r1 /* extract exponent */
andd 0x7ff,r1 /* 11 lower bits */
subd 1022,r1 /* unbias exponent */
movd r1,0(16(fp))
movd 8(fp),-8(fp) /* value, low 32 bit */
movd r2,-4(fp) /* value without exponent, high 32 bit */
movl -8(fp),f0 /* load return value */
exit []
ret 0
frexp_zero:
movqd 0,0(16(fp)) /* return exp = 0, mantissa = 9 */
movdl 0,f0
exit []
ret 0

View File

@ -1,10 +0,0 @@
#ifndef lint
static char rcsid[] = "$Id: infinity.c,v 1.1.1.1 1993/09/17 18:43:47 phil Exp $";
#endif /* not lint */
/* infinity.c */
#include <math.h>
/* bytes for +Infinity on a ns32k */
char __infinity[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 };

View File

@ -1,68 +0,0 @@
/*-
* Copyright (c) 1991 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char sccsid[] = "@(#)isinf.c 5.1 (Berkeley) 3/18/91"; */
static char rcsid[] = "";
#endif /* LIBC_SCCS and not lint */
/* I have not verified that this is correct for the ns32532 -- PAN */
#include <sys/types.h>
isnan(d)
double d;
{
register struct IEEEdp {
u_int manl : 32;
u_int manh : 20;
u_int exp : 11;
u_int sign : 1;
} *p = (struct IEEEdp *)&d;
return(p->exp == 2047 && (p->manh || p->manl));
}
isinf(d)
double d;
{
register struct IEEEdp {
u_int manl : 32;
u_int manh : 20;
u_int exp : 11;
u_int sign : 1;
} *p = (struct IEEEdp *)&d;
return(p->exp == 2047 && !p->manh && !p->manl);
}

View File

@ -1,52 +0,0 @@
/*
* Mach Operating System
* Copyright (c) 1992 Carnegie Mellon University
* Copyright (c) 1992 Helsinki University of Technology
* 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 AND HELSINKI UNIVERSITY OF TECHNOLOGY ALLOW FREE USE
* OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
* HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIM 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.
*/
/*
* HISTORY
* 11-May-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: ntoh.s,v 1.1.1.1 1993/09/17 18:43:48 phil Exp $
*/
#include <machine/asm.h>
.text
Entry(ntohl)
ENTRY(htonl)
movd S_ARG0,r0
rotw 8,r0
rotd 16,r0
rotw 8,r0
ret 0
Entry(ntohs)
ENTRY(htons)
movzwd S_ARG0,r0
rotw 8,r0
ret 0

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: abs.s,v 1.1 1993/09/17 19:12:41 phil Exp $
*/
#include <machine/asm.h>
ENTRY(abs)
absd S_ARG0,r0
ret 0

View File

@ -1,150 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* 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.
*/
#if defined(LIBC_SCCS) && !defined(lint)
/* static char sccsid[] = "@(#)atof.c 5.2 (Berkeley) 4/12/91"; */
static char rcsid[] = "$Id: atof.c,v 1.1 1993/09/17 19:12:44 phil Exp $";
#endif /* LIBC_SCCS and not lint */
/*
* simple atof() for IEEE 754 architectures
*/
#include <machine/endian.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
static double twoemax = 9007199254740992.; /*2^53*/
/* attempt to be as exact as possible */
static struct {
long low_word;
long high_word;
} exp5[] = {
#if BYTE_ORDER == BIG_ENDIAN
{ 0x40140000, 0x00000000 }, /* 5 */
{ 0x40390000, 0x00000000 }, /* 25 */
{ 0x40838800, 0x00000000 }, /* 625 */
{ 0x4117d784, 0x00000000 }, /* 390625 */
{ 0x4241c379, 0x37e08000 }, /* 152587890625 */
{ 0x4493b8b5, 0xb5056e17 }, /* 2.3283064365387e+022 */
{ 0x49384f03, 0xe93ff9f6 }, /* 5.42101086242753e+044 */
{ 0x52827748, 0xf9301d33 }, /* 2.93873587705572e+089 */
{ 0x65154fdd, 0x7f73bf3f } /* 8.63616855509445e+178 */
#else /* BYTE_ORDER == LITTLE_ENDIAN */
{ 0x00000000, 0x40140000 }, /* 5 */
{ 0x00000000, 0x40390000 }, /* 25 */
{ 0x00000000, 0x40838800 }, /* 625 */
{ 0x00000000, 0x4117d784 }, /* 390625 */
{ 0x37e08000, 0x4241c379 }, /* 152587890625 */
{ 0xb5056e17, 0x4493b8b5 }, /* 2.3283064365387e+022 */
{ 0xe93ff9f6, 0x49384f03 }, /* 5.42101086242753e+044 */
{ 0xf9301d33, 0x52827748 }, /* 2.93873587705572e+089 */
{ 0x7f73bf3f, 0x65154fdd } /* 8.63616855509445e+178 */
#endif
};
double
atof(p)
register const char *p;
{
register int c;
register int exp = 0;
register int eexp = 0;
double fl = 0;
double flexp = 1.0;
int bexp;
int neg = 1;
int negexp = 1;
while (isspace(*p))
++p;
if ((c = *p++) == '-')
neg = -1;
else if (c == '+')
/* skip it */;
else
--p;
while ((c = *p++) && isdigit(c))
if (fl < twoemax)
fl = 10 * fl + (c-'0');
else
++exp;
if (c == '.')
while ((c = *p++) && isdigit(c))
if (fl < twoemax) {
fl = 10 * fl + (c-'0');
--exp;
}
if (c == 'E' || c == 'e') {
if ((c = *p++) == '-')
negexp = -1;
else if (c == '+')
/* skip it */;
else
--p;
while ((c = *p++) && isdigit(c))
eexp = 10 * eexp + (c-'0');
if (negexp < 0)
eexp = -eexp;
exp += eexp;
}
bexp = exp;
if (exp < 0)
exp = -exp;
for (c = 0; exp && c < sizeof exp5 / sizeof exp5[0]; ++c) {
if (exp & 1)
flexp *= *(double *)&exp5[c];
exp >>= 1;
}
if (bexp < 0)
fl /= flexp;
else
fl *= flexp;
fl = ldexp(fl, bexp);
return neg < 0 ? -fl : fl;
}

View File

@ -1,73 +0,0 @@
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 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.
*/
/*
* $Id: bzero.c,v 1.1.1.1 1993/09/17 18:43:48 phil Exp $
*/
/*
* Object:
* bzero EXPORTED function
*
* Clear memory locations
*
* Optimize for aligned memory ops, if possible and simple.
* Might need later recoding in assembly for better efficiency.
*/
void
bzero(addr, bcount)
register unsigned addr;
register unsigned bcount;
{
register int i;
if (bcount == 0) /* sanity */
return;
switch (addr & 3) {
case 1:
*((char *) addr++) = 0;
if (--bcount == 0)
return;
case 2:
*((char *) addr++) = 0;
if (--bcount == 0)
return;
case 3:
*((char *) addr++) = 0;
if (--bcount == 0)
return;
default:
break;
}
for (i = bcount >> 2; i; i--, addr += 4)
*((int *) addr) = 0;
switch (bcount & 3) {
case 3: *((char*)addr++) = 0;
case 2: *((char*)addr++) = 0;
case 1: *((char*)addr++) = 0;
default:break;
}
}

View File

@ -1,36 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: Ovfork.s,v 1.1.1.1 1993/09/17 18:43:49 phil Exp $
*/
#include <syscall.h>
#include "SYS.h"
/*
* r0 = pid of child in parent / pid of parent in child
* r1 = 0 in parent, 1 in child
*/
SYSCALL(vfork)
cmpqd 0,r1
beq parent
movqd 0,r0
parent:
ret 0

View File

@ -1,43 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 11-May-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: brk.s,v 1.1.1.1 1993/09/17 18:43:50 phil Exp $
*/
#include <sys/syscall.h>
#include "SYS.h"
.globl _curbrk
.globl _minbrk
ENTRY(_brk)
br ok
ENTRY(brk)
cmpd S_ARG0, _minbrk(pc)
bge ok
movd _minbrk(pc), S_ARG0
ok:
movd SYS_break,r0
SVC
bcs cerror
movd S_ARG0, _curbrk(pc)
movqd 0, r0
ret 0

View File

@ -1,32 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: cerror.s,v 1.1.1.1 1993/09/17 18:43:50 phil Exp $
*/
#include "SYS.h"
.globl cerror
.globl _errno
cerror:
movd r0,_errno(pc)
movd -1,r0
ret 0

View File

@ -1,34 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: exect.s,v 1.1.1.1 1993/09/17 18:43:50 phil Exp $
*/
#include "SYS.h"
#include <machine/psl.h>
ENTRY(exect)
sprb us,r0
orb PSR_T,r0
lprb us,r0
movd SYS_execve,r0
SVC
bcs cerror
ret 0

View File

@ -1,34 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: fork.s,v 1.1.1.1 1993/09/17 18:43:51 phil Exp $
*/
#include <sys/syscall.h>
#include "SYS.h"
/* r0 = pid. r1 = 0 in parent, 1 in child */
SYSCALL(fork)
cmpqd 0, r1
beq parent
movqd 0, r0
parent:
ret 0 /* pid = fork() */

View File

@ -1,29 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: mount.s,v 1.1.1.1 1993/09/17 18:43:50 phil Exp $
*/
#include <syscall.h>
#include "SYS.h"
SYSCALL(mount)
movqd 0,r0
ret 0

View File

@ -1,32 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: pipe.s,v 1.1.1.1 1993/09/17 18:43:50 phil Exp $
*/
#include <sys/syscall.h>
#include <SYS.h>
SYSCALL(pipe)
movd S_ARG0, r2
movd r0, 0(r2)
movd r1, 4(r2)
movqd 0, r0
ret 0

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 1992 Helsinki University of Technology
* 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.
*
* HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
* ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
* LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
* USE OF THIS SOFTWARE.
*/
/*
* HISTORY
* 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
* Created.
*
* $Id: ptrace.s,v 1.1.1.1 1993/09/17 18:43:50 phil Exp $
*/
/*
* This is included for the NetBSD version!
*/
#include <syscall.h>
#include "SYS.h"
.globl EX(errno)
.globl cerror
ENTRY(ptrace)
movqd 0, EX(errno)
movd SYS_ptrace, r0
SVC
bcs cerror
ret 0

View File

@ -1,51 +0,0 @@
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* From: @(#)DEFS.h 8.1 (Berkeley) 6/4/93
* $Id: DEFS.h,v 1.1 1993/09/05 22:14:55 deraadt Exp $
*/
#ifdef PROF
#define FUNC(x) \
.align 4; .globl x; .proc 1; x:; .data; .align 4; 1: .long 0; \
.text; save %sp,-96,%sp; sethi %hi(1b),%o0; call mcount; \
or %lo(1b),%o0,%o0; restore
#else
#define FUNC(x) \
.align 4; .globl x; .proc 1; x:
#endif
#define ENTRY(x) FUNC(_##x)

View File

@ -1,30 +0,0 @@
# $Id: Makefile.inc,v 1.1 1993/09/05 22:14:56 deraadt Exp $
# `source' files built from m4 source
# the name `div.o' is taken for the ANSI C `div' function, hence sdiv here
SRCS+= rem.s sdiv.s udiv.s urem.s
CLEANFILES+=rem.s sdiv.s udiv.s urem.s
sdiv.s: ${.CURDIR}/sparc/gen/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`.div')define(OP,\`div')define(S,\`true')"; \
cat ${.ALLSRC}) | m4 > ${.TARGET}
@chmod 444 ${.TARGET}
udiv.s: ${.CURDIR}/sparc/gen/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`.udiv')define(OP,\`div')define(S,\`false')"; \
cat ${.ALLSRC}) | m4 > ${.TARGET}
@chmod 444 ${.TARGET}
rem.s: ${.CURDIR}/sparc/gen/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`.rem')define(OP,\`rem')define(S,\`true')"; \
cat ${.ALLSRC}) | m4 > ${.TARGET}
@chmod 444 ${.TARGET}
urem.s: ${.CURDIR}/sparc/gen/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`.urem')define(OP,\`rem')define(S,\`false')"; \
cat ${.ALLSRC}) | m4 > ${.TARGET}
@chmod 444 ${.TARGET}

View File

@ -1,89 +0,0 @@
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* @(#)SYS.h 8.1 (Berkeley) 6/4/93
*
* from: Header: SYS.h,v 1.2 92/07/03 18:57:00 torek Exp
* $Id: SYS.h,v 1.1 1993/09/05 22:14:57 deraadt Exp $
*/
#include <sys/syscall.h>
#include <machine/trap.h>
#ifdef PROF
#define ENTRY(x) \
.align 4; .globl _##x; .proc 1; _##x:; .data; .align 4; 1: .long 0; \
.text; save %sp,-96,%sp; sethi %hi(1b),%o0; call mcount; \
or %o0,%lo(1b),%o0; restore
#else
#define ENTRY(x) \
.align 4; .globl _##x; .proc 1; _##x:
#endif
/*
* ERROR branches to cerror. This is done with a macro so that I can
* change it to be position independent later, if need be.
*/
#define ERROR() \
sethi %hi(cerror),%g1; or %lo(cerror),%g1,%g1; jmp %g1; nop
/*
* SYSCALL is used when further action must be taken before returning.
* Note that it adds a `nop' over what we could do, if we only knew what
* came at label 1....
*/
#define SYSCALL(x) \
ENTRY(x); mov SYS_##x,%g1; t ST_SYSCALL; bcc 1f; nop; ERROR(); 1:
/*
* RSYSCALL is used when the system call should just return. Here
* we use the SYSCALL_G2RFLAG to put the `success' return address in %g2
* and avoid a branch.
*/
#define RSYSCALL(x) \
ENTRY(x); mov (SYS_##x)|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \
t ST_SYSCALL; ERROR()
/*
* PSEUDO(x,y) is like RSYSCALL(y) except that the name is x.
*/
#define PSEUDO(x,y) \
ENTRY(x); mov (SYS_##y)|SYSCALL_G2RFLAG,%g1; add %o7,8,%g2; \
t ST_SYSCALL; ERROR()
#define ASMSTR .asciz
.globl cerror

View File

@ -1,90 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: _setjmp.s,v 1.1 91/07/06 16:45:53 torek Exp
* $Id: _setjmp.s,v 1.1 1993/09/05 22:17:49 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)_setjmp.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/*
* C library -- _setjmp, _longjmp
*
* _longjmp(a,v)
* will generate a "return(v?v:1)" from
* the last call to
* _setjmp(a)
* by unwinding the call stack.
* The previous signal state is NOT restored.
*/
#include "DEFS.h"
ENTRY(_setjmp)
std %sp, [%o0+0] /* caller's stack pointer and return pc */
st %fp, [%o0+8] /* store caller's frame pointer */
retl
clr %o0 ! return 0
ENTRY(_longjmp)
addcc %o1, %g0, %g6 ! compute v ? v : 1 in a global register
be,a 0f
mov 1, %g6
0:
mov %o0, %g1 ! save a in another global register
ld [%g1+8], %g7 /* get caller's frame */
1:
cmp %fp, %g7 ! compare against desired frame
bl,a 1b ! if below,
restore ! pop frame and loop
be,a 2f ! if there,
ldd [%g1+0], %o2 ! fetch return %sp and pc, and get out
Lbotch:
call _longjmperror ! otherwise, went too far; bomb out
nop
unimp 0
2:
cmp %o2, %sp ! %sp must not decrease
bge,a 3f
mov %o2, %sp ! it is OK, put it in place
b,a Lbotch
3:
jmp %o3 + 8 ! success, return %g6
mov %g6, %o0

View File

@ -1,274 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: divrem.m4,v 1.4 92/06/25 13:23:57 torek Exp
* $Id: divrem.m4,v 1.1 1993/09/05 22:17:52 deraadt Exp $
*/
/*
* Division and remainder, from Appendix E of the Sparc Version 8
* Architecture Manual, with fixes from Gordon Irlam.
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)divrem.m4 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/*
* Input: dividend and divisor in %o0 and %o1 respectively.
*
* m4 parameters:
* NAME name of function to generate
* OP OP=div => %o0 / %o1; OP=rem => %o0 % %o1
* S S=true => signed; S=false => unsigned
*
* Algorithm parameters:
* N how many bits per iteration we try to get (4)
* WORDSIZE total number of bits (32)
*
* Derived constants:
* TWOSUPN 2^N, for label generation (m4 exponentiation currently broken)
* TOPBITS number of bits in the top `decade' of a number
*
* Important variables:
* Q the partial quotient under development (initially 0)
* R the remainder so far, initially the dividend
* ITER number of main division loop iterations required;
* equal to ceil(log2(quotient) / N). Note that this
* is the log base (2^N) of the quotient.
* V the current comparand, initially divisor*2^(ITER*N-1)
*
* Cost:
* Current estimate for non-large dividend is
* ceil(log2(quotient) / N) * (10 + 7N/2) + C
* A large dividend is one greater than 2^(31-TOPBITS) and takes a
* different path, as the upper bits of the quotient must be developed
* one bit at a time.
*/
define(N, `4')
define(TWOSUPN, `16')
define(WORDSIZE, `32')
define(TOPBITS, eval(WORDSIZE - N*((WORDSIZE-1)/N)))
define(dividend, `%o0')
define(divisor, `%o1')
define(Q, `%o2')
define(R, `%o3')
define(ITER, `%o4')
define(V, `%o5')
/* m4 reminder: ifelse(a,b,c,d) => if a is b, then c, else d */
define(T, `%g1')
define(SC, `%g7')
ifelse(S, `true', `define(SIGN, `%g6')')
/*
* This is the recursive definition for developing quotient digits.
*
* Parameters:
* $1 the current depth, 1 <= $1 <= N
* $2 the current accumulation of quotient bits
* N max depth
*
* We add a new bit to $2 and either recurse or insert the bits in
* the quotient. R, Q, and V are inputs and outputs as defined above;
* the condition codes are expected to reflect the input R, and are
* modified to reflect the output R.
*/
define(DEVELOP_QUOTIENT_BITS,
` ! depth $1, accumulated bits $2
bl L.$1.eval(TWOSUPN+$2)
srl V,1,V
! remainder is positive
subcc R,V,R
ifelse($1, N,
` b 9f
add Q, ($2*2+1), Q
', ` DEVELOP_QUOTIENT_BITS(incr($1), `eval(2*$2+1)')')
L.$1.eval(TWOSUPN+$2):
! remainder is negative
addcc R,V,R
ifelse($1, N,
` b 9f
add Q, ($2*2-1), Q
', ` DEVELOP_QUOTIENT_BITS(incr($1), `eval(2*$2-1)')')
ifelse($1, 1, `9:')')
#include "DEFS.h"
#include <machine/trap.h>
FUNC(NAME)
ifelse(S, `true',
` ! compute sign of result; if neither is negative, no problem
orcc divisor, dividend, %g0 ! either negative?
bge 2f ! no, go do the divide
xor divisor, dividend, SIGN ! compute sign in any case
tst divisor
bge 1f
tst dividend
! divisor is definitely negative; dividend might also be negative
bge 2f ! if dividend not negative...
neg divisor ! in any case, make divisor nonneg
1: ! dividend is negative, divisor is nonnegative
neg dividend ! make dividend nonnegative
2:
')
! Ready to divide. Compute size of quotient; scale comparand.
orcc divisor, %g0, V
bnz 1f
mov dividend, R
! Divide by zero trap. If it returns, return 0 (about as
! wrong as possible, but that is what SunOS does...).
t ST_DIV0
retl
clr %o0
1:
cmp R, V ! if divisor exceeds dividend, done
blu Lgot_result ! (and algorithm fails otherwise)
clr Q
sethi %hi(1 << (WORDSIZE - TOPBITS - 1)), T
cmp R, T
blu Lnot_really_big
clr ITER
! `Here the dividend is >= 2^(31-N) or so. We must be careful here,
! as our usual N-at-a-shot divide step will cause overflow and havoc.
! The number of bits in the result here is N*ITER+SC, where SC <= N.
! Compute ITER in an unorthodox manner: know we need to shift V into
! the top decade: so do not even bother to compare to R.'
1:
cmp V, T
bgeu 3f
mov 1, SC
sll V, N, V
b 1b
inc ITER
! Now compute SC.
2: addcc V, V, V
bcc Lnot_too_big
inc SC
! We get here if the divisor overflowed while shifting.
! This means that R has the high-order bit set.
! Restore V and subtract from R.
sll T, TOPBITS, T ! high order bit
srl V, 1, V ! rest of V
add V, T, V
b Ldo_single_div
dec SC
Lnot_too_big:
3: cmp V, R
blu 2b
nop
be Ldo_single_div
nop
/* NB: these are commented out in the V8-Sparc manual as well */
/* (I do not understand this) */
! V > R: went too far: back up 1 step
! srl V, 1, V
! dec SC
! do single-bit divide steps
!
! We have to be careful here. We know that R >= V, so we can do the
! first divide step without thinking. BUT, the others are conditional,
! and are only done if R >= 0. Because both R and V may have the high-
! order bit set in the first step, just falling into the regular
! division loop will mess up the first time around.
! So we unroll slightly...
Ldo_single_div:
deccc SC
bl Lend_regular_divide
nop
sub R, V, R
mov 1, Q
b Lend_single_divloop
nop
Lsingle_divloop:
sll Q, 1, Q
bl 1f
srl V, 1, V
! R >= 0
sub R, V, R
b 2f
inc Q
1: ! R < 0
add R, V, R
dec Q
2:
Lend_single_divloop:
deccc SC
bge Lsingle_divloop
tst R
b,a Lend_regular_divide
Lnot_really_big:
1:
sll V, N, V
cmp V, R
bleu 1b
inccc ITER
be Lgot_result
dec ITER
tst R ! set up for initial iteration
Ldivloop:
sll Q, N, Q
DEVELOP_QUOTIENT_BITS(1, 0)
Lend_regular_divide:
deccc ITER
bge Ldivloop
tst R
bl,a Lgot_result
! non-restoring fixup here (one instruction only!)
ifelse(OP, `div',
` dec Q
', ` add R, divisor, R
')
Lgot_result:
ifelse(S, `true',
` ! check to see if answer should be < 0
tst SIGN
bl,a 1f
ifelse(OP, `div', `neg Q', `neg R')
1:')
retl
ifelse(OP, `div', `mov Q, %o0', `mov R, %o0')

View File

@ -1,53 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: fabs.s,v 1.4 91/10/07 23:59:05 torek Exp
* $Id: fabs.s,v 1.1 1993/09/05 22:17:54 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)fabs.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/* fabs - floating absolute value */
#include "DEFS.h"
ENTRY(fabs)
std %o0, [%sp + 32] ! return value => %f0:f1
ldd [%sp + 32], %f0 ! (via kernel %o0/%o1 slot)
retl
fabss %f0, %f0 ! return absolute value

View File

@ -1,87 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: fixunsdfsi.s,v 1.3 91/10/08 00:03:15 torek Exp
* $Id: fixunsdfsi.s,v 1.1 1993/09/05 22:17:55 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)fixunsdfsi.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/*
* Convert double to unsigned integer (for gcc).
*
* I have made the output for NaN agree with the Sun compiler, not
* that it really matters, by using `fbul,a'.
*/
#include "DEFS.h"
.align 8
Lbig:
.word 0x41e00000 ! .double 0r2147483648.0e+00
.word 0 ! (who me, not trust the assembler?)
ENTRY(__fixunsdfsi)
sub %sp, 8, %sp
std %o0, [%sp + 64] ! get argument into fpu reg
ldd [%sp + 64], %f0
sethi %hi(Lbig), %g1
ldd [%g1 + %lo(Lbig)], %f2
fcmped %f0, %f2 ! d < 2^31, or NaN, or -Inf?
nop ! (fpop2 delay)
fbul,a 1f ! if so, use fdtoi to convert to int
fdtoi %f0, %f0 ! (this includes negatives!)
! d does not fit in an int, so subtract 2^31, convert,
! and add 2^31 again (sigh). Just hope the intermediate
! fits (if not, the result is undefined anyway).
fsubd %f0, %f2, %f0 ! d -= 2^31
fdtoi %f0, %f0 ! convert to int
st %f0, [%sp + 64] ! move into return reg
ld [%sp + 64], %o0
sethi %hi(0x80000000), %o1
add %o0, %o1, %o0 ! add 2^31
retl
add %sp, 8, %sp
1:
st %f0, [%sp + 64] ! return result
ld [%sp + 64], %o0
retl
add %sp, 8, %sp

View File

@ -1,79 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: frexp.c,v 1.1 91/07/07 04:45:01 torek Exp
* $Id: frexp.c,v 1.1 1993/09/05 22:22:22 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)frexp.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/ieee.h>
/*
* Split the given value into a fraction in the range [0.5, 1.0) and
* an exponent, such that frac * (2^exp) == value. If value is 0,
* return 0.
*/
double
frexp(value, eptr)
double value;
int *eptr;
{
union {
double v;
struct ieee_double s;
} u;
if (value) {
/*
* Fractions in [0.5..1.0) have an exponent of 2^-1.
* Leave Inf and NaN alone, however.
* WHAT ABOUT DENORMS?
*/
u.v = value;
if (u.s.dbl_exp != DBL_EXP_INFNAN) {
*eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
u.s.dbl_exp = DBL_EXP_BIAS - 1;
}
return (u.v);
} else {
*eptr = 0;
return ((double)0);
}
}

View File

@ -1,55 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
* $Id: isinf.c,v 1.1 1993/09/05 22:22:23 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/ieee.h>
isinf(d)
double d;
{
register struct ieee_double *p = (struct ieee_double *)&d;
return (p->dbl_exp == DBL_EXP_INFNAN &&
p->dbl_frach == 0 && p->dbl_fracl == 0);
}

View File

@ -1,51 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: htonl.s,v 1.1 92/06/25 12:47:05 torek Exp
* $Id: htonl.s,v 1.1 1993/09/05 22:18:19 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)htonl.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/* netorder = htonl(hostorder) */
#include "DEFS.h"
ENTRY(htonl)
retl
nop

View File

@ -1,52 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: htons.s,v 1.1 92/06/25 12:47:05 torek Exp
* $Id: htons.s,v 1.1 1993/09/05 22:18:21 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)htons.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/* netorder = htons(hostorder) */
#include "DEFS.h"
ENTRY(htons)
sethi %hi(0xffff0000), %o1
retl
andn %o0, %o1, %o0

View File

@ -1,51 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: ntohl.s,v 1.1 92/06/25 12:47:06 torek Exp
* $Id: ntohl.s,v 1.1 1993/09/05 22:18:22 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)ntohl.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/* hostorder = ntohl(netorder) */
#include "DEFS.h"
ENTRY(ntohl)
retl
nop

View File

@ -1,52 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: ntohs.s,v 1.1 92/06/25 12:47:07 torek Exp
* $Id: ntohs.s,v 1.1 1993/09/05 22:18:24 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)ntohs.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/* hostorder = ntohs(netorder) */
#include "DEFS.h"
ENTRY(ntohs)
sethi %hi(0xffff0000), %o1
retl
andn %o0, %o1, %o0

View File

@ -1,54 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: abs.s,v 1.1 91/07/06 18:01:57 torek Exp
* $Id: abs.s,v 1.1 1993/09/05 22:18:28 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)abs.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/* abs - int absolute value */
#include "DEFS.h"
ENTRY(abs)
tst %o0
bl,a 1f
neg %o0
1: retl
nop

View File

@ -1,146 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: bzero.s,v 1.1 92/06/25 12:52:46 torek Exp
* $Id: bzero.s,v 1.1 1993/09/05 22:18:33 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)bzero.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
/*
* bzero(addr, len)
*
* We should unroll the loop, but at the moment this would
* gain nothing since the `std' instructions are what limits us.
*/
ENTRY(bzero)
! %o0 = addr, %o1 = len
! Optimize a common case: addr and len are both multiples of 8.
or %o0, %o1, %o2
btst 7, %o2 ! ((addr | len) & 7) != 0?
bnz 1f ! if so, cannot optimize
clr %g1 ! in any case, we want g1=0
/* `Good' operands, can just store doubles. */
0:
deccc 8, %o1 ! while ((len -= 8) >= 0)
bge,a 0b
std %g0, [%o0 + %o1] ! *(quad *)(addr + len) = 0;
retl
nop
/*
* Either the address is unaligned, or the count is not a
* multiple of 8, or both. We will have to align the address
* in order to use anything `better' than stb.
*/
1:
cmp %o1, 15 ! len >= 15?
bge,a Lstd ! yes, use std
btst 1, %o0 ! (but first check alignment)
! not enough to bother: do byte-at-a-time loop.
2:
deccc %o1 ! while (--len >= 0)
bge,a 2b
stb %g0, [%o0 + %o1] ! addr[len] = 0;
retl
nop
Lstd:
/*
* There are at least 15 bytes to zero.
* We may have to zero some initial stuff to align
* the address.
*/
bz,a 1f ! if (addr & 1) {
btst 2, %o0
stb %g0, [%o0] ! *addr = 0;
inc %o0 ! addr++;
dec %o1 ! len--;
btst 2, %o0 ! }
1:
bz,a 1f ! if (addr & 2) {
btst 4, %o0
sth %g0, [%o0] ! *(short *)addr = 0;
inc 2, %o0 ! addr += 2;
dec 2, %o1 ! len -= 2;
btst 4, %o0 ! }
1:
bz 1f ! if (addr & 4) {
dec 8, %o1
st %g0, [%o0] ! *(int *)addr = 0;
inc 4, %o0 ! addr += 4;
dec 4, %o1 ! len -= 4;
! }
/*
* Address is double word aligned; len is 8 less than
* the number of bytes remaining (i.e., len is 0 if
* the remaining count is 8, 1 if it is 9, etc.).
*/
1:
std %g0, [%o0] ! do {
2: ! *(quad *)addr = 0;
inc 8, %o0 ! addr += 8;
deccc 8, %o1 ! } while ((len -= 8) >= 0);
bge,a 2b
std %g0, [%o0]
/*
* Len is in [-8..-1] where -8 => done, -7 => 1 byte to zero,
* -6 => two bytes, etc. Mop up this remainder, if any.
*/
btst 4, %o1
bz 1f ! if (len & 4) {
btst 2, %o1
st %g0, [%o0] ! *(int *)addr = 0;
inc 4, %o0 ! addr += 4;
1:
bz 1f ! if (len & 2) {
btst 1, %o1
sth %g0, [%o0] ! *(short *)addr = 0;
inc 2, %o0 ! addr += 2;
1:
bnz,a 1f ! if (len & 1)
stb %g0, [%o0] ! *addr = 0;
1:
retl
nop

View File

@ -1,109 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: ffs.s,v 1.3 92/07/07 00:23:57 torek Exp
* $Id: ffs.s,v 1.1 1993/09/05 22:18:35 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)ffs.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
/*
* ffs returns the number of the rightmost bit set in its argument,
* i.e., the lowest value such that (x & (ffs(x) - 1)) is nonzero.
* If no bits are set, ffs returns 0.
*
* We use a table lookup on each byte.
*
* In each section below, %o1 is the current byte (0, 1, 2, or 3).
* The last byte is handled specially: for the first three,
* if that byte is nonzero, we return the table value
* (plus 0, 8, or 16 for the byte number), but for the last
* one, we just return the table value plus 24. This means
* that ffstab[0] must be -24 so that ffs(0) will return 0.
*/
ENTRY(ffs)
set ffstab, %o2
andcc %o0, 0xff, %o1 ! get low byte
be,a 1f ! try again if 0
srl %o0, 8, %o0 ! delay slot, get ready for next byte
retl ! return ffstab[%o1]
ldsb [%o2 + %o1], %o0
1:
andcc %o0, 0xff, %o1 ! byte 1 like byte 0...
be,a 2f
srl %o0, 8, %o0 ! (use delay to prepare for byte 2)
ldsb [%o2 + %o1], %o0
retl ! return ffstab[%o1] + 8
add %o0, 8, %o0
2:
andcc %o0, 0xff, %o1
be,a 3f
srl %o0, 8, %o0 ! (prepare for byte 3)
ldsb [%o2 + %o1], %o0
retl ! return ffstab[%o1] + 16
add %o0, 16, %o0
3: ! just return ffstab[%o0] + 24
ldsb [%o2 + %o0], %o0
retl
add %o0, 24, %o0
ffstab:
.byte -24,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 00-0f */
.byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 10-1f */
.byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 20-2f */
.byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 30-3f */
.byte 7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 40-4f */
.byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 50-5f */
.byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 60-6f */
.byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 70-7f */
.byte 8,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 80-8f */
.byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 10-9f */
.byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* a0-af */
.byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* b0-bf */
.byte 7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* c0-cf */
.byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* d0-df */
.byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* e0-ef */
.byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* f0-ff */

View File

@ -1,55 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: strlen.s,v 1.1 92/06/25 12:52:47 torek Exp
* $Id: strlen.s,v 1.1 1993/09/05 22:18:37 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)strlen.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
ENTRY(strlen)
add %o0, 1, %o1 ! save starting point + 1
1:
ldsb [%o0], %o2 ! fetch byte
tst %o2 ! null?
bne 1b ! no, keep going
inc %o0 ! always increment pointer
retl
sub %o0, %o1, %o0 ! return length (ptr - (origptr+1))

View File

@ -1,57 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: Ovfork.s,v 1.1 91/07/06 13:05:56 torek Exp
* $Id: Ovfork.s,v 1.1 1993/09/05 22:18:41 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)Ovfork.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/*
* pid = vfork();
*
* %o1 == 0 in parent process, 1 in child process.
* %o0 == pid of child in parent, pid of parent in child.
*/
#include "SYS.h"
SYSCALL(vfork)
dec %o1 ! from 1 to 0 in child, 0 to -1 in parent
retl
and %o0, %o1, %o0 ! return 0 in child, pid in parent

View File

@ -1,69 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: brk.s,v 1.3 92/06/25 12:56:05 mccanne Exp
* $Id: brk.s,v 1.1 1993/09/05 22:18:45 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)brk.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
.globl curbrk
.globl minbrk
.data
minbrk: .long _end ! lower brk limit; also for gmon code
.text
ENTRY(brk)
sethi %hi(minbrk), %o1 ! %o1 = minbrk
ld [%o1 + %lo(minbrk)], %o1
cmp %o1, %o0 ! if (minbrk > %o0)
bg,a 0f
mov %o1, %o0 ! %o0 = minbrk
0:
mov %o0, %o2 ! save argument to syscall
mov SYS_break, %g1
t ST_SYSCALL
bcc,a 1f
sethi %hi(curbrk), %g1
ERROR()
1:
retl ! success, return 0 & record new break
st %o2, [%g1 + %lo(curbrk)]

View File

@ -1,53 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: cerror.s,v 1.3 92/07/02 04:17:59 torek Exp
* $Id: cerror.s,v 1.1 1993/09/05 22:18:47 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)cerror.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
.globl _errno
FUNC(cerror)
sethi %hi(_errno), %g1
st %o0, [%g1 + %lo(_errno)]
mov -1, %o0
retl
mov -1, %o1

View File

@ -1,50 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: exect.s,v 1.1 91/07/06 13:05:57 torek Exp
* $Id: exect.s,v 1.1 1993/09/05 22:18:48 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)exect.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
ENTRY(exect)
mov SYS_execve, %g1 /* execve(file, argv, env) */
t ST_SYSCALL
ERROR()

View File

@ -1,50 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: fork.s,v 1.1 91/07/06 13:05:58 torek Exp
* $Id: fork.s,v 1.1 1993/09/05 22:18:50 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)fork.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
SYSCALL(fork)
dec %o1 ! from 1 to 0 in child, 0 to -1 in parent
retl
and %o0, %o1, %o0 ! return 0 in child, pid in parent

View File

@ -1,57 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: pipe.s,v 1.1 91/07/06 13:05:58 torek Exp
* $Id: pipe.s,v 1.1 1993/09/05 22:18:51 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)pipe.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
ENTRY(pipe)
mov %o0, %o2 ! save pointer
mov SYS_pipe, %g1
t ST_SYSCALL ! pipe()
bcc,a 1f
st %o0, [%o2] ! success, store fds
ERROR()
1:
st %o1, [%o2 + 4]
retl ! and return 0
clr %o0

View File

@ -1,57 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* 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.
*
* from: Header: ptrace.s,v 1.2 91/12/20 01:59:00 leres Exp
* $Id: ptrace.s,v 1.1 1993/09/05 22:18:53 deraadt Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
.asciz "@(#)ptrace.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
ENTRY(ptrace)
sethi %hi(_errno), %g1
st %g0, [%g1 + %lo(_errno)]
mov SYS_ptrace, %g1
t ST_SYSCALL
bcc 1f
nop
ERROR()
1:
retl
nop

View File

@ -1,16 +0,0 @@
# from: @(#)Makefile 5.11 (Berkeley) 9/6/90
# $Id: Makefile,v 1.6 1993/08/01 05:40:05 mycroft Exp $
CFLAGS+=-DYP
LIB= rpc
SRCS= auth_none.c auth_unix.c authunix_prot.c bindresvport.c \
clnt_generic.c clnt_perror.c clnt_raw.c clnt_simple.c clnt_tcp.c \
clnt_udp.c rpc_dtablesize.c get_myaddress.c getrpcent.c getrpcport.c \
pmap_clnt.c pmap_getmaps.c pmap_getport.c pmap_prot.c \
pmap_prot2.c pmap_rmt.c rpc_prot.c rpc_commondata.c rpc_callmsg.c \
svc.c svc_auth.c svc_auth_unix.c svc_raw.c svc_run.c svc_simple.c \
svc_tcp.c svc_udp.c xdr.c xdr_array.c xdr_float.c xdr_mem.c \
xdr_rec.c xdr_reference.c xdr_stdio.c
.include <bsd.lib.mk>

View File

@ -1,135 +0,0 @@
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC";*/
static char *rcsid = "$Id: auth_none.c,v 1.3 1993/08/26 00:53:10 jtc Exp $";
#endif
/*
* auth_none.c
* Creates a client authentication handle for passing "null"
* credentials and verifiers to remote systems.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <rpc/auth.h>
#define MAX_MARSHEL_SIZE 20
/*
* Authenticator operations routines
*/
static void authnone_verf();
static void authnone_destroy();
static bool_t authnone_marshal();
static bool_t authnone_validate();
static bool_t authnone_refresh();
static struct auth_ops ops = {
authnone_verf,
authnone_marshal,
authnone_validate,
authnone_refresh,
authnone_destroy
};
static struct authnone_private {
AUTH no_client;
char marshalled_client[MAX_MARSHEL_SIZE];
u_int mcnt;
} *authnone_private;
AUTH *
authnone_create()
{
register struct authnone_private *ap = authnone_private;
XDR xdr_stream;
register XDR *xdrs;
if (ap == 0) {
ap = (struct authnone_private *)calloc(1, sizeof (*ap));
if (ap == 0)
return (0);
authnone_private = ap;
}
if (!ap->mcnt) {
ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth;
ap->no_client.ah_ops = &ops;
xdrs = &xdr_stream;
xdrmem_create(xdrs, ap->marshalled_client, (u_int)MAX_MARSHEL_SIZE,
XDR_ENCODE);
(void)xdr_opaque_auth(xdrs, &ap->no_client.ah_cred);
(void)xdr_opaque_auth(xdrs, &ap->no_client.ah_verf);
ap->mcnt = XDR_GETPOS(xdrs);
XDR_DESTROY(xdrs);
}
return (&ap->no_client);
}
/*ARGSUSED*/
static bool_t
authnone_marshal(client, xdrs)
AUTH *client;
XDR *xdrs;
{
register struct authnone_private *ap = authnone_private;
if (ap == 0)
return (0);
return ((*xdrs->x_ops->x_putbytes)(xdrs,
ap->marshalled_client, ap->mcnt));
}
static void
authnone_verf()
{
}
static bool_t
authnone_validate()
{
return (TRUE);
}
static bool_t
authnone_refresh()
{
return (FALSE);
}
static void
authnone_destroy()
{
}

View File

@ -1,322 +0,0 @@
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)auth_unix.c 2.2 88/08/01 4.0 RPCSRC";*/
static char *rcsid = "$Id: auth_unix.c,v 1.4 1993/08/26 00:53:11 jtc Exp $";
#endif
/*
* auth_unix.c, Implements UNIX style authentication parameters.
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*
* The system is very weak. The client uses no encryption for it's
* credentials and only sends null verifiers. The server sends backs
* null verifiers or optionally a verifier that suggests a new short hand
* for the credentials.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <rpc/auth.h>
#include <rpc/auth_unix.h>
/*
* Unix authenticator operations vector
*/
static void authunix_nextverf();
static bool_t authunix_marshal();
static bool_t authunix_validate();
static bool_t authunix_refresh();
static void authunix_destroy();
static struct auth_ops auth_unix_ops = {
authunix_nextverf,
authunix_marshal,
authunix_validate,
authunix_refresh,
authunix_destroy
};
/*
* This struct is pointed to by the ah_private field of an auth_handle.
*/
struct audata {
struct opaque_auth au_origcred; /* original credentials */
struct opaque_auth au_shcred; /* short hand cred */
u_long au_shfaults; /* short hand cache faults */
char au_marshed[MAX_AUTH_BYTES];
u_int au_mpos; /* xdr pos at end of marshed */
};
#define AUTH_PRIVATE(auth) ((struct audata *)auth->ah_private)
static bool_t marshal_new_auth();
/*
* Create a unix style authenticator.
* Returns an auth handle with the given stuff in it.
*/
AUTH *
authunix_create(machname, uid, gid, len, aup_gids)
char *machname;
int uid;
int gid;
register int len;
int *aup_gids;
{
struct authunix_parms aup;
char mymem[MAX_AUTH_BYTES];
struct timeval now;
XDR xdrs;
register AUTH *auth;
register struct audata *au;
/*
* Allocate and set up auth handle
*/
auth = (AUTH *)mem_alloc(sizeof(*auth));
#ifndef KERNEL
if (auth == NULL) {
(void)fprintf(stderr, "authunix_create: out of memory\n");
return (NULL);
}
#endif
au = (struct audata *)mem_alloc(sizeof(*au));
#ifndef KERNEL
if (au == NULL) {
(void)fprintf(stderr, "authunix_create: out of memory\n");
return (NULL);
}
#endif
auth->ah_ops = &auth_unix_ops;
auth->ah_private = (caddr_t)au;
auth->ah_verf = au->au_shcred = _null_auth;
au->au_shfaults = 0;
/*
* fill in param struct from the given params
*/
(void)gettimeofday(&now, (struct timezone *)0);
aup.aup_time = now.tv_sec;
aup.aup_machname = machname;
aup.aup_uid = uid;
aup.aup_gid = gid;
aup.aup_len = (u_int)len;
aup.aup_gids = aup_gids;
/*
* Serialize the parameters into origcred
*/
xdrmem_create(&xdrs, mymem, MAX_AUTH_BYTES, XDR_ENCODE);
if (! xdr_authunix_parms(&xdrs, &aup))
abort();
au->au_origcred.oa_length = len = XDR_GETPOS(&xdrs);
au->au_origcred.oa_flavor = AUTH_UNIX;
#ifdef KERNEL
au->au_origcred.oa_base = mem_alloc((u_int) len);
#else
if ((au->au_origcred.oa_base = mem_alloc((u_int) len)) == NULL) {
(void)fprintf(stderr, "authunix_create: out of memory\n");
return (NULL);
}
#endif
bcopy(mymem, au->au_origcred.oa_base, (u_int)len);
/*
* set auth handle to reflect new cred.
*/
auth->ah_cred = au->au_origcred;
marshal_new_auth(auth);
return (auth);
}
/*
* Returns an auth handle with parameters determined by doing lots of
* syscalls.
*/
AUTH *
authunix_create_default()
{
register int len;
char machname[MAX_MACHINE_NAME + 1];
register int uid;
register int gid;
int gids[NGRPS];
if (gethostname(machname, MAX_MACHINE_NAME) == -1)
abort();
machname[MAX_MACHINE_NAME] = 0;
uid = geteuid();
gid = getegid();
if ((len = getgroups(NGRPS, gids)) < 0)
abort();
return (authunix_create(machname, uid, gid, len, gids));
}
/*
* authunix operations
*/
static void
authunix_nextverf(auth)
AUTH *auth;
{
/* no action necessary */
}
static bool_t
authunix_marshal(auth, xdrs)
AUTH *auth;
XDR *xdrs;
{
register struct audata *au = AUTH_PRIVATE(auth);
return (XDR_PUTBYTES(xdrs, au->au_marshed, au->au_mpos));
}
static bool_t
authunix_validate(auth, verf)
register AUTH *auth;
struct opaque_auth verf;
{
register struct audata *au;
XDR xdrs;
if (verf.oa_flavor == AUTH_SHORT) {
au = AUTH_PRIVATE(auth);
xdrmem_create(&xdrs, verf.oa_base, verf.oa_length, XDR_DECODE);
if (au->au_shcred.oa_base != NULL) {
mem_free(au->au_shcred.oa_base,
au->au_shcred.oa_length);
au->au_shcred.oa_base = NULL;
}
if (xdr_opaque_auth(&xdrs, &au->au_shcred)) {
auth->ah_cred = au->au_shcred;
} else {
xdrs.x_op = XDR_FREE;
(void)xdr_opaque_auth(&xdrs, &au->au_shcred);
au->au_shcred.oa_base = NULL;
auth->ah_cred = au->au_origcred;
}
marshal_new_auth(auth);
}
return (TRUE);
}
static bool_t
authunix_refresh(auth)
register AUTH *auth;
{
register struct audata *au = AUTH_PRIVATE(auth);
struct authunix_parms aup;
struct timeval now;
XDR xdrs;
register int stat;
if (auth->ah_cred.oa_base == au->au_origcred.oa_base) {
/* there is no hope. Punt */
return (FALSE);
}
au->au_shfaults ++;
/* first deserialize the creds back into a struct authunix_parms */
aup.aup_machname = NULL;
aup.aup_gids = (int *)NULL;
xdrmem_create(&xdrs, au->au_origcred.oa_base,
au->au_origcred.oa_length, XDR_DECODE);
stat = xdr_authunix_parms(&xdrs, &aup);
if (! stat)
goto done;
/* update the time and serialize in place */
(void)gettimeofday(&now, (struct timezone *)0);
aup.aup_time = now.tv_sec;
xdrs.x_op = XDR_ENCODE;
XDR_SETPOS(&xdrs, 0);
stat = xdr_authunix_parms(&xdrs, &aup);
if (! stat)
goto done;
auth->ah_cred = au->au_origcred;
marshal_new_auth(auth);
done:
/* free the struct authunix_parms created by deserializing */
xdrs.x_op = XDR_FREE;
(void)xdr_authunix_parms(&xdrs, &aup);
XDR_DESTROY(&xdrs);
return (stat);
}
static void
authunix_destroy(auth)
register AUTH *auth;
{
register struct audata *au = AUTH_PRIVATE(auth);
mem_free(au->au_origcred.oa_base, au->au_origcred.oa_length);
if (au->au_shcred.oa_base != NULL)
mem_free(au->au_shcred.oa_base, au->au_shcred.oa_length);
mem_free(auth->ah_private, sizeof(struct audata));
if (auth->ah_verf.oa_base != NULL)
mem_free(auth->ah_verf.oa_base, auth->ah_verf.oa_length);
mem_free((caddr_t)auth, sizeof(*auth));
}
/*
* Marshals (pre-serializes) an auth struct.
* sets private data, au_marshed and au_mpos
*/
static bool_t
marshal_new_auth(auth)
register AUTH *auth;
{
XDR xdr_stream;
register XDR *xdrs = &xdr_stream;
register struct audata *au = AUTH_PRIVATE(auth);
xdrmem_create(xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE);
if ((! xdr_opaque_auth(xdrs, &(auth->ah_cred))) ||
(! xdr_opaque_auth(xdrs, &(auth->ah_verf)))) {
perror("auth_none.c - Fatal marshalling problem");
} else {
au->au_mpos = XDR_GETPOS(xdrs);
}
XDR_DESTROY(xdrs);
}

View File

@ -1,68 +0,0 @@
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
* media and as a part of the software program in whole or part. Users
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
*
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";*/
/*static char *sccsid = "from: @(#)authunix_prot.c 2.1 88/07/29 4.0 RPCSRC";*/
static char *rcsid = "$Id: authunix_prot.c,v 1.3 1993/08/26 00:53:13 jtc Exp $";
#endif
/*
* authunix_prot.c
* XDR for UNIX style authentication parameters for RPC
*
* Copyright (C) 1984, Sun Microsystems, Inc.
*/
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <rpc/auth.h>
#include <rpc/auth_unix.h>
/*
* XDR for unix authentication parameters.
*/
bool_t
xdr_authunix_parms(xdrs, p)
register XDR *xdrs;
register struct authunix_parms *p;
{
if (xdr_u_long(xdrs, &(p->aup_time))
&& xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME)
&& xdr_int(xdrs, &(p->aup_uid))
&& xdr_int(xdrs, &(p->aup_gid))
&& xdr_array(xdrs, (caddr_t *)&(p->aup_gids),
&(p->aup_len), NGRPS, sizeof(int), xdr_int) ) {
return (TRUE);
}
return (FALSE);
}