在 2021/1/14 上午5:14, Martin Storsjö 写道:
>
> --- a/mingw-w64-headers/crt/_mingw.h.in
> +++ b/mingw-w64-headers/crt/_mingw.h.in
> (...)
> + __asm__ __volatile__("unimplemented");
I suggest an `#error` here so the error could be caught earlier.
> --- a/mingw-w64-headers/include/winnt.h
> +++ b/mingw-w64-headers/include/winnt.h
> @@ -1846,6 +1846,9 @@ extern "C" {
> #define InterlockedCompareExchangePointerAcquire
> _InterlockedCompareExchangePointer
> #define InterlockedCompareExchangePointerRelease
> _InterlockedCompareExchangePointer
>
> +#define YieldProcessor() __asm__ __volatile__("dmb ishst\n\tyield")
> +#define MemoryBarrier() __asm__ __volatile__("dmb")
> +
The asm statement in `MemoryBarrier()` has no constraints, so the compiler is
free to reorder
loads/stores with it, which nullifies the effect of a barrier.
In order to prevent this, it is necessary to clobber memory explicitly like
this:
__asm__ __volatile__ ("dmb":::"memory")
> #ifdef __cplusplus
> }
> #endif
> @@ -2055,6 +2058,9 @@ extern "C" {
> #define InterlockedCompareExchangePointerAcquire
> _InterlockedCompareExchangePointer
> #define InterlockedCompareExchangePointerRelease
> _InterlockedCompareExchangePointer
>
> +#define YieldProcessor() __asm__ __volatile__("dmb ishst\n\tyield")
> +#define MemoryBarrier() __asm__ __volatile__("dmb sy")
Ditto.
--
Best regards,
LH_Mouse
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
