pykd
1#
2#
3#
4
5import sys6from pykd import *7
8def cr4( value = 0 ):9
10if value == 0:11value = reg( "cr4" )12
13dprintln( "CR4: %x (" % value + "".join( [ ( value & ( 1 << ( 31 - i ) ) ) and "1" or "0" for i in range(0,32) ] ) + ")" )14
15for i in range (0, 32):16bits = { 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" }17if ( ( 1 << ( 31 -i ) ) & value ) and 31-i in bits:18dprint( " " + bits[31-i] )19
20dprintln("")21
22
23if __name__ == "__main__":24
25if not isWindbgExt():26print "script is launch out of windbg"27quit( 0 )28
29if len(sys.argv) > 1:30cr4( int( sys.argv[1], 16 ) )31else:32cr4()33
34
35
36