Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allocation / OS check optimization, Mingw updates #36

Merged
merged 10 commits into from
Sep 19, 2023

Conversation

tormodvolden
Copy link
Contributor

The first commit was originally motivated by plans for other functions needing run-time OS version checks, but I have dropped those. It makes sense anyway.

The remaining commits are safe clean-ups and MinGW-only changes. The GUID macro changes were compile-tested on WDK by mcuee along with the rest.

The extra IRP debug printing can be omitted, but these events are relatively rare so it should not spam the debug log too much.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
The inconsistent indentation was giving compiler warnings.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
The preprocessor introduces a space between L and the string:
 L "abc"
and GCC will fail to recognize this as one token.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Many things have improved in MinGW over the years and less
special-casing is needed.

Due to many DDK header files referring to each other without
the ddk/ path prefix, we must tell make where to find the
include/ddk folder, e.g. (Ubuntu 20.04):

make host_prefix=i686-w64-mingw32 ddk=/usr/i686-w64-mingw32 driver
or
make host_prefix=x86_64-w64-mingw32 ddk=/usr/x86_64-w64-mingw32 driver
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Same includes for 32-bit as for 64-bit.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
@mcuee
Copy link
Owner

mcuee commented Feb 28, 2023

@dontech

Please review the changes when you are available. Thanks.

Take note we do not officially support MinGW for the driver building. Still please review the changes to see if the changes are good to have or not.

@dontech
Copy link
Collaborator

dontech commented Mar 1, 2023

I think it looks great! :-)
Thanks for the patches Tormod!

One question: What does the optimization do? Does it improve speed or anything else?

@tormodvolden
Copy link
Contributor Author

I guess no noticeable difference. But before, on every memory allocation the OS version was retrieved through a library function and the pool type determined. Now this is done only once when the driver is loaded, and the pool type is accessed through a simple variable.

@tormodvolden tormodvolden mentioned this pull request Sep 19, 2023
@dontech dontech merged commit 56bb429 into mcuee:master Sep 19, 2023
@dontech
Copy link
Collaborator

dontech commented Sep 20, 2023

Hi @mcuee

Take note we do not officially support MinGW for the driver building. Still please review the changes to see if the changes are good to have or not.

No, but building using other compilers (and testing) is always great as it reveals bugs and problems from a new angle.

Super work @tormodvolden

Thanks,

/pedro

@dontech
Copy link
Collaborator

dontech commented Sep 20, 2023

New snapshots: https://sourceforge.net/projects/libusb-win32/files/libusb-win32-snapshots/20230920/

@tormodvolden
Copy link
Contributor Author

No, but building using other compilers (and testing) is always great as it reveals bugs and problems from a new angle.

Indeed, GCC discovers a lot of things, mostly formal issues that might not influence the execution but sometimes they may. I reran compilation with GCC 12 now and there are many new warnings to look at.

Super work @tormodvolden

Thanks!

@tormodvolden
Copy link
Contributor Author

Note that the current binaries built with GCC (MinGW on latest Debian) don't load in Windows 10 ({Driver Entry Point Not Found} The %hs device driver could not locate the entry point %hs in driver %hs.)

However it should be possible (as demonstrated by projects like https://github.com/utoni/mingw-w64-dpp) so I hope to figure it out one day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants