Annotation of gforth/arch/m68k/machine.h, revision 1.6
1.1 anton 1: /* This is the machine-specific part for the 68000 and family
2:
1.6 ! anton 3: Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
1.1 anton 4:
5: This file is part of Gforth.
6:
7: Gforth is free software; you can redistribute it and/or
8: modify it under the terms of the GNU General Public License
9: as published by the Free Software Foundation; either version 2
10: of the License, or (at your option) any later version.
11:
12: This program is distributed in the hope that it will be useful,
13: but WITHOUT ANY WARRANTY; without even the implied warranty of
14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: GNU General Public License for more details.
16:
17: You should have received a copy of the GNU General Public License
18: along with this program; if not, write to the Free Software
19: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20: */
21:
1.2 anton 22: /* direct threading is faster at least on 68030 */
23: #if !defined INDIRECT_THREADED && !defined DIRECT_THREADED
24: #define DIRECT_THREADED
25: #endif
26:
27: /* define this if the processor cannot exploit instruction-level
28: parallelism (no pipelining or too few registers) */
29: #define CISC_NEXT
30:
31: #if !defined USE_NO_TOS && !defined USE_TOS
32: #define USE_TOS
33: #endif
34:
35: #define AUTO_INCREMENT
36:
37:
1.3 jwilke 38: #include "../generic/machine.h"
1.1 anton 39:
40: /* Clearing the whole cache is a bit drastic, but this is the only
41: * cache control available on the apollo and NeXT
42: */
43: #if defined(apollo)
44: # define FLUSH_ICACHE(addr,size) cache_$clear()
45: #elif defined(NeXT)
46: # define FLUSH_ICACHE(addr,size) asm("trap #2");
47: #elif defined(hpux)
48: # include <sys/cache.h>
49: # define FLUSH_ICACHE(addr,size) cachectl(CC_IPURGE,(addr),(size))
1.2 anton 50: #elif defined(linux)
51: #include <asm/cachectl.h>
52: extern int cacheflush(void *, int, int, size_t);
53: #define FLUSH_ICACHE(addr,size) \
54: cacheflush(addr, FLUSH_SCOPE_LINE, FLUSH_CACHE_INSN, (size_t)(size) + 15)
1.4 anton 55: #elif defined(amigaos)
56: # define FLUSH_ICACHE(addr,size) \
57: asm(" move.l a6,-(sp); \
58: move.l _SysBase,a6; \
59: jsr -636(a6); \
60: move.l (sp)+,a6; \
61: ")
1.1 anton 62: #else
63: # warning no FLUSH_ICACHE defined. If your machine has an I-cache (68020+),
64: # warning direct threading and CODE words will not work.
65: #endif
66:
67: #ifdef DIRECT_THREADED
68: /* PFA gives the parameter field address corresponding to a cfa */
1.2 anton 69: #define PFA(cfa) ((Cell *)(cfa)+2)
1.1 anton 70: /* PFA1 is a special version for use just after a NEXT1 */
71: #define PFA1(cfa) PFA(cfa)
72: /* CODE_ADDRESS is the address of the code jumped to through the code field */
1.2 anton 73: #define CODE_ADDRESS(cfa) (*(Label *)((char *)(cfa)+2))
1.1 anton 74: /* MAKE_CF creates an appropriate code field at the cfa;
75: ca is the code address */
1.2 anton 76: #define MAKE_CF(cfa,ca) ({short * _cfa = (short *)(cfa); \
77: long _ca = (long)(ca); \
1.1 anton 78: _cfa[0] = 0x4ef9; /* jmp.l */ \
1.2 anton 79: *(long *)(_cfa+1) = _ca;})
1.1 anton 80:
81: /* this is the point where the does code for the word with the xt cfa
82: starts. */
83: #define DOES_CODE(cfa) \
84: ({ short *_cfa=(short *)(cfa); \
1.2 anton 85: short *_ca=CODE_ADDRESS(_cfa); \
1.1 anton 86: ((_cfa[0] == 0x4ef9 \
1.2 anton 87: && _ca[0] == 0x4ef9 && CODE_ADDRESS(_ca) == &&dodoes) \
1.1 anton 88: ? ((unsigned)_ca)+DOES_HANDLER_SIZE \
89: : 0); })
90:
91: /* this is a special version of DOES_CODE for use in dodoes */
92: #define DOES_CODE1(cfa) ((Xt *)(((char *)CODE_ADDRESS(cfa))+DOES_HANDLER_SIZE))
93:
94: /* this stores a call dodoes at addr */
95: #define MAKE_DOES_HANDLER(addr) MAKE_CF(addr,symbols[DODOES])
96:
97: #define MAKE_DOES_CF(addr,doesp) MAKE_CF(addr,((int)(doesp)-8))
98: #endif
99:
1.2 anton 100: #ifdef FORCE_REG /* highly recommended */
1.4 anton 101: #if defined(amigaos)
1.5 pazsan 102: # define IPREG asm("%a6")
1.4 anton 103: #else
1.5 pazsan 104: # define IPREG asm("%a5")
1.4 anton 105: #endif
1.2 anton 106: #define SPREG asm("%a4")
107: #define RPREG asm("%a3")
108: #define CFAREG asm("%a2")
109: #define TOSREG asm("%d3")
110: #define LPREG asm("%d2")
111: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>