[0.3.x] branch : cr0.py cr4.py

git-svn-id: https://pykd.svn.codeplex.com/svn@85138 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2013-09-10 06:17:22 +00:00 committed by Mikhail I. Izmestev
parent bb9b0ea5f6
commit 10640607e1
3 changed files with 85 additions and 0 deletions

View File

@ -40,6 +40,23 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{FE24
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "targetapp", "kdlibcpp\tests\targetapp\targetapp.vcxproj", "{0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "targetapp", "kdlibcpp\tests\targetapp\targetapp.vcxproj", "{0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{A7AF87D2-983B-4B3A-823F-5A2C6989672E}"
ProjectSection(SolutionItems) = preProject
samples\samples.py = samples\samples.py
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "snippets", "snippets", "{AAB21DD2-B0EE-493E-8415-5195F18879EB}"
ProjectSection(SolutionItems) = preProject
snippets\cr0.py = snippets\cr0.py
snippets\cr4.py = snippets\cr4.py
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "um", "um", "{EEFC9510-DFA7-439E-801E-48FCE72766AD}"
ProjectSection(SolutionItems) = preProject
samples\um\critlist.py = samples\um\critlist.py
samples\um\ldr.py = samples\um\ldr.py
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_2.7|Win32 = Debug_2.7|Win32 Debug_2.7|Win32 = Debug_2.7|Win32
@ -93,5 +110,6 @@ Global
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{FE246107-1CB8-404F-97BD-E901E4B5E972} = {5A3C2DA6-AE91-4025-AC03-A58BD03CEBCD} {FE246107-1CB8-404F-97BD-E901E4B5E972} = {5A3C2DA6-AE91-4025-AC03-A58BD03CEBCD}
{0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF} = {5A3C2DA6-AE91-4025-AC03-A58BD03CEBCD} {0E4CC688-F2F5-499F-9C07-0F2CAEE0D3EF} = {5A3C2DA6-AE91-4025-AC03-A58BD03CEBCD}
{EEFC9510-DFA7-439E-801E-48FCE72766AD} = {A7AF87D2-983B-4B3A-823F-5A2C6989672E}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

32
snippets/cr0.py Normal file
View File

@ -0,0 +1,32 @@
#
#
#
import sys
from pykd import *
def cr0( value = 0 ):
if value == 0:
value = reg( "cr0" ) & 0xFFFFFFFF
dprintln( "CR0: %x (" % value + "".join( [ ( value & ( 1 << ( 31 - i ) ) ) and "1" or "0" for i in range(0,32) ] ) + ")" )
for i in range (0, 32):
bits = { 0 : "PE", 1 : "MP", 2 : "EM", 3 : "TS", 4 : "ET", 5 : "NE", 16 : "WP", 18 : "AM", 29 : "NW", 30 : "CD", 31 : "PG" }
if ( ( 1 << ( 31 -i ) ) & value ) and 31-i in bits:
dprint( " " + bits[31-i] )
dprintln("")
if __name__ == "__main__":
if not isWindbgExt():
print "script is launch out of windbg"
quit( 0 )
if ( len( sys.argv ) > 1 ):
cr0( int( sys.argv[1], 16 ) )
else:
cr0()

35
snippets/cr4.py Normal file
View File

@ -0,0 +1,35 @@
#
#
#
import sys
from pykd import *
def cr4( value = 0 ):
if value == 0:
value = reg( "cr4" ) & 0xFFFFFFFF
dprintln( "CR4: %x (" % value + "".join( [ ( value & ( 1 << ( 31 - i ) ) ) and "1" or "0" for i in range(0,32) ] ) + ")" )
for i in range (0, 32):
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 isWindbgExt():
print "script is launch out of windbg"
quit( 0 )
if len(sys.argv) > 1:
cr4( int( sys.argv[1], 16 ) )
else:
cr4()