Annotation of gforth/386.h, revision 1.6

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

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