1 | ; $Id: timesupA.asm 93115 2022-01-01 11:31:46Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; IPRT - Time using SUPLib, the Assembly Implementation.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2006-2022 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 | %ifndef IN_GUEST
|
---|
28 |
|
---|
29 | %include "iprt/asmdefs.mac"
|
---|
30 | %include "VBox/sup.mac"
|
---|
31 |
|
---|
32 | ;
|
---|
33 | ; Use the C reference implementation for now.
|
---|
34 | ;
|
---|
35 | %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."
|
---|
36 | This is out of date
|
---|
37 | This is out of date
|
---|
38 | This is out of date
|
---|
39 |
|
---|
40 |
|
---|
41 | ;; Keep this in sync with iprt/time.h.
|
---|
42 | struc RTTIMENANOTSDATA
|
---|
43 | .pu64Prev RTCCPTR_RES 1
|
---|
44 | .pfnBad RTCCPTR_RES 1
|
---|
45 | .pfnRediscover RTCCPTR_RES 1
|
---|
46 | .pvDummy RTCCPTR_RES 1
|
---|
47 | .c1nsSteps resd 1
|
---|
48 | .cExpired resd 1
|
---|
49 | .cBadPrev resd 1
|
---|
50 | .cUpdateRaces resd 1
|
---|
51 | endstruc
|
---|
52 |
|
---|
53 |
|
---|
54 | BEGINDATA
|
---|
55 | %undef IN_SUPLIB
|
---|
56 | %undef IMPORTED_SUPLIB
|
---|
57 | %ifdef IN_SUP_R0
|
---|
58 | %define IN_SUPLIB
|
---|
59 | %endif
|
---|
60 | %ifdef IN_SUP_R3
|
---|
61 | %define IN_SUPLIB
|
---|
62 | %endif
|
---|
63 | %ifdef IN_SUP_RC
|
---|
64 | %define IN_SUPLIB
|
---|
65 | %endif
|
---|
66 | %ifdef IN_SUPLIB
|
---|
67 | extern NAME(g_pSUPGlobalInfoPage)
|
---|
68 | %elifdef IN_RING0
|
---|
69 | %ifdef RT_OS_WINDOWS
|
---|
70 | %define IMPORTED_SUPLIB
|
---|
71 | extern IMPNAME(g_SUPGlobalInfoPage)
|
---|
72 | %else
|
---|
73 | extern NAME(g_SUPGlobalInfoPage)
|
---|
74 | %endif
|
---|
75 | %else
|
---|
76 | %ifdef RT_OS_WINDOWS
|
---|
77 | %define IMPORTED_SUPLIB
|
---|
78 | extern IMPNAME(g_pSUPGlobalInfoPage)
|
---|
79 | %else
|
---|
80 | extern NAME(g_pSUPGlobalInfoPage)
|
---|
81 | %endif
|
---|
82 | %endif
|
---|
83 |
|
---|
84 | BEGINCODE
|
---|
85 |
|
---|
86 | ;
|
---|
87 | ; The default stuff that works everywhere.
|
---|
88 | ; Uses cpuid for serializing.
|
---|
89 | ;
|
---|
90 | %undef ASYNC_GIP
|
---|
91 | %undef USE_LFENCE
|
---|
92 | %undef WITH_TSC_DELTA
|
---|
93 | %undef NEED_APIC_ID
|
---|
94 | %define NEED_TRANSACTION_ID
|
---|
95 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacySyncNoDelta
|
---|
96 | %include "timesupA.mac"
|
---|
97 |
|
---|
98 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacyInvariantNoDelta
|
---|
99 | %include "timesupA.mac"
|
---|
100 |
|
---|
101 | %define WITH_TSC_DELTA
|
---|
102 | %define NEED_APIC_ID
|
---|
103 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacySyncWithDelta
|
---|
104 | %include "timesupA.mac"
|
---|
105 |
|
---|
106 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacyInvariantWithDelta
|
---|
107 | %include "timesupA.mac"
|
---|
108 |
|
---|
109 | %define ASYNC_GIP
|
---|
110 | %undef WITH_TSC_DELTA
|
---|
111 | %define NEED_APIC_ID
|
---|
112 | %ifdef IN_RC
|
---|
113 | %undef NEED_TRANSACTION_ID
|
---|
114 | %endif
|
---|
115 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLegacyAsync
|
---|
116 | %include "timesupA.mac"
|
---|
117 |
|
---|
118 |
|
---|
119 | ;
|
---|
120 | ; Alternative implementation that employs lfence instead of cpuid.
|
---|
121 | ;
|
---|
122 | %undef ASYNC_GIP
|
---|
123 | %define USE_LFENCE
|
---|
124 | %undef WITH_TSC_DELTA
|
---|
125 | %undef NEED_APIC_ID
|
---|
126 | %define NEED_TRANSACTION_ID
|
---|
127 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceSyncNoDelta
|
---|
128 | %include "timesupA.mac"
|
---|
129 |
|
---|
130 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceInvariantNoDelta
|
---|
131 | %include "timesupA.mac"
|
---|
132 |
|
---|
133 | %define WITH_TSC_DELTA
|
---|
134 | %define NEED_APIC_ID
|
---|
135 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceSyncWithDelta
|
---|
136 | %include "timesupA.mac"
|
---|
137 |
|
---|
138 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceInvariantWithDelta
|
---|
139 | %include "timesupA.mac"
|
---|
140 |
|
---|
141 | %define ASYNC_GIP
|
---|
142 | %undef WITH_TSC_DELTA
|
---|
143 | %define NEED_APIC_ID
|
---|
144 | %ifdef IN_RC
|
---|
145 | %undef NEED_TRANSACTION_ID
|
---|
146 | %endif
|
---|
147 | %define rtTimeNanoTSInternalAsm RTTimeNanoTSLFenceAsync
|
---|
148 | %include "timesupA.mac"
|
---|
149 |
|
---|
150 |
|
---|
151 | %endif ; !IN_GUEST
|
---|