Annotation of gforth/sparc.h, revision 1.6

1.1       anton       1: /*
1.6     ! anton       2:   $Id: sparc.h,v 1.5 1994/12/16 18:14:57 anton Exp $
1.1       anton       3:   Copyright 1992 by the ANSI figForth Development Group
                      4: 
1.3       anton       5:   This is the machine-specific part for a SPARC
1.1       anton       6: */
1.5       anton       7: 
                      8: #include "32bit.h"
1.4       anton       9: 
                     10: #if !defined(USE_TOS) && !defined(USE_NO_TOS)
                     11: #define USE_TOS
                     12: #endif
1.1       anton      13: 
1.3       anton      14: /* direct threading is probably faster on the SPARC, but has it been
                     15:    tested? Therefore, DIRECT_THREADED is not defined */
1.1       anton      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 */
1.6     ! anton      22: #define PFA1(cfa)      PFA(cfa)
        !            23: #ifdef undefined
1.1       anton      24: #define PFA1(cfa)      /* PFA(cfa) */ \
1.6     ! anton      25:                        ({register Cell *pfa asm("%o7"); \
1.1       anton      26:                          pfa+2; })
1.6     ! anton      27: #endif
1.1       anton      28: /* CODE_ADDRESS is the address of the code jumped to through the code field */
1.6     ! anton      29: #define CODE_ADDRESS(cfa)      ({unsigned _cfa = (unsigned)(cfa); \
        !            30:                                    (Label)(_cfa+((*(unsigned *)_cfa)<<2));})
1.1       anton      31: /* MAKE_CF creates an appropriate code field at the cfa; ca is the code address */
                     32: /* we use call, since 'branch always' only has 22 bits displacement */
                     33: #define MAKE_CF(cfa,ca)        ({long *_cfa        = (long *)(cfa); \
                     34:                          unsigned _ca = (unsigned)(ca); \
1.6     ! anton      35:                          _cfa[0] = 0x40000000|((_ca+4-(unsigned)_cfa)>>2); /* CALL ca */ \
1.1       anton      36:                          _cfa[1] = *(long *)_ca; /* delay slot */})
                     37: 
                     38: /* this is the point where the does code starts if label points to the
                     39:  * jump dodoes */
1.6     ! anton      40: #define DOES_CODE(label)       ((Xt *)(CODE_ADDRESS(label)+DOES_HANDLER_SIZE))
1.1       anton      41: 
                     42: /* this is a special version of DOES_CODE for use in dodoes */
1.6     ! anton      43: #define DOES_CODE1(label)      DOES_CODE(label)
        !            44: #ifdef undefined
        !            45: #define DOES_CODE1(label)      ({register Xt *_does_code asm("%o7"); \
1.1       anton      46:                                _does_code+2; })
1.6     ! anton      47: #endif
1.1       anton      48: 
                     49: /* this stores a call dodoes at addr */
1.6     ! anton      50: #define MAKE_DOES_HANDLER(addr) MAKE_CF(addr,symbols[DODOES])
        !            51: 
        !            52: #define DOES_HANDLER_SIZE       8
        !            53: 
        !            54: #define MAKE_DOES_CF(addr,doesp) ({long *_addr        = (long *)(addr); \
        !            55:                          unsigned _doesp = (unsigned)(doesp); \
        !            56:                          _addr[0] = 0x40000000|((_doesp-8-(unsigned)_addr)>>2); /* CALL doesp-8 */ \
        !            57:                          _addr[1] = 0x01000000; /* nop */})
1.3       anton      58: #endif
1.6     ! anton      59: 

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