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 */
|
2001-12-07 05:41:02 -08:00
|
|
|
/* under the terms of the GNU Library General Public License, with */
|
|
|
|
/* the special exception on linking described in file ../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
|
2001-08-13 06:53:51 -07:00
|
|
|
#define Saved_return_address(sp) *((long *)((sp) - 8))
|
|
|
|
#define Already_scanned(sp, retaddr) ((retaddr) & 1L)
|
|
|
|
#define Mark_scanned(sp, retaddr) (*((long *)((sp) - 8)) = (retaddr) | 1L)
|
|
|
|
#define Mask_already_scanned(retaddr) ((retaddr) & ~1L)
|
|
|
|
#define Callback_link(sp) ((struct caml_context *)((sp) + 16))
|
1995-12-20 02:41:22 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TARGET_sparc
|
2001-08-13 06:53:51 -07: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
|
2001-08-13 06:53:51 -07:00
|
|
|
#define Saved_return_address(sp) *((long *)((sp) - 4))
|
|
|
|
#define Callback_link(sp) ((struct caml_context *)((sp) + 8))
|
1995-12-20 02:41:22 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TARGET_mips
|
2001-08-13 06:53:51 -07:00
|
|
|
#define Saved_return_address(sp) *((long *)((sp) - 4))
|
|
|
|
#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
|
2001-08-13 06:53:51 -07:00
|
|
|
#define Saved_return_address(sp) *((long *)(sp))
|
|
|
|
#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
|
2001-08-13 06:53:51 -07:00
|
|
|
#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
|
2003-06-20 08:17:52 -07:00
|
|
|
#define Trap_frame_size 32
|
1996-07-03 11:39:36 -07:00
|
|
|
#else
|
2003-06-20 08:17:52 -07:00
|
|
|
#define Trap_frame_size 16
|
1996-07-03 11:39:36 -07:00
|
|
|
#endif
|
2001-08-13 06:53:51 -07: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
|
2001-08-13 06:53:51 -07:00
|
|
|
#define Saved_return_address(sp) *((long *)((sp) - 4))
|
|
|
|
#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
|
2001-08-13 06:53:51 -07:00
|
|
|
#define Saved_return_address(sp) *((long *)((sp) - 4))
|
|
|
|
#define Callback_link(sp) ((struct caml_context *)((sp) + 8))
|
1998-10-15 09:10:53 -07:00
|
|
|
#endif
|
|
|
|
|
2000-06-30 09:37:42 -07:00
|
|
|
#ifdef TARGET_ia64
|
2001-08-13 06:53:51 -07:00
|
|
|
#define Saved_return_address(sp) *((long *)((sp) + 8))
|
|
|
|
#define Already_scanned(sp, retaddr) ((retaddr) & 1L)
|
|
|
|
#define Mark_scanned(sp, retaddr) (*((long *)((sp) + 8)) = (retaddr) | 1L)
|
|
|
|
#define Mask_already_scanned(retaddr) ((retaddr) & ~1L)
|
|
|
|
#define Callback_link(sp) ((struct caml_context *)((sp) + 32))
|
2000-06-30 09:37:42 -07:00
|
|
|
#endif
|
|
|
|
|
2003-06-30 01:28:48 -07:00
|
|
|
#ifdef TARGET_amd64
|
|
|
|
#define Saved_return_address(sp) *((long *)((sp) - 8))
|
|
|
|
#define Callback_link(sp) ((struct caml_context *)((sp) + 16))
|
|
|
|
#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_ */
|