VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/Instructions/tstVBInsTstR3.cpp@ 100725

Last change on this file since 100725 was 98103, checked in by vboxsync, 23 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.4 KB
Line 
1/* $Id: tstVBInsTstR3.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * Instruction Test Environment - IPRT ring-3 driver.
4 */
5
6/*
7 * Copyright (C) 2006-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 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28
29/*********************************************************************************************************************************
30* Header Files *
31*********************************************************************************************************************************/
32#include <iprt/mem.h>
33#include <iprt/string.h>
34#include <iprt/test.h>
35
36#ifdef RT_OS_WINDOWS
37# define NO_LOW_MEM
38#elif defined(RT_OS_OS2) || defined(RT_OS_HAIKU)
39# define NO_LOW_MEM
40#else
41# include <sys/mman.h>
42#endif
43
44
45/*********************************************************************************************************************************
46* Structures and Typedefs *
47*********************************************************************************************************************************/
48#if HC_ARCH_BITS == 64
49typedef uint64_t VBINSTSTREG;
50#else
51typedef uint32_t VBINSTSTREG;
52#endif
53
54
55/*********************************************************************************************************************************
56* Global Variables *
57*********************************************************************************************************************************/
58RTTEST g_hTest;
59
60
61RT_C_DECLS_BEGIN
62extern void *g_pvLow16Mem4K;
63extern void *g_pvLow32Mem4K;
64DECLASM(void) TestInstrMain(void);
65
66DECLEXPORT(void) VBInsTstFailure(const char *pszMessage);
67DECLEXPORT(void) VBInsTstFailure1(const char *pszFmt, VBINSTSTREG uArg1);
68DECLEXPORT(void) VBInsTstFailure2(const char *pszFmt, VBINSTSTREG uArg1, VBINSTSTREG uArg2);
69DECLEXPORT(void) VBInsTstFailure3(const char *pszFmt, VBINSTSTREG uArg1, VBINSTSTREG uArg2, VBINSTSTREG uArg3);
70DECLEXPORT(void) VBInsTstFailure4(const char *pszFmt, VBINSTSTREG uArg1, VBINSTSTREG uArg2, VBINSTSTREG uArg3, VBINSTSTREG uArg4);
71RT_C_DECLS_END
72
73
74DECLEXPORT(void) VBInsTstFailure(const char *pszMessage)
75{
76 RTTestFailed(g_hTest, "%s", pszMessage);
77}
78
79DECLEXPORT(void) VBInsTstFailure1(const char *pszFmt, VBINSTSTREG uArg1)
80{
81 RTTestFailed(g_hTest, pszFmt, uArg1);
82}
83
84
85DECLEXPORT(void) VBInsTstFailure2(const char *pszFmt, VBINSTSTREG uArg1, VBINSTSTREG uArg2)
86{
87 RTTestFailed(g_hTest, pszFmt, uArg1, uArg2);
88}
89
90
91DECLEXPORT(void) VBInsTstFailure3(const char *pszFmt, VBINSTSTREG uArg1, VBINSTSTREG uArg2, VBINSTSTREG uArg3)
92{
93 RTTestFailed(g_hTest, pszFmt, uArg1, uArg2, uArg3);
94}
95
96
97DECLEXPORT(void) VBInsTstFailure4(const char *pszFmt, VBINSTSTREG uArg1, VBINSTSTREG uArg2, VBINSTSTREG uArg3, VBINSTSTREG uArg4)
98{
99 RTTestFailed(g_hTest, pszFmt, uArg1, uArg2, uArg3, uArg4);
100}
101
102
103
104
105int main()
106{
107 RTEXITCODE rcExit = RTTestInitAndCreate("VBInsTstR3", &g_hTest);
108 if (rcExit != RTEXITCODE_SUCCESS)
109 return rcExit;
110 RTTestBanner(g_hTest);
111
112 int rc = RTMemAllocEx(_4K, 0, RTMEMALLOCEX_FLAGS_16BIT_REACH, &g_pvLow16Mem4K);
113 if (RT_FAILURE(rc))
114 {
115 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Could not allocate low 16-bit memory (%Rrc)\n", rc);
116 g_pvLow16Mem4K = NULL;
117 }
118
119 rc = RTMemAllocEx(_4K, 0, RTMEMALLOCEX_FLAGS_32BIT_REACH, &g_pvLow32Mem4K);
120 if (RT_FAILURE(rc))
121 {
122 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Could not allocate low 32-bit memory (%Rrc)\n", rc);
123 g_pvLow32Mem4K = NULL;
124 }
125
126 TestInstrMain();
127
128 return RTTestSummaryAndDestroy(g_hTest);
129}
130
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