Annotation of gforth/386.h, revision 1.4

1.1       anton       1: /*
1.4     ! anton       2:   $Id: 386.h,v 1.3 1994/09/08 17:20:03 anton Exp $
1.1       anton       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: 
1.3       anton      29: /* define this if the processor cannot exploit instruction-level
1.4     ! anton      30:    parallelism (no pipelining or too few registers) */
1.3       anton      31: #define CISC_NEXT
                     32: 
1.1       anton      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 */
1.2       pazsan     39: #define CODE_ADDRESS(cfa) \
                     40:     ({long _cfa = (char *)(cfa); (Label)(_cfa+*((long *)(_cfa+1))+5);})
1.1       anton      41: /* MAKE_CF creates an appropriate code field at the cfa; ca is the code address */
1.2       pazsan     42: #define MAKE_CF(cfa,ca)        ({long _cfa = (long)(cfa); \
                     43:                           long _ca  = (long)(ca); \
1.1       anton      44:                          *(char *)_cfa = 0xe9; /* jmp */ \
1.2       pazsan     45:                          *(long *)(_cfa+1) = _ca-(_cfa+5);})
1.1       anton      46: 
                     47: /* this is the point where the does code starts if label points to the
                     48:  * jump dodoes */
1.2       pazsan     49: #define DOES_HANDLER_SIZE       8
                     50: #define DOES_CODE(label)       ((Xt *)(CODE_ADDRESS(label)+DOES_HANDLER_SIZE))
1.1       anton      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 */
1.2       pazsan     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))
1.1       anton      59: #endif
1.4     ! anton      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 */
1.1       anton      70: 
1.2       pazsan     71: #define rint(x)        floor((x)+0.5)

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