--- system.h-rc 2003-11-30 00:21:55.000000000 +0100 +++ system.h 2003-11-30 00:26:17.000000000 +0100 @@ -138,12 +138,36 @@ #define set_wmb(var, value) do { var = value; wmb(); } while (0) -/* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. */ +/* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. + * + * Note that PA-RISC has to use `1' to mean unlocked and `0' to mean locked + * since it only has load-and-zero. Moreover, at least on some PA processors, + * the semaphore address has to be 16-byte aligned. + */ +#ifdef CONFIG_PA20 +/* +> From: "Jim Hull" +> Delivery-date: Wed, 29 Jan 2003 13:57:05 -0500 +> I've attached a summary of the change, but basically, for PA 2.0, as +> long as the ",CO" (coherent operation) completer is specified, then the +> 16-byte alignment requirement for ldcw and ldcd is relaxed, and instead +> they only require "natural" alignment (4-byte for ldcw, 8-byte for +> ldcd). +*/ + +#define __ldcw(a) ({ \ + unsigned __ret; \ + __asm__ __volatile__("ldcw,co 0(%1),%0" : "=r" (__ret) : "r" (a)); \ + __ret; \ +}) +#else #define __ldcw(a) ({ \ unsigned __ret; \ __asm__ __volatile__("ldcw 0(%1),%0" : "=r" (__ret) : "r" (a)); \ __ret; \ }) +#endif + /* Because kmalloc only guarantees 8-byte alignment for kmalloc'd data, and GCC only guarantees 8-byte alignment for stack locals, we can't