public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: PR libjava/53973: Check and and skip 67h address size prefix for x32
       [not found] <20120716210441.GA5620@intel.com>
@ 2012-07-18 16:30 ` H.J. Lu
  2012-07-18 17:35   ` Andrew Haley
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2012-07-18 16:30 UTC (permalink / raw)
  To: Uros Bizjak, java-patches; +Cc: gcc-patches

On Mon, Jul 16, 2012 at 02:04:41PM -0700, H.J. Lu wrote:
> Hi,
> 
> Since x32 may generate 64-bit integer divide like
> 
> 67 48 f7 bd a0 fe ff ff         idivq  -0x160(%ebp)
> 
> we need to check and skip 67h address size for x32.  OK for trunk if
> there are no regressions on Linux/x86-64?
> 
> Thanks.
> 
> H.J.
> ----
> 2012-07-16  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	PR libjava/53973
> 	* include/x86_64-signal.h (CHECK_67H_PREFIX): New.
> 	(HANDLE_DIVIDE_OVERFLOW): Check and and skip 67h address size
> 	prefix if CHECK_67H_PREFIX is 1.
> 

Here is the patch with the updated ChangeLog entry.  OK for trunk?

Thanks.

H.J.
---
2012-07-16  H.J. Lu  <hongjiu.lu@intel.com>

	PR libjava/53973
	* include/x86_64-signal.h (CHECK_67H_PREFIX): New.
	(HANDLE_DIVIDE_OVERFLOW): Check and and skip 67h address size
	prefix if CHECK_67H_PREFIX is 1.  Use ULL suffix for 64-bit
	integer.

diff --git a/libjava/include/x86_64-signal.h b/libjava/include/x86_64-signal.h
index 4bd8a36..84907c3 100644
--- a/libjava/include/x86_64-signal.h
+++ b/libjava/include/x86_64-signal.h
@@ -21,6 +21,12 @@ details.  */
 #define HANDLE_SEGV 1
 #define HANDLE_FPE 1
 
+#ifdef __ILP32__
+# define CHECK_67H_PREFIX 1
+#else
+# define CHECK_67H_PREFIX 0
+#endif
+
 #define SIGNAL_HANDLER(_name)					\
 static void _Jv_##_name (int, siginfo_t *,			\
 			 void *_p __attribute__ ((__unused__)))
@@ -47,6 +53,10 @@ do									\
 									\
   bool _is_64_bit = false;						\
 									\
