This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Tidy i386 signal handler
- From: Andrew Haley <aph at redhat dot com>
- To: guru <guru at computer-rave dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 7 Feb 2007 17:41:28 +0000
- Subject: Re: Tidy i386 signal handler
- References: <45CA0F53.3060900@computer-rave.com>
guru writes:
> actually this works better
> + _gregs[REG_EIP] += 2; with this the libgcj isn't libgij like
> the first one I tried
> + _gregs[REG_EIP] = (greg_t)_eip; not sure if this is right
> even thou it seems to be working
You need both of these lines. The code in question should look like
this:
-------------------------------------------------------------------------
/* Detect a signed division of Integer.MIN_VALUE. */ \
if (_eip[0] == 0xf7) \
{ \
bool _min_value_dividend = false; \
unsigned char _modrm = _eip[1]; \
\
if (((_modrm >> 3) & 7) == 7) /* Signed divide */ \
{ \
_min_value_dividend = \
_gregs[REG_EAX] == (greg_t)0x80000000UL; \
} \
\
if (_min_value_dividend) \
{ \
unsigned char _rm = _modrm & 7; \
_gregs[REG_EDX] = 0; /* the remainder is zero */ \
switch (_modrm >> 6) \
{ \
case 0: /* register indirect */ \
if (_rm == 5) /* 32-bit displacement */ \
_eip += 4; \
if (_rm == 4) /* A SIB byte follows the ModR/M byte */ \
_eip += 1; \
break; \
case 1: /* register indirect + 8-bit displacement */ \
_eip += 1; \
if (_rm == 4) /* A SIB byte follows the ModR/M byte */ \
_eip += 1; \
break; \
case 2: /* register indirect + 32-bit displacement */ \
_eip += 4; \
if (_rm == 4) /* A SIB byte follows the ModR/M byte */ \
_eip += 1; \
break; \
case 3: \
break; \
} \
_eip += 2; \
_gregs[REG_EIP] = (greg_t)_eip; \
return; \
} \
} \
} \
while (0)
-------------------------------------------------------------------------
If this doesn't work for you, please let us know what your system is,
and how you built gcc.
Andrew.