2.9
[glibc/nacl-glibc.git] / sysdeps / unix / sysv / linux / alpha / swapcontext.S
blob1221f67f781acd4f54a10309107b97d96ee0719c
1 /* Save current context and install the given one.
2    Copyright (C) 2004 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
20 #include <sysdep.h>
21 #include <ucontext-offsets.h>
23 ENTRY(__swapcontext)
25 #ifdef PROF
26         ldgp    $29, 0($27)
27         .set noat
28         lda     AT, _mcount
29         jsr     AT, (AT), _mcount
30         .set at
31         .prologue 1
32 #elif defined PIC
33         .prologue 0
34 #else
35         ldgp    $29, 0($27)
36         .prologue 1
37 #endif
39 #ifdef PIC
40         unop
41         bsr     $0, __getcontext_x      !samegp
42         mov     $17, $16
43         br      $31, __setcontext       !samegp
44 #else
45         jsr     $0, __getcontext_x
46         mov     $17, $16
47         jmp     $31, __setcontext
48 #endif
50 END(__swapcontext)
51 weak_alias (__swapcontext, swapcontext)