DDK memory replication, memory filling, memory resetting, memory comparison, checking memory read/write

Source: Internet
Author: User

The prefix of the function name during runtime is RTL.
I. Non-overlapping memory replication
Rtlcopymemory

Ii. Overlapping memory Replication
Rtlmovememory

3. Memory Filling
Rtlfillmemory

Iv. zero memory fill
Rtlzerobytes
Rtlzeromemory

It seems that the memory filling operation can also be implemented by using the memory-filled rtlfillmemory.

5. Memory comparison

Rtlcomparememory

6. Check whether the memory is readable.
Probeforread

7. Check whether the memory is writable.
Probeforwrite

The sixth and seventh functions do not return true or false, but cause an exception.

VII. Sample Code

# Define buffer_size 1024
# Pragma initcode
Void rtltest ()
{
Puchar pbuffer = (puchar) exallocatepool (pagedpool, buffer_size );

// Fill the memory with zero
Rtlzeromemory (pbuffer, buffer_size );

Puchar pbuffer2 = (puchar) exallocatepool (pagedpool, buffer_size );
// Fill the memory with fixed bytes
Rtlfillmemory (pbuffer2, buffer_size, 0xaa );

// Memory Replication
Rtlcopymemory (pbuffer, pbuffer2, buffer_size );

// Determine whether the memory is consistent
Ulong ulret = rtlcomparememory (pbuffer, pbuffer2, buffer_size );
If (ulret = buffer_size)
{
Kdprint ("the two memory blocks are consistent! "));

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.