1 | ; $Id: tstRTPrfA.asm 60191 2016-03-25 16:59:31Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; IPRT - Comparing CPU registers and memory (cache).
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2016 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 |
|
---|
28 |
|
---|
29 | %include "iprt/asmdefs.mac"
|
---|
30 |
|
---|
31 |
|
---|
32 | %define NUM_LOOPS 10000h
|
---|
33 |
|
---|
34 | BEGINPROC tstRTPRfARegisterAccess
|
---|
35 | push xBP
|
---|
36 | mov xBP, xSP
|
---|
37 | and xSP, ~3fh ; 64 byte align xSP
|
---|
38 | push xBP
|
---|
39 | mov xBP, xSP
|
---|
40 | sub xSP, 20h
|
---|
41 |
|
---|
42 | mov xAX, 1
|
---|
43 | mov xDX, 1
|
---|
44 | mov ecx, NUM_LOOPS
|
---|
45 | .again:
|
---|
46 | add eax, ecx
|
---|
47 | add xDX, xAX
|
---|
48 | shr xAX, 3
|
---|
49 | shl xAX, 1
|
---|
50 | xor xDX, 01010101h
|
---|
51 |
|
---|
52 | add eax, ecx
|
---|
53 | add xDX, xAX
|
---|
54 | shr xAX, 3
|
---|
55 | shl xAX, 1
|
---|
56 | xor xDX, 01010101h
|
---|
57 |
|
---|
58 | add eax, ecx
|
---|
59 | add xDX, xAX
|
---|
60 | shr xAX, 3
|
---|
61 | shl xAX, 1
|
---|
62 | xor xDX, 01010101h
|
---|
63 |
|
---|
64 | dec ecx
|
---|
65 | jnz .again
|
---|
66 |
|
---|
67 | leave
|
---|
68 | leave
|
---|
69 | ret
|
---|
70 | ENDPROC tstRTPRfARegisterAccess
|
---|
71 |
|
---|
72 |
|
---|
73 | BEGINPROC tstRTPRfAMemoryAccess
|
---|
74 | push xBP
|
---|
75 | mov xBP, xSP
|
---|
76 | and xSP, ~3fh ; 64 byte align xSP
|
---|
77 | push xBP
|
---|
78 | mov xBP, xSP
|
---|
79 | sub xSP, 20h
|
---|
80 |
|
---|
81 | %define VAR_XAX [xBP - xCB*1]
|
---|
82 | %define VAR_XDX [xBP - xCB*2]
|
---|
83 | %define VAR_ECX [xBP - xCB*3]
|
---|
84 |
|
---|
85 | mov RTCCPTR_PRE VAR_XAX, 1
|
---|
86 | mov RTCCPTR_PRE VAR_XDX, 1
|
---|
87 | mov dword VAR_ECX, NUM_LOOPS
|
---|
88 | .again:
|
---|
89 |
|
---|
90 | mov eax, VAR_ECX
|
---|
91 | add VAR_XAX, eax
|
---|
92 | mov xAX, VAR_XAX
|
---|
93 | add VAR_XDX, xAX
|
---|
94 | shr RTCCPTR_PRE VAR_XAX, 3
|
---|
95 | shl RTCCPTR_PRE VAR_XAX, 1
|
---|
96 | xor RTCCPTR_PRE VAR_XDX, 01010101h
|
---|
97 |
|
---|
98 | mov eax, VAR_ECX
|
---|
99 | add VAR_XAX, eax
|
---|
100 | mov xAX, VAR_XAX
|
---|
101 | add VAR_XDX, xAX
|
---|
102 | shr RTCCPTR_PRE VAR_XAX, 3
|
---|
103 | shl RTCCPTR_PRE VAR_XAX, 1
|
---|
104 | xor RTCCPTR_PRE VAR_XDX, 01010101h
|
---|
105 |
|
---|
106 | mov eax, VAR_ECX
|
---|
107 | add VAR_XAX, eax
|
---|
108 | mov xAX, VAR_XAX
|
---|
109 | add VAR_XDX, xAX
|
---|
110 | shr RTCCPTR_PRE VAR_XAX, 3
|
---|
111 | shl RTCCPTR_PRE VAR_XAX, 1
|
---|
112 | xor RTCCPTR_PRE VAR_XDX, 01010101h
|
---|
113 |
|
---|
114 | dec dword VAR_ECX
|
---|
115 | jnz .again
|
---|
116 |
|
---|
117 | %undef VAR_XAX
|
---|
118 | %undef VAR_XDX
|
---|
119 | %undef VAR_ECX
|
---|
120 |
|
---|
121 | leave
|
---|
122 | leave
|
---|
123 | ret
|
---|
124 | ENDPROC tstRTPRfAMemoryAccess
|
---|
125 |
|
---|
126 |
|
---|
127 | BEGINPROC tstRTPRfAMemoryUnalignedAccess
|
---|
128 | push xBP
|
---|
129 | mov xBP, xSP
|
---|
130 | and xSP, ~3fh ; 64 byte align xSP
|
---|
131 | push xBP
|
---|
132 | mov xBP, xSP
|
---|
133 | sub xSP, 20h
|
---|
134 |
|
---|
135 | %define VAR_XAX [xBP - xCB*1 - 1]
|
---|
136 | %define VAR_XDX [xBP - xCB*2 - 1]
|
---|
137 | %define VAR_ECX [xBP - xCB*3 - 1]
|
---|
138 |
|
---|
139 | mov RTCCPTR_PRE VAR_XAX, 1
|
---|
140 | mov RTCCPTR_PRE VAR_XDX, 1
|
---|
141 | mov dword VAR_ECX, NUM_LOOPS
|
---|
142 | .again:
|
---|
143 |
|
---|
144 | mov eax, VAR_ECX
|
---|
145 | add VAR_XAX, eax
|
---|
146 | mov xAX, VAR_XAX
|
---|
147 | add VAR_XDX, xAX
|
---|
148 | shr RTCCPTR_PRE VAR_XAX, 3
|
---|
149 | shl RTCCPTR_PRE VAR_XAX, 1
|
---|
150 | xor RTCCPTR_PRE VAR_XDX, 01010101h
|
---|
151 |
|
---|
152 | mov eax, VAR_ECX
|
---|
153 | add VAR_XAX, eax
|
---|
154 | mov xAX, VAR_XAX
|
---|
155 | add VAR_XDX, xAX
|
---|
156 | shr RTCCPTR_PRE VAR_XAX, 3
|
---|
157 | shl RTCCPTR_PRE VAR_XAX, 1
|
---|
158 | xor RTCCPTR_PRE VAR_XDX, 01010101h
|
---|
159 |
|
---|
160 | mov eax, VAR_ECX
|
---|
161 | add VAR_XAX, eax
|
---|
162 | mov xAX, VAR_XAX
|
---|
163 | add VAR_XDX, xAX
|
---|
164 | shr RTCCPTR_PRE VAR_XAX, 3
|
---|
165 | shl RTCCPTR_PRE VAR_XAX, 1
|
---|
166 | xor RTCCPTR_PRE VAR_XDX, 01010101h
|
---|
167 |
|
---|
168 | dec dword VAR_ECX
|
---|
169 | jnz .again
|
---|
170 |
|
---|
171 | %undef VAR_XAX
|
---|
172 | %undef VAR_XDX
|
---|
173 | %undef VAR_ECX
|
---|
174 |
|
---|
175 | leave
|
---|
176 | leave
|
---|
177 | ret
|
---|
178 | ENDPROC tstRTPRfAMemoryUnalignedAccess
|
---|
179 |
|
---|