Permalink
Browse files

-- Updated from hosted09 code.

  • Loading branch information...
1 parent db044de commit d57b0930e749a389b4ccb654d793fa0b6f21e20e @ricardog ricardog committed Apr 5, 2011
Showing with 35 additions and 51 deletions.
  1. +10 −12 cookbook/vt-exit-fast.emt
  2. +25 −39 cookbook/vt-exit.emt
View
@@ -1,5 +1,5 @@
/************************************************************
- * Copyright 2007-2011 VMware, Inc. All rights reserved.
+ * Copyright 2007-2009 VMware, Inc. All rights reserved.
* -- VMware Confidential
************************************************************/
@@ -12,24 +12,22 @@
*/
HV_Exit {
- code = getvmcs(VT_EXIT_REASON);
+ code = VMCS_EXIT_REASON;
if (code == 0) { /* Exception */
- key1 = getvmcs(VT_EXIT_INT_INFO) & 0xff;
- key2 = key1 == 14 ? getvmcs(VT_EXIT_QUAL) : 0;
+ key1 = VMCS_EXIT_INTR_INFO & 0xff;
+ key2 = key1 == 14 ? VMCS_EXIT_QUAL : 0;
} else if (code == 1) { /* Interrupt */
- key1 = getvmcs(VT_EXIT_INT_INFO) & 0xff;
+ key1 = VMCS_EXIT_INTR_INFO & 0xff;
key2 = 0;
} else if (code == 14) { /* INVLPG */
- key1 = getvmcs(VT_EXIT_QUAL);
+ key1 = VMCS_EXIT_QUAL;
key2 = 0;
} else if (code == 28) { /* CR */
- qual = getvmcs(VT_EXIT_QUAL);
- key1 = qual & 0xf;
- key2 = (qual >> 4) & 1;
+ key1 = VMCS_EXIT_QUAL & 0xf;
+ key2 = (VMCS_EXIT_QUAL >> 4) & 1;
} else if (code == 30) { /* IN/OUT */
- qual = getvmcs(VT_EXIT_QUAL);
- key1 = (qual >> 16) & 0xfff;
- key2 = (qual >> 3) & 1;
+ key1 = (VMCS_EXIT_QUAL >> 16) & 0xfff;
+ key2 = (VMCS_EXIT_QUAL >> 3) & 1;
} else {
key1 = 0;
key2 = 0;
View
@@ -1,30 +1,7 @@
/************************************************************
- * Copyright 2007-2010 VMware, Inc. All rights reserved.
+ * Copyright 2007-2009 VMware, Inc. All rights reserved.
* -- VMware Confidential
************************************************************/
-/**
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of VMware, Inc. nor the names of its contributors may
- * be used to endorse or promote products derived from this software with
- * specific prior written permission.
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- */
/*
* Pretty-printing aggregator for VT exits.
@@ -35,43 +12,49 @@
* aggregate keys.
*/
-string str;
HV_Exit {
+ string str;
code = VMCS_EXIT_REASON;
- sprintf(str, "%3d ", code);
- /* Exit code 0: software exception */
- if (code == 0) {
+ sprintf(str, "%3d", code);
+
+ if (code == 0) { // software exception
intrInfo = VMCS_EXIT_INTR_INFO;
faultNum = intrInfo & 0xff;
sprintf(str, "%s softint exc %d", str, faultNum);
if (faultNum == 14) {
sprintf(str, "%s #PF @%#llx", str, VMCS_EXIT_QUAL);
}
}
- if (code == 1) {
+ else if (code == 1) {
intrInfo = VMCS_EXIT_INTR_INFO;
sprintf(str, "%s hwIRQ %03d", str, intrInfo & 0xff);
}
- if (code == 12) {
+ else if (code == 7) {
+ sprintf(str, "%s Intr Window", str);
+ }
+ else if (code == 10) {
+ sprintf(str, "%s CPUID", str);
+ }
+ else if (code == 12) {
sprintf(str, "%s HLT", str);
}
- if (code == 14) {
+ else if (code == 14) {
sprintf(str, "%s INVLPG @%#llx", str, VMCS_EXIT_QUAL);
}
- /* Exit code 28: CR */
- if (code == 28) {
+ else if (code == 16) {
+ sprintf(str, "%s RDTSC", str);
+ }
+ else if (code == 28) { // CR instruction
qual = VMCS_EXIT_QUAL;
sprintf(str, "%s CR%1d", str, qual & 0xf);
if (qual & (1 << 4)) {
- sprintf(str, "%s WRITE ", str);
+ sprintf(str, "%s WRITE", str);
} else {
- sprintf(str, "%s READ ", str);
+ sprintf(str, "%s READ", str);
}
}
-
- /* Exit code 30: PIO instruction */
- if (code == 30) {
+ else if (code == 30) { // PIO instruction
qual = VMCS_EXIT_QUAL;
wasIn = qual & (1 << 3);
port = (qual >> 16) & 0xfff;
@@ -82,8 +65,11 @@ HV_Exit {
}
sprintf(str, "%s port %04x", str, port);
}
- if (code == 43) {
+ else if (code == 43) {
sprintf(str, "%s TPR", str);
}
+ else if (code == 44) {
+ sprintf(str, "%s APIC access", str);
+ }
exits[str]++;
}

0 comments on commit d57b093

Please sign in to comment.