VirtualBox

source: vbox/trunk/src/VBox/Runtime/testcase/tstRTPrfA.asm@ 102792

Last change on this file since 102792 was 98103, checked in by vboxsync, 20 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1; $Id: tstRTPrfA.asm 98103 2023-01-17 14:15:46Z vboxsync $
2;; @file
3; IPRT - Comparing CPU registers and memory (cache).
4;
5
6;
7; Copyright (C) 2007-2023 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
38
39%include "iprt/asmdefs.mac"
40
41
42%define NUM_LOOPS 10000h
43
44BEGINCODE
45
46BEGINPROC tstRTPRfARegisterAccess
47 push xBP
48 mov xBP, xSP
49 and xSP, ~3fh ; 64 byte align xSP
50 push xBP
51 mov xBP, xSP
52 sub xSP, 20h
53
54 mov xAX, 1
55 mov xDX, 1
56 mov ecx, NUM_LOOPS
57.again:
58 add eax, ecx
59 add xDX, xAX
60 shr xAX, 3
61 shl xAX, 1
62 xor xDX, 01010101h
63
64 add eax, ecx
65 add xDX, xAX
66 shr xAX, 3
67 shl xAX, 1
68 xor xDX, 01010101h
69
70 add eax, ecx
71 add xDX, xAX
72 shr xAX, 3
73 shl xAX, 1
74 xor xDX, 01010101h
75
76 dec ecx
77 jnz .again
78
79 leave
80 leave
81 ret
82ENDPROC tstRTPRfARegisterAccess
83
84
85BEGINPROC tstRTPRfAMemoryAccess
86 push xBP
87 mov xBP, xSP
88 and xSP, ~3fh ; 64 byte align xSP
89 push xBP
90 mov xBP, xSP
91 sub xSP, 20h
92
93%define VAR_XAX [xBP - xCB*1]
94%define VAR_XDX [xBP - xCB*2]
95%define VAR_ECX [xBP - xCB*3]
96
97 mov RTCCPTR_PRE VAR_XAX, 1
98 mov RTCCPTR_PRE VAR_XDX, 1
99 mov dword VAR_ECX, NUM_LOOPS
100.again:
101
102 mov eax, VAR_ECX
103 add VAR_XAX, eax
104 mov xAX, VAR_XAX
105 add VAR_XDX, xAX
106 shr RTCCPTR_PRE VAR_XAX, 3
107 shl RTCCPTR_PRE VAR_XAX, 1
108 xor RTCCPTR_PRE VAR_XDX, 01010101h
109
110 mov eax, VAR_ECX
111 add VAR_XAX, eax
112 mov xAX, VAR_XAX
113 add VAR_XDX, xAX
114 shr RTCCPTR_PRE VAR_XAX, 3
115 shl RTCCPTR_PRE VAR_XAX, 1
116 xor RTCCPTR_PRE VAR_XDX, 01010101h
117
118 mov eax, VAR_ECX
119 add VAR_XAX, eax
120 mov xAX, VAR_XAX
121 add VAR_XDX, xAX
122 shr RTCCPTR_PRE VAR_XAX, 3
123 shl RTCCPTR_PRE VAR_XAX, 1
124 xor RTCCPTR_PRE VAR_XDX, 01010101h
125
126 dec dword VAR_ECX
127 jnz .again
128
129%undef VAR_XAX
130%undef VAR_XDX
131%undef VAR_ECX
132
133 leave
134 leave
135 ret
136ENDPROC tstRTPRfAMemoryAccess
137
138
139BEGINPROC tstRTPRfAMemoryUnalignedAccess
140 push xBP
141 mov xBP, xSP
142 and xSP, ~3fh ; 64 byte align xSP
143 push xBP
144 mov xBP, xSP
145 sub xSP, 20h
146
147%define VAR_XAX [xBP - xCB*1 - 1]
148%define VAR_XDX [xBP - xCB*2 - 1]
149%define VAR_ECX [xBP - xCB*3 - 1]
150
151 mov RTCCPTR_PRE VAR_XAX, 1
152 mov RTCCPTR_PRE VAR_XDX, 1
153 mov dword VAR_ECX, NUM_LOOPS
154.again:
155
156 mov eax, VAR_ECX
157 add VAR_XAX, eax
158 mov xAX, VAR_XAX
159 add VAR_XDX, xAX
160 shr RTCCPTR_PRE VAR_XAX, 3
161 shl RTCCPTR_PRE VAR_XAX, 1
162 xor RTCCPTR_PRE VAR_XDX, 01010101h
163
164 mov eax, VAR_ECX
165 add VAR_XAX, eax
166 mov xAX, VAR_XAX
167 add VAR_XDX, xAX
168 shr RTCCPTR_PRE VAR_XAX, 3
169 shl RTCCPTR_PRE VAR_XAX, 1
170 xor RTCCPTR_PRE VAR_XDX, 01010101h
171
172 mov eax, VAR_ECX
173 add VAR_XAX, eax
174 mov xAX, VAR_XAX
175 add VAR_XDX, xAX
176 shr RTCCPTR_PRE VAR_XAX, 3
177 shl RTCCPTR_PRE VAR_XAX, 1
178 xor RTCCPTR_PRE VAR_XDX, 01010101h
179
180 dec dword VAR_ECX
181 jnz .again
182
183%undef VAR_XAX
184%undef VAR_XDX
185%undef VAR_ECX
186
187 leave
188 leave
189 ret
190ENDPROC tstRTPRfAMemoryUnalignedAccess
191
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette