VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-instr-2.c@ 106317

Last change on this file since 106317 was 106061, checked in by vboxsync, 2 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: 8.3 KB
Line 
1/* $Id: bs3-cpu-instr-2.c 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * BS3Kit - bs3-cpu-instr-2, 16-bit C code.
4 */
5
6/*
7 * Copyright (C) 2007-2024 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* Header Files *
40*********************************************************************************************************************************/
41#include <bs3kit.h>
42
43
44/*********************************************************************************************************************************
45* Internal Functions *
46*********************************************************************************************************************************/
47BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_and);
48BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_or);
49BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_xor);
50BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_test);
51BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_add);
52BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_adc);
53BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_sub);
54BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_sbb);
55BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_cmp);
56BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bt);
57BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_btc);
58BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_btr);
59BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bts);
60BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_shl);
61BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_shr);
62BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_sar);
63BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_rol);
64BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_ror);
65BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_rcl);
66BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_rcr);
67BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_mul);
68BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_imul);
69BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_div);
70BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_idiv);
71BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bsf_tzcnt);
72BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bsr_lzcnt);
73BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_andn);
74BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bextr);
75BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_blsr);
76BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_blsmsk);
77BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_blsi);
78BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bzhi);
79BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_pdep);
80BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_pext);
81BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_rorx);
82BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_shlx);
83BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_sarx);
84BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_shrx);
85BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_mulx);
86BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_popcnt);
87BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_crc32);
88BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_adcx_adox);
89BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_movbe);
90BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_cmpxchg8b);
91BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_cmpxchg16b);
92BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_wrfsbase);
93BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_wrgsbase);
94BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_rdfsbase);
95BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_rdgsbase);
96
97
98/*********************************************************************************************************************************
99* Global Variables *
100*********************************************************************************************************************************/
101static const BS3TESTMODEENTRY g_aModeTests[] =
102{
103#if 1 /*ndef DEBUG_bird*/
104# define ALL_TESTS
105#endif
106#if defined(ALL_TESTS)
107 BS3TESTMODEENTRY_CMN("and", bs3CpuInstr2_and),
108 BS3TESTMODEENTRY_CMN("or", bs3CpuInstr2_or),
109 BS3TESTMODEENTRY_CMN("xor", bs3CpuInstr2_xor),
110 BS3TESTMODEENTRY_CMN("test", bs3CpuInstr2_test),
111#endif
112#if defined(ALL_TESTS)
113 BS3TESTMODEENTRY_CMN("add", bs3CpuInstr2_add),
114 BS3TESTMODEENTRY_CMN("adc", bs3CpuInstr2_adc),
115 BS3TESTMODEENTRY_CMN("sub", bs3CpuInstr2_sub),
116 BS3TESTMODEENTRY_CMN("sbb", bs3CpuInstr2_sbb),
117 BS3TESTMODEENTRY_CMN("cmp", bs3CpuInstr2_cmp),
118#endif
119#if defined(ALL_TESTS)
120 BS3TESTMODEENTRY_CMN("bt", bs3CpuInstr2_bt),
121 BS3TESTMODEENTRY_CMN("btc", bs3CpuInstr2_btc),
122 BS3TESTMODEENTRY_CMN("btr", bs3CpuInstr2_btr),
123 BS3TESTMODEENTRY_CMN("bts", bs3CpuInstr2_bts),
124#endif
125#if defined(ALL_TESTS)
126 BS3TESTMODEENTRY_CMN("shl", bs3CpuInstr2_shl),
127 BS3TESTMODEENTRY_CMN("shr", bs3CpuInstr2_shr),
128 BS3TESTMODEENTRY_CMN("sar", bs3CpuInstr2_sar),
129# if 0/** @todo temporarily disabled till the flag handling in immediate variants have been solved on Intel. */
130 BS3TESTMODEENTRY_CMN("rol", bs3CpuInstr2_rol),
131 BS3TESTMODEENTRY_CMN("ror", bs3CpuInstr2_ror),
132# endif
133 BS3TESTMODEENTRY_CMN("rcl", bs3CpuInstr2_rcl),
134 BS3TESTMODEENTRY_CMN("rcr", bs3CpuInstr2_rcr),
135#endif
136#if defined(ALL_TESTS)
137 BS3TESTMODEENTRY_CMN("mul", bs3CpuInstr2_mul),
138 BS3TESTMODEENTRY_CMN("imul", bs3CpuInstr2_imul),
139 BS3TESTMODEENTRY_CMN("div", bs3CpuInstr2_div),
140 BS3TESTMODEENTRY_CMN("idiv", bs3CpuInstr2_idiv),
141#endif
142#if defined(ALL_TESTS) /* BSF/BSR (386+) & TZCNT/LZCNT (BMI1,ABM) */
143 BS3TESTMODEENTRY_CMN("bsf/tzcnt", bs3CpuInstr2_bsf_tzcnt),
144 BS3TESTMODEENTRY_CMN("bsr/lzcnt", bs3CpuInstr2_bsr_lzcnt),
145#endif
146#if defined(ALL_TESTS) /* BMI1 */
147 BS3TESTMODEENTRY_CMN("andn", bs3CpuInstr2_andn),
148 BS3TESTMODEENTRY_CMN("bextr", bs3CpuInstr2_bextr),
149 BS3TESTMODEENTRY_CMN("blsr", bs3CpuInstr2_blsr),
150 BS3TESTMODEENTRY_CMN("blsmsk", bs3CpuInstr2_blsmsk),
151 BS3TESTMODEENTRY_CMN("blsi", bs3CpuInstr2_blsi),
152#endif
153#if defined(ALL_TESTS) /* BMI2 */
154 BS3TESTMODEENTRY_CMN("bzhi", bs3CpuInstr2_bzhi),
155 BS3TESTMODEENTRY_CMN("pdep", bs3CpuInstr2_pdep),
156 BS3TESTMODEENTRY_CMN("pext", bs3CpuInstr2_pext),
157 BS3TESTMODEENTRY_CMN("rorx", bs3CpuInstr2_rorx),
158 BS3TESTMODEENTRY_CMN("shlx", bs3CpuInstr2_shlx),
159 BS3TESTMODEENTRY_CMN("sarx", bs3CpuInstr2_sarx),
160 BS3TESTMODEENTRY_CMN("shrx", bs3CpuInstr2_shrx),
161 BS3TESTMODEENTRY_CMN("mulx", bs3CpuInstr2_mulx),
162#endif
163#if defined(ALL_TESTS)
164 BS3TESTMODEENTRY_CMN("popcnt", bs3CpuInstr2_popcnt), /* Intel: POPCNT; AMD: ABM */
165 BS3TESTMODEENTRY_CMN("crc32", bs3CpuInstr2_crc32), /* SSE4.2 */
166 BS3TESTMODEENTRY_CMN("adcx/adox", bs3CpuInstr2_adcx_adox), /* ADX */
167 BS3TESTMODEENTRY_CMN("movbe", bs3CpuInstr2_movbe), /* MOVBE */
168 BS3TESTMODEENTRY_CMN("cmpxchg8b", bs3CpuInstr2_cmpxchg8b),
169#endif
170#if defined(ALL_TESTS)
171 BS3TESTMODEENTRY_CMN_64("cmpxchg16b", bs3CpuInstr2_cmpxchg16b),
172 BS3TESTMODEENTRY_CMN_64("wrfsbase", bs3CpuInstr2_wrfsbase),
173 BS3TESTMODEENTRY_CMN_64("wrgsbase", bs3CpuInstr2_wrgsbase),
174 BS3TESTMODEENTRY_CMN_64("rdfsbase", bs3CpuInstr2_rdfsbase),
175 BS3TESTMODEENTRY_CMN_64("rdgsbase", bs3CpuInstr2_rdgsbase),
176#endif
177};
178
179
180BS3_DECL(void) Main_rm()
181{
182 Bs3InitAll_rm();
183 Bs3TestInit("bs3-cpu-instr-2");
184
185 Bs3TestDoModes_rm(g_aModeTests, RT_ELEMENTS(g_aModeTests));
186
187 Bs3TestTerm();
188}
189
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