[edk2-devel] [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info

Ni, Ray ray.ni at intel.com
Fri Feb 10 12:34:14 UTC 2023


> +  ZeroMem (mSmmInitialized, sizeof (BOOLEAN) * mMaxNumberOfCpus);
> ...
> +  for (Index = 0; Index < mNumberOfCpus; Index++) {
> +    while (mSmmInitialized[Index] == FALSE) {
> +    }

Above code sets the BOOLEAN array to all FALSE.
Then polling on the array to be all TRUE.
We need to add "volatile" to the mSmmInitialized to tell
the compiler not to optimize the code but always check the
memory content.

A better way is to use compiler barrier but there is no
edk2 lib API to wrap it for different compilers
Let's just use "volatile" for now.

Thanks,
Ray


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100004): https://edk2.groups.io/g/devel/message/100004
Mute This Topic: https://groups.io/mt/96871374/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3943202/1813853/130120423/xyzzy [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list