Skip to content

Instantly share code, notes, and snippets.

@williamtu
Created April 10, 2015 06:02
Show Gist options
  • Save williamtu/6ebbb8249b85d56fc78a to your computer and use it in GitHub Desktop.
Save williamtu/6ebbb8249b85d56fc78a to your computer and use it in GitHub Desktop.
import curses
import sys, os, time, optparse, ctypes
from ctypes import *
class DebugfsProvider(object):
def __init__(self):
self.base = '/sys/kernel/debug/kvm'
self._fields = os.listdir(self.base)
def fields(self):
return self._fields
def select(self, fields):
self._fields = fields
def read(self):
def val(key):
return int(file(self.base + '/' + key).read())
return dict([(key, val(key)) for key in self._fields])
vmx_exit_reasons = {
0: 'EXCEPTION_NMI',
1: 'EXTERNAL_INTERRUPT',
2: 'TRIPLE_FAULT',
7: 'PENDING_INTERRUPT',
8: 'NMI_WINDOW',
9: 'TASK_SWITCH',
10: 'CPUID',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment