VirtualBox

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

Last change on this file since 46571 was 46571, checked in by vboxsync, 11 years ago

Preps for memory operand tests.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/* $Id: tstVBInsTstR3.cpp 46571 2013-06-14 16:49:48Z vboxsync $ */
2/** @file
3 * Instruction Test Environment - IPRT ring-3 driver.
4 */
5
6/*
7 * Copyright (C) 2006-2013 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_pvLowMem4K;
53DECLASM(void) TestInstrMain(void);
54
55DECLEXPORT(void) VBInsTstFailure(const char *pszMessage);
56DECLEXPORT(void) VBInsTstFailure1(const char *pszFmt, VBINSTSTREG uArg1);
57DECLEXPORT(void) VBInsTstFailure2(const char *pszFmt, VBINSTSTREG uArg1, VBINSTSTREG uArg2);
58DECLEXPORT(void) VBInsTstFailure3(const char *pszFmt, VBINSTSTREG uArg1, VBINSTSTREG uArg2, VBINSTSTREG uArg3);
59DECLEXPORT(void) VBInsTstFailure4(const char *pszFmt, VBINSTSTREG uArg1, VBINSTSTREG uArg2, VBINSTSTREG uArg3, VBINSTSTREG uArg4);
60RT_C_DECLS_END
61
62
63DECLEXPORT(void) VBInsTstFailure(const char *pszMessage)
64{
65 RTTestFailed(g_hTest, "%s", pszMessage);
66}
67
68DECLEXPORT(void) VBInsTstFailure1(const char *pszFmt, VBINSTSTREG uArg1)
69{
70 RTTestFailed(g_hTest, pszFmt, uArg1);
71}
72
73
74DECLEXPORT(void) VBInsTstFailure2(const char *pszFmt, VBINSTSTREG uArg1, VBINSTSTREG uArg2)
75{
76 RTTestFailed(g_hTest, pszFmt, uArg1, uArg2);
77}
78
79
80DECLEXPORT(void) VBInsTstFailure3(const char *pszFmt, VBINSTSTREG uArg1, VBINSTSTREG uArg2, VBINSTSTREG uArg3)
81{
82 RTTestFailed(g_hTest, pszFmt, uArg1, uArg2, uArg3);
83}
84
85
86DECLEXPORT(void) VBInsTstFailure4(const char *pszFmt, VBINSTSTREG uArg1, VBINSTSTREG uArg2, VBINSTSTREG uArg3, VBINSTSTREG uArg4)
87{
88 RTTestFailed(g_hTest, pszFmt, uArg1, uArg2, uArg3, uArg4);
89}
90
91
92
93
94int main()
95{
96 RTEXITCODE rcExit = RTTestInitAndCreate("VBInsTstR3", &g_hTest);
97 if (rcExit != RTEXITCODE_SUCCESS)
98 return rcExit;
99 RTTestBanner(g_hTest);
100
101 int rc = RTMemAllocEx(_4K, 0, RTMEMALLOCEX_FLAGS_16BIT_REACH, &g_pvLowMem4K);
102 if (RT_FAILURE(rc))
103 {
104 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Could not allocate low memory (%Rrc)\n", rc);
105 g_pvLowMem4K = NULL;
106 }
107
108 TestInstrMain();
109
110 return RTTestSummaryAndDestroy(g_hTest);
111}
112
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