VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/tstMicro.h@ 400

Last change on this file since 400 was 23, checked in by vboxsync, 18 years ago

string.h & stdio.h + header cleanups.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.2 KB
Line 
1/* $Id: tstMicro.h 23 2007-01-15 14:08:28Z vboxsync $ */
2/** @file
3 * Micro Testcase, profiling special CPU operations.
4 */
5
6/*
7 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#ifndef __tstMicro_h__
23#define __tstMicro_h__
24
25/**
26 * The testcase identifier.
27 */
28typedef enum TSTMICROTEST
29{
30 TSTMICROTEST_OVERHEAD = 0,
31 TSTMICROTEST_INVLPG_0,
32 TSTMICROTEST_INVLPG_EIP,
33 TSTMICROTEST_INVLPG_ESP,
34 TSTMICROTEST_CR3_RELOAD,
35 TSTMICROTEST_WP_DISABLE,
36 TSTMICROTEST_WP_ENABLE,
37
38 TSTMICROTEST_TRAP_FIRST,
39 TSTMICROTEST_PF_R0 = TSTMICROTEST_TRAP_FIRST,
40 TSTMICROTEST_PF_R1,
41 TSTMICROTEST_PF_R2,
42 TSTMICROTEST_PF_R3,
43
44 /** The max testcase. */
45 TSTMICROTEST_MAX
46} TSTMICROTEST;
47
48
49/**
50 *
51 */
52typedef struct TSTMICRORESULT
53{
54 /** The total number of ticks spent executing the testcase.
55 * This may include extra overhead stuff if we're weird stuff during trap handler. */
56 uint64_t cTotalTicks;
57 /** Number of ticks spent getting into Rx from R0.
58 * This will include time spent setting up the testcase in R3. */
59 uint64_t cToRxFirstTicks;
60 /** Number of ticks spent executing the trap.
61 * I.e. from right before trapping instruction to the start of the trap handler.
62 * This does not apply to testcases which doesn't trap. */
63 uint64_t cTrapTicks;
64 /** Number of ticks spent resuming Rx executing after a trap.
65 * This does not apply to testcases which doesn't trap. */
66 uint64_t cToRxTrapTicks;
67 /** Number of ticks to get to back to r0 after resuming the trapped code.
68 * This does not apply to testcases which doesn't trap. */
69 uint64_t cToR0Ticks;
70} TSTMICRORESULT, *PTSTMICRORESULT;
71
72/**
73 * Micro profiling testcase
74 */
75typedef struct TSTMICRO
76{
77 /** The GC address of this structure. */
78 RTGCPTR GCPtr;
79 /** Just for proper alignment. */
80 RTGCPTR GCPtrStack;
81
82 /** TSC sampled right before leaving R0. */
83 uint64_t u64TSCR0Start;
84 /** TSC sampled right before the exception. */
85 uint64_t u64TSCRxStart;
86 /** TSC sampled right after entering the trap handler. */
87 uint64_t u64TSCR0Enter;
88 /** TSC sampled right before exitting the trap handler. */
89 uint64_t u64TSCR0Exit;
90 /** TSC sampled right after resuming guest trap. */
91 uint64_t u64TSCRxEnd;
92 /** TSC sampled right after re-entering R0. */
93 uint64_t u64TSCR0End;
94 /** Number of times entered (should be one). */
95 uint32_t cHits;
96 /** Advance EIP. */
97 int32_t offEIPAdd;
98 /** The last CR3 code. */
99 uint32_t u32CR2;
100 /** The last error code. */
101 uint32_t u32ErrCd;
102 /** The last trap eip. */
103 uint32_t u32EIP;
104 /** The original IDT address and limit. */
105 VBOXIDTR OriginalIDTR;
106 /** Our IDT. */
107 VBOXIDTE aIDT[256];
108
109 /** The overhead for the rdtsc + 2 xchg instr. */
110 uint64_t u64Overhead;
111
112 /** The testresults. */
113 TSTMICRORESULT aResults[TSTMICROTEST_MAX];
114 /** Ring-3 stack. */
115 uint8_t au8Stack[4096];
116
117} TSTMICRO, *PTSTMICRO;
118
119
120__BEGIN_DECLS
121
122DECLASM(void) idtOnly42(PTSTMICRO pTst);
123
124
125DECLASM(void) tstOverhead(PTSTMICRO pTst);
126DECLASM(void) tstInvlpg0(PTSTMICRO pTst);
127DECLASM(void) tstInvlpgEIP(PTSTMICRO pTst);
128DECLASM(void) tstInvlpgESP(PTSTMICRO pTst);
129DECLASM(void) tstCR3Reload(PTSTMICRO pTst);
130DECLASM(void) tstWPEnable(PTSTMICRO pTst);
131DECLASM(void) tstWPDisable(PTSTMICRO pTst);
132
133
134DECLASM(int) tstPFR0(PTSTMICRO pTst);
135DECLASM(int) tstPFR1(PTSTMICRO pTst);
136DECLASM(int) tstPFR2(PTSTMICRO pTst);
137DECLASM(int) tstPFR3(PTSTMICRO pTst);
138
139
140
141DECLASM(void) tstTrapHandlerNoErr(void);
142DECLASM(void) tstTrapHandler(void);
143DECLASM(void) tstInterrupt42(void);
144
145__END_DECLS
146
147#endif
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