VirtualBox

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

最後變更 在這個檔案從103615是 103602,由 vboxsync 提交於 13 月 前

ValKit/bs3-cpu-instr-2: Added a bunch of tests for binary arithmetic/logical/bit-test-modify instruction (add, sub, cmp, test, and, ...). (This is a little reminiscent of early tstIEMAImpl, but we're severly space limited here, so don't worry about the data source-file size or compile times.) bugref:10376

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 7.3 KB
 
1/* $Id: bs3-cpu-instr-2.c 103602 2024-02-29 02:10:17Z vboxsync $ */
2/** @file
3 * BS3Kit - bs3-cpu-instr-2, 16-bit C code.
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.alldomusa.eu.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_mul);
61BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_imul);
62BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_div);
63BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_idiv);
64BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bsf_tzcnt);
65BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bsr_lzcnt);
66BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_andn);
67BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bextr);
68BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_blsr);
69BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_blsmsk);
70BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_blsi);
71BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_bzhi);
72BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_pdep);
73BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_pext);
74BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_rorx);
75BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_shlx);
76BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_sarx);
77BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_shrx);
78BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_mulx);
79BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_popcnt);
80BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_crc32);
81BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_adcx_adox);
82BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_movbe);
83BS3TESTMODE_PROTOTYPES_CMN(bs3CpuInstr2_cmpxchg8b);
84BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_cmpxchg16b);
85BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_wrfsbase);
86BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_wrgsbase);
87BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_rdfsbase);
88BS3TESTMODE_PROTOTYPES_CMN_64(bs3CpuInstr2_rdgsbase);
89
90
91/*********************************************************************************************************************************
92* Global Variables *
93*********************************************************************************************************************************/
94static const BS3TESTMODEENTRY g_aModeTests[] =
95{
96#if 1
97 BS3TESTMODEENTRY_CMN("and", bs3CpuInstr2_and),
98 BS3TESTMODEENTRY_CMN("or", bs3CpuInstr2_or),
99 BS3TESTMODEENTRY_CMN("xor", bs3CpuInstr2_xor),
100 BS3TESTMODEENTRY_CMN("test", bs3CpuInstr2_test),
101#endif
102#if 1
103 BS3TESTMODEENTRY_CMN("add", bs3CpuInstr2_add),
104 BS3TESTMODEENTRY_CMN("adc", bs3CpuInstr2_adc),
105 BS3TESTMODEENTRY_CMN("sub", bs3CpuInstr2_sub),
106 BS3TESTMODEENTRY_CMN("sbb", bs3CpuInstr2_sbb),
107 BS3TESTMODEENTRY_CMN("cmp", bs3CpuInstr2_cmp),
108#endif
109#if 1
110 BS3TESTMODEENTRY_CMN("bt", bs3CpuInstr2_bt),
111 BS3TESTMODEENTRY_CMN("btc", bs3CpuInstr2_btc),
112 BS3TESTMODEENTRY_CMN("btr", bs3CpuInstr2_btr),
113 BS3TESTMODEENTRY_CMN("bts", bs3CpuInstr2_bts),
114#endif
115#if 1
116 BS3TESTMODEENTRY_CMN("mul", bs3CpuInstr2_mul),
117 BS3TESTMODEENTRY_CMN("imul", bs3CpuInstr2_imul),
118 BS3TESTMODEENTRY_CMN("div", bs3CpuInstr2_div),
119 BS3TESTMODEENTRY_CMN("idiv", bs3CpuInstr2_idiv),
120#endif
121#if 1 /* BSF/BSR (386+) & TZCNT/LZCNT (BMI1,ABM) */
122 BS3TESTMODEENTRY_CMN("bsf/tzcnt", bs3CpuInstr2_bsf_tzcnt),
123 BS3TESTMODEENTRY_CMN("bsr/lzcnt", bs3CpuInstr2_bsr_lzcnt),
124#endif
125#if 1 /* BMI1 */
126 BS3TESTMODEENTRY_CMN("andn", bs3CpuInstr2_andn),
127 BS3TESTMODEENTRY_CMN("bextr", bs3CpuInstr2_bextr),
128 BS3TESTMODEENTRY_CMN("blsr", bs3CpuInstr2_blsr),
129 BS3TESTMODEENTRY_CMN("blsmsk", bs3CpuInstr2_blsmsk),
130 BS3TESTMODEENTRY_CMN("blsi", bs3CpuInstr2_blsi),
131#endif
132#if 1 /* BMI2 */
133 BS3TESTMODEENTRY_CMN("bzhi", bs3CpuInstr2_bzhi),
134 BS3TESTMODEENTRY_CMN("pdep", bs3CpuInstr2_pdep),
135 BS3TESTMODEENTRY_CMN("pext", bs3CpuInstr2_pext),
136 BS3TESTMODEENTRY_CMN("rorx", bs3CpuInstr2_rorx),
137 BS3TESTMODEENTRY_CMN("shlx", bs3CpuInstr2_shlx),
138 BS3TESTMODEENTRY_CMN("sarx", bs3CpuInstr2_sarx),
139 BS3TESTMODEENTRY_CMN("shrx", bs3CpuInstr2_shrx),
140 BS3TESTMODEENTRY_CMN("mulx", bs3CpuInstr2_mulx),
141#endif
142#if 1
143 BS3TESTMODEENTRY_CMN("popcnt", bs3CpuInstr2_popcnt), /* Intel: POPCNT; AMD: ABM */
144 BS3TESTMODEENTRY_CMN("crc32", bs3CpuInstr2_crc32), /* SSE4.2 */
145 BS3TESTMODEENTRY_CMN("adcx/adox", bs3CpuInstr2_adcx_adox), /* ADX */
146 BS3TESTMODEENTRY_CMN("movbe", bs3CpuInstr2_movbe), /* MOVBE */
147 BS3TESTMODEENTRY_CMN("cmpxchg8b", bs3CpuInstr2_cmpxchg8b),
148#endif
149#if 1
150 BS3TESTMODEENTRY_CMN_64("cmpxchg16b", bs3CpuInstr2_cmpxchg16b),
151 BS3TESTMODEENTRY_CMN_64("wrfsbase", bs3CpuInstr2_wrfsbase),
152 BS3TESTMODEENTRY_CMN_64("wrgsbase", bs3CpuInstr2_wrgsbase),
153 BS3TESTMODEENTRY_CMN_64("rdfsbase", bs3CpuInstr2_rdfsbase),
154 BS3TESTMODEENTRY_CMN_64("rdgsbase", bs3CpuInstr2_rdgsbase),
155#endif
156};
157
158
159BS3_DECL(void) Main_rm()
160{
161 Bs3InitAll_rm();
162 Bs3TestInit("bs3-cpu-instr-2");
163
164 Bs3TestDoModes_rm(g_aModeTests, RT_ELEMENTS(g_aModeTests));
165
166 Bs3TestTerm();
167}
168
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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