Update.
[glibc.git] / sysdeps / unix / sysv / linux / alpha / utimes.S
bloba1d2b1513c1c27bbb9c1b07658570a73f896bacb
1 /* Copyright (C) 1998 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
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
12    Library General Public License for more details.
14    You should have received a copy of the GNU Library General Public
15    License along with the GNU C Library; see the file COPYING.LIB.  If not,
16    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17    Boston, MA 02111-1307, USA.  */
19 #include <sysdep.h>
20 #define _ERRNO_H        1
21 #include <bits/errno.h>
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.
27    So now we have to do compatibility stuff.  */
29 /* The variable is shared between all wrappers around signal handling
30    functions which have RT equivalents.  */
31 .comm __libc_missing_axp_tv64, 4
33 .text
35 #if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
36 #define UTIMES  __utimes_tv64
37 #else
38 #define UTIMES  __utimes
39 #endif
41 LEAF(UTIMES, 16)
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
52         ldl     t0, __libc_missing_axp_tv64
54         /* Save arguments in case we do need to fall back.  */
55         stq     a0, 0(sp)
56         stq     a1, 8(sp)
58         bne     t0, $do32
60         ldi     v0, SYS_ify(utimes)
61         callsys
62         bne     a3, $err64
64         /* Everything ok.  */
65         addq    sp, 16, sp
66         ret
68         /* If we didn't get ENOSYS, it is a real error.  */
69         .align 3
70 $err64: cmpeq   v0, ENOSYS, t0
71         beq     t0, $error
72         stl     t0, __libc_missing_axp_tv64
74         /* Recover the saved arguments.  */
75         ldq     a1, 8(sp)
76         ldq     a0, 0(sp)
78         .align 3
79 $do32:
80         /* Conditionally bounce values down.  */
81         beq     a1, 1f
82         ldq     t0, 0(a1)
83         ldq     t1, 8(a1)
84         ldq     t2, 16(a1)
85         ldq     t3, 24(a1)
86         stl     t0, 0(sp)
87         stl     t1, 4(sp)
88         stl     t2, 8(sp)
89         stl     t3, 12(sp)
90         mov     sp, a1
92 1:      ldi     v0, SYS_ify(osf_utimes)
93         callsys
94         bne     a3, $error
96         addq    sp, 16, sp
97         ret
99         .align 3
100 $error:
101         lda     pv, __syscall_error
102         addq    sp, 16, sp
103         jmp     zero, (pv), __syscall_error
105 END(UTIMES)
107 #if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
108 default_symbol_version (__utimes_tv64, __utimes, GLIBC_2.1)
110 /* It seems to me to be a misfeature of the assembler that we can only
111    have one version-alias per symbol.  So create an alias ourselves.
112    The 'p' is for 'public'.  *Shrug*  */
113 strong_alias (__utimes_tv64, __utimes_tv64p)
114 default_symbol_version (__utimes_tv64p, utimes, GLIBC_2.1)
115 #else
116 weak_alias (__utimes, utimes)
117 #endif