1995-12-20 02:41:22 -08:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Objective Caml */
|
1995-12-20 02:41:22 -08:00
|
|
|
/* */
|
|
|
|
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
1999-11-17 10:59:06 -08:00
|
|
|
/* en Automatique. All rights reserved. This file is distributed */
|
|
|
|
/* under the terms of the GNU Library General Public License. */
|
1995-12-20 02:41:22 -08:00
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
1997-11-20 07:31:10 -08:00
|
|
|
/* Machine-dependent interface with the asm code */
|
1995-12-20 02:41:22 -08:00
|
|
|
|
|
|
|
#ifndef _stack_
|
|
|
|
#define _stack_
|
|
|
|
|
1997-11-20 07:31:10 -08:00
|
|
|
/* Macros to access the stack frame */
|
1995-12-20 02:41:22 -08:00
|
|
|
#ifdef TARGET_alpha
|
|
|
|
#define Saved_return_address(sp) *((long *)(sp - 8))
|
1997-05-13 07:03:16 -07:00
|
|
|
#define Already_scanned(sp, retaddr) (retaddr & 1L)
|
|
|
|
#define Mark_scanned(sp, retaddr) (*((long *)(sp - 8)) = retaddr | 1L)
|
|
|
|
#define Mask_already_scanned(retaddr) (retaddr & ~1L)
|
1997-11-27 08:28:40 -08:00
|
|
|
#define Callback_link(sp) ((struct caml_context *)(sp + 16))
|
1995-12-20 02:41:22 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TARGET_sparc
|
1997-11-27 08:28:40 -08:00
|
|
|
#define Saved_return_address(sp) *((long *)(sp + 92))
|
|
|
|
#define Callback_link(sp) ((struct caml_context *)(sp + 104))
|
1995-12-20 02:41:22 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TARGET_i386
|
|
|
|
#define Saved_return_address(sp) *((long *)(sp - 4))
|
1997-11-27 08:28:40 -08:00
|
|
|
#define Callback_link(sp) ((struct caml_context *)(sp + 8))
|
1995-12-20 02:41:22 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TARGET_mips
|
|
|
|
#define Saved_return_address(sp) *((long *)(sp - 4))
|
1998-11-18 10:10:53 -08:00
|
|
|
#define Callback_link(sp) ((struct caml_context *)(sp + 16))
|
1995-12-20 02:41:22 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TARGET_hppa
|
|
|
|
#define Stack_grows_upwards
|
|
|
|
#define Saved_return_address(sp) *((long *)sp)
|
1997-11-27 08:28:40 -08:00
|
|
|
#define Callback_link(sp) ((struct caml_context *)(sp - 24))
|
1995-12-20 02:41:22 -08:00
|
|
|
#endif
|
|
|
|
|
1996-01-06 10:56:39 -08:00
|
|
|
#ifdef TARGET_power
|
|
|
|
#define Saved_return_address(sp) *((long *)(sp - 4))
|
|
|
|
#define Already_scanned(sp, retaddr) (retaddr & 1)
|
|
|
|
#define Mark_scanned(sp, retaddr) (*((long *)(sp - 4)) = retaddr | 1)
|
|
|
|
#define Mask_already_scanned(retaddr) (retaddr & ~1)
|
1996-07-03 11:39:36 -07:00
|
|
|
#ifdef SYS_aix
|
|
|
|
#define Trap_frame_size 24
|
|
|
|
#else
|
|
|
|
#define Trap_frame_size 8
|
|
|
|
#endif
|
1997-11-27 08:28:40 -08:00
|
|
|
#define Callback_link(sp) ((struct caml_context *)(sp + Trap_frame_size))
|
1996-01-06 10:56:39 -08:00
|
|
|
#endif
|
1995-12-20 02:41:22 -08:00
|
|
|
|
1996-10-24 09:14:57 -07:00
|
|
|
#ifdef TARGET_m68k
|
|
|
|
#define Saved_return_address(sp) *((long *)(sp - 4))
|
1997-11-27 08:28:40 -08:00
|
|
|
#define Callback_link(sp) ((struct caml_context *)(sp + 8))
|
1996-10-24 09:14:57 -07:00
|
|
|
#endif
|
|
|
|
|
1998-10-15 09:10:53 -07:00
|
|
|
#ifdef TARGET_arm
|
|
|
|
#define Saved_return_address(sp) *((long *)(sp - 4))
|
|
|
|
#define Callback_link(sp) ((struct caml_context *)(sp + 8))
|
|
|
|
#endif
|
|
|
|
|
1997-11-27 08:28:40 -08:00
|
|
|
/* Structure of Caml callback contexts */
|
1997-11-21 05:46:23 -08:00
|
|
|
|
|
|
|
struct caml_context {
|
1997-11-27 08:28:40 -08:00
|
|
|
char * bottom_of_stack; /* beginning of Caml stack chunk */
|
1997-11-21 05:46:23 -08:00
|
|
|
unsigned long last_retaddr; /* last return address in Caml code */
|
1997-11-27 08:28:40 -08:00
|
|
|
value * gc_regs; /* pointer to register block */
|
1997-11-21 05:46:23 -08:00
|
|
|
};
|
|
|
|
|
1997-11-27 08:28:40 -08:00
|
|
|
/* Declaration of variables used in the asm code */
|
|
|
|
extern char * caml_bottom_of_stack;
|
|
|
|
extern unsigned long caml_last_return_address;
|
|
|
|
extern value * caml_gc_regs;
|
1997-11-21 05:46:23 -08:00
|
|
|
extern char * caml_exception_pointer;
|
|
|
|
extern value caml_globals[];
|
2000-01-05 05:16:31 -08:00
|
|
|
extern long caml_globals_inited;
|
1997-11-21 05:46:23 -08:00
|
|
|
extern long * caml_frametable[];
|
|
|
|
|
1996-01-07 08:58:44 -08:00
|
|
|
|
1995-12-20 02:41:22 -08:00
|
|
|
#endif /* _stack_ */
|