]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/alpha/gettimeofday.S
Update to LGPL v2.1.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / alpha / gettimeofday.S
CommitLineData
823bc652
RH
1/* Copyright (C) 1998 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
823bc652
RH
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 12 Lesser General Public License for more details.
823bc652 13
41bdb6e2
AJ
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
823bc652
RH
18
19#include <sysdep.h>
20#define _ERRNO_H 1
21#include <bits/errno.h>
22
23/* The problem here is that initially we made struct timeval compatible with
24 OSF/1, using int32. But we defined time_t with uint64, and later found
25 that POSIX requires tv_sec to be time_t.
26
27 So now we have to do compatibility stuff. */
28
29/* The variable is shared between all wrappers around signal handling
30 functions which have RT equivalents. */
31.comm __libc_missing_axp_tv64, 4
32
33.text
34
ef030f7f
UD
35#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
36#define GETTIMEOFDAY __gettimeofday_tv64
37#else
38#define GETTIMEOFDAY __gettimeofday
39#endif
40
41LEAF(GETTIMEOFDAY, 16)
823bc652
RH
42 ldgp gp, 0(pv)
43 subq sp, 16, sp
44#ifdef PROF
45 .set noat
46 lda AT, _mcount
47 jsr AT, (AT), _mcount
48 .set at
49#endif
50 .prologue 1
51
52 ldl t0, __libc_missing_axp_tv64
53
54 /* Save arguments in case we do need to fall back. */
55 stq a0, 0(sp)
56 stq a1, 8(sp)
57
58 bne t0, $do32
59
60 ldi v0, SYS_ify(gettimeofday)
61 callsys
62 bne a3, $err64
63
64 /* Everything ok. */
65 addq sp, 16, sp
66 ret
67
68 /* If we didn't get ENOSYS, it is a real error. */
69 .align 3
70$err64: cmpeq v0, ENOSYS, t0
ef030f7f 71 beq t0, $error
823bc652
RH
72 stl t0, __libc_missing_axp_tv64
73
74 /* Recover the saved arguments. */
75 ldq a1, 8(sp)
76 ldq a0, 0(sp)
77
78 .align 3
79$do32: ldi v0, SYS_ify(osf_gettimeofday)
80 callsys
81 bne a3, $error
82
83 /* Copy back to proper format. */
84 ldq a0, 0(sp)
85 beq a0, 2f
86 ldl t0, 0(a0)
87 ldl t1, 4(a0)
88 stq t0, 0(a0)
89 stq t1, 0(a0)
90
912: addq sp, 16, sp
92 ret
93
94 .align 3
95$error:
823bc652 96 addq sp, 16, sp
7d84a067 97 jmp zero, __syscall_error
823bc652 98
ef030f7f 99END(GETTIMEOFDAY)
823bc652 100
ef030f7f 101#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
823bc652
RH
102default_symbol_version (__gettimeofday_tv64, __gettimeofday, GLIBC_2.1)
103
104/* It seems to me to be a misfeature of the assembler that we can only
105 have one version-alias per symbol. So create an alias ourselves.
106 The 'p' is for 'public'. *Shrug* */
107strong_alias (__gettimeofday_tv64, __gettimeofday_tv64p)
108default_symbol_version (__gettimeofday_tv64p, gettimeofday, GLIBC_2.1)
ef030f7f
UD
109#else
110weak_alias (__gettimeofday, gettimeofday)
111#endif