+  /* Check and skip 67h address size prefix if needed.  */		\
+  if (CHECK_67H_PREFIX && _rip[0] == 0x67)				\
+    _rip++;								\
+									\
   if ((_rip[0] & 0xf0) == 0x40)  /* REX byte present.  */		\
     {									\
       unsigned char _rex = _rip[0] & 0x0f;				\
@@ -64,10 +74,10 @@ do									\
 	{								\
 	  if (_is_64_bit)						\
 	    _min_value_dividend =					\
-	      _gregs[REG_RAX] == (greg_t)0x8000000000000000UL;		\
+	      _gregs[REG_RAX] == (greg_t)0x8000000000000000ULL;		\
 	  else								\
 	    _min_value_dividend =					\
-	      (_gregs[REG_RAX] & 0xffffffff) == (greg_t)0x80000000UL;	\
+	      (_gregs[REG_RAX] & 0xffffffff) == (greg_t)0x80000000ULL;	\
 	}								\
 									\
       if (_min_value_dividend)						\

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PR libjava/53973: Check and and skip 67h address size prefix for x32
  2012-07-18 16:30 ` PR libjava/53973: Check and and skip 67h address size prefix for x32 H.J. Lu
@ 2012-07-18 17:35   ` Andrew Haley
  2012-07-18 17:47     ` Uros Bizjak
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Haley @ 2012-07-18 17:35 UTC (permalink / raw)
  To: H.J. Lu; +Cc: H.J. Lu, Uros Bizjak, java-patches, gcc-patches

On 07/18/2012 05:30 PM, H.J. Lu wrote:
> 2012-07-16  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	PR libjava/53973
> 	* include/x86_64-signal.h (CHECK_67H_PREFIX): New.
> 	(HANDLE_DIVIDE_OVERFLOW): Check and and skip 67h address size
> 	prefix if CHECK_67H_PREFIX is 1.  Use ULL suffix for 64-bit
> 	integer.

OK.  I would have thought it was OK to skip the 67h address size
whether or not it was x32, though.

Andrew.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PR libjava/53973: Check and and skip 67h address size prefix for x32
  2012-07-18 17:35   ` Andrew Haley
@ 2012-07-18 17:47     ` Uros Bizjak
  2012-07-18 17:58       ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Uros Bizjak @ 2012-07-18 17:47 UTC (permalink / raw)
  To: Andrew Haley; +Cc: H.J. Lu, H.J. Lu, java-patches, gcc-patches

On Wed, Jul 18, 2012 at 7:34 PM, Andrew Haley <aph@redhat.com> wrote:
> On 07/18/2012 05:30 PM, H.J. Lu wrote:
>> 2012-07-16  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>       PR libjava/53973
>>       * include/x86_64-signal.h (CHECK_67H_PREFIX): New.
>>       (HANDLE_DIVIDE_OVERFLOW): Check and and skip 67h address size
>>       prefix if CHECK_67H_PREFIX is 1.  Use ULL suffix for 64-bit
>>       integer.
>
> OK.  I would have thought it was OK to skip the 67h address size
> whether or not it was x32, though.

You can just skip the prefix unconditionally.

Uros.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PR libjava/53973: Check and and skip 67h address size prefix for x32
  2012-07-18 17:47     ` Uros Bizjak
@ 2012-07-18 17:58       ` H.J. Lu
  0 siblings, 0 replies; 4+ messages in thread
From: H.J. Lu @ 2012-07-18 17:58 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: Andrew Haley, H.J. Lu, java-patches, gcc-patches

On Wed, Jul 18, 2012 at 10:47 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Wed, Jul 18, 2012 at 7:34 PM, Andrew Haley <aph@redhat.com> wrote:
>> On 07/18/2012 05:30 PM, H.J. Lu wrote:
>>> 2012-07-16  H.J. Lu  <hongjiu.lu@intel.com>
>>>
>>>       PR libjava/53973
>>>       * include/x86_64-signal.h (CHECK_67H_PREFIX): New.
>>>       (HANDLE_DIVIDE_OVERFLOW): Check and and skip 67h address size
>>>       prefix if CHECK_67H_PREFIX is 1.  Use ULL suffix for 64-bit
>>>       integer.
>>
>> OK.  I would have thought it was OK to skip the 67h address size
>> whether or not it was x32, though.
>
> You can just skip the prefix unconditionally.
>
> Uros.

I will check in this patch shortly.

Thanks.

-- 
H.J.
---
2012-07-18  H.J. Lu  <hongjiu.lu@intel.com>

	PR libjava/53973
	* include/x86_64-signal.h (CHECK_67H_PREFIX): Removed.
	(HANDLE_DIVIDE_OVERFLOW): Check and and skip 67h address size
	prefix unconditionally.

diff --git a/libjava/include/x86_64-signal.h b/libjava/include/x86_64-signal.h
index 84907c3..aa5a903 100644
--- a/libjava/include/x86_64-signal.h
+++ b/libjava/include/x86_64-signal.h
@@ -21,12 +21,6 @@ details.  */
 #define HANDLE_SEGV 1
 #define HANDLE_FPE 1

-#ifdef __ILP32__
-# define CHECK_67H_PREFIX 1
-#else
-# define CHECK_67H_PREFIX 0
-#endif
-
 #define SIGNAL_HANDLER(_name)					\
 static void _Jv_##_name (int, siginfo_t *,			\
 			 void *_p __attribute__ ((__unused__)))
@@ -53,8 +47,8 @@ do								\
 									\
   bool _is_64_bit = false;						\
 									\
-  /* Check and skip 67h address size prefix if needed.  */		\
-  if (CHECK_67H_PREFIX && _rip[0] == 0x67)				\
+  /* Check and skip 67h address size prefix.  */			\
+  if (_rip[0] == 0x67)							\
     _rip++;								\
 									\

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-18 17:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20120716210441.GA5620@intel.com>
2012-07-18 16:30 ` PR libjava/53973: Check and and skip 67h address size prefix for x32 H.J. Lu
2012-07-18 17:35   ` Andrew Haley
2012-07-18 17:47     ` Uros Bizjak
2012-07-18 17:58       ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).