[gforth] / gforth / Attic / sparc.h  

gforth: gforth/Attic/sparc.h


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

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help