Statistics
| Branch: | Revision:

root / target-ppc / cpu.h @ 07ad1b93

History | View | Annotate | Download (14 kB)

1 79aceca5 bellard
/*
2 79aceca5 bellard
 *  PPC emulation cpu definitions for qemu.
3 79aceca5 bellard
 * 
4 79aceca5 bellard
 *  Copyright (c) 2003 Jocelyn Mayer
5 79aceca5 bellard
 *
6 79aceca5 bellard
 * This library is free software; you can redistribute it and/or
7 79aceca5 bellard
 * modify it under the terms of the GNU Lesser General Public
8 79aceca5 bellard
 * License as published by the Free Software Foundation; either
9 79aceca5 bellard
 * version 2 of the License, or (at your option) any later version.
10 79aceca5 bellard
 *
11 79aceca5 bellard
 * This library is distributed in the hope that it will be useful,
12 79aceca5 bellard
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 79aceca5 bellard
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 79aceca5 bellard
 * Lesser General Public License for more details.
15 79aceca5 bellard
 *
16 79aceca5 bellard
 * You should have received a copy of the GNU Lesser General Public
17 79aceca5 bellard
 * License along with this library; if not, write to the Free Software
18 79aceca5 bellard
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 79aceca5 bellard
 */
20 79aceca5 bellard
#if !defined (__CPU_PPC_H__)
21 79aceca5 bellard
#define __CPU_PPC_H__
22 79aceca5 bellard
23 79aceca5 bellard
#include <endian.h>
24 79aceca5 bellard
#include <asm/byteorder.h>
25 79aceca5 bellard
26 79aceca5 bellard
#include "cpu-defs.h"
27 79aceca5 bellard
28 79aceca5 bellard
/***                          Sign extend constants                        ***/
29 79aceca5 bellard
/* 8 to 32 bits */
30 79aceca5 bellard
static inline int32_t s_ext8 (uint8_t value)
31 79aceca5 bellard
{
32 79aceca5 bellard
    int8_t *tmp = &value;
33 79aceca5 bellard
34 79aceca5 bellard
    return *tmp;
35 79aceca5 bellard
}
36 79aceca5 bellard
37 79aceca5 bellard
/* 16 to 32 bits */
38 79aceca5 bellard
static inline int32_t s_ext16 (uint16_t value)
39 79aceca5 bellard
{
40 79aceca5 bellard
    int16_t *tmp = &value;
41 79aceca5 bellard
42 79aceca5 bellard
    return *tmp;
43 79aceca5 bellard
}
44 79aceca5 bellard
45 79aceca5 bellard
/* 24 to 32 bits */
46 79aceca5 bellard
static inline int32_t s_ext24 (uint32_t value)
47 79aceca5 bellard
{
48 79aceca5 bellard
    uint16_t utmp = (value >> 8) & 0xFFFF;
49 79aceca5 bellard
    int16_t *tmp = &utmp;
50 79aceca5 bellard
51 79aceca5 bellard
    return (*tmp << 8) | (value & 0xFF);
52 79aceca5 bellard
}
53 79aceca5 bellard
54 79aceca5 bellard
#include "config.h"
55 79aceca5 bellard
#include <setjmp.h>
56 79aceca5 bellard
57 79aceca5 bellard
/* Floting point status and control register */
58 79aceca5 bellard
#define FPSCR_FX     31
59 79aceca5 bellard
#define FPSCR_FEX    30
60 79aceca5 bellard
#define FPSCR_VX     29
61 79aceca5 bellard
#define FPSCR_OX     28
62 79aceca5 bellard
#define FPSCR_UX     27
63 79aceca5 bellard
#define FPSCR_ZX     26
64 79aceca5 bellard
#define FPSCR_XX     25
65 79aceca5 bellard
#define FPSCR_VXSNAN 24
66 79aceca5 bellard
#define FPSCR_VXISI  26
67 79aceca5 bellard
#define FPSCR_VXIDI  25
68 79aceca5 bellard
#define FPSCR_VXZDZ  21
69 79aceca5 bellard
#define FPSCR_VXIMZ  20
70 79aceca5 bellard
71 79aceca5 bellard
#define FPSCR_VXVC   18
72 79aceca5 bellard
#define FPSCR_FR     17
73 79aceca5 bellard
#define FPSCR_FI     16
74 79aceca5 bellard
#define FPSCR_FPRF   11
75 79aceca5 bellard
#define FPSCR_VXSOFT 9
76 79aceca5 bellard
#define FPSCR_VXSQRT 8
77 79aceca5 bellard
#define FPSCR_VXCVI  7
78 79aceca5 bellard
#define FPSCR_OE     6
79 79aceca5 bellard
#define FPSCR_UE     5
80 79aceca5 bellard
#define FPSCR_ZE     4
81 79aceca5 bellard
#define FPSCR_XE     3
82 79aceca5 bellard
#define FPSCR_NI     2
83 79aceca5 bellard
#define FPSCR_RN     0
84 79aceca5 bellard
#define fpscr_fx     env->fpscr[FPSCR_FX]
85 79aceca5 bellard
#define fpscr_fex    env->fpscr[FPSCR_FEX]
86 79aceca5 bellard
#define fpscr_vx     env->fpscr[FPSCR_VX]
87 79aceca5 bellard
#define fpscr_ox     env->fpscr[FPSCR_OX]
88 79aceca5 bellard
#define fpscr_ux     env->fpscr[FPSCR_UX]
89 79aceca5 bellard
#define fpscr_zx     env->fpscr[FPSCR_ZX]
90 79aceca5 bellard
#define fpscr_xx     env->fpscr[FPSCR_XX]
91 79aceca5 bellard
#define fpscr_vsxnan env->fpscr[FPSCR_VXSNAN]
92 79aceca5 bellard
#define fpscr_vxisi  env->fpscr[FPSCR_VXISI]
93 79aceca5 bellard
#define fpscr_vxidi  env->fpscr[FPSCR_VXIDI]
94 79aceca5 bellard
#define fpscr_vxzdz  env->fpscr[FPSCR_VXZDZ]
95 79aceca5 bellard
#define fpscr_vximz  env->fpscr[FPSCR_VXIMZ]
96 79aceca5 bellard
#define fpscr_fr     env->fpscr[FPSCR_FR]
97 79aceca5 bellard
#define fpscr_fi     env->fpscr[FPSCR_FI]
98 79aceca5 bellard
#define fpscr_fprf   env->fpscr[FPSCR_FPRF]
99 79aceca5 bellard
#define fpscr_vxsoft env->fpscr[FPSCR_VXSOFT]
100 79aceca5 bellard
#define fpscr_vxsqrt env->fpscr[FPSCR_VXSQRT]
101 79aceca5 bellard
#define fpscr_oe     env->fpscr[FPSCR_OE]
102 79aceca5 bellard
#define fpscr_ue     env->fpscr[FPSCR_UE]
103 79aceca5 bellard
#define fpscr_ze     env->fpscr[FPSCR_ZE]
104 79aceca5 bellard
#define fpscr_xe     env->fpscr[FPSCR_XE]
105 79aceca5 bellard
#define fpscr_ni     env->fpscr[FPSCR_NI]
106 79aceca5 bellard
#define fpscr_rn     env->fpscr[FPSCR_RN]
107 79aceca5 bellard
108 79aceca5 bellard
/* Supervisor mode registers */
109 79aceca5 bellard
/* Machine state register */
110 79aceca5 bellard
#define MSR_POW 18
111 79aceca5 bellard
#define MSR_ILE 16
112 79aceca5 bellard
#define MSR_EE  15
113 79aceca5 bellard
#define MSR_PR  14
114 79aceca5 bellard
#define MSR_FP  13
115 79aceca5 bellard
#define MSR_ME  12
116 79aceca5 bellard
#define MSR_FE0 11
117 79aceca5 bellard
#define MSR_SE  10
118 79aceca5 bellard
#define MSR_BE  9
119 79aceca5 bellard
#define MSR_FE1 8
120 79aceca5 bellard
#define MSR_IP 6
121 79aceca5 bellard
#define MSR_IR 5
122 79aceca5 bellard
#define MSR_DR 4
123 79aceca5 bellard
#define MSR_RI 1
124 79aceca5 bellard
#define MSR_LE 0
125 79aceca5 bellard
#define msr_pow env->msr[MSR_POW]
126 79aceca5 bellard
#define msr_ile env->msr[MSR_ILE]
127 79aceca5 bellard
#define msr_ee  env->msr[MSR_EE]
128 79aceca5 bellard
#define msr_pr  env->msr[MSR_PR]
129 79aceca5 bellard
#define msr_fp  env->msr[MSR_FP]
130 79aceca5 bellard
#define msr_me  env->msr[MSR_ME]
131 79aceca5 bellard
#define msr_fe0 env->msr[MSR_FE0]
132 79aceca5 bellard
#define msr_se  env->msr[MSR_SE]
133 79aceca5 bellard
#define msr_be  env->msr[MSR_BE]
134 79aceca5 bellard
#define msr_fe1 env->msr[MSR_FE1]
135 79aceca5 bellard
#define msr_ip  env->msr[MSR_IP]
136 79aceca5 bellard
#define msr_ir  env->msr[MSR_IR]
137 79aceca5 bellard
#define msr_dr  env->msr[MSR_DR]
138 79aceca5 bellard
#define msr_ri  env->msr[MSR_RI]
139 79aceca5 bellard
#define msr_le  env->msr[MSR_LE]
140 79aceca5 bellard
141 79aceca5 bellard
/* Segment registers */
142 79aceca5 bellard
typedef struct ppc_sr_t {
143 79aceca5 bellard
    uint32_t t:1;
144 79aceca5 bellard
    uint32_t ks:1;
145 79aceca5 bellard
    uint32_t kp:1;
146 79aceca5 bellard
    uint32_t n:1;
147 79aceca5 bellard
    uint32_t res:4;
148 79aceca5 bellard
    uint32_t vsid:24;
149 79aceca5 bellard
} ppc_sr_t;
150 79aceca5 bellard
151 79aceca5 bellard
typedef struct CPUPPCState {
152 79aceca5 bellard
    /* general purpose registers */
153 79aceca5 bellard
    uint32_t gpr[32];
154 79aceca5 bellard
    /* floating point registers */
155 79aceca5 bellard
    uint64_t fpr[32];
156 79aceca5 bellard
    /* segment registers */
157 79aceca5 bellard
    ppc_sr_t sr[16];
158 79aceca5 bellard
    /* special purpose registers */
159 79aceca5 bellard
    uint32_t spr[1024];
160 79aceca5 bellard
    /* XER */
161 79aceca5 bellard
    uint8_t xer[32];
162 79aceca5 bellard
    /* Reservation address */
163 79aceca5 bellard
    uint32_t reserve;
164 79aceca5 bellard
    /* machine state register */
165 79aceca5 bellard
    uint8_t msr[32];
166 79aceca5 bellard
    /* condition register */
167 79aceca5 bellard
    uint8_t crf[8];
168 79aceca5 bellard
    /* floating point status and control register */
169 79aceca5 bellard
    uint8_t fpscr[32];
170 79aceca5 bellard
    uint32_t nip;
171 79aceca5 bellard
    /* CPU exception code */
172 79aceca5 bellard
    uint32_t exception;
173 79aceca5 bellard
174 79aceca5 bellard
    /* qemu dedicated */
175 28b6751f bellard
    uint64_t ft0; /* temporary float register */
176 79aceca5 bellard
    int interrupt_request;
177 79aceca5 bellard
    jmp_buf jmp_env;
178 79aceca5 bellard
    int exception_index;
179 79aceca5 bellard
    int error_code;
180 79aceca5 bellard
    int user_mode_only; /* user mode only simulation */
181 79aceca5 bellard
    struct TranslationBlock *current_tb; /* currently executing TB */
182 79aceca5 bellard
183 79aceca5 bellard
    /* user data */
184 79aceca5 bellard
    void *opaque;
185 79aceca5 bellard
} CPUPPCState;
186 79aceca5 bellard
187 79aceca5 bellard
CPUPPCState *cpu_ppc_init(void);
188 79aceca5 bellard
int cpu_ppc_exec(CPUPPCState *s);
189 79aceca5 bellard
void cpu_ppc_close(CPUPPCState *s);
190 79aceca5 bellard
/* you can call this signal handler from your SIGBUS and SIGSEGV
191 79aceca5 bellard
   signal handlers to inform the virtual CPU of exceptions. non zero
192 79aceca5 bellard
   is returned if the signal was handled by the virtual CPU.  */
