home *** CD-ROM | disk | FTP | other *** search
- *
- * Stack check routine.
- *
- * Called from C68 if the -stackcheck runtime option is selected.
- *
- * Export: .stackcheck
- *
- .text
- .globl .stackcheck
-
- .stackcheck:
- move.l sp,d0 ; get stack pointer value
- addq.l #8,d0 ; don't count our own stack usage
- move.l d0,__act_sp
- move.l __spbase,d1
- sub.l d0,d1
- add.l 4(sp),d1
- cmp.l __stksize,d1
- bpl err
- cmp.l __stackmax,d1
- bpl max
- *
- * The exit code. In the case of a dummy version of this
- * routine, this is all that is needed.
- *
- fin: move.l (sp)+,a0 ; get return address
- addq.l #4,sp ; tidy stack by removing parameters
- jmp (a0) ; return to calling point
- *
- * This routine can do whatever it likes. Typically this
- * would be to update statistics on stack useage.
- *
- max: move.l d1,__stackmax ; store new maximum
- jsr __stack_newmax ; call routine when new max reached
- bra fin
- *
- * We expect that routine we call here to abort the program !
- *
- err: move.l _abort,(sp) ; set abort routine as return address
- jmp __stack_error ; call error reporting routine
-