VirtualBox

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

Last change on this file since 85972 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

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