File:  [gforth] / gforth / Attic / sparc.h
Revision 1.3: download - view: text, annotated - select for diffs
Mon Dec 12 17:10:51 1994 UTC (29 years, 4 months ago) by anton
Branches: MAIN
CVS tags: HEAD
Reorganized configuration: configure is now created by autoconf from
configure.in; I still left it in the CVS repository because not
everyone has autoconf. decstation.h renamed to mips.h and apollo68k to
m68k. Added general 32bit.h description, which the other machine
descriptions use. Created/copied replacement files install-sh memcmp.c
memmove.c select.c (carved out from ecvt.c) strtol.c
strtoul.c. Bytesex is now handled by configure.

Deciding the threading method is now done in machine.h, this should
also be done for USE_TOS and USE_FTOS.

    1: /*
    2:   $Id: sparc.h,v 1.3 1994/12/12 17:10:51 anton Exp $
    3:   Copyright 1992 by the ANSI figForth Development Group
    4: 
    5:   This is the machine-specific part for a SPARC
    6: */
    7: 
    8: /* direct threading is probably faster on the SPARC, but has it been
    9:    tested? Therefore, DIRECT_THREADED is not defined */
   10: 
   11: #ifdef DIRECT_THREADED
   12: /* PFA gives the parameter field address corresponding to a cfa */
   13: #define PFA(cfa)	(((Cell *)cfa)+2)
   14: /* PFA1 is a special version for use just after a NEXT1 */
   15: /* the improvement here is that we may destroy cfa before using PFA1 */
   16: #define PFA1(cfa)	/* PFA(cfa) */ \
   17: 			({register Cell *pfa asm("%15"); \
   18: 			  pfa+2; })
   19: /* CODE_ADDRESS is the address of the code jumped to through the code field */
   20: #define CODE_ADDRESS(cfa)	((Label)((*(unsigned *)(cfa))<<2))
   21: /* MAKE_CF creates an appropriate code field at the cfa; ca is the code address */
   22: /* we use call, since 'branch always' only has 22 bits displacement */
   23: #define MAKE_CF(cfa,ca)	({long *_cfa        = (long *)(cfa); \
   24: 			  unsigned _ca = (unsigned)(ca); \
   25: 			  _cfa[0] = 0x8000000|((_ca+4-(unsigned)_cfa)>>2) /* CALL ca */ \
   26: 			  _cfa[1] = *(long *)_ca; /* delay slot */})
   27: 
   28: /* this is the point where the does code starts if label points to the
   29:  * jump dodoes */
   30: #define DOES_CODE(label)	(((Xt *)(label))+2)
   31: 
   32: /* this is a special version of DOES_CODE for use in dodoes */
   33: #define DOES_CODE1(label)	({register Xt *_does_code asm("%15"); \
   34: 			  	_does_code+2; })
   35: 
   36: /* this stores a call dodoes at addr */
   37: #define MAKE_DOESJUMP(addr)	({long *_addr = (long *)(addr); \
   38: 				  _addr[0] = 0x8000000|((((unsigned)&&dodoes)+4-((unsigned)_addr))>>2) /* CALL dodoes */ \
   39: 			  _addr[1] = *(long *)&&dodoes; /* delay slot */})
   40: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>