193 79aceca5 bellard
struct siginfo;
194 79aceca5 bellard
int cpu_ppc_signal_handler(int host_signum, struct siginfo *info, 
195 79aceca5 bellard
                           void *puc);
196 79aceca5 bellard
197 79aceca5 bellard
void cpu_ppc_dump_state(CPUPPCState *env, FILE *f, int flags);
198 79aceca5 bellard
199 79aceca5 bellard
#define TARGET_PAGE_BITS 12
200 79aceca5 bellard
#include "cpu-all.h"
201 79aceca5 bellard
202 79aceca5 bellard
#define ugpr(n) (env->gpr[n])
203 79aceca5 bellard
#define fpr(n) (env->fpr[n])
204 79aceca5 bellard
205 79aceca5 bellard
#define SPR_ENCODE(sprn)                               \
206 79aceca5 bellard
(((sprn) >> 5) | (((sprn) & 0x1F) << 5))
207 79aceca5 bellard
208 79aceca5 bellard
/* User mode SPR */
209 79aceca5 bellard
#define spr(n) env->spr[n]
210 79aceca5 bellard
//#define XER    spr[1]
211 79aceca5 bellard
#define XER env->xer
212 79aceca5 bellard
#define XER_SO 31
213 79aceca5 bellard
#define XER_OV 30
214 79aceca5 bellard
#define XER_CA 29
215 79aceca5 bellard
#define XER_BC 0
216 79aceca5 bellard
#define xer_so env->xer[XER_SO]
217 79aceca5 bellard
#define xer_ov env->xer[XER_OV]
218 79aceca5 bellard
#define xer_ca env->xer[XER_CA]
219 79aceca5 bellard
#define xer_bc env->xer[XER_BC]
220 79aceca5 bellard
221 79aceca5 bellard
#define LR     spr[SPR_ENCODE(8)]
222 79aceca5 bellard
#define CTR    spr[SPR_ENCODE(9)]
223 79aceca5 bellard
/* VEA mode SPR */
224 79aceca5 bellard
#define V_TBL  spr[SPR_ENCODE(268)]
225 79aceca5 bellard
#define V_TBU  spr[SPR_ENCODE(269)]
226 79aceca5 bellard
/* supervisor mode SPR */
227 79aceca5 bellard
#define DSISR  spr[SPR_ENCODE(18)]
228 79aceca5 bellard
#define DAR    spr[SPR_ENCODE(19)]
229 79aceca5 bellard
#define DEC    spr[SPR_ENCODE(22)]
230 79aceca5 bellard
#define SDR1   spr[SPR_ENCODE(25)]
231 79aceca5 bellard
typedef struct ppc_sdr1_t {
232 79aceca5 bellard
    uint32_t htaborg:16;
233 79aceca5 bellard
    uint32_t res:7;
234 79aceca5 bellard
    uint32_t htabmask:9;
235 79aceca5 bellard
} ppc_sdr1_t;
236 79aceca5 bellard
#define SRR0   spr[SPR_ENCODE(26)]
237 79aceca5 bellard
#define SRR0_MASK 0xFFFFFFFC
238 79aceca5 bellard
#define SRR1   spr[SPR_ENCODE(27)]
239 79aceca5 bellard
#define SPRG0  spr[SPR_ENCODE(272)]
240 79aceca5 bellard
#define SPRG1  spr[SPR_ENCODE(273)]
241 79aceca5 bellard
#define SPRG2  spr[SPR_ENCODE(274)]
242 79aceca5 bellard
#define SPRG3  spr[SPR_ENCODE(275)]
243 79aceca5 bellard
#define EAR    spr[SPR_ENCODE(282)]
244 79aceca5 bellard
typedef struct ppc_ear_t {
245 79aceca5 bellard
    uint32_t e:1;
246 79aceca5 bellard
    uint32_t res:25;
247 79aceca5 bellard
    uint32_t rid:6;
248 79aceca5 bellard
} ppc_ear_t;
249 79aceca5 bellard
#define TBL    spr[SPR_ENCODE(284)]
250 79aceca5 bellard
#define TBU    spr[SPR_ENCODE(285)]
251 79aceca5 bellard
#define PVR    spr[SPR_ENCODE(287)]
252 79aceca5 bellard
typedef struct ppc_pvr_t {
253 79aceca5 bellard
    uint32_t version:16;
254 79aceca5 bellard
    uint32_t revision:16;
255 79aceca5 bellard
} ppc_pvr_t;
256 79aceca5 bellard
#define IBAT0U spr[SPR_ENCODE(528)]
257 79aceca5 bellard
#define IBAT0L spr[SPR_ENCODE(529)]
258 79aceca5 bellard
#define IBAT1U spr[SPR_ENCODE(530)]
259 79aceca5 bellard
#define IBAT1L spr[SPR_ENCODE(531)]
260 79aceca5 bellard
#define IBAT2U spr[SPR_ENCODE(532)]
261 79aceca5 bellard
#define IBAT2L spr[SPR_ENCODE(533)]
262 79aceca5 bellard
#define IBAT3U spr[SPR_ENCODE(534)]
263 79aceca5 bellard
#define IBAT3L spr[SPR_ENCODE(535)]
264 79aceca5 bellard
#define DBAT0U spr[SPR_ENCODE(536)]
265 79aceca5 bellard
#define DBAT0L spr[SPR_ENCODE(537)]
266 79aceca5 bellard
#define DBAT1U spr[SPR_ENCODE(538)]
267 79aceca5 bellard
#define DBAT1L spr[SPR_ENCODE(539)]
268 79aceca5 bellard
#define DBAT2U spr[SPR_ENCODE(540)]
269 79aceca5 bellard
#define DBAT2L spr[SPR_ENCODE(541)]
270 79aceca5 bellard
#define DBAT3U spr[SPR_ENCODE(542)]
271 79aceca5 bellard
#define DBAT3L spr[SPR_ENCODE(543)]
272 79aceca5 bellard
typedef struct ppc_ubat_t {
273 79aceca5 bellard
    uint32_t bepi:15;
274 79aceca5 bellard
    uint32_t res:4;
275 79aceca5 bellard
    uint32_t bl:11;
276 79aceca5 bellard
    uint32_t vs:1;
277 79aceca5 bellard
    uint32_t vp:1;
278 79aceca5 bellard
} ppc_ubat_t;
279 79aceca5 bellard
typedef struct ppc_lbat_t {
280 79aceca5 bellard
    uint32_t brpn:15;
281 79aceca5 bellard
    uint32_t res0:10;
282 79aceca5 bellard
    uint32_t w:1;
283 79aceca5 bellard
    uint32_t i:1;
284 79aceca5 bellard
    uint32_t m:1;
285 79aceca5 bellard
    uint32_t g:1;
286 79aceca5 bellard
    uint32_t res1:1;
287 79aceca5 bellard
    uint32_t pp:2;
288 79aceca5 bellard
} ppc_lbat_t;
289 79aceca5 bellard
#define DABR   spr[SPR_ENCODE(1013)]
290 79aceca5 bellard
#define DABR_MASK 0xFFFFFFF8
291 79aceca5 bellard
typedef struct ppc_dabr_t {
292 79aceca5 bellard
    uint32_t dab:29;
293 79aceca5 bellard
    uint32_t bt:1;
294 79aceca5 bellard
    uint32_t dw:1;
295 79aceca5 bellard
    uint32_t dr:1;
296 79aceca5 bellard
} ppc_dabr_t;
297 79aceca5 bellard
#define FPECR  spr[SPR_ENCODE(1022)]
298 79aceca5 bellard
#define PIR    spr[SPR_ENCODE(1023)]
299 79aceca5 bellard
300 79aceca5 bellard
#define TARGET_PAGE_BITS 12
301 79aceca5 bellard
#include "cpu-all.h"
302 79aceca5 bellard
303 79aceca5 bellard
CPUPPCState *cpu_ppc_init(void);
304 79aceca5 bellard
int cpu_ppc_exec(CPUPPCState *s);
305 79aceca5 bellard
void cpu_ppc_close(CPUPPCState *s);
306 79aceca5 bellard
void cpu_ppc_dump_state(CPUPPCState *env, FILE *f, int flags);
307 79aceca5 bellard
308 79aceca5 bellard
/* Exeptions */
309 79aceca5 bellard
enum {
310 79aceca5 bellard
    EXCP_NONE          = 0x00,
311 79aceca5 bellard
    /* PPC hardware exceptions : exception vector / 0x100 */
312 79aceca5 bellard
    EXCP_RESET         = 0x01, /* System reset                     */
313 79aceca5 bellard
    EXCP_MACHINE_CHECK = 0x02, /* Machine check exception          */
314 79aceca5 bellard
    EXCP_DSI           = 0x03, /* Impossible memory access         */
315 79aceca5 bellard
    EXCP_ISI           = 0x04, /* Impossible instruction fetch     */
316 79aceca5 bellard
    EXCP_EXTERNAL      = 0x05, /* External interruption            */
317 79aceca5 bellard
    EXCP_ALIGN         = 0x06, /* Alignment exception              */
318 79aceca5 bellard
    EXCP_PROGRAM       = 0x07, /* Program exception                */
319 79aceca5 bellard
    EXCP_NO_FP         = 0x08, /* No floating point                */
320 79aceca5 bellard
    EXCP_DECR          = 0x09, /* Decrementer exception            */
321 79aceca5 bellard
    EXCP_RESA          = 0x0A, /* Implementation specific          */
322 79aceca5 bellard
    EXCP_RESB          = 0x0B, /* Implementation specific          */
323 79aceca5 bellard
    EXCP_SYSCALL       = 0x0C, /* System call                      */
324 79aceca5 bellard
    EXCP_TRACE         = 0x0D, /* Trace exception (optional)       */
325 79aceca5 bellard
    EXCP_FP_ASSIST     = 0x0E, /* Floating-point assist (optional) */
326 79aceca5 bellard
#if 0
327 79aceca5 bellard
    /* Exeption subtypes for EXCP_DSI */
328 79aceca5 bellard
    EXCP_DSI_TRANSLATE = 0x10301, /* Data address can't be translated */
329 79aceca5 bellard
    EXCP_DSI_NOTSUP    = 0x10302, /* Access type not supported        */
330 79aceca5 bellard
    EXCP_DSI_PROT      = 0x10303, /* Memory protection violation      */
331 79aceca5 bellard
    EXCP_DSI_EXTERNAL  = 0x10304, /* External access disabled         */
332 79aceca5 bellard
    EXCP_DSI_DABR      = 0x10305, /* Data address breakpoint          */
333 79aceca5 bellard
    /* Exeption subtypes for EXCP_ISI */
334 79aceca5 bellard
    EXCP_ISI_TRANSLATE = 0x10401, /* Code address can't be translated */
335 79aceca5 bellard
    EXCP_ISI_NOTSUP    = 0x10402, /* Access type not supported        */
336 79aceca5 bellard
    EXCP_ISI_PROT      = 0x10403, /* Memory protection violation      */
337 79aceca5 bellard
    EXCP_ISI_GUARD     = 0x10404, /* Fetch into guarded memory        */
338 79aceca5 bellard
    /* Exeption subtypes for EXCP_ALIGN */
339 79aceca5 bellard
    EXCP_ALIGN_FP      = 0x10601, /* FP alignment exception           */
340 79aceca5 bellard
    EXCP_ALIGN_LST     = 0x10602, /* Unaligned memory load/store      */
341 79aceca5 bellard
    EXCP_ALIGN_LE      = 0x10603, /* Unaligned little-endian access   */
342 79aceca5 bellard
    EXCP_ALIGN_PROT    = 0x10604, /* Access cross protection boundary */
343 79aceca5 bellard
    EXCP_ALIGN_BAT     = 0x10605, /* Access cross a BAT/seg boundary  */
344 79aceca5 bellard
    EXCP_ALIGN_CACHE   = 0x10606, /* Impossible dcbz access           */
345 79aceca5 bellard
    /* Exeption subtypes for EXCP_PROGRAM */
346 79aceca5 bellard
    /* FP exceptions */
347 79aceca5 bellard
    EXCP_FP_OX         = 0x10701, /* FP overflow                      */
348 79aceca5 bellard
    EXCP_FP_UX         = 0x10702, /* FP underflow                     */
349 79aceca5 bellard
    EXCP_FP_ZX         = 0x10703, /* FP divide by zero                */
350 79aceca5 bellard
    EXCP_FP_XX         = 0x10704, /* FP inexact                       */
351 79aceca5 bellard
    EXCP_FP_VXNAN      = 0x10705, /* FP invalid SNaN op               */
352 79aceca5 bellard
    EXCP_FP_VXISI      = 0x10706, /* FP invalid infinite substraction */
353 79aceca5 bellard
    EXCP_FP_VXIDI      = 0x10707, /* FP invalid infinite divide       */
354 79aceca5 bellard
    EXCP_FP_VXZDZ      = 0x10708, /* FP invalid zero divide           */
355 79aceca5 bellard
    EXCP_FP_VXIMZ      = 0x10709, /* FP invalid infinite * zero       */
356 79aceca5 bellard
    EXCP_FP_VXVC       = 0x1070A, /* FP invalid compare               */
357 79aceca5 bellard
    EXCP_FP_VXSOFT     = 0x1070B, /* FP invalid operation             */
358 79aceca5 bellard
    EXCP_FP_VXSQRT     = 0x1070C, /* FP invalid square root           */
359 79aceca5 bellard
    EXCP_FP_VXCVI      = 0x1070D, /* FP invalid integer conversion    */
360 79aceca5 bellard
    /* Invalid instruction */
361 79aceca5 bellard
    EXCP_INVAL_INVAL   = 0x10711, /* Invalid instruction              */
362 79aceca5 bellard
    EXCP_INVAL_LSWX    = 0x10712, /* Invalid lswx instruction         */
363 79aceca5 bellard
    EXCP_INVAL_SPR     = 0x10713, /* Invalid SPR access               */
364 79aceca5 bellard
    EXCP_INVAL_FP      = 0x10714, /* Unimplemented mandatory fp instr */
365 79aceca5 bellard
#endif
366 79aceca5 bellard
    EXCP_INVAL         = 0x70,    /* Invalid instruction              */
367 79aceca5 bellard
    /* Privileged instruction */
368 79aceca5 bellard
    EXCP_PRIV          = 0x71,    /* Privileged instruction           */
369 79aceca5 bellard
    /* Trap */
370 79aceca5 bellard
    EXCP_TRAP          = 0x72,    /* Trap                             */
371 79aceca5 bellard
    /* Special cases where we want to stop translation */
372 79aceca5 bellard
    EXCP_MTMSR         = 0x103,   /* mtmsr instruction:               */
373 79aceca5 bellard
                                  /* may change privilege level       */
374 79aceca5 bellard
    EXCP_BRANCH        = 0x104,   /* branch instruction               */
375 79aceca5 bellard
};
376 79aceca5 bellard
377 79aceca5 bellard
/*
378 79aceca5 bellard
 * We need to put in some extra aux table entries to tell glibc what
379 79aceca5 bellard
 * the cache block size is, so it can use the dcbz instruction safely.
380 79aceca5 bellard
 */
