8226525: HotSpot compile-time error for x86-32
authoraph
Tue, 02 Jul 2019 16:54:52 +0100
changeset 55663 63d13c01f2b8
parent 55565 51b28beb53fd
child 55664 ceafb2debc68
8226525: HotSpot compile-time error for x86-32 Reviewed-by: shade
src/hotspot/os_cpu/linux_x86/orderAccess_linux_x86.hpp
--- a/src/hotspot/os_cpu/linux_x86/orderAccess_linux_x86.hpp	Tue Jul 02 17:46:38 2019 +0200
+++ b/src/hotspot/os_cpu/linux_x86/orderAccess_linux_x86.hpp	Tue Jul 02 16:54:52 2019 +0100
@@ -57,7 +57,13 @@
 
 inline void OrderAccess::cross_modify_fence() {
   int idx = 0;
+#ifdef AMD64
   __asm__ volatile ("cpuid " : "+a" (idx) : : "ebx", "ecx", "edx", "memory");
+#else
+  // On some x86 systems EBX is a reserved register that cannot be
+  // clobbered, so we must protect it around the CPUID.
+  __asm__ volatile ("xchg %%esi, %%ebx; cpuid; xchg %%esi, %%ebx " : "+a" (idx) : : "esi", "ecx", "edx", "memory");
+#endif
 }
 
 template<>