diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 38ac9504d..d0667f7c3 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,9 @@ +2012-08-06 Earnie Boyd + + * mingwex/membarrier.c: New file. + * mingwex/Makefile.in (DISTFILES): Add membarrier.c. + (REPLACE_OBJS): Add membarrier.o. + 2012-08-02 Ivan Maidanski * include/process.h (_wexec*, _wspawn*): Declare. diff --git a/winsup/mingw/mingwex/Makefile.in b/winsup/mingw/mingwex/Makefile.in index 59ebac7e3..afe32e5be 100644 --- a/winsup/mingw/mingwex/Makefile.in +++ b/winsup/mingw/mingwex/Makefile.in @@ -40,7 +40,7 @@ DISTFILES = \ fegetexceptflag.c fegetround.c feholdexcept.c feraiseexcept.c \ fesetenv.c fesetexceptflag.c fesetround.c fetestexcept.c \ feupdateenv.c ftruncate.c fwide.c getopt.c imaxabs.c imaxdiv.c \ - lltoa.c lltow.c mbsinit.c mingw-aligned-malloc.c \ + lltoa.c lltow.c mbsinit.c membarrier.c mingw-aligned-malloc.c \ mingw-fseek.c sitest.c strtoimax.c strtoumax.c \ testwmem.c tst-aligned-malloc.c ulltoa.c ulltow.c wcstof.c \ wcstoimax.c wcstold.c wcstoumax.c wctrans.c wctype.c \ @@ -201,7 +201,7 @@ POSIX_OBJS = \ dirent.o wdirent.o getopt.o ftruncate.o gettimeofday.o usleep.o \ basename.o dirname.o tsearch.o twalk.o tdelete.o tfind.o REPLACE_OBJS = \ - mingw-aligned-malloc.o mingw-fseek.o + membarrier.o mingw-aligned-malloc.o mingw-fseek.o COMPLEX_OBJS = \ cabs.o cabsf.o cabsl.o cacos.o cacosf.o cacosl.o cacosh.o \ cacoshf.o cacoshl.o carg.o cargf.o cargl.o casin.o casinf.o \ diff --git a/winsup/mingw/mingwex/membarrier.c b/winsup/mingw/mingwex/membarrier.c new file mode 100644 index 000000000..b8da9f7de --- /dev/null +++ b/winsup/mingw/mingwex/membarrier.c @@ -0,0 +1,19 @@ +/** + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +void __mingworg_MemoryBarrier(void); +void __mingworg_MemoryBarrier(void) +{ + long Barrier = 0; + __asm__ __volatile__("xchgl %%eax,%0 " + :"=r" (Barrier)); +} +