1 /* This file is part of the program psim.
3 Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 /* Instruction field macros:
24 The macro's below greatly simplify the process of translating the
25 pseudo code found in the PowerPC manual into C.
27 In addition to the below, more will be found in the gen program's
31 /* map some statements and variables directly across */
33 #define is_64bit_implementation (WITH_TARGET_WORD_BITSIZE == 64)
34 #define is_64bit_mode IS_64BIT_MODE(processor)
42 #define RESERVE cpu_reservation(processor)->valid
43 #define RESERVE_ADDR cpu_reservation(processor)->addr
44 #define RESERVE_DATA cpu_reservation(processor)->data
46 #define real_addr(EA, IS_READ) vm_real_data_addr(cpu_data_map(processor), \
53 /* depending on mode return a 32 or 64bit number */
55 #define IEA(X) (is_64bit_mode \
57 : MASKED((X), 32, 63))
59 /* Expand argument to current architecture size */
61 #define EXTS(X) EXTS_##X
64 /* Gen translates text of the form A{XX:YY} into A_XX_YY_ the macro's
65 below define such translated text into real expressions */
67 /* the spr field as it normally is used */
69 #define SPR_5_9_ (SPR & 0x1f)
70 #define SPR_0_4_ (SPR >> 5)
71 #define SPR_0_ ((SPR & BIT10(0)) != 0)
73 #define tbr_5_9_ (tbr & 0x1f)
74 #define tbr_0_4_ (tbr >> 5)
77 #define TB cpu_get_time_base(processor)
80 /* various registers with important masks */
82 #define LR_0b00 (LR & ~3)
83 #define CTR_0b00 (CTR & ~3)
85 #define CR_BI_ ((CR & BIT32_BI) != 0)
86 #define CR_BA_ ((CR & BIT32_BA) != 0)
87 #define CR_BB_ ((CR & BIT32_BB) != 0)
90 /* extended extracted fields */
92 #define TO_0_ ((TO & BIT5(0)) != 0)
93 #define TO_1_ ((TO & BIT5(1)) != 0)
94 #define TO_2_ ((TO & BIT5(2)) != 0)
95 #define TO_3_ ((TO & BIT5(3)) != 0)
96 #define TO_4_ ((TO & BIT5(4)) != 0)
98 #define BO_0_ ((BO & BIT5(0)) != 0)
99 #define BO_1_ ((BO & BIT5(1)) != 0)
100 #define BO_2_ ((BO & BIT5(2)) != 0)
101 #define BO_3_ ((BO & BIT5(3)) != 0)
102 #define BO_4_ ((BO & BIT5(4)) != 0)
104 #define GOTO(dest) goto XCONCAT4(label__,dest,__,MY_PREFIX)
105 #define LABEL(dest) XCONCAT4(label__,dest,__,MY_PREFIX)
This page took 0.032136 seconds and 4 git commands to generate.