home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / libcvers.zip / article_appendix / hcstack1.asm < prev    next >
Assembly Source File  |  2001-08-15  |  766b  |  41 lines

  1. ; $Id: hcstack1.asm,v 1.1.1.1 2001/08/14 23:34:32 root Exp $
  2. ;
  3. ; MetaWare stack routines - part 1
  4.  
  5. .386p
  6.  
  7. GRANULARITY    EQU    1000h        ; Stack checking granularity
  8.  
  9.         PUBLIC    __chkstk
  10.  
  11.         _TEXT    SEGMENT BYTE PUBLIC "CODE"
  12.         ASSUME    cs:_TEXT ;, ds:STACK32, es:STACK32
  13.  
  14. __chkstk:                
  15.                     
  16.         push    ecx        
  17.                     
  18.         mov    ecx, esp
  19.         add    ecx, 8
  20.  
  21. loc_18D6A:
  22.         cmp    eax, GRANULARITY
  23.         jb    loc_18D85
  24.         sub    ecx, GRANULARITY
  25.         or    dword ptr [ecx], 0
  26.         sub    eax, GRANULARITY
  27.         jmp    short loc_18D6A
  28. ; ───────────────────────────────────────────────────────────────────────────
  29.  
  30. loc_18D85:                ; CODE XREF: cseg01:00018D6Fj
  31.         sub    ecx, eax
  32.         or    dword ptr [ecx], 0
  33.         mov    eax, esp
  34.         mov    esp, ecx
  35.         mov    ecx, [eax]
  36.         mov    eax, [eax+4]
  37.         jmp    eax
  38.  
  39.         _TEXT    ENDS
  40.         END
  41.