8201509: Zero: S390 31bit atomic_copy64 inline assembler is wrong
authorchrisphi
Wed, 25 Apr 2018 12:21:29 -0400
changeset 49914 f82a7db36d30
parent 49913 61dbbdd6b857
child 49915 938478a66ad7
8201509: Zero: S390 31bit atomic_copy64 inline assembler is wrong Summary: The inline assembler for the S390 (S390 and not _LP64) has src and dst reversed thereby corrupting data Reviewed-by: shade Contributed-by: Martin Balao <mbalao@redhat.com>
src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp
--- a/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp	Fri Apr 27 08:45:11 2018 -0400
+++ b/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp	Wed Apr 25 12:21:29 2018 -0400
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2010 Red Hat, Inc.
+ * Copyright 2007, 2008, 2010, 2018, Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,10 +50,10 @@
                   : "Q"(*(volatile long*)src));
 #elif defined(S390) && !defined(_LP64)
     double tmp;
-    asm volatile ("ld  %0, 0(%1)\n"
-                  "std %0, 0(%2)\n"
-                  : "=r"(tmp)
-                  : "a"(src), "a"(dst));
+    asm volatile ("ld  %0, %2\n"
+                  "std %0, %1\n"
+                  : "=&f"(tmp), "=Q"(*(volatile double*)dst)
+                  : "Q"(*(volatile double*)src));
 #else
     *(jlong *) dst = *(const jlong *) src;
 #endif