Ignore:
Timestamp:
Apr 21, 2001, 11:10:14 AM (24 years ago)
Author:
sandervl
Message:

rewrote EXC_CallHandler in assembly + workaround for high addresses in stdout WriteFile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/exceptutil.asm

    r5378 r5557  
    1 ; $Id: exceptutil.asm,v 1.14 2001-03-25 22:05:36 sandervl Exp $
     1; $Id: exceptutil.asm,v 1.15 2001-04-21 09:10:14 sandervl Exp $
    22
    33;/*
     
    1010.386p
    1111                NAME    except
     12
     13DATA32  segment dword use32 public 'DATA'
     14DATA32  ends
     15CONST32_RO      segment dword use32 public 'CONST'
     16CONST32_RO      ends
     17BSS32   segment dword use32 public 'BSS'
     18BSS32   ends
     19EH_CODE segment dword use32 public 'CODE'
     20EH_CODE ends
     21CTOR_DTOR1      segment dword use32 public 'DATA'
     22CTOR_DTOR1      ends
     23CTOR_DTOR2      segment dword use32 public 'DATA'
     24CTOR_DTOR2      ends
     25CTOR_DTOR3      segment dword use32 public 'DATA'
     26CTOR_DTOR3      ends
     27EH_DATA segment para use32 public 'DATA'
     28EH_DATA ends
     29_VFT    segment para use32 public 'DATA'
     30_VFT    ends
     31DGROUP  group BSS32, DATA32
     32        assume  cs:FLAT, ds:FLAT, ss:FLAT, es:FLAT
     33
     34DATA32  segment dword use32 public 'DATA'
     35
     36CONST32_RO      segment
     37        align 04h
     38@CBE8   db "KERNEL32: Calling handle"
     39db "r at %p code=%lx flags=%"
     40db "lx",0ah,0h
     41@CBE9   db "KERNEL32: Handler return"
     42db "ed %lx",0ah,0h
     43CONST32_RO      ends
     44DATA32  ends
    1245
    1346CODE32          SEGMENT DWORD PUBLIC USE32 'CODE'
     
    246279_AsmCallThreadHandler endp
    247280
     281; 281 static DWORD EXC_CallHandler( WINEXCEPTION_RECORD *record, WINEXCEPTION_FRAME *frame,
     282        EXTRN WriteLog:PROC
     283        EXTRN _GetThreadTEB@0:PROC
     284IFDEF DEBUG
     285        EXTRN DbgEnabled:DWORD
     286ENDIF
     287
     288EXC_push_frame__FP19_WINEXCEPTION_FRAME proc
     289        push    ebp
     290        mov     ebp,esp
     291        sub     esp,04h
     292        mov     [ebp+08h],eax;  frame
     293
     294; 132     TEB *teb = GetThreadTEB();
     295        call    _GetThreadTEB@0
     296        mov     [ebp-04h],eax;  teb
     297
     298; 133     frame->Prev = (PWINEXCEPTION_FRAME)teb->except;
     299        mov     ecx,[ebp-04h];  teb
     300        mov     ecx,[ecx]
     301        mov     eax,[ebp+08h];  frame
     302        mov     [eax],ecx
     303
     304; 134     teb->except = frame;
     305        mov     eax,[ebp-04h];  teb
     306        mov     ecx,[ebp+08h];  frame
     307        mov     [eax],ecx
     308
     309; 135     return frame->Prev;
     310        mov     eax,[ebp+08h];  frame
     311        mov     eax,[eax]
     312        leave   
     313        ret     
     314EXC_push_frame__FP19_WINEXCEPTION_FRAME endp
     315
     316; 138 static inline WINEXCEPTION_FRAME * EXC_pop_frame( WINEXCEPTION_FRAME *frame )
     317        align 04h
     318
     319EXC_pop_frame__FP19_WINEXCEPTION_FRAME  proc
     320        push    ebp
     321        mov     ebp,esp
     322        sub     esp,04h
     323        mov     [ebp+08h],eax;  frame
     324
     325; 141     TEB *teb = GetThreadTEB();
     326        call    _GetThreadTEB@0
     327        mov     [ebp-04h],eax;  teb
     328
     329; 142     teb->except = frame->Prev;
     330        mov     ecx,[ebp+08h];  frame
     331        mov     ecx,[ecx]
     332        mov     eax,[ebp-04h];  teb
     333        mov     [eax],ecx
     334
     335; 143     return frame->Prev;
     336        mov     eax,[ebp+08h];  frame
     337        mov     eax,[eax]
     338        leave   
     339        ret     
     340EXC_pop_frame__FP19_WINEXCEPTION_FRAME  endp
     341
     342        align 04h
     343        PUBLIC EXC_CallHandler__FP20_WINEXCEPTION_RECORDP19_WINEXCEPTION_FRAMEP10WINCONTEXTPP19_WINEXCEPTION_FRAMEPFP20_WINEXCEPTION_RECORDP19_WINEXCEPTION_FRAMEP10WINCONTEXTPv_UlT5
     344
     345EXC_CallHandler__FP20_WINEXCEPTION_RECORDP19_WINEXCEPTION_FRAMEP10WINCONTEXTPP19_WINEXCEPTION_FRAMEPFP20_WINEXCEPTION_RECORDP19_WINEXCEPTION_FRAMEP10WINCONTEXTPv_UlT5  proc
     346        push    ebp
     347        mov     ebp,esp
     348        sub     esp,010h
     349        sub     esp,04h
     350        mov     [ebp+08h],eax;  record
     351        mov     [ebp+0ch],edx;  frame
     352        mov     [ebp+010h],ecx; context
     353
     354; 296     newframe.frame.Handler = nested_handler;
     355        mov     eax,[ebp+01ch]; nested_handler
     356        mov     [ebp-08h],eax;  newframe
     357
     358; 297     newframe.prevFrame     = frame;
     359        mov     eax,[ebp+0ch];  frame
     360        mov     [ebp-04h],eax;  newframe
     361
     362; 298     EXC_push_frame( &newframe.frame );
     363        lea     eax,[ebp-0ch];  newframe
     364        call    EXC_push_frame__FP19_WINEXCEPTION_FRAME
     365
     366; 299     dprintf(("KERNEL32: Calling handler at %p code=%lx flags=%lx\n",
     367IFDEF DEBUG
     368        cmp     word ptr  DbgEnabled+020h,01h
     369        jne     @BLBL20
     370        mov     eax,[ebp+08h];  record
     371        push    dword ptr [eax+04h]
     372        mov     eax,[ebp+08h];  record
     373        push    dword ptr [eax]
     374        push    dword ptr [ebp+018h];   handler
     375        push    offset FLAT:@CBE8
     376        call    WriteLog
     377        add     esp,010h
     378ENDIF
     379
     380; 300            handler, record->ExceptionCode, record->ExceptionFlags));
     381@BLBL20:
     382
     383; 301     ret = handler( record, frame, context, dispatcher );
     384        push    dword ptr [ebp+014h];   dispatcher
     385        push    dword ptr [ebp+010h];   context
     386        push    dword ptr [ebp+0ch];    frame
     387        push    dword ptr [ebp+08h];    record
     388        call    dword ptr [ebp+018h];   handler
     389        mov     [ebp-010h],eax; ret
     390
     391IFDEF DEBUG
     392; 302     dprintf(("KERNEL32: Handler returned %lx\n", ret));
     393        cmp     word ptr  DbgEnabled+020h,01h
     394        jne     @BLBL21
     395        push    dword ptr [ebp-010h];   ret
     396        push    offset FLAT:@CBE9
     397        call    WriteLog
     398        add     esp,08h
     399@BLBL21:
     400ENDIF
     401
     402; 303     EXC_pop_frame( &newframe.frame );
     403        lea     eax,[ebp-0ch];  newframe
     404        call    EXC_pop_frame__FP19_WINEXCEPTION_FRAME
     405
     406; 304     return ret;
     407        mov     eax,[ebp-010h]; ret
     408        add     esp,04h
     409        leave   
     410        ret     
     411EXC_CallHandler__FP20_WINEXCEPTION_RECORDP19_WINEXCEPTION_FRAMEP10WINCONTEXTPP19_WINEXCEPTION_FRAMEPFP20_WINEXCEPTION_RECORDP19_WINEXCEPTION_FRAMEP10WINCONTEXTPv_UlT5  endp
     412
    248413CODE32          ENDS
    249414
Note: See TracChangeset for help on using the changeset viewer.