381 79aceca5 bellard
#define AT_DCACHEBSIZE          19
382 79aceca5 bellard
#define AT_ICACHEBSIZE          20
383 79aceca5 bellard
#define AT_UCACHEBSIZE          21
384 79aceca5 bellard
/* A special ignored type value for PPC, for glibc compatibility.  */
385 79aceca5 bellard
#define AT_IGNOREPPC            22
386 79aceca5 bellard
/*
387 79aceca5 bellard
 * The requirements here are:
388 79aceca5 bellard
 * - keep the final alignment of sp (sp & 0xf)
389 79aceca5 bellard
 * - make sure the 32-bit value at the first 16 byte aligned position of
390 79aceca5 bellard
 *   AUXV is greater than 16 for glibc compatibility.
391 79aceca5 bellard
 *   AT_IGNOREPPC is used for that.
392 79aceca5 bellard
 * - for compatibility with glibc ARCH_DLINFO must always be defined on PPC,
393 79aceca5 bellard
 *   even if DLINFO_ARCH_ITEMS goes to zero or is undefined.
394 79aceca5 bellard
 */
395 79aceca5 bellard
#define DLINFO_ARCH_ITEMS       3
396 79aceca5 bellard
#define ARCH_DLINFO                                                     \
397 79aceca5 bellard
do {                                                                    \
398 79aceca5 bellard
        /*                                                              \
399 79aceca5 bellard
         * Now handle glibc compatibility.                              \
400 79aceca5 bellard
         */                                                             \
401 79aceca5 bellard
        NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC);                        \
402 79aceca5 bellard
        NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC);                        \
403 79aceca5 bellard
                                                                        \
404 79aceca5 bellard
        NEW_AUX_ENT(AT_DCACHEBSIZE, 0x20);                              \
405 79aceca5 bellard
        NEW_AUX_ENT(AT_ICACHEBSIZE, 0x20);                              \
406 79aceca5 bellard
        NEW_AUX_ENT(AT_UCACHEBSIZE, 0);                                 \
407 79aceca5 bellard
 } while (0)
408 79aceca5 bellard
#endif /* !defined (__CPU_PPC_H__) */