VirtualBox

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

Last change on this file since 73299 was 69111, checked in by vboxsync, 7 years ago

(C) year

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