Changeset 21636 for trunk/include


Ignore:
Timestamp:
Jun 16, 2011, 3:44:07 PM (14 years ago)
Author:
dmik
Message:

SEH: Preserve EDX before try just in case if the compiler happens to store something important in it when optimizing (it should normally not though).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/excpt.h

    r21633 r21636  
    9191    __seh_frame.Pointers.ContextRecord = NULL;                                 \
    9292    __seh_frame.state = 0;                                                     \
    93     __asm__("\n0:\n"); /* pFilterCallback */                                   \
     93    /* install exception handler, both Win32 and OS/2 chains (note: EDX is in  \
     94     * clobber too since it may carry any value when we jump back to           \
     95     * pFilterCallback from the handler */                                     \
     96    __asm__ ("leal %0, %%ecx; "                                                \
     97             "movl %%fs, %%eax; "                                              \
     98             "andl $0x0000FFFF, %%eax; "                                       \
     99             "movl %%eax, 64(%%ecx); "                                         \
     100             "movl %%fs:0, %%eax; "                                            \
     101             "movl %%eax, 0(%%ecx); "                                          \
     102             "movl %%eax, 60(%%ecx); "                                         \
     103             "movl $0f, 8(%%ecx); "                                            \
     104                                                                               \
     105             "movl %%ebx, 24(%%ecx); "                                         \
     106             "movl %%esi, 28(%%ecx); "                                         \
     107             "movl %%edi, 32(%%ecx); "                                         \
     108             "movl %%ebp, 36(%%ecx); "                                         \
     109             "movl %%esp, 40(%%ecx); "                                         \
     110                                                                               \
     111             "pushl %%fs; "                                                    \
     112             "pushl $Dos32TIB; "                                               \
     113             "popl %%fs; "                                                     \
     114             "movl %%fs:0, %%eax; "                                            \
     115             "movl %%eax, 44(%%ecx); "                                         \
     116             "movl %%ecx, %%fs:0; "                                            \
     117             "popl %%fs; "                                                     \
     118                                                                               \
     119             "movl %%ecx, %%fs:0; "                                            \
     120                                                                               \
     121             "\n0: /* pFilterCallback */ \n"                                   \
     122                                                                               \
     123             : : "m" (__seh_frame)                                             \
     124             : "%eax", "%ecx", "%edx");                                        \
    94125    for (; __seh_frame.state <= 3; ++__seh_frame.state)                        \
    95126        if (__seh_frame.state == 0)                                            \
    96127        {                                                                      \
    97             /* install exception handler (both Win32 and OS/2 chains) */       \
    98             __asm__ ("leal %0, %%ecx; "                                        \
    99                      "movl %%fs, %%eax; "                                      \
    100                      "andl $0x0000FFFF, %%eax; "                               \
    101                      "movl %%eax, 64(%%ecx); "                                 \
    102                      "movl %%fs:0, %%eax; "                                    \
    103                      "movl %%eax, 0(%%ecx); "                                  \
    104                      "movl %%eax, 60(%%ecx); "                                 \
    105                      "movl $0b, 8(%%ecx); "                                    \
    106                      ""                                                        \
    107                      "movl %%ebx, 24(%%ecx); "                                 \
    108                      "movl %%esi, 28(%%ecx); "                                 \
    109                      "movl %%edi, 32(%%ecx); "                                 \
    110                      "movl %%ebp, 36(%%ecx); "                                 \
    111                      "movl %%esp, 40(%%ecx); "                                 \
    112                      ""                                                        \
    113                      "pushl %%fs; "                                            \
    114                      "pushl $Dos32TIB; "                                       \
    115                      "popl %%fs; "                                             \
    116                      "movl %%fs:0, %%eax; "                                    \
    117                      "movl %%eax, 44(%%ecx); "                                 \
    118                      "movl %%ecx, %%fs:0; "                                    \
    119                      "popl %%fs; "                                             \
    120                      ""                                                        \
    121                      "movl %%ecx, %%fs:0; "                                    \
    122                      : : "m" (__seh_frame)                                     \
    123                      : "%eax", "%ecx");                                        \
    124128            {
    125129
     
    141145             * registration record, so use the original __seh_frame value) */  \
    142146            __asm__ ("leal %0, %%ecx; "                                        \
    143                      ""                                                        \
     147                                                                               \
    144148                     "movl 64(%%ecx), %%eax; "                                 \
    145149                     "movl %%eax, %%fs; "                                      \
    146                      ""                                                        \
     150                                                                               \
    147151                     "movl 60(%%ecx), %%eax; "                                 \
    148152                     "movl %%eax, %%fs:0; "                                    \
    149                      ""                                                        \
     153                                                                               \
    150154                     "pushl %%fs; "                                            \
    151155                     "pushl $Dos32TIB; "                                       \
     
    175179             * registration record, so use the original __seh_frame value) */  \
    176180            __asm__ ("leal %0, %%ecx; "                                        \
    177                      ""                                                        \
     181                                                                               \
    178182                     "movl 64(%%ecx), %%eax; "                                 \
    179183                     "movl %%eax, %%fs; "                                      \
    180                      ""                                                        \
     184                                                                               \
    181185                     "movl 60(%%ecx), %%eax; "                                 \
    182186                     "movl %%eax, %%fs:0; "                                    \
    183                      ""                                                        \
     187                                                                               \
    184188                     "pushl %%fs; "                                            \
    185189                     "pushl $Dos32TIB; "                                       \
Note: See TracChangeset for help on using the changeset viewer.