File:  [gforth] / gforth / Attic / 386.h
Revision 1.5: download - view: text, annotated - select for diffs
Wed Sep 28 17:02:44 1994 UTC (29 years, 7 months ago) by anton
Branches: MAIN
CVS tags: HEAD
Fixed some bugs and eliminated some warnings

    1: /*
    2:   $Id: 386.h,v 1.5 1994/09/28 17:02:44 anton Exp $
    3:   Copyright 1992 by the ANSI figForth Development Group
    4: 
    5:   This is the machine-specific part for Intel 386 compatible processors
    6: */
    7: 
    8: 
    9: /* Cell and UCell must be the same size as a pointer */
   10: typedef long Cell;
   11: typedef unsigned long UCell;
   12: 
   13: /* DCell and UDCell must be twice as large as Cell */
   14: typedef long long DCell;
   15: typedef unsigned long long UDCell;
   16: 
   17: /* define this if IEEE singles and doubles are available as C data types */
   18: #define IEEE_FP
   19: 
   20: /* the IEEE types are used only for loading and storing */
   21: /* the IEEE double precision type */
   22: typedef double DFloat;
   23: /* the IEEE single precision type */
   24: typedef float SFloat;
   25: 
   26: /* define this if the least-significant byte is at the largets address */
   27: /* #define BIG_ENDIAN */
   28: 
   29: /* define this if the processor cannot exploit instruction-level
   30:    parallelism (no pipelining or too few registers) */
   31: #define CISC_NEXT
   32: 
   33: #ifdef DIRECT_THREADED
   34: /* PFA gives the parameter field address corresponding to a cfa */
   35: #define PFA(cfa)	(((Cell *)cfa)+2)
   36: /* PFA1 is a special version for use just after a NEXT1 */
   37: #define PFA1(cfa)	PFA(cfa)
   38: /* CODE_ADDRESS is the address of the code jumped to through the code field */
   39: #define CODE_ADDRESS(cfa) \
   40:     ({long _cfa = (long)(cfa); (Label)(_cfa+*((long *)(_cfa+1))+5);})
   41: /* MAKE_CF creates an appropriate code field at the cfa; ca is the code address */
   42: #define MAKE_CF(cfa,ca)	({long _cfa = (long)(cfa); \
   43:                           long _ca  = (long)(ca); \
   44: 			  *(char *)_cfa = 0xe9; /* jmp */ \
   45: 			  *(long *)(_cfa+1) = _ca-(_cfa+5);})
   46: 
   47: /* this is the point where the does code starts if label points to the
   48:  * jump dodoes */
   49: #define DOES_HANDLER_SIZE       8
   50: #define DOES_CODE(label)	((Xt *)(CODE_ADDRESS(label)+DOES_HANDLER_SIZE))
   51: 
   52: /* this is a special version of DOES_CODE for use in dodoes */
   53: #define DOES_CODE1(label)	DOES_CODE(label)
   54: 
   55: /* this stores a jump dodoes at addr */
   56: #define MAKE_DOES_HANDLER(addr) MAKE_CF(addr,symbols[DODOES])
   57: 
   58: #define MAKE_DOES_CF(addr,doesp) MAKE_CF(addr,((int)(doesp)-8))
   59: #endif
   60: 
   61: #ifdef FORCE_REG
   62: #define IPREG asm("%esi")
   63: #define SPREG asm("%edi")
   64: #ifdef USE_TOS
   65: #define CFAREG asm("%ecx")
   66: #else
   67: #define CFAREG asm("%edx")
   68: #endif
   69: #endif /* FORCE_REG */
   70: 
   71: #define rint(x)	floor((x)+0.5)

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