diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-04-19 16:31:12 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-04-19 16:31:12 +0000 |
commit | 9bab980687708a6038f894aab30f303084aefa86 (patch) | |
tree | 02e4fca7778b3dd3c38288bd8004586cc0e0f816 /sysdeps/unix/sysv/linux/sparc/sparc64 | |
parent | 0b35a2da19eb7b598a88cc6daf4ad06d6c5615dd (diff) | |
download | glibc-9bab980687708a6038f894aab30f303084aefa86.tar glibc-9bab980687708a6038f894aab30f303084aefa86.tar.gz glibc-9bab980687708a6038f894aab30f303084aefa86.tar.bz2 glibc-9bab980687708a6038f894aab30f303084aefa86.zip |
Update.
2001-04-18 Jakub Jelinek <jakub@redhat.com>
* sysdeps/sparc/sparc64/fpu/libm-test-ulps: Update.
* sysdeps/unix/sysv/linux/sparc/sparc64/makecontext.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/swapcontext.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S (__setcontext):
Copy first word of uc_sigmask into __uc_sigmask.
* sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S (__getcontext):
Save uc_link around trap. Copy __uc_sigmask into first word of
uc_sigmask, clear the rest. Make sure setcontext to the created
context doesn't do this though.
* sysdeps/unix/sysv/linux/sparc/sparc64/ucontext_i.h: New file.
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (ucontext_t): Add
uc_stack and uc_sigmask, rename old uc_sigmask to __uc_sigmask in the
64bit version, make uc_sigmask __sigset_t in the 32bit version.
* rt/Makefile (otherlibs): Added for static NSS.
* glibcbug.in (BUGGLIBC): Send to new alias.
Diffstat (limited to 'sysdeps/unix/sysv/linux/sparc/sparc64')
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S | 40 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/makecontext.c | 67 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S | 10 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/swapcontext.c | 48 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/ucontext_i.h | 27 |
5 files changed, 185 insertions, 7 deletions
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S index 05b06269e4..457f07448c 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2001 Free Software Foundation, Inc. Contributed by Richard Henderson (rth@tamu.edu). The GNU C Library is free software; you can redistribute it and/or @@ -17,13 +17,47 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include "ucontext_i.h" -/* void getcontext(ucontext_t *); */ +/* int getcontext(ucontext_t *); */ ENTRY(__getcontext) + ldx [%o0 + UC_LINK], %o1 /* Preserve uc_link field, the + trap clears it. */ ta 0x6e - ret +1: + ldx [%o0 + UC_M_PC], %o2 + ldx [%o0 + UC_M_NPC], %o3 + ldx [%o0 + __UC_SIGMASK], %o4 + stx %o1, [%o0 + UC_LINK] + add %o2, 2f - 1b, %o2 + stx %o2, [%o0 + UC_M_PC] + add %o3, 2f - 1b, %o3 + stx %o3, [%o0 + UC_M_NPC] +#if SIGMASK_WORDS == 16 + stx %o4, [%o0 + UC_SIGMASK] + stx %g0, [%o0 + UC_SIGMASK + 8] + stx %g0, [%o0 + UC_SIGMASK + 16] + stx %g0, [%o0 + UC_SIGMASK + 24] + stx %g0, [%o0 + UC_SIGMASK + 32] + stx %g0, [%o0 + UC_SIGMASK + 40] + stx %g0, [%o0 + UC_SIGMASK + 48] + stx %g0, [%o0 + UC_SIGMASK + 56] + stx %g0, [%o0 + UC_SIGMASK + 64] + stx %g0, [%o0 + UC_SIGMASK + 72] + stx %g0, [%o0 + UC_SIGMASK + 80] + stx %g0, [%o0 + UC_SIGMASK + 88] + stx %g0, [%o0 + UC_SIGMASK + 96] + stx %g0, [%o0 + UC_SIGMASK + 104] + stx %g0, [%o0 + UC_SIGMASK + 112] + stx %g0, [%o0 + UC_SIGMASK + 120] +#else +# error Adjust __getcontext +#endif +2: + retl + clr %o0 END(__getcontext) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/makecontext.c b/sysdeps/unix/sysv/linux/sparc/sparc64/makecontext.c new file mode 100644 index 0000000000..93ac398b2c --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/makecontext.c @@ -0,0 +1,67 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <ucontext.h> + +void +__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) +{ + extern void __makecontext_ret (void); + unsigned long *sp, *topsp; + va_list ap; + int i; + + sp = (long *) ((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size); + sp -= (argc > 6 ? argc : 6) + 32; + sp = (long *) (((long) sp) & -16L); + topsp = sp + (argc > 6 ? argc : 6) + 16; + + ucp->uc_mcontext.mc_gregs[MC_PC] = (long) func; + ucp->uc_mcontext.mc_gregs[MC_NPC] = ((long) func) + 4; + ucp->uc_mcontext.mc_gregs[MC_O6] = ((long) sp) - 0x7ff; + ucp->uc_mcontext.mc_gregs[MC_O7] = ((long) __makecontext_ret) - 8; + ucp->uc_mcontext.mc_fp = ((long) topsp) - 0x7ff; + ucp->uc_mcontext.mc_i7 = 0; + topsp[14] = 0; + topsp[15] = 0; + sp[8] = (long) ucp->uc_link; + va_start (ap, argc); + for (i = 0; i < argc; ++i) + if (i < 6) + ucp->uc_mcontext.mc_gregs[MC_O0 + i] = va_arg (ap, long); + else + sp[16 + i] = va_arg (ap, long); + va_end (ap); +} + +asm (" \n\ + .text \n\ + .type __makecontext_ret, #function \n\ +__makecontext_ret: \n\ + mov 1, %o1 \n\ + call __setcontext \n\ + mov %i0, %o0 \n\ + unimp 0 \n\ + .size __makecontext_ret, .-__makecontext_ret \n\ + "); + +weak_alias (__makecontext, makecontext) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S index 2968b65633..bdd841dda3 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2001 Free Software Foundation, Inc. Contributed by Richard Henderson (rth@tamu.edu). The GNU C Library is free software; you can redistribute it and/or @@ -17,17 +17,19 @@ Boston, MA 02111-1307, USA. */ #include <sysdep.h> +#include "ucontext_i.h" - -/* void setcontext(ucontext_t *ctx); */ +/* int setcontext(ucontext_t *ctx); */ .weak setcontext ENTRY(setcontext) mov 1, %o1 -/* void __setcontext(ucontext_t *ctx, int restoremask); */ +/* int __setcontext(ucontext_t *ctx, int restoremask); */ ENTRY(__setcontext) + ldx [%o0 + UC_SIGMASK], %o2 + stx %o2, [%o0 + __UC_SIGMASK] ta 0x6f END(__setcontext) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/swapcontext.c b/sysdeps/unix/sysv/linux/sparc/sparc64/swapcontext.c new file mode 100644 index 0000000000..141c74663f --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/swapcontext.c @@ -0,0 +1,48 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <ucontext.h> + +extern int __getcontext (ucontext_t *ucp); +extern int __setcontext (const ucontext_t *ucp, int restoremask); + +int +__swapcontext (ucontext_t *oucp, const ucontext_t *ucp) +{ + extern void __swapcontext_ret (void); + /* Save the current machine context to oucp. */ + __getcontext (oucp); + /* Modify oucp to skip the __setcontext call on reactivation. */ + oucp->uc_mcontext.mc_gregs[MC_PC] = (long) __swapcontext_ret; + oucp->uc_mcontext.mc_gregs[MC_NPC] = ((long) __swapcontext_ret) + 4; + /* Restore the machine context in ucp. */ + __setcontext (ucp, 1); + return 0; +} + +asm (" \n\ + .text \n\ + .type __swapcontext_ret, #function \n\ +__swapcontext_ret: \n\ + return %i7 + 8 \n\ + clr %o0 \n\ + .size __swapcontext_ret, .-__swapcontext_ret \n\ + "); + +weak_alias (__swapcontext, swapcontext) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ucontext_i.h b/sysdeps/unix/sysv/linux/sparc/sparc64/ucontext_i.h new file mode 100644 index 0000000000..b7934d7e27 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ucontext_i.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Jakub Jelinek <jakub@redhat.com>. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Constants shared between setcontext() and getcontext(). Don't + install this header file. */ + +#define UC_LINK 0 +#define __UC_SIGMASK 16 +#define UC_M_PC 40 +#define UC_M_NPC 48 +#define UC_SIGMASK 536 +#define SIGMASK_WORDS 16 |