Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/runtime/include/asm-base.h
ViewVC logotype

View of /sml/trunk/src/runtime/include/asm-base.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 876 - (download) (as text) (annotate)
Wed Jul 11 15:42:20 2001 UTC (18 years, 3 months ago) by blume
File size: 4227 byte(s)
minor tweaks to 110.34 (and re-tagged)
/* asm-base.h
 *
 * COPYRIGHT (c) 1992 AT&T Bell Laboratories
 *
 * Common definitions for assembly files in the SML/NJ system.
 */

#ifndef _ASM_BASE_
#define _ASM_BASE_

#ifndef _ML_BASE_
#include "ml-base.h"
#endif

/* bool_t values for assembly code */
#define FALSE	0
#define TRUE	1

#if (!defined(GLOBALS_HAVE_UNDERSCORE)) && (defined(OPSYS_SUNOS) || (defined(OPSYS_FREEBSD) && !defined(__ELF__)) || defined(OPSYS_NETBSD) || defined(OPSYS_NEXTSTEP) || defined(OPSYS_WIN32) || defined(OPSYS_DARWIN))
#  define GLOBALS_HAVE_UNDERSCORE
#endif

/* we should probably consider factoring this out into ml-unixdep.h -- JHR */
#ifdef GLOBALS_HAVE_UNDERSCORE
#  define CSYM(ID)	CONCAT(_,ID)
#else
#  define CSYM(ID)	ID
#endif

#if defined(HOST_SPARC)
#  if defined(OPSYS_SUNOS)
#    include <machine/asm_linkage.h>
#    include <machine/trap.h>
#    undef ENTRY
#  elif defined(OPSYS_SOLARIS)
#    define _ASM
#    include <sys/stack.h>
#    include <sys/trap.h>
#  endif
#  define GLOBAL(ID)	.global	CSYM(ID)
#  define LABEL(ID)	ID:
#  define ALIGN4        .align 4
#  define WORD(W)       .word W
#  if defined(OPSYS_NEXTSTEP)
#    define TEXT          .text
#    define DATA          .data
#  else
#    define TEXT          .seg "text"
#    define DATA          .seg "data"
#  endif
#  define BEGIN_PROC(P)
#  define END_PROC(P)

#elif defined(HOST_MIPS)
#  if defined(OPSYS_MACH)
#    include <mips/regdef.h>
#  elif defined(OPSYS_IRIX5)
#    define _MIPS_SIM	1	/* IRIX 5.x needs this in <regdef.h> */
#    include <regdef.h>
#  else
#    include <regdef.h>
#  endif
#  define GLOBAL(ID)	.globl	CSYM(ID)
#  define LABEL(ID)	ID:
#  define ALIGN4        .align 2
#  define WORD(W)       .word W
#  define TEXT          .text
#  define DATA          .data
#  define BEGIN_PROC(P)	.ent CSYM(P)
#  define END_PROC(P)	.end CSYM(P)

#elif defined(HOST_ALPHA32)
#  include <regdef.h>
#  define GLOBAL(ID)	.globl  CSYM(ID)
#  define LABEL(ID)	ID:
#  define ALIGN4	.align 2
#  define WORD(W)	.word W
#  define TEXT		.text
#  define DATA		.data
#  define BEGIN_PROC(P)	.align 3; .ent CSYM(P)
#  define END_PROC(P)	.end CSYM(P)

#elif defined(HOST_HPPA)
#  define GLOBAL(ID)    .export ID,DATA
#  define LABEL(ID)     .label ID
#  define ALIGN4        .align 8
#  define BEGIN_PROC(P)
#  define END_PROC(P)
#  define __SC__	!

#elif (defined(HOST_RS6000) || defined(HOST_PPC))
#  if defined(OPSYS_AIX)
#    define CFUNSYM(ID)	CONCAT(.,ID)
#    define USE_TOC
#    define GLOBAL(ID)	.globl CSYM(ID)
#    define TEXT	.csect [PR]
#    define DATA	.csect [RW]
#    define RO_DATA	.csect [RO]
#    define ALIGN4	.align 2
#    define ALIGN8	.align 3
#    define DOUBLE(V)	.double V
#    define LABEL(ID)   ID:

#  elif (defined(OPSYS_LINUX) && defined(TARGET_PPC))
#    define CFUNSYM(ID)	ID
#    define GLOBAL(ID)	.globl CSYM(ID)
#    define TEXT	.section ".text"
#    define DATA	.section ".data"
#    define RO_DATA	.section ".rodata"
#    define ALIGN4	.align 2
#    define ALIGN8	.align 3
#    define DOUBLE(V)	.double V
#    define LABEL(ID)	ID:

#  elif (defined(OPSYS_DARWIN) && defined(TARGET_PPC))
#    define CFUNSYM(ID) CSYM(ID)
#    define GLOBAL(ID)  .globl  CSYM(ID)
#    define TEXT        .text
#    define DATA        .data
#    define RO_DATA     .data
#    define ALIGN4      .align 2
#    define ALIGN8	.align 3
#    define DOUBLE(V)	.double V
#    define LABEL(ID)	ID:
#    define __SC__      @
#  endif

#  define CENTRY(ID)		\
    .globl CFUNSYM(ID) __SC__	\
    LABEL(CFUNSYM(ID))

#elif defined(HOST_X86)
#  if defined(OPSYS_WIN32)
#    include "x86-masm.h"
#    define WORD(W)     WORD32(W)
#  else
#    define GLOBAL(ID)	  .globl	CSYM(ID)
#    define LABEL(ID)	  CONCAT(ID,:)
#    define IMMED(ID)	  CONCAT($,ID)
#    define ALIGN4        .align 2
#    define WORD(W)       .word W
#    define TEXT          .text
#    define DATA          .data
#    define BEGIN_PROC(P) .ent P
#    define END_PROC(P)	  .end P

#  endif

#else

#  error missing asm definitions

#endif

#ifndef __SC__
#  define __SC__ 	;
#endif

#define ENTRY(ID)				\
    GLOBAL(ID) __SC__				\
    LABEL(CSYM(ID))

#define ML_CODE_HDR(name)			\
	    GLOBAL(name) __SC__		\
	    ALIGN4 __SC__			\
    LABEL(CSYM(name))

#endif /* !_ASM_BASE_ */


root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0