repo_id
stringlengths 5
115
| size
int64 590
5.01M
| file_path
stringlengths 4
212
| content
stringlengths 590
5.01M
|
|---|---|---|---|
0xffea/MINIX3
| 2,136
|
lib/libc/arch/arm/hardfloat/fpsetsticky.S
|
/* $NetBSD: fpsetsticky.S,v 1.4 2004/08/21 11:21:00 rearnsha Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
* 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 Mark Brinicombe
* for the NetBSD project.
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
/*
* Set the current FP cumulative flags
*/
#ifdef WEAK_ALIAS
WEAK_ALIAS(fpsetsticky, _fpsetsticky)
ENTRY(_fpsetsticky)
#else
ENTRY(fpsetsticky)
#endif
rfs r1
bic r1, r1, #0x1f
and r0, r0, #0x1f
orr r0, r1, r0
wfs r0
mov r0, r1 /* Return old mask */
RET
|
0xffea/MINIX3
| 2,076
|
lib/libc/arch/arm/hardfloat/fpgetmask.S
|
/* $NetBSD: fpgetmask.S,v 1.4 2004/08/21 11:21:00 rearnsha Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
* 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 Mark Brinicombe
* for the NetBSD project.
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
/*
* Return the current FP exception enable mask
*/
#ifdef WEAK_ALIAS
WEAK_ALIAS(fpgetmask, _fpgetmask)
ENTRY(_fpgetmask)
#else
ENTRY(fpgetmask)
#endif
rfs r0
mov r0, r0, lsr #16
and r0, r0, #0x1f
RET
|
0xffea/MINIX3
| 2,060
|
lib/libc/arch/arm/hardfloat/fpgetsticky.S
|
/* $NetBSD: fpgetsticky.S,v 1.4 2004/08/21 11:21:00 rearnsha Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
* 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 Mark Brinicombe
* for the NetBSD project.
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
/*
* Return the current FP cumulative flags
*/
#ifdef WEAK_ALIAS
WEAK_ALIAS(fpgetsticky, _fpgetsticky)
ENTRY(_fpgetsticky)
#else
ENTRY(fpgetsticky)
#endif
rfs r0
and r0, r0, #0x1f
RET
|
0xffea/MINIX3
| 2,160
|
lib/libc/arch/arm/hardfloat/fpsetmask.S
|
/* $NetBSD: fpsetmask.S,v 1.4 2004/08/21 11:21:00 rearnsha Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
* 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 Mark Brinicombe
* for the NetBSD project.
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
/*
* Set the current FP exception enable mask
*/
#ifdef WEAK_ALIAS
WEAK_ALIAS(fpsetmask, _fpsetmask)
ENTRY(_fpsetmask)
#else
ENTRY(fpsetmask)
#endif
rfs r1
bic r1, r1, #0x001f0000
and r0, r0, #0x0000001f
orr r0, r1, r0, lsl #16
wfs r0
mov r0, r1, lsr #16 /* Return old mask */
RET
|
0xffea/MINIX3
| 2,433
|
lib/libc/arch/arm/sys/ptrace.S
|
/* $NetBSD: ptrace.S,v 1.8 2004/08/21 11:30:17 rearnsha Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. 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: @(#)ptrace.s 5.1 (Berkeley) 4/23/90
*/
#include "SYS.h"
ENTRY(ptrace)
#ifdef _REENTRANT
stmfd sp!, {r0-r3, lr}
sub sp, sp, #4 /* align stack */
bl PIC_SYM(_C_LABEL(__errno), PLT)
add sp, sp, #4 /* unalign stack */
mov r1, #0x00000000
str r1, [r0]
ldmfd sp!, {r0-r3, lr}
#else
stmfd sp!, {r0, r1}
#ifdef PIC
/* Setup the GOT */
ldr r0, .Lgot
add r0, pc, r0
.L1:
ldr r1, .Lerrno
ldr r1, [r0, r1]
#else
ldr r1, .Lerrno
#endif /* PIC */
mov r0, #0x00000000
str r0, [r1]
ldmfd sp!, {r0, r1}
#endif /* _REENTRANT */
SYSTRAP(ptrace)
bcs PIC_SYM(CERROR, PLT)
RET
#ifndef _REENTRANT
#ifdef PIC
.align 0
.Lgot:
.word _C_LABEL(_GLOBAL_OFFSET_TABLE_) + (. - (.L1+4))
#endif /* PIC */
.Lerrno:
.word PIC_SYM(_C_LABEL(errno), GOT)
#endif /* !_REENTRANT */
|
0xffea/MINIX3
| 2,647
|
lib/libc/arch/arm/sys/__clone.S
|
/* $NetBSD: __clone.S,v 1.6 2006/04/24 19:00:30 snj Exp $ */
/*
* Copyright (c) 2001 Christopher Gilbert
* All rights reserved.
*
* 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. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <sys/errno.h>
#include "SYS.h"
#ifdef WEAK_ALIAS
WEAK_ALIAS(clone, __clone)
#endif
/*
* int __clone(int (*fn)(void *), void *stack, int flags, void *arg);
*/
ENTRY(__clone)
/* test stack and function are not null */
teq r0, #0x00
teqne r1, #0x00
beq .Leinval
/* place the func and its arg onto the child's stack */
stmfd r1!, {r0, r3}
/* syscall expects (flags, stack) */
mov r0, r2
SYSTRAP(__clone)
bcs PIC_SYM(CERROR, PLT)
/*
* r1 and r0 are the same as from fork:
* r1 == 0 in parent process, r1 == 1 in child process.
* r0 == pid of child in parent, r0 == pid of parent in child.
*/
teq r1, #0x00
/* if this is the parent then just return the pid */
RETc(eq)
/*
* This is the child
* load the function and arg off the stack
*/
ldmfd sp!, {r1, r2}
/* setup return address */
add lr, pc, #.Lreturnhere - . - 8
/* place arg in r0 */
mov r0, r2
/* call the function */
#ifdef _ARM_ARCH_4T
bx r1
#else
mov pc, r1
#endif
.Lreturnhere:
/* call _exit with the returned value */
b PIC_SYM(_C_LABEL(_exit), PLT)
/* NOTREACHED */
/* error handler if func or stack is NULL */
.Leinval:
mov R0, #EINVAL
b PIC_SYM(CERROR, PLT)
|
0xffea/MINIX3
| 1,735
|
lib/libc/arch/arm/sys/exect.S
|
/* $NetBSD: exect.S,v 1.4 2003/08/07 16:42:04 agc Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. 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: @(#)exect.s 5.1 (Berkeley) 4/23/90
*/
#include "SYS.h"
PSEUDO(exect,execve)
|
0xffea/MINIX3
| 1,740
|
lib/libc/arch/arm/sys/__syscall.S
|
/* $NetBSD: __syscall.S,v 1.4 2003/08/07 16:42:03 agc Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. 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: @(#)syscall.s 5.1 (Berkeley) 4/23/90
*/
#include "SYS.h"
RSYSCALL(__syscall)
|
0xffea/MINIX3
| 2,714
|
lib/libc/arch/arm/sys/brk.S
|
/* $NetBSD: brk.S,v 1.8 2004/08/21 11:30:17 rearnsha Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. 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: @(#)brk.s 5.2 (Berkeley) 12/17/90
*/
#include "SYS.h"
.globl _C_LABEL(end)
.globl CURBRK
#ifdef WEAK_ALIAS
WEAK_ALIAS(brk, _brk)
#endif
.data
.align 0
.globl _C_LABEL(__minbrk)
.type _C_LABEL(__minbrk),#object
_C_LABEL(__minbrk):
.word _C_LABEL(end)
/*
* Change the data segment size
*/
ENTRY(_brk)
#ifdef PIC
/* Setup the GOT */
ldr r3, .Lgot
add r3, pc, r3
.L1:
ldr r1, .Lminbrk
ldr r1, [r3, r1]
#else
ldr r1, .Lminbrk
#endif
/* Get the minimum allowable brk address */
ldr r1, [r1]
/*
* Valid the address specified and set to the minimum
* if the address is below minbrk.
*/
cmp r0, r1
movcc r0, r1
mov r2, r0
SYSTRAP(break)
bcs PIC_SYM(CERROR, PLT)
#ifdef PIC
ldr r1, .Lcurbrk
ldr r1, [r3, r1]
#else
ldr r1, .Lcurbrk
#endif
/* Store the new address in curbrk */
str r2, [r1]
/* Return 0 for success */
mov r0, #0x00000000
RET
.align 2
#ifdef PIC
.Lgot:
.word _C_LABEL(_GLOBAL_OFFSET_TABLE_) + (. - (.L1+4))
#endif
.Lminbrk:
.word PIC_SYM(_C_LABEL(__minbrk), GOT)
.Lcurbrk:
.word PIC_SYM(CURBRK, GOT)
|
0xffea/MINIX3
| 2,126
|
lib/libc/arch/arm/sys/__vfork14.S
|
/* $NetBSD: __vfork14.S,v 1.7 2004/08/21 11:30:17 rearnsha Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. 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: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90
*/
#include "SYS.h"
/*
* pid = vfork();
*
* On return from the SWI:
* r1 == 0 in parent process, r1 == 1 in child process.
* r0 == pid of child in parent, r0 == pid of parent in child.
*/
.text
.align 0
ENTRY(__vfork14)
mov r2, r14
SYSTRAP(__vfork14)
bcs PIC_SYM(CERROR, PLT)
mov r14, r2
sub r1, r1, #1 /* r1 == 0xffffffff if parent, 0 if child */
and r0, r0, r1 /* r0 == 0 if child, else unchanged */
RET
|
0xffea/MINIX3
| 1,736
|
lib/libc/arch/arm/sys/syscall.S
|
/* $NetBSD: syscall.S,v 1.4 2003/08/07 16:42:05 agc Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. 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: @(#)syscall.s 5.1 (Berkeley) 4/23/90
*/
#include "SYS.h"
RSYSCALL(syscall)
|
0xffea/MINIX3
| 2,339
|
lib/libc/arch/arm/sys/cerror.S
|
/* $NetBSD: cerror.S,v 1.7 2011/01/14 06:12:17 matt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. 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: @(#)cerror.s 5.1 (Berkeley) 4/23/90
*/
#include "SYS.h"
#ifdef PIC
.hidden CERROR
#endif
ASENTRY(CERROR)
#ifdef _REENTRANT
stmfd sp!, {r4, lr}
mov r4, r0
bl PIC_SYM(_C_LABEL(__errno), PLT)
str r4, [r0]
mvn r0, #0x00000000
mvn r1, #0x00000000
ldmfd sp!, {r4, pc}
#else
#ifdef PIC
/* Setup the GOT */
ldr r3, .Lgot
add r3, pc, r3
.L1:
ldr r1, .Lerrno
ldr r1, [r3, r1]
#else
ldr r1, .Lerrno
#endif /* PIC */
str r0, [r1]
mvn r0, #0x00000000
mvn r1, #0x00000000
RET
#ifdef PIC
.align 0
.Lgot:
.word _C_LABEL(_GLOBAL_OFFSET_TABLE_) + (. - (.L1+4))
#endif /* PIC */
.globl _C_LABEL(errno)
.Lerrno:
.word PIC_SYM(_C_LABEL(errno), GOT)
#endif /* _REENTRANT */
|
0xffea/MINIX3
| 2,034
|
lib/libc/arch/arm/sys/fork.S
|
/* $NetBSD: fork.S,v 1.6 2004/08/21 11:30:17 rearnsha Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. 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: @(#)fork.s 5.1 (Berkeley) 4/23/90
*/
#include "SYS.h"
/*
* pid = fork();
*
* On return from the SWI:
* r1 == 0 in parent process, r1 == 1 in child process.
* r0 == pid of child in parent, r0 == pid of parent in child.
*/
_SYSCALL(__fork,fork)
sub r1, r1, #1 /* r1 == 0xffffffff if parent, 0 if child */
and r0, r0, r1 /* r0 == 0 if child, else unchanged */
RET
|
0xffea/MINIX3
| 1,905
|
lib/libc/arch/arm/sys/pipe.S
|
/* $NetBSD: pipe.S,v 1.6 2004/08/21 11:30:17 rearnsha Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. 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: @(#)pipe.s 5.1 (Berkeley) 4/23/90
*/
#include "SYS.h"
#ifdef WEAK_ALIAS
WEAK_ALIAS(pipe, _pipe)
#endif
ENTRY(_pipe)
mov r2, r0
SYSTRAP(pipe)
bcs PIC_SYM(CERROR, PLT)
str r0, [r2, #0x0000]
str r1, [r2, #0x0004]
mov r0, #0x00000000
RET
|
0xffea/MINIX3
| 2,017
|
lib/libc/arch/arm/sys/__sigtramp2.S
|
/* $NetBSD: __sigtramp2.S,v 1.2 2008/04/28 20:22:55 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
/*
* The ARM signal trampoline is invoked only to return from
* the signal; the kernel calls the signal handler directly.
*
* On entry, the stack looks like:
*
* ucontext structure
* sp-> siginfo structure
* and r5 points to the ucontext
*/
ENTRY_NP(__sigtramp_siginfo_2)
mov r0, r5 /* set the arg */
SYSTRAP(setcontext) /* and call setcontext */
/* If that failed, exit with the error code. */
SYSTRAP(exit)
|
0xffea/MINIX3
| 2,449
|
lib/libc/arch/arm/sys/sbrk.S
|
/* $NetBSD: sbrk.S,v 1.8 2004/08/21 11:30:17 rearnsha Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. 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: @(#)sbrk.s 5.1 (Berkeley) 4/23/90
*/
#include "SYS.h"
.globl _C_LABEL(end)
#ifdef WEAK_ALIAS
WEAK_ALIAS(sbrk, _sbrk)
#endif
.data
.align 0
.globl CURBRK
.type CURBRK,#object
CURBRK:
.word _C_LABEL(end)
/*
* Change the data segment size
*/
ENTRY(_sbrk)
#ifdef PIC
/* Setup the GOT */
ldr r3, .Lgot
add r3, pc, r3
.L1:
ldr r2, .Lcurbrk
ldr r2, [r3, r2]
#else
ldr r2, .Lcurbrk
#endif
/* Get the current brk address */
ldr r1, [r2]
/* Calculate new value */
mov r3, r0
add r0, r0, r1
SYSTRAP(break)
bcs PIC_SYM(CERROR, PLT)
/* Store new curbrk value */
ldr r0, [r2]
add r1, r0, r3
str r1, [r2]
/* Return old curbrk value */
RET
.align 0
#ifdef PIC
.Lgot:
.word _C_LABEL(_GLOBAL_OFFSET_TABLE_) + (. - (.L1+4))
#endif
.Lcurbrk:
.word PIC_SYM(CURBRK, GOT)
|
0xffea/MINIX3
| 2,155
|
lib/libc/arch/arm/sys/getcontext.S
|
/* $NetBSD: getcontext.S,v 1.6 2008/04/28 20:22:55 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: getcontext.S,v 1.6 2008/04/28 20:22:55 martin Exp $")
#endif /* SYSLIBC_SCCS && !lint */
#ifdef WEAK_ALIAS
WEAK_ALIAS(getcontext, _getcontext)
#endif
ENTRY(_getcontext)
mov r2, r0 /* Must save argument pointer. */
SYSTRAP (getcontext)
bcs PIC_SYM(CERROR, PLT)
str lr, [r2, #(36 + 15*4)] /* Adjust PC. */
#ifdef SOFTFLOAT
/* Ahem. */
/* Judging from the softfloat code we should at least save
the exception codes and rounding mode here. */
#endif
mov r0, #0
str r0, [r2, #(36 + 0*4)] /* Return 0. */
RET
|
0xffea/MINIX3
| 3,479
|
lib/libc/arch/arm/gen/setjmp.S
|
/* $NetBSD: setjmp.S,v 1.8 2005/10/16 17:26:24 christos Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe
* 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 Mark Brinicombe
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
/*
* 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 restored.
*/
ENTRY(__setjmp14)
/* Get the signal mask. */
stmfd sp!, {r0-r2, r14}
add r2, r0, #(_JB_SIGMASK * 4)
mov r1, #0x00000000
mov r0, #0x00000000
bl PIC_SYM(_C_LABEL(__sigprocmask14), PLT)
ldmfd sp!, {r0-r2, r14}
ldr r1, .Lsetjmp_magic
str r1, [r0], #4
#ifdef SOFTFLOAT
add r0, r0, #52
#else
/* Store fp registers */
sfm f4, 4, [r0], #48
/* Store fpsr */
rfs r1
str r1, [r0], #0x0004
#endif /*SOFTFLOAT*/
/* Store integer registers */
stmia r0, {r4-r14}
mov r0, #0x00000000
RET
.Lsetjmp_magic:
.word _JB_MAGIC_SETJMP
ENTRY(__longjmp14)
ldr r2, .Lsetjmp_magic
ldr r3, [r0]
teq r2, r3
bne .Lbotch
/* Restore the signal mask. */
stmfd sp!, {r0-r2, r14}
mov r2, #0x00000000
add r1, r0, #(_JB_SIGMASK * 4)
mov r0, #3 /* SIG_SETMASK */
bl PIC_SYM(_C_LABEL(__sigprocmask14), PLT)
ldmfd sp!, {r0-r2, r14}
add r0, r0, #4
#ifdef SOFTFLOAT
add r0, r0, #52
#else
/* Restore fp registers */
lfm f4, 4, [r0], #48
/* Restore FPSR */
ldr r4, [r0], #0x0004
wfs r4
#endif /* SOFTFLOAT */
/* Restore integer registers */
ldmia r0, {r4-r14}
/* Validate sp and r14 */
teq sp, #0
teqne r14, #0
beq .Lbotch
/* Set return value */
mov r0, r1
teq r0, #0x00000000
moveq r0, #0x00000001
RET
/* validation failed, die die die. */
.Lbotch:
bl PIC_SYM(_C_LABEL(longjmperror), PLT)
bl PIC_SYM(_C_LABEL(abort), PLT)
b . - 8 /* Cannot get here */
|
0xffea/MINIX3
| 2,056
|
lib/libc/arch/arm/gen/swapcontext.S
|
/* $NetBSD: swapcontext.S,v 1.5 2008/04/28 20:22:55 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: swapcontext.S,v 1.5 2008/04/28 20:22:55 martin Exp $")
#endif /* LIBC_SCCS && !lint */
ENTRY(swapcontext)
stmfd sp!, {r0-r1, lr} /* Must save oucp, ucp, lr. */
bl PIC_SYM(_C_LABEL(_getcontext), PLT) /* getcontext(oucp) */
cmp r0, #0
ldmfd sp!, {r0-r1, lr}
RETc(ne)
str lr, [r0, #(36 + 15*4)] /* Adjust saved PC. */
#ifdef SOFTFLOAT
/* Ahem. */
#endif
mov r0, r1
bl PIC_SYM(_C_LABEL(setcontext), PLT)
RET
|
0xffea/MINIX3
| 3,150
|
lib/libc/arch/arm/gen/_setjmp.S
|
/* $NetBSD: _setjmp.S,v 1.6 2004/08/21 11:20:10 rearnsha Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe
* 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 Mark Brinicombe
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
/*
* 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.
*
* Note: r0 is the return value
* r1-r3 are scratch registers in functions
*/
ENTRY(_setjmp)
ldr r1, .L_setjmp_magic
str r1, [r0], #4
#ifdef SOFTFLOAT
add r0, r0, #52
#else
/* Store fp registers */
sfm f4, 4, [r0], #48
/* Store fpsr */
rfs r1
str r1, [r0], #0x0004
#endif /* SOFTFLOAT */
/* Store integer registers */
stmia r0, {r4-r14}
mov r0, #0x00000000
RET
.L_setjmp_magic:
.word _JB_MAGIC__SETJMP
ENTRY(_longjmp)
ldr r2, .L_setjmp_magic
ldr r3, [r0], #4
teq r2, r3
bne botch
#ifdef SOFTFLOAT
add r0, r0, #52
#else
/* Restore fp registers */
lfm f4, 4, [r0], #48
/* Restore fpsr */
ldr r4, [r0], #0x0004
wfs r4
#endif /* SOFTFLOAT */
/* Restore integer registers */
ldmia r0, {r4-r14}
/* Validate sp and r14 */
teq sp, #0
teqne r14, #0
beq botch
/* Set return value */
mov r0, r1
teq r0, #0x00000000
moveq r0, #0x00000001
RET
/* validation failed, die die die. */
botch:
bl PIC_SYM(_C_LABEL(longjmperror), PLT)
bl PIC_SYM(_C_LABEL(abort), PLT)
b . - 8 /* Cannot get here */
|
0xffea/MINIX3
| 2,096
|
lib/libc/arch/arm/gen/alloca.S
|
/* $NetBSD: alloca.S,v 1.4 2004/08/21 11:20:10 rearnsha Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe
* 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 Mark Brinicombe
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* like alloc, but automatic automatic free in return */
#include <machine/asm.h>
ENTRY(alloca)
add r0, r0, #0x00000007 /* round up to next 8 byte alignment */
bic r0, r0, #0x00000007
sub sp, sp, r0 /* Adjust the stack pointer */
mov r0, sp /* r0 = base of new space */
RET
|
0xffea/MINIX3
| 2,389
|
lib/libc/arch/arm/gen/sigsetjmp.S
|
/* $NetBSD: sigsetjmp.S,v 1.5 2005/10/16 17:26:24 christos Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe
* 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 Mark Brinicombe
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
/*
* C library -- sigsetjmp, siglongjmp
*
* longjmp(a,v)
* will generate a "return(v)" from the last call to
* setjmp(a, m)
* by restoring registers from the stack.
* The previous signal state is restored.
*/
ENTRY(__sigsetjmp14)
teq r1, #0
beq PIC_SYM(_C_LABEL(_setjmp), PLT)
b PIC_SYM(_C_LABEL(__setjmp14), PLT)
.L_setjmp_magic:
.word _JB_MAGIC__SETJMP
ENTRY(__siglongjmp14)
ldr r2, .L_setjmp_magic
ldr r3, [r0]
teq r2, r3
beq PIC_SYM(_C_LABEL(_longjmp), PLT)
b PIC_SYM(_C_LABEL(__longjmp14), PLT)
|
0xffea/MINIX3
| 1,634
|
lib/libc/arch/arm/string/bzero.S
|
/* $NetBSD: bzero.S,v 1.4 2008/04/28 20:22:55 martin Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Neil A. Carson and Mark Brinicombe
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#define _BZERO
#include "memset.S"
|
0xffea/MINIX3
| 2,234
|
lib/libc/arch/x86_64/sys/ptrace.S
|
/* $NetBSD: ptrace.S,v 1.2 2003/08/07 16:42:37 agc Exp $ */
/*-
* 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. 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: @(#)ptrace.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: ptrace.S,v 1.2 2003/08/07 16:42:37 agc Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
.globl _C_LABEL(__errno)
ENTRY(ptrace)
#ifdef PIC
call PIC_PLT(_C_LABEL(__errno))
#else
call _C_LABEL(__errno)
#endif /* PIC */
movl $0,(%rax)
SYSTRAP(ptrace)
jc err
ret
err:
#ifdef PIC
movq PIC_GOT(CERROR), %rcx
jmp *%rcx
#else
jmp CERROR
#endif
|
0xffea/MINIX3
| 2,762
|
lib/libc/arch/x86_64/sys/__clone.S
|
/* $NetBSD: __clone.S,v 1.2 2002/06/06 20:51:17 fvdl Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Frank van der Linden for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <sys/errno.h>
#include "SYS.h"
#ifdef WEAK_ALIAS
WEAK_ALIAS(clone, __clone)
#endif
.text
/*
* int clone(int (*fn)(void *), void *stack, int flags, void *arg);
*/
ENTRY(__clone)
pushq %r12
pushq %r13
/*
* Sanity checks: func and stack may not be NULL.
*/
testq %rdi,%rdi
je 3f
testq %rsi,%rsi
je 3f
movq %rdi,%r12
movq %rcx,%r13
movq %rdx,%rdi
pushq $0 /* dummy return address */
SYSTRAP(__clone)
jc 4f
cmpl $0,%eax
jne 2f /* we're the parent */
movq %r13,%rdi /* restore argument */
call *%r12 /* this is the clone, call the function */
movq %rax,%rdi
#ifdef PIC
call PIC_PLT(_C_LABEL(_exit))
#else
call _C_LABEL(_exit)
#endif
2:
addq $8,%rsp
popq %r13
popq %r12
ret
3:
movl $EINVAL,%eax
jmp 5f
4:
addq $8,%rsp
5:
popq %r13
popq %r12
#ifdef PIC
movq PIC_GOT(CERROR),%rdx
jmp *%rdx
#else
jmp CERROR
#endif
|
0xffea/MINIX3
| 2,143
|
lib/libc/arch/x86_64/sys/exect.S
|
/* $NetBSD: exect.S,v 1.2 2003/08/07 16:42:37 agc Exp $ */
/*-
* 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. 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: @(#)exect.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: exect.S,v 1.2 2003/08/07 16:42:37 agc Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
#include <machine/psl.h>
ENTRY(exect)
pushfq
orb $(PSL_T>>8),1(%rsp)
popfq
SYSTRAP(execve)
#ifdef PIC
movq PIC_GOT(CERROR), %rcx
jmp *%rcx
#else
jmp CERROR
#endif
|
0xffea/MINIX3
| 2,003
|
lib/libc/arch/x86_64/sys/__syscall.S
|
/* $NetBSD: __syscall.S,v 1.2 2003/08/07 16:42:37 agc Exp $ */
/*-
* 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. 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: @(#)syscall.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: __syscall.S,v 1.2 2003/08/07 16:42:37 agc Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
RSYSCALL(__syscall)
|
0xffea/MINIX3
| 2,565
|
lib/libc/arch/x86_64/sys/brk.S
|
/* $NetBSD: brk.S,v 1.3 2003/08/07 16:42:37 agc Exp $ */
/*-
* 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. 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: @(#)brk.s 5.2 (Berkeley) 12/17/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: brk.S,v 1.3 2003/08/07 16:42:37 agc Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
.globl _end
.globl _C_LABEL(__minbrk)
.globl CURBRK
#ifdef WEAK_ALIAS
WEAK_ALIAS(brk, _brk)
#endif
.data
_C_LABEL(__minbrk):
.quad _end
.text
ENTRY(_brk)
#ifdef PIC
movq PIC_GOT(_C_LABEL(__minbrk)),%rdx
cmpq %rdi,(%rdx)
jb 1f
movq (%rdx),%rdi
1:
SYSTRAP(break)
jc err
movq PIC_GOT(CURBRK),%rdx # set up GOT addressing
movq %rdi,(%rdx)
xorl %eax,%eax
ret
err:
movq PIC_GOT(CERROR),%rdx
jmp *%rdx
#else
cmpq %rdi,_C_LABEL(__minbrk)(%rip)
jb 1f
movq _C_LABEL(__minbrk)(%rip),%rdi
1:
SYSTRAP(break)
jc err
movq %rdi,CURBRK(%rip)
xorl %eax,%eax
ret
err:
jmp CERROR
#endif
|
0xffea/MINIX3
| 2,345
|
lib/libc/arch/x86_64/sys/__vfork14.S
|
/* $NetBSD: __vfork14.S,v 1.3 2003/08/07 16:42:37 agc Exp $ */
/*-
* 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. 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: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: __vfork14.S,v 1.3 2003/08/07 16:42:37 agc Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
/*
* pid = vfork();
*
* %edx == 0 in parent process, %edx == 1 in child process.
* %eax == pid of child in parent, %eax == pid of parent in child.
*
*/
ENTRY(__vfork14)
popq %r9 /* my rta into r9 */
SYSTRAP(__vfork14)
jc err
decl %edx
andl %edx,%eax
jmp *%r9
err:
pushq %r9
#ifdef PIC
movq PIC_GOT(CERROR), %rcx
jmp *%rcx
#else
jmp CERROR
#endif
|
0xffea/MINIX3
| 1,997
|
lib/libc/arch/x86_64/sys/syscall.S
|
/* $NetBSD: syscall.S,v 1.4 2007/11/05 20:30:07 dsl Exp $ */
/*-
* 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. 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: @(#)syscall.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: syscall.S,v 1.4 2007/11/05 20:30:07 dsl Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
RSYSCALL(syscall)
|
0xffea/MINIX3
| 2,204
|
lib/libc/arch/x86_64/sys/cerror.S
|
/* $NetBSD: cerror.S,v 1.3 2003/08/07 16:42:37 agc Exp $ */
/*-
* 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. 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: @(#)cerror.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: cerror.S,v 1.3 2003/08/07 16:42:37 agc Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
.globl _C_LABEL(__errno)
_ENTRY(CERROR)
pushq %r12
movl %eax,%edi
movl %eax,%r12d
#ifdef PIC
call PIC_PLT(_C_LABEL(__errno))
#else
call _C_LABEL(__errno)
#endif /* PIC */
movl %r12d,(%rax)
movq $-1,%rax
popq %r12
ret
|
0xffea/MINIX3
| 2,091
|
lib/libc/arch/x86_64/sys/fork.S
|
/* $NetBSD: fork.S,v 1.3 2003/08/07 16:42:37 agc Exp $ */
/*-
* 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. 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: @(#)fork.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: fork.S,v 1.3 2003/08/07 16:42:37 agc Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
_SYSCALL(__fork,fork)
decl %edx /* from 1 to 0 in child, 0 to -1 in parent */
andl %edx,%eax
ret /* pid = fork(); */
|
0xffea/MINIX3
| 2,099
|
lib/libc/arch/x86_64/sys/pipe.S
|
/* $NetBSD: pipe.S,v 1.2 2003/08/07 16:42:37 agc Exp $ */
/*-
* 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. 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: @(#)pipe.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: pipe.S,v 1.2 2003/08/07 16:42:37 agc Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
#ifdef WEAK_ALIAS
WEAK_ALIAS(pipe, _pipe)
#endif
_SYSCALL(_pipe,pipe)
movl %eax,(%rdi)
movl %edx,4(%rdi)
xorl %eax,%eax
ret
|
0xffea/MINIX3
| 2,201
|
lib/libc/arch/x86_64/sys/__sigtramp2.S
|
/* $NetBSD: __sigtramp2.S,v 1.5 2006/11/08 21:16:40 drochner Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Frank van der Linden for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
/*
* The x86-64 signal trampoline is invoked only to return from
* the signal; the kernel calls the signal handler directly.
*/
NENTRY(__sigtramp_siginfo_2)
movq %r15,%rdi
movq $SYS_setcontext, %rax
syscall
movq $-1,%rdi /* if we return here, something is wrong */
movq $SYS_exit, %rax
syscall
|
0xffea/MINIX3
| 2,527
|
lib/libc/arch/x86_64/sys/sbrk.S
|
/* $NetBSD: sbrk.S,v 1.3 2008/07/02 20:07:43 rmind Exp $ */
/*-
* 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. 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: @(#)sbrk.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: sbrk.S,v 1.3 2008/07/02 20:07:43 rmind Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
.globl _end
.globl CURBRK
#ifdef WEAK_ALIAS
WEAK_ALIAS(sbrk, _sbrk)
#endif
.data
CURBRK: .quad _end
.text
ENTRY(_sbrk)
#ifdef PIC
movq PIC_GOT(CURBRK),%rdx
movq (%rdx),%rax
test %rdi,%rdi
jz out
addq %rax,%rdi
SYSTRAP(break)
jc err
movq PIC_GOT(CURBRK),%rdx
movq (%rdx),%rax
movq %rdi,(%rdx)
out:
ret
err:
mov PIC_GOT(CERROR),%rdx
jmp *%rdx
#else
movq CURBRK(%rip),%rax
test %rdi,%rdi
jz out
movq %rdi,%rsi
addq %rax,%rdi
SYSTRAP(break)
jc err
movq CURBRK(%rip),%rax
addq %rsi,CURBRK(%rip)
out:
ret
err:
jmp CERROR
#endif
|
0xffea/MINIX3
| 2,373
|
lib/libc/arch/x86_64/sys/getcontext.S
|
/* $NetBSD: getcontext.S,v 1.3 2004/03/09 20:21:22 drochner Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Frank van der Linden for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: getcontext.S,v 1.3 2004/03/09 20:21:22 drochner Exp $")
#endif
#ifdef WEAK_ALIAS
WEAK_ALIAS(getcontext, _getcontext)
#endif
/*
* 56 == offsetof(ucontext_t, uc_mcontext)
* 14 == _REG_RAX
* 21 == _REG_RIP
* 24 == _REG_URSP
*/
_SYSCALL(_getcontext,getcontext)
movq (%rsp),%r11
movq %r11,(56 + 21 * 8)(%rdi)
leaq 8(%rsp),%r11
movq %r11,(56 + 24 * 8)(%rdi)
movq $0,(56 + 14 * 8)(%rdi)
xorl %eax,%eax
ret
|
0xffea/MINIX3
| 3,383
|
lib/libc/arch/x86_64/gen/__sigsetjmp14.S
|
/* $NetBSD: __sigsetjmp14.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Frank van der Linden for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: __sigsetjmp14.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $")
#endif
/*
* 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 restored.
*/
ENTRY(__sigsetjmp14)
movq (%rsp),%r11
movq %rbx,(_JB_RBX * 8)(%rdi)
movq %rbp,(_JB_RBP * 8)(%rdi)
movq %r12,(_JB_R12 * 8)(%rdi)
movq %r13,(_JB_R13 * 8)(%rdi)
movq %r14,(_JB_R14 * 8)(%rdi)
movq %r15,(_JB_R15 * 8)(%rdi)
movq %rsp,(_JB_RSP * 8)(%rdi)
movq %r11,(_JB_PC * 8)(%rdi)
movq %rsi,(_JB_SIGFLAG * 8)(%rdi)
testl %esi,%esi
jz 2f
leaq (_JB_SIGMASK * 8)(%rdi),%rdx
xorl %edi,%edi
xorq %rsi,%rsi
#ifdef PIC
call PIC_PLT(_C_LABEL(__sigprocmask14))
#else
call _C_LABEL(__sigprocmask14)
#endif
2: xorl %eax,%eax
ret
ENTRY(__siglongjmp14)
movq %rdi,%r12
pushq %rsi
cmpl $0, (_JB_SIGFLAG * 8)(%rdi)
jz 2f
leaq (_JB_SIGMASK * 8)(%rdi),%rsi
movl $3,%edi /* SIG_SETMASK */
xorq %rdx,%rdx
#ifdef PIC
call PIC_PLT(_C_LABEL(__sigprocmask14))
#else
call _C_LABEL(__sigprocmask14)
#endif
2: popq %rax
movq (_JB_RBX * 8)(%r12),%rbx
movq (_JB_RBP * 8)(%r12),%rbp
movq (_JB_R13 * 8)(%r12),%r13
movq (_JB_R14 * 8)(%r12),%r14
movq (_JB_R15 * 8)(%r12),%r15
movq (_JB_RSP * 8)(%r12),%rsp
movq (_JB_PC * 8)(%r12),%r11
movq (_JB_R12 * 8)(%r12),%r12
testl %eax,%eax
jnz 1f
incl %eax
1: movq %r11,0(%rsp)
ret
|
0xffea/MINIX3
| 2,571
|
lib/libc/arch/x86_64/gen/swapcontext.S
|
/* $NetBSD: swapcontext.S,v 1.4 2007/04/12 12:33:26 pooka Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Frank van der Linden for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: swapcontext.S,v 1.4 2007/04/12 12:33:26 pooka Exp $")
#endif /* LIBC_SCCS && !lint */
/*
* 56 == offsetof(ucontext_t, uc_mcontext)
* 21 == _REG_RIP
* 24 == _REG_URSP
*/
ENTRY(swapcontext)
pushq %rdi /* preserve oucp */
pushq %rsi /* preserve ucp */
#ifdef PIC
call PIC_PLT(_C_LABEL(_getcontext))
#else
call _C_LABEL(_getcontext)
#endif
popq %rsi
popq %rdi
testl %eax,%eax
jnz 2f
movq 0(%rsp),%r11
movq %r11,(56 + 21 * 8)(%rdi)
leaq 8(%rsp),%r11
movq %r11,(56 + 24 * 8)(%rdi)
movq %rsi,%rdi
#ifdef PIC
call PIC_PLT(_C_LABEL(setcontext))
#else
call _C_LABEL(setcontext)
#endif
2:
ret
|
0xffea/MINIX3
| 3,297
|
lib/libc/arch/x86_64/gen/__setjmp14.S
|
/* $NetBSD: __setjmp14.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Frank van der Linden for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: __setjmp14.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $")
#endif
/*
* 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 restored.
*/
ENTRY(__setjmp14)
movq (%rsp),%r11
movq %rbx,(_JB_RBX * 8)(%rdi)
movq %rbp,(_JB_RBP * 8)(%rdi)
movq %r12,(_JB_R12 * 8)(%rdi)
movq %r13,(_JB_R13 * 8)(%rdi)
movq %r14,(_JB_R14 * 8)(%rdi)
movq %r15,(_JB_R15 * 8)(%rdi)
movq %rsp,(_JB_RSP * 8)(%rdi)
movq %r11,(_JB_PC * 8)(%rdi)
leaq (_JB_SIGMASK * 8)(%rdi),%rdx
xorl %edi,%edi
xorq %rsi,%rsi
#ifdef PIC
call PIC_PLT(_C_LABEL(__sigprocmask14))
#else
call _C_LABEL(__sigprocmask14)
#endif
2: xorl %eax,%eax
ret
ENTRY(__longjmp14)
movq %rdi,%r12
movl %esi,%r8d
leaq (_JB_SIGMASK * 8)(%rdi),%rsi
movl $3,%edi /* SIG_SETMASK */
xorq %rdx,%rdx
pushq %r8
#ifdef PIC
call PIC_PLT(_C_LABEL(__sigprocmask14))
#else
call _C_LABEL(__sigprocmask14)
#endif
popq %r8
movq (_JB_RBX * 8)(%r12),%rbx
movq (_JB_RBP * 8)(%r12),%rbp
movq (_JB_R13 * 8)(%r12),%r13
movq (_JB_R14 * 8)(%r12),%r14
movq (_JB_R15 * 8)(%r12),%r15
movq (_JB_RSP * 8)(%r12),%rsp
movq (_JB_PC * 8)(%r12),%r11
movq (_JB_R12 * 8)(%r12),%r12
movl %r8d,%eax
testl %eax,%eax
jnz 1f
incl %eax
1: movq %r11,0(%rsp)
ret
|
0xffea/MINIX3
| 2,938
|
lib/libc/arch/x86_64/gen/_setjmp.S
|
/* $NetBSD: _setjmp.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Frank van der Linden for Wasabi Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: _setjmp.S,v 1.1 2001/06/19 00:25:02 fvdl Exp $")
#endif
/*
* 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.
*/
ENTRY(_setjmp)
movq (%rsp),%r11
movq %rbx,(_JB_RBX * 8)(%rdi)
movq %rbp,(_JB_RBP * 8)(%rdi)
movq %r12,(_JB_R12 * 8)(%rdi)
movq %r13,(_JB_R13 * 8)(%rdi)
movq %r14,(_JB_R14 * 8)(%rdi)
movq %r15,(_JB_R15 * 8)(%rdi)
movq %rsp,(_JB_RSP * 8)(%rdi)
movq %r11,(_JB_PC * 8)(%rdi)
xorl %eax,%eax
ret
ENTRY(_longjmp)
movq (_JB_RBX * 8)(%rdi),%rbx
movq (_JB_RBP * 8)(%rdi),%rbp
movq (_JB_R12 * 8)(%rdi),%r12
movq (_JB_R13 * 8)(%rdi),%r13
movq (_JB_R14 * 8)(%rdi),%r14
movq (_JB_R15 * 8)(%rdi),%r15
movq (_JB_RSP * 8)(%rdi),%rsp
movq (_JB_PC * 8)(%rdi),%r11
movl %esi,%eax
testl %eax,%eax
jnz 1f
incl %eax
1: movq %r11,0(%rsp)
ret
|
0xffea/MINIX3
| 2,684
|
lib/libc/arch/x86_64/gen/resumecontext.S
|
/* $NetBSD: resumecontext.S,v 1.4 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* Modified for x86-64 by [email protected]
*/
#include <machine/asm.h>
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: resumecontext.S,v 1.4 2008/04/28 20:22:58 martin Exp $")
#endif /* LIBC_SCCS && !lint */
/*
* This assembly-language implementation differs from the (obvious)
* C-language implementation only in not clobbering the previous
* function's return address (us), which is the point of the exercise.
*/
NENTRY(_resumecontext) /* profiling prologue would clobber TOS */
leaq -(8 + 784)(%rsp),%rdi /* retaddr + sizeof (ucontext_t) */
andq $~15,%rdi /* align on _UC_UCONTEXT_ALIGN */
movq %rdi,%rsp
#ifdef PIC
call PIC_PLT(_C_LABEL(_getcontext))
#else
call _C_LABEL(_getcontext)
#endif
movq 8(%rsp),%rdi /* uc_link */
testq %rdi,%rdi /* link end? */
jnz 9f
/* normal exit */
#ifdef PIC
call PIC_PLT(_C_LABEL(exit))
#else
call _C_LABEL(exit)
#endif
9:
#ifdef PIC
call PIC_PLT(_C_LABEL(setcontext))
#else
call _C_LABEL(setcontext)
#endif
/* NOTREACHED */
/* something is wrong, pull the brake */
movq $-1,%rdi
movq $SYS_exit,%rax
syscall
/* NOTREACHED */
|
0xffea/MINIX3
| 1,413
|
lib/libc/arch/x86_64/string/strncmp.S
|
/*
* Written by J.T. Conklin <[email protected]>.
* Public domain.
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: strncmp.S,v 1.3 2005/08/03 22:59:50 rpaulo Exp $")
#endif
/*
* NOTE: I've unrolled the loop eight times: large enough to make a
* significant difference, and small enough not to totally trash the
* cache.
*/
ENTRY(strncmp)
testq %rdx,%rdx
jmp L2 /* Jump into the loop! */
L1: incq %rdi
incq %rsi
decq %rdx
L2: jz L4 /* strings are equal */
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
jne L3
incq %rdi
incq %rsi
decq %rdx
jz L4
movb (%rdi),%al
testb %al,%al
jz L3
cmpb %al,(%rsi)
je L1
L3: movzbl (%rdi),%eax /* unsigned comparison */
movzbl (%rsi),%ecx
subl %ecx,%eax
ret
L4: xorl %eax,%eax
ret
|
0xffea/MINIX3
| 1,967
|
lib/libc/arch/x86_64/stdlib/abs.S
|
/* $NetBSD: abs.S,v 1.2 2003/08/07 16:42:36 agc Exp $ */
/*-
* 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. 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: @(#)abs.s 5.2 (Berkeley) 12/17/90
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: abs.S,v 1.2 2003/08/07 16:42:36 agc Exp $")
#endif
ENTRY(abs)
movl %edi,%eax
testl %eax,%eax
jns 1f
negl %eax
1: ret
|
0xffea/MINIX3
| 1,197
|
lib/libc/arch/alpha/sys/ptrace.S
|
/* $NetBSD: ptrace.S,v 1.5 2000/06/14 06:49:03 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include "SYS.h"
LEAF(ptrace, 4)
LDGP(pv)
stl zero, errno
CALLSYS_ERROR(ptrace)
RET
END(ptrace)
|
0xffea/MINIX3
| 2,541
|
lib/libc/arch/alpha/sys/__clone.S
|
/* $NetBSD: __clone.S,v 1.3 2008/04/28 20:22:55 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/errno.h>
#include "SYS.h"
#ifdef WEAK_ALIAS
WEAK_ALIAS(clone, __clone)
#endif
/*
* int __clone(int (*fn)(void *), void *stack, int flags, void *arg);
*/
LEAF(__clone, 4)
br pv, 1f
1: LDGP(pv)
/*
* Sanity checks: func and stack may not be NULL.
*/
beq a0, 9f
beq a1, 9f
/*
* We need to be able to get at the func and arg arguments
* in the child. Luckily, we have a convenient place to
* do this; the child's stack.
*/
subq a1, 16, a1
stq a0, 0(a1)
stq a3, 8(a1)
/*
* The system call expects (flags, stack).
*/
mov a2, a0
CALLSYS_ERROR(__clone)
beq a4, 8f /* a4 (rv[1]) == 0, parent, child pid in v0 */
/*
* Fetch the function and argument from the new stack, and
* pop it back.
*/
ldq pv, 0(sp)
ldq a0, 8(sp)
addq sp, 16, sp
/* Call the clone's entry point. */
CALL((pv))
/* Pass return value to _exit(). */
mov v0, a0
CALL(_exit)
/* NOTREACHED */
8: RET
9: ldiq v0, EINVAL
jmp zero, __cerror
END(__clone)
|
0xffea/MINIX3
| 1,167
|
lib/libc/arch/alpha/sys/exect.S
|
/* $NetBSD: exect.S,v 1.3 2000/06/14 06:49:03 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include "SYS.h"
LEAF(exect, 3)
CALLSYS_ERROR(execve)
RET
END(exect)
|
0xffea/MINIX3
| 1,141
|
lib/libc/arch/alpha/sys/__syscall.S
|
/* $NetBSD: __syscall.S,v 1.1 2000/12/13 07:49:17 mycroft Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include "SYS.h"
RSYSCALL(__syscall)
|
0xffea/MINIX3
| 1,428
|
lib/libc/arch/alpha/sys/brk.S
|
/* $NetBSD: brk.S,v 1.9 2001/05/07 17:19:17 kleink Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include "SYS.h"
.globl _end
IMPORT(__curbrk, 8)
#ifdef WEAK_ALIAS
WEAK_ALIAS(brk, _brk)
#endif
.data
EXPORT(__minbrk)
.quad _end
.text
LEAF(_brk, 1)
br pv, L1 /* XXX profiling */
L1: LDGP(pv)
ldq v0, __minbrk
cmpult a0, v0, t0
cmovne t0, v0, a0
CALLSYS_ERROR(break)
stq a0, __curbrk
mov zero, v0
RET
END(_brk)
|
0xffea/MINIX3
| 1,207
|
lib/libc/arch/alpha/sys/__vfork14.S
|
/* $NetBSD: __vfork14.S,v 1.2 2000/06/14 06:49:03 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include "SYS.h"
SYSCALL(__vfork14)
cmovne a4, zero, v0 /* a4 (rv[1]) != 0, child */
RET
END(__vfork14)
|
0xffea/MINIX3
| 1,133
|
lib/libc/arch/alpha/sys/syscall.S
|
/* $NetBSD: syscall.S,v 1.2 2000/06/14 06:49:03 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include "SYS.h"
RSYSCALL(syscall)
|
0xffea/MINIX3
| 1,644
|
lib/libc/arch/alpha/sys/cerror.S
|
/* $NetBSD: cerror.S,v 1.6 2000/06/14 06:49:03 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include "SYS.h"
#ifdef _REENTRANT
#define FRAME_SIZE 16
#define FRAME_RA_OFFSET 0
#define FRAME_V0_OFFSET 8
#endif
#ifdef _REENTRANT
NESTED(__cerror, 0, FRAME_SIZE, ra, IM_RA|IM_V0, 0)
#else
LEAF(__cerror, 0)
#endif
br t0, L1
L1: LDGP(t0)
#ifdef _REENTRANT
lda sp, -FRAME_SIZE(sp)
stq ra, FRAME_RA_OFFSET(sp)
stq v0, FRAME_V0_OFFSET(sp)
CALL(__errno)
ldq t0, FRAME_V0_OFFSET(sp)
stl t0, 0(v0)
#else
stl v0, errno
#endif
ldiq v0, -1
#ifdef _REENTRANT
ldq ra, FRAME_RA_OFFSET(sp)
lda sp, FRAME_SIZE(sp)
#endif
RET
END(__cerror)
|
0xffea/MINIX3
| 1,221
|
lib/libc/arch/alpha/sys/fork.S
|
/* $NetBSD: fork.S,v 1.5 2003/02/13 02:50:48 nathanw Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include "SYS.h"
LEAF(__fork, 0)
CALLSYS_ERROR(fork)
cmovne a4, zero, v0 /* a4 (rv[1]) != 0, child */
RET
END(__fork)
|
0xffea/MINIX3
| 1,261
|
lib/libc/arch/alpha/sys/pipe.S
|
/* $NetBSD: pipe.S,v 1.4 2001/05/07 17:19:18 kleink Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include "SYS.h"
#ifdef WEAK_ALIAS
WEAK_ALIAS(pipe, _pipe)
#endif
LEAF(_pipe, 0)
CALLSYS_ERROR(pipe)
stl v0, 0(a0)
stl a4, 4(a0)
mov zero, v0
RET
END(_pipe)
|
0xffea/MINIX3
| 1,686
|
lib/libc/arch/alpha/sys/__sigtramp2.S
|
/* $NetBSD: __sigtramp2.S,v 1.2 2006/11/08 21:16:40 drochner Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include "SYS.h"
/*
* The Alpha signal trampoline is invoked only to return from
* the signal; the kernel calls the signal handler directly.
*
* On entry, the stack looks like:
*
* ucontext structure [128] == sp + sizeof(siginfo_t)]
* sp-> siginfo structure [0]
*/
NESTED_NOPROFILE(__sigtramp_siginfo_2,0,0,ra,0,0)
ldgp gp,0(ra)
lda a0,(128)(sp) /* get pointer to ucontext */
CALLSYS_NOERROR(setcontext) /* and call setcontext() with it */
ldiq a0,-1 /* if that failed, set an exit code */
CALLSYS_NOERROR(exit) /* and call exit() */
END(__sigtramp_siginfo_2)
|
0xffea/MINIX3
| 1,388
|
lib/libc/arch/alpha/sys/sbrk.S
|
/* $NetBSD: sbrk.S,v 1.9 2001/05/07 17:19:18 kleink Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include "SYS.h"
.globl _end
#ifdef WEAK_ALIAS
WEAK_ALIAS(sbrk, _sbrk)
#endif
.data
EXPORT(__curbrk)
.quad _end
.text
LEAF(_sbrk, 1)
br pv, L1 /* XXX profiling */
L1: LDGP(pv)
ldq a1, __curbrk
addq a0, a1, a0
CALLSYS_ERROR(break)
stq a0, __curbrk
mov a1, v0
RET
END(_sbrk)
|
0xffea/MINIX3
| 1,821
|
lib/libc/arch/alpha/sys/getcontext.S
|
/* $NetBSD: getcontext.S,v 1.3 2008/04/28 20:22:55 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
#ifdef WEAK_ALIAS
WEAK_ALIAS(getcontext, _getcontext)
#endif
LEAF(_getcontext, 1)
CALLSYS_ERROR(getcontext)
stq ra, (56 + 32 * 8)(a0) /* Adjust saved PC */
stq zero, (56 + 0 * 8)(a0) /* Arrange for a return value of 0 */
RET
END(_getcontext)
|
0xffea/MINIX3
| 1,831
|
lib/libc/arch/alpha/gen/__sigsetjmp14.S
|
/* $NetBSD: __sigsetjmp14.S,v 1.2 2000/06/14 06:49:01 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
/*
* C library -- sigsetjmp, siglongjmp
*
* siglongjmp(a,v)
* will generate a "return(v)" from
* the last call to
* sigsetjmp(a, mask)
* by restoring registers from the stack.
* If `mask' is non-zero, the previous signal
* state will be restored.
*/
.set noreorder
LEAF(__sigsetjmp14, 2)
LDGP(pv)
stq a1, (83 * 8)(a0) /* save the mask */
bne a1, Lsavesig /* if !zero, save signals */
jmp zero, _setjmp /* else don't. */
Lsavesig:
jmp zero, __setjmp14
END(__sigsetjmp14)
LEAF(__siglongjmp14, 2)
LDGP(pv)
ldq t0, (83 * 8)(a0) /* get the mask */
bne t0, Lrestoresig /* if !zero, restore signals */
jmp zero, _longjmp
Lrestoresig:
jmp zero, __longjmp14
END(__siglongjmp14)
|
0xffea/MINIX3
| 2,139
|
lib/libc/arch/alpha/gen/swapcontext.S
|
/* $NetBSD: swapcontext.S,v 1.3 2008/04/28 20:22:55 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
NESTED(swapcontext, 2, 24, ra, IM_RA|IM_A0|IM_A1, 0)
LDGP(pv)
lda sp, -24(sp)
stq ra, (24- 8)(sp) /* must save ra, oucp, ucp */
stq a0, (24-16)(sp)
stq a1, (24-24)(sp)
CALL(_getcontext) /* getcontext(oucp) */
ldq t0, (24-16)(sp)
bne v0, Lerr
ldq t1, (24- 8)(sp)
stq t1, (56 + 26 * 8)(t0) /* Adjust saved RA */
stq t1, (56 + 32 * 8)(t0) /* Adjust saved PC */
lda t1, 24(sp)
stq t1, (56 + 30 * 8)(t0) /* Adjust saved SP */
ldq a0, (24-24)(sp)
CALL(setcontext) /* setcontext(ucp) */
Lerr:
ldq ra, (24- 8)(sp)
lda sp, 24(sp)
RET
END(swapcontext)
|
0xffea/MINIX3
| 3,863
|
lib/libc/arch/alpha/gen/__setjmp14.S
|
/* $NetBSD: __setjmp14.S,v 1.5 2011/06/12 05:44:36 matt Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
#include "assym.h"
/*
* 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,
* and the previous signal state.
*/
.set noreorder
LEAF(__setjmp14, 1)
LDGP(pv)
stq ra, SC_PC(a0) /* sc_pc = return address */
stq s0, (SC_REGS+_REG_S0)(a0) /* saved bits of sc_regs */
stq s1, (SC_REGS+_REG_S1)(a0)
stq s2, (SC_REGS+_REG_S2)(a0)
stq s3, (SC_REGS+_REG_S3)(a0)
stq s4, (SC_REGS+_REG_S4)(a0)
stq s5, (SC_REGS+_REG_S5)(a0)
stq s6, (SC_REGS+_REG_S6)(a0)
stq ra, (SC_REGS+_REG_RA)(a0)
stq sp, (SC_REGS+_REG_SP)(a0)
/*
* get signal information
*/
mov a0, s0 /* squirrel away ptr to sc */
/* see what's blocked */
mov zero, a0 /* how (insignificant) */
mov zero, a1 /* set (NULL) */
lda a2, SC_MASK(s0) /* point to mask in sc */
CALL(__sigprocmask14)
lda sp, -24(sp) /* sizeof struct sigaltstack */
mov zero, a0
mov sp, a1
CALL(__sigaltstack14)
ldl t0, 16(sp) /* offset of ss_flags */
lda sp, 24(sp) /* sizeof struct sigaltstack */
ldq ra, (SC_REGS+_REG_RA)(s0) /* restore return address */
blt v0, botch /* check for error */
and t0, 0x1, t0 /* get SA_ONSTACK flag */
stq t0, SC_ONSTACK(s0) /* and save it in sc_onstack */
/*
* Restore old s0 and a0, and continue saving registers
*/
mov s0, a0
ldq s0, (SC_REGS+_REG_S0)(a0)
ldiq t0, 0xacedbade /* sigcontext magic number */
stq t0, (SC_REGS+_REG_UNIQUE)(a0) /* magic in sc_regs[31] */
/* Too bad we can't check if we actually used FP */
ldiq t0, 1
stq t0, SC_OWNEDFP(a0) /* say we've used FP. */
stt fs0, (2*8 + SC_FPREGS)(a0) /* saved bits of sc_fpregs */
stt fs1, (3*8 + SC_FPREGS)(a0)
stt fs2, (4*8 + SC_FPREGS)(a0)
stt fs3, (5*8 + SC_FPREGS)(a0)
stt fs4, (6*8 + SC_FPREGS)(a0)
stt fs5, (7*8 + SC_FPREGS)(a0)
stt fs6, (8*8 + SC_FPREGS)(a0)
stt fs7, (9*8 + SC_FPREGS)(a0)
excb /* required 4.7.8.1 Alpha ARM */
mf_fpcr ft0 /* get FP control reg */
excb /* required 4.7.8.1 Alpha ARM */
stt ft0, SC_FPCR(a0) /* and store it in sc_fpcr */
stq zero, SC_FP_CONTROL(a0) /* FP software control XXX */
stq zero, (SC_RESERVED + 0*8)(a0) /* sc_reserved[0] */
stq zero, (SC_RESERVED + 1*8)(a0) /* sc_reserved[1] */
stq zero, (SC_XXX + 0*8)(a0) /* sc_xxx[0] */
stq zero, (SC_XXX + 1*8)(a0) /* sc_xxx[1] */
stq zero, (SC_XXX + 2*8)(a0) /* sc_xxx[2] */
stq zero, (SC_XXX + 3*8)(a0) /* sc_xxx[3] */
stq zero, (SC_XXX + 4*8)(a0) /* sc_xxx[4] */
stq zero, (SC_XXX + 5*8)(a0) /* sc_xxx[5] */
stq zero, (SC_XXX + 6*8)(a0) /* sc_xxx[6] */
stq zero, (SC_XXX + 7*8)(a0) /* sc_xxx[7] */
mov zero, v0 /* return zero */
RET
botch:
CALL(abort)
RET /* "can't" get here... */
END(__setjmp14)
|
0xffea/MINIX3
| 1,549
|
lib/libc/arch/alpha/gen/_resumecontext.S
|
/* $NetBSD: _resumecontext.S,v 1.3 2008/04/22 04:47:44 dogcow Exp $ */
/*
* Copyright (c) 2004
* Matthias Drochner. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
LEAF_NOPROFILE(__resumecontext, 0)
LDGP(ra)
CALL(_resumecontext)
END(__resumecontext)
|
0xffea/MINIX3
| 1,171
|
lib/libc/arch/alpha/gen/fabs.S
|
/* $NetBSD: fabs.S,v 1.3 2000/06/14 06:49:02 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* 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 [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
LEAF(fabs, 1)
cpys fzero, fa0, fv0
RET
END(fabs)
|
0xffea/MINIX3
| 2,143
|
lib/libc/arch/mips/sys/ptrace.S
|
/* $NetBSD: ptrace.S,v 1.10 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)ptrace.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: ptrace.S,v 1.10 2009/12/14 01:07:42 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
LEAF(ptrace)
PIC_PROLOGUE(ptrace)
INT_S zero, _C_LABEL(errno) /* BOGUS */
SYSTRAP(ptrace)
bne a3, zero, 1f
PIC_RETURN()
1:
PIC_TAILCALL(__cerror)
END(ptrace)
|
0xffea/MINIX3
| 3,098
|
lib/libc/arch/mips/sys/__clone.S
|
/* $NetBSD: __clone.S,v 1.8 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/errno.h>
#include "SYS.h"
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: __clone.S,v 1.8 2009/12/14 01:07:42 matt Exp $");
#endif /* SYSLIBC_SCCS and not lint */
#ifdef WEAK_ALIAS
WEAK_ALIAS(clone, __clone)
#endif
/*
* int __clone(int (*fn)(void *), void *stack, int flags, void *arg);
*/
LEAF(__clone)
PIC_PROLOGUE(__clone)
/*
* Sanity checks: func and stack may not be NULL.
*/
li v0, EINVAL
beq a0, zero, 8f
beq a1, zero, 8f
/*
* We need to be able to get at the func and arg arguments
* in the child. Luckily, we have a convenient place to
* do this: the child's stack.
*/
PTR_SUBU a1, a1, CALLFRAME_SIZ
REG_S a0, 0(a1)
REG_S a3, SZREG(a1)
/*
* The system call expects (flags, stack).
*/
move a0, a2
SYSTRAP(__clone)
bne a3, zero, 8f
bne v1, zero, 9f # v1 (rv[1]) == 0, parent, child pid in v0
PIC_RETURN() # parent return
8: PIC_TAILCALL(__cerror)
/* NOTREACHED */
9: /*
* Child: Fetch the function and argument from the new stack and create
a frame so that the child can be safely called.
*
* There are already register slots on the stack from above.
* They already include the o32 argument save area. The
* highest is unused. a1 should equal sp now.
*/
REG_L t9, 0(sp)
REG_L a0, SZREG(sp)
REG_S zero, CALLFRAME_RA(sp) /* make sure stack frame ends */
/* Call the clone's entry point. */
SAVE_GP(CALLFRAME_GP)
jal t9
/* Pass the return value to _exit. */
move a0, v0
PIC_TAILCALL(_exit)
/* NOTREACHED */
END(__clone)
|
0xffea/MINIX3
| 2,105
|
lib/libc/arch/mips/sys/exect.S
|
/* $NetBSD: exect.S,v 1.10 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)exect.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: exect.S,v 1.10 2009/12/14 01:07:42 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
LEAF(exect)
PIC_PROLOGUE(exect)
li v0, SYS_execve
syscall
bne a3, zero, 1f
PIC_RETURN()
1:
PIC_TAILCALL(__cerror)
END(exect)
|
0xffea/MINIX3
| 2,470
|
lib/libc/arch/mips/sys/brk.S
|
/* $NetBSD: brk.S,v 1.18 2010/12/12 09:00:37 tsutsui Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)brk.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: brk.S,v 1.18 2010/12/12 09:00:37 tsutsui Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
.globl _C_LABEL(__minbrk)
.globl _C_LABEL(__curbrk)
.globl _C_LABEL(_end)
#ifdef WEAK_ALIAS
WEAK_ALIAS(brk, _brk)
#endif
.data
_C_LABEL(__minbrk):
PTR_WORD _C_LABEL(_end)
.text
LEAF(_brk)
PIC_PROLOGUE(_brk)
PTR_LA t0, _C_LABEL(__minbrk)
PTR_L v0, 0(t0)
bgeu a0, v0, 1f
move a0, v0 # dont allow break < minbrk
1:
li v0, SYS_break
syscall
bne a3, zero, 2f
PTR_LA t0, _C_LABEL(__curbrk)
PTR_S a0, 0(t0)
move v0, zero
PIC_RETURN()
2:
PIC_TAILCALL(__cerror)
END(_brk)
|
0xffea/MINIX3
| 2,408
|
lib/libc/arch/mips/sys/__vfork14.S
|
/* $NetBSD: __vfork14.S,v 1.6 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)Ovfork.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: __vfork14.S,v 1.6 2009/12/14 01:07:42 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
/*
* pid = vfork();
*
* v1 == 0 in parent process, v1 == 1 in child process.
* v0 == pid of child in parent, v0 == pid of parent in child.
*/
LEAF(__vfork14)
PIC_PROLOGUE(__vfork14)
li v0, SYS___vfork14 # system call number for vfork
syscall
beq a3, zero, 1f # jump if no errors
PIC_TAILCALL(__cerror)
1:
beq v1, zero, 2f # parent process ?
move v0, zero # return zero in child
2:
PIC_RETURN()
END(__vfork14)
|
0xffea/MINIX3
| 1,997
|
lib/libc/arch/mips/sys/syscall.S
|
/* $NetBSD: syscall.S,v 1.6 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)syscall.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: syscall.S,v 1.6 2009/12/14 01:07:42 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
RSYSCALL(syscall)
|
0xffea/MINIX3
| 2,823
|
lib/libc/arch/mips/sys/cerror.S
|
/* $NetBSD: cerror.S,v 1.18 2012/02/27 14:48:34 tsutsui Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)cerror.s 8.1 (Berkeley) 6/16/93")
#else
RCSID("$NetBSD: cerror.S,v 1.18 2012/02/27 14:48:34 tsutsui Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
#ifdef PIC
.protected __cerror
#endif
#ifdef _REENTRANT
.globl _C_LABEL(__errno)
NESTED_NOPROFILE(__cerror, CALLFRAME_SIZ, ra)
.mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
PIC_PROLOGUE(__cerror)
PTR_SUBU sp, CALLFRAME_SIZ
PTR_S ra, CALLFRAME_RA(sp)
INT_S v0, CALLFRAME_S0(sp) # save errno value
SAVE_GP(CALLFRAME_GP)
PTR_LA t9, _C_LABEL(__errno) # locate address of errno
RESTORE_GP64 # restore GP (from t3)
jalr t9 # __errno()
INT_L t0, CALLFRAME_S0(sp)
PTR_L ra, CALLFRAME_RA(sp)
INT_S t0, 0(v0) # update errno value
PTR_ADDU sp, CALLFRAME_SIZ
li v0, -1
li v1, -1
j ra # GP has been restored.
END(__cerror)
#else
.globl _C_LABEL(errno)
LEAF_NOPROFILE(__cerror)
PIC_PROLOGUE(__cerror)
INT_S v0, _C_LABEL(errno)
li v0, -1
li v1, -1
PIC_RETURN()
END(__cerror)
#endif /* _REENTRANT */
|
0xffea/MINIX3
| 2,178
|
lib/libc/arch/mips/sys/fork.S
|
/* $NetBSD: fork.S,v 1.12 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)fork.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: fork.S,v 1.12 2009/12/14 01:07:42 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
LEAF(__fork)
PIC_PROLOGUE(__fork)
SYSTRAP(fork) # pid = fork()
bne a3, zero, 2f
beq v1, zero, 1f # v1 == 0 in parent, 1 in child
move v0, zero
1:
PIC_RETURN()
2:
PIC_TAILCALL(__cerror)
END(__fork)
|
0xffea/MINIX3
| 2,256
|
lib/libc/arch/mips/sys/pipe.S
|
/* $NetBSD: pipe.S,v 1.12 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)pipe.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: pipe.S,v 1.12 2009/12/14 01:07:42 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
#ifdef WEAK_ALIAS
WEAK_ALIAS(pipe, _pipe)
#endif
LEAF(_pipe)
PIC_PROLOGUE(_pipe);
SYSTRAP(pipe) # pipe(fildes) int fildes[2];
bne a3, zero, 1f
INT_S v0, 0(a0) # store the two file descriptors
INT_S v1, 4(a0)
move v0, zero
PIC_RETURN()
1:
PIC_TAILCALL(__cerror)
END(_pipe)
|
0xffea/MINIX3
| 2,241
|
lib/libc/arch/mips/sys/__sigtramp2.S
|
/* $NetBSD: __sigtramp2.S,v 1.3 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
#include "assym.h"
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: __sigtramp2.S,v 1.3 2009/12/14 01:07:42 matt Exp $")
#endif /* SYSLIBC_SCCS and not lint */
/*
* The MIPS signal trampoline is invoked only to return from
* the signal; the kernel calls the signal handler directly.
*
* On entry, stack looks like:
*
* sp -> siginfo_t structure
* sp + SIGINFO_SIZE -> ucontext_t structure
*/
LEAF_NOPROFILE(__sigtramp_siginfo_2)
PTR_ADDU a0, sp, SIGINFO_SIZE /* address of ucontext */
SYSTRAP(setcontext) /* and do setcontext */
move a0, v0 /* exit with errno */
SYSTRAP(exit) /* if sigreturn fails */
END(__sigtramp_siginfo_2)
|
0xffea/MINIX3
| 2,497
|
lib/libc/arch/mips/sys/sbrk.S
|
/* $NetBSD: sbrk.S,v 1.18 2010/12/12 09:03:06 tsutsui Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)sbrk.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: sbrk.S,v 1.18 2010/12/12 09:03:06 tsutsui Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
.globl _C_LABEL(__curbrk)
.globl _C_LABEL(_end)
#ifdef WEAK_ALIAS
WEAK_ALIAS(sbrk, _sbrk)
#endif
.data
_C_LABEL(__curbrk):
PTR_WORD _C_LABEL(_end)
.text
LEAF(_sbrk)
PIC_PROLOGUE(_sbrk)
PTR_LA t0, _C_LABEL(__curbrk)
PTR_L v1, 0(t0)
PTR_ADDU a0, a0, v1 # compute current break
SYSTRAP(break)
bne a3, zero, 1f
move v0, v1 # return old val of curbrk from above
PTR_LA t0, _C_LABEL(__curbrk)
PTR_S a0, 0(t0) # save current val of curbrk from above
PIC_RETURN()
1:
PIC_TAILCALL(__cerror)
END(_sbrk)
|
0xffea/MINIX3
| 2,130
|
lib/libc/arch/mips/sys/getcontext.S
|
/* $NetBSD: getcontext.S,v 1.4 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
#include "assym.h"
#include <machine/mcontext.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: getcontext.S,v 1.4 2009/12/14 01:07:42 matt Exp $")
#endif /* SYSLIBC_SCCS && !lint */
#ifdef WEAK_ALIAS
WEAK_ALIAS(getcontext, _getcontext)
#endif
.set reorder
LEAF(_getcontext)
PIC_PROLOGUE(_getcontext)
SYSTRAP(getcontext)
bne a3, zero, 1f
REG_PROLOGUE
REG_S zero, (_OFFSETOF_UC_GREGS + _REG_V0 * SZREG)(a0)
REG_S ra, (_OFFSETOF_UC_GREGS + _REG_EPC * SZREG)(a0)
REG_EPILOGUE
PIC_RETURN()
1:
PIC_TAILCALL(__cerror)
END(_getcontext)
|
0xffea/MINIX3
| 2,862
|
lib/libc/arch/mips/gen/modf.S
|
/* $NetBSD: modf.S,v 1.11 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <mips/asm.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)modf.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: modf.S,v 1.11 2009/12/14 01:07:42 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
/*
* double modf(val, iptr)
* double val, *iptr;
* returns: xxx and n (in *iptr) where val == n.xxx
*/
LEAF(modf)
cfc1 t0, $31 # get the control register
li.d $f2, 4503599627370496e0 # f2 <- 2^52
or t1, t0, 0x3 # set rounding mode to round to zero
xor t1, t1, 0x2 # (i.e., 01)
ctc1 t1, $31
mov.d $f0, $f12 # f0 <- f12
abs.d $f4, $f12 # f4 <- |f12|
c.olt.d $f4, $f2 # f4 ? < f2
bc1f 1f # leave f0 alone if Nan, infinity
# or >=2^52
c.eq.d $f12,$f4 # was f12 positive ?
add.d $f4,$f2,$f4 # round off to integer
bc1f 2f # No -> will have to negate result
sub.d $f0,$f4,$f2 # Remove fudge factor
j 1f # integer fraction got
2:
sub.d $f0,$f2,$f4 # Remove fudge factor and negate
1:
ctc1 t0, $31 # restore old rounding mode
s.d $f0, 0(a2) # save the integer part
sub.d $f0, $f12, $f0 # subtract val - integer part
j ra
END(modf)
|
0xffea/MINIX3
| 5,041
|
lib/libc/arch/mips/gen/setjmp.S
|
/* $NetBSD: setjmp.S,v 1.19 2010/09/03 17:22:51 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/syscall.h>
#include <mips/asm.h>
#include "assym.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: setjmp.S,v 1.19 2010/09/03 17:22:51 matt Exp $")
#endif
#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,
* and a struct sigcontext, see <signal.h>
*/
#define SETJMP_FRAME_SIZE (CALLFRAME_SIZ + STACK_T_SIZE)
NON_LEAF(__setjmp14, SETJMP_FRAME_SIZE, ra)
.mask 0x80010000, (CALLFRAME_RA - CALLFRAME_SIZ)
SETUP_GP
PTR_SUBU sp, sp, SETJMP_FRAME_SIZE # allocate stack frame
SAVE_GP(CALLFRAME_GP)
SETUP_GP64(CALLFRAME_GP, __setjmp14)
REG_S ra, CALLFRAME_RA(sp) # save RA
REG_S s0, CALLFRAME_S0(sp) # save S0
move s0, a0 # save sigcontext
/* Get the signal mask. */
PTR_ADDU a2, a0, _OFFSETOF_SC_MASK # &sc.sc_mask
move a1, zero
jal _C_LABEL(__sigprocmask14) # get current signal mask
/* Get the signal stack. */
move a0, zero
PTR_ADDU a1, sp, CALLFRAME_SIZ # pointer to stack_t
jal _C_LABEL(__sigaltstack14)
move a0, s0 # restore jmpbuf
INT_L v1, CALLFRAME_SIZ+_OFFSETOF_STACK_T_FLAGS(sp)
# get old ss_onstack
and v1, v1, SS_ONSTACK # extract onstack flag
INT_S v1, _OFFSETOF_SC_ONSTACK(a0) # save it in sc_onstack
REG_L s0, CALLFRAME_S0(sp) # restore S0
REG_L ra, CALLFRAME_RA(sp) # restore RA
blt v0, zero, botch # check for sigaltstack() error
nop
/*
* We know we won't need this routine's GP anymore.
*/
RESTORE_GP64
PTR_ADDU sp, sp, SETJMP_FRAME_SIZE # pop stack frame
REG_PROLOGUE
REG_S ra, _OFFSETOF_SC_PC(a0) # sc_pc = return address
REG_LI v0, 0xACEDBADE # sigcontext magic number
REG_S v0, _OFFSETOF_SC_REGS(a0) # saved in sc_regs[0]
REG_S s0, _OFFSETOF_SC_REGS_S0(a0)
REG_S s1, _OFFSETOF_SC_REGS_S1(a0)
REG_S s2, _OFFSETOF_SC_REGS_S2(a0)
REG_S s3, _OFFSETOF_SC_REGS_S3(a0)
REG_S s4, _OFFSETOF_SC_REGS_S4(a0)
REG_S s5, _OFFSETOF_SC_REGS_S5(a0)
REG_S s6, _OFFSETOF_SC_REGS_S6(a0)
REG_S s7, _OFFSETOF_SC_REGS_S7(a0)
REG_S gp, _OFFSETOF_SC_REGS_GP(a0)
REG_S sp, _OFFSETOF_SC_REGS_SP(a0)
REG_S s8, _OFFSETOF_SC_REGS_S8(a0)
#ifdef SOFTFLOAT_FOR_GCC
INT_S zero, _OFFSETOF_SC_FPUSED(a0) # sc_fpused = 0
#else
li v0, 1 # be nice if we could tell
INT_S v0, _OFFSETOF_SC_FPUSED(a0) # sc_fpused = 1
cfc1 v0, $31
INT_S v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
#if defined(__mips_o32) || defined(__mips_o64) || defined(__mips_n32)
FP_S $f20, _OFFSETOF_SC_FPREGS_F20(a0)
FP_S $f22, _OFFSETOF_SC_FPREGS_F22(a0)
#endif
#if defined(__mips_o32) || defined(__mips_o64)
FP_S $f21, _OFFSETOF_SC_FPREGS_F21(a0)
FP_S $f23, _OFFSETOF_SC_FPREGS_F23(a0)
#endif
#if defined(__mips_n32) || defined(__mips_n64)
FP_S $f24, _OFFSETOF_SC_FPREGS_F24(a0)
FP_S $f26, _OFFSETOF_SC_FPREGS_F26(a0)
FP_S $f28, _OFFSETOF_SC_FPREGS_F28(a0)
FP_S $f30, _OFFSETOF_SC_FPREGS_F30(a0)
#endif
#if defined(__mips_n64)
FP_S $f25, _OFFSETOF_SC_FPREGS_F25(a0)
FP_S $f27, _OFFSETOF_SC_FPREGS_F27(a0)
FP_S $f29, _OFFSETOF_SC_FPREGS_F29(a0)
FP_S $f31, _OFFSETOF_SC_FPREGS_F31(a0)
#endif
#endif /* SOFTFLOAT_FOR_GCC */
REG_EPILOGUE
move v0, zero
j ra
botch:
jal _C_LABEL(abort)
END(__setjmp14)
|
0xffea/MINIX3
| 2,495
|
lib/libc/arch/mips/gen/swapcontext.S
|
/* $NetBSD: swapcontext.S,v 1.5 2012/09/12 02:00:52 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
#include "assym.h"
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: swapcontext.S,v 1.5 2012/09/12 02:00:52 manu Exp $")
#endif /* SYSLIBC_SCCS && !lint */
.set reorder
NESTED(swapcontext, CALLFRAME_SIZ, ra)
.mask 0x80000030, (CALLFRAME_RA - CALLFRAME_SIZ)
PTR_SUBU sp, sp, CALLFRAME_SIZ
PTR_S ra, CALLFRAME_RA(sp) # save ra
PTR_S a0, 0(sp) # stash away oucp
PTR_S a1, SZREG(sp) # stash away ucp
SYSTRAP(getcontext)
PTR_L ra, CALLFRAME_RA(sp)
bne a3, zero, 1f
PTR_L v1, 0(sp) # load oucp again for adjustment
PTR_L a0, SZREG(sp) # load ucp
PTR_ADDIU v0, sp, CALLFRAME_SIZ
REG_PROLOGUE
REG_S zero, _OFFSETOF_UC_GREGS_V0(v1)
REG_S ra, _OFFSETOF_UC_GREGS_EPC(v1)
REG_S v0, _OFFSETOF_UC_GREGS_SP(v1)
REG_EPILOGUE
PIC_TAILCALL(setcontext)
/* NOTREACHED */
1:
PTR_ADDU sp, sp, CALLFRAME_SIZ
SETUP_GPX(t0);
SETUP_GP64(t3,swapcontext);
PIC_TAILCALL(__cerror)
END(swapcontext)
|
0xffea/MINIX3
| 6,090
|
lib/libc/arch/mips/gen/ldexp.S
|
/* $NetBSD: ldexp.S,v 1.9 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <mips/asm.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)ldexp.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: ldexp.S,v 1.9 2009/12/14 01:07:42 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
#define DEXP_INF 0x7ff
#define DEXP_BIAS 1023
#define DEXP_MIN -1022
#define DEXP_MAX 1023
#define DFRAC_BITS 52
#define DIMPL_ONE 0x00100000
#define DLEAD_ZEROS 31 - 20
#define STICKYBIT 1
#define GUARDBIT 0x80000000
#define DSIGNAL_NAN 0x00040000
#define DQUIET_NAN0 0x0007ffff
#define DQUIET_NAN1 0xffffffff
/*
* double ldexp(x, N)
* double x; int N;
*
* Return x * (2**N), for integer values N.
*/
LEAF(ldexp)
mfc1 v1, $f13 # get MSW of x
mfc1 t3, $f12 # get LSW of x
sll t1, v1, 1 # get x exponent
srl t1, t1, 32 - 11
beq t1, DEXP_INF, 9f # is it a NAN or infinity?
beq t1, zero, 1f # zero or denormalized number?
addu t1, t1, a2 # scale exponent
sll v0, a2, 20 # position N for addition
bge t1, DEXP_INF, 8f # overflow?
addu v0, v0, v1 # multiply by (2**N)
ble t1, zero, 4f # underflow?
mtc1 v0, $f1 # save MSW of result
mtc1 t3, $f0 # save LSW of result
j ra
1:
sll t2, v1, 32 - 20 # get x fraction
srl t2, t2, 32 - 20
srl t0, v1, 31 # get x sign
bne t2, zero, 1f
beq t3, zero, 9f # result is zero
1:
/*
* Find out how many leading zero bits are in t2,t3 and put in t9.
*/
move v0, t2
move t9, zero
bne t2, zero, 1f
move v0, t3
addu t9, 32
1:
srl ta0, v0, 16
bne ta0, zero, 1f
addu t9, 16
sll v0, 16
1:
srl ta0, v0, 24
bne ta0, zero, 1f
addu t9, 8
sll v0, 8
1:
srl ta0, v0, 28
bne ta0, zero, 1f
addu t9, 4
sll v0, 4
1:
srl ta0, v0, 30
bne ta0, zero, 1f
addu t9, 2
sll v0, 2
1:
srl ta0, v0, 31
bne ta0, zero, 1f
addu t9, 1
/*
* Now shift t2,t3 the correct number of bits.
*/
1:
subu t9, t9, DLEAD_ZEROS # dont count normal leading zeros
li t1, DEXP_MIN + DEXP_BIAS
subu t1, t1, t9 # adjust exponent
addu t1, t1, a2 # scale exponent
li v0, 32
blt t9, v0, 1f
subu t9, t9, v0 # shift fraction left >= 32 bits
sll t2, t3, t9
move t3, zero
b 2f
1:
subu v0, v0, t9 # shift fraction left < 32 bits
sll t2, t2, t9
srl ta0, t3, v0
or t2, t2, ta0
sll t3, t3, t9
2:
bge t1, DEXP_INF, 8f # overflow?
ble t1, zero, 4f # underflow?
sll t2, t2, 32 - 20 # clear implied one bit
srl t2, t2, 32 - 20
3:
sll t1, t1, 31 - 11 # reposition exponent
sll t0, t0, 31 # reposition sign
or t0, t0, t1 # put result back together
or t0, t0, t2
mtc1 t0, $f1 # save MSW of result
mtc1 t3, $f0 # save LSW of result
j ra
4:
li v0, 0x80000000
ble t1, -52, 7f # is result too small for denorm?
sll t2, v1, 31 - 20 # clear exponent, extract fraction
or t2, t2, v0 # set implied one bit
blt t1, -30, 2f # will all bits in t3 be shifted out?
srl t2, t2, 31 - 20 # shift fraction back to normal position
subu t1, t1, 1
sll ta0, t2, t1 # shift right t2,t3 based on exponent
srl t8, t3, t1 # save bits shifted out
negu t1
srl t3, t3, t1
or t3, t3, ta0
srl t2, t2, t1
bge t8, zero, 1f # does result need to be rounded?
addu t3, t3, 1 # round result
sltu ta0, t3, 1
sll t8, t8, 1
addu t2, t2, ta0
bne t8, zero, 1f # round result to nearest
and t3, t3, ~1
1:
mtc1 t3, $f0 # save denormalized result (LSW)
mtc1 t2, $f1 # save denormalized result (MSW)
bge v1, zero, 1f # should result be negative?
neg.d $f0, $f0 # negate result
1:
j ra
2:
mtc1 zero, $f1 # exponent and upper fraction
addu t1, t1, 20 # compute amount to shift right by
sll t8, t2, t1 # save bits shifted out
negu t1
srl t3, t2, t1
bge t8, zero, 1f # does result need to be rounded?
addu t3, t3, 1 # round result
sltu ta0, t3, 1
sll t8, t8, 1
mtc1 ta0, $f1 # exponent and upper fraction
bne t8, zero, 1f # round result to nearest
and t3, t3, ~1
1:
mtc1 t3, $f0
bge v1, zero, 1f # is result negative?
neg.d $f0, $f0 # negate result
1:
j ra
7:
mtc1 zero, $f0 # result is zero
mtc1 zero, $f1
beq t0, zero, 1f # is result positive?
neg.d $f0, $f0 # negate result
1:
j ra
8:
li t1, 0x7ff00000 # result is infinity (MSW)
mtc1 t1, $f1
mtc1 zero, $f0 # result is infinity (LSW)
bge v1, zero, 1f # should result be negative infinity?
neg.d $f0, $f0 # result is negative infinity
1:
add.d $f0, $f0 # cause overflow faults if enabled
j ra
9:
mov.d $f0, $f12 # yes, result is just x
j ra
END(ldexp)
|
0xffea/MINIX3
| 6,260
|
lib/libc/arch/mips/gen/_setjmp.S
|
/* $NetBSD: _setjmp.S,v 1.24 2012/07/08 00:59:34 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/cdefs.h>
#include <mips/regnum.h>
#include <mips/asm.h>
#include <machine/setjmp.h>
#include <machine/signal.h> /* XXX */
#include "assym.h"
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)_setjmp.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: _setjmp.S,v 1.24 2012/07/08 00:59:34 matt Exp $")
#endif
#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.
*/
.set noreorder
LEAF(_setjmp)
REG_PROLOGUE
REG_LI v0, 0xACEDBADE # sigcontext magic number
REG_S ra, _OFFSETOF_SC_PC(a0) # sc_pc = return address
REG_S v0, _OFFSETOF_SC_REGS(a0) # saved in sc_regs[0]
REG_S s0, _OFFSETOF_SC_REGS_S0(a0)
REG_S s1, _OFFSETOF_SC_REGS_S1(a0)
REG_S s2, _OFFSETOF_SC_REGS_S2(a0)
REG_S s3, _OFFSETOF_SC_REGS_S3(a0)
REG_S s4, _OFFSETOF_SC_REGS_S4(a0)
REG_S s5, _OFFSETOF_SC_REGS_S5(a0)
REG_S s6, _OFFSETOF_SC_REGS_S6(a0)
REG_S s7, _OFFSETOF_SC_REGS_S7(a0)
REG_S sp, _OFFSETOF_SC_REGS_SP(a0)
REG_S s8, _OFFSETOF_SC_REGS_S8(a0)
#if defined(__mips_n32) || defined(__mips_n64)
REG_S gp, _OFFSETOF_SC_REGS_GP(a0) # newabi gp is callee-saved
#endif
/*
* In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
* In N64, FP registers F23 .. F31 are callee-saved.
* In O32, FP registers F20 .. F23 are callee-saved.
*/
#ifndef SOFTFLOAT_FOR_GCC
cfc1 v0, $31 # too bad cant check if FP used
#if defined(__mips_n64) || defined(__mips_n32)
FP_S $f30, _OFFSETOF_SC_FPREGS_F30(a0)
FP_S $f28, _OFFSETOF_SC_FPREGS_F28(a0)
FP_S $f26, _OFFSETOF_SC_FPREGS_F26(a0)
FP_S $f24, _OFFSETOF_SC_FPREGS_F24(a0)
#endif
#if defined(__mips_n32) || defined(__mips_o32) || defined(__mips_o64)
FP_S $f22, _OFFSETOF_SC_FPREGS_F22(a0)
FP_S $f20, _OFFSETOF_SC_FPREGS_F20(a0)
#endif
#if defined(__mips_o32) || defined(__mips_o64)
FP_S $f21, _OFFSETOF_SC_FPREGS_F21(a0)
FP_S $f23, _OFFSETOF_SC_FPREGS_F23(a0)
#endif
#if defined(__mips_n64)
FP_S $f25, _OFFSETOF_SC_FPREGS_F25(a0)
FP_S $f27, _OFFSETOF_SC_FPREGS_F27(a0)
FP_S $f29, _OFFSETOF_SC_FPREGS_F29(a0)
FP_S $f31, _OFFSETOF_SC_FPREGS_F31(a0)
#endif
INT_S v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
#endif /* SOFTFLOAT_FOR_GCC */
REG_EPILOGUE
j ra
move v0, zero
END(_setjmp)
LEAF(_longjmp)
PIC_PROLOGUE(_longjmp)
PTR_SUBU sp, sp, CALLFRAME_SIZ
SAVE_GP(CALLFRAME_GP)
REG_PROLOGUE
REG_L v0, _OFFSETOF_SC_REGS(a0) # get magic number
REG_L ra, _OFFSETOF_SC_PC(a0)
REG_LI t0, 0xACEDBADE
bne v0, t0, botch # jump if error
PTR_ADDU sp, sp, CALLFRAME_SIZ # does not matter, sanity
REG_S a1, _OFFSETOF_SC_REGS_V0(a0) # save return value
REG_L s0, _OFFSETOF_SC_REGS_S0(a0)
REG_L s1, _OFFSETOF_SC_REGS_S1(a0)
REG_L s2, _OFFSETOF_SC_REGS_S2(a0)
REG_L s3, _OFFSETOF_SC_REGS_S3(a0)
REG_L s4, _OFFSETOF_SC_REGS_S4(a0)
REG_L s5, _OFFSETOF_SC_REGS_S5(a0)
REG_L s6, _OFFSETOF_SC_REGS_S6(a0)
REG_L s7, _OFFSETOF_SC_REGS_S7(a0)
#if defined(__mips_n32) || defined(__mips_n64)
REG_L gp, _OFFSETOF_SC_REGS_GP(a0)
#endif
#ifndef SOFTFLOAT_FOR_GCC
# get fpu status
INT_L v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
#endif
REG_L sp, _OFFSETOF_SC_REGS_SP(a0)
REG_L s8, _OFFSETOF_SC_REGS_S8(a0)
#ifndef SOFTFLOAT_FOR_GCC
ctc1 v0, $31
/*
* In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
* In N64, FP registers F23 .. F31 are callee-saved.
* In O32, FP registers F20 .. F23 are callee-saved.
*/
#if defined(__mips_n64) || defined(__mips_n32)
FP_L $f30, _OFFSETOF_SC_FPREGS_F30(a0)
FP_L $f28, _OFFSETOF_SC_FPREGS_F28(a0)
FP_L $f26, _OFFSETOF_SC_FPREGS_F26(a0)
FP_L $f24, _OFFSETOF_SC_FPREGS_F24(a0)
#endif
#if defined(__mips_n32) || defined(__mips_o32) || defined(__mips_o64)
FP_L $f22, _OFFSETOF_SC_FPREGS_F22(a0)
FP_L $f20, _OFFSETOF_SC_FPREGS_F20(a0)
#endif
#if defined(__mips_o32) || defined(__mips_o64)
FP_L $f21, _OFFSETOF_SC_FPREGS_F21(a0)
FP_L $f23, _OFFSETOF_SC_FPREGS_F23(a0)
#endif
#if defined(__mips_n64)
FP_L $f25, _OFFSETOF_SC_FPREGS_F25(a0)
FP_L $f27, _OFFSETOF_SC_FPREGS_F27(a0)
FP_L $f29, _OFFSETOF_SC_FPREGS_F29(a0)
FP_L $f31, _OFFSETOF_SC_FPREGS_F31(a0)
#endif
#endif /* SOFTFLOAT_FOR_GCC */
REG_EPILOGUE
j ra
move v0, a1 # get return value in 1st arg
botch:
/*
* We know we aren't returning so we don't care about restoring
* our caller's GP.
*/
jal _C_LABEL(longjmperror)
nop
PIC_TAILCALL(abort)
nop
END(_longjmp)
|
0xffea/MINIX3
| 2,786
|
lib/libc/arch/mips/gen/sigsetjmp.S
|
/* $NetBSD: sigsetjmp.S,v 1.9 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1995,
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Havard Eidnes.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/syscall.h>
#include <mips/regnum.h>
#include <mips/asm.h>
#include <machine/setjmp.h>
#include "assym.h"
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: sigsetjmp.S,v 1.9 2009/12/14 01:07:42 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
/*
* C library -- sigsetjmp, siglongjmp
*
* siglongjmp(a,v)
* will generate a "return(v)" from
* the last call to
* sigsetjmp(a, savemask)
* by restoring registers from the stack,
* and dependent on savemask restores the
* signal mask.
*/
LEAF(__sigsetjmp14)
PIC_PROLOGUE(__sigsetjmp14)
REG_S a1, _JBLEN*SZREG(a0) # save "savemask"
bne a1, 0x0, 1f # do saving of signal mask?
PIC_TAILCALL(_setjmp)
1: PIC_TAILCALL(__setjmp14)
END(__sigsetjmp14)
LEAF(__siglongjmp14)
PIC_PROLOGUE(__siglongjmp14)
REG_L t0, _JBLEN*SZREG(a0) # get "savemask"
bne t0, 0x0, 1f # restore signal mask?
PIC_TAILCALL(_longjmp)
1: PIC_TAILCALL(__longjmp14)
END(__siglongjmp14)
|
0xffea/MINIX3
| 2,460
|
lib/libc/arch/mips/gen/_resumecontext.S
|
/* $NetBSD: _resumecontext.S,v 1.7 2012/09/12 02:00:52 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Wayne Knowles.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#include "SYS.h"
#include "assym.h"
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: _resumecontext.S,v 1.7 2012/09/12 02:00:52 manu Exp $")
#endif /* SYSLIBC_SCCS && !lint */
.set reorder
.hidden _C_LABEL(__resumecontext)
LEAF_NOPROFILE(__resumecontext)
/*
* We get here not by a call through $t9 but thru $ra after the
* function passed to makecontext returns.
*/
PTR_SUBU sp, sp, UCONTEXT_SIZE # get space for ucontext
move a0, sp # arg0 for getcontext
PTR_S zero, _OFFSETOF_UC_LINK(a0) # make sure uc_link is 0
SYSTRAP(getcontext) # get context
PTR_L a0, _OFFSETOF_UC_LINK(a0) # linked context?
beq a0, zero, 1f # nope, exit process
nop
PIC_TAILCALL(setcontext) # yes, become it.
/* NOTREACHED (in theory) */
li a0, -1 # failure,
1:
SYSTRAP(exit) # all hope is lost.
/* NOTREACHED */
END(__resumecontext)
|
0xffea/MINIX3
| 2,128
|
lib/libc/arch/mips/gen/fabs.S
|
/* $NetBSD: fabs.S,v 1.8 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <mips/asm.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)fabs.s 8.1 (Berkeley) 2/16/94")
#else
RCSID("$NetBSD: fabs.S,v 1.8 2009/12/14 01:07:42 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
.set noreorder
/*
* fabs(x)
* double x;
*
* Return absolute value of x.
*/
LEAF(fabs)
j ra
abs.d $f0, $f12 # compute absolute value of x
END(fabs)
|
0xffea/MINIX3
| 3,875
|
lib/libc/arch/mips/string/bcmp.S
|
/* $NetBSD: bcmp.S,v 1.9 2009/12/14 01:07:42 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <mips/asm.h>
#define _LOCORE /* XXX not really, just assembly-code source */
#include <machine/endian.h> /* LWLO/LWHI, SWLO/SWHI */
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)bcmp.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: bcmp.S,v 1.9 2009/12/14 01:07:42 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
/* bcmp(s1, s2, n) */
LEAF(bcmp)
.set noreorder
blt a2, 16, small # is it worth any trouble?
xor v0, a0, a1 # compare low two bits of addresses
and v0, v0, 3
PTR_SUBU a3, zero, a1 # compute # bytes to word align address
bne v0, zero, unaligned # not possible to align addresses
and a3, a3, 3
beq a3, zero, 1f
PTR_SUBU a2, a2, a3 # subtract from remaining count
move v0, v1 # init v0,v1 so unmodified bytes match
LWHI v0, 0(a0) # read 1, 2, or 3 bytes
LWHI v1, 0(a1)
PTR_ADDU a1, a1, a3
bne v0, v1, nomatch
PTR_ADDU a0, a0, a3
1:
and a3, a2, ~3 # compute number of whole words left
PTR_SUBU a2, a2, a3 # which has to be >= (16-3) & ~3
PTR_ADDU a3, a3, a0 # compute ending address
2:
lw v0, 0(a0) # compare words
lw v1, 0(a1)
PTR_ADDU a0, a0, 4
bne v0, v1, nomatch
PTR_ADDU a1, a1, 4
bne a0, a3, 2b
nop
b small # finish remainder
nop
unaligned:
beq a3, zero, 2f
PTR_SUBU a2, a2, a3 # subtract from remaining count
PTR_ADDU a3, a3, a0 # compute ending address
1:
lbu v0, 0(a0) # compare bytes until a1 word aligned
lbu v1, 0(a1)
PTR_ADDU a0, a0, 1
bne v0, v1, nomatch
PTR_ADDU a1, a1, 1
bne a0, a3, 1b
nop
2:
and a3, a2, ~3 # compute number of whole words left
PTR_SUBU a2, a2, a3 # which has to be >= (16-3) & ~3
PTR_ADDU a3, a3, a0 # compute ending address
3:
LWHI v0, 0(a0) # compare words a0 unaligned, a1 aligned
LWLO v0, 3(a0)
lw v1, 0(a1)
PTR_ADDU a0, a0, 4
bne v0, v1, nomatch
PTR_ADDU a1, a1, 4
bne a0, a3, 3b
nop
small:
ble a2, zero, match
PTR_ADDU a3, a2, a0 # compute ending address
1:
lbu v0, 0(a0)
lbu v1, 0(a1)
PTR_ADDU a0, a0, 1
bne v0, v1, nomatch
PTR_ADDU a1, a1, 1
bne a0, a3, 1b
nop
match:
j ra
move v0, zero
nomatch:
j ra
li v0, 1
.set reorder
END(bcmp)
|
0xffea/MINIX3
| 3,452
|
lib/libc/arch/mips/string/bzero.S
|
/* $NetBSD: bzero.S,v 1.10 2009/12/14 02:53:52 matt Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell.
*
* 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. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <mips/asm.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)bzero.s 8.1 (Berkeley) 6/4/93")
#else
RCSID("$NetBSD: bzero.S,v 1.10 2009/12/14 02:53:52 matt Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
#define _LOCORE /* XXX not really, just assembly-code source */
#include <machine/endian.h>
/* bzero(s1, n) */
LEAF(bzero)
.set noreorder
blt a1, 3*SZREG, smallclr # small amount to clear?
PTR_SUBU a3, zero, a0 # compute # bytes to word align address
and a3, a3, SZREG-1
beq a3, zero, 1f # skip if word aligned
#if SZREG == 4
PTR_SUBU a1, a1, a3 # subtract from remaining count
SWHI zero, 0(a0) # clear 1, 2, or 3 bytes to align
PTR_ADDU a0, a0, a3
#endif
#if SZREG == 8
PTR_SUBU a1, a1, a3 # subtract from remaining count
PTR_ADDU a0, a0, a3 # align dst to next word
sll a3, a3, 3 # bits to bytes
li a2, -1 # make a mask
#if _BYTE_ORDER == _BIG_ENDIAN
REG_SRLV a2, a2, a3 # we want to keep the MSB bytes
#endif
#if _BYTE_ORDER == _LITTLE_ENDIAN
REG_SLLV a2, a2, a3 # we want to keep the LSB bytes
#endif
nor a2, zero, a2 # complement the mask
REG_L v0, -SZREG(a0) # load the word to partially clear
and v0, v0, a2 # clear the bytes
REG_S v0, -SZREG(a0) # store it back
#endif
1:
and v0, a1, SZREG-1 # compute number of words left
PTR_SUBU a3, a1, v0
move a1, v0
PTR_ADDU a3, a3, a0 # compute ending address
2:
PTR_ADDU a0, a0, SZREG # clear words
bne a0, a3, 2b # unrolling loop doesnt help
REG_S zero, -SZREG(a0) # since we are limited by memory speed
smallclr:
ble a1, zero, 2f
PTR_ADDU a3, a1, a0 # compute ending address
1:
PTR_ADDU a0, a0, 1 # clear bytes
bne a0, a3, 1b
sb zero, -1(a0)
2:
j ra
nop
END(bzero)
|
0xffea/MINIX3
| 1,442
|
lib/libc/arch/powerpc/sys/ptrace.S
|
/* $NetBSD: ptrace.S,v 1.6 2011/01/16 02:43:10 matt Exp $ */
#include "SYS.h"
#include "assym.h"
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: ptrace.S,v 1.6 2011/01/16 02:43:10 matt Exp $")
#endif /* LIBC_SCCS && !lint */
#define XCALLFRAMELEN ((((2+5)*SZREG) + CALLFRAMELEN - 1) & -CALLFRAMELEN)
#define XCALLFRAME_DATA (XCALLFRAMELEN - 1*SZREG)
#define XCALLFRAME_ADDR (XCALLFRAMELEN - 2*SZREG)
#define XCALLFRAME_PID (XCALLFRAMELEN - 3*SZREG)
#define XCALLFRAME_REQUEST (XCALLFRAMELEN - 4*SZREG)
#define XCALLFRAME_R30 (XCALLFRAMELEN - 5*SZREG)
ENTRY(ptrace)
#ifdef _REENTRANT
mflr %r0
stw %r0,CALLFRAME_LR(%r1)
stwu %r1,-XCALLFRAMELEN(%r1)
stw %r3,XCALLFRAME_REQUEST(%r1)
stw %r4,XCALLFRAME_PID(%r1)
stw %r5,XCALLFRAME_ADDR(%r1)
stw %r6,XCALLFRAME_DATA(%r1)
#ifdef PIC
stw %r30,XCALLFRAME_R30(%r1)
PIC_TOCSETUP(ptrace, %r30)
#endif
bl PIC_PLT(_C_LABEL(__errno))
li %r7,0
stw %r7,0(%r3)
#ifdef PIC
lwz %r30,XCALLFRAME_R30(%r1)
#endif
lwz %r6,XCALLFRAME_DATA(%r1)
lwz %r4,XCALLFRAME_PID(%r1)
lwz %r5,XCALLFRAME_ADDR(%r1)
lwz %r3,XCALLFRAME_REQUEST(%r1)
addi %r1,%r1,XCALLFRAMELEN
lwz %r0,CALLFRAME_LR(%r1)
mtlr %r0
#else
#ifdef PIC
mflr %r0
PIC_GOTSETUP(%r7)
lwz %r7,_C_LABEL(errno)@got(%r7)
li %r8,0
stw %r8,0(%r7)
mtlr 0
#else
lis %r7,_C_LABEL(errno)@ha
li %r8,0
stw %r8,_C_LABEL(errno)@l(%r7)
#endif /* PIC */
#endif /* _REENTRANT */
_DOSYSCALL(ptrace)
bnslr
b _C_LABEL(__cerror)
|
0xffea/MINIX3
| 2,400
|
lib/libc/arch/powerpc/sys/__clone.S
|
/* $NetBSD: __clone.S,v 1.4 2011/01/16 02:43:10 matt Exp $ */
/*-
* Copyright (c) 2001 Tsubai Masanari. 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. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/errno.h>
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: __clone.S,v 1.4 2011/01/16 02:43:10 matt Exp $")
#endif /* LIBC_SCCS && !lint */
#ifdef WEAK_ALIAS
WEAK_ALIAS(clone, __clone)
#endif
/*
* int __clone(int (*fn)(void *), void *stack, int flags, void *arg);
*/
ENTRY(__clone)
/*
* Sanity checks: func and stack may not be NULL.
*/
cmpwi %r3,0
beq 1f
cmpwi %r4,0
beq 1f
mr %r7,%r3 /* Save fn in r7. */
mr %r3,%r5
_DOSYSCALL(__clone) /* (flags, stack) */
bso 2f /* error... */
cmpwi %r3,0
bnelr /* We're the parent, just return. */
mtlr %r7 /* fn */
mr %r3,%r6 /* arg */
blrl /* Call the clone's entry point. */
#ifdef PIC
PIC_TOCSETUP(__clone, %r30) /* exit won't return so blow away r30 */
#endif
bl PIC_PLT(_C_LABEL(_exit))
1:
li %r3,EINVAL
2:
b _C_LABEL(__cerror)
END(__clone)
|
0xffea/MINIX3
| 1,097
|
lib/libc/arch/powerpc/sys/cerror.S
|
/* $NetBSD: cerror.S,v 1.10 2012/02/27 15:47:11 matt Exp $ */
#include "SYS.h"
#include "assym.h"
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: cerror.S,v 1.10 2012/02/27 15:47:11 matt Exp $")
#endif /* LIBC_SCCS && !lint */
#ifndef _REENTRANT
.globl _C_LABEL(errno)
#endif
#ifdef PIC
.protected _C_LABEL(__cerror)
#endif
ENTRY(__cerror)
#ifdef _REENTRANT
mflr %r0
stwu %r1,-CALLFRAMELEN(%r1) # allocate new stack frame
stw %r0,CALLFRAMELEN+CALLFRAME_LR(%r1)
#ifdef PIC
stw %r30,CALLFRAME_R30(%r1)
PIC_TOCSETUP(__cerror, %r30)
#endif
stw %r31,CALLFRAME_R31(%r1)
mr %r31,%r3 # stash away in callee-saved register
bl PIC_PLT(_C_LABEL(__errno))
stw %r31,0(%r3)
lwz %r0,CALLFRAMELEN+CALLFRAME_LR(%r1)
lwz %r31,CALLFRAME_R31(%r1)
#ifdef PIC
lwz %r30,CALLFRAME_R30(%r1)
#endif
mtlr %r0
addi %r1,%r1,CALLFRAMELEN
#else
#ifdef PIC
mflr %r10
PIC_GOTSETUP(%r4)
lwz %r4,_C_LABEL(errno)@got(%r4)
stw %r3,0(%r4)
mtlr %r10
#else
lis %r4,_C_LABEL(errno)@ha
stw %r3,_C_LABEL(errno)@l(%r4)
#endif /* PIC */
#endif /* _REENTRANT */
li %r3,-1
li %r4,-1
blr
END(__cerror)
|
0xffea/MINIX3
| 2,197
|
lib/libc/arch/powerpc/sys/__sigtramp2.S
|
/* $NetBSD: __sigtramp2.S,v 1.3 2011/01/15 07:31:12 matt Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: __sigtramp2.S,v 1.3 2011/01/15 07:31:12 matt Exp $")
#endif /* LIBC_SCCS && !lint */
/*
* On entry to user space, stack and registers look like:
*
* r3 signal number
* r4 pointer to siginfo structure
* r5 pointer to ucontext structure
* r30 pointer to ucontext structure
* srr0 address of handler
* lr address of this trampoline
*
*/
ENTRY_NOPROFILE(__sigtramp_siginfo_2)
mr %r3,%r30 /* restore ucontext pointer */
_DOSYSCALL(setcontext) /* restore machine state */
_DOSYSCALL(exit) /* or exit with errno if failed */
END(__sigtramp_siginfo_2)
|
0xffea/MINIX3
| 2,040
|
lib/libc/arch/powerpc/sys/getcontext.S
|
/* $NetBSD: getcontext.S,v 1.5 2011/01/15 07:31:13 matt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
#include "assym.h"
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: getcontext.S,v 1.5 2011/01/15 07:31:13 matt Exp $")
#endif /* LIBC_SCCS && !lint */
#ifdef WEAK_ALIAS
WEAK_ALIAS(getcontext, _getcontext)
#endif
ENTRY(_getcontext)
mr %r5,%r3 # must save pointer
_DOSYSCALL(getcontext)
bso 1f
mflr %r4
stw %r4,UC_GREGS_PC(%r5) # saved pc <- lr
stw %r3,UC_GREGS_R3(%r5) # arrange for return value 0
blr
1:
b _C_LABEL(__cerror)
END(_getcontext)
|
0xffea/MINIX3
| 2,763
|
lib/libc/arch/powerpc/gen/swapcontext.S
|
/* $NetBSD: swapcontext.S,v 1.6 2011/01/16 02:43:10 matt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Klaus Klein.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
#include "assym.h"
__RCSID("$NetBSD: swapcontext.S,v 1.6 2011/01/16 02:43:10 matt Exp $")
#define XCALLFRAMELEN (((2+3)*SZREG + CALLFRAMELEN - 1) & -CALLFRAMELEN)
#define XCALLFRAME_R30 (XCALLFRAMELEN-1*SZREG)
#define XCALLFRAME_UCP (XCALLFRAMELEN-2*SZREG)
#define XCALLFRAME_OUCP (XCALLFRAMELEN-3*SZREG)
ENTRY(swapcontext)
stwu %r1,-XCALLFRAMELEN(%r1) # set up new stack frame
mflr %r0
stw %r0,XCALLFRAMELEN+CALLFRAME_LR(%r1) # save link register
stw %r3,XCALLFRAME_OUCP(%r1) # must save oucp
stw %r4,XCALLFRAME_UCP(%r1) # must save ucp
#ifdef PIC
stw %r30,XCALLFRAME_R30(%r1) # must save r30
PIC_TOCSETUP(swapcontext,%r30) # setup toc pointer
#endif
bl PIC_PLT(_C_LABEL(_getcontext)) # getcontext(oucp)
cmpwi %r3,0
bne 1f
lwz %r11,XCALLFRAME_OUCP(%r1) # load oucp for adjustment
lwz %r0,XCALLFRAMELEN+CALLFRAME_LR(%r1)
stw %r0,UC_GREGS_PC(%r11) # pc <- lr
addi %r0,%r1,XCALLFRAMELEN
stw %r0,UC_GREGS_R1(%r11) # adjust sp
lwz %r3,XCALLFRAME_UCP(%r1) # load ucp
bl PIC_PLT(_C_LABEL(setcontext)) # setcontext(ucp)
1:
lwz %r0,XCALLFRAMELEN+CALLFRAME_LR(%r1)
#ifdef PIC
lwz %r30,XCALLFRAME_R30(%r1)
#endif
mtlr %r0
addi %r1,%r1,XCALLFRAMELEN
blr
END(swapcontext)
|
0xffea/MINIX3
| 1,030
|
lib/libc/arch/powerpc/gen/_setjmp.S
|
/* $NetBSD: _setjmp.S,v 1.3 2011/01/15 07:31:12 matt Exp $ */
#include <machine/asm.h>
#if defined(LIBC_SCCS)
__RCSID("$NetBSD: _setjmp.S,v 1.3 2011/01/15 07:31:12 matt Exp $")
#endif
/*
* C library -- _setjmp, _longjmp
*
* _longjmp(a,v)
* will generate a "return(v?v:1)" from the last call to
* _setjmp(a)
* by restoring registers from the stack.
* The previous signal state is NOT restored.
*/
ENTRY(_setjmp)
mflr %r11 /* save return address */
mfcr %r12 /* save condition register */
mr %r10,%r1 /* save stack pointer */
mr %r9,%r2 /* save GPR2 (not needed) */
stmw %r9,8(%r3) /* save r9..r31 */
li %r3,0 /* indicate success */
blr /* return */
END(_setjmp)
ENTRY(_longjmp)
lmw %r9,8(%r3) /* save r9..r31 */
mtlr %r11 /* restore LR */
mtcr %r12 /* restore CR */
mr %r2,%r9 /* restore GPR2 (not needed) */
mr %r1,%r10 /* restore stack */
or. %r3,%r4,%r4 /* get return value */
bnelr /* return if not 0 */
li %r3,1 /* what's the point? */
blr /* return */
END(_longjmp)
|
0xffea/MINIX3
| 9,057
|
lib/libc/arch/powerpc/string/bzero.S
|
/* $NetBSD: bzero.S,v 1.11 2011/01/29 02:21:20 matt Exp $ */
/*-
* Copyright (C) 2001 Martin J. Laubach <[email protected]>
* 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. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*----------------------------------------------------------------------*/
#include <machine/asm.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: bzero.S,v 1.11 2011/01/29 02:21:20 matt Exp $")
#endif /* LIBC_SCCS && !lint */
#ifdef _KERNEL
#include <assym.h>
#endif
#define USE_STSWX 0 /* don't. slower than trivial copy loop */
/*----------------------------------------------------------------------*/
/*
void bzero(void *b %r3, size_t len %r4);
void * memset(void *b %r3, int c %r4, size_t len %r5);
*/
/*----------------------------------------------------------------------*/
#define r_dst %r3
#define r_len %r4
#define r_val %r0
.text
.align 4
ENTRY(bzero)
li r_val, 0 /* Value to stuff in */
b cb_memset
END(bzero)
ENTRY(memset)
cmplwi %cr1, %r5, 0
mr. %r0, %r4
mr %r8, %r3
beqlr- %cr1 /* Nothing to do */
rlwimi %r0, %r4, 8, 16, 23 /* word extend fill value */
rlwimi %r0, %r0, 16, 0, 15
mr %r4, %r5
bne- simple_fill /* =! 0, use trivial fill */
cb_memset:
/*----------------------------------------------------------------------*/
#ifndef _KERNEL
/* First find out cache line size */
mflr %r9
#ifdef PIC
PIC_GOTSETUP(%r10)
mtlr %r9
lwz %r5,cache_info@got(%r10)
#else
lis %r5,cache_info@h
ori %r5,%r5,cache_info@l
#endif
lwz %r6, 4(%r5)
cmpwi %r6, -1
bne+ cb_cacheline_known
/*----------------------------------------------------------------------*/
#define CTL_MACHDEP 7
#define CPU_CACHELINE 1
#define CPU_CACHEINFO 5
#define STKFRAME_SZ 64
#define MIB 8
#define OLDPLEN 16
#define R3_SAVE 20
#define R4_SAVE 24
#define R0_SAVE 28
#define R8_SAVE 32
#define R31_SAVE 36
#ifdef PIC
#define R30_SAVE 40
#endif
stw %r9, 4(%r1)
stwu %r1, -STKFRAME_SZ(%r1)
stw %r31, R31_SAVE(%r1)
mr %r31, %r5 /* cache info */
#ifdef PIC
stw %r30, R30_SAVE(%r1)
PIC_TOCSETUP(cb_memset,%r30)
#endif
stw %r8, R8_SAVE(%r1)
stw %r3, R3_SAVE(%r1)
stw %r4, R4_SAVE(%r1)
stw %r0, R0_SAVE(%r1)
li %r0, CTL_MACHDEP /* Construct MIB */
stw %r0, MIB(%r1)
li %r0, CPU_CACHEINFO
stw %r0, MIB+4(%r1)
li %r0, 4*4 /* Oldlenp := 4*4 */
stw %r0, OLDPLEN(%r1)
addi %r3, %r1, MIB
li %r4, 2 /* namelen */
/* %r5 already contains &cache_info */
addi %r6, %r1, OLDPLEN
li %r7, 0
li %r8, 0
bl PIC_PLT(_C_LABEL(sysctl))
cmpwi %r3, 0 /* Check result */
beq 1f
/* Failure, try older sysctl */
li %r0, CTL_MACHDEP /* Construct MIB */
stw %r0, MIB(%r1)
li %r0, CPU_CACHELINE
stw %r0, MIB+4(%r1)
li %r0, 4 /* Oldlenp := 4 */
stw %r0, OLDPLEN(%r1)
addi %r3, %r1, MIB
li %r4, 2 /* namelen */
addi %r5, %r31, 4
addi %r6, %r1, OLDPLEN
li %r7, 0
li %r8, 0
bl PIC_PLT(_C_LABEL(sysctl))
1:
lwz %r3, R3_SAVE(%r1)
lwz %r4, R4_SAVE(%r1)
lwz %r8, R8_SAVE(%r1)
lwz %r0, R0_SAVE(%r1)
lwz %r9, 4(%r31)
lwz %r31, R31_SAVE(%r1)
#ifdef PIC
lwz %r30, R30_SAVE(%r1)
#endif
addi %r1, %r1, STKFRAME_SZ
lwz %r7, 4(%r1)
mtlr %r7
cntlzw %r6, %r9 /* compute shift value */
li %r5, 31
subf %r5, %r6, %r5
#ifdef PIC
mflr %r9
PIC_GOTSETUP(%r10)
mtlr %r9
lwz %r6, cache_sh@got(%r10)
stw %r5, 0(%r6)
#else
lis %r6, cache_sh@ha
stw %r5, cache_sh@l(%r6)
#endif
/*----------------------------------------------------------------------*/
/* Okay, we know the cache line size (%r9) and shift value (%r10) */
cb_cacheline_known:
#ifdef PIC
lwz %r5, cache_info@got(%r10)
lwz %r9, 4(%r5)
lwz %r5, cache_sh@got(%r10)
lwz %r10, 0(%r5)
#else
lis %r9, cache_info+4@ha
lwz %r9, cache_info+4@l(%r9)
lis %r10, cache_sh@ha
lwz %r10, cache_sh@l(%r10)
#endif
#else /* _KERNEL */
#ifdef MULTIPROCESSOR
mfsprg %r10, 0 /* Get cpu_info pointer */
#else
lis %r10, cpu_info_store@ha
addi %r10, %r10, cpu_info_store@l
#endif
lwz %r9, CPU_CI+4(%r10) /* Load D$ line size */
cntlzw %r10, %r9 /* Calculate shift.. */
li %r6, 31
subf %r10, %r10, %r6
#endif /* _KERNEL */
/* Back in memory filling business */
cmplwi %cr1, r_len, 0 /* Nothing to do? */
add %r5, %r9, %r9
cmplw r_len, %r5 /* <= 2*CL bytes to move? */
beqlr- %cr1 /* then do nothing */
blt+ simple_fill /* a trivial fill routine */
/* Word align the block, fill bytewise until dst even*/
andi. %r5, r_dst, 0x03
li %r6, 4
beq+ cb_aligned_w /* already aligned to word? */
subf %r5, %r5, %r6 /* bytes to fill to align4 */
#if USE_STSWX
mtxer %r5
stswx %r0, 0, r_dst
add r_dst, %r5, r_dst
#else
mtctr %r5
subi r_dst, r_dst, 1
1: stbu r_val, 1(r_dst) /* Fill bytewise */
bdnz 1b
addi r_dst, r_dst, 1
#endif
subf r_len, %r5, r_len
cb_aligned_w: /* Cache block align, fill wordwise until dst aligned */
/* I know I have something to do since we had > 2*CL initially */
/* so no need to check for r_len = 0 */
subi %r6, %r9, 1 /* CL mask */
and. %r5, r_dst, %r6
srwi %r5, %r5, 2
srwi %r6, %r9, 2
beq cb_aligned_cb /* already on CL boundary? */
subf %r5, %r5, %r6 /* words to fill to alignment */
mtctr %r5
slwi %r5, %r5, 2
subf r_len, %r5, r_len
subi r_dst, r_dst, 4
1: stwu r_val, 4(r_dst) /* Fill wordwise */
bdnz 1b
addi r_dst, r_dst, 4
cb_aligned_cb: /* no need to check r_len, see above */
srw. %r5, r_len, %r10 /* Number of cache blocks */
mtctr %r5
beq cblocks_done
slw %r5, %r5, %r10
subf r_len, %r5, r_len
1: dcbz 0, r_dst /* Clear blockwise */
add r_dst, r_dst, %r9
bdnz 1b
cblocks_done: /* still CL aligned, but less than CL bytes left */
cmplwi %cr1, r_len, 0
cmplwi r_len, 8
beq- %cr1, sf_return
blt- sf_bytewise /* <8 remaining? */
b sf_aligned_w
/*----------------------------------------------------------------------*/
wbzero: li r_val, 0
cmplwi r_len, 0
beqlr- /* Nothing to do */
simple_fill:
#if USE_STSWX
cmplwi %cr1, r_len, 12 /* < 12 bytes to move? */
#else
cmplwi %cr1, r_len, 8 /* < 8 bytes to move? */
#endif
andi. %r5, r_dst, 0x03 /* bytes to fill to align4 */
blt %cr1, sf_bytewise /* trivial byte mover */
li %r6, 4
subf %r5, %r5, %r6
beq+ sf_aligned_w /* dest is word aligned */
#if USE_STSWX
mtxer %r5
stswx %r0, 0, r_dst
add r_dst, %r5, r_dst
#else
mtctr %r5 /* nope, then fill bytewise */
subi r_dst, r_dst, 1 /* until it is */
1: stbu r_val, 1(r_dst)
bdnz 1b
addi r_dst, r_dst, 1
#endif
subf r_len, %r5, r_len
sf_aligned_w: /* no need to check r_len since it were >= 8 bytes initially */
#if USE_STSWX
mr %r6, %r0
mr %r7, %r0
srwi %r5, r_len, 3
mtctr %r5
slwi %r5, %r5, 3 /* adjust len */
subf. r_len, %r5, r_len
1: stswi %r6, r_dst, 8
addi r_dst, r_dst, 8
bdnz 1b
#else
srwi %r5, r_len, 2 /* words to fill */
mtctr %r5
slwi %r5, %r5, 2
subf. r_len, %r5, r_len /* adjust len for fill */
subi r_dst, r_dst, 4
1: stwu r_val, 4(r_dst)
bdnz 1b
addi r_dst, r_dst, 4
#endif
sf_word_done: bne- sf_bytewise
sf_return: mr %r3, %r8 /* restore orig ptr */
blr /* for memset functionality */
sf_bytewise:
#if USE_STSWX
mr %r5, %r0
mr %r6, %r0
mr %r7, %r0
mtxer r_len
stswx %r5, 0, r_dst
#else
mtctr r_len
subi r_dst, r_dst, 1
1: stbu r_val, 1(r_dst)
bdnz 1b
#endif
mr %r3, %r8 /* restore orig ptr */
blr /* for memset functionality */
END(memset)
/*----------------------------------------------------------------------*/
#ifndef _KERNEL
.data
cache_info: .long -1, -1, -1, -1
cache_sh: .long 0
#endif
/*----------------------------------------------------------------------*/
|
0xffea/MINIX3
| 2,909
|
lib/csu/common/sysident.S
|
/* $NetBSD: sysident.S,v 1.1 2010/08/07 18:01:33 joerg Exp $ */
/*
* Copyright (c) 1997 Christopher G. Demetriou
* 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 for the
* NetBSD Project. See http://www.NetBSD.org/ for
* information about NetBSD.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR 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.
*
* <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
*/
/*
* Here we define the NetBSD OS Version in an ELF .note section, structured
* like:
*
* [NOTE HEADER]
* long name size
* long description size
* long note type
*
* [NOTE DATUM]
* string OS name
*
* OSVERSION notes also have:
* long OS version (__NetBSD_Version__ constant from param.h)
*
* The DATUM fields should be padded out such that their actual (not
* declared) sizes % 4 == 0.
*
* These are used by the kernel to determine if this binary is really a
* NetBSD binary, or some other OS's.
*/
#include "sysident_assym.h"
#ifdef __minix
.section .rodata
.ascii "$MINIX$\0"
#else
.section ".note.netbsd.ident", "a"
.align 4
.long ELF_NOTE_NETBSD_NAMESZ
.long ELF_NOTE_NETBSD_DESCSZ
.long ELF_NOTE_TYPE_NETBSD_TAG
.ascii "NetBSD\0\0" /* ELF_NOTE_NETBSD_NAME */
.long __NetBSD_Version__
.section ".note.netbsd.pax", "a"
.align 4
.long ELF_NOTE_PAX_NAMESZ
.long ELF_NOTE_PAX_DESCSZ
.long ELF_NOTE_TYPE_PAX_TAG
.ascii "PaX\0" /* ELF_NOTE_PAX_NAME */
.long 0
#endif
|
0xffea/MINIX3
| 2,040
|
lib/csu/arch/m68k/crtn.S
|
/* $NetBSD: crtn.S,v 1.1 2010/08/07 18:01:34 joerg Exp $ */
/*-
* Copyright (c) 2001 Ross Harvey
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
RCSID("$NetBSD: crtn.S,v 1.1 2010/08/07 18:01:34 joerg Exp $")
.section ".init", "ax", @progbits
rts
.section ".fini", "ax", @progbits
rts
|
0xffea/MINIX3
| 2,115
|
lib/csu/arch/m68k/crti.S
|
/* $NetBSD: crti.S,v 1.1 2010/08/07 18:01:34 joerg Exp $ */
/*-
* Copyright (c) 2001 Ross Harvey
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
RCSID("$NetBSD: crti.S,v 1.1 2010/08/07 18:01:34 joerg Exp $")
#include "sysident.S"
.section ".init", "ax", @progbits
.align 2
.globl _init
_init:
.section ".fini", "ax", @progbits
.align 2
.globl _fini
_fini:
|
0xffea/MINIX3
| 2,230
|
lib/csu/arch/m68k/crt0.S
|
#include <machine/asm.h>
/*
* Copyright (c) 1999 Klaus Klein
* Copyright (c) 1995 Christopher G. Demetriou
* 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 for the
* NetBSD Project. See http://www.NetBSD.org/ for
* information about NetBSD.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR 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.
*
* <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
*/
RCSID("$NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $")
STRONG_ALIAS(_start,__start)
_ENTRY(__start)
movl (%sp),%d0
movl %a2,-(%sp) | ps_strings
movl %a0,-(%sp) | obj
movl %a1,-(%sp) | cleanup
movl %d0,%d1
lsll #2,%d1
pea (16+4)(%sp,%d1.l) | envp = &argv[argc + 1]
pea 20(%sp) | argv
movl %d0,-(%sp) | argc
jsr ___start
|
0xffea/MINIX3
| 2,054
|
lib/csu/arch/i386/crtn.S
|
/* $NetBSD: crtn.S,v 1.1 2010/08/07 18:01:34 joerg Exp $ */
/*-
* Copyright (c) 2001 Ross Harvey
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
RCSID("$NetBSD: crtn.S,v 1.1 2010/08/07 18:01:34 joerg Exp $")
.section ".init", "ax", @progbits
leave
ret
.section ".fini", "ax", @progbits
leave
ret
|
0xffea/MINIX3
| 2,175
|
lib/csu/arch/i386/crti.S
|
/* $NetBSD: crti.S,v 1.1 2010/08/07 18:01:33 joerg Exp $ */
/*-
* Copyright (c) 2001 Ross Harvey
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
RCSID("$NetBSD: crti.S,v 1.1 2010/08/07 18:01:33 joerg Exp $")
#include "sysident.S"
.section ".init", "ax", @progbits
.align 16
.globl _init
_init:
pushl %ebp
movl %esp, %ebp
.section ".fini", "ax", @progbits
.align 16
.globl _fini
_fini:
pushl %ebp
movl %esp, %ebp
|
0xffea/MINIX3
| 1,857
|
lib/csu/arch/i386/crtend.S
|
/* $NetBSD: crtend.S,v 1.1 2010/08/07 18:01:33 joerg Exp $ */
/*-
* Copyright (c) 2010 Joerg Sonnenberger <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
RCSID("$NetBSD: crtend.S,v 1.1 2010/08/07 18:01:33 joerg Exp $")
.section .ctors, "aw", @progbits
.align 4
.global __CTOR_LIST_END__
.hidden __CTOR_LIST_END__
__CTOR_LIST_END__:
.long 0
.section .dtors, "aw", @progbits
.align 4
.long 0
.section .eh_frame, "a", @progbits
.align 4
.long 0
.section .jcr, "aw", @progbits
.align 4
.long 0
|
0xffea/MINIX3
| 2,213
|
lib/csu/arch/i386/crt0.S
|
/* $NetBSD: crt0.S,v 1.1 2010/08/07 18:01:33 joerg Exp $ */
/*
* Copyright (c) 1998 Christos Zoulas
* Copyright (c) 1995 Christopher G. Demetriou
* 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 for the
* NetBSD Project. See http://www.NetBSD.org/ for
* information about NetBSD.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR 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.
*
* <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
*/
#include <machine/asm.h>
RCSID("$NetBSD: crt0.S,v 1.1 2010/08/07 18:01:33 joerg Exp $")
STRONG_ALIAS(_start,__start)
_ENTRY(__start)
pushl %ebx
pushl %ecx
pushl %edx
movl 12(%esp),%eax
leal 16(%esp),%edx
leal 20(%esp,%eax,4),%ecx
pushl %ecx
pushl %edx
pushl %eax
call ___start
|
0xffea/MINIX3
| 3,828
|
lib/csu/arch/i386/crtbegin.S
|
/* $NetBSD: crtbegin.S,v 1.1 2010/08/07 18:01:33 joerg Exp $ */
/*-
* Copyright (c) 2010 Joerg Sonnenberger <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
RCSID("$NetBSD: crtbegin.S,v 1.1 2010/08/07 18:01:33 joerg Exp $")
.section .ctors, "aw", @progbits
.align 4
__CTOR_LIST__:
.long -1
.section .dtors, "aw", @progbits
.align 4
__DTOR_LIST__:
.long -1
.section .eh_frame, "a", @progbits
.align 4
__EH_FRAME_LIST__:
.section .jcr, "aw", @progbits
.align 4
__JCR_LIST__:
.section .data.rel, "aw", @progbits
.align 4
.type __dso_handle, @object
.size __dso_handle, 4
.globl __dso_handle
.hidden __dso_handle
__dso_handle:
#ifdef SHARED
.long __dso_handle
#else
.long 0
#endif
__dwarf_eh_object:
.zero 32
__initialized:
.zero 1
__finished:
.zero 1
.text
.weak __cxa_finalize
.weak __deregister_frame_info
.weak __register_frame_info
.weak _Jv_RegisterClasses
__get_thunk:
movl (%esp), %ebx
ret
__do_global_dtors_aux:
pushl %ebx
pushl %edi
subl $8, %esp
call __get_thunk
addl $_GLOBAL_OFFSET_TABLE_, %ebx
cmpb $0, __finished@GOTOFF(%ebx)
jne 4f
movb $1, __finished@GOTOFF(%ebx)
#ifdef SHARED
cmpl $0, __cxa_finalize@GOT(%ebx)
je 1f
movl __dso_handle@GOTOFF(%ebx), %eax
movl %eax, (%esp)
call __cxa_finalize@PLT
1:
#endif
leal 4+__DTOR_LIST__@GOTOFF(%ebx), %edi
2:
movl (%edi), %eax
testl %eax, %eax
je 3f
call *%eax
addl $8, %edi
jmp 2b
3:
cmpl $0, __deregister_frame_info@GOT(%ebx)
je 4f
leal __EH_FRAME_LIST__@GOTOFF(%ebx), %eax
movl %eax, (%esp)
call __deregister_frame_info@PLT
4:
addl $8, %esp
popl %edi
popl %ebx
ret
__do_global_ctors_aux:
pushl %ebx
pushl %edi
subl $8, %esp
call __get_thunk
addl $_GLOBAL_OFFSET_TABLE_, %ebx
cmpb $0, __initialized@GOTOFF(%ebx)
jne 4f
movb $1, __initialized@GOTOFF(%ebx)
cmpl $0, __register_frame_info@GOT(%ebx)
je 1f
leal __dwarf_eh_object@GOTOFF(%ebx), %edi
movl %edi, 4(%esp)
leal __EH_FRAME_LIST__@GOTOFF(%ebx), %edi
movl %edi, (%esp)
call __register_frame_info@PLT
1:
cmpl $0, _Jv_RegisterClasses@GOT(%ebx)
je 2f
leal __JCR_LIST__@GOTOFF(%ebx), %edi
movl (%edi), %edi
testl %edi, %edi
je 2f
movl %edi, (%esp)
call _Jv_RegisterClasses@PLT
2:
leal -4+__CTOR_LIST_END__@GOTOFF(%ebx), %edi
3:
movl (%edi), %eax
cmpl $-1, %eax
je 4f
call *%eax
subl $4, %edi
jmp 3b
4:
addl $8, %esp
popl %edi
popl %ebx
ret
.section .init, "ax", @progbits
call __do_global_ctors_aux
.section .fini, "ax", @progbits
call __do_global_dtors_aux
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.