This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch: signal handling


I've applied another signal handling patch for an unusual boundary
condition.

Andrew.


1999-07-07  Andrew Haley  <aph@cygnus.com>

        * include/i386-signal.h (MAKE_THROW_FRAME): Advance EIP by two
        bytes to make it point after the instruction where the trap
        occurred.
        (HANDLE_DIVIDE_OVERFLOW): Ditto.

Index: libjava/include/i386-signal.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/include/i386-signal.h,v
retrieving revision 1.4
diff -w -u -r1.4 i386-signal.h
--- i386-signal.h       1999/07/01 10:30:58     1.4
+++ i386-signal.h       1999/07/07 16:08:47
@@ -33,6 +33,11 @@
   register unsigned long _ebp = _regs->ebp;                            \
   register unsigned char *_eip = (unsigned char *)_regs->eip;          \
                                                                        \
+  /* Advance the program counter so that it is after the start of the  \
+     instruction:  the x86 exception handler expects                   \
+     the PC to point to the instruction after a call. */               \
+  _eip += 2;                                                           \
+                                                                       \
   asm volatile ("mov %0, (%%ebp); mov %1, 4(%%ebp)"                    \
                : : "r"(_ebp), "r"(_eip));                              \
 }                                                                      \
@@ -99,6 +104,14 @@
          _eip = (unsigned char *)_ebp[1];                              \
          _ebp = (unsigned long *)_ebp[0];                              \
        }                                                               \
+      else                                                             \
+       {                                                               \
+         /* Advance the program counter so that it is after the start  \
+            of the instruction: this is because the x86 exception      \
+            handler expects the PC to point to the instruction after a \
+            call. */                                                   \
+         _eip += 2;                                                    \
+       }                                                               \
     }                                                                  \
                                                                        \
   asm volatile ("mov %0, (%%ebp); mov %1, 4(%%ebp)"                    \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]