Add ns32k ucontext userland portions. Untested, but compiled in the
recent past and presumed working.
This commit is contained in:
parent
0dd40ac3d5
commit
8b314175ec
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile.inc,v 1.14 2002/02/19 13:08:24 simonb Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.15 2003/01/21 21:03:25 kleink Exp $
|
||||
|
||||
# objects built from assembler sources (need lint stubs)
|
||||
ASSRCS+=alloca.S fabs.S modf.S
|
||||
@ -7,6 +7,8 @@ ASSRCS+=__setjmp14.S
|
||||
ASSRCS+=_setjmp.S
|
||||
ASSRCS+=__sigsetjmp14.S
|
||||
|
||||
ASSRCS+=resumecontext.S swapcontext.S
|
||||
|
||||
# objects built from assembler sources (without lint stubs)
|
||||
SRCS+= setjmp.S sigsetjmp.S
|
||||
|
||||
@ -18,3 +20,8 @@ SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
|
||||
# Common ieee754 constants and functions
|
||||
SRCS+= ieee754_nanf.c ieee754_infinity.c
|
||||
SRCS+= ieee754_frexp.c ieee754_isinf.c ieee754_isnan.c ieee754_ldexp.c
|
||||
|
||||
SRCS+= makecontext.c
|
||||
|
||||
LSRCS+= Lint_resumecontext.c Lint_swapcontext.c
|
||||
DPSRCS+= Lint_resumecontext.c Lint_swapcontext.c
|
||||
|
97
lib/libc/arch/ns32k/gen/makecontext.c
Normal file
97
lib/libc/arch/ns32k/gen/makecontext.c
Normal file
@ -0,0 +1,97 @@
|
||||
/* $NetBSD: makecontext.c,v 1.1 2003/01/21 21:03:25 kleink 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.
|
||||
* 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 <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: makecontext.c,v 1.1 2003/01/21 21:03:25 kleink Exp $");
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <ucontext.h>
|
||||
#include "extern.h"
|
||||
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
|
||||
#else
|
||||
makecontext(ucp, func, argc, va_alist)
|
||||
ucontext_t *ucp;
|
||||
void (*func)();
|
||||
int argc;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
__greg_t *gr = ucp->uc_mcontext.__gregs;
|
||||
unsigned int *sp;
|
||||
va_list ap;
|
||||
|
||||
/* LINTED __greg_t is safe */
|
||||
gr[_REG_PC] = (__greg_t)func;
|
||||
|
||||
/* LINTED uintptr_t is safe */
|
||||
sp = (int *)((uintptr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
|
||||
/* LINTED uintptr_t is safe */
|
||||
sp = (int *)((uintptr_t)sp & ~0x3); /* Align on word boundary. */
|
||||
sp -= (argc + 1); /* Make room for ret and args. */
|
||||
/* LINTED __greg_t is safe */
|
||||
gr[_REG_SP] = (__greg_t)sp;
|
||||
gr[_REG_FP] = (__greg_t)0; /* Wipe out frame pointer. */
|
||||
|
||||
/* Put return address on top of stack. */
|
||||
/* LINTED uintptr_t is safe */
|
||||
*sp++ = (uintptr_t)_resumecontext;
|
||||
|
||||
/* Construct argument list. */
|
||||
#if __STDC__
|
||||
va_start(ap, argc);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
while (argc-- > 0) {
|
||||
/* LINTED uintptr_t is safe */
|
||||
*sp++ = va_arg(ap, uintptr_t);
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
58
lib/libc/arch/ns32k/gen/resumecontext.S
Normal file
58
lib/libc/arch/ns32k/gen/resumecontext.S
Normal file
@ -0,0 +1,58 @@
|
||||
/* $NetBSD: resumecontext.S,v 1.1 2003/01/21 21:03:25 kleink 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.
|
||||
* 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>
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
RCSID("$NetBSD: resumecontext.S,v 1.1 2003/01/21 21:03:25 kleink 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.
|
||||
*/
|
||||
|
||||
ENTRY_NOPROFILE(_resumecontext) /* profiling prologue would clobber TOS */
|
||||
adjspd (4 + 120)
|
||||
addr 0(sp),tos
|
||||
bsr _C_LABEL(_getcontext)
|
||||
adjspd -4
|
||||
addr 0(4(sp)),tos
|
||||
bsr _C_LABEL(setcontext)
|
||||
/* NOTREACHED */
|
60
lib/libc/arch/ns32k/gen/swapcontext.S
Normal file
60
lib/libc/arch/ns32k/gen/swapcontext.S
Normal file
@ -0,0 +1,60 @@
|
||||
/* $NetBSD: swapcontext.S,v 1.1 2003/01/21 21:03:25 kleink 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.
|
||||
* 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 "SYS.h"
|
||||
|
||||
#if defined(SYSLIBC_SCCS) && !defined(lint)
|
||||
RCSID("$NetBSD: swapcontext.S,v 1.1 2003/01/21 21:03:25 kleink Exp $")
|
||||
#endif /* SYSLIBC_SCCS && !lint */
|
||||
|
||||
ENTRY(swapcontext)
|
||||
movd S_ARG0,tos /* push oucp */
|
||||
bsr _C_LABEL(_getcontext) /* getcontext(oucp) */
|
||||
adjspd -4
|
||||
cmpqd 0,r0 /* success? */
|
||||
bne 0f
|
||||
movd S_ARG0,r2
|
||||
addr 4(sp),(36 + 8 * 4)(r2) /* Adjust saved sp ... */
|
||||
movd 0(sp),(36 + 11 * 4)(r2) /* ... and pc. */
|
||||
/* Note: a return value of 0 has been arranged for by getcontext(). */
|
||||
movd S_ARG1,tos /* push ucp */
|
||||
bsr _C_LABEL(setcontext) /* setcontext(ucp) */
|
||||
adjspd -4
|
||||
/* No need to error-check: setcontext() must have failed. */
|
||||
0:
|
||||
ret 0
|
54
lib/libc/arch/ns32k/sys/getcontext.S
Normal file
54
lib/libc/arch/ns32k/sys/getcontext.S
Normal file
@ -0,0 +1,54 @@
|
||||
/* $NetBSD: getcontext.S,v 1.1 2003/01/21 21:03:25 kleink 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.
|
||||
* 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 "SYS.h"
|
||||
|
||||
#if defined(SYSLIBC_SCCS) && !defined(lint)
|
||||
RCSID("$NetBSD: getcontext.S,v 1.1 2003/01/21 21:03:25 kleink Exp $")
|
||||
#endif /* SYSLIBC_SCCS && !lint */
|
||||
|
||||
#ifdef WEAK_ALIAS
|
||||
WEAK_ALIAS(getcontext, _getcontext)
|
||||
#endif
|
||||
|
||||
_SYSCALL(_getcontext, getcontext)
|
||||
movd S_ARG0,r2
|
||||
addr 4(sp),(36 + 8 * 4)(r2) /* Adjust saved sp ... */
|
||||
movd 0(sp),(36 + 11 * 4)(r2) /* ... and pc. */
|
||||
movqd 0,(36 + 7 * 4)(r2) /* Arrange for a return value of 0. */
|
||||
ret 0
|
Loading…
Reference in New Issue
Block a user