home *** CD-ROM | disk | FTP | other *** search
- ;[]-----------------------------------------------------------------[]
- ;| STACK.ASM -- stack overflow handler |
- ;| |
- ;| Turbo-C Run Time Library Version 3.0 |
- ;| |
- ;| Copyright (c) 1987,1988,1990 by Borland International Inc. |
- ;| All Rights Reserved. |
- ;[]-----------------------------------------------------------------[]
-
- ; calls to this routine are generated by the compiler when
- ; stack overflow is detected.
-
- INCLUDE RULES.ASI
-
- _TEXT SEGMENT BYTE PUBLIC 'CODE'
- ASSUME CS:_TEXT
-
- extrn __exit:near
-
- public F_OVERFLOW@
- public N_OVERFLOW@
- public OVERFLOW@
-
- message db 'Stack overflow!',13,10,'$'
- N_OVERFLOW@:
- F_OVERFLOW@:
- OVERFLOW@:
- push cs
- pop ds ; Print the message.
- mov dx,offset message
- mov ah,9
- int 21h
- ;
- ; We can't just terminate the program here because it might die owning
- ; interrupt vectors that startup took for the signals and divide by zero.
- ; The clean way out is through _exit() who puts all that stuff back.
- ;
- ; Hopefully the program hasn't gone so berserk so that _exit() restores
- ; invalid stuff. We have a real "lose-lose" situation here....
- ; In the case of a 'nice' stack overrun we're doing the right thing though.
- ;
- jmp __exit ; This is a one-way trip!
- _TEXT ENDS
- END
-
-