[ros-dev] [ros-diffs] [fireball] 34232: Yuri Sidorov <jura at cp-lab.com> - Prevent boolean flags from being optimized away by compiler (due to PSEH usage) by making them volatile. See issue #3408 for more details.

Alex Ionescu ionucu at videotron.ca
Tue Jul 1 20:28:15 CEST 2008


What?

Why would the compiler optimize these away? This doesn't make any sense.

If something is happening to these flags, PSEH should be fixed -- not  
making every flag in the source base a volatile.

On 1-Jul-08, at 3:48 AM, fireball at svn.reactos.org wrote:

> Author: fireball
> Date: Tue Jul  1 05:48:50 2008
> New Revision: 34232
>
> URL: http://svn.reactos.org/svn/reactos?rev=34232&view=rev
> Log:
> Yuri Sidorov <jura at cp-lab.com>
> - Prevent boolean flags from being optimized away by compiler (due  
> to PSEH usage) by making them volatile.
> See issue #3408 for more details.
>
> Modified:
>    trunk/reactos/ntoskrnl/mm/virtual.c
>
> Modified: trunk/reactos/ntoskrnl/mm/virtual.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/virtual.c?rev=34232&r1=34231&r2=34232&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- trunk/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] Tue Jul  1  
> 05:48:50 2008
> @@ -70,7 +70,7 @@
>     PFN_NUMBER MdlBuffer[(sizeof(MDL) / sizeof(PFN_NUMBER)) +  
> MI_MAPPED_COPY_PAGES + 1];
>     PMDL Mdl = (PMDL)MdlBuffer;
>     ULONG TotalSize, CurrentSize, RemainingSize;
> -    BOOLEAN FailedInProbe = FALSE, FailedInMapping = FALSE,  
> FailedInMoving;
> +    volatile BOOLEAN FailedInProbe = FALSE, FailedInMapping =  
> FALSE, FailedInMoving;
>     BOOLEAN PagesLocked;
>     PVOID CurrentAddress = SourceAddress, CurrentTargetAddress =  
> TargetAddress;
>     PVOID MdlAddress;
> @@ -225,7 +225,7 @@
> {
>     UCHAR StackBuffer[MI_POOL_COPY_BYTES];
>     ULONG TotalSize, CurrentSize, RemainingSize;
> -    BOOLEAN FailedInProbe = FALSE, FailedInMoving, HavePoolAddress  
> = FALSE;
> +    volatile BOOLEAN FailedInProbe = FALSE, FailedInMoving,  
> HavePoolAddress = FALSE;
>     PVOID CurrentAddress = SourceAddress, CurrentTargetAddress =  
> TargetAddress;
>     PVOID PoolAddress;
>     KAPC_STATE ApcState;
>

Best regards,
Alex Ionescu



More information about the Ros-dev mailing list