VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/testcase/tstContiguous.cpp@ 6412

Last change on this file since 6412 was 5999, checked in by vboxsync, 17 years ago

The Giant CDDL Dual-License Header Change.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1/** @file
2 *
3 * VBox host drivers - Ring-0 support drivers - Testcases:
4 * Test contiguous memory
5 */
6
7/*
8 * Copyright (C) 2006-2007 innotek GmbH
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * The contents of this file may alternatively be used under the terms
19 * of the Common Development and Distribution License Version 1.0
20 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
21 * VirtualBox OSE distribution, in which case the provisions of the
22 * CDDL are applicable instead of those of the GPL.
23 *
24 * You may elect to license modified versions of this file under the
25 * terms and conditions of either the GPL or the CDDL or both.
26 */
27
28
29/*******************************************************************************
30* Header Files *
31*******************************************************************************/
32#include <VBox/sup.h>
33#include <VBox/param.h>
34#include <iprt/runtime.h>
35#include <iprt/stream.h>
36#include <stdlib.h>
37#include <string.h>
38
39
40
41int main(int argc, char **argv)
42{
43 int rc;
44 int rcRet = 0;
45
46 RTR3Init(false);
47 rc = SUPInit();
48 RTPrintf("tstContiguous: SUPInit -> rc=%Vrc\n", rc);
49 rcRet += rc != 0;
50 if (!rc)
51 {
52 /*
53 * Allocate a bit of contiguous memory.
54 */
55 RTHCPHYS HCPhys;
56 void *pv = SUPContAlloc(8, &HCPhys);
57 rcRet += pv == NULL || HCPhys == 0;
58 if (pv && HCPhys)
59 {
60 memset(pv, 0xff, PAGE_SIZE * 8);
61 pv = SUPContAlloc(5, &HCPhys);
62 rcRet += pv == NULL || HCPhys == 0;
63 if (pv && HCPhys)
64 {
65 memset(pv, 0x7f, PAGE_SIZE * 5);
66 rc = SUPContFree(pv, 5);
67 rcRet += rc != 0;
68 if (rc)
69 RTPrintf("tstContiguous: SUPContFree failed! rc=%Vrc\n", rc);
70 }
71 else
72 RTPrintf("tstContiguous: SUPContAlloc (2nd) failed!\n");
73 }
74 else
75 RTPrintf("tstContiguous: SUPContAlloc failed!\n");
76
77 rc = SUPTerm();
78 RTPrintf("tstContiguous: SUPTerm -> rc=%Vrc\n", rc);
79 rcRet += rc != 0;
80 }
81
82 return rcRet;
83}
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