1 | /* $Id: timesupref.cpp 29267 2010-05-09 21:21:36Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Time using SUPLib, the C Implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2010 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #if !defined(IN_GUEST) && !defined(RT_NO_GIP)
|
---|
28 |
|
---|
29 | /*******************************************************************************
|
---|
30 | * Header Files *
|
---|
31 | *******************************************************************************/
|
---|
32 | #include <iprt/time.h>
|
---|
33 | #include "internal/iprt.h"
|
---|
34 |
|
---|
35 | #include <iprt/asm.h>
|
---|
36 | #include <iprt/asm-math.h>
|
---|
37 | #include <iprt/asm-amd64-x86.h>
|
---|
38 | #include <VBox/sup.h>
|
---|
39 | #include "internal/time.h"
|
---|
40 |
|
---|
41 |
|
---|
42 | /*
|
---|
43 | * Use the CPUID instruction for some kind of serialization.
|
---|
44 | */
|
---|
45 | #undef ASYNC_GIP
|
---|
46 | #undef USE_LFENCE
|
---|
47 | #define NEED_TRANSACTION_ID
|
---|
48 | #define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySync
|
---|
49 | #include "timesupref.h"
|
---|
50 | RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySync);
|
---|
51 |
|
---|
52 | #define ASYNC_GIP
|
---|
53 | #ifdef IN_RC
|
---|
54 | # undef NEED_TRANSACTION_ID
|
---|
55 | #endif
|
---|
56 | #undef rtTimeNanoTSInternalRef
|
---|
57 | #define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsync
|
---|
58 | #include "timesupref.h"
|
---|
59 | RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsync);
|
---|
60 |
|
---|
61 |
|
---|
62 | /*
|
---|
63 | * Use LFENCE for load serialization.
|
---|
64 | */
|
---|
65 | #undef ASYNC_GIP
|
---|
66 | #define USE_LFENCE
|
---|
67 | #undef NEED_TRANSACTION_ID
|
---|
68 | #define NEED_TRANSACTION_ID
|
---|
69 | #undef rtTimeNanoTSInternalRef
|
---|
70 | #define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSync
|
---|
71 | #include "timesupref.h"
|
---|
72 | RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSync);
|
---|
73 |
|
---|
74 | #define ASYNC_GIP
|
---|
75 | #ifdef IN_RC
|
---|
76 | # undef NEED_TRANSACTION_ID
|
---|
77 | #endif
|
---|
78 | #undef rtTimeNanoTSInternalRef
|
---|
79 | #define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsync
|
---|
80 | #include "timesupref.h"
|
---|
81 | RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsync);
|
---|
82 |
|
---|
83 |
|
---|
84 | #endif /* !IN_GUEST && !RT_NO_GIP */
|
---|
85 |
|
---|