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

MdePkg/BaseMemoryLib: Prevent VS2022 (17.5) linker failure #290

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions MdePkg/Library/BaseMemoryLib/MemLibGeneric.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ InternalMemSetMem16 (
)
{
for ( ; Length != 0; Length--) {
((UINT16 *)Buffer)[Length - 1] = Value;
// MU_CHANGE use a pointer to volatile data to prevent Visual Studio 17.5 (VS2022)
// from replacing the assignment with a `memset()` intrinsic
((volatile UINT16 *)Buffer)[Length - 1] = Value;
}

return Buffer;
Expand All @@ -57,7 +59,9 @@ InternalMemSetMem32 (
)
{
for ( ; Length != 0; Length--) {
((UINT32 *)Buffer)[Length - 1] = Value;
// MU_CHANGE use a pointer to volatile data to prevent Visual Studio 17.5 (VS2022)
// from replacing the assignment with a `memset()` intrinsic
((volatile UINT32 *)Buffer)[Length - 1] = Value;
}

return Buffer;
Expand All @@ -82,7 +86,9 @@ InternalMemSetMem64 (
)
{
for ( ; Length != 0; Length--) {
((UINT64 *)Buffer)[Length - 1] = Value;
// MU_CHANGE use a pointer to volatile data to prevent Visual Studio 17.5 (VS2022)
// from replacing the assignment with a `memset()` intrinsic
((volatile UINT64 *)Buffer)[Length - 1] = Value;
}

return Buffer;
Expand Down