[gforth] / gforth / Attic / 386.h  

gforth: gforth/Attic/386.h


1 : anton 1.1 /*
2 :     $Id: 386.h,v 1.2 1993/07/08 08:52:26 benschop Exp $
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 :    
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 :     #define PFA1(cfa) PFA(cfa)
34 :     /* CODE_ADDRESS is the address of the code jumped to through the code field */
35 :     #define CODE_ADDRESS(cfa) ({long _cfa = (char *)(cfa); (Label)(_cfa+*((long *)(_cfa+1))-5);})
36 :     /* MAKE_CF creates an appropriate code field at the cfa; ca is the code address */
37 :     #define MAKE_CF(cfa,ca) ({long _cfa = (long *)(cfa); \
38 :     *(char *)_cfa = 0xe9; /* jmp */ \
39 :     *(long *)(_cfa+1) = ((long)(ca))-(_cfa+5);})
40 :    
41 :     /* this is the point where the does code starts if label points to the
42 :     * jump dodoes */
43 :     #define DOES_CODE(label) ((Xt *)(((char *)label)+8))
44 :    
45 :     /* this is a special version of DOES_CODE for use in dodoes */
46 :     #define DOES_CODE1(label) DOES_CODE(label)
47 :    
48 :     /* this stores a jump dodoes at addr */
49 :     #define MAKE_DOESJUMP(addr) ({long _addr = (long *)(addr); \
50 :     *(char *)_addr = 0xe9; /* jmp */ \
51 :     *(long *)(_addr+1) = ((long)(&&dodoes))-(_addr+5);})
52 :     #endif
53 :    

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help