diff options
Diffstat (limited to 'debian/htdig/htdig-3.2.0b6/db/sparc.gcc')
-rw-r--r-- | debian/htdig/htdig-3.2.0b6/db/sparc.gcc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/debian/htdig/htdig-3.2.0b6/db/sparc.gcc b/debian/htdig/htdig-3.2.0b6/db/sparc.gcc new file mode 100644 index 00000000..d1ff93e5 --- /dev/null +++ b/debian/htdig/htdig-3.2.0b6/db/sparc.gcc @@ -0,0 +1,27 @@ +/* + * @(#)sparc.gcc 11.4 (Sleepycat) 9/14/99 + * + * The ldstub instruction takes the location specified by its first argument + * (a register containing a memory address) and loads its contents into its + * second argument (a register) and atomically sets the contents the location + * specified by its first argument to a byte of 1s. (The value in the second + * argument is never read, but only overwritten.) + * + * The stbar is needed for v8, and is implemented as membar #sync on v9, + + so is functional there as well. For v7, stbar may generate an illegal + + instruction and we have no way to tell what we're running on. Some + + operating systems notice and skip this instruction in the fault handler. + * + * For gcc/sparc, 0 is clear, 1 is set. + */ +#define MUTEX_SET(tsl) ({ \ + register tsl_t *__l = (tsl); \ + register tsl_t __r; \ + __asm__ volatile \ + ("ldstub [%1],%0; stbar" \ + : "=r"( __r) : "r" (__l)); \ + !__r; \ +}) + +#define MUTEX_UNSET(tsl) (*(tsl) = 0) +#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) |