Paging memory vs. non-paged memory

Source: Internet
Author: User

Windows specifies that some virtual memory can be swapped into a file, which is known as paged memory

Some virtual memory is never exchanged to a file, which is called non-paged memory

#define Pagedcode code_seg ("page");//Paging memory

#define Lockedcode code_seg ();//Non-paged

#define Initcode code_seg ("INIT");

#define PAGEDDATA data_seg ("page");

#define Lockeddata data_seg ();

#define InitData data_seg ("INIT");

Cases:

If you load a function into paged memory, the following functions are available

#pragma pagedcode

VOID Fun ()

{

Paged_code (); Do something

}

Note: Paged_code () is a macro provided by DDK that only takes effect in the check version, and it checks if the function is running at an interrupt request below dispatch_leval, if it is equal to or higher than the interrupt request level, An assertion is generated. When the program is running on top of dispatch_level (including this layer), the program can only use non-paged memory, otherwise it will cause blue screen to panic

If you load a function into non-paged memory, the following functions are available

#pragma lockedcode

VOID Fun ()

{

}

A routine needs to be loaded into memory at initialization time, and then unloaded from memory, such as DriverEntry case, DriverEntry will be large, occupy a lot of space, in order to save memory, need to unload the memory in a timely manner

#pragma initcode

NTSTATUS DriverEntry (

In Pdriver_object Pdriverobject,

In Punicode_string Registerpath)

{//do something}

Paging memory vs. non-paged memory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.