X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/misc/blobdiff_plain/0f581568f662310ff4a32e3d43016fff268d10bd..300a556d392d9bd6ac5b98c1b4b2d0a052459053:/fence.h diff --git a/fence.h b/fence.h new file mode 100644 index 0000000..a78b9f7 --- /dev/null +++ b/fence.h @@ -0,0 +1,59 @@ +/* -*-c-*- + * + * Bodge to control memory access ordering + * + * (c) 2016 Mark Wooding + */ + +/*----- Licensing notice --------------------------------------------------* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef FENCE_H +#define FENCE_H + +#ifdef __cplusplus + extern "C" { +#endif + +/*----- Header files ------------------------------------------------------*/ + +#include + +/*----- Functions provided ------------------------------------------------*/ + +/* --- @compiler_fence@ --- * + * + * Arguments: some pointers to things + * + * Returns: Nothing. + * + * Use: Actually doesn't do anything at all, but in a separate + * translation unit so that the compiler can't tell that. So it + * won't be able to move memory accesses to the addressed + * objects across the call. + */ + +#define FENCE_END ((void *)0) +EXECL_LIKE(0) void compiler_fence(void */*p*/, ...); + +/*----- That's all, folks -------------------------------------------------*/ + +#ifdef __cplusplus + } +#endif + +#endif