File:  [gforth] / gforth / Attic / sparc.h
Revision 1.5: download - view: text, annotated - select for diffs
Fri Dec 16 18:14:57 1994 UTC (29 years, 4 months ago) by anton
Branches: MAIN
CVS tags: HEAD
fixed a bug in sparc.h
brought strtoul closer to compiling on the SPARC (but it still does not)

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

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