Changeset 21633 for trunk/include


Ignore:
Timestamp:
Jun 2, 2011, 1:49:51 PM (14 years ago)
Author:
dmik
Message:

kernel32: Fixed crashes in code involving _try/except due to garbage in FS:[0]. See OpenJDK ticket #96 for details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/excpt.h

    r21624 r21633  
    6666    /* +56 */ int state;
    6767    /* +60 */ DWORD pPrevFrameWin32;
     68    /* +64 */ DWORD Win32FS;
    6869}
    6970__seh_EXCEPTION_FRAME;
     
    9697            /* install exception handler (both Win32 and OS/2 chains) */       \
    9798            __asm__ ("leal %0, %%ecx; "                                        \
     99                     "movl %%fs, %%eax; "                                      \
     100                     "andl $0x0000FFFF, %%eax; "                               \
     101                     "movl %%eax, 64(%%ecx); "                                 \
    98102                     "movl %%fs:0, %%eax; "                                    \
    99103                     "movl %%eax, 0(%%ecx); "                                  \
     
    133137        }                                                                      \
    134138        else if (__seh_frame.state == 3)                                       \
    135             /* remove exception handler */                                     \
    136             __asm__ ("push $1; "                                               \
    137                      "call _SetWin32TIB@4; "                                   \
    138                      ""                                                        \
    139                      "movl %%fs:0, %%ecx; "                                    \
     139            /* remove exception handler (note that for some reason SMP kernel  \
     140             * seems to garbage the Win32FS:[0] cell with the OS/2 exception   \
     141             * registration record, so use the original __seh_frame value) */  \
     142            __asm__ ("leal %0, %%ecx; "                                        \
     143                     ""                                                        \
     144                     "movl 64(%%ecx), %%eax; "                                 \
     145                     "movl %%eax, %%fs; "                                      \
     146                     ""                                                        \
    140147                     "movl 60(%%ecx), %%eax; "                                 \
    141148                     "movl %%eax, %%fs:0; "                                    \
     
    147154                     "movl %%eax, %%fs:0; "                                    \
    148155                     "popl %%fs; "                                             \
    149                      : :                                                       \
     156                     : : "m"(__seh_frame)                                      \
    150157                     : "%eax", "%ecx");                                        \
    151158        else /* __seh_frame.state == 2 -> execute except block */
     
    164171        }                                                                      \
    165172        else if (__seh_frame.state == 3)                                       \
    166             /* remove exception handler */                                     \
    167             __asm__ ("push $1; "                                               \
    168                      "call _SetWin32TIB@4; "                                   \
    169                      ""                                                        \
    170                      "movl %%fs:0, %%ecx; "                                    \
     173            /* remove exception handler (note that for some reason SMP kernel  \
     174             * seems to garbage the Win32FS:[0] cell with the OS/2 exception   \
     175             * registration record, so use the original __seh_frame value) */  \
     176            __asm__ ("leal %0, %%ecx; "                                        \
     177                     ""                                                        \
     178                     "movl 64(%%ecx), %%eax; "                                 \
     179                     "movl %%eax, %%fs; "                                      \
     180                     ""                                                        \
    171181                     "movl 60(%%ecx), %%eax; "                                 \
    172182                     "movl %%eax, %%fs:0; "                                    \
     
    178188                     "movl %%eax, %%fs:0; "                                    \
    179189                     "popl %%fs; "                                             \
    180                      : :                                                       \
     190                     : : "m"(__seh_frame)                                      \
    181191                     : "%eax", "%ecx");                                        \
    182192        else /* __seh_frame.state == 2 -> execute finally block */
Note: See TracChangeset for help on using the changeset viewer.