Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / unix / sysv / linux / m68k / m68k-helpers.S
blob032b1f29827edf0508dbc4ccb6a0449b118d372b
1 /* Copyright (C) 2010-2014 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
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    In addition to the permissions in the GNU Lesser General Public
11    License, the Free Software Foundation gives you unlimited
12    permission to link the compiled version of this file with other
13    programs, and to distribute those programs without any restriction
14    coming from the use of this file. (The GNU Lesser General Public
15    License restrictions do apply in other respects; for example, they
16    cover modification of the file, and distribution when not linked
17    into another program.)
19    Note that people who make modified versions of this file are not
20    obligated to grant this special exception for their modified
21    versions; it is their choice whether to do so. The GNU Lesser
22    General Public License gives permission to release a modified
23    version without this exception; this exception also makes it
24    possible to release a modified version which carries forward this
25    exception.
27    The GNU C Library is distributed in the hope that it will be useful,
28    but WITHOUT ANY WARRANTY; without even the implied warranty of
29    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
30    Lesser General Public License for more details.
32    You should have received a copy of the GNU Lesser General Public
33    License along with the GNU C Library.  If not, see
34    <http://www.gnu.org/licenses/>.  */
36 #include <sysdep.h>
37 #include <bits/m68k-vdso.h>
39         .text
41         .hidden __vdso_read_tp_stub
42 ENTRY (__vdso_read_tp_stub)
43         move.l  #__NR_get_thread_area, %d0
44         trap    #0
45         move.l  %d0, %a0
46         rts
47 END (__vdso_read_tp_stub)
49 # ifdef SHARED
50 /* GCC will emit calls to this routine.  Linux has an
51    equivalent helper function (which clobbers fewer registers than
52    a normal function call) in a vdso; tail call to the
53    helper.  */
54 # ifdef IS_IN_rtld
55 /* rtld gets a hidden copy of __m68k_read_tp.  */
56         .hidden __m68k_read_tp
57 # endif
58 ENTRY (__m68k_read_tp)
59         LOAD_GOT (%a0)
60         move.l  M68K_VDSO_SYMBOL (__vdso_read_tp)@GOT(%a0), %a0
61         move.l  (%a0), %a0
62         jmp     (%a0)
63 END (__m68k_read_tp)
65 /* The following two stubs are for macros in atomic.h, they can't
66    clobber anything.  */
68         .hidden __vdso_atomic_cmpxchg_32_stub
69 ENTRY (__vdso_atomic_cmpxchg_32_stub)
70         move.l  %d2, -(%sp)
71         cfi_adjust_cfa_offset (4)
72         cfi_rel_offset (%d2, 0)
73         move.l  %d0, %d2
74         move.l  #SYS_ify (atomic_cmpxchg_32), %d0
75         trap    #0
76         move.l  (%sp)+, %d2
77         cfi_adjust_cfa_offset (-4)
78         cfi_restore (%d2)
79         rts
80 END (__vdso_atomic_cmpxchg_32_stub)
82         .hidden __vdso_atomic_barrier_stub
83 ENTRY (__vdso_atomic_barrier_stub)
84         move.l  %d0, -(%sp)
85         cfi_adjust_cfa_offset (4)
86         move.l  #SYS_ify (atomic_barrier), %d0
87         trap    #0
88         move.l  (%sp)+, %d0
89         cfi_adjust_cfa_offset (-4)
90         rts
91 END (__vdso_atomic_barrier_stub)
92 # else /* !SHARED */
93 /* If the vDSO is not available, use a syscall to get TP.  */
94         strong_alias (__vdso_read_tp_stub, __m68k_read_tp)
95 # endif /* SHARED */