| /* |
/* This is the machine-specific part for the Power (incl. PPC) architecture |
| Copyright 1992 by the ANSI figForth Development Group |
|
| |
|
| This is the machine-specific part for the Power (incl. PPC) architecture |
Copyright (C) 1995 Free Software Foundation, Inc. |
| |
|
| |
This file is part of Gforth. |
| |
|
| |
Gforth is free software; you can redistribute it and/or |
| |
modify it under the terms of the GNU General Public License |
| |
as published by the Free Software Foundation; either version 2 |
| |
of the License, or (at your option) any later version. |
| |
|
| |
This program is distributed in the hope that it will be useful, |
| |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| |
GNU General Public License for more details. |
| |
|
| |
You should have received a copy of the GNU General Public License |
| |
along with this program; if not, write to the Free Software |
| |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| */ |
*/ |
| |
|
| #if !defined(USE_TOS) && !defined(USE_NO_TOS) |
#if !defined(USE_TOS) && !defined(USE_NO_TOS) |
| #include "32bit.h" |
#include "32bit.h" |
| |
|
| /* cache flush stuff */ |
/* cache flush stuff */ |
| #ifdef DIRECT_THREADED |
|
| #warning Direct threading for Power has not been tested |
|
| |
|
| #warning If you get assembly errors, here is the reason why |
#warning If you get assembly errors, here is the reason why |
| #define CACHE_FLUSH(addr,size) asm("icbi (%0); isync"::"b"(addr)) |
#define FLUSH_ICACHE(addr,size) asm("icbi (%0); isync"::"b"(addr)) |
| /* this assumes size=4 */ |
/* this assumes size=4 */ |
| /* the mnemonics are for the PPC and the syntax is a wild guess; for |
/* the mnemonics are for the PPC and the syntax is a wild guess; for |
| Power the mnemonic for the isync instruction is "ics" and I have |
Power the mnemonic for the isync instruction is "ics" and I have |
| not found an equivalent for the icbi instruction in my reference. |
not found an equivalent for the icbi instruction in my reference. |
| */ |
*/ |
| |
|
| |
#ifdef DIRECT_THREADED |
| |
#warning Direct threading for Power has not been tested |
| |
|
| /* PFA gives the parameter field address corresponding to a cfa */ |
/* PFA gives the parameter field address corresponding to a cfa */ |
| #define PFA(cfa) (((Cell *)cfa)+2) |
#define PFA(cfa) (((Cell *)cfa)+2) |
| /* PFA1 is a special version for use just after a NEXT1 */ |
/* PFA1 is a special version for use just after a NEXT1 */ |
| /* this is the point where the does code for the word with the xt cfa |
/* this is the point where the does code for the word with the xt cfa |
| starts. Since a branch is only a cell on Power, we can use the |
starts. Since a branch is only a cell on Power, we can use the |
| second cell of the cfa for storing the does address */ |
second cell of the cfa for storing the does address */ |
| #define DOES_CODE(cfa) ((Xt *)(((long *)(cfa))[1])) |
#define DOES_CODE(cfa) \ |
| |
({ unsigned *_cfa=(unsigned)(cfa); \ |
| |
_cfa[0]==(0x48000002|&&docol) ? DOES_CODE1(_cfa) : 0; }) |
| |
|
| |
|
| |
DOES_CODE(label) |
| /* this is a special version of DOES_CODE for use in dodoes */ |
/* this is a special version of DOES_CODE for use in dodoes */ |
| #define DOES_CODE1(label) DOES_CODE(label) |
#define DOES_CODE1(cfa) ((Xt *)(((long *)(cfa))[1])) |
| |
|
| /* the does handler resides between DOES> and the following Forth |
/* the does handler resides between DOES> and the following Forth |
| code. Since the code-field jumps directly to dodoes, the |
code. Since the code-field jumps directly to dodoes, the |