RFR: 8185723: Zero: segfaults on Power PC 32-bit
John Paul Adrian Glaubitz
glaubitz at physik.fu-berlin.de
Thu Aug 3 12:19:30 UTC 2017
On 08/03/2017 12:06 PM, Andrew Haley wrote:
> On 03/08/17 10:32, John Paul Adrian Glaubitz wrote:
>> I think either __arch_compare_and_exchange_val_64_acq() or
>> atomic_exchange_acq() from [1] should help.
>
> The first one is what you want, assuming that you're happy to
> write to an operand you're supposed to only read.
I'm trying this now:
--- jdk9-fe8466adaef8.orig/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp 2017-07-14 06:32:55.000000000 +0200
+++ jdk9-fe8466adaef8/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.hpp 2017-08-03 13:59:40.257640677 +0200
@@ -48,6 +48,22 @@
"std %0, 0(%2)\n"
: "=r"(tmp)
: "a"(src), "a"(dst));
+#elif defined(M68K)
+# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
+ ({ __typeof (*(mem)) __ret; \
+ __typeof (mem) __memp = (mem); \
+ __asm __volatile ("cas2%.l %0:%R0,%1:%R1,(%2):(%3)" \
+ : "=d" (__ret) \
+ : "d" ((__typeof (*(mem))) (newval)), "r" (__memp), \
+ "r" ((char *) __memp + 4), "0" (oldval) \
+ : "memory"); \
+ __ret; })
+
+ jlong tmp;
+ do {
+ tmp = *(jlong *)src;
+ } while(!__arch_compare_and_exchange_val_64_acq(src, tmp, tmp));
+ while(__arch_compare_and_exchange_val_64_acq(dst, *(jlong*)dst, tmp));
#else
*(jlong *) dst = *(jlong *) src;
#endif
I have no idea whether it's correct, but I'll find out.
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - glaubitz at debian.org
`. `' Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
More information about the hotspot-dev
mailing list