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

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