1 | ; $Id: timesupA.asm 96407 2022-08-22 17:43:14Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; IPRT - Time using SUPLib, the Assembly Implementation.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox base platform packages, as
|
---|
10 | ; available from https://www.virtualbox.org.
|
---|
11 | ;
|
---|
12 | ; This program is free software; you can redistribute it and/or
|
---|
13 | ; modify it under the terms of the GNU General Public License
|
---|
14 | ; as published by the Free Software Foundation, in version 3 of the
|
---|
15 | ; License.
|
---|
16 | ;
|
---|
17 | ; This program is distributed in the hope that it will be useful, but
|
---|
18 | ; WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | ; General Public License for more details.
|
---|
21 | ;
|
---|
22 | ; You should have received a copy of the GNU General Public License
|
---|
23 | ; along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | ;
|
---|
25 | ; The contents of this file may alternatively be used under the terms
|
---|
26 | ; of the Common Development and Distribution License Version 1.0
|
---|
27 | ; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | ; in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | ; CDDL are applicable instead of those of the GPL.
|
---|
30 | ;
|
---|
31 | ; You may elect to license modified versions of this file under the
|
---|
32 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | ;
|
---|
34 | ; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | ;
|
---|
36 |
|
---|
37 | %ifndef IN_GUEST
|
---|
38 |
|
---|
39 | %include "iprt/asmdefs.mac"
|
---|
40 | %include "VBox/sup.mac"
|
---|
41 |
|
---|
42 | ;
|
---|
43 | ; Use the C reference implementation for now.
|
---|
44 | ;
|
---|
45 | %error "This is out of date, use C code. Not worth it for a couple of ticks in some functions and equal or worse performance in others."
|
---|
46 | This is out of date
|
---|
47 | This is out of date
|
---|
48 | This is out of date
|
---|
49 |
|
---|
50 |
|
---|
51 | ;; Keep this in sync with iprt/time.h.
|
---|
52 | struc RTTIMENANOTSDATA
|
---|
53 | .pu64Prev RTCCPTR_RES 1
|
---|
54 | .pfnBad RTCCPTR_RES 1
|
---|
55 | .pfnRediscover RTCCPTR_RES 1
|
---|
56 | .pvDummy RTCCPTR_RES 1
|
---|
57 | .c1nsSteps resd 1
|
---|
58 | .cExpired resd 1
|
---|
59 | .cBadPrev resd 1
|
---|
60 | .cUpdateRaces resd 1
|
---|
61 | endstruc
|
---|
62 |
|
---|
63 |
|
---|
64 | BEGINDATA
|
---|
65 | %undef IN_SUPLIB
|
---|
66 | %undef IMPORTED_SUPLIB
|
---|
67 | %ifdef IN_SUP_R0
|
---|
68 | %define IN_SUPLIB
|
---|
69 | %endif
|
---|
70 | %ifdef IN_SUP_R3
|
---|
71 | %define IN_SUPLIB
|
---|
72 | %endif
|
---|
73 | %ifdef IN_SUP_RC
|
---|
74 | %define IN_SUPLIB
|
---|
75 | %endif
|
---|
76 | %ifdef IN_SUPLIB
|
---|
77 | extern NAME(g_pSUPGlobalInfoPage)
|
---|
78 | %elifdef IN_RING0
|
---|
79 | %ifdef RT_OS_WINDOWS
|
---|
80 | %define IMPORTED_SUPLIB
|
---|
81 | extern IMPNAME(g_SUPGlobalInfoPage)
|
---|
82 | %else
|
---|
83 | extern NAME(g_SUPGlobalInfoPage)
|
---|
84 | %endif
|
---|
85 | %else
|
---|
86 | %ifdef RT_OS_WINDOWS
|
---|
87 | %define IMPORTED_SUPLIB
|
---|
88 | extern IMPNAME(g_pSUPGlobalInfoPage)
|
---|
89 | %else
|
---|
90 | extern NAME(g_pSUPGlobalInfoPage)
|
---|
91 | %endif
|
---|
92 | %endif
|
---|
93 |
|
---|
94 | BEGINCODE
|
---|
95 |
|
---|
96 | ;
|
---|
97 | ; The default stuff that works everywhere.
|
---|
98 | ; Uses cpuid for serializing.
|
---|
99 | ;
|
---|
100 | %undef ASYNC_GIP
|
---|
101 | %undef USE_LFENCE
|
---|
102 | %undef WITH_TSC_DELTA
|
---|
103 | %undef NEED_APIC_ID
|
---|
104 | %define NEED_TRANSACTION_ID
|
---|
105 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacySyncNoDelta
|
---|
106 | %include "timesupA.mac"
|
---|
107 |
|
---|
108 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacyInvariantNoDelta
|
---|
109 | %include "timesupA.mac"
|
---|
110 |
|
---|
111 | %define WITH_TSC_DELTA
|
---|
112 | %define NEED_APIC_ID
|
---|
113 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacySyncWithDelta
|
---|
114 | %include "timesupA.mac"
|
---|
115 |
|
---|
116 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacyInvariantWithDelta
|
---|
117 | %include "timesupA.mac"
|
---|
118 |
|
---|
119 | %define ASYNC_GIP
|
---|
120 | %undef WITH_TSC_DELTA
|
---|
121 | %define NEED_APIC_ID
|
---|
122 | %ifdef IN_RC
|
---|
123 | %undef NEED_TRANSACTION_ID
|
---|
124 | %endif
|
---|
125 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacyAsync
|
---|
126 | %include "timesupA.mac"
|
---|
127 |
|
---|
128 |
|
---|
129 | ;
|
---|
130 | ; Alternative implementation that employs lfence instead of cpuid.
|
---|
131 | ;
|
---|
132 | %undef ASYNC_GIP
|
---|
133 | %define USE_LFENCE
|
---|
134 | %undef WITH_TSC_DELTA
|
---|
135 | %undef NEED_APIC_ID
|
---|
136 | %define NEED_TRANSACTION_ID
|
---|
137 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceSyncNoDelta
|
---|
138 | %include "timesupA.mac"
|
---|
139 |
|
---|
140 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceInvariantNoDelta
|
---|
141 | %include "timesupA.mac"
|
---|
142 |
|
---|
143 | %define WITH_TSC_DELTA
|
---|
144 | %define NEED_APIC_ID
|
---|
145 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceSyncWithDelta
|
---|
146 | %include "timesupA.mac"
|
---|
147 |
|
---|
148 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceInvariantWithDelta
|
---|
149 | %include "timesupA.mac"
|
---|
150 |
|
---|
151 | %define ASYNC_GIP
|
---|
152 | %undef WITH_TSC_DELTA
|
---|
153 | %define NEED_APIC_ID
|
---|
154 | %ifdef IN_RC
|
---|
155 | %undef NEED_TRANSACTION_ID
|
---|
156 | %endif
|
---|
157 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceAsync
|
---|
158 | %include "timesupA.mac"
|
---|
159 |
|
---|
160 |
|
---|
161 | %endif ; !IN_GUEST
|
---|