profile: bugfix (cpu.h atomic functions require intptr_t)
slight improvements to aken (declare code segment as pageable) This was SVN commit r5202.
This commit is contained in:
parent
7d91dec842
commit
dc40e831d4
@ -6,15 +6,20 @@ extern "C" { // must come before ntddk.h
|
||||
#define WIN32_NAME L"\\DosDevices\\Aken"
|
||||
#define DEVICE_NAME L"\\Device\\Aken"
|
||||
|
||||
// note: this driver isn't much larger than a page anyway, so
|
||||
// there's little point in using #pragma alloc_text.
|
||||
// this driver isn't large, but it's still slightly nicer to make its
|
||||
// functions pageable and thus not waste precious non-paged pool.
|
||||
// #pragma code_seg is more convenient than specifying alloc_text for
|
||||
// every other function.
|
||||
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING registryPath);
|
||||
#pragma alloc_text(INIT, DriverEntry) // => discardable
|
||||
#pragma code_seg(push, "PAGE")
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// memory mapping
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
|
||||
there are three approaches to mapping physical memory:
|
||||
(http://www.microsoft.com/whdc/driver/kernel/mem-mgmt.mspx)
|
||||
|
||||
@ -43,12 +48,10 @@ means of accessing the page frame database (to check if mapped anywhere
|
||||
and determine the previously set attributes) has not borne fruit, so we
|
||||
must use ZwMapViewOfSection.
|
||||
|
||||
note that we do try to guess if the page will have been mapped as cacheable
|
||||
and even try the opposite if we turn out to be incorrect.
|
||||
|
||||
note that we guess if the page will have been mapped as cacheable and
|
||||
even try the opposite if that turns out to have been incorrect.
|
||||
*/
|
||||
|
||||
|
||||
static bool IsMemoryUncacheable(DWORD64 physicalAddress64)
|
||||
{
|
||||
// original PC memory - contains BIOS
|
||||
@ -335,7 +338,9 @@ static VOID AkenUnload(IN PDRIVER_OBJECT driverObject)
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS DriverEntry(IN OUT PDRIVER_OBJECT driverObject, IN PUNICODE_STRING registryPath)
|
||||
#pragma code_seg(pop) // make sure we don't countermand the alloc_text
|
||||
|
||||
NTSTATUS DriverEntry(IN PDRIVER_OBJECT driverObject, IN PUNICODE_STRING registryPath)
|
||||
{
|
||||
UNICODE_STRING deviceName = RTL_CONSTANT_STRING(DEVICE_NAME);
|
||||
|
||||
|
@ -374,7 +374,7 @@ void CProfileNode::Frame()
|
||||
|
||||
// TODO: these should probably only count allocations that occur in the thread being profiled
|
||||
#if HAVE_VC_DEBUG_ALLOC
|
||||
static long memory_alloc_bias = 0; // so we can subtract the allocations caused by this function
|
||||
static intptr_t memory_alloc_bias = 0; // so we can subtract the allocations caused by this function
|
||||
static long get_memory_alloc_count()
|
||||
{
|
||||
// TODO: it's probably better to use _CrtSetAllocHook to increment a
|
||||
|
Loading…
Reference in New Issue
Block a user