Thinking Kernel Mode

ExAllocatePoolWithTag(KMScrapPad, sizeof(KMSCRAP), TAG_TKM);

  Home  |   Contact  |   Syndication    |   Login
  15 Posts | 0 Stories | 43 Comments | 26 Trackbacks

News

Sreejith S

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Archives

Blogs I Read

Links

New Page 1

Never allocate a dispatcher object from PagedPool. Which means, don't even think about doing a 

KSPIN_LOCK SpinLock;

within your PAGED_CODE. 

If a dispatcher object is allocated from PagedPool, the driver might work peacefully, but occasionally the system will bugcheck saying that it tried to access paged memory from higher IRQL.

So,

  1. Allocate them explicitly from NonPagedPool .

    PKSPIN_LOCK pSpinLock = ExAllocatePool(NonPagedPool, sizeof(struct KSPIN_LOCK));


  2. Or declare them globally. (All global variables in a kernel mode driver are allocated from NonPagedPool).

  3. You can place them in the device extension of the driver created device object. The device extension is always allocated from NonPaged memory.

  4. You can also place them in the controller extension of the driver created controller object.

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Thursday, October 20, 2005 1:11 PM

Feedback

# re: Allocating a synchronization primitive 10/20/2005 7:48 PM Good paper
Da could u present one on synchronisation primitives?

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: