home *** CD-ROM | disk | FTP | other *** search
- ****************************************************************************
- *
- * $RCSfile: STACKCHK.asm $
- * Description: Runtime support for the Oberon-A compiler
- *
- * Created by: fjc (Frank Copeland)
- * $Revision: 1.2 $
- * $Author: fjc $
- * $Date: 1994/08/08 16:31:56 $
- *
- * Copyright © 1994, Frank Copeland.
- * This file is part of the Oberon-A Library.
- * See Oberon-A.doc for conditions of use and distribution.
- *
- * Log entries are at the end of the file.
- *
- ****************************************************************************
- *
- * This file contains the MC68000 source code for part of the runtime
- * support library of the Oberon-A compiler. It contains the code to
- * implement stack checking on procedure entry.
- *
- * Other parts of the runtime system may be found in the other files in
- * this directory. The object files resulting from assembling these
- * files are concatenated to create OberonSys.lib.
- *
- * This code is by definition *not* re-entrant and is not suitable for
- * creating shared-code libraries.
- *
- ****************************************************************************
-
- ;---------------------------------------------------------------------
- ; Program unit hunk name
- ; !! DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING !!
-
- TTL OberonSys
-
- ;---------------------------------------------------------------------
- ; Imports
-
- INCLUDE "OberonSys.i"
-
- ABSEXECBASE EQU 4
- ThisTask EQU 276
- tc_SPLower EQU 58
-
- ;---------------------------------------------------------------------
- ; PROCEDURE OberonSys_STACKCHK
- ; ( size {D0} : LONGINT )
- ;
- ; A call to this procedure is generated by the compiler when it
- ; generates the code for entry to a procedure.
- ;
- ; The procedure assumes that 1500 bytes must remain free on the stack,
- ; to allow for the parameters of procedures called in the body of the
- ; procedure, and the extra stack required by dos.library functions.
- ; This limit is the same as the constant OCG.ParLimit. If that
- ; constant changes, this code must be modified and re-assembled.
- ;
- ; OberonSys_STACKCHK trashes the A0 register.
- ;---------------------------------------------------------------------
-
- SECTION OberonSys,CODE
-
- XDEF OberonSys_STACKCHK
-
- OberonSys_STACKCHK:
-
- MOVE.L A0,-(A7) ; (* Save register *)
- MOVE.L ABSEXECBASE,A0 ; IF SysBase.ThisTask.tc_SPLower
- MOVE.L ThisTask(A0),A0
- MOVE.L tc_SPLower(A0),A0
- ADD.L D0,A0 ; + size + OCG.ParLimit
- ADD.W #1500,A0
- CMP.L A7,A0 ; > A7 THEN
- BLS.S 1$
- TRAP #OS_StackChk ; TRAP #StackChk
- 1$
- MOVE.L (A7)+,A0 ; (* Restore register *)
- RTS ; END
-
- ;---------------------------------------------------------------------
-
- END ; OberonSys
-
- ****************************************************************************
- *
- * $Log: STACKCHK.asm $
- ;; Revision 1.2 1994/08/08 16:31:56 fjc
- ;; Release 1.4
- ;;
- ;; Revision 1.1 1994/07/24 18:31:36 fjc
- ;; Initial revision
- ;;
- ****************************************************************************
-
-