From 639b5df6b37c1bb389ed85d508731ba2c35aab7c Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Thu, 28 Oct 2010 08:04:01 +0000 Subject: [PATCH] [+] added: windbg snippet displaying CR4 register git-svn-id: https://pykd.svn.codeplex.com/svn@56566 9b283d60-5439-405e-af05-b73fd8c4d996 --- snippets/cr4.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 snippets/cr4.py diff --git a/snippets/cr4.py b/snippets/cr4.py new file mode 100644 index 0000000..b29e1d3 --- /dev/null +++ b/snippets/cr4.py @@ -0,0 +1,34 @@ +# +# +# + +from pykd import * + +def cr4( value = 0 ): + + if value == 0: + value = reg( "cr4" ) + + dprintln( "CR4: %x (" % value + "".join( [ ( value & ( 1 << ( 31 - i ) ) ) and "1" or "0" for i in range(0,31) ] ) + ")" ) + + for i in range (0, 31): + bits = { 0 : "VME", 1 : "PVI", 2 : "TSD", 3 : "DE", 4 : "PSE", 5 : "PAE", 6 : "MCE", 7 : "PGE", 8 : "PCE", 9 : "OSFXSR", 10 : "OSXMMEXCPT", 13 : "VMXE", 14 : "SMXE", 17 : "PCIDE", 18 : "OSXSAVE" } + if ( ( 1 << ( 31 -i ) ) & value ) and 31-i in bits: + dprint( " " + bits[31-i] ) + + dprintln("") + + +if __name__ == "__main__": + + if not isSessionStart(): + print "script is launch out of windbg" + quit( 0 ) + + if (sys.argv[0] != "" ): + cr4( int( sys.argv[0], 16 ) ) + else: + cr4() + + +