2 * Copyright (c) 1999-2016 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
32 * A third argument, of type uint64_t*, was added to the gettimeofday syscall
33 * for use cases that also want to know the mach_absolute_time that matches the
34 * time value returned.
36 * __gettimeofday takes the traditional two arguments. It will zero out the
37 * third argument argument before entering the kernel, behaving like the old
40 * __gettimeofday_with_mach will pass it through and supporting kernels will
41 * copy-out the mach_absolute_time. Old kernels will leave the pointed to
45 .private_extern ___gettimeofday_with_mach
49 LABEL(___gettimeofday)
53 calll ___gettimeofday_with_mach
57 LABEL(___gettimeofday_with_mach)
58 UNIX_SYSCALL_INT_NONAME(gettimeofday,0)
60 * <rdar://problem/26410029>
61 * If eax is 0, we're on a new kernel and timeval was written by the kernel.
62 * Otherwise, eax:edx contains the timeval and we marshal into timeval.
73 #elif defined(__x86_64__)
75 __SYSCALL(___gettimeofday_with_mach, gettimeofday, 3)
77 LABEL(___gettimeofday)
78 movq $0x0, %rdx // zero out third argument
80 UNIX_SYSCALL_NONAME(gettimeofday,0,cerror_nocancel)
82 * <rdar://problem/26410029>
83 * If rax is 0, we're on a new kernel and timeval was written by the kernel.
84 * Otherwise, rax:rdx contains the timeval and we marshal into timeval.
94 #elif defined(__arm__)
96 __SYSCALL2(___gettimeofday_with_mach, gettimeofday, 3, cerror_nocancel)
100 .globl ___gettimeofday
103 SYSCALL_NONAME(gettimeofday, 3, cerror_nocancel)
106 #elif defined(__arm64__)
108 __SYSCALL2(___gettimeofday_with_mach, gettimeofday, 3, cerror_nocancel)
112 .globl ___gettimeofday
115 SYSCALL_NONAME(gettimeofday, 3, cerror_nocancel)
119 #error Unsupported architecture