VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp@ 1890

Last change on this file since 1890 was 1850, checked in by vboxsync, 18 years ago

Corrected the heuristics for detecing async GIP mode, fixed GIP layout bug and initialize u32Version.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/** @file
2 *
3 * VBox host drivers - Ring-0 support drivers - Testcases:
4 * Test the Global Info Page interface
5 */
6
7/*
8 * Copyright (C) 2006 InnoTek Systemberatung 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 as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * If you received this file as part of a commercial VirtualBox
19 * distribution, then only the terms of your commercial VirtualBox
20 * license agreement apply instead of the previous paragraph.
21 */
22
23/*******************************************************************************
24* Header Files *
25*******************************************************************************/
26#include <VBox/sup.h>
27#include <VBox/err.h>
28#include <VBox/param.h>
29#include <iprt/asm.h>
30#include <iprt/assert.h>
31#include <iprt/alloc.h>
32#include <iprt/thread.h>
33#include <iprt/stream.h>
34#include <iprt/runtime.h>
35
36
37int main(void)
38{
39 RTR3Init();
40
41 /*
42 * Init
43 */
44 PSUPDRVSESSION pSession = NIL_RTR0PTR;
45 int rc = SUPInit(&pSession);
46 if (VBOX_SUCCESS(rc))
47 {
48 if (g_pSUPGlobalInfoPage)
49 {
50 RTPrintf("tstGIP-2: u32UpdateHz=%RU32 u32UpdateIntervalNS=%RU32 u64NanoTSLastUpdateHz=%RX64 u32Mode=%d (%s) u32Version=%#x\n"
51 "tstGIP-2: it: u64NanoTS u64TSC UpIntTSC H TransId CpuHz TSC Interval History...\n",
52 g_pSUPGlobalInfoPage->u32UpdateHz,
53 g_pSUPGlobalInfoPage->u32UpdateIntervalNS,
54 g_pSUPGlobalInfoPage->u64NanoTSLastUpdateHz,
55 g_pSUPGlobalInfoPage->u32Mode,
56 g_pSUPGlobalInfoPage->u32Mode == SUPGIPMODE_SYNC_TSC ? "sync"
57 : g_pSUPGlobalInfoPage->u32Mode == SUPGIPMODE_ASYNC_TSC ? "async"
58 : "???",
59 g_pSUPGlobalInfoPage->u32Version);
60 for (int i = 0; i < 80; i++)
61 {
62 RTPrintf("tstGIP-2: %2d: %016llx %016llx %08x %d %08x %15llu %08x %08x %08x %08x %08x %08x %08x %08x\n",
63 i,
64 g_pSUPGlobalInfoPage->aCPUs[0].u64NanoTS,
65 g_pSUPGlobalInfoPage->aCPUs[0].u64TSC,
66 g_pSUPGlobalInfoPage->aCPUs[0].u32UpdateIntervalTSC,
67 g_pSUPGlobalInfoPage->aCPUs[0].iTSCHistoryHead,
68 g_pSUPGlobalInfoPage->aCPUs[0].u32TransactionId,
69 g_pSUPGlobalInfoPage->aCPUs[0].u64CpuHz,
70 g_pSUPGlobalInfoPage->aCPUs[0].au32TSCHistory[0],
71 g_pSUPGlobalInfoPage->aCPUs[0].au32TSCHistory[1],
72 g_pSUPGlobalInfoPage->aCPUs[0].au32TSCHistory[2],
73 g_pSUPGlobalInfoPage->aCPUs[0].au32TSCHistory[3],
74 g_pSUPGlobalInfoPage->aCPUs[0].au32TSCHistory[4],
75 g_pSUPGlobalInfoPage->aCPUs[0].au32TSCHistory[5],
76 g_pSUPGlobalInfoPage->aCPUs[0].au32TSCHistory[6],
77 g_pSUPGlobalInfoPage->aCPUs[0].au32TSCHistory[7]);
78 RTThreadSleep(9);
79 }
80 }
81 else
82 {
83 RTPrintf("tstGIP-2: g_pSUPGlobalInfoPage is NULL\n");
84 rc = -1;
85 }
86
87 SUPTerm();
88 }
89 else
90 RTPrintf("tstGIP-2: SUPInit failed: %Vrc\n", rc);
91 return !!rc;
92}
Note: See TracBrowser for help on using the repository browser.

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