Annotation of gforth/arch/386/machine.h, revision 1.28
1.1 anton 1: /*
2: This is the machine-specific part for Intel 386 compatible processors
3:
1.28 ! anton 4: Copyright (C) 1995,1996,1997,1998,2000,2003,2004 Free Software Foundation, Inc.
1.1 anton 5:
6: This file is part of Gforth.
7:
8: Gforth is free software; you can redistribute it and/or
9: modify it under the terms of the GNU General Public License
10: as published by the Free Software Foundation; either version 2
11: of the License, or (at your option) any later version.
12:
13: This program is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: GNU General Public License for more details.
17:
18: You should have received a copy of the GNU General Public License
19: along with this program; if not, write to the Free Software
1.13 anton 20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
1.1 anton 21: */
22:
1.4 pazsan 23: #ifdef HAVE_LIBKERNEL32
24: #ifdef i386
25: #define SYSCALL __attribute__ ((stdcall))
26: #endif
27: #endif
28:
1.6 anton 29: #ifndef THREADING_SCHEME
30: #define THREADING_SCHEME 8
31: #endif
1.7 anton 32:
1.21 anton 33: #if (((__GNUC__==2 && defined(__GNUC_MINOR__) && __GNUC_MINOR__>=95) || (__GNUC__>2))) && defined(FORCE_REG)
1.8 pazsan 34: #if !defined(USE_TOS) && !defined(USE_NO_TOS)
35: #define USE_TOS
1.9 pazsan 36: #endif
37: #endif
1.8 pazsan 38: #define MEMCMP_AS_SUBROUTINE 1
39:
1.11 anton 40: #ifndef USE_FTOS
41: #ifndef USE_NO_FTOS
42: /* gcc can't keep TOS in a register on the 386, so don't try */
43: #define USE_NO_FTOS
44: #endif
45: #endif
46:
1.7 anton 47: #include "../generic/machine.h"
1.6 anton 48:
1.1 anton 49: /* define this if the processor cannot exploit instruction-level
50: parallelism (no pipelining or too few registers) */
51: #define CISC_NEXT
52:
53: /* 386 and below have no cache, 486 has a shared cache, and the
1.18 anton 54: Pentium and later employ hardware cache consistency, so
1.1 anton 55: flush-icache is a noop */
56: #define FLUSH_ICACHE(addr,size)
57:
1.26 anton 58: #if defined(FORCE_REG) && !defined(DOUBLY_INDIRECT) && !defined(VM_PROFILING)
1.1 anton 59: #if (__GNUC__==2 && defined(__GNUC_MINOR__) && __GNUC_MINOR__==5)
60: /* i.e. gcc-2.5.x */
61: /* this works with 2.5.7; nothing works with 2.5.8 */
62: #define IPREG asm("%esi")
63: #define SPREG asm("%edi")
1.17 anton 64: #if 0
1.1 anton 65: #ifdef USE_TOS
66: #define CFAREG asm("%ecx")
67: #else
68: #define CFAREG asm("%edx")
1.17 anton 69: #endif
1.1 anton 70: #endif
1.19 anton 71: #else /* !gcc-2.5.x */
1.1 anton 72: /* this works with 2.6.3 (and quite well, too) */
73: /* since this is not very demanding, it's the default for other gcc versions */
74: #if defined(USE_TOS) && !defined(CFA_NEXT)
1.8 pazsan 75: #if ((__GNUC__==2 && defined(__GNUC_MINOR__) && __GNUC_MINOR__>=95) || (__GNUC__>2))
76: /* gcc 2.95 has a better register allocater */
77: #define SPREG asm("%esi")
1.15 anton 78: #define RPREG asm("%edi")
1.27 anton 79: #ifdef NO_IP
80: #define spbREG asm("%ebx")
81: #else
1.15 anton 82: #define IPREG asm("%ebx")
1.27 anton 83: #endif
1.19 anton 84: /* ebp leads to broken code (gcc-3.0); eax, ecx, edx produce compile errors */
1.15 anton 85: #define TOSREG asm("%ecx")
1.19 anton 86: /* ecx works only for TOS, and eax, edx don't work for anything (gcc-3.0) */
87: #else /* !(gcc-2.95 or later) */
1.1 anton 88: #define IPREG asm("%ebx")
1.19 anton 89: #endif /* !(gcc-2.95 or later) */
90: #else /* !defined(USE_TOS) || defined(CFA_NEXT) */
1.9 pazsan 91: #if ((__GNUC__==2 && defined(__GNUC_MINOR__) && __GNUC_MINOR__>=95) || (__GNUC__>2))
92: #define SPREG asm("%esi")
93: #define RPREG asm("%edi")
1.27 anton 94: #ifdef NO_IP
95: #define spbREG asm("%ebx")
96: #else
1.14 anton 97: #define IPREG asm("%ebx")
1.27 anton 98: #endif
1.19 anton 99: #else /* !(gcc-2.95 or later) */
1.1 anton 100: #define SPREG asm("%ebx")
1.19 anton 101: #endif /* !(gcc-2.95 or later) */
102: #endif /* !defined(USE_TOS) || defined(CFA_NEXT) */
103: #endif /* !gcc-2.5.x */
1.26 anton 104: #endif /* defined(FORCE_REG) && !defined(DOUBLY_INDIRECT) && !defined(VM_PROFILING) */
1.2 pazsan 105:
106: /* #define ALIGNMENT_CHECK 1 */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>