Annotation of gforth/sparc.h, revision 1.2
1.1 anton 1: /*
2: $Id: sparc.h,v 1.2 1993/02/11 15:57:33 anton Exp $
3: Copyright 1992 by the ANSI figForth Development Group
4:
5: This is the machine-specific part for a SPARC running SunOS
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:
29: #ifdef DIRECT_THREADED
30: /* PFA gives the parameter field address corresponding to a cfa */
31: #define PFA(cfa) (((Cell *)cfa)+2)
32: /* PFA1 is a special version for use just after a NEXT1 */
33: /* the improvement here is that we may destroy cfa before using PFA1 */
34: #define PFA1(cfa) /* PFA(cfa) */ \
35: ({register Cell *pfa asm("%15"); \
36: pfa+2; })
37: /* CODE_ADDRESS is the address of the code jumped to through the code field */
38: #define CODE_ADDRESS(cfa) ((Label)((*(unsigned *)(cfa))<<2))
39: /* MAKE_CF creates an appropriate code field at the cfa; ca is the code address */
40: /* we use call, since 'branch always' only has 22 bits displacement */
41: #define MAKE_CF(cfa,ca) ({long *_cfa = (long *)(cfa); \
42: unsigned _ca = (unsigned)(ca); \
43: _cfa[0] = 0x8000000|((_ca+4-(unsigned)_cfa)>>2) /* CALL ca */ \
44: _cfa[1] = *(long *)_ca; /* delay slot */})
45: #endif
46:
47: /* this is the point where the does code starts if label points to the
48: * jump dodoes */
49: #define DOES_CODE(label) (((Xt *)(label))+2)
50:
51: /* this is a special version of DOES_CODE for use in dodoes */
52: #define DOES_CODE1(label) ({register Xt *_does_code asm("%15"); \
53: _does_code+2; })
54:
55: /* this stores a call dodoes at addr */
56: #define MAKE_DOESJUMP(addr) ({long *_addr = (long *)(addr); \
57: _addr[0] = 0x8000000|((((unsigned)&&dodoes)+4-((unsigned)_addr))>>2) /* CALL dodoes */ \
58: _addr[1] = *(long *)&&dodoes; /* delay slot */})
59:
60: /* OS dependences */
61:
62: #define SEEK_SET 0
1.2 ! pazsan 63:
! 64: #define memmove(a,b,c) ({ if((long)(a)<(long)(b)) memcpy(a,b,c); \
! 65: else \
! 66: { int i; \
! 67: for(i=(c)-1; i>=0; i--) \
! 68: (char*)a[i]=(char*)b[i]; \
! 69: } \
! 70: })
! 71: #define strtoul(a,b,c) strtol(a,b,c)
! 72:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>