Dave Bristor kirjoitti:
> Hi Petteri,
> 
> This looks like an issue for the [EMAIL PROTECTED] list.  Could
> you try posting there?
> 
> Thanks,
>     Dave
>

Nope this is a bug in java_md.c

I have no idea why that code is duplicated in those two files. I guess
the hotspot version is never run during the build because fixing the
j2se one was enough to make the issue go away. So far I haven't had any
problems running junit tests with openjdk compile using
-fomit-frame-pointer but we shall see. The patch was built with input
from Ian Rogers and Diego Pettenò.

Regards,
Petteri
Index: j2se/src/solaris/bin/java_md.c
===================================================================
--- j2se/src/solaris/bin/java_md.c	(revision 237)
+++ j2se/src/solaris/bin/java_md.c	(working copy)
@@ -1119,23 +1119,28 @@
   uint32_t value_of_ebx = 0;
   uint32_t value_of_ecx = 0;
   uint32_t value_of_edx = 0;
+  /* ebx handling is needed for PIC code (GCC can't handle it) */
+  uint32_t ebx_tmp = 0;
   __asm__ volatile (/* Instructions */
-                        /* ebx is callee-save, so push it */
-                    "   pushl   %%ebx      \n"
-                    "	movl	%4, %%eax  \n"
+                      /* Save ebx */
+                    "	movl	%%ebx, %4  \n"
+                      /* Set the value to call cpuid with */
+                    "	movl	%5, %%eax  \n"
+                      /* Call cpuid and get values */
                     "	cpuid              \n"
                     "	movl    %%eax, %0  \n"
                     "	movl    %%ebx, %1  \n"
                     "	movl    %%ecx, %2  \n"
                     "	movl    %%edx, %3  \n"
-                        /* restore ebx */
-                    "   popl    %%ebx      \n"
+                      /* Restore ebx */
+                    "	movl    %4, %%ebx  \n"
 
                     : /* Outputs */
                     "=m" (value_of_eax),
                     "=m" (value_of_ebx),
                     "=m" (value_of_ecx),
-                    "=m" (value_of_edx)
+                    "=m" (value_of_edx),
+                    "=m" (ebx_tmp)
                     : /* Inputs */
                     "m" (arg)
                     : /* Clobbers */
Index: hotspot/src/os/linux/launcher/java_md.c
===================================================================
--- hotspot/src/os/linux/launcher/java_md.c	(revision 237)
+++ hotspot/src/os/linux/launcher/java_md.c	(working copy)
@@ -1256,24 +1256,28 @@
   uint32_t value_of_ebx = 0;
   uint32_t value_of_ecx = 0;
   uint32_t value_of_edx = 0;
+  /* ebx handling is needed for PIC code (GCC can't handle it) */
+  uint32_t ebx_tmp = 0;
   __asm__ volatile (/* Instructions */
-                        /* ebx is callee-save, so push it */
-                        /* even though it's in the clobbers section */
-                    "   pushl   %%ebx      \n"
-                    "	movl	%4, %%eax  \n"
+                      /* Save ebx */
+                    "	movl    %%ebx, %4  \n"
+                     /* Set the value to call cpuid with */
+                    "	movl    %5, %%eax  \n"
+                      /* Call cpuid and get values */	  
                     "	cpuid              \n"
                     "	movl    %%eax, %0  \n"
                     "	movl    %%ebx, %1  \n"
                     "	movl    %%ecx, %2  \n"
                     "	movl    %%edx, %3  \n"
                         /* restore ebx */
-                    "   popl    %%ebx      \n"
+                    "	movl    %4, %%ebx  \n"
 
                     : /* Outputs */
                     "=m" (value_of_eax),
                     "=m" (value_of_ebx),
                     "=m" (value_of_ecx),
-                    "=m" (value_of_edx)
+                    "=m" (value_of_edx),
+                    "=m" (ebx_tmp)
                     : /* Inputs */
                     "m" (arg)
                     : /* Clobbers */

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to