Page size for x64

There is a long, sometime torturous, thread on the topic of common buffer alignment here. I strongly recommend you get a cup of coffee and read through the entire thing. Mr. Roberts does some excellent investigation.

Among the findings:

  1. It appears you have to use a scatter/gather profile for your alignment to be respected.

  2. Use WdfCommonBufferCreateWithConfig instead of relying on the device alignment to be respected.

I’ll be waiting to hear the result of your experiments!

Peter

3 Likes

The result of “WdfCommonBufferCreateWithConfig” is that it is looking that all my problems have apparently vanished, for now.

I will give that thread a read.

Thank you.

Even absent a “correct” fix, it’s always trivially easy to generate whatever arbitrary alignment you need. If you need a 64k buffer with 16k alignment, just allocate an 80k buffer (64+16), and adjust your starting address to the first 16k aligned address.

void * myptr = allocate_common_buffer( 65536 + 16384);
void * aligned = (void *)((UINT_PTR)myptr) + 16384 - ((UINT_PTR)myptr) & 16383));

@“Peter_Viscarola_(OSR)” said:
There is a long, sometime torturous, thread on the topic of common buffer alignment here. I strongly recommend you get a cup of coffee and read through the entire thing. Mr. Roberts does some excellent investigation.
Wow, did anyone formally report this bug to MSFT? I agree with the comments in that thread that this is a BUG!
Thanks @“Peter_Viscarola_(OSR)” and @Tim_Roberts for some very useful info.

Eric

Wow, did anyone formally report this bug to MSFT?

I didn’t report it either formally or informally. Mr. Roberts should get the glory :slight_smile:

Peter

Anyhow everything is working great. Thank you all. And if you think that is a bug I should not mention… I think driver writers should learn how to create actual devices…and the other way around. I am sooooo tired. But thank you.