From baa453196431c37a0f5e9636caee13d69a83e123 Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Fri, 17 Aug 2012 07:15:10 +0000 Subject: [PATCH] [0.2.x] added : pageSize routines git-svn-id: https://pykd.svn.codeplex.com/svn@78897 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/dbgengine.h | 1 + pykd/pymod.cpp | 2 ++ pykd/win/dbgeng.cpp | 16 ++++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/pykd/dbgengine.h b/pykd/dbgengine.h index 5f004f0..581ffdd 100644 --- a/pykd/dbgengine.h +++ b/pykd/dbgengine.h @@ -31,6 +31,7 @@ void eprintln( const std::wstring &str ); // system properties ULONG ptrSize(); bool is64bitSystem(); +ULONG getPageSize(); //manage debug module ULONG64 findModuleBase( const std::string &moduleName ); diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index cf25e60..efbab75 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -106,6 +106,8 @@ BOOST_PYTHON_MODULE( pykd ) "Return effective pointer size" ); python::def( "is64bitSystem", &is64bitSystem, "Check if target system has 64 address space" ); + python::def( "getPageSize", &getPageSize, + "Get the page size for the currently executing processor context" ); // Manage target memory access diff --git a/pykd/win/dbgeng.cpp b/pykd/win/dbgeng.cpp index beaf65c..c21a092 100644 --- a/pykd/win/dbgeng.cpp +++ b/pykd/win/dbgeng.cpp @@ -522,6 +522,22 @@ bool is64bitSystem() /////////////////////////////////////////////////////////////////////////////// +ULONG getPageSize() +{ + PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate ); + + HRESULT hres; + ULONG pageSize; + + hres = g_dbgEng->control->GetPageSize( &pageSize ); + if ( FAILED( hres ) ) + throw DbgException( "IDebugControl::GetPageSize failed" ); + + return pageSize; +} + +/////////////////////////////////////////////////////////////////////////////// + ULONG64 loadMSR( ULONG msr ) { PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );