File:  [gforth] / gforth / Attic / 386.h
Revision 1.6: download - view: text, annotated - select for diffs
Mon Oct 3 18:23:54 1994 UTC (25 years ago) by anton
Branches: MAIN
CVS tags: HEAD
Updated ToDo and INSTALL; Wrote README; Lifted COPYING and getopt*
from other packages;  removed $Id$ lines from some files

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

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