2 * PowerPC CPU initialization for qemu.
4 * Copyright (c) 2003-2007 Jocelyn Mayer
5 * Copyright 2011 Freescale Semiconductor, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library 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 GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #include "qemu/osdep.h"
22 #include "disas/bfd.h"
23 #include "exec/gdbstub.h"
24 #include <sysemu/kvm.h>
26 #include "sysemu/arch_init.h"
27 #include "sysemu/cpus.h"
28 #include "cpu-models.h"
29 #include "mmu-hash32.h"
30 #include "mmu-hash64.h"
31 #include "qemu/error-report.h"
32 #include "qapi/visitor.h"
33 #include "hw/qdev-properties.h"
35 //#define PPC_DUMP_CPU
36 //#define PPC_DEBUG_SPR
37 //#define PPC_DUMP_SPR_ACCESSES
38 /* #define USE_APPLE_GDB */
40 /* For user-mode emulation, we don't emulate any IRQ controller */
41 #if defined(CONFIG_USER_ONLY)
42 #define PPC_IRQ_INIT_FN(name) \
43 static inline void glue(glue(ppc, name),_irq_init) (CPUPPCState *env) \
47 #define PPC_IRQ_INIT_FN(name) \
48 void glue(glue(ppc, name),_irq_init) (CPUPPCState *env);
54 PPC_IRQ_INIT_FN(POWER7
);
55 PPC_IRQ_INIT_FN(e500
);
58 * do nothing but store/retrieve spr value
60 static void spr_load_dump_spr(int sprn
)
62 #ifdef PPC_DUMP_SPR_ACCESSES
63 TCGv_i32 t0
= tcg_const_i32(sprn
);
64 gen_helper_load_dump_spr(cpu_env
, t0
);
65 tcg_temp_free_i32(t0
);
69 static void spr_read_generic (DisasContext
*ctx
, int gprn
, int sprn
)
71 gen_load_spr(cpu_gpr
[gprn
], sprn
);
72 spr_load_dump_spr(sprn
);
75 static void spr_store_dump_spr(int sprn
)
77 #ifdef PPC_DUMP_SPR_ACCESSES
78 TCGv_i32 t0
= tcg_const_i32(sprn
);
79 gen_helper_store_dump_spr(cpu_env
, t0
);
80 tcg_temp_free_i32(t0
);
84 static void spr_write_generic (DisasContext
*ctx
, int sprn
, int gprn
)
86 gen_store_spr(sprn
, cpu_gpr
[gprn
]);
87 spr_store_dump_spr(sprn
);
90 #if !defined(CONFIG_USER_ONLY)
91 static void spr_write_generic32(DisasContext
*ctx
, int sprn
, int gprn
)
94 TCGv t0
= tcg_temp_new();
95 tcg_gen_ext32u_tl(t0
, cpu_gpr
[gprn
]);
96 gen_store_spr(sprn
, t0
);
98 spr_store_dump_spr(sprn
);
100 spr_write_generic(ctx
, sprn
, gprn
);
104 static void spr_write_clear (DisasContext
*ctx
, int sprn
, int gprn
)
106 TCGv t0
= tcg_temp_new();
107 TCGv t1
= tcg_temp_new();
108 gen_load_spr(t0
, sprn
);
109 tcg_gen_neg_tl(t1
, cpu_gpr
[gprn
]);
110 tcg_gen_and_tl(t0
, t0
, t1
);
111 gen_store_spr(sprn
, t0
);
116 static void spr_access_nop(DisasContext
*ctx
, int sprn
, int gprn
)
122 /* SPR common to all PowerPC */
124 static void spr_read_xer (DisasContext
*ctx
, int gprn
, int sprn
)
126 gen_read_xer(cpu_gpr
[gprn
]);
129 static void spr_write_xer (DisasContext
*ctx
, int sprn
, int gprn
)
131 gen_write_xer(cpu_gpr
[gprn
]);
135 static void spr_read_lr (DisasContext
*ctx
, int gprn
, int sprn
)
137 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_lr
);
140 static void spr_write_lr (DisasContext
*ctx
, int sprn
, int gprn
)
142 tcg_gen_mov_tl(cpu_lr
, cpu_gpr
[gprn
]);
146 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
147 static void spr_read_cfar (DisasContext
*ctx
, int gprn
, int sprn
)
149 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_cfar
);
152 static void spr_write_cfar (DisasContext
*ctx
, int sprn
, int gprn
)
154 tcg_gen_mov_tl(cpu_cfar
, cpu_gpr
[gprn
]);
156 #endif /* defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) */
159 static void spr_read_ctr (DisasContext
*ctx
, int gprn
, int sprn
)
161 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_ctr
);
164 static void spr_write_ctr (DisasContext
*ctx
, int sprn
, int gprn
)
166 tcg_gen_mov_tl(cpu_ctr
, cpu_gpr
[gprn
]);
169 /* User read access to SPR */
175 static void spr_read_ureg (DisasContext
*ctx
, int gprn
, int sprn
)
177 gen_load_spr(cpu_gpr
[gprn
], sprn
+ 0x10);
180 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
181 static void spr_write_ureg(DisasContext
*ctx
, int sprn
, int gprn
)
183 gen_store_spr(sprn
+ 0x10, cpu_gpr
[gprn
]);
187 /* SPR common to all non-embedded PowerPC */
189 #if !defined(CONFIG_USER_ONLY)
190 static void spr_read_decr (DisasContext
*ctx
, int gprn
, int sprn
)
192 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
195 gen_helper_load_decr(cpu_gpr
[gprn
], cpu_env
);
196 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
198 gen_stop_exception(ctx
);
202 static void spr_write_decr (DisasContext
*ctx
, int sprn
, int gprn
)
204 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
207 gen_helper_store_decr(cpu_env
, cpu_gpr
[gprn
]);
208 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
210 gen_stop_exception(ctx
);
215 /* SPR common to all non-embedded PowerPC, except 601 */
217 static void spr_read_tbl (DisasContext
*ctx
, int gprn
, int sprn
)
219 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
222 gen_helper_load_tbl(cpu_gpr
[gprn
], cpu_env
);
223 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
225 gen_stop_exception(ctx
);
229 static void spr_read_tbu (DisasContext
*ctx
, int gprn
, int sprn
)
231 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
234 gen_helper_load_tbu(cpu_gpr
[gprn
], cpu_env
);
235 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
237 gen_stop_exception(ctx
);
241 __attribute__ (( unused
))
242 static void spr_read_atbl (DisasContext
*ctx
, int gprn
, int sprn
)
244 gen_helper_load_atbl(cpu_gpr
[gprn
], cpu_env
);
247 __attribute__ (( unused
))
248 static void spr_read_atbu (DisasContext
*ctx
, int gprn
, int sprn
)
250 gen_helper_load_atbu(cpu_gpr
[gprn
], cpu_env
);
253 #if !defined(CONFIG_USER_ONLY)
254 static void spr_write_tbl (DisasContext
*ctx
, int sprn
, int gprn
)
256 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
259 gen_helper_store_tbl(cpu_env
, cpu_gpr
[gprn
]);
260 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
262 gen_stop_exception(ctx
);
266 static void spr_write_tbu (DisasContext
*ctx
, int sprn
, int gprn
)
268 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
271 gen_helper_store_tbu(cpu_env
, cpu_gpr
[gprn
]);
272 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
274 gen_stop_exception(ctx
);
278 __attribute__ (( unused
))
279 static void spr_write_atbl (DisasContext
*ctx
, int sprn
, int gprn
)
281 gen_helper_store_atbl(cpu_env
, cpu_gpr
[gprn
]);
284 __attribute__ (( unused
))
285 static void spr_write_atbu (DisasContext
*ctx
, int sprn
, int gprn
)
287 gen_helper_store_atbu(cpu_env
, cpu_gpr
[gprn
]);
290 #if defined(TARGET_PPC64)
291 __attribute__ (( unused
))
292 static void spr_read_purr (DisasContext
*ctx
, int gprn
, int sprn
)
294 gen_helper_load_purr(cpu_gpr
[gprn
], cpu_env
);
299 #if !defined(CONFIG_USER_ONLY)
300 /* IBAT0U...IBAT0U */
301 /* IBAT0L...IBAT7L */
302 static void spr_read_ibat (DisasContext
*ctx
, int gprn
, int sprn
)
304 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
307 static void spr_read_ibat_h (DisasContext
*ctx
, int gprn
, int sprn
)
309 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][((sprn
- SPR_IBAT4U
) / 2) + 4]));
312 static void spr_write_ibatu (DisasContext
*ctx
, int sprn
, int gprn
)
314 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
315 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
316 tcg_temp_free_i32(t0
);
319 static void spr_write_ibatu_h (DisasContext
*ctx
, int sprn
, int gprn
)
321 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4U
) / 2) + 4);
322 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
323 tcg_temp_free_i32(t0
);
326 static void spr_write_ibatl (DisasContext
*ctx
, int sprn
, int gprn
)
328 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0L
) / 2);
329 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
330 tcg_temp_free_i32(t0
);
333 static void spr_write_ibatl_h (DisasContext
*ctx
, int sprn
, int gprn
)
335 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4L
) / 2) + 4);
336 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
337 tcg_temp_free_i32(t0
);
340 /* DBAT0U...DBAT7U */
341 /* DBAT0L...DBAT7L */
342 static void spr_read_dbat (DisasContext
*ctx
, int gprn
, int sprn
)
344 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, DBAT
[sprn
& 1][(sprn
- SPR_DBAT0U
) / 2]));
347 static void spr_read_dbat_h (DisasContext
*ctx
, int gprn
, int sprn
)
349 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, DBAT
[sprn
& 1][((sprn
- SPR_DBAT4U
) / 2) + 4]));
352 static void spr_write_dbatu (DisasContext
*ctx
, int sprn
, int gprn
)
354 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0U
) / 2);
355 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
356 tcg_temp_free_i32(t0
);
359 static void spr_write_dbatu_h (DisasContext
*ctx
, int sprn
, int gprn
)
361 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4U
) / 2) + 4);
362 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
363 tcg_temp_free_i32(t0
);
366 static void spr_write_dbatl (DisasContext
*ctx
, int sprn
, int gprn
)
368 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0L
) / 2);
369 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
370 tcg_temp_free_i32(t0
);
373 static void spr_write_dbatl_h (DisasContext
*ctx
, int sprn
, int gprn
)
375 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4L
) / 2) + 4);
376 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
377 tcg_temp_free_i32(t0
);
381 static void spr_write_sdr1 (DisasContext
*ctx
, int sprn
, int gprn
)
383 gen_helper_store_sdr1(cpu_env
, cpu_gpr
[gprn
]);
386 /* 64 bits PowerPC specific SPRs */
387 #if defined(TARGET_PPC64)
388 static void spr_read_hior (DisasContext
*ctx
, int gprn
, int sprn
)
390 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
393 static void spr_write_hior (DisasContext
*ctx
, int sprn
, int gprn
)
395 TCGv t0
= tcg_temp_new();
396 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0x3FFFFF00000ULL
);
397 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
403 /* PowerPC 601 specific registers */
405 static void spr_read_601_rtcl (DisasContext
*ctx
, int gprn
, int sprn
)
407 gen_helper_load_601_rtcl(cpu_gpr
[gprn
], cpu_env
);
410 static void spr_read_601_rtcu (DisasContext
*ctx
, int gprn
, int sprn
)
412 gen_helper_load_601_rtcu(cpu_gpr
[gprn
], cpu_env
);
415 #if !defined(CONFIG_USER_ONLY)
416 static void spr_write_601_rtcu (DisasContext
*ctx
, int sprn
, int gprn
)
418 gen_helper_store_601_rtcu(cpu_env
, cpu_gpr
[gprn
]);
421 static void spr_write_601_rtcl (DisasContext
*ctx
, int sprn
, int gprn
)
423 gen_helper_store_601_rtcl(cpu_env
, cpu_gpr
[gprn
]);
426 static void spr_write_hid0_601 (DisasContext
*ctx
, int sprn
, int gprn
)
428 gen_helper_store_hid0_601(cpu_env
, cpu_gpr
[gprn
]);
429 /* Must stop the translation as endianness may have changed */
430 gen_stop_exception(ctx
);
435 #if !defined(CONFIG_USER_ONLY)
436 static void spr_read_601_ubat (DisasContext
*ctx
, int gprn
, int sprn
)
438 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
441 static void spr_write_601_ubatu (DisasContext
*ctx
, int sprn
, int gprn
)
443 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
444 gen_helper_store_601_batl(cpu_env
, t0
, cpu_gpr
[gprn
]);
445 tcg_temp_free_i32(t0
);
448 static void spr_write_601_ubatl (DisasContext
*ctx
, int sprn
, int gprn
)
450 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
451 gen_helper_store_601_batu(cpu_env
, t0
, cpu_gpr
[gprn
]);
452 tcg_temp_free_i32(t0
);
456 /* PowerPC 40x specific registers */
457 #if !defined(CONFIG_USER_ONLY)
458 static void spr_read_40x_pit (DisasContext
*ctx
, int gprn
, int sprn
)
460 gen_helper_load_40x_pit(cpu_gpr
[gprn
], cpu_env
);
463 static void spr_write_40x_pit (DisasContext
*ctx
, int sprn
, int gprn
)
465 gen_helper_store_40x_pit(cpu_env
, cpu_gpr
[gprn
]);
468 static void spr_write_40x_dbcr0 (DisasContext
*ctx
, int sprn
, int gprn
)
470 gen_helper_store_40x_dbcr0(cpu_env
, cpu_gpr
[gprn
]);
471 /* We must stop translation as we may have rebooted */
472 gen_stop_exception(ctx
);
475 static void spr_write_40x_sler (DisasContext
*ctx
, int sprn
, int gprn
)
477 gen_helper_store_40x_sler(cpu_env
, cpu_gpr
[gprn
]);
480 static void spr_write_booke_tcr (DisasContext
*ctx
, int sprn
, int gprn
)
482 gen_helper_store_booke_tcr(cpu_env
, cpu_gpr
[gprn
]);
485 static void spr_write_booke_tsr (DisasContext
*ctx
, int sprn
, int gprn
)
487 gen_helper_store_booke_tsr(cpu_env
, cpu_gpr
[gprn
]);
491 /* PowerPC 403 specific registers */
492 /* PBL1 / PBU1 / PBL2 / PBU2 */
493 #if !defined(CONFIG_USER_ONLY)
494 static void spr_read_403_pbr (DisasContext
*ctx
, int gprn
, int sprn
)
496 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, pb
[sprn
- SPR_403_PBL1
]));
499 static void spr_write_403_pbr (DisasContext
*ctx
, int sprn
, int gprn
)
501 TCGv_i32 t0
= tcg_const_i32(sprn
- SPR_403_PBL1
);
502 gen_helper_store_403_pbr(cpu_env
, t0
, cpu_gpr
[gprn
]);
503 tcg_temp_free_i32(t0
);
506 static void spr_write_pir (DisasContext
*ctx
, int sprn
, int gprn
)
508 TCGv t0
= tcg_temp_new();
509 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0xF);
510 gen_store_spr(SPR_PIR
, t0
);
515 /* SPE specific registers */
516 static void spr_read_spefscr (DisasContext
*ctx
, int gprn
, int sprn
)
518 TCGv_i32 t0
= tcg_temp_new_i32();
519 tcg_gen_ld_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
520 tcg_gen_extu_i32_tl(cpu_gpr
[gprn
], t0
);
521 tcg_temp_free_i32(t0
);
524 static void spr_write_spefscr (DisasContext
*ctx
, int sprn
, int gprn
)
526 TCGv_i32 t0
= tcg_temp_new_i32();
527 tcg_gen_trunc_tl_i32(t0
, cpu_gpr
[gprn
]);
528 tcg_gen_st_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
529 tcg_temp_free_i32(t0
);
532 #if !defined(CONFIG_USER_ONLY)
533 /* Callback used to write the exception vector base */
534 static void spr_write_excp_prefix (DisasContext
*ctx
, int sprn
, int gprn
)
536 TCGv t0
= tcg_temp_new();
537 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivpr_mask
));
538 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
539 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
540 gen_store_spr(sprn
, t0
);
544 static void spr_write_excp_vector (DisasContext
*ctx
, int sprn
, int gprn
)
548 if (sprn
>= SPR_BOOKE_IVOR0
&& sprn
<= SPR_BOOKE_IVOR15
) {
549 sprn_offs
= sprn
- SPR_BOOKE_IVOR0
;
550 } else if (sprn
>= SPR_BOOKE_IVOR32
&& sprn
<= SPR_BOOKE_IVOR37
) {
551 sprn_offs
= sprn
- SPR_BOOKE_IVOR32
+ 32;
552 } else if (sprn
>= SPR_BOOKE_IVOR38
&& sprn
<= SPR_BOOKE_IVOR42
) {
553 sprn_offs
= sprn
- SPR_BOOKE_IVOR38
+ 38;
555 printf("Trying to write an unknown exception vector %d %03x\n",
557 gen_inval_exception(ctx
, POWERPC_EXCP_PRIV_REG
);
561 TCGv t0
= tcg_temp_new();
562 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivor_mask
));
563 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
564 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_vectors
[sprn_offs
]));
565 gen_store_spr(sprn
, t0
);
570 static inline void vscr_init (CPUPPCState
*env
, uint32_t val
)
573 /* Altivec always uses round-to-nearest */
574 set_float_rounding_mode(float_round_nearest_even
, &env
->vec_status
);
575 set_flush_to_zero(vscr_nj
, &env
->vec_status
);
578 #ifdef CONFIG_USER_ONLY
579 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
580 oea_read, oea_write, one_reg_id, initial_value) \
581 _spr_register(env, num, name, uea_read, uea_write, initial_value)
583 #if !defined(CONFIG_KVM)
584 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
585 oea_read, oea_write, one_reg_id, initial_value) \
586 _spr_register(env, num, name, uea_read, uea_write, \
587 oea_read, oea_write, initial_value)
589 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
590 oea_read, oea_write, one_reg_id, initial_value) \
591 _spr_register(env, num, name, uea_read, uea_write, \
592 oea_read, oea_write, one_reg_id, initial_value)
596 #define spr_register(env, num, name, uea_read, uea_write, \
597 oea_read, oea_write, initial_value) \
598 spr_register_kvm(env, num, name, uea_read, uea_write, \
599 oea_read, oea_write, 0, initial_value)
601 static inline void _spr_register(CPUPPCState
*env
, int num
,
603 void (*uea_read
)(DisasContext
*ctx
, int gprn
, int sprn
),
604 void (*uea_write
)(DisasContext
*ctx
, int sprn
, int gprn
),
605 #if !defined(CONFIG_USER_ONLY)
607 void (*oea_read
)(DisasContext
*ctx
, int gprn
, int sprn
),
608 void (*oea_write
)(DisasContext
*ctx
, int sprn
, int gprn
),
610 #if defined(CONFIG_KVM)
613 target_ulong initial_value
)
617 spr
= &env
->spr_cb
[num
];
618 if (spr
->name
!= NULL
||env
-> spr
[num
] != 0x00000000 ||
619 #if !defined(CONFIG_USER_ONLY)
620 spr
->oea_read
!= NULL
|| spr
->oea_write
!= NULL
||
622 spr
->uea_read
!= NULL
|| spr
->uea_write
!= NULL
) {
623 printf("Error: Trying to register SPR %d (%03x) twice !\n", num
, num
);
626 #if defined(PPC_DEBUG_SPR)
627 printf("*** register spr %d (%03x) %s val " TARGET_FMT_lx
"\n", num
, num
,
628 name
, initial_value
);
631 spr
->uea_read
= uea_read
;
632 spr
->uea_write
= uea_write
;
633 #if !defined(CONFIG_USER_ONLY)
634 spr
->oea_read
= oea_read
;
635 spr
->oea_write
= oea_write
;
637 #if defined(CONFIG_KVM)
638 spr
->one_reg_id
= one_reg_id
,
640 env
->spr
[num
] = spr
->default_value
= initial_value
;
643 /* Generic PowerPC SPRs */
644 static void gen_spr_generic (CPUPPCState
*env
)
646 /* Integer processing */
647 spr_register(env
, SPR_XER
, "XER",
648 &spr_read_xer
, &spr_write_xer
,
649 &spr_read_xer
, &spr_write_xer
,
652 spr_register(env
, SPR_LR
, "LR",
653 &spr_read_lr
, &spr_write_lr
,
654 &spr_read_lr
, &spr_write_lr
,
656 spr_register(env
, SPR_CTR
, "CTR",
657 &spr_read_ctr
, &spr_write_ctr
,
658 &spr_read_ctr
, &spr_write_ctr
,
660 /* Interrupt processing */
661 spr_register(env
, SPR_SRR0
, "SRR0",
662 SPR_NOACCESS
, SPR_NOACCESS
,
663 &spr_read_generic
, &spr_write_generic
,
665 spr_register(env
, SPR_SRR1
, "SRR1",
666 SPR_NOACCESS
, SPR_NOACCESS
,
667 &spr_read_generic
, &spr_write_generic
,
669 /* Processor control */
670 spr_register(env
, SPR_SPRG0
, "SPRG0",
671 SPR_NOACCESS
, SPR_NOACCESS
,
672 &spr_read_generic
, &spr_write_generic
,
674 spr_register(env
, SPR_SPRG1
, "SPRG1",
675 SPR_NOACCESS
, SPR_NOACCESS
,
676 &spr_read_generic
, &spr_write_generic
,
678 spr_register(env
, SPR_SPRG2
, "SPRG2",
679 SPR_NOACCESS
, SPR_NOACCESS
,
680 &spr_read_generic
, &spr_write_generic
,
682 spr_register(env
, SPR_SPRG3
, "SPRG3",
683 SPR_NOACCESS
, SPR_NOACCESS
,
684 &spr_read_generic
, &spr_write_generic
,
688 /* SPR common to all non-embedded PowerPC, including 601 */
689 static void gen_spr_ne_601 (CPUPPCState
*env
)
691 /* Exception processing */
692 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
693 SPR_NOACCESS
, SPR_NOACCESS
,
694 &spr_read_generic
, &spr_write_generic
,
695 KVM_REG_PPC_DSISR
, 0x00000000);
696 spr_register_kvm(env
, SPR_DAR
, "DAR",
697 SPR_NOACCESS
, SPR_NOACCESS
,
698 &spr_read_generic
, &spr_write_generic
,
699 KVM_REG_PPC_DAR
, 0x00000000);
701 spr_register(env
, SPR_DECR
, "DECR",
702 SPR_NOACCESS
, SPR_NOACCESS
,
703 &spr_read_decr
, &spr_write_decr
,
705 /* Memory management */
706 spr_register(env
, SPR_SDR1
, "SDR1",
707 SPR_NOACCESS
, SPR_NOACCESS
,
708 &spr_read_generic
, &spr_write_sdr1
,
713 static void gen_low_BATs (CPUPPCState
*env
)
715 #if !defined(CONFIG_USER_ONLY)
716 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
717 SPR_NOACCESS
, SPR_NOACCESS
,
718 &spr_read_ibat
, &spr_write_ibatu
,
720 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
721 SPR_NOACCESS
, SPR_NOACCESS
,
722 &spr_read_ibat
, &spr_write_ibatl
,
724 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
725 SPR_NOACCESS
, SPR_NOACCESS
,
726 &spr_read_ibat
, &spr_write_ibatu
,
728 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
729 SPR_NOACCESS
, SPR_NOACCESS
,
730 &spr_read_ibat
, &spr_write_ibatl
,
732 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
733 SPR_NOACCESS
, SPR_NOACCESS
,
734 &spr_read_ibat
, &spr_write_ibatu
,
736 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
737 SPR_NOACCESS
, SPR_NOACCESS
,
738 &spr_read_ibat
, &spr_write_ibatl
,
740 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
741 SPR_NOACCESS
, SPR_NOACCESS
,
742 &spr_read_ibat
, &spr_write_ibatu
,
744 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
745 SPR_NOACCESS
, SPR_NOACCESS
,
746 &spr_read_ibat
, &spr_write_ibatl
,
748 spr_register(env
, SPR_DBAT0U
, "DBAT0U",
749 SPR_NOACCESS
, SPR_NOACCESS
,
750 &spr_read_dbat
, &spr_write_dbatu
,
752 spr_register(env
, SPR_DBAT0L
, "DBAT0L",
753 SPR_NOACCESS
, SPR_NOACCESS
,
754 &spr_read_dbat
, &spr_write_dbatl
,
756 spr_register(env
, SPR_DBAT1U
, "DBAT1U",
757 SPR_NOACCESS
, SPR_NOACCESS
,
758 &spr_read_dbat
, &spr_write_dbatu
,
760 spr_register(env
, SPR_DBAT1L
, "DBAT1L",
761 SPR_NOACCESS
, SPR_NOACCESS
,
762 &spr_read_dbat
, &spr_write_dbatl
,
764 spr_register(env
, SPR_DBAT2U
, "DBAT2U",
765 SPR_NOACCESS
, SPR_NOACCESS
,
766 &spr_read_dbat
, &spr_write_dbatu
,
768 spr_register(env
, SPR_DBAT2L
, "DBAT2L",
769 SPR_NOACCESS
, SPR_NOACCESS
,
770 &spr_read_dbat
, &spr_write_dbatl
,
772 spr_register(env
, SPR_DBAT3U
, "DBAT3U",
773 SPR_NOACCESS
, SPR_NOACCESS
,
774 &spr_read_dbat
, &spr_write_dbatu
,
776 spr_register(env
, SPR_DBAT3L
, "DBAT3L",
777 SPR_NOACCESS
, SPR_NOACCESS
,
778 &spr_read_dbat
, &spr_write_dbatl
,
785 static void gen_high_BATs (CPUPPCState
*env
)
787 #if !defined(CONFIG_USER_ONLY)
788 spr_register(env
, SPR_IBAT4U
, "IBAT4U",
789 SPR_NOACCESS
, SPR_NOACCESS
,
790 &spr_read_ibat_h
, &spr_write_ibatu_h
,
792 spr_register(env
, SPR_IBAT4L
, "IBAT4L",
793 SPR_NOACCESS
, SPR_NOACCESS
,
794 &spr_read_ibat_h
, &spr_write_ibatl_h
,
796 spr_register(env
, SPR_IBAT5U
, "IBAT5U",
797 SPR_NOACCESS
, SPR_NOACCESS
,
798 &spr_read_ibat_h
, &spr_write_ibatu_h
,
800 spr_register(env
, SPR_IBAT5L
, "IBAT5L",
801 SPR_NOACCESS
, SPR_NOACCESS
,
802 &spr_read_ibat_h
, &spr_write_ibatl_h
,
804 spr_register(env
, SPR_IBAT6U
, "IBAT6U",
805 SPR_NOACCESS
, SPR_NOACCESS
,
806 &spr_read_ibat_h
, &spr_write_ibatu_h
,
808 spr_register(env
, SPR_IBAT6L
, "IBAT6L",
809 SPR_NOACCESS
, SPR_NOACCESS
,
810 &spr_read_ibat_h
, &spr_write_ibatl_h
,
812 spr_register(env
, SPR_IBAT7U
, "IBAT7U",
813 SPR_NOACCESS
, SPR_NOACCESS
,
814 &spr_read_ibat_h
, &spr_write_ibatu_h
,
816 spr_register(env
, SPR_IBAT7L
, "IBAT7L",
817 SPR_NOACCESS
, SPR_NOACCESS
,
818 &spr_read_ibat_h
, &spr_write_ibatl_h
,
820 spr_register(env
, SPR_DBAT4U
, "DBAT4U",
821 SPR_NOACCESS
, SPR_NOACCESS
,
822 &spr_read_dbat_h
, &spr_write_dbatu_h
,
824 spr_register(env
, SPR_DBAT4L
, "DBAT4L",
825 SPR_NOACCESS
, SPR_NOACCESS
,
826 &spr_read_dbat_h
, &spr_write_dbatl_h
,
828 spr_register(env
, SPR_DBAT5U
, "DBAT5U",
829 SPR_NOACCESS
, SPR_NOACCESS
,
830 &spr_read_dbat_h
, &spr_write_dbatu_h
,
832 spr_register(env
, SPR_DBAT5L
, "DBAT5L",
833 SPR_NOACCESS
, SPR_NOACCESS
,
834 &spr_read_dbat_h
, &spr_write_dbatl_h
,
836 spr_register(env
, SPR_DBAT6U
, "DBAT6U",
837 SPR_NOACCESS
, SPR_NOACCESS
,
838 &spr_read_dbat_h
, &spr_write_dbatu_h
,
840 spr_register(env
, SPR_DBAT6L
, "DBAT6L",
841 SPR_NOACCESS
, SPR_NOACCESS
,
842 &spr_read_dbat_h
, &spr_write_dbatl_h
,
844 spr_register(env
, SPR_DBAT7U
, "DBAT7U",
845 SPR_NOACCESS
, SPR_NOACCESS
,
846 &spr_read_dbat_h
, &spr_write_dbatu_h
,
848 spr_register(env
, SPR_DBAT7L
, "DBAT7L",
849 SPR_NOACCESS
, SPR_NOACCESS
,
850 &spr_read_dbat_h
, &spr_write_dbatl_h
,
856 /* Generic PowerPC time base */
857 static void gen_tbl (CPUPPCState
*env
)
859 spr_register(env
, SPR_VTBL
, "TBL",
860 &spr_read_tbl
, SPR_NOACCESS
,
861 &spr_read_tbl
, SPR_NOACCESS
,
863 spr_register(env
, SPR_TBL
, "TBL",
864 &spr_read_tbl
, SPR_NOACCESS
,
865 &spr_read_tbl
, &spr_write_tbl
,
867 spr_register(env
, SPR_VTBU
, "TBU",
868 &spr_read_tbu
, SPR_NOACCESS
,
869 &spr_read_tbu
, SPR_NOACCESS
,
871 spr_register(env
, SPR_TBU
, "TBU",
872 &spr_read_tbu
, SPR_NOACCESS
,
873 &spr_read_tbu
, &spr_write_tbu
,
877 /* Softare table search registers */
878 static void gen_6xx_7xx_soft_tlb (CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
880 #if !defined(CONFIG_USER_ONLY)
881 env
->nb_tlb
= nb_tlbs
;
882 env
->nb_ways
= nb_ways
;
884 env
->tlb_type
= TLB_6XX
;
885 spr_register(env
, SPR_DMISS
, "DMISS",
886 SPR_NOACCESS
, SPR_NOACCESS
,
887 &spr_read_generic
, SPR_NOACCESS
,
889 spr_register(env
, SPR_DCMP
, "DCMP",
890 SPR_NOACCESS
, SPR_NOACCESS
,
891 &spr_read_generic
, SPR_NOACCESS
,
893 spr_register(env
, SPR_HASH1
, "HASH1",
894 SPR_NOACCESS
, SPR_NOACCESS
,
895 &spr_read_generic
, SPR_NOACCESS
,
897 spr_register(env
, SPR_HASH2
, "HASH2",
898 SPR_NOACCESS
, SPR_NOACCESS
,
899 &spr_read_generic
, SPR_NOACCESS
,
901 spr_register(env
, SPR_IMISS
, "IMISS",
902 SPR_NOACCESS
, SPR_NOACCESS
,
903 &spr_read_generic
, SPR_NOACCESS
,
905 spr_register(env
, SPR_ICMP
, "ICMP",
906 SPR_NOACCESS
, SPR_NOACCESS
,
907 &spr_read_generic
, SPR_NOACCESS
,
909 spr_register(env
, SPR_RPA
, "RPA",
910 SPR_NOACCESS
, SPR_NOACCESS
,
911 &spr_read_generic
, &spr_write_generic
,
916 /* SPR common to MPC755 and G2 */
917 static void gen_spr_G2_755 (CPUPPCState
*env
)
920 spr_register(env
, SPR_SPRG4
, "SPRG4",
921 SPR_NOACCESS
, SPR_NOACCESS
,
922 &spr_read_generic
, &spr_write_generic
,
924 spr_register(env
, SPR_SPRG5
, "SPRG5",
925 SPR_NOACCESS
, SPR_NOACCESS
,
926 &spr_read_generic
, &spr_write_generic
,
928 spr_register(env
, SPR_SPRG6
, "SPRG6",
929 SPR_NOACCESS
, SPR_NOACCESS
,
930 &spr_read_generic
, &spr_write_generic
,
932 spr_register(env
, SPR_SPRG7
, "SPRG7",
933 SPR_NOACCESS
, SPR_NOACCESS
,
934 &spr_read_generic
, &spr_write_generic
,
938 /* SPR common to all 7xx PowerPC implementations */
939 static void gen_spr_7xx (CPUPPCState
*env
)
942 /* XXX : not implemented */
943 spr_register_kvm(env
, SPR_DABR
, "DABR",
944 SPR_NOACCESS
, SPR_NOACCESS
,
945 &spr_read_generic
, &spr_write_generic
,
946 KVM_REG_PPC_DABR
, 0x00000000);
947 /* XXX : not implemented */
948 spr_register(env
, SPR_IABR
, "IABR",
949 SPR_NOACCESS
, SPR_NOACCESS
,
950 &spr_read_generic
, &spr_write_generic
,
952 /* Cache management */
953 /* XXX : not implemented */
954 spr_register(env
, SPR_ICTC
, "ICTC",
955 SPR_NOACCESS
, SPR_NOACCESS
,
956 &spr_read_generic
, &spr_write_generic
,
958 /* Performance monitors */
959 /* XXX : not implemented */
960 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
961 SPR_NOACCESS
, SPR_NOACCESS
,
962 &spr_read_generic
, &spr_write_generic
,
964 /* XXX : not implemented */
965 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
966 SPR_NOACCESS
, SPR_NOACCESS
,
967 &spr_read_generic
, &spr_write_generic
,
969 /* XXX : not implemented */
970 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
971 SPR_NOACCESS
, SPR_NOACCESS
,
972 &spr_read_generic
, &spr_write_generic
,
974 /* XXX : not implemented */
975 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
976 SPR_NOACCESS
, SPR_NOACCESS
,
977 &spr_read_generic
, &spr_write_generic
,
979 /* XXX : not implemented */
980 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
981 SPR_NOACCESS
, SPR_NOACCESS
,
982 &spr_read_generic
, &spr_write_generic
,
984 /* XXX : not implemented */
985 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
986 SPR_NOACCESS
, SPR_NOACCESS
,
987 &spr_read_generic
, &spr_write_generic
,
989 /* XXX : not implemented */
990 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
991 SPR_NOACCESS
, SPR_NOACCESS
,
992 &spr_read_generic
, SPR_NOACCESS
,
994 /* XXX : not implemented */
995 spr_register(env
, SPR_7XX_UMMCR0
, "UMMCR0",
996 &spr_read_ureg
, SPR_NOACCESS
,
997 &spr_read_ureg
, SPR_NOACCESS
,
999 /* XXX : not implemented */
1000 spr_register(env
, SPR_7XX_UMMCR1
, "UMMCR1",
1001 &spr_read_ureg
, SPR_NOACCESS
,
1002 &spr_read_ureg
, SPR_NOACCESS
,
1004 /* XXX : not implemented */
1005 spr_register(env
, SPR_7XX_UPMC1
, "UPMC1",
1006 &spr_read_ureg
, SPR_NOACCESS
,
1007 &spr_read_ureg
, SPR_NOACCESS
,
1009 /* XXX : not implemented */
1010 spr_register(env
, SPR_7XX_UPMC2
, "UPMC2",
1011 &spr_read_ureg
, SPR_NOACCESS
,
1012 &spr_read_ureg
, SPR_NOACCESS
,
1014 /* XXX : not implemented */
1015 spr_register(env
, SPR_7XX_UPMC3
, "UPMC3",
1016 &spr_read_ureg
, SPR_NOACCESS
,
1017 &spr_read_ureg
, SPR_NOACCESS
,
1019 /* XXX : not implemented */
1020 spr_register(env
, SPR_7XX_UPMC4
, "UPMC4",
1021 &spr_read_ureg
, SPR_NOACCESS
,
1022 &spr_read_ureg
, SPR_NOACCESS
,
1024 /* XXX : not implemented */
1025 spr_register(env
, SPR_7XX_USIAR
, "USIAR",
1026 &spr_read_ureg
, SPR_NOACCESS
,
1027 &spr_read_ureg
, SPR_NOACCESS
,
1029 /* External access control */
1030 /* XXX : not implemented */
1031 spr_register(env
, SPR_EAR
, "EAR",
1032 SPR_NOACCESS
, SPR_NOACCESS
,
1033 &spr_read_generic
, &spr_write_generic
,
1038 #ifndef CONFIG_USER_ONLY
1039 static void spr_read_uamr (DisasContext
*ctx
, int gprn
, int sprn
)
1041 gen_load_spr(cpu_gpr
[gprn
], SPR_AMR
);
1042 spr_load_dump_spr(SPR_AMR
);
1045 static void spr_write_uamr (DisasContext
*ctx
, int sprn
, int gprn
)
1047 gen_store_spr(SPR_AMR
, cpu_gpr
[gprn
]);
1048 spr_store_dump_spr(SPR_AMR
);
1051 static void spr_write_uamr_pr (DisasContext
*ctx
, int sprn
, int gprn
)
1053 TCGv t0
= tcg_temp_new();
1055 gen_load_spr(t0
, SPR_UAMOR
);
1056 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
1057 gen_store_spr(SPR_AMR
, t0
);
1058 spr_store_dump_spr(SPR_AMR
);
1060 #endif /* CONFIG_USER_ONLY */
1062 static void gen_spr_amr (CPUPPCState
*env
)
1064 #ifndef CONFIG_USER_ONLY
1065 /* Virtual Page Class Key protection */
1066 /* The AMR is accessible either via SPR 13 or SPR 29. 13 is
1067 * userspace accessible, 29 is privileged. So we only need to set
1068 * the kvm ONE_REG id on one of them, we use 29 */
1069 spr_register(env
, SPR_UAMR
, "UAMR",
1070 &spr_read_uamr
, &spr_write_uamr_pr
,
1071 &spr_read_uamr
, &spr_write_uamr
,
1073 spr_register_kvm(env
, SPR_AMR
, "AMR",
1074 SPR_NOACCESS
, SPR_NOACCESS
,
1075 &spr_read_generic
, &spr_write_generic
,
1076 KVM_REG_PPC_AMR
, 0);
1077 spr_register_kvm(env
, SPR_UAMOR
, "UAMOR",
1078 SPR_NOACCESS
, SPR_NOACCESS
,
1079 &spr_read_generic
, &spr_write_generic
,
1080 KVM_REG_PPC_UAMOR
, 0);
1081 #endif /* !CONFIG_USER_ONLY */
1083 #endif /* TARGET_PPC64 */
1085 static void gen_spr_thrm (CPUPPCState
*env
)
1087 /* Thermal management */
1088 /* XXX : not implemented */
1089 spr_register(env
, SPR_THRM1
, "THRM1",
1090 SPR_NOACCESS
, SPR_NOACCESS
,
1091 &spr_read_generic
, &spr_write_generic
,
1093 /* XXX : not implemented */
1094 spr_register(env
, SPR_THRM2
, "THRM2",
1095 SPR_NOACCESS
, SPR_NOACCESS
,
1096 &spr_read_generic
, &spr_write_generic
,
1098 /* XXX : not implemented */
1099 spr_register(env
, SPR_THRM3
, "THRM3",
1100 SPR_NOACCESS
, SPR_NOACCESS
,
1101 &spr_read_generic
, &spr_write_generic
,
1105 /* SPR specific to PowerPC 604 implementation */
1106 static void gen_spr_604 (CPUPPCState
*env
)
1108 /* Processor identification */
1109 spr_register(env
, SPR_PIR
, "PIR",
1110 SPR_NOACCESS
, SPR_NOACCESS
,
1111 &spr_read_generic
, &spr_write_pir
,
1114 /* XXX : not implemented */
1115 spr_register(env
, SPR_IABR
, "IABR",
1116 SPR_NOACCESS
, SPR_NOACCESS
,
1117 &spr_read_generic
, &spr_write_generic
,
1119 /* XXX : not implemented */
1120 spr_register_kvm(env
, SPR_DABR
, "DABR",
1121 SPR_NOACCESS
, SPR_NOACCESS
,
1122 &spr_read_generic
, &spr_write_generic
,
1123 KVM_REG_PPC_DABR
, 0x00000000);
1124 /* Performance counters */
1125 /* XXX : not implemented */
1126 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
1127 SPR_NOACCESS
, SPR_NOACCESS
,
1128 &spr_read_generic
, &spr_write_generic
,
1130 /* XXX : not implemented */
1131 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
1132 SPR_NOACCESS
, SPR_NOACCESS
,
1133 &spr_read_generic
, &spr_write_generic
,
1135 /* XXX : not implemented */
1136 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
1137 SPR_NOACCESS
, SPR_NOACCESS
,
1138 &spr_read_generic
, &spr_write_generic
,
1140 /* XXX : not implemented */
1141 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
1142 SPR_NOACCESS
, SPR_NOACCESS
,
1143 &spr_read_generic
, SPR_NOACCESS
,
1145 /* XXX : not implemented */
1146 spr_register(env
, SPR_SDA
, "SDA",
1147 SPR_NOACCESS
, SPR_NOACCESS
,
1148 &spr_read_generic
, SPR_NOACCESS
,
1150 /* External access control */
1151 /* XXX : not implemented */
1152 spr_register(env
, SPR_EAR
, "EAR",
1153 SPR_NOACCESS
, SPR_NOACCESS
,
1154 &spr_read_generic
, &spr_write_generic
,
1158 /* SPR specific to PowerPC 603 implementation */
1159 static void gen_spr_603 (CPUPPCState
*env
)
1161 /* External access control */
1162 /* XXX : not implemented */
1163 spr_register(env
, SPR_EAR
, "EAR",
1164 SPR_NOACCESS
, SPR_NOACCESS
,
1165 &spr_read_generic
, &spr_write_generic
,
1168 /* XXX : not implemented */
1169 spr_register(env
, SPR_IABR
, "IABR",
1170 SPR_NOACCESS
, SPR_NOACCESS
,
1171 &spr_read_generic
, &spr_write_generic
,
1176 /* SPR specific to PowerPC G2 implementation */
1177 static void gen_spr_G2 (CPUPPCState
*env
)
1179 /* Memory base address */
1181 /* XXX : not implemented */
1182 spr_register(env
, SPR_MBAR
, "MBAR",
1183 SPR_NOACCESS
, SPR_NOACCESS
,
1184 &spr_read_generic
, &spr_write_generic
,
1186 /* Exception processing */
1187 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1188 SPR_NOACCESS
, SPR_NOACCESS
,
1189 &spr_read_generic
, &spr_write_generic
,
1191 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1192 SPR_NOACCESS
, SPR_NOACCESS
,
1193 &spr_read_generic
, &spr_write_generic
,
1196 /* XXX : not implemented */
1197 spr_register(env
, SPR_DABR
, "DABR",
1198 SPR_NOACCESS
, SPR_NOACCESS
,
1199 &spr_read_generic
, &spr_write_generic
,
1201 /* XXX : not implemented */
1202 spr_register(env
, SPR_DABR2
, "DABR2",
1203 SPR_NOACCESS
, SPR_NOACCESS
,
1204 &spr_read_generic
, &spr_write_generic
,
1206 /* XXX : not implemented */
1207 spr_register(env
, SPR_IABR
, "IABR",
1208 SPR_NOACCESS
, SPR_NOACCESS
,
1209 &spr_read_generic
, &spr_write_generic
,
1211 /* XXX : not implemented */
1212 spr_register(env
, SPR_IABR2
, "IABR2",
1213 SPR_NOACCESS
, SPR_NOACCESS
,
1214 &spr_read_generic
, &spr_write_generic
,
1216 /* XXX : not implemented */
1217 spr_register(env
, SPR_IBCR
, "IBCR",
1218 SPR_NOACCESS
, SPR_NOACCESS
,
1219 &spr_read_generic
, &spr_write_generic
,
1221 /* XXX : not implemented */
1222 spr_register(env
, SPR_DBCR
, "DBCR",
1223 SPR_NOACCESS
, SPR_NOACCESS
,
1224 &spr_read_generic
, &spr_write_generic
,
1228 /* SPR specific to PowerPC 602 implementation */
1229 static void gen_spr_602 (CPUPPCState
*env
)
1232 /* XXX : not implemented */
1233 spr_register(env
, SPR_SER
, "SER",
1234 SPR_NOACCESS
, SPR_NOACCESS
,
1235 &spr_read_generic
, &spr_write_generic
,
1237 /* XXX : not implemented */
1238 spr_register(env
, SPR_SEBR
, "SEBR",
1239 SPR_NOACCESS
, SPR_NOACCESS
,
1240 &spr_read_generic
, &spr_write_generic
,
1242 /* XXX : not implemented */
1243 spr_register(env
, SPR_ESASRR
, "ESASRR",
1244 SPR_NOACCESS
, SPR_NOACCESS
,
1245 &spr_read_generic
, &spr_write_generic
,
1247 /* Floating point status */
1248 /* XXX : not implemented */
1249 spr_register(env
, SPR_SP
, "SP",
1250 SPR_NOACCESS
, SPR_NOACCESS
,
1251 &spr_read_generic
, &spr_write_generic
,
1253 /* XXX : not implemented */
1254 spr_register(env
, SPR_LT
, "LT",
1255 SPR_NOACCESS
, SPR_NOACCESS
,
1256 &spr_read_generic
, &spr_write_generic
,
1258 /* Watchdog timer */
1259 /* XXX : not implemented */
1260 spr_register(env
, SPR_TCR
, "TCR",
1261 SPR_NOACCESS
, SPR_NOACCESS
,
1262 &spr_read_generic
, &spr_write_generic
,
1264 /* Interrupt base */
1265 spr_register(env
, SPR_IBR
, "IBR",
1266 SPR_NOACCESS
, SPR_NOACCESS
,
1267 &spr_read_generic
, &spr_write_generic
,
1269 /* XXX : not implemented */
1270 spr_register(env
, SPR_IABR
, "IABR",
1271 SPR_NOACCESS
, SPR_NOACCESS
,
1272 &spr_read_generic
, &spr_write_generic
,
1276 /* SPR specific to PowerPC 601 implementation */
1277 static void gen_spr_601 (CPUPPCState
*env
)
1279 /* Multiplication/division register */
1281 spr_register(env
, SPR_MQ
, "MQ",
1282 &spr_read_generic
, &spr_write_generic
,
1283 &spr_read_generic
, &spr_write_generic
,
1286 spr_register(env
, SPR_601_RTCU
, "RTCU",
1287 SPR_NOACCESS
, SPR_NOACCESS
,
1288 SPR_NOACCESS
, &spr_write_601_rtcu
,
1290 spr_register(env
, SPR_601_VRTCU
, "RTCU",
1291 &spr_read_601_rtcu
, SPR_NOACCESS
,
1292 &spr_read_601_rtcu
, SPR_NOACCESS
,
1294 spr_register(env
, SPR_601_RTCL
, "RTCL",
1295 SPR_NOACCESS
, SPR_NOACCESS
,
1296 SPR_NOACCESS
, &spr_write_601_rtcl
,
1298 spr_register(env
, SPR_601_VRTCL
, "RTCL",
1299 &spr_read_601_rtcl
, SPR_NOACCESS
,
1300 &spr_read_601_rtcl
, SPR_NOACCESS
,
1304 spr_register(env
, SPR_601_UDECR
, "UDECR",
1305 &spr_read_decr
, SPR_NOACCESS
,
1306 &spr_read_decr
, SPR_NOACCESS
,
1309 /* External access control */
1310 /* XXX : not implemented */
1311 spr_register(env
, SPR_EAR
, "EAR",
1312 SPR_NOACCESS
, SPR_NOACCESS
,
1313 &spr_read_generic
, &spr_write_generic
,
1315 /* Memory management */
1316 #if !defined(CONFIG_USER_ONLY)
1317 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
1318 SPR_NOACCESS
, SPR_NOACCESS
,
1319 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1321 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
1322 SPR_NOACCESS
, SPR_NOACCESS
,
1323 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1325 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
1326 SPR_NOACCESS
, SPR_NOACCESS
,
1327 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1329 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
1330 SPR_NOACCESS
, SPR_NOACCESS
,
1331 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1333 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
1334 SPR_NOACCESS
, SPR_NOACCESS
,
1335 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1337 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
1338 SPR_NOACCESS
, SPR_NOACCESS
,
1339 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1341 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
1342 SPR_NOACCESS
, SPR_NOACCESS
,
1343 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1345 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
1346 SPR_NOACCESS
, SPR_NOACCESS
,
1347 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1353 static void gen_spr_74xx (CPUPPCState
*env
)
1355 /* Processor identification */
1356 spr_register(env
, SPR_PIR
, "PIR",
1357 SPR_NOACCESS
, SPR_NOACCESS
,
1358 &spr_read_generic
, &spr_write_pir
,
1360 /* XXX : not implemented */
1361 spr_register(env
, SPR_74XX_MMCR2
, "MMCR2",
1362 SPR_NOACCESS
, SPR_NOACCESS
,
1363 &spr_read_generic
, &spr_write_generic
,
1365 /* XXX : not implemented */
1366 spr_register(env
, SPR_74XX_UMMCR2
, "UMMCR2",
1367 &spr_read_ureg
, SPR_NOACCESS
,
1368 &spr_read_ureg
, SPR_NOACCESS
,
1370 /* XXX: not implemented */
1371 spr_register(env
, SPR_BAMR
, "BAMR",
1372 SPR_NOACCESS
, SPR_NOACCESS
,
1373 &spr_read_generic
, &spr_write_generic
,
1375 /* XXX : not implemented */
1376 spr_register(env
, SPR_MSSCR0
, "MSSCR0",
1377 SPR_NOACCESS
, SPR_NOACCESS
,
1378 &spr_read_generic
, &spr_write_generic
,
1380 /* Hardware implementation registers */
1381 /* XXX : not implemented */
1382 spr_register(env
, SPR_HID0
, "HID0",
1383 SPR_NOACCESS
, SPR_NOACCESS
,
1384 &spr_read_generic
, &spr_write_generic
,
1386 /* XXX : not implemented */
1387 spr_register(env
, SPR_HID1
, "HID1",
1388 SPR_NOACCESS
, SPR_NOACCESS
,
1389 &spr_read_generic
, &spr_write_generic
,
1392 spr_register(env
, SPR_VRSAVE
, "VRSAVE",
1393 &spr_read_generic
, &spr_write_generic
,
1394 &spr_read_generic
, &spr_write_generic
,
1396 /* XXX : not implemented */
1397 spr_register(env
, SPR_L2CR
, "L2CR",
1398 SPR_NOACCESS
, SPR_NOACCESS
,
1399 &spr_read_generic
, spr_access_nop
,
1401 /* Not strictly an SPR */
1402 vscr_init(env
, 0x00010000);
1405 static void gen_l3_ctrl (CPUPPCState
*env
)
1408 /* XXX : not implemented */
1409 spr_register(env
, SPR_L3CR
, "L3CR",
1410 SPR_NOACCESS
, SPR_NOACCESS
,
1411 &spr_read_generic
, &spr_write_generic
,
1414 /* XXX : not implemented */
1415 spr_register(env
, SPR_L3ITCR0
, "L3ITCR0",
1416 SPR_NOACCESS
, SPR_NOACCESS
,
1417 &spr_read_generic
, &spr_write_generic
,
1420 /* XXX : not implemented */
1421 spr_register(env
, SPR_L3PM
, "L3PM",
1422 SPR_NOACCESS
, SPR_NOACCESS
,
1423 &spr_read_generic
, &spr_write_generic
,
1427 static void gen_74xx_soft_tlb (CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
1429 #if !defined(CONFIG_USER_ONLY)
1430 env
->nb_tlb
= nb_tlbs
;
1431 env
->nb_ways
= nb_ways
;
1433 env
->tlb_type
= TLB_6XX
;
1434 /* XXX : not implemented */
1435 spr_register(env
, SPR_PTEHI
, "PTEHI",
1436 SPR_NOACCESS
, SPR_NOACCESS
,
1437 &spr_read_generic
, &spr_write_generic
,
1439 /* XXX : not implemented */
1440 spr_register(env
, SPR_PTELO
, "PTELO",
1441 SPR_NOACCESS
, SPR_NOACCESS
,
1442 &spr_read_generic
, &spr_write_generic
,
1444 /* XXX : not implemented */
1445 spr_register(env
, SPR_TLBMISS
, "TLBMISS",
1446 SPR_NOACCESS
, SPR_NOACCESS
,
1447 &spr_read_generic
, &spr_write_generic
,
1452 #if !defined(CONFIG_USER_ONLY)
1453 static void spr_write_e500_l1csr0 (DisasContext
*ctx
, int sprn
, int gprn
)
1455 TCGv t0
= tcg_temp_new();
1457 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR0_DCE
| L1CSR0_CPE
);
1458 gen_store_spr(sprn
, t0
);
1462 static void spr_write_e500_l1csr1(DisasContext
*ctx
, int sprn
, int gprn
)
1464 TCGv t0
= tcg_temp_new();
1466 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR1_ICE
| L1CSR1_CPE
);
1467 gen_store_spr(sprn
, t0
);
1471 static void spr_write_booke206_mmucsr0 (DisasContext
*ctx
, int sprn
, int gprn
)
1473 gen_helper_booke206_tlbflush(cpu_env
, cpu_gpr
[gprn
]);
1476 static void spr_write_booke_pid (DisasContext
*ctx
, int sprn
, int gprn
)
1478 TCGv_i32 t0
= tcg_const_i32(sprn
);
1479 gen_helper_booke_setpid(cpu_env
, t0
, cpu_gpr
[gprn
]);
1480 tcg_temp_free_i32(t0
);
1484 static void gen_spr_usprgh (CPUPPCState
*env
)
1486 spr_register(env
, SPR_USPRG4
, "USPRG4",
1487 &spr_read_ureg
, SPR_NOACCESS
,
1488 &spr_read_ureg
, SPR_NOACCESS
,
1490 spr_register(env
, SPR_USPRG5
, "USPRG5",
1491 &spr_read_ureg
, SPR_NOACCESS
,
1492 &spr_read_ureg
, SPR_NOACCESS
,
1494 spr_register(env
, SPR_USPRG6
, "USPRG6",
1495 &spr_read_ureg
, SPR_NOACCESS
,
1496 &spr_read_ureg
, SPR_NOACCESS
,
1498 spr_register(env
, SPR_USPRG7
, "USPRG7",
1499 &spr_read_ureg
, SPR_NOACCESS
,
1500 &spr_read_ureg
, SPR_NOACCESS
,
1504 /* PowerPC BookE SPR */
1505 static void gen_spr_BookE (CPUPPCState
*env
, uint64_t ivor_mask
)
1507 const char *ivor_names
[64] = {
1508 "IVOR0", "IVOR1", "IVOR2", "IVOR3",
1509 "IVOR4", "IVOR5", "IVOR6", "IVOR7",
1510 "IVOR8", "IVOR9", "IVOR10", "IVOR11",
1511 "IVOR12", "IVOR13", "IVOR14", "IVOR15",
1512 "IVOR16", "IVOR17", "IVOR18", "IVOR19",
1513 "IVOR20", "IVOR21", "IVOR22", "IVOR23",
1514 "IVOR24", "IVOR25", "IVOR26", "IVOR27",
1515 "IVOR28", "IVOR29", "IVOR30", "IVOR31",
1516 "IVOR32", "IVOR33", "IVOR34", "IVOR35",
1517 "IVOR36", "IVOR37", "IVOR38", "IVOR39",
1518 "IVOR40", "IVOR41", "IVOR42", "IVOR43",
1519 "IVOR44", "IVOR45", "IVOR46", "IVOR47",
1520 "IVOR48", "IVOR49", "IVOR50", "IVOR51",
1521 "IVOR52", "IVOR53", "IVOR54", "IVOR55",
1522 "IVOR56", "IVOR57", "IVOR58", "IVOR59",
1523 "IVOR60", "IVOR61", "IVOR62", "IVOR63",
1525 #define SPR_BOOKE_IVORxx (-1)
1526 int ivor_sprn
[64] = {
1527 SPR_BOOKE_IVOR0
, SPR_BOOKE_IVOR1
, SPR_BOOKE_IVOR2
, SPR_BOOKE_IVOR3
,
1528 SPR_BOOKE_IVOR4
, SPR_BOOKE_IVOR5
, SPR_BOOKE_IVOR6
, SPR_BOOKE_IVOR7
,
1529 SPR_BOOKE_IVOR8
, SPR_BOOKE_IVOR9
, SPR_BOOKE_IVOR10
, SPR_BOOKE_IVOR11
,
1530 SPR_BOOKE_IVOR12
, SPR_BOOKE_IVOR13
, SPR_BOOKE_IVOR14
, SPR_BOOKE_IVOR15
,
1531 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1532 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1533 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1534 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1535 SPR_BOOKE_IVOR32
, SPR_BOOKE_IVOR33
, SPR_BOOKE_IVOR34
, SPR_BOOKE_IVOR35
,
1536 SPR_BOOKE_IVOR36
, SPR_BOOKE_IVOR37
, SPR_BOOKE_IVOR38
, SPR_BOOKE_IVOR39
,
1537 SPR_BOOKE_IVOR40
, SPR_BOOKE_IVOR41
, SPR_BOOKE_IVOR42
, SPR_BOOKE_IVORxx
,
1538 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1539 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1540 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1541 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1542 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1546 /* Interrupt processing */
1547 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1548 SPR_NOACCESS
, SPR_NOACCESS
,
1549 &spr_read_generic
, &spr_write_generic
,
1551 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1552 SPR_NOACCESS
, SPR_NOACCESS
,
1553 &spr_read_generic
, &spr_write_generic
,
1556 /* XXX : not implemented */
1557 spr_register(env
, SPR_BOOKE_IAC1
, "IAC1",
1558 SPR_NOACCESS
, SPR_NOACCESS
,
1559 &spr_read_generic
, &spr_write_generic
,
1561 /* XXX : not implemented */
1562 spr_register(env
, SPR_BOOKE_IAC2
, "IAC2",
1563 SPR_NOACCESS
, SPR_NOACCESS
,
1564 &spr_read_generic
, &spr_write_generic
,
1566 /* XXX : not implemented */
1567 spr_register(env
, SPR_BOOKE_DAC1
, "DAC1",
1568 SPR_NOACCESS
, SPR_NOACCESS
,
1569 &spr_read_generic
, &spr_write_generic
,
1571 /* XXX : not implemented */
1572 spr_register(env
, SPR_BOOKE_DAC2
, "DAC2",
1573 SPR_NOACCESS
, SPR_NOACCESS
,
1574 &spr_read_generic
, &spr_write_generic
,
1576 /* XXX : not implemented */
1577 spr_register(env
, SPR_BOOKE_DBCR0
, "DBCR0",
1578 SPR_NOACCESS
, SPR_NOACCESS
,
1579 &spr_read_generic
, &spr_write_40x_dbcr0
,
1581 /* XXX : not implemented */
1582 spr_register(env
, SPR_BOOKE_DBCR1
, "DBCR1",
1583 SPR_NOACCESS
, SPR_NOACCESS
,
1584 &spr_read_generic
, &spr_write_generic
,
1586 /* XXX : not implemented */
1587 spr_register(env
, SPR_BOOKE_DBCR2
, "DBCR2",
1588 SPR_NOACCESS
, SPR_NOACCESS
,
1589 &spr_read_generic
, &spr_write_generic
,
1591 /* XXX : not implemented */
1592 spr_register(env
, SPR_BOOKE_DBSR
, "DBSR",
1593 SPR_NOACCESS
, SPR_NOACCESS
,
1594 &spr_read_generic
, &spr_write_clear
,
1596 spr_register(env
, SPR_BOOKE_DEAR
, "DEAR",
1597 SPR_NOACCESS
, SPR_NOACCESS
,
1598 &spr_read_generic
, &spr_write_generic
,
1600 spr_register(env
, SPR_BOOKE_ESR
, "ESR",
1601 SPR_NOACCESS
, SPR_NOACCESS
,
1602 &spr_read_generic
, &spr_write_generic
,
1604 spr_register(env
, SPR_BOOKE_IVPR
, "IVPR",
1605 SPR_NOACCESS
, SPR_NOACCESS
,
1606 &spr_read_generic
, &spr_write_excp_prefix
,
1608 /* Exception vectors */
1609 for (i
= 0; i
< 64; i
++) {
1610 if (ivor_mask
& (1ULL << i
)) {
1611 if (ivor_sprn
[i
] == SPR_BOOKE_IVORxx
) {
1612 fprintf(stderr
, "ERROR: IVOR %d SPR is not defined\n", i
);
1615 spr_register(env
, ivor_sprn
[i
], ivor_names
[i
],
1616 SPR_NOACCESS
, SPR_NOACCESS
,
1617 &spr_read_generic
, &spr_write_excp_vector
,
1621 spr_register(env
, SPR_BOOKE_PID
, "PID",
1622 SPR_NOACCESS
, SPR_NOACCESS
,
1623 &spr_read_generic
, &spr_write_booke_pid
,
1625 spr_register(env
, SPR_BOOKE_TCR
, "TCR",
1626 SPR_NOACCESS
, SPR_NOACCESS
,
1627 &spr_read_generic
, &spr_write_booke_tcr
,
1629 spr_register(env
, SPR_BOOKE_TSR
, "TSR",
1630 SPR_NOACCESS
, SPR_NOACCESS
,
1631 &spr_read_generic
, &spr_write_booke_tsr
,
1634 spr_register(env
, SPR_DECR
, "DECR",
1635 SPR_NOACCESS
, SPR_NOACCESS
,
1636 &spr_read_decr
, &spr_write_decr
,
1638 spr_register(env
, SPR_BOOKE_DECAR
, "DECAR",
1639 SPR_NOACCESS
, SPR_NOACCESS
,
1640 SPR_NOACCESS
, &spr_write_generic
,
1643 spr_register(env
, SPR_USPRG0
, "USPRG0",
1644 &spr_read_generic
, &spr_write_generic
,
1645 &spr_read_generic
, &spr_write_generic
,
1647 spr_register(env
, SPR_SPRG4
, "SPRG4",
1648 SPR_NOACCESS
, SPR_NOACCESS
,
1649 &spr_read_generic
, &spr_write_generic
,
1651 spr_register(env
, SPR_SPRG5
, "SPRG5",
1652 SPR_NOACCESS
, SPR_NOACCESS
,
1653 &spr_read_generic
, &spr_write_generic
,
1655 spr_register(env
, SPR_SPRG6
, "SPRG6",
1656 SPR_NOACCESS
, SPR_NOACCESS
,
1657 &spr_read_generic
, &spr_write_generic
,
1659 spr_register(env
, SPR_SPRG7
, "SPRG7",
1660 SPR_NOACCESS
, SPR_NOACCESS
,
1661 &spr_read_generic
, &spr_write_generic
,
1665 static inline uint32_t gen_tlbncfg(uint32_t assoc
, uint32_t minsize
,
1666 uint32_t maxsize
, uint32_t flags
,
1669 return (assoc
<< TLBnCFG_ASSOC_SHIFT
) |
1670 (minsize
<< TLBnCFG_MINSIZE_SHIFT
) |
1671 (maxsize
<< TLBnCFG_MAXSIZE_SHIFT
) |
1675 /* BookE 2.06 storage control registers */
1676 static void gen_spr_BookE206(CPUPPCState
*env
, uint32_t mas_mask
,
1679 #if !defined(CONFIG_USER_ONLY)
1680 const char *mas_names
[8] = {
1681 "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
1684 SPR_BOOKE_MAS0
, SPR_BOOKE_MAS1
, SPR_BOOKE_MAS2
, SPR_BOOKE_MAS3
,
1685 SPR_BOOKE_MAS4
, SPR_BOOKE_MAS5
, SPR_BOOKE_MAS6
, SPR_BOOKE_MAS7
,
1689 /* TLB assist registers */
1690 /* XXX : not implemented */
1691 for (i
= 0; i
< 8; i
++) {
1692 void (*uea_write
)(DisasContext
*ctx
, int sprn
, int gprn
) = &spr_write_generic32
;
1693 if (i
== 2 && (mas_mask
& (1 << i
)) && (env
->insns_flags
& PPC_64B
)) {
1694 uea_write
= &spr_write_generic
;
1696 if (mas_mask
& (1 << i
)) {
1697 spr_register(env
, mas_sprn
[i
], mas_names
[i
],
1698 SPR_NOACCESS
, SPR_NOACCESS
,
1699 &spr_read_generic
, uea_write
,
1703 if (env
->nb_pids
> 1) {
1704 /* XXX : not implemented */
1705 spr_register(env
, SPR_BOOKE_PID1
, "PID1",
1706 SPR_NOACCESS
, SPR_NOACCESS
,
1707 &spr_read_generic
, &spr_write_booke_pid
,
1710 if (env
->nb_pids
> 2) {
1711 /* XXX : not implemented */
1712 spr_register(env
, SPR_BOOKE_PID2
, "PID2",
1713 SPR_NOACCESS
, SPR_NOACCESS
,
1714 &spr_read_generic
, &spr_write_booke_pid
,
1717 /* XXX : not implemented */
1718 spr_register(env
, SPR_MMUCFG
, "MMUCFG",
1719 SPR_NOACCESS
, SPR_NOACCESS
,
1720 &spr_read_generic
, SPR_NOACCESS
,
1721 0x00000000); /* TOFIX */
1722 switch (env
->nb_ways
) {
1724 spr_register(env
, SPR_BOOKE_TLB3CFG
, "TLB3CFG",
1725 SPR_NOACCESS
, SPR_NOACCESS
,
1726 &spr_read_generic
, SPR_NOACCESS
,
1730 spr_register(env
, SPR_BOOKE_TLB2CFG
, "TLB2CFG",
1731 SPR_NOACCESS
, SPR_NOACCESS
,
1732 &spr_read_generic
, SPR_NOACCESS
,
1736 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
1737 SPR_NOACCESS
, SPR_NOACCESS
,
1738 &spr_read_generic
, SPR_NOACCESS
,
1742 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
1743 SPR_NOACCESS
, SPR_NOACCESS
,
1744 &spr_read_generic
, SPR_NOACCESS
,
1753 gen_spr_usprgh(env
);
1756 /* SPR specific to PowerPC 440 implementation */
1757 static void gen_spr_440 (CPUPPCState
*env
)
1760 /* XXX : not implemented */
1761 spr_register(env
, SPR_440_DNV0
, "DNV0",
1762 SPR_NOACCESS
, SPR_NOACCESS
,
1763 &spr_read_generic
, &spr_write_generic
,
1765 /* XXX : not implemented */
1766 spr_register(env
, SPR_440_DNV1
, "DNV1",
1767 SPR_NOACCESS
, SPR_NOACCESS
,
1768 &spr_read_generic
, &spr_write_generic
,
1770 /* XXX : not implemented */
1771 spr_register(env
, SPR_440_DNV2
, "DNV2",
1772 SPR_NOACCESS
, SPR_NOACCESS
,
1773 &spr_read_generic
, &spr_write_generic
,
1775 /* XXX : not implemented */
1776 spr_register(env
, SPR_440_DNV3
, "DNV3",
1777 SPR_NOACCESS
, SPR_NOACCESS
,
1778 &spr_read_generic
, &spr_write_generic
,
1780 /* XXX : not implemented */
1781 spr_register(env
, SPR_440_DTV0
, "DTV0",
1782 SPR_NOACCESS
, SPR_NOACCESS
,
1783 &spr_read_generic
, &spr_write_generic
,
1785 /* XXX : not implemented */
1786 spr_register(env
, SPR_440_DTV1
, "DTV1",
1787 SPR_NOACCESS
, SPR_NOACCESS
,
1788 &spr_read_generic
, &spr_write_generic
,
1790 /* XXX : not implemented */
1791 spr_register(env
, SPR_440_DTV2
, "DTV2",
1792 SPR_NOACCESS
, SPR_NOACCESS
,
1793 &spr_read_generic
, &spr_write_generic
,
1795 /* XXX : not implemented */
1796 spr_register(env
, SPR_440_DTV3
, "DTV3",
1797 SPR_NOACCESS
, SPR_NOACCESS
,
1798 &spr_read_generic
, &spr_write_generic
,
1800 /* XXX : not implemented */
1801 spr_register(env
, SPR_440_DVLIM
, "DVLIM",
1802 SPR_NOACCESS
, SPR_NOACCESS
,
1803 &spr_read_generic
, &spr_write_generic
,
1805 /* XXX : not implemented */
1806 spr_register(env
, SPR_440_INV0
, "INV0",
1807 SPR_NOACCESS
, SPR_NOACCESS
,
1808 &spr_read_generic
, &spr_write_generic
,
1810 /* XXX : not implemented */
1811 spr_register(env
, SPR_440_INV1
, "INV1",
1812 SPR_NOACCESS
, SPR_NOACCESS
,
1813 &spr_read_generic
, &spr_write_generic
,
1815 /* XXX : not implemented */
1816 spr_register(env
, SPR_440_INV2
, "INV2",
1817 SPR_NOACCESS
, SPR_NOACCESS
,
1818 &spr_read_generic
, &spr_write_generic
,
1820 /* XXX : not implemented */
1821 spr_register(env
, SPR_440_INV3
, "INV3",
1822 SPR_NOACCESS
, SPR_NOACCESS
,
1823 &spr_read_generic
, &spr_write_generic
,
1825 /* XXX : not implemented */
1826 spr_register(env
, SPR_440_ITV0
, "ITV0",
1827 SPR_NOACCESS
, SPR_NOACCESS
,
1828 &spr_read_generic
, &spr_write_generic
,
1830 /* XXX : not implemented */
1831 spr_register(env
, SPR_440_ITV1
, "ITV1",
1832 SPR_NOACCESS
, SPR_NOACCESS
,
1833 &spr_read_generic
, &spr_write_generic
,
1835 /* XXX : not implemented */
1836 spr_register(env
, SPR_440_ITV2
, "ITV2",
1837 SPR_NOACCESS
, SPR_NOACCESS
,
1838 &spr_read_generic
, &spr_write_generic
,
1840 /* XXX : not implemented */
1841 spr_register(env
, SPR_440_ITV3
, "ITV3",
1842 SPR_NOACCESS
, SPR_NOACCESS
,
1843 &spr_read_generic
, &spr_write_generic
,
1845 /* XXX : not implemented */
1846 spr_register(env
, SPR_440_IVLIM
, "IVLIM",
1847 SPR_NOACCESS
, SPR_NOACCESS
,
1848 &spr_read_generic
, &spr_write_generic
,
1851 /* XXX : not implemented */
1852 spr_register(env
, SPR_BOOKE_DCDBTRH
, "DCDBTRH",
1853 SPR_NOACCESS
, SPR_NOACCESS
,
1854 &spr_read_generic
, SPR_NOACCESS
,
1856 /* XXX : not implemented */
1857 spr_register(env
, SPR_BOOKE_DCDBTRL
, "DCDBTRL",
1858 SPR_NOACCESS
, SPR_NOACCESS
,
1859 &spr_read_generic
, SPR_NOACCESS
,
1861 /* XXX : not implemented */
1862 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
1863 SPR_NOACCESS
, SPR_NOACCESS
,
1864 &spr_read_generic
, SPR_NOACCESS
,
1866 /* XXX : not implemented */
1867 spr_register(env
, SPR_BOOKE_ICDBTRH
, "ICDBTRH",
1868 SPR_NOACCESS
, SPR_NOACCESS
,
1869 &spr_read_generic
, SPR_NOACCESS
,
1871 /* XXX : not implemented */
1872 spr_register(env
, SPR_BOOKE_ICDBTRL
, "ICDBTRL",
1873 SPR_NOACCESS
, SPR_NOACCESS
,
1874 &spr_read_generic
, SPR_NOACCESS
,
1876 /* XXX : not implemented */
1877 spr_register(env
, SPR_440_DBDR
, "DBDR",
1878 SPR_NOACCESS
, SPR_NOACCESS
,
1879 &spr_read_generic
, &spr_write_generic
,
1881 /* Processor control */
1882 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
1883 SPR_NOACCESS
, SPR_NOACCESS
,
1884 &spr_read_generic
, &spr_write_generic
,
1886 spr_register(env
, SPR_440_RSTCFG
, "RSTCFG",
1887 SPR_NOACCESS
, SPR_NOACCESS
,
1888 &spr_read_generic
, SPR_NOACCESS
,
1890 /* Storage control */
1891 spr_register(env
, SPR_440_MMUCR
, "MMUCR",
1892 SPR_NOACCESS
, SPR_NOACCESS
,
1893 &spr_read_generic
, &spr_write_generic
,
1897 /* SPR shared between PowerPC 40x implementations */
1898 static void gen_spr_40x (CPUPPCState
*env
)
1901 /* not emulated, as QEMU do not emulate caches */
1902 spr_register(env
, SPR_40x_DCCR
, "DCCR",
1903 SPR_NOACCESS
, SPR_NOACCESS
,
1904 &spr_read_generic
, &spr_write_generic
,
1906 /* not emulated, as QEMU do not emulate caches */
1907 spr_register(env
, SPR_40x_ICCR
, "ICCR",
1908 SPR_NOACCESS
, SPR_NOACCESS
,
1909 &spr_read_generic
, &spr_write_generic
,
1911 /* not emulated, as QEMU do not emulate caches */
1912 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
1913 SPR_NOACCESS
, SPR_NOACCESS
,
1914 &spr_read_generic
, SPR_NOACCESS
,
1917 spr_register(env
, SPR_40x_DEAR
, "DEAR",
1918 SPR_NOACCESS
, SPR_NOACCESS
,
1919 &spr_read_generic
, &spr_write_generic
,
1921 spr_register(env
, SPR_40x_ESR
, "ESR",
1922 SPR_NOACCESS
, SPR_NOACCESS
,
1923 &spr_read_generic
, &spr_write_generic
,
1925 spr_register(env
, SPR_40x_EVPR
, "EVPR",
1926 SPR_NOACCESS
, SPR_NOACCESS
,
1927 &spr_read_generic
, &spr_write_excp_prefix
,
1929 spr_register(env
, SPR_40x_SRR2
, "SRR2",
1930 &spr_read_generic
, &spr_write_generic
,
1931 &spr_read_generic
, &spr_write_generic
,
1933 spr_register(env
, SPR_40x_SRR3
, "SRR3",
1934 &spr_read_generic
, &spr_write_generic
,
1935 &spr_read_generic
, &spr_write_generic
,
1938 spr_register(env
, SPR_40x_PIT
, "PIT",
1939 SPR_NOACCESS
, SPR_NOACCESS
,
1940 &spr_read_40x_pit
, &spr_write_40x_pit
,
1942 spr_register(env
, SPR_40x_TCR
, "TCR",
1943 SPR_NOACCESS
, SPR_NOACCESS
,
1944 &spr_read_generic
, &spr_write_booke_tcr
,
1946 spr_register(env
, SPR_40x_TSR
, "TSR",
1947 SPR_NOACCESS
, SPR_NOACCESS
,
1948 &spr_read_generic
, &spr_write_booke_tsr
,
1952 /* SPR specific to PowerPC 405 implementation */
1953 static void gen_spr_405 (CPUPPCState
*env
)
1956 spr_register(env
, SPR_40x_PID
, "PID",
1957 SPR_NOACCESS
, SPR_NOACCESS
,
1958 &spr_read_generic
, &spr_write_generic
,
1960 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
1961 SPR_NOACCESS
, SPR_NOACCESS
,
1962 &spr_read_generic
, &spr_write_generic
,
1964 /* Debug interface */
1965 /* XXX : not implemented */
1966 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
1967 SPR_NOACCESS
, SPR_NOACCESS
,
1968 &spr_read_generic
, &spr_write_40x_dbcr0
,
1970 /* XXX : not implemented */
1971 spr_register(env
, SPR_405_DBCR1
, "DBCR1",
1972 SPR_NOACCESS
, SPR_NOACCESS
,
1973 &spr_read_generic
, &spr_write_generic
,
1975 /* XXX : not implemented */
1976 spr_register(env
, SPR_40x_DBSR
, "DBSR",
1977 SPR_NOACCESS
, SPR_NOACCESS
,
1978 &spr_read_generic
, &spr_write_clear
,
1979 /* Last reset was system reset */
1981 /* XXX : not implemented */
1982 spr_register(env
, SPR_40x_DAC1
, "DAC1",
1983 SPR_NOACCESS
, SPR_NOACCESS
,
1984 &spr_read_generic
, &spr_write_generic
,
1986 spr_register(env
, SPR_40x_DAC2
, "DAC2",
1987 SPR_NOACCESS
, SPR_NOACCESS
,
1988 &spr_read_generic
, &spr_write_generic
,
1990 /* XXX : not implemented */
1991 spr_register(env
, SPR_405_DVC1
, "DVC1",
1992 SPR_NOACCESS
, SPR_NOACCESS
,
1993 &spr_read_generic
, &spr_write_generic
,
1995 /* XXX : not implemented */
1996 spr_register(env
, SPR_405_DVC2
, "DVC2",
1997 SPR_NOACCESS
, SPR_NOACCESS
,
1998 &spr_read_generic
, &spr_write_generic
,
2000 /* XXX : not implemented */
2001 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2002 SPR_NOACCESS
, SPR_NOACCESS
,
2003 &spr_read_generic
, &spr_write_generic
,
2005 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2006 SPR_NOACCESS
, SPR_NOACCESS
,
2007 &spr_read_generic
, &spr_write_generic
,
2009 /* XXX : not implemented */
2010 spr_register(env
, SPR_405_IAC3
, "IAC3",
2011 SPR_NOACCESS
, SPR_NOACCESS
,
2012 &spr_read_generic
, &spr_write_generic
,
2014 /* XXX : not implemented */
2015 spr_register(env
, SPR_405_IAC4
, "IAC4",
2016 SPR_NOACCESS
, SPR_NOACCESS
,
2017 &spr_read_generic
, &spr_write_generic
,
2019 /* Storage control */
2020 /* XXX: TODO: not implemented */
2021 spr_register(env
, SPR_405_SLER
, "SLER",
2022 SPR_NOACCESS
, SPR_NOACCESS
,
2023 &spr_read_generic
, &spr_write_40x_sler
,
2025 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2026 SPR_NOACCESS
, SPR_NOACCESS
,
2027 &spr_read_generic
, &spr_write_generic
,
2029 /* XXX : not implemented */
2030 spr_register(env
, SPR_405_SU0R
, "SU0R",
2031 SPR_NOACCESS
, SPR_NOACCESS
,
2032 &spr_read_generic
, &spr_write_generic
,
2035 spr_register(env
, SPR_USPRG0
, "USPRG0",
2036 &spr_read_ureg
, SPR_NOACCESS
,
2037 &spr_read_ureg
, SPR_NOACCESS
,
2039 spr_register(env
, SPR_SPRG4
, "SPRG4",
2040 SPR_NOACCESS
, SPR_NOACCESS
,
2041 &spr_read_generic
, &spr_write_generic
,
2043 spr_register(env
, SPR_SPRG5
, "SPRG5",
2044 SPR_NOACCESS
, SPR_NOACCESS
,
2045 spr_read_generic
, &spr_write_generic
,
2047 spr_register(env
, SPR_SPRG6
, "SPRG6",
2048 SPR_NOACCESS
, SPR_NOACCESS
,
2049 spr_read_generic
, &spr_write_generic
,
2051 spr_register(env
, SPR_SPRG7
, "SPRG7",
2052 SPR_NOACCESS
, SPR_NOACCESS
,
2053 spr_read_generic
, &spr_write_generic
,
2055 gen_spr_usprgh(env
);
2058 /* SPR shared between PowerPC 401 & 403 implementations */
2059 static void gen_spr_401_403 (CPUPPCState
*env
)
2062 spr_register(env
, SPR_403_VTBL
, "TBL",
2063 &spr_read_tbl
, SPR_NOACCESS
,
2064 &spr_read_tbl
, SPR_NOACCESS
,
2066 spr_register(env
, SPR_403_TBL
, "TBL",
2067 SPR_NOACCESS
, SPR_NOACCESS
,
2068 SPR_NOACCESS
, &spr_write_tbl
,
2070 spr_register(env
, SPR_403_VTBU
, "TBU",
2071 &spr_read_tbu
, SPR_NOACCESS
,
2072 &spr_read_tbu
, SPR_NOACCESS
,
2074 spr_register(env
, SPR_403_TBU
, "TBU",
2075 SPR_NOACCESS
, SPR_NOACCESS
,
2076 SPR_NOACCESS
, &spr_write_tbu
,
2079 /* not emulated, as QEMU do not emulate caches */
2080 spr_register(env
, SPR_403_CDBCR
, "CDBCR",
2081 SPR_NOACCESS
, SPR_NOACCESS
,
2082 &spr_read_generic
, &spr_write_generic
,
2086 /* SPR specific to PowerPC 401 implementation */
2087 static void gen_spr_401 (CPUPPCState
*env
)
2089 /* Debug interface */
2090 /* XXX : not implemented */
2091 spr_register(env
, SPR_40x_DBCR0
, "DBCR",
2092 SPR_NOACCESS
, SPR_NOACCESS
,
2093 &spr_read_generic
, &spr_write_40x_dbcr0
,
2095 /* XXX : not implemented */
2096 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2097 SPR_NOACCESS
, SPR_NOACCESS
,
2098 &spr_read_generic
, &spr_write_clear
,
2099 /* Last reset was system reset */
2101 /* XXX : not implemented */
2102 spr_register(env
, SPR_40x_DAC1
, "DAC",
2103 SPR_NOACCESS
, SPR_NOACCESS
,
2104 &spr_read_generic
, &spr_write_generic
,
2106 /* XXX : not implemented */
2107 spr_register(env
, SPR_40x_IAC1
, "IAC",
2108 SPR_NOACCESS
, SPR_NOACCESS
,
2109 &spr_read_generic
, &spr_write_generic
,
2111 /* Storage control */
2112 /* XXX: TODO: not implemented */
2113 spr_register(env
, SPR_405_SLER
, "SLER",
2114 SPR_NOACCESS
, SPR_NOACCESS
,
2115 &spr_read_generic
, &spr_write_40x_sler
,
2117 /* not emulated, as QEMU never does speculative access */
2118 spr_register(env
, SPR_40x_SGR
, "SGR",
2119 SPR_NOACCESS
, SPR_NOACCESS
,
2120 &spr_read_generic
, &spr_write_generic
,
2122 /* not emulated, as QEMU do not emulate caches */
2123 spr_register(env
, SPR_40x_DCWR
, "DCWR",
2124 SPR_NOACCESS
, SPR_NOACCESS
,
2125 &spr_read_generic
, &spr_write_generic
,
2129 static void gen_spr_401x2 (CPUPPCState
*env
)
2132 spr_register(env
, SPR_40x_PID
, "PID",
2133 SPR_NOACCESS
, SPR_NOACCESS
,
2134 &spr_read_generic
, &spr_write_generic
,
2136 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2137 SPR_NOACCESS
, SPR_NOACCESS
,
2138 &spr_read_generic
, &spr_write_generic
,
2142 /* SPR specific to PowerPC 403 implementation */
2143 static void gen_spr_403 (CPUPPCState
*env
)
2145 /* Debug interface */
2146 /* XXX : not implemented */
2147 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2148 SPR_NOACCESS
, SPR_NOACCESS
,
2149 &spr_read_generic
, &spr_write_40x_dbcr0
,
2151 /* XXX : not implemented */
2152 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2153 SPR_NOACCESS
, SPR_NOACCESS
,
2154 &spr_read_generic
, &spr_write_clear
,
2155 /* Last reset was system reset */
2157 /* XXX : not implemented */
2158 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2159 SPR_NOACCESS
, SPR_NOACCESS
,
2160 &spr_read_generic
, &spr_write_generic
,
2162 /* XXX : not implemented */
2163 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2164 SPR_NOACCESS
, SPR_NOACCESS
,
2165 &spr_read_generic
, &spr_write_generic
,
2167 /* XXX : not implemented */
2168 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2169 SPR_NOACCESS
, SPR_NOACCESS
,
2170 &spr_read_generic
, &spr_write_generic
,
2172 /* XXX : not implemented */
2173 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2174 SPR_NOACCESS
, SPR_NOACCESS
,
2175 &spr_read_generic
, &spr_write_generic
,
2179 static void gen_spr_403_real (CPUPPCState
*env
)
2181 spr_register(env
, SPR_403_PBL1
, "PBL1",
2182 SPR_NOACCESS
, SPR_NOACCESS
,
2183 &spr_read_403_pbr
, &spr_write_403_pbr
,
2185 spr_register(env
, SPR_403_PBU1
, "PBU1",
2186 SPR_NOACCESS
, SPR_NOACCESS
,
2187 &spr_read_403_pbr
, &spr_write_403_pbr
,
2189 spr_register(env
, SPR_403_PBL2
, "PBL2",
2190 SPR_NOACCESS
, SPR_NOACCESS
,
2191 &spr_read_403_pbr
, &spr_write_403_pbr
,
2193 spr_register(env
, SPR_403_PBU2
, "PBU2",
2194 SPR_NOACCESS
, SPR_NOACCESS
,
2195 &spr_read_403_pbr
, &spr_write_403_pbr
,
2199 static void gen_spr_403_mmu (CPUPPCState
*env
)
2202 spr_register(env
, SPR_40x_PID
, "PID",
2203 SPR_NOACCESS
, SPR_NOACCESS
,
2204 &spr_read_generic
, &spr_write_generic
,
2206 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2207 SPR_NOACCESS
, SPR_NOACCESS
,
2208 &spr_read_generic
, &spr_write_generic
,
2212 /* SPR specific to PowerPC compression coprocessor extension */
2213 static void gen_spr_compress (CPUPPCState
*env
)
2215 /* XXX : not implemented */
2216 spr_register(env
, SPR_401_SKR
, "SKR",
2217 SPR_NOACCESS
, SPR_NOACCESS
,
2218 &spr_read_generic
, &spr_write_generic
,
2222 static void gen_spr_5xx_8xx (CPUPPCState
*env
)
2224 /* Exception processing */
2225 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
2226 SPR_NOACCESS
, SPR_NOACCESS
,
2227 &spr_read_generic
, &spr_write_generic
,
2228 KVM_REG_PPC_DSISR
, 0x00000000);
2229 spr_register_kvm(env
, SPR_DAR
, "DAR",
2230 SPR_NOACCESS
, SPR_NOACCESS
,
2231 &spr_read_generic
, &spr_write_generic
,
2232 KVM_REG_PPC_DAR
, 0x00000000);
2234 spr_register(env
, SPR_DECR
, "DECR",
2235 SPR_NOACCESS
, SPR_NOACCESS
,
2236 &spr_read_decr
, &spr_write_decr
,
2238 /* XXX : not implemented */
2239 spr_register(env
, SPR_MPC_EIE
, "EIE",
2240 SPR_NOACCESS
, SPR_NOACCESS
,
2241 &spr_read_generic
, &spr_write_generic
,
2243 /* XXX : not implemented */
2244 spr_register(env
, SPR_MPC_EID
, "EID",
2245 SPR_NOACCESS
, SPR_NOACCESS
,
2246 &spr_read_generic
, &spr_write_generic
,
2248 /* XXX : not implemented */
2249 spr_register(env
, SPR_MPC_NRI
, "NRI",
2250 SPR_NOACCESS
, SPR_NOACCESS
,
2251 &spr_read_generic
, &spr_write_generic
,
2253 /* XXX : not implemented */
2254 spr_register(env
, SPR_MPC_CMPA
, "CMPA",
2255 SPR_NOACCESS
, SPR_NOACCESS
,
2256 &spr_read_generic
, &spr_write_generic
,
2258 /* XXX : not implemented */
2259 spr_register(env
, SPR_MPC_CMPB
, "CMPB",
2260 SPR_NOACCESS
, SPR_NOACCESS
,
2261 &spr_read_generic
, &spr_write_generic
,
2263 /* XXX : not implemented */
2264 spr_register(env
, SPR_MPC_CMPC
, "CMPC",
2265 SPR_NOACCESS
, SPR_NOACCESS
,
2266 &spr_read_generic
, &spr_write_generic
,
2268 /* XXX : not implemented */
2269 spr_register(env
, SPR_MPC_CMPD
, "CMPD",
2270 SPR_NOACCESS
, SPR_NOACCESS
,
2271 &spr_read_generic
, &spr_write_generic
,
2273 /* XXX : not implemented */
2274 spr_register(env
, SPR_MPC_ECR
, "ECR",
2275 SPR_NOACCESS
, SPR_NOACCESS
,
2276 &spr_read_generic
, &spr_write_generic
,
2278 /* XXX : not implemented */
2279 spr_register(env
, SPR_MPC_DER
, "DER",
2280 SPR_NOACCESS
, SPR_NOACCESS
,
2281 &spr_read_generic
, &spr_write_generic
,
2283 /* XXX : not implemented */
2284 spr_register(env
, SPR_MPC_COUNTA
, "COUNTA",
2285 SPR_NOACCESS
, SPR_NOACCESS
,
2286 &spr_read_generic
, &spr_write_generic
,
2288 /* XXX : not implemented */
2289 spr_register(env
, SPR_MPC_COUNTB
, "COUNTB",
2290 SPR_NOACCESS
, SPR_NOACCESS
,
2291 &spr_read_generic
, &spr_write_generic
,
2293 /* XXX : not implemented */
2294 spr_register(env
, SPR_MPC_CMPE
, "CMPE",
2295 SPR_NOACCESS
, SPR_NOACCESS
,
2296 &spr_read_generic
, &spr_write_generic
,
2298 /* XXX : not implemented */
2299 spr_register(env
, SPR_MPC_CMPF
, "CMPF",
2300 SPR_NOACCESS
, SPR_NOACCESS
,
2301 &spr_read_generic
, &spr_write_generic
,
2303 /* XXX : not implemented */
2304 spr_register(env
, SPR_MPC_CMPG
, "CMPG",
2305 SPR_NOACCESS
, SPR_NOACCESS
,
2306 &spr_read_generic
, &spr_write_generic
,
2308 /* XXX : not implemented */
2309 spr_register(env
, SPR_MPC_CMPH
, "CMPH",
2310 SPR_NOACCESS
, SPR_NOACCESS
,
2311 &spr_read_generic
, &spr_write_generic
,
2313 /* XXX : not implemented */
2314 spr_register(env
, SPR_MPC_LCTRL1
, "LCTRL1",
2315 SPR_NOACCESS
, SPR_NOACCESS
,
2316 &spr_read_generic
, &spr_write_generic
,
2318 /* XXX : not implemented */
2319 spr_register(env
, SPR_MPC_LCTRL2
, "LCTRL2",
2320 SPR_NOACCESS
, SPR_NOACCESS
,
2321 &spr_read_generic
, &spr_write_generic
,
2323 /* XXX : not implemented */
2324 spr_register(env
, SPR_MPC_BAR
, "BAR",
2325 SPR_NOACCESS
, SPR_NOACCESS
,
2326 &spr_read_generic
, &spr_write_generic
,
2328 /* XXX : not implemented */
2329 spr_register(env
, SPR_MPC_DPDR
, "DPDR",
2330 SPR_NOACCESS
, SPR_NOACCESS
,
2331 &spr_read_generic
, &spr_write_generic
,
2333 /* XXX : not implemented */
2334 spr_register(env
, SPR_MPC_IMMR
, "IMMR",
2335 SPR_NOACCESS
, SPR_NOACCESS
,
2336 &spr_read_generic
, &spr_write_generic
,
2340 static void gen_spr_5xx (CPUPPCState
*env
)
2342 /* XXX : not implemented */
2343 spr_register(env
, SPR_RCPU_MI_GRA
, "MI_GRA",
2344 SPR_NOACCESS
, SPR_NOACCESS
,
2345 &spr_read_generic
, &spr_write_generic
,
2347 /* XXX : not implemented */
2348 spr_register(env
, SPR_RCPU_L2U_GRA
, "L2U_GRA",
2349 SPR_NOACCESS
, SPR_NOACCESS
,
2350 &spr_read_generic
, &spr_write_generic
,
2352 /* XXX : not implemented */
2353 spr_register(env
, SPR_RPCU_BBCMCR
, "L2U_BBCMCR",
2354 SPR_NOACCESS
, SPR_NOACCESS
,
2355 &spr_read_generic
, &spr_write_generic
,
2357 /* XXX : not implemented */
2358 spr_register(env
, SPR_RCPU_L2U_MCR
, "L2U_MCR",
2359 SPR_NOACCESS
, SPR_NOACCESS
,
2360 &spr_read_generic
, &spr_write_generic
,
2362 /* XXX : not implemented */
2363 spr_register(env
, SPR_RCPU_MI_RBA0
, "MI_RBA0",
2364 SPR_NOACCESS
, SPR_NOACCESS
,
2365 &spr_read_generic
, &spr_write_generic
,
2367 /* XXX : not implemented */
2368 spr_register(env
, SPR_RCPU_MI_RBA1
, "MI_RBA1",
2369 SPR_NOACCESS
, SPR_NOACCESS
,
2370 &spr_read_generic
, &spr_write_generic
,
2372 /* XXX : not implemented */
2373 spr_register(env
, SPR_RCPU_MI_RBA2
, "MI_RBA2",
2374 SPR_NOACCESS
, SPR_NOACCESS
,
2375 &spr_read_generic
, &spr_write_generic
,
2377 /* XXX : not implemented */
2378 spr_register(env
, SPR_RCPU_MI_RBA3
, "MI_RBA3",
2379 SPR_NOACCESS
, SPR_NOACCESS
,
2380 &spr_read_generic
, &spr_write_generic
,
2382 /* XXX : not implemented */
2383 spr_register(env
, SPR_RCPU_L2U_RBA0
, "L2U_RBA0",
2384 SPR_NOACCESS
, SPR_NOACCESS
,
2385 &spr_read_generic
, &spr_write_generic
,
2387 /* XXX : not implemented */
2388 spr_register(env
, SPR_RCPU_L2U_RBA1
, "L2U_RBA1",
2389 SPR_NOACCESS
, SPR_NOACCESS
,
2390 &spr_read_generic
, &spr_write_generic
,
2392 /* XXX : not implemented */
2393 spr_register(env
, SPR_RCPU_L2U_RBA2
, "L2U_RBA2",
2394 SPR_NOACCESS
, SPR_NOACCESS
,
2395 &spr_read_generic
, &spr_write_generic
,
2397 /* XXX : not implemented */
2398 spr_register(env
, SPR_RCPU_L2U_RBA3
, "L2U_RBA3",
2399 SPR_NOACCESS
, SPR_NOACCESS
,
2400 &spr_read_generic
, &spr_write_generic
,
2402 /* XXX : not implemented */
2403 spr_register(env
, SPR_RCPU_MI_RA0
, "MI_RA0",
2404 SPR_NOACCESS
, SPR_NOACCESS
,
2405 &spr_read_generic
, &spr_write_generic
,
2407 /* XXX : not implemented */
2408 spr_register(env
, SPR_RCPU_MI_RA1
, "MI_RA1",
2409 SPR_NOACCESS
, SPR_NOACCESS
,
2410 &spr_read_generic
, &spr_write_generic
,
2412 /* XXX : not implemented */
2413 spr_register(env
, SPR_RCPU_MI_RA2
, "MI_RA2",
2414 SPR_NOACCESS
, SPR_NOACCESS
,
2415 &spr_read_generic
, &spr_write_generic
,
2417 /* XXX : not implemented */
2418 spr_register(env
, SPR_RCPU_MI_RA3
, "MI_RA3",
2419 SPR_NOACCESS
, SPR_NOACCESS
,
2420 &spr_read_generic
, &spr_write_generic
,
2422 /* XXX : not implemented */
2423 spr_register(env
, SPR_RCPU_L2U_RA0
, "L2U_RA0",
2424 SPR_NOACCESS
, SPR_NOACCESS
,
2425 &spr_read_generic
, &spr_write_generic
,
2427 /* XXX : not implemented */
2428 spr_register(env
, SPR_RCPU_L2U_RA1
, "L2U_RA1",
2429 SPR_NOACCESS
, SPR_NOACCESS
,
2430 &spr_read_generic
, &spr_write_generic
,
2432 /* XXX : not implemented */
2433 spr_register(env
, SPR_RCPU_L2U_RA2
, "L2U_RA2",
2434 SPR_NOACCESS
, SPR_NOACCESS
,
2435 &spr_read_generic
, &spr_write_generic
,
2437 /* XXX : not implemented */
2438 spr_register(env
, SPR_RCPU_L2U_RA3
, "L2U_RA3",
2439 SPR_NOACCESS
, SPR_NOACCESS
,
2440 &spr_read_generic
, &spr_write_generic
,
2442 /* XXX : not implemented */
2443 spr_register(env
, SPR_RCPU_FPECR
, "FPECR",
2444 SPR_NOACCESS
, SPR_NOACCESS
,
2445 &spr_read_generic
, &spr_write_generic
,
2449 static void gen_spr_8xx (CPUPPCState
*env
)
2451 /* XXX : not implemented */
2452 spr_register(env
, SPR_MPC_IC_CST
, "IC_CST",
2453 SPR_NOACCESS
, SPR_NOACCESS
,
2454 &spr_read_generic
, &spr_write_generic
,
2456 /* XXX : not implemented */
2457 spr_register(env
, SPR_MPC_IC_ADR
, "IC_ADR",
2458 SPR_NOACCESS
, SPR_NOACCESS
,
2459 &spr_read_generic
, &spr_write_generic
,
2461 /* XXX : not implemented */
2462 spr_register(env
, SPR_MPC_IC_DAT
, "IC_DAT",
2463 SPR_NOACCESS
, SPR_NOACCESS
,
2464 &spr_read_generic
, &spr_write_generic
,
2466 /* XXX : not implemented */
2467 spr_register(env
, SPR_MPC_DC_CST
, "DC_CST",
2468 SPR_NOACCESS
, SPR_NOACCESS
,
2469 &spr_read_generic
, &spr_write_generic
,
2471 /* XXX : not implemented */
2472 spr_register(env
, SPR_MPC_DC_ADR
, "DC_ADR",
2473 SPR_NOACCESS
, SPR_NOACCESS
,
2474 &spr_read_generic
, &spr_write_generic
,
2476 /* XXX : not implemented */
2477 spr_register(env
, SPR_MPC_DC_DAT
, "DC_DAT",
2478 SPR_NOACCESS
, SPR_NOACCESS
,
2479 &spr_read_generic
, &spr_write_generic
,
2481 /* XXX : not implemented */
2482 spr_register(env
, SPR_MPC_MI_CTR
, "MI_CTR",
2483 SPR_NOACCESS
, SPR_NOACCESS
,
2484 &spr_read_generic
, &spr_write_generic
,
2486 /* XXX : not implemented */
2487 spr_register(env
, SPR_MPC_MI_AP
, "MI_AP",
2488 SPR_NOACCESS
, SPR_NOACCESS
,
2489 &spr_read_generic
, &spr_write_generic
,
2491 /* XXX : not implemented */
2492 spr_register(env
, SPR_MPC_MI_EPN
, "MI_EPN",
2493 SPR_NOACCESS
, SPR_NOACCESS
,
2494 &spr_read_generic
, &spr_write_generic
,
2496 /* XXX : not implemented */
2497 spr_register(env
, SPR_MPC_MI_TWC
, "MI_TWC",
2498 SPR_NOACCESS
, SPR_NOACCESS
,
2499 &spr_read_generic
, &spr_write_generic
,
2501 /* XXX : not implemented */
2502 spr_register(env
, SPR_MPC_MI_RPN
, "MI_RPN",
2503 SPR_NOACCESS
, SPR_NOACCESS
,
2504 &spr_read_generic
, &spr_write_generic
,
2506 /* XXX : not implemented */
2507 spr_register(env
, SPR_MPC_MI_DBCAM
, "MI_DBCAM",
2508 SPR_NOACCESS
, SPR_NOACCESS
,
2509 &spr_read_generic
, &spr_write_generic
,
2511 /* XXX : not implemented */
2512 spr_register(env
, SPR_MPC_MI_DBRAM0
, "MI_DBRAM0",
2513 SPR_NOACCESS
, SPR_NOACCESS
,
2514 &spr_read_generic
, &spr_write_generic
,
2516 /* XXX : not implemented */
2517 spr_register(env
, SPR_MPC_MI_DBRAM1
, "MI_DBRAM1",
2518 SPR_NOACCESS
, SPR_NOACCESS
,
2519 &spr_read_generic
, &spr_write_generic
,
2521 /* XXX : not implemented */
2522 spr_register(env
, SPR_MPC_MD_CTR
, "MD_CTR",
2523 SPR_NOACCESS
, SPR_NOACCESS
,
2524 &spr_read_generic
, &spr_write_generic
,
2526 /* XXX : not implemented */
2527 spr_register(env
, SPR_MPC_MD_CASID
, "MD_CASID",
2528 SPR_NOACCESS
, SPR_NOACCESS
,
2529 &spr_read_generic
, &spr_write_generic
,
2531 /* XXX : not implemented */
2532 spr_register(env
, SPR_MPC_MD_AP
, "MD_AP",
2533 SPR_NOACCESS
, SPR_NOACCESS
,
2534 &spr_read_generic
, &spr_write_generic
,
2536 /* XXX : not implemented */
2537 spr_register(env
, SPR_MPC_MD_EPN
, "MD_EPN",
2538 SPR_NOACCESS
, SPR_NOACCESS
,
2539 &spr_read_generic
, &spr_write_generic
,
2541 /* XXX : not implemented */
2542 spr_register(env
, SPR_MPC_MD_TWB
, "MD_TWB",
2543 SPR_NOACCESS
, SPR_NOACCESS
,
2544 &spr_read_generic
, &spr_write_generic
,
2546 /* XXX : not implemented */
2547 spr_register(env
, SPR_MPC_MD_TWC
, "MD_TWC",
2548 SPR_NOACCESS
, SPR_NOACCESS
,
2549 &spr_read_generic
, &spr_write_generic
,
2551 /* XXX : not implemented */
2552 spr_register(env
, SPR_MPC_MD_RPN
, "MD_RPN",
2553 SPR_NOACCESS
, SPR_NOACCESS
,
2554 &spr_read_generic
, &spr_write_generic
,
2556 /* XXX : not implemented */
2557 spr_register(env
, SPR_MPC_MD_TW
, "MD_TW",
2558 SPR_NOACCESS
, SPR_NOACCESS
,
2559 &spr_read_generic
, &spr_write_generic
,
2561 /* XXX : not implemented */
2562 spr_register(env
, SPR_MPC_MD_DBCAM
, "MD_DBCAM",
2563 SPR_NOACCESS
, SPR_NOACCESS
,
2564 &spr_read_generic
, &spr_write_generic
,
2566 /* XXX : not implemented */
2567 spr_register(env
, SPR_MPC_MD_DBRAM0
, "MD_DBRAM0",
2568 SPR_NOACCESS
, SPR_NOACCESS
,
2569 &spr_read_generic
, &spr_write_generic
,
2571 /* XXX : not implemented */
2572 spr_register(env
, SPR_MPC_MD_DBRAM1
, "MD_DBRAM1",
2573 SPR_NOACCESS
, SPR_NOACCESS
,
2574 &spr_read_generic
, &spr_write_generic
,
2580 * AMR => SPR 29 (Power 2.04)
2581 * CTRL => SPR 136 (Power 2.04)
2582 * CTRL => SPR 152 (Power 2.04)
2583 * SCOMC => SPR 276 (64 bits ?)
2584 * SCOMD => SPR 277 (64 bits ?)
2585 * TBU40 => SPR 286 (Power 2.04 hypv)
2586 * HSPRG0 => SPR 304 (Power 2.04 hypv)
2587 * HSPRG1 => SPR 305 (Power 2.04 hypv)
2588 * HDSISR => SPR 306 (Power 2.04 hypv)
2589 * HDAR => SPR 307 (Power 2.04 hypv)
2590 * PURR => SPR 309 (Power 2.04 hypv)
2591 * HDEC => SPR 310 (Power 2.04 hypv)
2592 * HIOR => SPR 311 (hypv)
2593 * RMOR => SPR 312 (970)
2594 * HRMOR => SPR 313 (Power 2.04 hypv)
2595 * HSRR0 => SPR 314 (Power 2.04 hypv)
2596 * HSRR1 => SPR 315 (Power 2.04 hypv)
2597 * LPIDR => SPR 317 (970)
2598 * EPR => SPR 702 (Power 2.04 emb)
2599 * perf => 768-783 (Power 2.04)
2600 * perf => 784-799 (Power 2.04)
2601 * PPR => SPR 896 (Power 2.04)
2602 * EPLC => SPR 947 (Power 2.04 emb)
2603 * EPSC => SPR 948 (Power 2.04 emb)
2604 * DABRX => 1015 (Power 2.04 hypv)
2605 * FPECR => SPR 1022 (?)
2606 * ... and more (thermal management, performance counters, ...)
2609 /*****************************************************************************/
2610 /* Exception vectors models */
2611 static void init_excp_4xx_real (CPUPPCState
*env
)
2613 #if !defined(CONFIG_USER_ONLY)
2614 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2615 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2616 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2617 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2618 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2619 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2620 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2621 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2622 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2623 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2624 env
->ivor_mask
= 0x0000FFF0UL
;
2625 env
->ivpr_mask
= 0xFFFF0000UL
;
2626 /* Hardware reset vector */
2627 env
->hreset_vector
= 0xFFFFFFFCUL
;
2631 static void init_excp_4xx_softmmu (CPUPPCState
*env
)
2633 #if !defined(CONFIG_USER_ONLY)
2634 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2635 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2636 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2637 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2638 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2639 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2640 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2641 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2642 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2643 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2644 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2645 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001100;
2646 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001200;
2647 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2648 env
->ivor_mask
= 0x0000FFF0UL
;
2649 env
->ivpr_mask
= 0xFFFF0000UL
;
2650 /* Hardware reset vector */
2651 env
->hreset_vector
= 0xFFFFFFFCUL
;
2655 static void init_excp_MPC5xx (CPUPPCState
*env
)
2657 #if !defined(CONFIG_USER_ONLY)
2658 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2659 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2660 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2661 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2662 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2663 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2664 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2665 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2666 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2667 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2668 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2669 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2670 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2671 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2672 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2673 env
->ivor_mask
= 0x0000FFF0UL
;
2674 env
->ivpr_mask
= 0xFFFF0000UL
;
2675 /* Hardware reset vector */
2676 env
->hreset_vector
= 0x00000100UL
;
2680 static void init_excp_MPC8xx (CPUPPCState
*env
)
2682 #if !defined(CONFIG_USER_ONLY)
2683 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2684 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2685 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2686 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2687 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2688 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2689 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2690 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2691 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2692 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2693 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2694 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2695 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2696 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001100;
2697 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001200;
2698 env
->excp_vectors
[POWERPC_EXCP_ITLBE
] = 0x00001300;
2699 env
->excp_vectors
[POWERPC_EXCP_DTLBE
] = 0x00001400;
2700 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2701 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2702 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2703 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2704 env
->ivor_mask
= 0x0000FFF0UL
;
2705 env
->ivpr_mask
= 0xFFFF0000UL
;
2706 /* Hardware reset vector */
2707 env
->hreset_vector
= 0x00000100UL
;
2711 static void init_excp_G2 (CPUPPCState
*env
)
2713 #if !defined(CONFIG_USER_ONLY)
2714 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2715 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2716 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2717 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2718 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2719 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2720 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2721 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2722 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2723 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000A00;
2724 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2725 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2726 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2727 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2728 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2729 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2730 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2731 /* Hardware reset vector */
2732 env
->hreset_vector
= 0x00000100UL
;
2736 static void init_excp_e200(CPUPPCState
*env
, target_ulong ivpr_mask
)
2738 #if !defined(CONFIG_USER_ONLY)
2739 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000FFC;
2740 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2741 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2742 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2743 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2744 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2745 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2746 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2747 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2748 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2749 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2750 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2751 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2752 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2753 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2754 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2755 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2756 env
->excp_vectors
[POWERPC_EXCP_SPEU
] = 0x00000000;
2757 env
->excp_vectors
[POWERPC_EXCP_EFPDI
] = 0x00000000;
2758 env
->excp_vectors
[POWERPC_EXCP_EFPRI
] = 0x00000000;
2759 env
->ivor_mask
= 0x0000FFF7UL
;
2760 env
->ivpr_mask
= ivpr_mask
;
2761 /* Hardware reset vector */
2762 env
->hreset_vector
= 0xFFFFFFFCUL
;
2766 static void init_excp_BookE (CPUPPCState
*env
)
2768 #if !defined(CONFIG_USER_ONLY)
2769 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2770 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2771 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2772 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2773 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2774 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2775 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2776 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2777 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2778 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2779 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2780 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2781 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2782 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2783 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2784 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2785 env
->ivor_mask
= 0x0000FFF0UL
;
2786 env
->ivpr_mask
= 0xFFFF0000UL
;
2787 /* Hardware reset vector */
2788 env
->hreset_vector
= 0xFFFFFFFCUL
;
2792 static void init_excp_601 (CPUPPCState
*env
)
2794 #if !defined(CONFIG_USER_ONLY)
2795 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2796 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2797 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2798 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2799 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2800 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2801 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2802 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2803 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2804 env
->excp_vectors
[POWERPC_EXCP_IO
] = 0x00000A00;
2805 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2806 env
->excp_vectors
[POWERPC_EXCP_RUNM
] = 0x00002000;
2807 /* Hardware reset vector */
2808 env
->hreset_vector
= 0x00000100UL
;
2812 static void init_excp_602 (CPUPPCState
*env
)
2814 #if !defined(CONFIG_USER_ONLY)
2815 /* XXX: exception prefix has a special behavior on 602 */
2816 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2817 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2818 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2819 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2820 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2821 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2822 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2823 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2824 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2825 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2826 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2827 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2828 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2829 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2830 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2831 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2832 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001500;
2833 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001600;
2834 /* Hardware reset vector */
2835 env
->hreset_vector
= 0x00000100UL
;
2839 static void init_excp_603 (CPUPPCState
*env
)
2841 #if !defined(CONFIG_USER_ONLY)
2842 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2843 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2844 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2845 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2846 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2847 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2848 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2849 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2850 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2851 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2852 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2853 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2854 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2855 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2856 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2857 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2858 /* Hardware reset vector */
2859 env
->hreset_vector
= 0x00000100UL
;
2863 static void init_excp_604 (CPUPPCState
*env
)
2865 #if !defined(CONFIG_USER_ONLY)
2866 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2867 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2868 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2869 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2870 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2871 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2872 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2873 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2874 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2875 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2876 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2877 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2878 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2879 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2880 /* Hardware reset vector */
2881 env
->hreset_vector
= 0x00000100UL
;
2885 static void init_excp_7x0 (CPUPPCState
*env
)
2887 #if !defined(CONFIG_USER_ONLY)
2888 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2889 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2890 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2891 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2892 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2893 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2894 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2895 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2896 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2897 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2898 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2899 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2900 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2901 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2902 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2903 /* Hardware reset vector */
2904 env
->hreset_vector
= 0x00000100UL
;
2908 static void init_excp_750cl (CPUPPCState
*env
)
2910 #if !defined(CONFIG_USER_ONLY)
2911 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2912 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2913 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2914 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2915 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2916 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2917 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2918 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2919 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2920 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2921 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2922 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2923 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2924 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2925 /* Hardware reset vector */
2926 env
->hreset_vector
= 0x00000100UL
;
2930 static void init_excp_750cx (CPUPPCState
*env
)
2932 #if !defined(CONFIG_USER_ONLY)
2933 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2934 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2935 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2936 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2937 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2938 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2939 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2940 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2941 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2942 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2943 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2944 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2945 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2946 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2947 /* Hardware reset vector */
2948 env
->hreset_vector
= 0x00000100UL
;
2952 /* XXX: Check if this is correct */
2953 static void init_excp_7x5 (CPUPPCState
*env
)
2955 #if !defined(CONFIG_USER_ONLY)
2956 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2957 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2958 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2959 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2960 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2961 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2962 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2963 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2964 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2965 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2966 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2967 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2968 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2969 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2970 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2971 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2972 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2973 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2974 /* Hardware reset vector */
2975 env
->hreset_vector
= 0x00000100UL
;
2979 static void init_excp_7400 (CPUPPCState
*env
)
2981 #if !defined(CONFIG_USER_ONLY)
2982 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2983 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2984 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2985 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2986 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2987 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2988 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2989 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2990 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2991 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2992 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2993 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2994 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
2995 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2996 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2997 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
2998 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2999 /* Hardware reset vector */
3000 env
->hreset_vector
= 0x00000100UL
;
3004 static void init_excp_7450 (CPUPPCState
*env
)
3006 #if !defined(CONFIG_USER_ONLY)
3007 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3008 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3009 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3010 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3011 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3012 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3013 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3014 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3015 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3016 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3017 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3018 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3019 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3020 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3021 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3022 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3023 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3024 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3025 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3026 /* Hardware reset vector */
3027 env
->hreset_vector
= 0x00000100UL
;
3031 #if defined (TARGET_PPC64)
3032 static void init_excp_970 (CPUPPCState
*env
)
3034 #if !defined(CONFIG_USER_ONLY)
3035 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3036 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3037 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3038 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3039 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3040 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3041 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3042 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3043 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3044 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3045 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3046 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3047 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3048 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3049 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3050 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3051 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3052 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
3053 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
3054 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
3055 /* Hardware reset vector */
3056 env
->hreset_vector
= 0x0000000000000100ULL
;
3060 static void init_excp_POWER7 (CPUPPCState
*env
)
3062 #if !defined(CONFIG_USER_ONLY)
3063 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3064 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3065 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3066 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3067 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3068 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3069 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3070 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3071 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3072 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3073 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3074 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3075 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3076 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3077 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3078 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3079 env
->excp_vectors
[POWERPC_EXCP_VSXU
] = 0x00000F40;
3080 env
->excp_vectors
[POWERPC_EXCP_FU
] = 0x00000F60;
3081 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3082 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
3083 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
3084 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
3085 /* Hardware reset vector */
3086 env
->hreset_vector
= 0x0000000000000100ULL
;
3091 /*****************************************************************************/
3092 /* Power management enable checks */
3093 static int check_pow_none (CPUPPCState
*env
)
3098 static int check_pow_nocheck (CPUPPCState
*env
)
3103 static int check_pow_hid0 (CPUPPCState
*env
)
3105 if (env
->spr
[SPR_HID0
] & 0x00E00000)
3111 static int check_pow_hid0_74xx (CPUPPCState
*env
)
3113 if (env
->spr
[SPR_HID0
] & 0x00600000)
3119 static bool ppc_cpu_interrupts_big_endian_always(PowerPCCPU
*cpu
)
3125 static bool ppc_cpu_interrupts_big_endian_lpcr(PowerPCCPU
*cpu
)
3127 return !(cpu
->env
.spr
[SPR_LPCR
] & LPCR_ILE
);
3131 /*****************************************************************************/
3132 /* PowerPC implementations definitions */
3134 #define POWERPC_FAMILY(_name) \
3136 glue(glue(ppc_, _name), _cpu_family_class_init)(ObjectClass *, void *); \
3138 static const TypeInfo \
3139 glue(glue(ppc_, _name), _cpu_family_type_info) = { \
3140 .name = stringify(_name) "-family-" TYPE_POWERPC_CPU, \
3141 .parent = TYPE_POWERPC_CPU, \
3143 .class_init = glue(glue(ppc_, _name), _cpu_family_class_init), \
3146 static void glue(glue(ppc_, _name), _cpu_family_register_types)(void) \
3148 type_register_static( \
3149 &glue(glue(ppc_, _name), _cpu_family_type_info)); \
3152 type_init(glue(glue(ppc_, _name), _cpu_family_register_types)) \
3154 static void glue(glue(ppc_, _name), _cpu_family_class_init)
3156 static void init_proc_401 (CPUPPCState
*env
)
3159 gen_spr_401_403(env
);
3161 init_excp_4xx_real(env
);
3162 env
->dcache_line_size
= 32;
3163 env
->icache_line_size
= 32;
3164 /* Allocate hardware IRQ controller */
3165 ppc40x_irq_init(env
);
3167 SET_FIT_PERIOD(12, 16, 20, 24);
3168 SET_WDT_PERIOD(16, 20, 24, 28);
3171 POWERPC_FAMILY(401)(ObjectClass
*oc
, void *data
)
3173 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3174 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3176 dc
->desc
= "PowerPC 401";
3177 pcc
->init_proc
= init_proc_401
;
3178 pcc
->check_pow
= check_pow_nocheck
;
3179 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3180 PPC_WRTEE
| PPC_DCR
|
3181 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3183 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3184 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3185 pcc
->msr_mask
= (1ull << MSR_KEY
) |
3194 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3195 pcc
->excp_model
= POWERPC_EXCP_40x
;
3196 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3197 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3198 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3199 POWERPC_FLAG_BUS_CLK
;
3202 static void init_proc_401x2 (CPUPPCState
*env
)
3205 gen_spr_401_403(env
);
3207 gen_spr_compress(env
);
3208 /* Memory management */
3209 #if !defined(CONFIG_USER_ONLY)
3213 env
->tlb_type
= TLB_EMB
;
3215 init_excp_4xx_softmmu(env
);
3216 env
->dcache_line_size
= 32;
3217 env
->icache_line_size
= 32;
3218 /* Allocate hardware IRQ controller */
3219 ppc40x_irq_init(env
);
3221 SET_FIT_PERIOD(12, 16, 20, 24);
3222 SET_WDT_PERIOD(16, 20, 24, 28);
3225 POWERPC_FAMILY(401x2
)(ObjectClass
*oc
, void *data
)
3227 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3228 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3230 dc
->desc
= "PowerPC 401x2";
3231 pcc
->init_proc
= init_proc_401x2
;
3232 pcc
->check_pow
= check_pow_nocheck
;
3233 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3234 PPC_DCR
| PPC_WRTEE
|
3235 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3236 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3237 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3238 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3239 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3240 pcc
->msr_mask
= (1ull << 20) |
3252 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3253 pcc
->excp_model
= POWERPC_EXCP_40x
;
3254 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3255 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3256 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3257 POWERPC_FLAG_BUS_CLK
;
3260 static void init_proc_401x3 (CPUPPCState
*env
)
3263 gen_spr_401_403(env
);
3266 gen_spr_compress(env
);
3267 init_excp_4xx_softmmu(env
);
3268 env
->dcache_line_size
= 32;
3269 env
->icache_line_size
= 32;
3270 /* Allocate hardware IRQ controller */
3271 ppc40x_irq_init(env
);
3273 SET_FIT_PERIOD(12, 16, 20, 24);
3274 SET_WDT_PERIOD(16, 20, 24, 28);
3277 POWERPC_FAMILY(401x3
)(ObjectClass
*oc
, void *data
)
3279 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3280 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3282 dc
->desc
= "PowerPC 401x3";
3283 pcc
->init_proc
= init_proc_401x3
;
3284 pcc
->check_pow
= check_pow_nocheck
;
3285 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3286 PPC_DCR
| PPC_WRTEE
|
3287 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3288 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3289 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3290 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3291 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3292 pcc
->msr_mask
= (1ull << 20) |
3305 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3306 pcc
->excp_model
= POWERPC_EXCP_40x
;
3307 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3308 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3309 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3310 POWERPC_FLAG_BUS_CLK
;
3313 static void init_proc_IOP480 (CPUPPCState
*env
)
3316 gen_spr_401_403(env
);
3318 gen_spr_compress(env
);
3319 /* Memory management */
3320 #if !defined(CONFIG_USER_ONLY)
3324 env
->tlb_type
= TLB_EMB
;
3326 init_excp_4xx_softmmu(env
);
3327 env
->dcache_line_size
= 32;
3328 env
->icache_line_size
= 32;
3329 /* Allocate hardware IRQ controller */
3330 ppc40x_irq_init(env
);
3332 SET_FIT_PERIOD(8, 12, 16, 20);
3333 SET_WDT_PERIOD(16, 20, 24, 28);
3336 POWERPC_FAMILY(IOP480
)(ObjectClass
*oc
, void *data
)
3338 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3339 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3341 dc
->desc
= "IOP480";
3342 pcc
->init_proc
= init_proc_IOP480
;
3343 pcc
->check_pow
= check_pow_nocheck
;
3344 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3345 PPC_DCR
| PPC_WRTEE
|
3346 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3347 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3348 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3349 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3350 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3351 pcc
->msr_mask
= (1ull << 20) |
3363 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3364 pcc
->excp_model
= POWERPC_EXCP_40x
;
3365 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3366 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3367 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3368 POWERPC_FLAG_BUS_CLK
;
3371 static void init_proc_403 (CPUPPCState
*env
)
3374 gen_spr_401_403(env
);
3376 gen_spr_403_real(env
);
3377 init_excp_4xx_real(env
);
3378 env
->dcache_line_size
= 32;
3379 env
->icache_line_size
= 32;
3380 /* Allocate hardware IRQ controller */
3381 ppc40x_irq_init(env
);
3383 SET_FIT_PERIOD(8, 12, 16, 20);
3384 SET_WDT_PERIOD(16, 20, 24, 28);
3387 POWERPC_FAMILY(403)(ObjectClass
*oc
, void *data
)
3389 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3390 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3392 dc
->desc
= "PowerPC 403";
3393 pcc
->init_proc
= init_proc_403
;
3394 pcc
->check_pow
= check_pow_nocheck
;
3395 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3396 PPC_DCR
| PPC_WRTEE
|
3397 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3399 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3400 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3401 pcc
->msr_mask
= (1ull << MSR_POW
) |
3410 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3411 pcc
->excp_model
= POWERPC_EXCP_40x
;
3412 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3413 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3414 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3415 POWERPC_FLAG_BUS_CLK
;
3418 static void init_proc_403GCX (CPUPPCState
*env
)
3421 gen_spr_401_403(env
);
3423 gen_spr_403_real(env
);
3424 gen_spr_403_mmu(env
);
3425 /* Bus access control */
3426 /* not emulated, as QEMU never does speculative access */
3427 spr_register(env
, SPR_40x_SGR
, "SGR",
3428 SPR_NOACCESS
, SPR_NOACCESS
,
3429 &spr_read_generic
, &spr_write_generic
,
3431 /* not emulated, as QEMU do not emulate caches */
3432 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3433 SPR_NOACCESS
, SPR_NOACCESS
,
3434 &spr_read_generic
, &spr_write_generic
,
3436 /* Memory management */
3437 #if !defined(CONFIG_USER_ONLY)
3441 env
->tlb_type
= TLB_EMB
;
3443 init_excp_4xx_softmmu(env
);
3444 env
->dcache_line_size
= 32;
3445 env
->icache_line_size
= 32;
3446 /* Allocate hardware IRQ controller */
3447 ppc40x_irq_init(env
);
3449 SET_FIT_PERIOD(8, 12, 16, 20);
3450 SET_WDT_PERIOD(16, 20, 24, 28);
3453 POWERPC_FAMILY(403GCX
)(ObjectClass
*oc
, void *data
)
3455 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3456 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3458 dc
->desc
= "PowerPC 403 GCX";
3459 pcc
->init_proc
= init_proc_403GCX
;
3460 pcc
->check_pow
= check_pow_nocheck
;
3461 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3462 PPC_DCR
| PPC_WRTEE
|
3463 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3465 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3466 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3467 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3468 pcc
->msr_mask
= (1ull << MSR_POW
) |
3477 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3478 pcc
->excp_model
= POWERPC_EXCP_40x
;
3479 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3480 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3481 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3482 POWERPC_FLAG_BUS_CLK
;
3485 static void init_proc_405 (CPUPPCState
*env
)
3491 /* Bus access control */
3492 /* not emulated, as QEMU never does speculative access */
3493 spr_register(env
, SPR_40x_SGR
, "SGR",
3494 SPR_NOACCESS
, SPR_NOACCESS
,
3495 &spr_read_generic
, &spr_write_generic
,
3497 /* not emulated, as QEMU do not emulate caches */
3498 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3499 SPR_NOACCESS
, SPR_NOACCESS
,
3500 &spr_read_generic
, &spr_write_generic
,
3502 /* Memory management */
3503 #if !defined(CONFIG_USER_ONLY)
3507 env
->tlb_type
= TLB_EMB
;
3509 init_excp_4xx_softmmu(env
);
3510 env
->dcache_line_size
= 32;
3511 env
->icache_line_size
= 32;
3512 /* Allocate hardware IRQ controller */
3513 ppc40x_irq_init(env
);
3515 SET_FIT_PERIOD(8, 12, 16, 20);
3516 SET_WDT_PERIOD(16, 20, 24, 28);
3519 POWERPC_FAMILY(405)(ObjectClass
*oc
, void *data
)
3521 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3522 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3524 dc
->desc
= "PowerPC 405";
3525 pcc
->init_proc
= init_proc_405
;
3526 pcc
->check_pow
= check_pow_nocheck
;
3527 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3528 PPC_DCR
| PPC_WRTEE
|
3529 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3530 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3531 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3532 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3533 PPC_4xx_COMMON
| PPC_405_MAC
| PPC_40x_EXCP
;
3534 pcc
->msr_mask
= (1ull << MSR_POW
) |
3543 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx
;
3544 pcc
->excp_model
= POWERPC_EXCP_40x
;
3545 pcc
->bus_model
= PPC_FLAGS_INPUT_405
;
3546 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3547 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3548 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3551 static void init_proc_440EP (CPUPPCState
*env
)
3555 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3557 gen_spr_usprgh(env
);
3558 /* Processor identification */
3559 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3560 SPR_NOACCESS
, SPR_NOACCESS
,
3561 &spr_read_generic
, &spr_write_pir
,
3563 /* XXX : not implemented */
3564 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3565 SPR_NOACCESS
, SPR_NOACCESS
,
3566 &spr_read_generic
, &spr_write_generic
,
3568 /* XXX : not implemented */
3569 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3570 SPR_NOACCESS
, SPR_NOACCESS
,
3571 &spr_read_generic
, &spr_write_generic
,
3573 /* XXX : not implemented */
3574 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3575 SPR_NOACCESS
, SPR_NOACCESS
,
3576 &spr_read_generic
, &spr_write_generic
,
3578 /* XXX : not implemented */
3579 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3580 SPR_NOACCESS
, SPR_NOACCESS
,
3581 &spr_read_generic
, &spr_write_generic
,
3583 /* XXX : not implemented */
3584 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3585 SPR_NOACCESS
, SPR_NOACCESS
,
3586 &spr_read_generic
, &spr_write_generic
,
3588 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3589 SPR_NOACCESS
, SPR_NOACCESS
,
3590 &spr_read_generic
, &spr_write_generic
,
3592 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3593 SPR_NOACCESS
, SPR_NOACCESS
,
3594 &spr_read_generic
, &spr_write_generic
,
3596 /* XXX : not implemented */
3597 spr_register(env
, SPR_440_CCR1
, "CCR1",
3598 SPR_NOACCESS
, SPR_NOACCESS
,
3599 &spr_read_generic
, &spr_write_generic
,
3601 /* Memory management */
3602 #if !defined(CONFIG_USER_ONLY)
3606 env
->tlb_type
= TLB_EMB
;
3608 init_excp_BookE(env
);
3609 env
->dcache_line_size
= 32;
3610 env
->icache_line_size
= 32;
3611 ppc40x_irq_init(env
);
3613 SET_FIT_PERIOD(12, 16, 20, 24);
3614 SET_WDT_PERIOD(20, 24, 28, 32);
3617 POWERPC_FAMILY(440EP
)(ObjectClass
*oc
, void *data
)
3619 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3620 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3622 dc
->desc
= "PowerPC 440 EP";
3623 pcc
->init_proc
= init_proc_440EP
;
3624 pcc
->check_pow
= check_pow_nocheck
;
3625 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3626 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
3627 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
3629 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
3630 PPC_CACHE
| PPC_CACHE_ICBI
|
3631 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3632 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3633 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3635 pcc
->msr_mask
= (1ull << MSR_POW
) |
3647 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3648 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3649 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3650 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3651 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3652 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3655 static void init_proc_440GP (CPUPPCState
*env
)
3659 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3661 gen_spr_usprgh(env
);
3662 /* Processor identification */
3663 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3664 SPR_NOACCESS
, SPR_NOACCESS
,
3665 &spr_read_generic
, &spr_write_pir
,
3667 /* XXX : not implemented */
3668 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3669 SPR_NOACCESS
, SPR_NOACCESS
,
3670 &spr_read_generic
, &spr_write_generic
,
3672 /* XXX : not implemented */
3673 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3674 SPR_NOACCESS
, SPR_NOACCESS
,
3675 &spr_read_generic
, &spr_write_generic
,
3677 /* XXX : not implemented */
3678 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3679 SPR_NOACCESS
, SPR_NOACCESS
,
3680 &spr_read_generic
, &spr_write_generic
,
3682 /* XXX : not implemented */
3683 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3684 SPR_NOACCESS
, SPR_NOACCESS
,
3685 &spr_read_generic
, &spr_write_generic
,
3687 /* Memory management */
3688 #if !defined(CONFIG_USER_ONLY)
3692 env
->tlb_type
= TLB_EMB
;
3694 init_excp_BookE(env
);
3695 env
->dcache_line_size
= 32;
3696 env
->icache_line_size
= 32;
3697 /* XXX: TODO: allocate internal IRQ controller */
3699 SET_FIT_PERIOD(12, 16, 20, 24);
3700 SET_WDT_PERIOD(20, 24, 28, 32);
3703 POWERPC_FAMILY(440GP
)(ObjectClass
*oc
, void *data
)
3705 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3706 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3708 dc
->desc
= "PowerPC 440 GP";
3709 pcc
->init_proc
= init_proc_440GP
;
3710 pcc
->check_pow
= check_pow_nocheck
;
3711 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3712 PPC_DCR
| PPC_DCRX
| PPC_WRTEE
| PPC_MFAPIDI
|
3713 PPC_CACHE
| PPC_CACHE_ICBI
|
3714 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3715 PPC_MEM_TLBSYNC
| PPC_TLBIVA
| PPC_MFTB
|
3716 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3718 pcc
->msr_mask
= (1ull << MSR_POW
) |
3730 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3731 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3732 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3733 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3734 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3735 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3738 static void init_proc_440x4 (CPUPPCState
*env
)
3742 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3744 gen_spr_usprgh(env
);
3745 /* Processor identification */
3746 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3747 SPR_NOACCESS
, SPR_NOACCESS
,
3748 &spr_read_generic
, &spr_write_pir
,
3750 /* XXX : not implemented */
3751 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3752 SPR_NOACCESS
, SPR_NOACCESS
,
3753 &spr_read_generic
, &spr_write_generic
,
3755 /* XXX : not implemented */
3756 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3757 SPR_NOACCESS
, SPR_NOACCESS
,
3758 &spr_read_generic
, &spr_write_generic
,
3760 /* XXX : not implemented */
3761 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3762 SPR_NOACCESS
, SPR_NOACCESS
,
3763 &spr_read_generic
, &spr_write_generic
,
3765 /* XXX : not implemented */
3766 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3767 SPR_NOACCESS
, SPR_NOACCESS
,
3768 &spr_read_generic
, &spr_write_generic
,
3770 /* Memory management */
3771 #if !defined(CONFIG_USER_ONLY)
3775 env
->tlb_type
= TLB_EMB
;
3777 init_excp_BookE(env
);
3778 env
->dcache_line_size
= 32;
3779 env
->icache_line_size
= 32;
3780 /* XXX: TODO: allocate internal IRQ controller */
3782 SET_FIT_PERIOD(12, 16, 20, 24);
3783 SET_WDT_PERIOD(20, 24, 28, 32);
3786 POWERPC_FAMILY(440x4
)(ObjectClass
*oc
, void *data
)
3788 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3789 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3791 dc
->desc
= "PowerPC 440x4";
3792 pcc
->init_proc
= init_proc_440x4
;
3793 pcc
->check_pow
= check_pow_nocheck
;
3794 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3795 PPC_DCR
| PPC_WRTEE
|
3796 PPC_CACHE
| PPC_CACHE_ICBI
|
3797 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3798 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3799 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3801 pcc
->msr_mask
= (1ull << MSR_POW
) |
3813 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3814 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3815 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3816 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3817 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3818 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3821 static void init_proc_440x5 (CPUPPCState
*env
)
3825 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3827 gen_spr_usprgh(env
);
3828 /* Processor identification */
3829 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3830 SPR_NOACCESS
, SPR_NOACCESS
,
3831 &spr_read_generic
, &spr_write_pir
,
3833 /* XXX : not implemented */
3834 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3835 SPR_NOACCESS
, SPR_NOACCESS
,
3836 &spr_read_generic
, &spr_write_generic
,
3838 /* XXX : not implemented */
3839 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3840 SPR_NOACCESS
, SPR_NOACCESS
,
3841 &spr_read_generic
, &spr_write_generic
,
3843 /* XXX : not implemented */
3844 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3845 SPR_NOACCESS
, SPR_NOACCESS
,
3846 &spr_read_generic
, &spr_write_generic
,
3848 /* XXX : not implemented */
3849 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3850 SPR_NOACCESS
, SPR_NOACCESS
,
3851 &spr_read_generic
, &spr_write_generic
,
3853 /* XXX : not implemented */
3854 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3855 SPR_NOACCESS
, SPR_NOACCESS
,
3856 &spr_read_generic
, &spr_write_generic
,
3858 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3859 SPR_NOACCESS
, SPR_NOACCESS
,
3860 &spr_read_generic
, &spr_write_generic
,
3862 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3863 SPR_NOACCESS
, SPR_NOACCESS
,
3864 &spr_read_generic
, &spr_write_generic
,
3866 /* XXX : not implemented */
3867 spr_register(env
, SPR_440_CCR1
, "CCR1",
3868 SPR_NOACCESS
, SPR_NOACCESS
,
3869 &spr_read_generic
, &spr_write_generic
,
3871 /* Memory management */
3872 #if !defined(CONFIG_USER_ONLY)
3876 env
->tlb_type
= TLB_EMB
;
3878 init_excp_BookE(env
);
3879 env
->dcache_line_size
= 32;
3880 env
->icache_line_size
= 32;
3881 ppc40x_irq_init(env
);
3883 SET_FIT_PERIOD(12, 16, 20, 24);
3884 SET_WDT_PERIOD(20, 24, 28, 32);
3887 POWERPC_FAMILY(440x5
)(ObjectClass
*oc
, void *data
)
3889 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3890 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3892 dc
->desc
= "PowerPC 440x5";
3893 pcc
->init_proc
= init_proc_440x5
;
3894 pcc
->check_pow
= check_pow_nocheck
;
3895 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3896 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
3897 PPC_CACHE
| PPC_CACHE_ICBI
|
3898 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3899 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3900 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3902 pcc
->msr_mask
= (1ull << MSR_POW
) |
3914 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3915 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3916 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3917 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3918 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3919 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3922 POWERPC_FAMILY(440x5wDFPU
)(ObjectClass
*oc
, void *data
)
3924 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3925 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3927 dc
->desc
= "PowerPC 440x5 with double precision FPU";
3928 pcc
->init_proc
= init_proc_440x5
;
3929 pcc
->check_pow
= check_pow_nocheck
;
3930 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3931 PPC_FLOAT
| PPC_FLOAT_FSQRT
|
3933 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
3934 PPC_CACHE
| PPC_CACHE_ICBI
|
3935 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3936 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3937 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3939 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
3940 pcc
->msr_mask
= (1ull << MSR_POW
) |
3952 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3953 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3954 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3955 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3956 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3957 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3960 static void init_proc_460 (CPUPPCState
*env
)
3964 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3966 gen_spr_usprgh(env
);
3967 /* Processor identification */
3968 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3969 SPR_NOACCESS
, SPR_NOACCESS
,
3970 &spr_read_generic
, &spr_write_pir
,
3972 /* XXX : not implemented */
3973 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3974 SPR_NOACCESS
, SPR_NOACCESS
,
3975 &spr_read_generic
, &spr_write_generic
,
3977 /* XXX : not implemented */
3978 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3979 SPR_NOACCESS
, SPR_NOACCESS
,
3980 &spr_read_generic
, &spr_write_generic
,
3982 /* XXX : not implemented */
3983 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3984 SPR_NOACCESS
, SPR_NOACCESS
,
3985 &spr_read_generic
, &spr_write_generic
,
3987 /* XXX : not implemented */
3988 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3989 SPR_NOACCESS
, SPR_NOACCESS
,
3990 &spr_read_generic
, &spr_write_generic
,
3992 /* XXX : not implemented */
3993 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3994 SPR_NOACCESS
, SPR_NOACCESS
,
3995 &spr_read_generic
, &spr_write_generic
,
3997 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3998 SPR_NOACCESS
, SPR_NOACCESS
,
3999 &spr_read_generic
, &spr_write_generic
,
4001 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4002 SPR_NOACCESS
, SPR_NOACCESS
,
4003 &spr_read_generic
, &spr_write_generic
,
4005 /* XXX : not implemented */
4006 spr_register(env
, SPR_440_CCR1
, "CCR1",
4007 SPR_NOACCESS
, SPR_NOACCESS
,
4008 &spr_read_generic
, &spr_write_generic
,
4010 /* XXX : not implemented */
4011 spr_register(env
, SPR_DCRIPR
, "SPR_DCRIPR",
4012 &spr_read_generic
, &spr_write_generic
,
4013 &spr_read_generic
, &spr_write_generic
,
4015 /* Memory management */
4016 #if !defined(CONFIG_USER_ONLY)
4020 env
->tlb_type
= TLB_EMB
;
4022 init_excp_BookE(env
);
4023 env
->dcache_line_size
= 32;
4024 env
->icache_line_size
= 32;
4025 /* XXX: TODO: allocate internal IRQ controller */
4027 SET_FIT_PERIOD(12, 16, 20, 24);
4028 SET_WDT_PERIOD(20, 24, 28, 32);
4031 POWERPC_FAMILY(460)(ObjectClass
*oc
, void *data
)
4033 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4034 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4036 dc
->desc
= "PowerPC 460 (guessed)";
4037 pcc
->init_proc
= init_proc_460
;
4038 pcc
->check_pow
= check_pow_nocheck
;
4039 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4040 PPC_DCR
| PPC_DCRX
| PPC_DCRUX
|
4041 PPC_WRTEE
| PPC_MFAPIDI
| PPC_MFTB
|
4042 PPC_CACHE
| PPC_CACHE_ICBI
|
4043 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4044 PPC_MEM_TLBSYNC
| PPC_TLBIVA
|
4045 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4047 pcc
->msr_mask
= (1ull << MSR_POW
) |
4059 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4060 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4061 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4062 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4063 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4064 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4067 static void init_proc_460F (CPUPPCState
*env
)
4071 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4073 gen_spr_usprgh(env
);
4074 /* Processor identification */
4075 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4076 SPR_NOACCESS
, SPR_NOACCESS
,
4077 &spr_read_generic
, &spr_write_pir
,
4079 /* XXX : not implemented */
4080 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4081 SPR_NOACCESS
, SPR_NOACCESS
,
4082 &spr_read_generic
, &spr_write_generic
,
4084 /* XXX : not implemented */
4085 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4086 SPR_NOACCESS
, SPR_NOACCESS
,
4087 &spr_read_generic
, &spr_write_generic
,
4089 /* XXX : not implemented */
4090 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4091 SPR_NOACCESS
, SPR_NOACCESS
,
4092 &spr_read_generic
, &spr_write_generic
,
4094 /* XXX : not implemented */
4095 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4096 SPR_NOACCESS
, SPR_NOACCESS
,
4097 &spr_read_generic
, &spr_write_generic
,
4099 /* XXX : not implemented */
4100 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4101 SPR_NOACCESS
, SPR_NOACCESS
,
4102 &spr_read_generic
, &spr_write_generic
,
4104 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4105 SPR_NOACCESS
, SPR_NOACCESS
,
4106 &spr_read_generic
, &spr_write_generic
,
4108 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4109 SPR_NOACCESS
, SPR_NOACCESS
,
4110 &spr_read_generic
, &spr_write_generic
,
4112 /* XXX : not implemented */
4113 spr_register(env
, SPR_440_CCR1
, "CCR1",
4114 SPR_NOACCESS
, SPR_NOACCESS
,
4115 &spr_read_generic
, &spr_write_generic
,
4117 /* XXX : not implemented */
4118 spr_register(env
, SPR_DCRIPR
, "SPR_DCRIPR",
4119 &spr_read_generic
, &spr_write_generic
,
4120 &spr_read_generic
, &spr_write_generic
,
4122 /* Memory management */
4123 #if !defined(CONFIG_USER_ONLY)
4127 env
->tlb_type
= TLB_EMB
;
4129 init_excp_BookE(env
);
4130 env
->dcache_line_size
= 32;
4131 env
->icache_line_size
= 32;
4132 /* XXX: TODO: allocate internal IRQ controller */
4134 SET_FIT_PERIOD(12, 16, 20, 24);
4135 SET_WDT_PERIOD(20, 24, 28, 32);
4138 POWERPC_FAMILY(460F
)(ObjectClass
*oc
, void *data
)
4140 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4141 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4143 dc
->desc
= "PowerPC 460F (guessed)";
4144 pcc
->init_proc
= init_proc_460F
;
4145 pcc
->check_pow
= check_pow_nocheck
;
4146 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4147 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
4148 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
4149 PPC_FLOAT_STFIWX
| PPC_MFTB
|
4150 PPC_DCR
| PPC_DCRX
| PPC_DCRUX
|
4151 PPC_WRTEE
| PPC_MFAPIDI
|
4152 PPC_CACHE
| PPC_CACHE_ICBI
|
4153 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4154 PPC_MEM_TLBSYNC
| PPC_TLBIVA
|
4155 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4157 pcc
->msr_mask
= (1ull << MSR_POW
) |
4169 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4170 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4171 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4172 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4173 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4174 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4177 static void init_proc_MPC5xx (CPUPPCState
*env
)
4181 gen_spr_5xx_8xx(env
);
4183 init_excp_MPC5xx(env
);
4184 env
->dcache_line_size
= 32;
4185 env
->icache_line_size
= 32;
4186 /* XXX: TODO: allocate internal IRQ controller */
4189 POWERPC_FAMILY(MPC5xx
)(ObjectClass
*oc
, void *data
)
4191 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4192 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4194 dc
->desc
= "Freescale 5xx cores (aka RCPU)";
4195 pcc
->init_proc
= init_proc_MPC5xx
;
4196 pcc
->check_pow
= check_pow_none
;
4197 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4198 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4199 PPC_CACHE_ICBI
| PPC_FLOAT
| PPC_FLOAT_STFIWX
|
4201 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4213 pcc
->mmu_model
= POWERPC_MMU_REAL
;
4214 pcc
->excp_model
= POWERPC_EXCP_603
;
4215 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4216 pcc
->bfd_mach
= bfd_mach_ppc_505
;
4217 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4218 POWERPC_FLAG_BUS_CLK
;
4221 static void init_proc_MPC8xx (CPUPPCState
*env
)
4225 gen_spr_5xx_8xx(env
);
4227 init_excp_MPC8xx(env
);
4228 env
->dcache_line_size
= 32;
4229 env
->icache_line_size
= 32;
4230 /* XXX: TODO: allocate internal IRQ controller */
4233 POWERPC_FAMILY(MPC8xx
)(ObjectClass
*oc
, void *data
)
4235 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4236 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4238 dc
->desc
= "Freescale 8xx cores (aka PowerQUICC)";
4239 pcc
->init_proc
= init_proc_MPC8xx
;
4240 pcc
->check_pow
= check_pow_none
;
4241 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4242 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4243 PPC_CACHE_ICBI
| PPC_MFTB
;
4244 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4256 pcc
->mmu_model
= POWERPC_MMU_MPC8xx
;
4257 pcc
->excp_model
= POWERPC_EXCP_603
;
4258 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4259 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4260 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4261 POWERPC_FLAG_BUS_CLK
;
4264 /* Freescale 82xx cores (aka PowerQUICC-II) */
4266 static void init_proc_G2 (CPUPPCState
*env
)
4268 gen_spr_ne_601(env
);
4269 gen_spr_G2_755(env
);
4273 /* External access control */
4274 /* XXX : not implemented */
4275 spr_register(env
, SPR_EAR
, "EAR",
4276 SPR_NOACCESS
, SPR_NOACCESS
,
4277 &spr_read_generic
, &spr_write_generic
,
4279 /* Hardware implementation register */
4280 /* XXX : not implemented */
4281 spr_register(env
, SPR_HID0
, "HID0",
4282 SPR_NOACCESS
, SPR_NOACCESS
,
4283 &spr_read_generic
, &spr_write_generic
,
4285 /* XXX : not implemented */
4286 spr_register(env
, SPR_HID1
, "HID1",
4287 SPR_NOACCESS
, SPR_NOACCESS
,
4288 &spr_read_generic
, &spr_write_generic
,
4290 /* XXX : not implemented */
4291 spr_register(env
, SPR_HID2
, "HID2",
4292 SPR_NOACCESS
, SPR_NOACCESS
,
4293 &spr_read_generic
, &spr_write_generic
,
4295 /* Memory management */
4298 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4300 env
->dcache_line_size
= 32;
4301 env
->icache_line_size
= 32;
4302 /* Allocate hardware IRQ controller */
4303 ppc6xx_irq_init(env
);
4306 POWERPC_FAMILY(G2
)(ObjectClass
*oc
, void *data
)
4308 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4309 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4311 dc
->desc
= "PowerPC G2";
4312 pcc
->init_proc
= init_proc_G2
;
4313 pcc
->check_pow
= check_pow_hid0
;
4314 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4315 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4317 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4318 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4319 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4320 PPC_SEGMENT
| PPC_EXTERN
;
4321 pcc
->msr_mask
= (1ull << MSR_POW
) |
4322 (1ull << MSR_TGPR
) |
4336 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4337 pcc
->excp_model
= POWERPC_EXCP_G2
;
4338 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4339 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4340 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4341 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4344 static void init_proc_G2LE (CPUPPCState
*env
)
4346 gen_spr_ne_601(env
);
4347 gen_spr_G2_755(env
);
4351 /* External access control */
4352 /* XXX : not implemented */
4353 spr_register(env
, SPR_EAR
, "EAR",
4354 SPR_NOACCESS
, SPR_NOACCESS
,
4355 &spr_read_generic
, &spr_write_generic
,
4357 /* Hardware implementation register */
4358 /* XXX : not implemented */
4359 spr_register(env
, SPR_HID0
, "HID0",
4360 SPR_NOACCESS
, SPR_NOACCESS
,
4361 &spr_read_generic
, &spr_write_generic
,
4363 /* XXX : not implemented */
4364 spr_register(env
, SPR_HID1
, "HID1",
4365 SPR_NOACCESS
, SPR_NOACCESS
,
4366 &spr_read_generic
, &spr_write_generic
,
4368 /* XXX : not implemented */
4369 spr_register(env
, SPR_HID2
, "HID2",
4370 SPR_NOACCESS
, SPR_NOACCESS
,
4371 &spr_read_generic
, &spr_write_generic
,
4374 /* Memory management */
4377 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4379 env
->dcache_line_size
= 32;
4380 env
->icache_line_size
= 32;
4381 /* Allocate hardware IRQ controller */
4382 ppc6xx_irq_init(env
);
4385 POWERPC_FAMILY(G2LE
)(ObjectClass
*oc
, void *data
)
4387 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4388 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4390 dc
->desc
= "PowerPC G2LE";
4391 pcc
->init_proc
= init_proc_G2LE
;
4392 pcc
->check_pow
= check_pow_hid0
;
4393 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4394 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4396 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4397 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4398 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4399 PPC_SEGMENT
| PPC_EXTERN
;
4400 pcc
->msr_mask
= (1ull << MSR_POW
) |
4401 (1ull << MSR_TGPR
) |
4417 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4418 pcc
->excp_model
= POWERPC_EXCP_G2
;
4419 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4420 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4421 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4422 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4425 static void init_proc_e200 (CPUPPCState
*env
)
4429 gen_spr_BookE(env
, 0x000000070000FFFFULL
);
4430 /* XXX : not implemented */
4431 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4432 &spr_read_spefscr
, &spr_write_spefscr
,
4433 &spr_read_spefscr
, &spr_write_spefscr
,
4435 /* Memory management */
4436 gen_spr_BookE206(env
, 0x0000005D, NULL
);
4437 /* XXX : not implemented */
4438 spr_register(env
, SPR_HID0
, "HID0",
4439 SPR_NOACCESS
, SPR_NOACCESS
,
4440 &spr_read_generic
, &spr_write_generic
,
4442 /* XXX : not implemented */
4443 spr_register(env
, SPR_HID1
, "HID1",
4444 SPR_NOACCESS
, SPR_NOACCESS
,
4445 &spr_read_generic
, &spr_write_generic
,
4447 /* XXX : not implemented */
4448 spr_register(env
, SPR_Exxx_ALTCTXCR
, "ALTCTXCR",
4449 SPR_NOACCESS
, SPR_NOACCESS
,
4450 &spr_read_generic
, &spr_write_generic
,
4452 /* XXX : not implemented */
4453 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4454 SPR_NOACCESS
, SPR_NOACCESS
,
4455 &spr_read_generic
, &spr_write_generic
,
4457 /* XXX : not implemented */
4458 spr_register(env
, SPR_Exxx_CTXCR
, "CTXCR",
4459 SPR_NOACCESS
, SPR_NOACCESS
,
4460 &spr_read_generic
, &spr_write_generic
,
4462 /* XXX : not implemented */
4463 spr_register(env
, SPR_Exxx_DBCNT
, "DBCNT",
4464 SPR_NOACCESS
, SPR_NOACCESS
,
4465 &spr_read_generic
, &spr_write_generic
,
4467 /* XXX : not implemented */
4468 spr_register(env
, SPR_Exxx_DBCR3
, "DBCR3",
4469 SPR_NOACCESS
, SPR_NOACCESS
,
4470 &spr_read_generic
, &spr_write_generic
,
4472 /* XXX : not implemented */
4473 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4474 &spr_read_generic
, SPR_NOACCESS
,
4475 &spr_read_generic
, SPR_NOACCESS
,
4477 /* XXX : not implemented */
4478 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4479 SPR_NOACCESS
, SPR_NOACCESS
,
4480 &spr_read_generic
, &spr_write_generic
,
4482 /* XXX : not implemented */
4483 spr_register(env
, SPR_Exxx_L1FINV0
, "L1FINV0",
4484 SPR_NOACCESS
, SPR_NOACCESS
,
4485 &spr_read_generic
, &spr_write_generic
,
4487 /* XXX : not implemented */
4488 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
4489 SPR_NOACCESS
, SPR_NOACCESS
,
4490 &spr_read_generic
, &spr_write_generic
,
4492 /* XXX : not implemented */
4493 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
4494 SPR_NOACCESS
, SPR_NOACCESS
,
4495 &spr_read_generic
, &spr_write_generic
,
4497 /* XXX : not implemented */
4498 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4499 SPR_NOACCESS
, SPR_NOACCESS
,
4500 &spr_read_generic
, &spr_write_generic
,
4502 /* XXX : not implemented */
4503 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4504 SPR_NOACCESS
, SPR_NOACCESS
,
4505 &spr_read_generic
, &spr_write_generic
,
4507 /* XXX : not implemented */
4508 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4509 SPR_NOACCESS
, SPR_NOACCESS
,
4510 &spr_read_generic
, &spr_write_generic
,
4511 0x00000000); /* TOFIX */
4512 spr_register(env
, SPR_BOOKE_DSRR0
, "DSRR0",
4513 SPR_NOACCESS
, SPR_NOACCESS
,
4514 &spr_read_generic
, &spr_write_generic
,
4516 spr_register(env
, SPR_BOOKE_DSRR1
, "DSRR1",
4517 SPR_NOACCESS
, SPR_NOACCESS
,
4518 &spr_read_generic
, &spr_write_generic
,
4520 #if !defined(CONFIG_USER_ONLY)
4524 env
->tlb_type
= TLB_EMB
;
4526 init_excp_e200(env
, 0xFFFF0000UL
);
4527 env
->dcache_line_size
= 32;
4528 env
->icache_line_size
= 32;
4529 /* XXX: TODO: allocate internal IRQ controller */
4532 POWERPC_FAMILY(e200
)(ObjectClass
*oc
, void *data
)
4534 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4535 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4537 dc
->desc
= "e200 core";
4538 pcc
->init_proc
= init_proc_e200
;
4539 pcc
->check_pow
= check_pow_hid0
;
4540 /* XXX: unimplemented instructions:
4547 * all SPE multiply-accumulate instructions
4549 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4550 PPC_SPE
| PPC_SPE_SINGLE
|
4551 PPC_WRTEE
| PPC_RFDI
|
4552 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4553 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4554 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
|
4556 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4570 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4571 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4572 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4573 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4574 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4575 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4576 POWERPC_FLAG_BUS_CLK
;
4579 static void init_proc_e300 (CPUPPCState
*env
)
4581 gen_spr_ne_601(env
);
4585 /* hardware implementation registers */
4586 /* XXX : not implemented */
4587 spr_register(env
, SPR_HID0
, "HID0",
4588 SPR_NOACCESS
, SPR_NOACCESS
,
4589 &spr_read_generic
, &spr_write_generic
,
4591 /* XXX : not implemented */
4592 spr_register(env
, SPR_HID1
, "HID1",
4593 SPR_NOACCESS
, SPR_NOACCESS
,
4594 &spr_read_generic
, &spr_write_generic
,
4596 /* XXX : not implemented */
4597 spr_register(env
, SPR_HID2
, "HID2",
4598 SPR_NOACCESS
, SPR_NOACCESS
,
4599 &spr_read_generic
, &spr_write_generic
,
4602 /* XXX : not implemented */
4603 spr_register(env
, SPR_DABR
, "DABR",
4604 SPR_NOACCESS
, SPR_NOACCESS
,
4605 &spr_read_generic
, &spr_write_generic
,
4607 /* XXX : not implemented */
4608 spr_register(env
, SPR_DABR2
, "DABR2",
4609 SPR_NOACCESS
, SPR_NOACCESS
,
4610 &spr_read_generic
, &spr_write_generic
,
4612 /* XXX : not implemented */
4613 spr_register(env
, SPR_IABR2
, "IABR2",
4614 SPR_NOACCESS
, SPR_NOACCESS
,
4615 &spr_read_generic
, &spr_write_generic
,
4617 /* XXX : not implemented */
4618 spr_register(env
, SPR_IBCR
, "IBCR",
4619 SPR_NOACCESS
, SPR_NOACCESS
,
4620 &spr_read_generic
, &spr_write_generic
,
4622 /* XXX : not implemented */
4623 spr_register(env
, SPR_DBCR
, "DBCR",
4624 SPR_NOACCESS
, SPR_NOACCESS
,
4625 &spr_read_generic
, &spr_write_generic
,
4627 /* Memory management */
4630 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4632 env
->dcache_line_size
= 32;
4633 env
->icache_line_size
= 32;
4634 /* Allocate hardware IRQ controller */
4635 ppc6xx_irq_init(env
);
4638 POWERPC_FAMILY(e300
)(ObjectClass
*oc
, void *data
)
4640 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4641 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4643 dc
->desc
= "e300 core";
4644 pcc
->init_proc
= init_proc_e300
;
4645 pcc
->check_pow
= check_pow_hid0
;
4646 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4647 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4649 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4650 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4651 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4652 PPC_SEGMENT
| PPC_EXTERN
;
4653 pcc
->msr_mask
= (1ull << MSR_POW
) |
4654 (1ull << MSR_TGPR
) |
4670 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4671 pcc
->excp_model
= POWERPC_EXCP_603
;
4672 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4673 pcc
->bfd_mach
= bfd_mach_ppc_603
;
4674 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4675 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4678 #if !defined(CONFIG_USER_ONLY)
4679 static void spr_write_mas73(DisasContext
*ctx
, int sprn
, int gprn
)
4681 TCGv val
= tcg_temp_new();
4682 tcg_gen_ext32u_tl(val
, cpu_gpr
[gprn
]);
4683 gen_store_spr(SPR_BOOKE_MAS3
, val
);
4684 tcg_gen_shri_tl(val
, cpu_gpr
[gprn
], 32);
4685 gen_store_spr(SPR_BOOKE_MAS7
, val
);
4689 static void spr_read_mas73(DisasContext
*ctx
, int gprn
, int sprn
)
4691 TCGv mas7
= tcg_temp_new();
4692 TCGv mas3
= tcg_temp_new();
4693 gen_load_spr(mas7
, SPR_BOOKE_MAS7
);
4694 tcg_gen_shli_tl(mas7
, mas7
, 32);
4695 gen_load_spr(mas3
, SPR_BOOKE_MAS3
);
4696 tcg_gen_or_tl(cpu_gpr
[gprn
], mas3
, mas7
);
4697 tcg_temp_free(mas3
);
4698 tcg_temp_free(mas7
);
4703 enum fsl_e500_version
{
4710 static void init_proc_e500 (CPUPPCState
*env
, int version
)
4712 PowerPCCPU
*cpu
= ppc_env_get_cpu(env
);
4713 uint32_t tlbncfg
[2];
4715 uint64_t ivpr_mask
= 0xFFFF0000ULL
;
4716 uint32_t l1cfg0
= 0x3800 /* 8 ways */
4717 | 0x0020; /* 32 kb */
4718 uint32_t l1cfg1
= 0x3800 /* 8 ways */
4719 | 0x0020; /* 32 kb */
4720 #if !defined(CONFIG_USER_ONLY)
4727 * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't
4728 * complain when accessing them.
4729 * gen_spr_BookE(env, 0x0000000F0000FD7FULL);
4735 ivor_mask
= 0x0000000F0000FFFFULL
;
4739 ivor_mask
= 0x000003FE0000FFFFULL
;
4742 gen_spr_BookE(env
, ivor_mask
);
4743 /* Processor identification */
4744 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4745 SPR_NOACCESS
, SPR_NOACCESS
,
4746 &spr_read_generic
, &spr_write_pir
,
4748 /* XXX : not implemented */
4749 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4750 &spr_read_spefscr
, &spr_write_spefscr
,
4751 &spr_read_spefscr
, &spr_write_spefscr
,
4753 #if !defined(CONFIG_USER_ONLY)
4754 /* Memory management */
4760 tlbncfg
[0] = gen_tlbncfg(2, 1, 1, 0, 256);
4761 tlbncfg
[1] = gen_tlbncfg(16, 1, 9, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4764 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4765 tlbncfg
[1] = gen_tlbncfg(16, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4769 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4770 tlbncfg
[1] = gen_tlbncfg(64, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 64);
4773 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4780 env
->dcache_line_size
= 32;
4781 env
->icache_line_size
= 32;
4785 env
->dcache_line_size
= 64;
4786 env
->icache_line_size
= 64;
4787 l1cfg0
|= 0x1000000; /* 64 byte cache block size */
4788 l1cfg1
|= 0x1000000; /* 64 byte cache block size */
4791 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4793 gen_spr_BookE206(env
, 0x000000DF, tlbncfg
);
4794 /* XXX : not implemented */
4795 spr_register(env
, SPR_HID0
, "HID0",
4796 SPR_NOACCESS
, SPR_NOACCESS
,
4797 &spr_read_generic
, &spr_write_generic
,
4799 /* XXX : not implemented */
4800 spr_register(env
, SPR_HID1
, "HID1",
4801 SPR_NOACCESS
, SPR_NOACCESS
,
4802 &spr_read_generic
, &spr_write_generic
,
4804 /* XXX : not implemented */
4805 spr_register(env
, SPR_Exxx_BBEAR
, "BBEAR",
4806 SPR_NOACCESS
, SPR_NOACCESS
,
4807 &spr_read_generic
, &spr_write_generic
,
4809 /* XXX : not implemented */
4810 spr_register(env
, SPR_Exxx_BBTAR
, "BBTAR",
4811 SPR_NOACCESS
, SPR_NOACCESS
,
4812 &spr_read_generic
, &spr_write_generic
,
4814 /* XXX : not implemented */
4815 spr_register(env
, SPR_Exxx_MCAR
, "MCAR",
4816 SPR_NOACCESS
, SPR_NOACCESS
,
4817 &spr_read_generic
, &spr_write_generic
,
4819 /* XXX : not implemented */
4820 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4821 SPR_NOACCESS
, SPR_NOACCESS
,
4822 &spr_read_generic
, &spr_write_generic
,
4824 /* XXX : not implemented */
4825 spr_register(env
, SPR_Exxx_NPIDR
, "NPIDR",
4826 SPR_NOACCESS
, SPR_NOACCESS
,
4827 &spr_read_generic
, &spr_write_generic
,
4829 /* XXX : not implemented */
4830 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4831 SPR_NOACCESS
, SPR_NOACCESS
,
4832 &spr_read_generic
, &spr_write_generic
,
4834 /* XXX : not implemented */
4835 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4836 &spr_read_generic
, SPR_NOACCESS
,
4837 &spr_read_generic
, SPR_NOACCESS
,
4839 spr_register(env
, SPR_Exxx_L1CFG1
, "L1CFG1",
4840 &spr_read_generic
, SPR_NOACCESS
,
4841 &spr_read_generic
, SPR_NOACCESS
,
4843 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4844 SPR_NOACCESS
, SPR_NOACCESS
,
4845 &spr_read_generic
, &spr_write_e500_l1csr0
,
4847 spr_register(env
, SPR_Exxx_L1CSR1
, "L1CSR1",
4848 SPR_NOACCESS
, SPR_NOACCESS
,
4849 &spr_read_generic
, &spr_write_e500_l1csr1
,
4851 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4852 SPR_NOACCESS
, SPR_NOACCESS
,
4853 &spr_read_generic
, &spr_write_generic
,
4855 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4856 SPR_NOACCESS
, SPR_NOACCESS
,
4857 &spr_read_generic
, &spr_write_generic
,
4859 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4860 SPR_NOACCESS
, SPR_NOACCESS
,
4861 &spr_read_generic
, &spr_write_booke206_mmucsr0
,
4863 spr_register(env
, SPR_BOOKE_EPR
, "EPR",
4864 SPR_NOACCESS
, SPR_NOACCESS
,
4865 &spr_read_generic
, SPR_NOACCESS
,
4867 /* XXX better abstract into Emb.xxx features */
4868 if (version
== fsl_e5500
) {
4869 spr_register(env
, SPR_BOOKE_EPCR
, "EPCR",
4870 SPR_NOACCESS
, SPR_NOACCESS
,
4871 &spr_read_generic
, &spr_write_generic
,
4873 spr_register(env
, SPR_BOOKE_MAS7_MAS3
, "MAS7_MAS3",
4874 SPR_NOACCESS
, SPR_NOACCESS
,
4875 &spr_read_mas73
, &spr_write_mas73
,
4877 ivpr_mask
= (target_ulong
)~0xFFFFULL
;
4880 #if !defined(CONFIG_USER_ONLY)
4882 env
->tlb_type
= TLB_MAS
;
4883 for (i
= 0; i
< BOOKE206_MAX_TLBN
; i
++) {
4884 env
->nb_tlb
+= booke206_tlb_size(env
, i
);
4888 init_excp_e200(env
, ivpr_mask
);
4889 /* Allocate hardware IRQ controller */
4890 ppce500_irq_init(env
);
4893 static void init_proc_e500v1(CPUPPCState
*env
)
4895 init_proc_e500(env
, fsl_e500v1
);
4898 POWERPC_FAMILY(e500v1
)(ObjectClass
*oc
, void *data
)
4900 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4901 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4903 dc
->desc
= "e500v1 core";
4904 pcc
->init_proc
= init_proc_e500v1
;
4905 pcc
->check_pow
= check_pow_hid0
;
4906 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4907 PPC_SPE
| PPC_SPE_SINGLE
|
4908 PPC_WRTEE
| PPC_RFDI
|
4909 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4910 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4911 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
4912 pcc
->insns_flags2
= PPC2_BOOKE206
;
4913 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4927 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4928 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4929 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4930 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4931 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4932 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4933 POWERPC_FLAG_BUS_CLK
;
4936 static void init_proc_e500v2(CPUPPCState
*env
)
4938 init_proc_e500(env
, fsl_e500v2
);
4941 POWERPC_FAMILY(e500v2
)(ObjectClass
*oc
, void *data
)
4943 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4944 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4946 dc
->desc
= "e500v2 core";
4947 pcc
->init_proc
= init_proc_e500v2
;
4948 pcc
->check_pow
= check_pow_hid0
;
4949 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4950 PPC_SPE
| PPC_SPE_SINGLE
| PPC_SPE_DOUBLE
|
4951 PPC_WRTEE
| PPC_RFDI
|
4952 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4953 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4954 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
4955 pcc
->insns_flags2
= PPC2_BOOKE206
;
4956 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4970 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4971 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4972 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4973 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4974 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4975 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4976 POWERPC_FLAG_BUS_CLK
;
4979 static void init_proc_e500mc(CPUPPCState
*env
)
4981 init_proc_e500(env
, fsl_e500mc
);
4984 POWERPC_FAMILY(e500mc
)(ObjectClass
*oc
, void *data
)
4986 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4987 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4989 dc
->desc
= "e500mc core";
4990 pcc
->init_proc
= init_proc_e500mc
;
4991 pcc
->check_pow
= check_pow_none
;
4992 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4993 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
4994 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4995 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4996 PPC_FLOAT
| PPC_FLOAT_FRES
|
4997 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
4998 PPC_FLOAT_STFIWX
| PPC_WAIT
|
4999 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5000 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
;
5001 pcc
->msr_mask
= (1ull << MSR_GS
) |
5002 (1ull << MSR_UCLE
) |
5015 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5016 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5017 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5018 /* FIXME: figure out the correct flag for e500mc */
5019 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5020 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5021 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5025 static void init_proc_e5500(CPUPPCState
*env
)
5027 init_proc_e500(env
, fsl_e5500
);
5030 POWERPC_FAMILY(e5500
)(ObjectClass
*oc
, void *data
)
5032 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5033 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5035 dc
->desc
= "e5500 core";
5036 pcc
->init_proc
= init_proc_e5500
;
5037 pcc
->check_pow
= check_pow_none
;
5038 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5039 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5040 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5041 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5042 PPC_FLOAT
| PPC_FLOAT_FRES
|
5043 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5044 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5045 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
5046 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
;
5047 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
| \
5049 pcc
->msr_mask
= (1ull << MSR_CM
) |
5051 (1ull << MSR_UCLE
) |
5064 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5065 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5066 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5067 /* FIXME: figure out the correct flag for e5500 */
5068 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5069 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5070 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5074 /* Non-embedded PowerPC */
5076 /* POWER : same as 601, without mfmsr, mfsr */
5077 POWERPC_FAMILY(POWER
)(ObjectClass
*oc
, void *data
)
5079 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5080 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5083 /* pcc->insns_flags = XXX_TODO; */
5084 /* POWER RSC (from RAD6000) */
5085 pcc
->msr_mask
= (1ull << MSR_EE
) |
5098 #define POWERPC_MSRR_601 (0x0000000000001040ULL)
5100 static void init_proc_601 (CPUPPCState
*env
)
5102 gen_spr_ne_601(env
);
5104 /* Hardware implementation registers */
5105 /* XXX : not implemented */
5106 spr_register(env
, SPR_HID0
, "HID0",
5107 SPR_NOACCESS
, SPR_NOACCESS
,
5108 &spr_read_generic
, &spr_write_hid0_601
,
5110 /* XXX : not implemented */
5111 spr_register(env
, SPR_HID1
, "HID1",
5112 SPR_NOACCESS
, SPR_NOACCESS
,
5113 &spr_read_generic
, &spr_write_generic
,
5115 /* XXX : not implemented */
5116 spr_register(env
, SPR_601_HID2
, "HID2",
5117 SPR_NOACCESS
, SPR_NOACCESS
,
5118 &spr_read_generic
, &spr_write_generic
,
5120 /* XXX : not implemented */
5121 spr_register(env
, SPR_601_HID5
, "HID5",
5122 SPR_NOACCESS
, SPR_NOACCESS
,
5123 &spr_read_generic
, &spr_write_generic
,
5125 /* Memory management */
5127 /* XXX: beware that dcache line size is 64
5128 * but dcbz uses 32 bytes "sectors"
5129 * XXX: this breaks clcs instruction !
5131 env
->dcache_line_size
= 32;
5132 env
->icache_line_size
= 64;
5133 /* Allocate hardware IRQ controller */
5134 ppc6xx_irq_init(env
);
5137 POWERPC_FAMILY(601)(ObjectClass
*oc
, void *data
)
5139 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5140 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5142 dc
->desc
= "PowerPC 601";
5143 pcc
->init_proc
= init_proc_601
;
5144 pcc
->check_pow
= check_pow_none
;
5145 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5147 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5148 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5149 PPC_SEGMENT
| PPC_EXTERN
;
5150 pcc
->msr_mask
= (1ull << MSR_EE
) |
5160 pcc
->mmu_model
= POWERPC_MMU_601
;
5161 #if defined(CONFIG_SOFTMMU)
5162 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5164 pcc
->excp_model
= POWERPC_EXCP_601
;
5165 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5166 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5167 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5170 #define POWERPC_MSRR_601v (0x0000000000001040ULL)
5172 static void init_proc_601v (CPUPPCState
*env
)
5175 /* XXX : not implemented */
5176 spr_register(env
, SPR_601_HID15
, "HID15",
5177 SPR_NOACCESS
, SPR_NOACCESS
,
5178 &spr_read_generic
, &spr_write_generic
,
5182 POWERPC_FAMILY(601v
)(ObjectClass
*oc
, void *data
)
5184 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5185 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5187 dc
->desc
= "PowerPC 601v";
5188 pcc
->init_proc
= init_proc_601v
;
5189 pcc
->check_pow
= check_pow_none
;
5190 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5192 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5193 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5194 PPC_SEGMENT
| PPC_EXTERN
;
5195 pcc
->msr_mask
= (1ull << MSR_EE
) |
5205 pcc
->mmu_model
= POWERPC_MMU_601
;
5206 #if defined(CONFIG_SOFTMMU)
5207 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5209 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5210 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5211 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5214 static void init_proc_602 (CPUPPCState
*env
)
5216 gen_spr_ne_601(env
);
5220 /* hardware implementation registers */
5221 /* XXX : not implemented */
5222 spr_register(env
, SPR_HID0
, "HID0",
5223 SPR_NOACCESS
, SPR_NOACCESS
,
5224 &spr_read_generic
, &spr_write_generic
,
5226 /* XXX : not implemented */
5227 spr_register(env
, SPR_HID1
, "HID1",
5228 SPR_NOACCESS
, SPR_NOACCESS
,
5229 &spr_read_generic
, &spr_write_generic
,
5231 /* Memory management */
5233 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5235 env
->dcache_line_size
= 32;
5236 env
->icache_line_size
= 32;
5237 /* Allocate hardware IRQ controller */
5238 ppc6xx_irq_init(env
);
5241 POWERPC_FAMILY(602)(ObjectClass
*oc
, void *data
)
5243 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5244 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5246 dc
->desc
= "PowerPC 602";
5247 pcc
->init_proc
= init_proc_602
;
5248 pcc
->check_pow
= check_pow_hid0
;
5249 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5250 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5251 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5252 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5253 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5254 PPC_MEM_TLBIE
| PPC_6xx_TLB
| PPC_MEM_TLBSYNC
|
5255 PPC_SEGMENT
| PPC_602_SPEC
;
5256 pcc
->msr_mask
= (1ull << MSR_VSX
) |
5259 (1ull << MSR_TGPR
) |
5274 /* XXX: 602 MMU is quite specific. Should add a special case */
5275 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5276 pcc
->excp_model
= POWERPC_EXCP_602
;
5277 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5278 pcc
->bfd_mach
= bfd_mach_ppc_602
;
5279 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5280 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5283 static void init_proc_603 (CPUPPCState
*env
)
5285 gen_spr_ne_601(env
);
5289 /* hardware implementation registers */
5290 /* XXX : not implemented */
5291 spr_register(env
, SPR_HID0
, "HID0",
5292 SPR_NOACCESS
, SPR_NOACCESS
,
5293 &spr_read_generic
, &spr_write_generic
,
5295 /* XXX : not implemented */
5296 spr_register(env
, SPR_HID1
, "HID1",
5297 SPR_NOACCESS
, SPR_NOACCESS
,
5298 &spr_read_generic
, &spr_write_generic
,
5300 /* Memory management */
5302 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5304 env
->dcache_line_size
= 32;
5305 env
->icache_line_size
= 32;
5306 /* Allocate hardware IRQ controller */
5307 ppc6xx_irq_init(env
);
5310 POWERPC_FAMILY(603)(ObjectClass
*oc
, void *data
)
5312 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5313 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5315 dc
->desc
= "PowerPC 603";
5316 pcc
->init_proc
= init_proc_603
;
5317 pcc
->check_pow
= check_pow_hid0
;
5318 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5319 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5320 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5321 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5322 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5323 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5324 PPC_SEGMENT
| PPC_EXTERN
;
5325 pcc
->msr_mask
= (1ull << MSR_POW
) |
5326 (1ull << MSR_TGPR
) |
5341 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5342 pcc
->excp_model
= POWERPC_EXCP_603
;
5343 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5344 pcc
->bfd_mach
= bfd_mach_ppc_603
;
5345 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5346 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5349 static void init_proc_603E (CPUPPCState
*env
)
5351 gen_spr_ne_601(env
);
5355 /* hardware implementation registers */
5356 /* XXX : not implemented */
5357 spr_register(env
, SPR_HID0
, "HID0",
5358 SPR_NOACCESS
, SPR_NOACCESS
,
5359 &spr_read_generic
, &spr_write_generic
,
5361 /* XXX : not implemented */
5362 spr_register(env
, SPR_HID1
, "HID1",
5363 SPR_NOACCESS
, SPR_NOACCESS
,
5364 &spr_read_generic
, &spr_write_generic
,
5366 /* Memory management */
5368 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5370 env
->dcache_line_size
= 32;
5371 env
->icache_line_size
= 32;
5372 /* Allocate hardware IRQ controller */
5373 ppc6xx_irq_init(env
);
5376 POWERPC_FAMILY(603E
)(ObjectClass
*oc
, void *data
)
5378 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5379 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5381 dc
->desc
= "PowerPC 603e";
5382 pcc
->init_proc
= init_proc_603E
;
5383 pcc
->check_pow
= check_pow_hid0
;
5384 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5385 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5386 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5387 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5388 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5389 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5390 PPC_SEGMENT
| PPC_EXTERN
;
5391 pcc
->msr_mask
= (1ull << MSR_POW
) |
5392 (1ull << MSR_TGPR
) |
5407 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5408 pcc
->excp_model
= POWERPC_EXCP_603E
;
5409 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5410 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
5411 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5412 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5415 static void init_proc_604 (CPUPPCState
*env
)
5417 gen_spr_ne_601(env
);
5421 /* Hardware implementation registers */
5422 /* XXX : not implemented */
5423 spr_register(env
, SPR_HID0
, "HID0",
5424 SPR_NOACCESS
, SPR_NOACCESS
,
5425 &spr_read_generic
, &spr_write_generic
,
5427 /* Memory management */
5430 env
->dcache_line_size
= 32;
5431 env
->icache_line_size
= 32;
5432 /* Allocate hardware IRQ controller */
5433 ppc6xx_irq_init(env
);
5436 POWERPC_FAMILY(604)(ObjectClass
*oc
, void *data
)
5438 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5439 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5441 dc
->desc
= "PowerPC 604";
5442 pcc
->init_proc
= init_proc_604
;
5443 pcc
->check_pow
= check_pow_nocheck
;
5444 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5445 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5446 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5447 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5448 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5449 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5450 PPC_SEGMENT
| PPC_EXTERN
;
5451 pcc
->msr_mask
= (1ull << MSR_POW
) |
5467 pcc
->mmu_model
= POWERPC_MMU_32B
;
5468 #if defined(CONFIG_SOFTMMU)
5469 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5471 pcc
->excp_model
= POWERPC_EXCP_604
;
5472 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5473 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5474 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5475 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5478 static void init_proc_604E (CPUPPCState
*env
)
5480 gen_spr_ne_601(env
);
5482 /* XXX : not implemented */
5483 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
5484 SPR_NOACCESS
, SPR_NOACCESS
,
5485 &spr_read_generic
, &spr_write_generic
,
5487 /* XXX : not implemented */
5488 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
5489 SPR_NOACCESS
, SPR_NOACCESS
,
5490 &spr_read_generic
, &spr_write_generic
,
5492 /* XXX : not implemented */
5493 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
5494 SPR_NOACCESS
, SPR_NOACCESS
,
5495 &spr_read_generic
, &spr_write_generic
,
5499 /* Hardware implementation registers */
5500 /* XXX : not implemented */
5501 spr_register(env
, SPR_HID0
, "HID0",
5502 SPR_NOACCESS
, SPR_NOACCESS
,
5503 &spr_read_generic
, &spr_write_generic
,
5505 /* XXX : not implemented */
5506 spr_register(env
, SPR_HID1
, "HID1",
5507 SPR_NOACCESS
, SPR_NOACCESS
,
5508 &spr_read_generic
, &spr_write_generic
,
5510 /* Memory management */
5513 env
->dcache_line_size
= 32;
5514 env
->icache_line_size
= 32;
5515 /* Allocate hardware IRQ controller */
5516 ppc6xx_irq_init(env
);
5519 POWERPC_FAMILY(604E
)(ObjectClass
*oc
, void *data
)
5521 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5522 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5524 dc
->desc
= "PowerPC 604E";
5525 pcc
->init_proc
= init_proc_604E
;
5526 pcc
->check_pow
= check_pow_nocheck
;
5527 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5528 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5529 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5530 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5531 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5532 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5533 PPC_SEGMENT
| PPC_EXTERN
;
5534 pcc
->msr_mask
= (1ull << MSR_POW
) |
5550 pcc
->mmu_model
= POWERPC_MMU_32B
;
5551 #if defined(CONFIG_SOFTMMU)
5552 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5554 pcc
->excp_model
= POWERPC_EXCP_604
;
5555 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5556 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5557 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5558 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5561 static void init_proc_740 (CPUPPCState
*env
)
5563 gen_spr_ne_601(env
);
5567 /* Thermal management */
5569 /* Hardware implementation registers */
5570 /* XXX : not implemented */
5571 spr_register(env
, SPR_HID0
, "HID0",
5572 SPR_NOACCESS
, SPR_NOACCESS
,
5573 &spr_read_generic
, &spr_write_generic
,
5575 /* XXX : not implemented */
5576 spr_register(env
, SPR_HID1
, "HID1",
5577 SPR_NOACCESS
, SPR_NOACCESS
,
5578 &spr_read_generic
, &spr_write_generic
,
5580 /* Memory management */
5583 env
->dcache_line_size
= 32;
5584 env
->icache_line_size
= 32;
5585 /* Allocate hardware IRQ controller */
5586 ppc6xx_irq_init(env
);
5589 POWERPC_FAMILY(740)(ObjectClass
*oc
, void *data
)
5591 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5592 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5594 dc
->desc
= "PowerPC 740";
5595 pcc
->init_proc
= init_proc_740
;
5596 pcc
->check_pow
= check_pow_hid0
;
5597 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5598 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5599 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5600 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5601 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5602 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5603 PPC_SEGMENT
| PPC_EXTERN
;
5604 pcc
->msr_mask
= (1ull << MSR_POW
) |
5620 pcc
->mmu_model
= POWERPC_MMU_32B
;
5621 #if defined(CONFIG_SOFTMMU)
5622 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5624 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5625 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5626 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5627 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5628 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5631 static void init_proc_750 (CPUPPCState
*env
)
5633 gen_spr_ne_601(env
);
5635 /* XXX : not implemented */
5636 spr_register(env
, SPR_L2CR
, "L2CR",
5637 SPR_NOACCESS
, SPR_NOACCESS
,
5638 &spr_read_generic
, spr_access_nop
,
5642 /* Thermal management */
5644 /* Hardware implementation registers */
5645 /* XXX : not implemented */
5646 spr_register(env
, SPR_HID0
, "HID0",
5647 SPR_NOACCESS
, SPR_NOACCESS
,
5648 &spr_read_generic
, &spr_write_generic
,
5650 /* XXX : not implemented */
5651 spr_register(env
, SPR_HID1
, "HID1",
5652 SPR_NOACCESS
, SPR_NOACCESS
,
5653 &spr_read_generic
, &spr_write_generic
,
5655 /* Memory management */
5657 /* XXX: high BATs are also present but are known to be bugged on
5661 env
->dcache_line_size
= 32;
5662 env
->icache_line_size
= 32;
5663 /* Allocate hardware IRQ controller */
5664 ppc6xx_irq_init(env
);
5667 POWERPC_FAMILY(750)(ObjectClass
*oc
, void *data
)
5669 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5670 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5672 dc
->desc
= "PowerPC 750";
5673 pcc
->init_proc
= init_proc_750
;
5674 pcc
->check_pow
= check_pow_hid0
;
5675 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5676 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5677 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5678 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5679 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5680 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5681 PPC_SEGMENT
| PPC_EXTERN
;
5682 pcc
->msr_mask
= (1ull << MSR_POW
) |
5698 pcc
->mmu_model
= POWERPC_MMU_32B
;
5699 #if defined(CONFIG_SOFTMMU)
5700 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5702 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5703 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5704 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5705 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5706 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5709 static void init_proc_750cl (CPUPPCState
*env
)
5711 gen_spr_ne_601(env
);
5713 /* XXX : not implemented */
5714 spr_register(env
, SPR_L2CR
, "L2CR",
5715 SPR_NOACCESS
, SPR_NOACCESS
,
5716 &spr_read_generic
, spr_access_nop
,
5720 /* Thermal management */
5721 /* Those registers are fake on 750CL */
5722 spr_register(env
, SPR_THRM1
, "THRM1",
5723 SPR_NOACCESS
, SPR_NOACCESS
,
5724 &spr_read_generic
, &spr_write_generic
,
5726 spr_register(env
, SPR_THRM2
, "THRM2",
5727 SPR_NOACCESS
, SPR_NOACCESS
,
5728 &spr_read_generic
, &spr_write_generic
,
5730 spr_register(env
, SPR_THRM3
, "THRM3",
5731 SPR_NOACCESS
, SPR_NOACCESS
,
5732 &spr_read_generic
, &spr_write_generic
,
5734 /* XXX: not implemented */
5735 spr_register(env
, SPR_750_TDCL
, "TDCL",
5736 SPR_NOACCESS
, SPR_NOACCESS
,
5737 &spr_read_generic
, &spr_write_generic
,
5739 spr_register(env
, SPR_750_TDCH
, "TDCH",
5740 SPR_NOACCESS
, SPR_NOACCESS
,
5741 &spr_read_generic
, &spr_write_generic
,
5744 /* XXX : not implemented */
5745 spr_register(env
, SPR_750_WPAR
, "WPAR",
5746 SPR_NOACCESS
, SPR_NOACCESS
,
5747 &spr_read_generic
, &spr_write_generic
,
5749 spr_register(env
, SPR_750_DMAL
, "DMAL",
5750 SPR_NOACCESS
, SPR_NOACCESS
,
5751 &spr_read_generic
, &spr_write_generic
,
5753 spr_register(env
, SPR_750_DMAU
, "DMAU",
5754 SPR_NOACCESS
, SPR_NOACCESS
,
5755 &spr_read_generic
, &spr_write_generic
,
5757 /* Hardware implementation registers */
5758 /* XXX : not implemented */
5759 spr_register(env
, SPR_HID0
, "HID0",
5760 SPR_NOACCESS
, SPR_NOACCESS
,
5761 &spr_read_generic
, &spr_write_generic
,
5763 /* XXX : not implemented */
5764 spr_register(env
, SPR_HID1
, "HID1",
5765 SPR_NOACCESS
, SPR_NOACCESS
,
5766 &spr_read_generic
, &spr_write_generic
,
5768 /* XXX : not implemented */
5769 spr_register(env
, SPR_750CL_HID2
, "HID2",
5770 SPR_NOACCESS
, SPR_NOACCESS
,
5771 &spr_read_generic
, &spr_write_generic
,
5773 /* XXX : not implemented */
5774 spr_register(env
, SPR_750CL_HID4
, "HID4",
5775 SPR_NOACCESS
, SPR_NOACCESS
,
5776 &spr_read_generic
, &spr_write_generic
,
5778 /* Quantization registers */
5779 /* XXX : not implemented */
5780 spr_register(env
, SPR_750_GQR0
, "GQR0",
5781 SPR_NOACCESS
, SPR_NOACCESS
,
5782 &spr_read_generic
, &spr_write_generic
,
5784 /* XXX : not implemented */
5785 spr_register(env
, SPR_750_GQR1
, "GQR1",
5786 SPR_NOACCESS
, SPR_NOACCESS
,
5787 &spr_read_generic
, &spr_write_generic
,
5789 /* XXX : not implemented */
5790 spr_register(env
, SPR_750_GQR2
, "GQR2",
5791 SPR_NOACCESS
, SPR_NOACCESS
,
5792 &spr_read_generic
, &spr_write_generic
,
5794 /* XXX : not implemented */
5795 spr_register(env
, SPR_750_GQR3
, "GQR3",
5796 SPR_NOACCESS
, SPR_NOACCESS
,
5797 &spr_read_generic
, &spr_write_generic
,
5799 /* XXX : not implemented */
5800 spr_register(env
, SPR_750_GQR4
, "GQR4",
5801 SPR_NOACCESS
, SPR_NOACCESS
,
5802 &spr_read_generic
, &spr_write_generic
,
5804 /* XXX : not implemented */
5805 spr_register(env
, SPR_750_GQR5
, "GQR5",
5806 SPR_NOACCESS
, SPR_NOACCESS
,
5807 &spr_read_generic
, &spr_write_generic
,
5809 /* XXX : not implemented */
5810 spr_register(env
, SPR_750_GQR6
, "GQR6",
5811 SPR_NOACCESS
, SPR_NOACCESS
,
5812 &spr_read_generic
, &spr_write_generic
,
5814 /* XXX : not implemented */
5815 spr_register(env
, SPR_750_GQR7
, "GQR7",
5816 SPR_NOACCESS
, SPR_NOACCESS
,
5817 &spr_read_generic
, &spr_write_generic
,
5819 /* Memory management */
5821 /* PowerPC 750cl has 8 DBATs and 8 IBATs */
5823 init_excp_750cl(env
);
5824 env
->dcache_line_size
= 32;
5825 env
->icache_line_size
= 32;
5826 /* Allocate hardware IRQ controller */
5827 ppc6xx_irq_init(env
);
5830 POWERPC_FAMILY(750cl
)(ObjectClass
*oc
, void *data
)
5832 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5833 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5835 dc
->desc
= "PowerPC 750 CL";
5836 pcc
->init_proc
= init_proc_750cl
;
5837 pcc
->check_pow
= check_pow_hid0
;
5838 /* XXX: not implemented:
5839 * cache lock instructions:
5841 * floating point paired instructions
5876 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5877 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5878 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5879 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5880 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5881 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5882 PPC_SEGMENT
| PPC_EXTERN
;
5883 pcc
->msr_mask
= (1ull << MSR_POW
) |
5899 pcc
->mmu_model
= POWERPC_MMU_32B
;
5900 #if defined(CONFIG_SOFTMMU)
5901 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5903 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5904 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5905 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5906 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5907 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5910 static void init_proc_750cx (CPUPPCState
*env
)
5912 gen_spr_ne_601(env
);
5914 /* XXX : not implemented */
5915 spr_register(env
, SPR_L2CR
, "L2CR",
5916 SPR_NOACCESS
, SPR_NOACCESS
,
5917 &spr_read_generic
, spr_access_nop
,
5921 /* Thermal management */
5923 /* This register is not implemented but is present for compatibility */
5924 spr_register(env
, SPR_SDA
, "SDA",
5925 SPR_NOACCESS
, SPR_NOACCESS
,
5926 &spr_read_generic
, &spr_write_generic
,
5928 /* Hardware implementation registers */
5929 /* XXX : not implemented */
5930 spr_register(env
, SPR_HID0
, "HID0",
5931 SPR_NOACCESS
, SPR_NOACCESS
,
5932 &spr_read_generic
, &spr_write_generic
,
5934 /* XXX : not implemented */
5935 spr_register(env
, SPR_HID1
, "HID1",
5936 SPR_NOACCESS
, SPR_NOACCESS
,
5937 &spr_read_generic
, &spr_write_generic
,
5939 /* Memory management */
5941 /* PowerPC 750cx has 8 DBATs and 8 IBATs */
5943 init_excp_750cx(env
);
5944 env
->dcache_line_size
= 32;
5945 env
->icache_line_size
= 32;
5946 /* Allocate hardware IRQ controller */
5947 ppc6xx_irq_init(env
);
5950 POWERPC_FAMILY(750cx
)(ObjectClass
*oc
, void *data
)
5952 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5953 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5955 dc
->desc
= "PowerPC 750CX";
5956 pcc
->init_proc
= init_proc_750cx
;
5957 pcc
->check_pow
= check_pow_hid0
;
5958 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5959 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5960 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5961 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5962 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5963 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5964 PPC_SEGMENT
| PPC_EXTERN
;
5965 pcc
->msr_mask
= (1ull << MSR_POW
) |
5981 pcc
->mmu_model
= POWERPC_MMU_32B
;
5982 #if defined(CONFIG_SOFTMMU)
5983 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5985 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5986 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5987 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5988 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5989 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5992 static void init_proc_750fx (CPUPPCState
*env
)
5994 gen_spr_ne_601(env
);
5996 /* XXX : not implemented */
5997 spr_register(env
, SPR_L2CR
, "L2CR",
5998 SPR_NOACCESS
, SPR_NOACCESS
,
5999 &spr_read_generic
, spr_access_nop
,
6003 /* Thermal management */
6005 /* XXX : not implemented */
6006 spr_register(env
, SPR_750_THRM4
, "THRM4",
6007 SPR_NOACCESS
, SPR_NOACCESS
,
6008 &spr_read_generic
, &spr_write_generic
,
6010 /* Hardware implementation registers */
6011 /* XXX : not implemented */
6012 spr_register(env
, SPR_HID0
, "HID0",
6013 SPR_NOACCESS
, SPR_NOACCESS
,
6014 &spr_read_generic
, &spr_write_generic
,
6016 /* XXX : not implemented */
6017 spr_register(env
, SPR_HID1
, "HID1",
6018 SPR_NOACCESS
, SPR_NOACCESS
,
6019 &spr_read_generic
, &spr_write_generic
,
6021 /* XXX : not implemented */
6022 spr_register(env
, SPR_750FX_HID2
, "HID2",
6023 SPR_NOACCESS
, SPR_NOACCESS
,
6024 &spr_read_generic
, &spr_write_generic
,
6026 /* Memory management */
6028 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6031 env
->dcache_line_size
= 32;
6032 env
->icache_line_size
= 32;
6033 /* Allocate hardware IRQ controller */
6034 ppc6xx_irq_init(env
);
6037 POWERPC_FAMILY(750fx
)(ObjectClass
*oc
, void *data
)
6039 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6040 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6042 dc
->desc
= "PowerPC 750FX";
6043 pcc
->init_proc
= init_proc_750fx
;
6044 pcc
->check_pow
= check_pow_hid0
;
6045 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6046 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6047 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6048 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6049 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6050 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6051 PPC_SEGMENT
| PPC_EXTERN
;
6052 pcc
->msr_mask
= (1ull << MSR_POW
) |
6068 pcc
->mmu_model
= POWERPC_MMU_32B
;
6069 #if defined(CONFIG_SOFTMMU)
6070 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6072 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6073 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6074 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6075 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6076 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6079 static void init_proc_750gx (CPUPPCState
*env
)
6081 gen_spr_ne_601(env
);
6083 /* XXX : not implemented (XXX: different from 750fx) */
6084 spr_register(env
, SPR_L2CR
, "L2CR",
6085 SPR_NOACCESS
, SPR_NOACCESS
,
6086 &spr_read_generic
, spr_access_nop
,
6090 /* Thermal management */
6092 /* XXX : not implemented */
6093 spr_register(env
, SPR_750_THRM4
, "THRM4",
6094 SPR_NOACCESS
, SPR_NOACCESS
,
6095 &spr_read_generic
, &spr_write_generic
,
6097 /* Hardware implementation registers */
6098 /* XXX : not implemented (XXX: different from 750fx) */
6099 spr_register(env
, SPR_HID0
, "HID0",
6100 SPR_NOACCESS
, SPR_NOACCESS
,
6101 &spr_read_generic
, &spr_write_generic
,
6103 /* XXX : not implemented */
6104 spr_register(env
, SPR_HID1
, "HID1",
6105 SPR_NOACCESS
, SPR_NOACCESS
,
6106 &spr_read_generic
, &spr_write_generic
,
6108 /* XXX : not implemented (XXX: different from 750fx) */
6109 spr_register(env
, SPR_750FX_HID2
, "HID2",
6110 SPR_NOACCESS
, SPR_NOACCESS
,
6111 &spr_read_generic
, &spr_write_generic
,
6113 /* Memory management */
6115 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6118 env
->dcache_line_size
= 32;
6119 env
->icache_line_size
= 32;
6120 /* Allocate hardware IRQ controller */
6121 ppc6xx_irq_init(env
);
6124 POWERPC_FAMILY(750gx
)(ObjectClass
*oc
, void *data
)
6126 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6127 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6129 dc
->desc
= "PowerPC 750GX";
6130 pcc
->init_proc
= init_proc_750gx
;
6131 pcc
->check_pow
= check_pow_hid0
;
6132 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6133 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6134 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6135 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6136 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6137 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6138 PPC_SEGMENT
| PPC_EXTERN
;
6139 pcc
->msr_mask
= (1ull << MSR_POW
) |
6155 pcc
->mmu_model
= POWERPC_MMU_32B
;
6156 #if defined(CONFIG_SOFTMMU)
6157 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6159 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6160 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6161 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6162 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6163 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6166 static void init_proc_745 (CPUPPCState
*env
)
6168 gen_spr_ne_601(env
);
6170 gen_spr_G2_755(env
);
6173 /* Thermal management */
6175 /* Hardware implementation registers */
6176 /* XXX : not implemented */
6177 spr_register(env
, SPR_HID0
, "HID0",
6178 SPR_NOACCESS
, SPR_NOACCESS
,
6179 &spr_read_generic
, &spr_write_generic
,
6181 /* XXX : not implemented */
6182 spr_register(env
, SPR_HID1
, "HID1",
6183 SPR_NOACCESS
, SPR_NOACCESS
,
6184 &spr_read_generic
, &spr_write_generic
,
6186 /* XXX : not implemented */
6187 spr_register(env
, SPR_HID2
, "HID2",
6188 SPR_NOACCESS
, SPR_NOACCESS
,
6189 &spr_read_generic
, &spr_write_generic
,
6191 /* Memory management */
6194 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6196 env
->dcache_line_size
= 32;
6197 env
->icache_line_size
= 32;
6198 /* Allocate hardware IRQ controller */
6199 ppc6xx_irq_init(env
);
6202 POWERPC_FAMILY(745)(ObjectClass
*oc
, void *data
)
6204 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6205 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6207 dc
->desc
= "PowerPC 745";
6208 pcc
->init_proc
= init_proc_745
;
6209 pcc
->check_pow
= check_pow_hid0
;
6210 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6211 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6212 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6213 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6214 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6215 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6216 PPC_SEGMENT
| PPC_EXTERN
;
6217 pcc
->msr_mask
= (1ull << MSR_POW
) |
6233 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6234 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6235 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6236 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6237 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6238 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6241 static void init_proc_755 (CPUPPCState
*env
)
6243 gen_spr_ne_601(env
);
6245 gen_spr_G2_755(env
);
6248 /* L2 cache control */
6249 /* XXX : not implemented */
6250 spr_register(env
, SPR_L2CR
, "L2CR",
6251 SPR_NOACCESS
, SPR_NOACCESS
,
6252 &spr_read_generic
, spr_access_nop
,
6254 /* XXX : not implemented */
6255 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6256 SPR_NOACCESS
, SPR_NOACCESS
,
6257 &spr_read_generic
, &spr_write_generic
,
6259 /* Thermal management */
6261 /* Hardware implementation registers */
6262 /* XXX : not implemented */
6263 spr_register(env
, SPR_HID0
, "HID0",
6264 SPR_NOACCESS
, SPR_NOACCESS
,
6265 &spr_read_generic
, &spr_write_generic
,
6267 /* XXX : not implemented */
6268 spr_register(env
, SPR_HID1
, "HID1",
6269 SPR_NOACCESS
, SPR_NOACCESS
,
6270 &spr_read_generic
, &spr_write_generic
,
6272 /* XXX : not implemented */
6273 spr_register(env
, SPR_HID2
, "HID2",
6274 SPR_NOACCESS
, SPR_NOACCESS
,
6275 &spr_read_generic
, &spr_write_generic
,
6277 /* Memory management */
6280 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6282 env
->dcache_line_size
= 32;
6283 env
->icache_line_size
= 32;
6284 /* Allocate hardware IRQ controller */
6285 ppc6xx_irq_init(env
);
6288 POWERPC_FAMILY(755)(ObjectClass
*oc
, void *data
)
6290 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6291 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6293 dc
->desc
= "PowerPC 755";
6294 pcc
->init_proc
= init_proc_755
;
6295 pcc
->check_pow
= check_pow_hid0
;
6296 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6297 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6298 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6299 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6300 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6301 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6302 PPC_SEGMENT
| PPC_EXTERN
;
6303 pcc
->msr_mask
= (1ull << MSR_POW
) |
6319 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6320 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6321 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6322 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6323 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6324 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6327 static void init_proc_7400 (CPUPPCState
*env
)
6329 gen_spr_ne_601(env
);
6333 /* 74xx specific SPR */
6335 /* XXX : not implemented */
6336 spr_register(env
, SPR_UBAMR
, "UBAMR",
6337 &spr_read_ureg
, SPR_NOACCESS
,
6338 &spr_read_ureg
, SPR_NOACCESS
,
6340 /* XXX: this seems not implemented on all revisions. */
6341 /* XXX : not implemented */
6342 spr_register(env
, SPR_MSSCR1
, "MSSCR1",
6343 SPR_NOACCESS
, SPR_NOACCESS
,
6344 &spr_read_generic
, &spr_write_generic
,
6346 /* Thermal management */
6348 /* Memory management */
6350 init_excp_7400(env
);
6351 env
->dcache_line_size
= 32;
6352 env
->icache_line_size
= 32;
6353 /* Allocate hardware IRQ controller */
6354 ppc6xx_irq_init(env
);
6357 POWERPC_FAMILY(7400)(ObjectClass
*oc
, void *data
)
6359 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6360 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6362 dc
->desc
= "PowerPC 7400 (aka G4)";
6363 pcc
->init_proc
= init_proc_7400
;
6364 pcc
->check_pow
= check_pow_hid0
;
6365 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6366 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6367 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6369 PPC_CACHE
| PPC_CACHE_ICBI
|
6370 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6371 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6372 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6374 PPC_SEGMENT
| PPC_EXTERN
|
6376 pcc
->msr_mask
= (1ull << MSR_VR
) |
6393 pcc
->mmu_model
= POWERPC_MMU_32B
;
6394 #if defined(CONFIG_SOFTMMU)
6395 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6397 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6398 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6399 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6400 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6401 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6402 POWERPC_FLAG_BUS_CLK
;
6405 static void init_proc_7410 (CPUPPCState
*env
)
6407 gen_spr_ne_601(env
);
6411 /* 74xx specific SPR */
6413 /* XXX : not implemented */
6414 spr_register(env
, SPR_UBAMR
, "UBAMR",
6415 &spr_read_ureg
, SPR_NOACCESS
,
6416 &spr_read_ureg
, SPR_NOACCESS
,
6418 /* Thermal management */
6421 /* XXX : not implemented */
6422 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6423 SPR_NOACCESS
, SPR_NOACCESS
,
6424 &spr_read_generic
, &spr_write_generic
,
6427 /* XXX : not implemented */
6428 spr_register(env
, SPR_LDSTDB
, "LDSTDB",
6429 SPR_NOACCESS
, SPR_NOACCESS
,
6430 &spr_read_generic
, &spr_write_generic
,
6432 /* Memory management */
6434 init_excp_7400(env
);
6435 env
->dcache_line_size
= 32;
6436 env
->icache_line_size
= 32;
6437 /* Allocate hardware IRQ controller */
6438 ppc6xx_irq_init(env
);
6441 POWERPC_FAMILY(7410)(ObjectClass
*oc
, void *data
)
6443 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6444 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6446 dc
->desc
= "PowerPC 7410 (aka G4)";
6447 pcc
->init_proc
= init_proc_7410
;
6448 pcc
->check_pow
= check_pow_hid0
;
6449 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6450 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6451 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6453 PPC_CACHE
| PPC_CACHE_ICBI
|
6454 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6455 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6456 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6458 PPC_SEGMENT
| PPC_EXTERN
|
6460 pcc
->msr_mask
= (1ull << MSR_VR
) |
6477 pcc
->mmu_model
= POWERPC_MMU_32B
;
6478 #if defined(CONFIG_SOFTMMU)
6479 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6481 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6482 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6483 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6484 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6485 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6486 POWERPC_FLAG_BUS_CLK
;
6489 static void init_proc_7440 (CPUPPCState
*env
)
6491 gen_spr_ne_601(env
);
6495 /* 74xx specific SPR */
6497 /* XXX : not implemented */
6498 spr_register(env
, SPR_UBAMR
, "UBAMR",
6499 &spr_read_ureg
, SPR_NOACCESS
,
6500 &spr_read_ureg
, SPR_NOACCESS
,
6503 /* XXX : not implemented */
6504 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6505 SPR_NOACCESS
, SPR_NOACCESS
,
6506 &spr_read_generic
, &spr_write_generic
,
6509 /* XXX : not implemented */
6510 spr_register(env
, SPR_ICTRL
, "ICTRL",
6511 SPR_NOACCESS
, SPR_NOACCESS
,
6512 &spr_read_generic
, &spr_write_generic
,
6515 /* XXX : not implemented */
6516 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6517 SPR_NOACCESS
, SPR_NOACCESS
,
6518 &spr_read_generic
, &spr_write_generic
,
6521 /* XXX : not implemented */
6522 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6523 SPR_NOACCESS
, SPR_NOACCESS
,
6524 &spr_read_generic
, &spr_write_generic
,
6526 /* XXX : not implemented */
6527 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6528 &spr_read_ureg
, SPR_NOACCESS
,
6529 &spr_read_ureg
, SPR_NOACCESS
,
6531 /* XXX : not implemented */
6532 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6533 SPR_NOACCESS
, SPR_NOACCESS
,
6534 &spr_read_generic
, &spr_write_generic
,
6536 /* XXX : not implemented */
6537 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6538 &spr_read_ureg
, SPR_NOACCESS
,
6539 &spr_read_ureg
, SPR_NOACCESS
,
6541 /* Memory management */
6543 gen_74xx_soft_tlb(env
, 128, 2);
6544 init_excp_7450(env
);
6545 env
->dcache_line_size
= 32;
6546 env
->icache_line_size
= 32;
6547 /* Allocate hardware IRQ controller */
6548 ppc6xx_irq_init(env
);
6551 POWERPC_FAMILY(7440)(ObjectClass
*oc
, void *data
)
6553 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6554 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6556 dc
->desc
= "PowerPC 7440 (aka G4)";
6557 pcc
->init_proc
= init_proc_7440
;
6558 pcc
->check_pow
= check_pow_hid0_74xx
;
6559 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6560 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6561 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6563 PPC_CACHE
| PPC_CACHE_ICBI
|
6564 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6565 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6566 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6567 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6568 PPC_SEGMENT
| PPC_EXTERN
|
6570 pcc
->msr_mask
= (1ull << MSR_VR
) |
6587 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6588 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6589 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6590 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6591 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6592 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6593 POWERPC_FLAG_BUS_CLK
;
6596 static void init_proc_7450 (CPUPPCState
*env
)
6598 gen_spr_ne_601(env
);
6602 /* 74xx specific SPR */
6604 /* Level 3 cache control */
6607 /* XXX : not implemented */
6608 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
6609 SPR_NOACCESS
, SPR_NOACCESS
,
6610 &spr_read_generic
, &spr_write_generic
,
6613 /* XXX : not implemented */
6614 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
6615 SPR_NOACCESS
, SPR_NOACCESS
,
6616 &spr_read_generic
, &spr_write_generic
,
6619 /* XXX : not implemented */
6620 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
6621 SPR_NOACCESS
, SPR_NOACCESS
,
6622 &spr_read_generic
, &spr_write_generic
,
6625 /* XXX : not implemented */
6626 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
6627 SPR_NOACCESS
, SPR_NOACCESS
,
6628 &spr_read_generic
, &spr_write_generic
,
6630 /* XXX : not implemented */
6631 spr_register(env
, SPR_UBAMR
, "UBAMR",
6632 &spr_read_ureg
, SPR_NOACCESS
,
6633 &spr_read_ureg
, SPR_NOACCESS
,
6636 /* XXX : not implemented */
6637 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6638 SPR_NOACCESS
, SPR_NOACCESS
,
6639 &spr_read_generic
, &spr_write_generic
,
6642 /* XXX : not implemented */
6643 spr_register(env
, SPR_ICTRL
, "ICTRL",
6644 SPR_NOACCESS
, SPR_NOACCESS
,
6645 &spr_read_generic
, &spr_write_generic
,
6648 /* XXX : not implemented */
6649 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6650 SPR_NOACCESS
, SPR_NOACCESS
,
6651 &spr_read_generic
, &spr_write_generic
,
6654 /* XXX : not implemented */
6655 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6656 SPR_NOACCESS
, SPR_NOACCESS
,
6657 &spr_read_generic
, &spr_write_generic
,
6659 /* XXX : not implemented */
6660 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6661 &spr_read_ureg
, SPR_NOACCESS
,
6662 &spr_read_ureg
, SPR_NOACCESS
,
6664 /* XXX : not implemented */
6665 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6666 SPR_NOACCESS
, SPR_NOACCESS
,
6667 &spr_read_generic
, &spr_write_generic
,
6669 /* XXX : not implemented */
6670 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6671 &spr_read_ureg
, SPR_NOACCESS
,
6672 &spr_read_ureg
, SPR_NOACCESS
,
6674 /* Memory management */
6676 gen_74xx_soft_tlb(env
, 128, 2);
6677 init_excp_7450(env
);
6678 env
->dcache_line_size
= 32;
6679 env
->icache_line_size
= 32;
6680 /* Allocate hardware IRQ controller */
6681 ppc6xx_irq_init(env
);
6684 POWERPC_FAMILY(7450)(ObjectClass
*oc
, void *data
)
6686 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6687 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6689 dc
->desc
= "PowerPC 7450 (aka G4)";
6690 pcc
->init_proc
= init_proc_7450
;
6691 pcc
->check_pow
= check_pow_hid0_74xx
;
6692 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6693 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6694 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6696 PPC_CACHE
| PPC_CACHE_ICBI
|
6697 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6698 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6699 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6700 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6701 PPC_SEGMENT
| PPC_EXTERN
|
6703 pcc
->msr_mask
= (1ull << MSR_VR
) |
6720 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6721 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6722 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6723 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6724 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6725 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6726 POWERPC_FLAG_BUS_CLK
;
6729 static void init_proc_7445 (CPUPPCState
*env
)
6731 gen_spr_ne_601(env
);
6735 /* 74xx specific SPR */
6738 /* XXX : not implemented */
6739 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6740 SPR_NOACCESS
, SPR_NOACCESS
,
6741 &spr_read_generic
, &spr_write_generic
,
6744 /* XXX : not implemented */
6745 spr_register(env
, SPR_ICTRL
, "ICTRL",
6746 SPR_NOACCESS
, SPR_NOACCESS
,
6747 &spr_read_generic
, &spr_write_generic
,
6750 /* XXX : not implemented */
6751 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6752 SPR_NOACCESS
, SPR_NOACCESS
,
6753 &spr_read_generic
, &spr_write_generic
,
6756 /* XXX : not implemented */
6757 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6758 SPR_NOACCESS
, SPR_NOACCESS
,
6759 &spr_read_generic
, &spr_write_generic
,
6761 /* XXX : not implemented */
6762 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6763 &spr_read_ureg
, SPR_NOACCESS
,
6764 &spr_read_ureg
, SPR_NOACCESS
,
6766 /* XXX : not implemented */
6767 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6768 SPR_NOACCESS
, SPR_NOACCESS
,
6769 &spr_read_generic
, &spr_write_generic
,
6771 /* XXX : not implemented */
6772 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6773 &spr_read_ureg
, SPR_NOACCESS
,
6774 &spr_read_ureg
, SPR_NOACCESS
,
6777 spr_register(env
, SPR_SPRG4
, "SPRG4",
6778 SPR_NOACCESS
, SPR_NOACCESS
,
6779 &spr_read_generic
, &spr_write_generic
,
6781 spr_register(env
, SPR_USPRG4
, "USPRG4",
6782 &spr_read_ureg
, SPR_NOACCESS
,
6783 &spr_read_ureg
, SPR_NOACCESS
,
6785 spr_register(env
, SPR_SPRG5
, "SPRG5",
6786 SPR_NOACCESS
, SPR_NOACCESS
,
6787 &spr_read_generic
, &spr_write_generic
,
6789 spr_register(env
, SPR_USPRG5
, "USPRG5",
6790 &spr_read_ureg
, SPR_NOACCESS
,
6791 &spr_read_ureg
, SPR_NOACCESS
,
6793 spr_register(env
, SPR_SPRG6
, "SPRG6",
6794 SPR_NOACCESS
, SPR_NOACCESS
,
6795 &spr_read_generic
, &spr_write_generic
,
6797 spr_register(env
, SPR_USPRG6
, "USPRG6",
6798 &spr_read_ureg
, SPR_NOACCESS
,
6799 &spr_read_ureg
, SPR_NOACCESS
,
6801 spr_register(env
, SPR_SPRG7
, "SPRG7",
6802 SPR_NOACCESS
, SPR_NOACCESS
,
6803 &spr_read_generic
, &spr_write_generic
,
6805 spr_register(env
, SPR_USPRG7
, "USPRG7",
6806 &spr_read_ureg
, SPR_NOACCESS
,
6807 &spr_read_ureg
, SPR_NOACCESS
,
6809 /* Memory management */
6812 gen_74xx_soft_tlb(env
, 128, 2);
6813 init_excp_7450(env
);
6814 env
->dcache_line_size
= 32;
6815 env
->icache_line_size
= 32;
6816 /* Allocate hardware IRQ controller */
6817 ppc6xx_irq_init(env
);
6820 POWERPC_FAMILY(7445)(ObjectClass
*oc
, void *data
)
6822 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6823 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6825 dc
->desc
= "PowerPC 7445 (aka G4)";
6826 pcc
->init_proc
= init_proc_7445
;
6827 pcc
->check_pow
= check_pow_hid0_74xx
;
6828 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6829 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6830 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6832 PPC_CACHE
| PPC_CACHE_ICBI
|
6833 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6834 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6835 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6836 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6837 PPC_SEGMENT
| PPC_EXTERN
|
6839 pcc
->msr_mask
= (1ull << MSR_VR
) |
6856 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6857 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6858 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6859 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6860 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6861 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6862 POWERPC_FLAG_BUS_CLK
;
6865 static void init_proc_7455 (CPUPPCState
*env
)
6867 gen_spr_ne_601(env
);
6871 /* 74xx specific SPR */
6873 /* Level 3 cache control */
6876 /* XXX : not implemented */
6877 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6878 SPR_NOACCESS
, SPR_NOACCESS
,
6879 &spr_read_generic
, &spr_write_generic
,
6882 /* XXX : not implemented */
6883 spr_register(env
, SPR_ICTRL
, "ICTRL",
6884 SPR_NOACCESS
, SPR_NOACCESS
,
6885 &spr_read_generic
, &spr_write_generic
,
6888 /* XXX : not implemented */
6889 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6890 SPR_NOACCESS
, SPR_NOACCESS
,
6891 &spr_read_generic
, &spr_write_generic
,
6894 /* XXX : not implemented */
6895 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6896 SPR_NOACCESS
, SPR_NOACCESS
,
6897 &spr_read_generic
, &spr_write_generic
,
6899 /* XXX : not implemented */
6900 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6901 &spr_read_ureg
, SPR_NOACCESS
,
6902 &spr_read_ureg
, SPR_NOACCESS
,
6904 /* XXX : not implemented */
6905 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6906 SPR_NOACCESS
, SPR_NOACCESS
,
6907 &spr_read_generic
, &spr_write_generic
,
6909 /* XXX : not implemented */
6910 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6911 &spr_read_ureg
, SPR_NOACCESS
,
6912 &spr_read_ureg
, SPR_NOACCESS
,
6915 spr_register(env
, SPR_SPRG4
, "SPRG4",
6916 SPR_NOACCESS
, SPR_NOACCESS
,
6917 &spr_read_generic
, &spr_write_generic
,
6919 spr_register(env
, SPR_USPRG4
, "USPRG4",
6920 &spr_read_ureg
, SPR_NOACCESS
,
6921 &spr_read_ureg
, SPR_NOACCESS
,
6923 spr_register(env
, SPR_SPRG5
, "SPRG5",
6924 SPR_NOACCESS
, SPR_NOACCESS
,
6925 &spr_read_generic
, &spr_write_generic
,
6927 spr_register(env
, SPR_USPRG5
, "USPRG5",
6928 &spr_read_ureg
, SPR_NOACCESS
,
6929 &spr_read_ureg
, SPR_NOACCESS
,
6931 spr_register(env
, SPR_SPRG6
, "SPRG6",
6932 SPR_NOACCESS
, SPR_NOACCESS
,
6933 &spr_read_generic
, &spr_write_generic
,
6935 spr_register(env
, SPR_USPRG6
, "USPRG6",
6936 &spr_read_ureg
, SPR_NOACCESS
,
6937 &spr_read_ureg
, SPR_NOACCESS
,
6939 spr_register(env
, SPR_SPRG7
, "SPRG7",
6940 SPR_NOACCESS
, SPR_NOACCESS
,
6941 &spr_read_generic
, &spr_write_generic
,
6943 spr_register(env
, SPR_USPRG7
, "USPRG7",
6944 &spr_read_ureg
, SPR_NOACCESS
,
6945 &spr_read_ureg
, SPR_NOACCESS
,
6947 /* Memory management */
6950 gen_74xx_soft_tlb(env
, 128, 2);
6951 init_excp_7450(env
);
6952 env
->dcache_line_size
= 32;
6953 env
->icache_line_size
= 32;
6954 /* Allocate hardware IRQ controller */
6955 ppc6xx_irq_init(env
);
6958 POWERPC_FAMILY(7455)(ObjectClass
*oc
, void *data
)
6960 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6961 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6963 dc
->desc
= "PowerPC 7455 (aka G4)";
6964 pcc
->init_proc
= init_proc_7455
;
6965 pcc
->check_pow
= check_pow_hid0_74xx
;
6966 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6967 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6968 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6970 PPC_CACHE
| PPC_CACHE_ICBI
|
6971 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6972 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6973 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6974 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6975 PPC_SEGMENT
| PPC_EXTERN
|
6977 pcc
->msr_mask
= (1ull << MSR_VR
) |
6994 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6995 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6996 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6997 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6998 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6999 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7000 POWERPC_FLAG_BUS_CLK
;
7003 static void init_proc_7457 (CPUPPCState
*env
)
7005 gen_spr_ne_601(env
);
7009 /* 74xx specific SPR */
7011 /* Level 3 cache control */
7014 /* XXX : not implemented */
7015 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
7016 SPR_NOACCESS
, SPR_NOACCESS
,
7017 &spr_read_generic
, &spr_write_generic
,
7020 /* XXX : not implemented */
7021 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
7022 SPR_NOACCESS
, SPR_NOACCESS
,
7023 &spr_read_generic
, &spr_write_generic
,
7026 /* XXX : not implemented */
7027 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
7028 SPR_NOACCESS
, SPR_NOACCESS
,
7029 &spr_read_generic
, &spr_write_generic
,
7032 /* XXX : not implemented */
7033 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
7034 SPR_NOACCESS
, SPR_NOACCESS
,
7035 &spr_read_generic
, &spr_write_generic
,
7038 /* XXX : not implemented */
7039 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7040 SPR_NOACCESS
, SPR_NOACCESS
,
7041 &spr_read_generic
, &spr_write_generic
,
7044 /* XXX : not implemented */
7045 spr_register(env
, SPR_ICTRL
, "ICTRL",
7046 SPR_NOACCESS
, SPR_NOACCESS
,
7047 &spr_read_generic
, &spr_write_generic
,
7050 /* XXX : not implemented */
7051 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7052 SPR_NOACCESS
, SPR_NOACCESS
,
7053 &spr_read_generic
, &spr_write_generic
,
7056 /* XXX : not implemented */
7057 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7058 SPR_NOACCESS
, SPR_NOACCESS
,
7059 &spr_read_generic
, &spr_write_generic
,
7061 /* XXX : not implemented */
7062 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7063 &spr_read_ureg
, SPR_NOACCESS
,
7064 &spr_read_ureg
, SPR_NOACCESS
,
7066 /* XXX : not implemented */
7067 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7068 SPR_NOACCESS
, SPR_NOACCESS
,
7069 &spr_read_generic
, &spr_write_generic
,
7071 /* XXX : not implemented */
7072 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7073 &spr_read_ureg
, SPR_NOACCESS
,
7074 &spr_read_ureg
, SPR_NOACCESS
,
7077 spr_register(env
, SPR_SPRG4
, "SPRG4",
7078 SPR_NOACCESS
, SPR_NOACCESS
,
7079 &spr_read_generic
, &spr_write_generic
,
7081 spr_register(env
, SPR_USPRG4
, "USPRG4",
7082 &spr_read_ureg
, SPR_NOACCESS
,
7083 &spr_read_ureg
, SPR_NOACCESS
,
7085 spr_register(env
, SPR_SPRG5
, "SPRG5",
7086 SPR_NOACCESS
, SPR_NOACCESS
,
7087 &spr_read_generic
, &spr_write_generic
,
7089 spr_register(env
, SPR_USPRG5
, "USPRG5",
7090 &spr_read_ureg
, SPR_NOACCESS
,
7091 &spr_read_ureg
, SPR_NOACCESS
,
7093 spr_register(env
, SPR_SPRG6
, "SPRG6",
7094 SPR_NOACCESS
, SPR_NOACCESS
,
7095 &spr_read_generic
, &spr_write_generic
,
7097 spr_register(env
, SPR_USPRG6
, "USPRG6",
7098 &spr_read_ureg
, SPR_NOACCESS
,
7099 &spr_read_ureg
, SPR_NOACCESS
,
7101 spr_register(env
, SPR_SPRG7
, "SPRG7",
7102 SPR_NOACCESS
, SPR_NOACCESS
,
7103 &spr_read_generic
, &spr_write_generic
,
7105 spr_register(env
, SPR_USPRG7
, "USPRG7",
7106 &spr_read_ureg
, SPR_NOACCESS
,
7107 &spr_read_ureg
, SPR_NOACCESS
,
7109 /* Memory management */
7112 gen_74xx_soft_tlb(env
, 128, 2);
7113 init_excp_7450(env
);
7114 env
->dcache_line_size
= 32;
7115 env
->icache_line_size
= 32;
7116 /* Allocate hardware IRQ controller */
7117 ppc6xx_irq_init(env
);
7120 POWERPC_FAMILY(7457)(ObjectClass
*oc
, void *data
)
7122 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7123 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7125 dc
->desc
= "PowerPC 7457 (aka G4)";
7126 pcc
->init_proc
= init_proc_7457
;
7127 pcc
->check_pow
= check_pow_hid0_74xx
;
7128 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7129 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7130 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7132 PPC_CACHE
| PPC_CACHE_ICBI
|
7133 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7134 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7135 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7136 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7137 PPC_SEGMENT
| PPC_EXTERN
|
7139 pcc
->msr_mask
= (1ull << MSR_VR
) |
7156 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7157 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7158 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7159 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7160 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7161 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7162 POWERPC_FLAG_BUS_CLK
;
7165 static void init_proc_e600 (CPUPPCState
*env
)
7167 gen_spr_ne_601(env
);
7171 /* 74xx specific SPR */
7173 /* XXX : not implemented */
7174 spr_register(env
, SPR_UBAMR
, "UBAMR",
7175 &spr_read_ureg
, SPR_NOACCESS
,
7176 &spr_read_ureg
, SPR_NOACCESS
,
7178 /* XXX : not implemented */
7179 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7180 SPR_NOACCESS
, SPR_NOACCESS
,
7181 &spr_read_generic
, &spr_write_generic
,
7183 /* XXX : not implemented */
7184 spr_register(env
, SPR_ICTRL
, "ICTRL",
7185 SPR_NOACCESS
, SPR_NOACCESS
,
7186 &spr_read_generic
, &spr_write_generic
,
7188 /* XXX : not implemented */
7189 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7190 SPR_NOACCESS
, SPR_NOACCESS
,
7191 &spr_read_generic
, &spr_write_generic
,
7193 /* XXX : not implemented */
7194 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7195 SPR_NOACCESS
, SPR_NOACCESS
,
7196 &spr_read_generic
, &spr_write_generic
,
7198 /* XXX : not implemented */
7199 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7200 &spr_read_ureg
, SPR_NOACCESS
,
7201 &spr_read_ureg
, SPR_NOACCESS
,
7203 /* XXX : not implemented */
7204 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7205 SPR_NOACCESS
, SPR_NOACCESS
,
7206 &spr_read_generic
, &spr_write_generic
,
7208 /* XXX : not implemented */
7209 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7210 &spr_read_ureg
, SPR_NOACCESS
,
7211 &spr_read_ureg
, SPR_NOACCESS
,
7214 spr_register(env
, SPR_SPRG4
, "SPRG4",
7215 SPR_NOACCESS
, SPR_NOACCESS
,
7216 &spr_read_generic
, &spr_write_generic
,
7218 spr_register(env
, SPR_USPRG4
, "USPRG4",
7219 &spr_read_ureg
, SPR_NOACCESS
,
7220 &spr_read_ureg
, SPR_NOACCESS
,
7222 spr_register(env
, SPR_SPRG5
, "SPRG5",
7223 SPR_NOACCESS
, SPR_NOACCESS
,
7224 &spr_read_generic
, &spr_write_generic
,
7226 spr_register(env
, SPR_USPRG5
, "USPRG5",
7227 &spr_read_ureg
, SPR_NOACCESS
,
7228 &spr_read_ureg
, SPR_NOACCESS
,
7230 spr_register(env
, SPR_SPRG6
, "SPRG6",
7231 SPR_NOACCESS
, SPR_NOACCESS
,
7232 &spr_read_generic
, &spr_write_generic
,
7234 spr_register(env
, SPR_USPRG6
, "USPRG6",
7235 &spr_read_ureg
, SPR_NOACCESS
,
7236 &spr_read_ureg
, SPR_NOACCESS
,
7238 spr_register(env
, SPR_SPRG7
, "SPRG7",
7239 SPR_NOACCESS
, SPR_NOACCESS
,
7240 &spr_read_generic
, &spr_write_generic
,
7242 spr_register(env
, SPR_USPRG7
, "USPRG7",
7243 &spr_read_ureg
, SPR_NOACCESS
,
7244 &spr_read_ureg
, SPR_NOACCESS
,
7246 /* Memory management */
7249 gen_74xx_soft_tlb(env
, 128, 2);
7250 init_excp_7450(env
);
7251 env
->dcache_line_size
= 32;
7252 env
->icache_line_size
= 32;
7253 /* Allocate hardware IRQ controller */
7254 ppc6xx_irq_init(env
);
7257 POWERPC_FAMILY(e600
)(ObjectClass
*oc
, void *data
)
7259 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7260 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7262 dc
->desc
= "PowerPC e600";
7263 pcc
->init_proc
= init_proc_e600
;
7264 pcc
->check_pow
= check_pow_hid0_74xx
;
7265 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7266 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7267 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7269 PPC_CACHE
| PPC_CACHE_ICBI
|
7270 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7271 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7272 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7273 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7274 PPC_SEGMENT
| PPC_EXTERN
|
7276 pcc
->insns_flags2
= PPC_NONE
;
7277 pcc
->msr_mask
= (1ull << MSR_VR
) |
7294 pcc
->mmu_model
= POWERPC_MMU_32B
;
7295 #if defined(CONFIG_SOFTMMU)
7296 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
7298 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7299 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7300 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7301 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7302 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7303 POWERPC_FLAG_BUS_CLK
;
7306 #if defined (TARGET_PPC64)
7307 #if defined(CONFIG_USER_ONLY)
7308 #define POWERPC970_HID5_INIT 0x00000080
7310 #define POWERPC970_HID5_INIT 0x00000000
7313 enum BOOK3S_CPU_TYPE
{
7315 BOOK3S_CPU_POWER5PLUS
,
7321 static void gen_fscr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7322 int bit
, int sprn
, int cause
)
7324 TCGv_i32 t1
= tcg_const_i32(bit
);
7325 TCGv_i32 t2
= tcg_const_i32(sprn
);
7326 TCGv_i32 t3
= tcg_const_i32(cause
);
7328 gen_update_current_nip(ctx
);
7329 gen_helper_fscr_facility_check(cpu_env
, t1
, t2
, t3
);
7331 tcg_temp_free_i32(t3
);
7332 tcg_temp_free_i32(t2
);
7333 tcg_temp_free_i32(t1
);
7336 static void gen_msr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7337 int bit
, int sprn
, int cause
)
7339 TCGv_i32 t1
= tcg_const_i32(bit
);
7340 TCGv_i32 t2
= tcg_const_i32(sprn
);
7341 TCGv_i32 t3
= tcg_const_i32(cause
);
7343 gen_update_current_nip(ctx
);
7344 gen_helper_msr_facility_check(cpu_env
, t1
, t2
, t3
);
7346 tcg_temp_free_i32(t3
);
7347 tcg_temp_free_i32(t2
);
7348 tcg_temp_free_i32(t1
);
7351 static void spr_read_prev_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
7353 TCGv spr_up
= tcg_temp_new();
7354 TCGv spr
= tcg_temp_new();
7356 gen_load_spr(spr
, sprn
- 1);
7357 tcg_gen_shri_tl(spr_up
, spr
, 32);
7358 tcg_gen_ext32u_tl(cpu_gpr
[gprn
], spr_up
);
7361 tcg_temp_free(spr_up
);
7364 static void spr_write_prev_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
7366 TCGv spr
= tcg_temp_new();
7368 gen_load_spr(spr
, sprn
- 1);
7369 tcg_gen_deposit_tl(spr
, spr
, cpu_gpr
[gprn
], 32, 32);
7370 gen_store_spr(sprn
- 1, spr
);
7375 static int check_pow_970 (CPUPPCState
*env
)
7377 if (env
->spr
[SPR_HID0
] & (HID0_DEEPNAP
| HID0_DOZE
| HID0_NAP
)) {
7384 static void gen_spr_970_hid(CPUPPCState
*env
)
7386 /* Hardware implementation registers */
7387 /* XXX : not implemented */
7388 spr_register(env
, SPR_HID0
, "HID0",
7389 SPR_NOACCESS
, SPR_NOACCESS
,
7390 &spr_read_generic
, &spr_write_clear
,
7392 spr_register(env
, SPR_HID1
, "HID1",
7393 SPR_NOACCESS
, SPR_NOACCESS
,
7394 &spr_read_generic
, &spr_write_generic
,
7396 spr_register(env
, SPR_970_HID5
, "HID5",
7397 SPR_NOACCESS
, SPR_NOACCESS
,
7398 &spr_read_generic
, &spr_write_generic
,
7399 POWERPC970_HID5_INIT
);
7402 static void gen_spr_970_hior(CPUPPCState
*env
)
7404 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7405 SPR_NOACCESS
, SPR_NOACCESS
,
7406 &spr_read_hior
, &spr_write_hior
,
7410 static void gen_spr_970_lpar(CPUPPCState
*env
)
7412 /* Logical partitionning */
7413 /* PPC970: HID4 is effectively the LPCR */
7414 spr_register(env
, SPR_970_HID4
, "HID4",
7415 SPR_NOACCESS
, SPR_NOACCESS
,
7416 &spr_read_generic
, &spr_write_generic
,
7420 static void gen_spr_book3s_common(CPUPPCState
*env
)
7422 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
7423 SPR_NOACCESS
, SPR_NOACCESS
,
7424 SPR_NOACCESS
, &spr_write_generic
,
7426 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
7427 &spr_read_ureg
, SPR_NOACCESS
,
7428 &spr_read_ureg
, SPR_NOACCESS
,
7432 static void gen_spr_book3s_altivec(CPUPPCState
*env
)
7434 if (!(env
->insns_flags
& PPC_ALTIVEC
)) {
7438 spr_register_kvm(env
, SPR_VRSAVE
, "VRSAVE",
7439 &spr_read_generic
, &spr_write_generic
,
7440 &spr_read_generic
, &spr_write_generic
,
7441 KVM_REG_PPC_VRSAVE
, 0x00000000);
7443 /* Can't find information on what this should be on reset. This
7444 * value is the one used by 74xx processors. */
7445 vscr_init(env
, 0x00010000);
7448 static void gen_spr_book3s_dbg(CPUPPCState
*env
)
7451 * TODO: different specs define different scopes for these,
7452 * will have to address this:
7453 * 970: super/write and super/read
7454 * powerisa 2.03..2.04: hypv/write and super/read.
7455 * powerisa 2.05 and newer: hypv/write and hypv/read.
7457 spr_register_kvm(env
, SPR_DABR
, "DABR",
7458 SPR_NOACCESS
, SPR_NOACCESS
,
7459 &spr_read_generic
, &spr_write_generic
,
7460 KVM_REG_PPC_DABR
, 0x00000000);
7461 spr_register_kvm(env
, SPR_DABRX
, "DABRX",
7462 SPR_NOACCESS
, SPR_NOACCESS
,
7463 &spr_read_generic
, &spr_write_generic
,
7464 KVM_REG_PPC_DABRX
, 0x00000000);
7467 static void gen_spr_970_dbg(CPUPPCState
*env
)
7470 spr_register(env
, SPR_IABR
, "IABR",
7471 SPR_NOACCESS
, SPR_NOACCESS
,
7472 &spr_read_generic
, &spr_write_generic
,
7476 static void gen_spr_book3s_pmu_sup(CPUPPCState
*env
)
7478 spr_register_kvm(env
, SPR_POWER_MMCR0
, "MMCR0",
7479 SPR_NOACCESS
, SPR_NOACCESS
,
7480 &spr_read_generic
, &spr_write_generic
,
7481 KVM_REG_PPC_MMCR0
, 0x00000000);
7482 spr_register_kvm(env
, SPR_POWER_MMCR1
, "MMCR1",
7483 SPR_NOACCESS
, SPR_NOACCESS
,
7484 &spr_read_generic
, &spr_write_generic
,
7485 KVM_REG_PPC_MMCR1
, 0x00000000);
7486 spr_register_kvm(env
, SPR_POWER_MMCRA
, "MMCRA",
7487 SPR_NOACCESS
, SPR_NOACCESS
,
7488 &spr_read_generic
, &spr_write_generic
,
7489 KVM_REG_PPC_MMCRA
, 0x00000000);
7490 spr_register_kvm(env
, SPR_POWER_PMC1
, "PMC1",
7491 SPR_NOACCESS
, SPR_NOACCESS
,
7492 &spr_read_generic
, &spr_write_generic
,
7493 KVM_REG_PPC_PMC1
, 0x00000000);
7494 spr_register_kvm(env
, SPR_POWER_PMC2
, "PMC2",
7495 SPR_NOACCESS
, SPR_NOACCESS
,
7496 &spr_read_generic
, &spr_write_generic
,
7497 KVM_REG_PPC_PMC2
, 0x00000000);
7498 spr_register_kvm(env
, SPR_POWER_PMC3
, "PMC3",
7499 SPR_NOACCESS
, SPR_NOACCESS
,
7500 &spr_read_generic
, &spr_write_generic
,
7501 KVM_REG_PPC_PMC3
, 0x00000000);
7502 spr_register_kvm(env
, SPR_POWER_PMC4
, "PMC4",
7503 SPR_NOACCESS
, SPR_NOACCESS
,
7504 &spr_read_generic
, &spr_write_generic
,
7505 KVM_REG_PPC_PMC4
, 0x00000000);
7506 spr_register_kvm(env
, SPR_POWER_PMC5
, "PMC5",
7507 SPR_NOACCESS
, SPR_NOACCESS
,
7508 &spr_read_generic
, &spr_write_generic
,
7509 KVM_REG_PPC_PMC5
, 0x00000000);
7510 spr_register_kvm(env
, SPR_POWER_PMC6
, "PMC6",
7511 SPR_NOACCESS
, SPR_NOACCESS
,
7512 &spr_read_generic
, &spr_write_generic
,
7513 KVM_REG_PPC_PMC6
, 0x00000000);
7514 spr_register_kvm(env
, SPR_POWER_SIAR
, "SIAR",
7515 SPR_NOACCESS
, SPR_NOACCESS
,
7516 &spr_read_generic
, &spr_write_generic
,
7517 KVM_REG_PPC_SIAR
, 0x00000000);
7518 spr_register_kvm(env
, SPR_POWER_SDAR
, "SDAR",
7519 SPR_NOACCESS
, SPR_NOACCESS
,
7520 &spr_read_generic
, &spr_write_generic
,
7521 KVM_REG_PPC_SDAR
, 0x00000000);
7524 static void gen_spr_book3s_pmu_user(CPUPPCState
*env
)
7526 spr_register(env
, SPR_POWER_UMMCR0
, "UMMCR0",
7527 &spr_read_ureg
, SPR_NOACCESS
,
7528 &spr_read_ureg
, &spr_write_ureg
,
7530 spr_register(env
, SPR_POWER_UMMCR1
, "UMMCR1",
7531 &spr_read_ureg
, SPR_NOACCESS
,
7532 &spr_read_ureg
, &spr_write_ureg
,
7534 spr_register(env
, SPR_POWER_UMMCRA
, "UMMCRA",
7535 &spr_read_ureg
, SPR_NOACCESS
,
7536 &spr_read_ureg
, &spr_write_ureg
,
7538 spr_register(env
, SPR_POWER_UPMC1
, "UPMC1",
7539 &spr_read_ureg
, SPR_NOACCESS
,
7540 &spr_read_ureg
, &spr_write_ureg
,
7542 spr_register(env
, SPR_POWER_UPMC2
, "UPMC2",
7543 &spr_read_ureg
, SPR_NOACCESS
,
7544 &spr_read_ureg
, &spr_write_ureg
,
7546 spr_register(env
, SPR_POWER_UPMC3
, "UPMC3",
7547 &spr_read_ureg
, SPR_NOACCESS
,
7548 &spr_read_ureg
, &spr_write_ureg
,
7550 spr_register(env
, SPR_POWER_UPMC4
, "UPMC4",
7551 &spr_read_ureg
, SPR_NOACCESS
,
7552 &spr_read_ureg
, &spr_write_ureg
,
7554 spr_register(env
, SPR_POWER_UPMC5
, "UPMC5",
7555 &spr_read_ureg
, SPR_NOACCESS
,
7556 &spr_read_ureg
, &spr_write_ureg
,
7558 spr_register(env
, SPR_POWER_UPMC6
, "UPMC6",
7559 &spr_read_ureg
, SPR_NOACCESS
,
7560 &spr_read_ureg
, &spr_write_ureg
,
7562 spr_register(env
, SPR_POWER_USIAR
, "USIAR",
7563 &spr_read_ureg
, SPR_NOACCESS
,
7564 &spr_read_ureg
, &spr_write_ureg
,
7566 spr_register(env
, SPR_POWER_USDAR
, "USDAR",
7567 &spr_read_ureg
, SPR_NOACCESS
,
7568 &spr_read_ureg
, &spr_write_ureg
,
7572 static void gen_spr_970_pmu_sup(CPUPPCState
*env
)
7574 spr_register_kvm(env
, SPR_970_PMC7
, "PMC7",
7575 SPR_NOACCESS
, SPR_NOACCESS
,
7576 &spr_read_generic
, &spr_write_generic
,
7577 KVM_REG_PPC_PMC7
, 0x00000000);
7578 spr_register_kvm(env
, SPR_970_PMC8
, "PMC8",
7579 SPR_NOACCESS
, SPR_NOACCESS
,
7580 &spr_read_generic
, &spr_write_generic
,
7581 KVM_REG_PPC_PMC8
, 0x00000000);
7584 static void gen_spr_970_pmu_user(CPUPPCState
*env
)
7586 spr_register(env
, SPR_970_UPMC7
, "UPMC7",
7587 &spr_read_ureg
, SPR_NOACCESS
,
7588 &spr_read_ureg
, &spr_write_ureg
,
7590 spr_register(env
, SPR_970_UPMC8
, "UPMC8",
7591 &spr_read_ureg
, SPR_NOACCESS
,
7592 &spr_read_ureg
, &spr_write_ureg
,
7596 static void gen_spr_power8_pmu_sup(CPUPPCState
*env
)
7598 spr_register_kvm(env
, SPR_POWER_MMCR2
, "MMCR2",
7599 SPR_NOACCESS
, SPR_NOACCESS
,
7600 &spr_read_generic
, &spr_write_generic
,
7601 KVM_REG_PPC_MMCR2
, 0x00000000);
7602 spr_register_kvm(env
, SPR_POWER_MMCRS
, "MMCRS",
7603 SPR_NOACCESS
, SPR_NOACCESS
,
7604 &spr_read_generic
, &spr_write_generic
,
7605 KVM_REG_PPC_MMCRS
, 0x00000000);
7608 static void gen_spr_power8_pmu_user(CPUPPCState
*env
)
7610 spr_register(env
, SPR_POWER_UMMCR2
, "UMMCR2",
7611 &spr_read_ureg
, SPR_NOACCESS
,
7612 &spr_read_ureg
, &spr_write_ureg
,
7616 static void gen_spr_power5p_ear(CPUPPCState
*env
)
7618 /* External access control */
7619 spr_register(env
, SPR_EAR
, "EAR",
7620 SPR_NOACCESS
, SPR_NOACCESS
,
7621 &spr_read_generic
, &spr_write_generic
,
7625 static void gen_spr_power5p_lpar(CPUPPCState
*env
)
7627 /* Logical partitionning */
7628 spr_register_kvm(env
, SPR_LPCR
, "LPCR",
7629 SPR_NOACCESS
, SPR_NOACCESS
,
7630 &spr_read_generic
, &spr_write_generic
,
7631 KVM_REG_PPC_LPCR
, 0x00000000);
7634 static void gen_spr_book3s_ids(CPUPPCState
*env
)
7636 /* Processor identification */
7637 spr_register(env
, SPR_PIR
, "PIR",
7638 SPR_NOACCESS
, SPR_NOACCESS
,
7639 &spr_read_generic
, &spr_write_pir
,
7643 static void gen_spr_power8_ids(CPUPPCState
*env
)
7645 /* Thread identification */
7646 spr_register(env
, SPR_TIR
, "TIR",
7647 SPR_NOACCESS
, SPR_NOACCESS
,
7648 &spr_read_generic
, SPR_NOACCESS
,
7652 static void gen_spr_book3s_purr(CPUPPCState
*env
)
7654 #if !defined(CONFIG_USER_ONLY)
7655 /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
7656 spr_register_kvm(env
, SPR_PURR
, "PURR",
7657 &spr_read_purr
, SPR_NOACCESS
,
7658 &spr_read_purr
, SPR_NOACCESS
,
7659 KVM_REG_PPC_PURR
, 0x00000000);
7660 spr_register_kvm(env
, SPR_SPURR
, "SPURR",
7661 &spr_read_purr
, SPR_NOACCESS
,
7662 &spr_read_purr
, SPR_NOACCESS
,
7663 KVM_REG_PPC_SPURR
, 0x00000000);
7667 static void gen_spr_power6_dbg(CPUPPCState
*env
)
7669 #if !defined(CONFIG_USER_ONLY)
7670 spr_register(env
, SPR_CFAR
, "SPR_CFAR",
7671 SPR_NOACCESS
, SPR_NOACCESS
,
7672 &spr_read_cfar
, &spr_write_cfar
,
7677 static void gen_spr_power5p_common(CPUPPCState
*env
)
7679 spr_register_kvm(env
, SPR_PPR
, "PPR",
7680 &spr_read_generic
, &spr_write_generic
,
7681 &spr_read_generic
, &spr_write_generic
,
7682 KVM_REG_PPC_PPR
, 0x00000000);
7685 static void gen_spr_power6_common(CPUPPCState
*env
)
7687 #if !defined(CONFIG_USER_ONLY)
7688 spr_register_kvm(env
, SPR_DSCR
, "SPR_DSCR",
7689 SPR_NOACCESS
, SPR_NOACCESS
,
7690 &spr_read_generic
, &spr_write_generic
,
7691 KVM_REG_PPC_DSCR
, 0x00000000);
7694 * Register PCR to report POWERPC_EXCP_PRIV_REG instead of
7695 * POWERPC_EXCP_INVAL_SPR.
7697 spr_register(env
, SPR_PCR
, "PCR",
7698 SPR_NOACCESS
, SPR_NOACCESS
,
7699 SPR_NOACCESS
, SPR_NOACCESS
,
7703 static void spr_read_tar(DisasContext
*ctx
, int gprn
, int sprn
)
7705 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
7706 spr_read_generic(ctx
, gprn
, sprn
);
7709 static void spr_write_tar(DisasContext
*ctx
, int sprn
, int gprn
)
7711 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
7712 spr_write_generic(ctx
, sprn
, gprn
);
7715 static void gen_spr_power8_tce_address_control(CPUPPCState
*env
)
7717 spr_register(env
, SPR_TAR
, "TAR",
7718 &spr_read_tar
, &spr_write_tar
,
7719 &spr_read_generic
, &spr_write_generic
,
7723 static void spr_read_tm(DisasContext
*ctx
, int gprn
, int sprn
)
7725 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
7726 spr_read_generic(ctx
, gprn
, sprn
);
7729 static void spr_write_tm(DisasContext
*ctx
, int sprn
, int gprn
)
7731 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
7732 spr_write_generic(ctx
, sprn
, gprn
);
7735 static void spr_read_tm_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
7737 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
7738 spr_read_prev_upper32(ctx
, gprn
, sprn
);
7741 static void spr_write_tm_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
7743 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
7744 spr_write_prev_upper32(ctx
, sprn
, gprn
);
7747 static void gen_spr_power8_tm(CPUPPCState
*env
)
7749 spr_register_kvm(env
, SPR_TFHAR
, "TFHAR",
7750 &spr_read_tm
, &spr_write_tm
,
7751 &spr_read_tm
, &spr_write_tm
,
7752 KVM_REG_PPC_TFHAR
, 0x00000000);
7753 spr_register_kvm(env
, SPR_TFIAR
, "TFIAR",
7754 &spr_read_tm
, &spr_write_tm
,
7755 &spr_read_tm
, &spr_write_tm
,
7756 KVM_REG_PPC_TFIAR
, 0x00000000);
7757 spr_register_kvm(env
, SPR_TEXASR
, "TEXASR",
7758 &spr_read_tm
, &spr_write_tm
,
7759 &spr_read_tm
, &spr_write_tm
,
7760 KVM_REG_PPC_TEXASR
, 0x00000000);
7761 spr_register(env
, SPR_TEXASRU
, "TEXASRU",
7762 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
7763 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
7767 static void spr_read_ebb(DisasContext
*ctx
, int gprn
, int sprn
)
7769 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
7770 spr_read_generic(ctx
, gprn
, sprn
);
7773 static void spr_write_ebb(DisasContext
*ctx
, int sprn
, int gprn
)
7775 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
7776 spr_write_generic(ctx
, sprn
, gprn
);
7779 static void spr_read_ebb_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
7781 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
7782 spr_read_prev_upper32(ctx
, gprn
, sprn
);
7785 static void spr_write_ebb_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
7787 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
7788 spr_write_prev_upper32(ctx
, sprn
, gprn
);
7791 static void gen_spr_power8_ebb(CPUPPCState
*env
)
7793 spr_register(env
, SPR_BESCRS
, "BESCRS",
7794 &spr_read_ebb
, &spr_write_ebb
,
7795 &spr_read_generic
, &spr_write_generic
,
7797 spr_register(env
, SPR_BESCRSU
, "BESCRSU",
7798 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
7799 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
7801 spr_register(env
, SPR_BESCRR
, "BESCRR",
7802 &spr_read_ebb
, &spr_write_ebb
,
7803 &spr_read_generic
, &spr_write_generic
,
7805 spr_register(env
, SPR_BESCRRU
, "BESCRRU",
7806 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
7807 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
7809 spr_register_kvm(env
, SPR_EBBHR
, "EBBHR",
7810 &spr_read_ebb
, &spr_write_ebb
,
7811 &spr_read_generic
, &spr_write_generic
,
7812 KVM_REG_PPC_EBBHR
, 0x00000000);
7813 spr_register_kvm(env
, SPR_EBBRR
, "EBBRR",
7814 &spr_read_ebb
, &spr_write_ebb
,
7815 &spr_read_generic
, &spr_write_generic
,
7816 KVM_REG_PPC_EBBRR
, 0x00000000);
7817 spr_register_kvm(env
, SPR_BESCR
, "BESCR",
7818 &spr_read_ebb
, &spr_write_ebb
,
7819 &spr_read_generic
, &spr_write_generic
,
7820 KVM_REG_PPC_BESCR
, 0x00000000);
7823 /* Virtual Time Base */
7824 static void gen_spr_vtb(CPUPPCState
*env
)
7826 spr_register(env
, SPR_VTB
, "VTB",
7827 SPR_NOACCESS
, SPR_NOACCESS
,
7828 &spr_read_tbl
, SPR_NOACCESS
,
7832 static void gen_spr_power8_fscr(CPUPPCState
*env
)
7834 #if defined(CONFIG_USER_ONLY)
7835 target_ulong initval
= 1ULL << FSCR_TAR
;
7837 target_ulong initval
= 0;
7839 spr_register_kvm(env
, SPR_FSCR
, "FSCR",
7840 SPR_NOACCESS
, SPR_NOACCESS
,
7841 &spr_read_generic
, &spr_write_generic
,
7842 KVM_REG_PPC_FSCR
, initval
);
7845 static void init_proc_book3s_64(CPUPPCState
*env
, int version
)
7847 gen_spr_ne_601(env
);
7849 gen_spr_book3s_altivec(env
);
7850 gen_spr_book3s_pmu_sup(env
);
7851 gen_spr_book3s_pmu_user(env
);
7852 gen_spr_book3s_common(env
);
7855 case BOOK3S_CPU_970
:
7856 case BOOK3S_CPU_POWER5PLUS
:
7857 gen_spr_970_hid(env
);
7858 gen_spr_970_hior(env
);
7860 gen_spr_970_pmu_sup(env
);
7861 gen_spr_970_pmu_user(env
);
7863 case BOOK3S_CPU_POWER7
:
7864 case BOOK3S_CPU_POWER8
:
7865 gen_spr_book3s_ids(env
);
7867 gen_spr_book3s_purr(env
);
7868 env
->ci_large_pages
= true;
7871 g_assert_not_reached();
7873 if (version
>= BOOK3S_CPU_POWER5PLUS
) {
7874 gen_spr_power5p_common(env
);
7875 gen_spr_power5p_lpar(env
);
7876 gen_spr_power5p_ear(env
);
7878 gen_spr_970_lpar(env
);
7880 if (version
== BOOK3S_CPU_970
) {
7881 gen_spr_970_dbg(env
);
7883 if (version
>= BOOK3S_CPU_POWER6
) {
7884 gen_spr_power6_common(env
);
7885 gen_spr_power6_dbg(env
);
7887 if (version
>= BOOK3S_CPU_POWER8
) {
7888 gen_spr_power8_tce_address_control(env
);
7889 gen_spr_power8_ids(env
);
7890 gen_spr_power8_ebb(env
);
7891 gen_spr_power8_fscr(env
);
7892 gen_spr_power8_pmu_sup(env
);
7893 gen_spr_power8_pmu_user(env
);
7894 gen_spr_power8_tm(env
);
7897 if (version
< BOOK3S_CPU_POWER8
) {
7898 gen_spr_book3s_dbg(env
);
7900 #if !defined(CONFIG_USER_ONLY)
7902 case BOOK3S_CPU_970
:
7903 case BOOK3S_CPU_POWER5PLUS
:
7906 case BOOK3S_CPU_POWER7
:
7907 case BOOK3S_CPU_POWER8
:
7913 /* Allocate hardware IRQ controller */
7915 case BOOK3S_CPU_970
:
7916 case BOOK3S_CPU_POWER5PLUS
:
7918 ppc970_irq_init(env
);
7920 case BOOK3S_CPU_POWER7
:
7921 case BOOK3S_CPU_POWER8
:
7922 init_excp_POWER7(env
);
7923 ppcPOWER7_irq_init(env
);
7926 g_assert_not_reached();
7929 env
->dcache_line_size
= 128;
7930 env
->icache_line_size
= 128;
7933 static void init_proc_970(CPUPPCState
*env
)
7935 init_proc_book3s_64(env
, BOOK3S_CPU_970
);
7938 POWERPC_FAMILY(970)(ObjectClass
*oc
, void *data
)
7940 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7941 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7943 dc
->desc
= "PowerPC 970";
7944 pcc
->init_proc
= init_proc_970
;
7945 pcc
->check_pow
= check_pow_970
;
7946 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7947 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7948 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7950 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7951 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7952 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7953 PPC_64B
| PPC_ALTIVEC
|
7954 PPC_SEGMENT_64B
| PPC_SLBI
;
7955 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
7956 pcc
->msr_mask
= (1ull << MSR_SF
) |
7971 pcc
->mmu_model
= POWERPC_MMU_64B
;
7972 #if defined(CONFIG_SOFTMMU)
7973 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7975 pcc
->excp_model
= POWERPC_EXCP_970
;
7976 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
7977 pcc
->bfd_mach
= bfd_mach_ppc64
;
7978 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7979 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7980 POWERPC_FLAG_BUS_CLK
;
7981 pcc
->l1_dcache_size
= 0x8000;
7982 pcc
->l1_icache_size
= 0x10000;
7985 static void init_proc_power5plus(CPUPPCState
*env
)
7987 init_proc_book3s_64(env
, BOOK3S_CPU_POWER5PLUS
);
7990 POWERPC_FAMILY(POWER5P
)(ObjectClass
*oc
, void *data
)
7992 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7993 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7995 dc
->fw_name
= "PowerPC,POWER5";
7996 dc
->desc
= "POWER5+";
7997 pcc
->init_proc
= init_proc_power5plus
;
7998 pcc
->check_pow
= check_pow_970
;
7999 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8000 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8001 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8003 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8004 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8005 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8007 PPC_SEGMENT_64B
| PPC_SLBI
;
8008 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8009 pcc
->msr_mask
= (1ull << MSR_SF
) |
8024 pcc
->mmu_model
= POWERPC_MMU_2_03
;
8025 #if defined(CONFIG_SOFTMMU)
8026 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8028 pcc
->excp_model
= POWERPC_EXCP_970
;
8029 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8030 pcc
->bfd_mach
= bfd_mach_ppc64
;
8031 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8032 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8033 POWERPC_FLAG_BUS_CLK
;
8034 pcc
->l1_dcache_size
= 0x8000;
8035 pcc
->l1_icache_size
= 0x10000;
8038 static void powerpc_get_compat(Object
*obj
, Visitor
*v
, const char *name
,
8039 void *opaque
, Error
**errp
)
8041 char *value
= (char *)"";
8042 Property
*prop
= opaque
;
8043 uint32_t *max_compat
= qdev_get_prop_ptr(DEVICE(obj
), prop
);
8045 switch (*max_compat
) {
8046 case CPU_POWERPC_LOGICAL_2_05
:
8047 value
= (char *)"power6";
8049 case CPU_POWERPC_LOGICAL_2_06
:
8050 value
= (char *)"power7";
8052 case CPU_POWERPC_LOGICAL_2_07
:
8053 value
= (char *)"power8";
8058 error_setg(errp
, "Internal error: compat is set to %x",
8059 max_compat
? *max_compat
: -1);
8063 visit_type_str(v
, name
, &value
, errp
);
8066 static void powerpc_set_compat(Object
*obj
, Visitor
*v
, const char *name
,
8067 void *opaque
, Error
**errp
)
8069 Error
*error
= NULL
;
8071 Property
*prop
= opaque
;
8072 uint32_t *max_compat
= qdev_get_prop_ptr(DEVICE(obj
), prop
);
8074 visit_type_str(v
, name
, &value
, &error
);
8076 error_propagate(errp
, error
);
8080 if (strcmp(value
, "power6") == 0) {
8081 *max_compat
= CPU_POWERPC_LOGICAL_2_05
;
8082 } else if (strcmp(value
, "power7") == 0) {
8083 *max_compat
= CPU_POWERPC_LOGICAL_2_06
;
8084 } else if (strcmp(value
, "power8") == 0) {
8085 *max_compat
= CPU_POWERPC_LOGICAL_2_07
;
8087 error_setg(errp
, "Invalid compatibility mode \"%s\"", value
);
8093 static PropertyInfo powerpc_compat_propinfo
= {
8095 .description
= "compatibility mode, power6/power7/power8",
8096 .get
= powerpc_get_compat
,
8097 .set
= powerpc_set_compat
,
8100 #define DEFINE_PROP_POWERPC_COMPAT(_n, _s, _f) \
8101 DEFINE_PROP(_n, _s, _f, powerpc_compat_propinfo, uint32_t)
8103 static Property powerpc_servercpu_properties
[] = {
8104 DEFINE_PROP_POWERPC_COMPAT("compat", PowerPCCPU
, max_compat
),
8105 DEFINE_PROP_END_OF_LIST(),
8108 #ifdef CONFIG_SOFTMMU
8109 static const struct ppc_segment_page_sizes POWER7_POWER8_sps
= {
8112 .page_shift
= 12, /* 4K */
8114 .enc
= { { .page_shift
= 12, .pte_enc
= 0 },
8115 { .page_shift
= 16, .pte_enc
= 0x7 },
8116 { .page_shift
= 24, .pte_enc
= 0x38 }, },
8119 .page_shift
= 16, /* 64K */
8120 .slb_enc
= SLB_VSID_64K
,
8121 .enc
= { { .page_shift
= 16, .pte_enc
= 0x1 },
8122 { .page_shift
= 24, .pte_enc
= 0x8 }, },
8125 .page_shift
= 24, /* 16M */
8126 .slb_enc
= SLB_VSID_16M
,
8127 .enc
= { { .page_shift
= 24, .pte_enc
= 0 }, },
8130 .page_shift
= 34, /* 16G */
8131 .slb_enc
= SLB_VSID_16G
,
8132 .enc
= { { .page_shift
= 34, .pte_enc
= 0x3 }, },
8136 #endif /* CONFIG_SOFTMMU */
8138 static void init_proc_POWER7 (CPUPPCState
*env
)
8140 init_proc_book3s_64(env
, BOOK3S_CPU_POWER7
);
8143 static bool ppc_pvr_match_power7(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8145 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7P_BASE
) {
8148 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7_BASE
) {
8154 POWERPC_FAMILY(POWER7
)(ObjectClass
*oc
, void *data
)
8156 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8157 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8159 dc
->fw_name
= "PowerPC,POWER7";
8160 dc
->desc
= "POWER7";
8161 dc
->props
= powerpc_servercpu_properties
;
8162 pcc
->pvr_match
= ppc_pvr_match_power7
;
8163 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
;
8164 pcc
->init_proc
= init_proc_POWER7
;
8165 pcc
->check_pow
= check_pow_nocheck
;
8166 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8167 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8168 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8169 PPC_FLOAT_FRSQRTES
|
8172 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8173 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8174 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8175 PPC_64B
| PPC_ALTIVEC
|
8176 PPC_SEGMENT_64B
| PPC_SLBI
|
8177 PPC_POPCNTB
| PPC_POPCNTWD
;
8178 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
8179 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8180 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8181 PPC2_FP_TST_ISA206
| PPC2_FP_CVT_S64
;
8182 pcc
->msr_mask
= (1ull << MSR_SF
) |
8198 pcc
->mmu_model
= POWERPC_MMU_2_06
;
8199 #if defined(CONFIG_SOFTMMU)
8200 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8201 pcc
->sps
= &POWER7_POWER8_sps
;
8203 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
8204 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8205 pcc
->bfd_mach
= bfd_mach_ppc64
;
8206 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8207 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8208 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8210 pcc
->l1_dcache_size
= 0x8000;
8211 pcc
->l1_icache_size
= 0x8000;
8212 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8215 static void init_proc_POWER8(CPUPPCState
*env
)
8217 init_proc_book3s_64(env
, BOOK3S_CPU_POWER8
);
8220 static bool ppc_pvr_match_power8(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8222 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8E_BASE
) {
8225 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8_BASE
) {
8231 POWERPC_FAMILY(POWER8
)(ObjectClass
*oc
, void *data
)
8233 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8234 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8236 dc
->fw_name
= "PowerPC,POWER8";
8237 dc
->desc
= "POWER8";
8238 dc
->props
= powerpc_servercpu_properties
;
8239 pcc
->pvr_match
= ppc_pvr_match_power8
;
8240 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
;
8241 pcc
->init_proc
= init_proc_POWER8
;
8242 pcc
->check_pow
= check_pow_nocheck
;
8243 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8244 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8245 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8246 PPC_FLOAT_FRSQRTES
|
8249 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8250 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8251 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8252 PPC_64B
| PPC_64BX
| PPC_ALTIVEC
|
8253 PPC_SEGMENT_64B
| PPC_SLBI
|
8254 PPC_POPCNTB
| PPC_POPCNTWD
;
8255 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
8256 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8257 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8258 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
8259 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
8260 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
8262 pcc
->msr_mask
= (1ull << MSR_SF
) |
8279 pcc
->mmu_model
= POWERPC_MMU_2_07
;
8280 #if defined(CONFIG_SOFTMMU)
8281 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8282 pcc
->sps
= &POWER7_POWER8_sps
;
8284 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
8285 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8286 pcc
->bfd_mach
= bfd_mach_ppc64
;
8287 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8288 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8289 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8290 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
;
8291 pcc
->l1_dcache_size
= 0x8000;
8292 pcc
->l1_icache_size
= 0x8000;
8293 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8295 #endif /* defined (TARGET_PPC64) */
8298 /*****************************************************************************/
8299 /* Generic CPU instantiation routine */
8300 static void init_ppc_proc(PowerPCCPU
*cpu
)
8302 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8303 CPUPPCState
*env
= &cpu
->env
;
8304 #if !defined(CONFIG_USER_ONLY)
8307 env
->irq_inputs
= NULL
;
8308 /* Set all exception vectors to an invalid address */
8309 for (i
= 0; i
< POWERPC_EXCP_NB
; i
++)
8310 env
->excp_vectors
[i
] = (target_ulong
)(-1ULL);
8311 env
->ivor_mask
= 0x00000000;
8312 env
->ivpr_mask
= 0x00000000;
8313 /* Default MMU definitions */
8317 env
->tlb_type
= TLB_NONE
;
8319 /* Register SPR common to all PowerPC implementations */
8320 gen_spr_generic(env
);
8321 spr_register(env
, SPR_PVR
, "PVR",
8322 /* Linux permits userspace to read PVR */
8323 #if defined(CONFIG_LINUX_USER)
8329 &spr_read_generic
, SPR_NOACCESS
,
8331 /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
8332 if (pcc
->svr
!= POWERPC_SVR_NONE
) {
8333 if (pcc
->svr
& POWERPC_SVR_E500
) {
8334 spr_register(env
, SPR_E500_SVR
, "SVR",
8335 SPR_NOACCESS
, SPR_NOACCESS
,
8336 &spr_read_generic
, SPR_NOACCESS
,
8337 pcc
->svr
& ~POWERPC_SVR_E500
);
8339 spr_register(env
, SPR_SVR
, "SVR",
8340 SPR_NOACCESS
, SPR_NOACCESS
,
8341 &spr_read_generic
, SPR_NOACCESS
,
8345 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
8346 (*pcc
->init_proc
)(env
);
8348 /* MSR bits & flags consistency checks */
8349 if (env
->msr_mask
& (1 << 25)) {
8350 switch (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
8351 case POWERPC_FLAG_SPE
:
8352 case POWERPC_FLAG_VRE
:
8355 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8356 "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
8359 } else if (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
8360 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8361 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
8364 if (env
->msr_mask
& (1 << 17)) {
8365 switch (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8366 case POWERPC_FLAG_TGPR
:
8367 case POWERPC_FLAG_CE
:
8370 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8371 "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
8374 } else if (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8375 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8376 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
8379 if (env
->msr_mask
& (1 << 10)) {
8380 switch (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8381 POWERPC_FLAG_UBLE
)) {
8382 case POWERPC_FLAG_SE
:
8383 case POWERPC_FLAG_DWE
:
8384 case POWERPC_FLAG_UBLE
:
8387 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8388 "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
8389 "POWERPC_FLAG_UBLE\n");
8392 } else if (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8393 POWERPC_FLAG_UBLE
)) {
8394 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8395 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
8396 "POWERPC_FLAG_UBLE\n");
8399 if (env
->msr_mask
& (1 << 9)) {
8400 switch (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8401 case POWERPC_FLAG_BE
:
8402 case POWERPC_FLAG_DE
:
8405 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8406 "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
8409 } else if (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8410 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8411 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
8414 if (env
->msr_mask
& (1 << 2)) {
8415 switch (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8416 case POWERPC_FLAG_PX
:
8417 case POWERPC_FLAG_PMM
:
8420 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8421 "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
8424 } else if (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8425 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8426 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
8429 if ((env
->flags
& (POWERPC_FLAG_RTC_CLK
| POWERPC_FLAG_BUS_CLK
)) == 0) {
8430 fprintf(stderr
, "PowerPC flags inconsistency\n"
8431 "Should define the time-base and decrementer clock source\n");
8434 /* Allocate TLBs buffer when needed */
8435 #if !defined(CONFIG_USER_ONLY)
8436 if (env
->nb_tlb
!= 0) {
8437 int nb_tlb
= env
->nb_tlb
;
8438 if (env
->id_tlbs
!= 0)
8440 switch (env
->tlb_type
) {
8442 env
->tlb
.tlb6
= g_malloc0(nb_tlb
* sizeof(ppc6xx_tlb_t
));
8445 env
->tlb
.tlbe
= g_malloc0(nb_tlb
* sizeof(ppcemb_tlb_t
));
8448 env
->tlb
.tlbm
= g_malloc0(nb_tlb
* sizeof(ppcmas_tlb_t
));
8451 /* Pre-compute some useful values */
8452 env
->tlb_per_way
= env
->nb_tlb
/ env
->nb_ways
;
8454 if (env
->irq_inputs
== NULL
) {
8455 fprintf(stderr
, "WARNING: no internal IRQ controller registered.\n"
8456 " Attempt QEMU to crash very soon !\n");
8459 if (env
->check_pow
== NULL
) {
8460 fprintf(stderr
, "WARNING: no power management check handler "
8462 " Attempt QEMU to crash very soon !\n");
8466 #if defined(PPC_DUMP_CPU)
8467 static void dump_ppc_sprs (CPUPPCState
*env
)
8470 #if !defined(CONFIG_USER_ONLY)
8476 printf("Special purpose registers:\n");
8477 for (i
= 0; i
< 32; i
++) {
8478 for (j
= 0; j
< 32; j
++) {
8480 spr
= &env
->spr_cb
[n
];
8481 uw
= spr
->uea_write
!= NULL
&& spr
->uea_write
!= SPR_NOACCESS
;
8482 ur
= spr
->uea_read
!= NULL
&& spr
->uea_read
!= SPR_NOACCESS
;
8483 #if !defined(CONFIG_USER_ONLY)
8484 sw
= spr
->oea_write
!= NULL
&& spr
->oea_write
!= SPR_NOACCESS
;
8485 sr
= spr
->oea_read
!= NULL
&& spr
->oea_read
!= SPR_NOACCESS
;
8486 if (sw
|| sr
|| uw
|| ur
) {
8487 printf("SPR: %4d (%03x) %-8s s%c%c u%c%c\n",
8488 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
8489 sw
? 'w' : '-', sr
? 'r' : '-',
8490 uw
? 'w' : '-', ur
? 'r' : '-');
8494 printf("SPR: %4d (%03x) %-8s u%c%c\n",
8495 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
8496 uw
? 'w' : '-', ur
? 'r' : '-');
8506 /*****************************************************************************/
8510 PPC_DIRECT
= 0, /* Opcode routine */
8511 PPC_INDIRECT
= 1, /* Indirect opcode table */
8514 #define PPC_OPCODE_MASK 0x3
8516 static inline int is_indirect_opcode (void *handler
)
8518 return ((uintptr_t)handler
& PPC_OPCODE_MASK
) == PPC_INDIRECT
;
8521 static inline opc_handler_t
**ind_table(void *handler
)
8523 return (opc_handler_t
**)((uintptr_t)handler
& ~PPC_OPCODE_MASK
);
8526 /* Instruction table creation */
8527 /* Opcodes tables creation */
8528 static void fill_new_table (opc_handler_t
**table
, int len
)
8532 for (i
= 0; i
< len
; i
++)
8533 table
[i
] = &invalid_handler
;
8536 static int create_new_table (opc_handler_t
**table
, unsigned char idx
)
8538 opc_handler_t
**tmp
;
8540 tmp
= g_new(opc_handler_t
*, PPC_CPU_INDIRECT_OPCODES_LEN
);
8541 fill_new_table(tmp
, PPC_CPU_INDIRECT_OPCODES_LEN
);
8542 table
[idx
] = (opc_handler_t
*)((uintptr_t)tmp
| PPC_INDIRECT
);
8547 static int insert_in_table (opc_handler_t
**table
, unsigned char idx
,
8548 opc_handler_t
*handler
)
8550 if (table
[idx
] != &invalid_handler
)
8552 table
[idx
] = handler
;
8557 static int register_direct_insn (opc_handler_t
**ppc_opcodes
,
8558 unsigned char idx
, opc_handler_t
*handler
)
8560 if (insert_in_table(ppc_opcodes
, idx
, handler
) < 0) {
8561 printf("*** ERROR: opcode %02x already assigned in main "
8562 "opcode table\n", idx
);
8563 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8564 printf(" Registered handler '%s' - new handler '%s'\n",
8565 ppc_opcodes
[idx
]->oname
, handler
->oname
);
8573 static int register_ind_in_table (opc_handler_t
**table
,
8574 unsigned char idx1
, unsigned char idx2
,
8575 opc_handler_t
*handler
)
8577 if (table
[idx1
] == &invalid_handler
) {
8578 if (create_new_table(table
, idx1
) < 0) {
8579 printf("*** ERROR: unable to create indirect table "
8580 "idx=%02x\n", idx1
);
8584 if (!is_indirect_opcode(table
[idx1
])) {
8585 printf("*** ERROR: idx %02x already assigned to a direct "
8587 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8588 printf(" Registered handler '%s' - new handler '%s'\n",
8589 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
8594 if (handler
!= NULL
&&
8595 insert_in_table(ind_table(table
[idx1
]), idx2
, handler
) < 0) {
8596 printf("*** ERROR: opcode %02x already assigned in "
8597 "opcode table %02x\n", idx2
, idx1
);
8598 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8599 printf(" Registered handler '%s' - new handler '%s'\n",
8600 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
8608 static int register_ind_insn (opc_handler_t
**ppc_opcodes
,
8609 unsigned char idx1
, unsigned char idx2
,
8610 opc_handler_t
*handler
)
8612 return register_ind_in_table(ppc_opcodes
, idx1
, idx2
, handler
);
8615 static int register_dblind_insn (opc_handler_t
**ppc_opcodes
,
8616 unsigned char idx1
, unsigned char idx2
,
8617 unsigned char idx3
, opc_handler_t
*handler
)
8619 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
8620 printf("*** ERROR: unable to join indirect table idx "
8621 "[%02x-%02x]\n", idx1
, idx2
);
8624 if (register_ind_in_table(ind_table(ppc_opcodes
[idx1
]), idx2
, idx3
,
8626 printf("*** ERROR: unable to insert opcode "
8627 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
8634 static int register_insn (opc_handler_t
**ppc_opcodes
, opcode_t
*insn
)
8636 if (insn
->opc2
!= 0xFF) {
8637 if (insn
->opc3
!= 0xFF) {
8638 if (register_dblind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
8639 insn
->opc3
, &insn
->handler
) < 0)
8642 if (register_ind_insn(ppc_opcodes
, insn
->opc1
,
8643 insn
->opc2
, &insn
->handler
) < 0)
8647 if (register_direct_insn(ppc_opcodes
, insn
->opc1
, &insn
->handler
) < 0)
8654 static int test_opcode_table (opc_handler_t
**table
, int len
)
8658 for (i
= 0, count
= 0; i
< len
; i
++) {
8659 /* Consistency fixup */
8660 if (table
[i
] == NULL
)
8661 table
[i
] = &invalid_handler
;
8662 if (table
[i
] != &invalid_handler
) {
8663 if (is_indirect_opcode(table
[i
])) {
8664 tmp
= test_opcode_table(ind_table(table
[i
]),
8665 PPC_CPU_INDIRECT_OPCODES_LEN
);
8668 table
[i
] = &invalid_handler
;
8681 static void fix_opcode_tables (opc_handler_t
**ppc_opcodes
)
8683 if (test_opcode_table(ppc_opcodes
, PPC_CPU_OPCODES_LEN
) == 0)
8684 printf("*** WARNING: no opcode defined !\n");
8687 /*****************************************************************************/
8688 static void create_ppc_opcodes(PowerPCCPU
*cpu
, Error
**errp
)
8690 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8691 CPUPPCState
*env
= &cpu
->env
;
8694 fill_new_table(env
->opcodes
, PPC_CPU_OPCODES_LEN
);
8695 for (opc
= opcodes
; opc
< &opcodes
[ARRAY_SIZE(opcodes
)]; opc
++) {
8696 if (((opc
->handler
.type
& pcc
->insns_flags
) != 0) ||
8697 ((opc
->handler
.type2
& pcc
->insns_flags2
) != 0)) {
8698 if (register_insn(env
->opcodes
, opc
) < 0) {
8699 error_setg(errp
, "ERROR initializing PowerPC instruction "
8700 "0x%02x 0x%02x 0x%02x", opc
->opc1
, opc
->opc2
,
8706 fix_opcode_tables(env
->opcodes
);
8711 #if defined(PPC_DUMP_CPU)
8712 static void dump_ppc_insns (CPUPPCState
*env
)
8714 opc_handler_t
**table
, *handler
;
8716 uint8_t opc1
, opc2
, opc3
;
8718 printf("Instructions set:\n");
8719 /* opc1 is 6 bits long */
8720 for (opc1
= 0x00; opc1
< PPC_CPU_OPCODES_LEN
; opc1
++) {
8721 table
= env
->opcodes
;
8722 handler
= table
[opc1
];
8723 if (is_indirect_opcode(handler
)) {
8724 /* opc2 is 5 bits long */
8725 for (opc2
= 0; opc2
< PPC_CPU_INDIRECT_OPCODES_LEN
; opc2
++) {
8726 table
= env
->opcodes
;
8727 handler
= env
->opcodes
[opc1
];
8728 table
= ind_table(handler
);
8729 handler
= table
[opc2
];
8730 if (is_indirect_opcode(handler
)) {
8731 table
= ind_table(handler
);
8732 /* opc3 is 5 bits long */
8733 for (opc3
= 0; opc3
< PPC_CPU_INDIRECT_OPCODES_LEN
;
8735 handler
= table
[opc3
];
8736 if (handler
->handler
!= &gen_invalid
) {
8737 /* Special hack to properly dump SPE insns */
8738 p
= strchr(handler
->oname
, '_');
8740 printf("INSN: %02x %02x %02x (%02d %04d) : "
8742 opc1
, opc2
, opc3
, opc1
,
8747 if ((p
- handler
->oname
) != strlen(q
) ||
8748 memcmp(handler
->oname
, q
, strlen(q
)) != 0) {
8749 /* First instruction */
8750 printf("INSN: %02x %02x %02x (%02d %04d) : "
8752 opc1
, opc2
<< 1, opc3
, opc1
,
8753 (opc3
<< 6) | (opc2
<< 1),
8754 (int)(p
- handler
->oname
),
8757 if (strcmp(p
+ 1, q
) != 0) {
8758 /* Second instruction */
8759 printf("INSN: %02x %02x %02x (%02d %04d) : "
8761 opc1
, (opc2
<< 1) | 1, opc3
, opc1
,
8762 (opc3
<< 6) | (opc2
<< 1) | 1,
8769 if (handler
->handler
!= &gen_invalid
) {
8770 printf("INSN: %02x %02x -- (%02d %04d) : %s\n",
8771 opc1
, opc2
, opc1
, opc2
, handler
->oname
);
8776 if (handler
->handler
!= &gen_invalid
) {
8777 printf("INSN: %02x -- -- (%02d ----) : %s\n",
8778 opc1
, opc1
, handler
->oname
);
8785 static bool avr_need_swap(CPUPPCState
*env
)
8787 #ifdef HOST_WORDS_BIGENDIAN
8794 static int gdb_get_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8797 stfq_p(mem_buf
, env
->fpr
[n
]);
8798 ppc_maybe_bswap_register(env
, mem_buf
, 8);
8802 stl_p(mem_buf
, env
->fpscr
);
8803 ppc_maybe_bswap_register(env
, mem_buf
, 4);
8809 static int gdb_set_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8812 ppc_maybe_bswap_register(env
, mem_buf
, 8);
8813 env
->fpr
[n
] = ldfq_p(mem_buf
);
8817 ppc_maybe_bswap_register(env
, mem_buf
, 4);
8818 helper_store_fpscr(env
, ldl_p(mem_buf
), 0xffffffff);
8824 static int gdb_get_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8827 if (!avr_need_swap(env
)) {
8828 stq_p(mem_buf
, env
->avr
[n
].u64
[0]);
8829 stq_p(mem_buf
+8, env
->avr
[n
].u64
[1]);
8831 stq_p(mem_buf
, env
->avr
[n
].u64
[1]);
8832 stq_p(mem_buf
+8, env
->avr
[n
].u64
[0]);
8834 ppc_maybe_bswap_register(env
, mem_buf
, 8);
8835 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
8839 stl_p(mem_buf
, env
->vscr
);
8840 ppc_maybe_bswap_register(env
, mem_buf
, 4);
8844 stl_p(mem_buf
, (uint32_t)env
->spr
[SPR_VRSAVE
]);
8845 ppc_maybe_bswap_register(env
, mem_buf
, 4);
8851 static int gdb_set_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8854 ppc_maybe_bswap_register(env
, mem_buf
, 8);
8855 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
8856 if (!avr_need_swap(env
)) {
8857 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
);
8858 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
+8);
8860 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
);
8861 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
+8);
8866 ppc_maybe_bswap_register(env
, mem_buf
, 4);
8867 env
->vscr
= ldl_p(mem_buf
);
8871 ppc_maybe_bswap_register(env
, mem_buf
, 4);
8872 env
->spr
[SPR_VRSAVE
] = (target_ulong
)ldl_p(mem_buf
);
8878 static int gdb_get_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8881 #if defined(TARGET_PPC64)
8882 stl_p(mem_buf
, env
->gpr
[n
] >> 32);
8883 ppc_maybe_bswap_register(env
, mem_buf
, 4);
8885 stl_p(mem_buf
, env
->gprh
[n
]);
8890 stq_p(mem_buf
, env
->spe_acc
);
8891 ppc_maybe_bswap_register(env
, mem_buf
, 8);
8895 stl_p(mem_buf
, env
->spe_fscr
);
8896 ppc_maybe_bswap_register(env
, mem_buf
, 4);
8902 static int gdb_set_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8905 #if defined(TARGET_PPC64)
8906 target_ulong lo
= (uint32_t)env
->gpr
[n
];
8909 ppc_maybe_bswap_register(env
, mem_buf
, 4);
8911 hi
= (target_ulong
)ldl_p(mem_buf
) << 32;
8912 env
->gpr
[n
] = lo
| hi
;
8914 env
->gprh
[n
] = ldl_p(mem_buf
);
8919 ppc_maybe_bswap_register(env
, mem_buf
, 8);
8920 env
->spe_acc
= ldq_p(mem_buf
);
8924 ppc_maybe_bswap_register(env
, mem_buf
, 4);
8925 env
->spe_fscr
= ldl_p(mem_buf
);
8931 static int gdb_get_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8934 stq_p(mem_buf
, env
->vsr
[n
]);
8935 ppc_maybe_bswap_register(env
, mem_buf
, 8);
8941 static int gdb_set_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8944 ppc_maybe_bswap_register(env
, mem_buf
, 8);
8945 env
->vsr
[n
] = ldq_p(mem_buf
);
8951 static int ppc_fixup_cpu(PowerPCCPU
*cpu
)
8953 CPUPPCState
*env
= &cpu
->env
;
8955 /* TCG doesn't (yet) emulate some groups of instructions that
8956 * are implemented on some otherwise supported CPUs (e.g. VSX
8957 * and decimal floating point instructions on POWER7). We
8958 * remove unsupported instruction groups from the cpu state's
8959 * instruction masks and hope the guest can cope. For at
8960 * least the pseries machine, the unavailability of these
8961 * instructions can be advertised to the guest via the device
8963 if ((env
->insns_flags
& ~PPC_TCG_INSNS
)
8964 || (env
->insns_flags2
& ~PPC_TCG_INSNS2
)) {
8965 fprintf(stderr
, "Warning: Disabling some instructions which are not "
8966 "emulated by TCG (0x%" PRIx64
", 0x%" PRIx64
")\n",
8967 env
->insns_flags
& ~PPC_TCG_INSNS
,
8968 env
->insns_flags2
& ~PPC_TCG_INSNS2
);
8970 env
->insns_flags
&= PPC_TCG_INSNS
;
8971 env
->insns_flags2
&= PPC_TCG_INSNS2
;
8975 static inline bool ppc_cpu_is_valid(PowerPCCPUClass
*pcc
)
8977 #ifdef TARGET_PPCEMB
8978 return pcc
->mmu_model
== POWERPC_MMU_BOOKE
||
8979 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx
||
8980 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx_Z
;
8986 static void ppc_cpu_realizefn(DeviceState
*dev
, Error
**errp
)
8988 CPUState
*cs
= CPU(dev
);
8989 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
8990 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8991 Error
*local_err
= NULL
;
8992 #if !defined(CONFIG_USER_ONLY)
8993 int max_smt
= kvm_enabled() ? kvmppc_smt_threads() : 1;
8996 #if !defined(CONFIG_USER_ONLY)
8997 if (smp_threads
> max_smt
) {
8998 error_setg(errp
, "Cannot support more than %d threads on PPC with %s",
8999 max_smt
, kvm_enabled() ? "KVM" : "TCG");
9002 if (!is_power_of_2(smp_threads
)) {
9003 error_setg(errp
, "Cannot support %d threads on PPC with %s, "
9004 "threads count must be a power of 2.",
9005 smp_threads
, kvm_enabled() ? "KVM" : "TCG");
9010 cpu_exec_init(cs
, &local_err
);
9011 if (local_err
!= NULL
) {
9012 error_propagate(errp
, local_err
);
9016 #if !defined(CONFIG_USER_ONLY)
9017 cpu
->cpu_dt_id
= (cs
->cpu_index
/ smp_threads
) * max_smt
9018 + (cs
->cpu_index
% smp_threads
);
9021 if (tcg_enabled()) {
9022 if (ppc_fixup_cpu(cpu
) != 0) {
9023 error_setg(errp
, "Unable to emulate selected CPU with TCG");
9028 #if defined(TARGET_PPCEMB)
9029 if (!ppc_cpu_is_valid(pcc
)) {
9030 error_setg(errp
, "CPU does not possess a BookE or 4xx MMU. "
9031 "Please use qemu-system-ppc or qemu-system-ppc64 instead "
9032 "or choose another CPU model.");
9037 create_ppc_opcodes(cpu
, &local_err
);
9038 if (local_err
!= NULL
) {
9039 error_propagate(errp
, local_err
);
9044 if (pcc
->insns_flags
& PPC_FLOAT
) {
9045 gdb_register_coprocessor(cs
, gdb_get_float_reg
, gdb_set_float_reg
,
9046 33, "power-fpu.xml", 0);
9048 if (pcc
->insns_flags
& PPC_ALTIVEC
) {
9049 gdb_register_coprocessor(cs
, gdb_get_avr_reg
, gdb_set_avr_reg
,
9050 34, "power-altivec.xml", 0);
9052 if (pcc
->insns_flags
& PPC_SPE
) {
9053 gdb_register_coprocessor(cs
, gdb_get_spe_reg
, gdb_set_spe_reg
,
9054 34, "power-spe.xml", 0);
9056 if (pcc
->insns_flags2
& PPC2_VSX
) {
9057 gdb_register_coprocessor(cs
, gdb_get_vsx_reg
, gdb_set_vsx_reg
,
9058 32, "power-vsx.xml", 0);
9063 pcc
->parent_realize(dev
, errp
);
9065 #if defined(PPC_DUMP_CPU)
9067 CPUPPCState
*env
= &cpu
->env
;
9068 const char *mmu_model
, *excp_model
, *bus_model
;
9069 switch (env
->mmu_model
) {
9070 case POWERPC_MMU_32B
:
9071 mmu_model
= "PowerPC 32";
9073 case POWERPC_MMU_SOFT_6xx
:
9074 mmu_model
= "PowerPC 6xx/7xx with software driven TLBs";
9076 case POWERPC_MMU_SOFT_74xx
:
9077 mmu_model
= "PowerPC 74xx with software driven TLBs";
9079 case POWERPC_MMU_SOFT_4xx
:
9080 mmu_model
= "PowerPC 4xx with software driven TLBs";
9082 case POWERPC_MMU_SOFT_4xx_Z
:
9083 mmu_model
= "PowerPC 4xx with software driven TLBs "
9084 "and zones protections";
9086 case POWERPC_MMU_REAL
:
9087 mmu_model
= "PowerPC real mode only";
9089 case POWERPC_MMU_MPC8xx
:
9090 mmu_model
= "PowerPC MPC8xx";
9092 case POWERPC_MMU_BOOKE
:
9093 mmu_model
= "PowerPC BookE";
9095 case POWERPC_MMU_BOOKE206
:
9096 mmu_model
= "PowerPC BookE 2.06";
9098 case POWERPC_MMU_601
:
9099 mmu_model
= "PowerPC 601";
9101 #if defined (TARGET_PPC64)
9102 case POWERPC_MMU_64B
:
9103 mmu_model
= "PowerPC 64";
9107 mmu_model
= "Unknown or invalid";
9110 switch (env
->excp_model
) {
9111 case POWERPC_EXCP_STD
:
9112 excp_model
= "PowerPC";
9114 case POWERPC_EXCP_40x
:
9115 excp_model
= "PowerPC 40x";
9117 case POWERPC_EXCP_601
:
9118 excp_model
= "PowerPC 601";
9120 case POWERPC_EXCP_602
:
9121 excp_model
= "PowerPC 602";
9123 case POWERPC_EXCP_603
:
9124 excp_model
= "PowerPC 603";
9126 case POWERPC_EXCP_603E
:
9127 excp_model
= "PowerPC 603e";
9129 case POWERPC_EXCP_604
:
9130 excp_model
= "PowerPC 604";
9132 case POWERPC_EXCP_7x0
:
9133 excp_model
= "PowerPC 740/750";
9135 case POWERPC_EXCP_7x5
:
9136 excp_model
= "PowerPC 745/755";
9138 case POWERPC_EXCP_74xx
:
9139 excp_model
= "PowerPC 74xx";
9141 case POWERPC_EXCP_BOOKE
:
9142 excp_model
= "PowerPC BookE";
9144 #if defined (TARGET_PPC64)
9145 case POWERPC_EXCP_970
:
9146 excp_model
= "PowerPC 970";
9150 excp_model
= "Unknown or invalid";
9153 switch (env
->bus_model
) {
9154 case PPC_FLAGS_INPUT_6xx
:
9155 bus_model
= "PowerPC 6xx";
9157 case PPC_FLAGS_INPUT_BookE
:
9158 bus_model
= "PowerPC BookE";
9160 case PPC_FLAGS_INPUT_405
:
9161 bus_model
= "PowerPC 405";
9163 case PPC_FLAGS_INPUT_401
:
9164 bus_model
= "PowerPC 401/403";
9166 case PPC_FLAGS_INPUT_RCPU
:
9167 bus_model
= "RCPU / MPC8xx";
9169 #if defined (TARGET_PPC64)
9170 case PPC_FLAGS_INPUT_970
:
9171 bus_model
= "PowerPC 970";
9175 bus_model
= "Unknown or invalid";
9178 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64
"\n"
9179 " MMU model : %s\n",
9180 object_class_get_name(OBJECT_CLASS(pcc
)),
9181 pcc
->pvr
, pcc
->msr_mask
, mmu_model
);
9182 #if !defined(CONFIG_USER_ONLY)
9183 if (env
->tlb
.tlb6
) {
9184 printf(" %d %s TLB in %d ways\n",
9185 env
->nb_tlb
, env
->id_tlbs
? "splitted" : "merged",
9189 printf(" Exceptions model : %s\n"
9190 " Bus model : %s\n",
9191 excp_model
, bus_model
);
9192 printf(" MSR features :\n");
9193 if (env
->flags
& POWERPC_FLAG_SPE
)
9194 printf(" signal processing engine enable"
9196 else if (env
->flags
& POWERPC_FLAG_VRE
)
9197 printf(" vector processor enable\n");
9198 if (env
->flags
& POWERPC_FLAG_TGPR
)
9199 printf(" temporary GPRs\n");
9200 else if (env
->flags
& POWERPC_FLAG_CE
)
9201 printf(" critical input enable\n");
9202 if (env
->flags
& POWERPC_FLAG_SE
)
9203 printf(" single-step trace mode\n");
9204 else if (env
->flags
& POWERPC_FLAG_DWE
)
9205 printf(" debug wait enable\n");
9206 else if (env
->flags
& POWERPC_FLAG_UBLE
)
9207 printf(" user BTB lock enable\n");
9208 if (env
->flags
& POWERPC_FLAG_BE
)
9209 printf(" branch-step trace mode\n");
9210 else if (env
->flags
& POWERPC_FLAG_DE
)
9211 printf(" debug interrupt enable\n");
9212 if (env
->flags
& POWERPC_FLAG_PX
)
9213 printf(" inclusive protection\n");
9214 else if (env
->flags
& POWERPC_FLAG_PMM
)
9215 printf(" performance monitor mark\n");
9216 if (env
->flags
== POWERPC_FLAG_NONE
)
9218 printf(" Time-base/decrementer clock source: %s\n",
9219 env
->flags
& POWERPC_FLAG_RTC_CLK
? "RTC clock" : "bus clock");
9220 dump_ppc_insns(env
);
9227 static void ppc_cpu_unrealizefn(DeviceState
*dev
, Error
**errp
)
9229 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
9230 CPUPPCState
*env
= &cpu
->env
;
9231 opc_handler_t
**table
;
9234 cpu_exec_exit(CPU(dev
));
9236 for (i
= 0; i
< PPC_CPU_OPCODES_LEN
; i
++) {
9237 if (env
->opcodes
[i
] == &invalid_handler
) {
9240 if (is_indirect_opcode(env
->opcodes
[i
])) {
9241 table
= ind_table(env
->opcodes
[i
]);
9242 for (j
= 0; j
< PPC_CPU_INDIRECT_OPCODES_LEN
; j
++) {
9243 if (table
[j
] != &invalid_handler
&&
9244 is_indirect_opcode(table
[j
])) {
9245 g_free((opc_handler_t
*)((uintptr_t)table
[j
] &
9249 g_free((opc_handler_t
*)((uintptr_t)env
->opcodes
[i
] &
9255 int ppc_get_compat_smt_threads(PowerPCCPU
*cpu
)
9257 int ret
= MIN(smp_threads
, kvmppc_smt_threads());
9259 switch (cpu
->cpu_version
) {
9260 case CPU_POWERPC_LOGICAL_2_05
:
9263 case CPU_POWERPC_LOGICAL_2_06
:
9266 case CPU_POWERPC_LOGICAL_2_07
:
9274 void ppc_set_compat(PowerPCCPU
*cpu
, uint32_t cpu_version
, Error
**errp
)
9277 CPUPPCState
*env
= &cpu
->env
;
9279 cpu
->cpu_version
= cpu_version
;
9281 switch (cpu_version
) {
9282 case CPU_POWERPC_LOGICAL_2_05
:
9283 env
->spr
[SPR_PCR
] = PCR_COMPAT_2_05
;
9285 case CPU_POWERPC_LOGICAL_2_06
:
9286 env
->spr
[SPR_PCR
] = PCR_COMPAT_2_06
;
9288 case CPU_POWERPC_LOGICAL_2_06_PLUS
:
9289 env
->spr
[SPR_PCR
] = PCR_COMPAT_2_06
;
9292 env
->spr
[SPR_PCR
] = 0;
9296 if (kvm_enabled()) {
9297 ret
= kvmppc_set_compat(cpu
, cpu
->cpu_version
);
9299 error_setg_errno(errp
, -ret
,
9300 "Unable to set CPU compatibility mode in KVM");
9305 static gint
ppc_cpu_compare_class_pvr(gconstpointer a
, gconstpointer b
)
9307 ObjectClass
*oc
= (ObjectClass
*)a
;
9308 uint32_t pvr
= *(uint32_t *)b
;
9309 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
9311 /* -cpu host does a PVR lookup during construction */
9312 if (unlikely(strcmp(object_class_get_name(oc
),
9313 TYPE_HOST_POWERPC_CPU
) == 0)) {
9317 if (!ppc_cpu_is_valid(pcc
)) {
9321 return pcc
->pvr
== pvr
? 0 : -1;
9324 PowerPCCPUClass
*ppc_cpu_class_by_pvr(uint32_t pvr
)
9326 GSList
*list
, *item
;
9327 PowerPCCPUClass
*pcc
= NULL
;
9329 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9330 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr
);
9332 pcc
= POWERPC_CPU_CLASS(item
->data
);
9339 static gint
ppc_cpu_compare_class_pvr_mask(gconstpointer a
, gconstpointer b
)
9341 ObjectClass
*oc
= (ObjectClass
*)a
;
9342 uint32_t pvr
= *(uint32_t *)b
;
9343 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
9345 /* -cpu host does a PVR lookup during construction */
9346 if (unlikely(strcmp(object_class_get_name(oc
),
9347 TYPE_HOST_POWERPC_CPU
) == 0)) {
9351 if (!ppc_cpu_is_valid(pcc
)) {
9355 if (pcc
->pvr_match(pcc
, pvr
)) {
9362 PowerPCCPUClass
*ppc_cpu_class_by_pvr_mask(uint32_t pvr
)
9364 GSList
*list
, *item
;
9365 PowerPCCPUClass
*pcc
= NULL
;
9367 list
= object_class_get_list(TYPE_POWERPC_CPU
, true);
9368 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr_mask
);
9370 pcc
= POWERPC_CPU_CLASS(item
->data
);
9377 static gint
ppc_cpu_compare_class_name(gconstpointer a
, gconstpointer b
)
9379 ObjectClass
*oc
= (ObjectClass
*)a
;
9380 const char *name
= b
;
9381 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9383 if (strncasecmp(name
, object_class_get_name(oc
), strlen(name
)) == 0 &&
9384 ppc_cpu_is_valid(pcc
) &&
9385 strcmp(object_class_get_name(oc
) + strlen(name
),
9386 "-" TYPE_POWERPC_CPU
) == 0) {
9393 static ObjectClass
*ppc_cpu_class_by_name(const char *name
);
9395 static ObjectClass
*ppc_cpu_class_by_alias(PowerPCCPUAlias
*alias
)
9397 ObjectClass
*invalid_class
= (void*)ppc_cpu_class_by_alias
;
9399 /* Cache target class lookups in the alias table */
9401 alias
->oc
= ppc_cpu_class_by_name(alias
->model
);
9403 /* Fast check for non-existing aliases */
9404 alias
->oc
= invalid_class
;
9408 if (alias
->oc
== invalid_class
) {
9415 static ObjectClass
*ppc_cpu_class_by_name(const char *name
)
9417 GSList
*list
, *item
;
9418 ObjectClass
*ret
= NULL
;
9422 /* Check if the given name is a PVR */
9424 if (len
== 10 && name
[0] == '0' && name
[1] == 'x') {
9427 } else if (len
== 8) {
9430 for (i
= 0; i
< 8; i
++) {
9431 if (!qemu_isxdigit(*p
++))
9435 return OBJECT_CLASS(ppc_cpu_class_by_pvr(strtoul(name
, NULL
, 16)));
9439 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9440 item
= g_slist_find_custom(list
, name
, ppc_cpu_compare_class_name
);
9442 ret
= OBJECT_CLASS(item
->data
);
9450 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9451 if (strcmp(ppc_cpu_aliases
[i
].alias
, name
) == 0) {
9452 return ppc_cpu_class_by_alias(&ppc_cpu_aliases
[i
]);
9459 PowerPCCPU
*cpu_ppc_init(const char *cpu_model
)
9461 return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU
, cpu_model
));
9464 /* Sort by PVR, ordering special case "host" last. */
9465 static gint
ppc_cpu_list_compare(gconstpointer a
, gconstpointer b
)
9467 ObjectClass
*oc_a
= (ObjectClass
*)a
;
9468 ObjectClass
*oc_b
= (ObjectClass
*)b
;
9469 PowerPCCPUClass
*pcc_a
= POWERPC_CPU_CLASS(oc_a
);
9470 PowerPCCPUClass
*pcc_b
= POWERPC_CPU_CLASS(oc_b
);
9471 const char *name_a
= object_class_get_name(oc_a
);
9472 const char *name_b
= object_class_get_name(oc_b
);
9474 if (strcmp(name_a
, TYPE_HOST_POWERPC_CPU
) == 0) {
9476 } else if (strcmp(name_b
, TYPE_HOST_POWERPC_CPU
) == 0) {
9479 /* Avoid an integer overflow during subtraction */
9480 if (pcc_a
->pvr
< pcc_b
->pvr
) {
9482 } else if (pcc_a
->pvr
> pcc_b
->pvr
) {
9490 static void ppc_cpu_list_entry(gpointer data
, gpointer user_data
)
9492 ObjectClass
*oc
= data
;
9493 CPUListState
*s
= user_data
;
9494 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9495 const char *typename
= object_class_get_name(oc
);
9499 if (!ppc_cpu_is_valid(pcc
)) {
9502 if (unlikely(strcmp(typename
, TYPE_HOST_POWERPC_CPU
) == 0)) {
9506 name
= g_strndup(typename
,
9507 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
9508 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s PVR %08x\n",
9510 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9511 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
9512 ObjectClass
*alias_oc
= ppc_cpu_class_by_alias(alias
);
9514 if (alias_oc
!= oc
) {
9517 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s (alias for %s)\n",
9518 alias
->alias
, name
);
9523 void ppc_cpu_list(FILE *f
, fprintf_function cpu_fprintf
)
9527 .cpu_fprintf
= cpu_fprintf
,
9531 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9532 list
= g_slist_sort(list
, ppc_cpu_list_compare
);
9533 g_slist_foreach(list
, ppc_cpu_list_entry
, &s
);
9537 cpu_fprintf(f
, "\n");
9538 cpu_fprintf(f
, "PowerPC %-16s\n", "host");
9542 static void ppc_cpu_defs_entry(gpointer data
, gpointer user_data
)
9544 ObjectClass
*oc
= data
;
9545 CpuDefinitionInfoList
**first
= user_data
;
9546 const char *typename
;
9547 CpuDefinitionInfoList
*entry
;
9548 CpuDefinitionInfo
*info
;
9549 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9551 if (!ppc_cpu_is_valid(pcc
)) {
9555 typename
= object_class_get_name(oc
);
9556 info
= g_malloc0(sizeof(*info
));
9557 info
->name
= g_strndup(typename
,
9558 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
9560 entry
= g_malloc0(sizeof(*entry
));
9561 entry
->value
= info
;
9562 entry
->next
= *first
;
9566 CpuDefinitionInfoList
*arch_query_cpu_definitions(Error
**errp
)
9568 CpuDefinitionInfoList
*cpu_list
= NULL
;
9572 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9573 g_slist_foreach(list
, ppc_cpu_defs_entry
, &cpu_list
);
9576 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9577 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
9579 CpuDefinitionInfoList
*entry
;
9580 CpuDefinitionInfo
*info
;
9582 oc
= ppc_cpu_class_by_alias(alias
);
9587 info
= g_malloc0(sizeof(*info
));
9588 info
->name
= g_strdup(alias
->alias
);
9590 entry
= g_malloc0(sizeof(*entry
));
9591 entry
->value
= info
;
9592 entry
->next
= cpu_list
;
9599 static void ppc_cpu_set_pc(CPUState
*cs
, vaddr value
)
9601 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9603 cpu
->env
.nip
= value
;
9606 static bool ppc_cpu_has_work(CPUState
*cs
)
9608 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9609 CPUPPCState
*env
= &cpu
->env
;
9611 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
9614 static void ppc_cpu_exec_enter(CPUState
*cs
)
9616 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9617 CPUPPCState
*env
= &cpu
->env
;
9619 env
->reserve_addr
= -1;
9622 /* CPUClass::reset() */
9623 static void ppc_cpu_reset(CPUState
*s
)
9625 PowerPCCPU
*cpu
= POWERPC_CPU(s
);
9626 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9627 CPUPPCState
*env
= &cpu
->env
;
9631 pcc
->parent_reset(s
);
9633 msr
= (target_ulong
)0;
9635 /* XXX: find a suitable condition to enable the hypervisor mode */
9636 msr
|= (target_ulong
)MSR_HVB
;
9638 msr
|= (target_ulong
)0 << MSR_AP
; /* TO BE CHECKED */
9639 msr
|= (target_ulong
)0 << MSR_SA
; /* TO BE CHECKED */
9640 msr
|= (target_ulong
)1 << MSR_EP
;
9641 #if defined(DO_SINGLE_STEP) && 0
9642 /* Single step trace mode */
9643 msr
|= (target_ulong
)1 << MSR_SE
;
9644 msr
|= (target_ulong
)1 << MSR_BE
;
9646 #if defined(CONFIG_USER_ONLY)
9647 msr
|= (target_ulong
)1 << MSR_FP
; /* Allow floating point usage */
9648 msr
|= (target_ulong
)1 << MSR_VR
; /* Allow altivec usage */
9649 msr
|= (target_ulong
)1 << MSR_VSX
; /* Allow VSX usage */
9650 msr
|= (target_ulong
)1 << MSR_SPE
; /* Allow SPE usage */
9651 msr
|= (target_ulong
)1 << MSR_PR
;
9652 #if defined(TARGET_PPC64)
9653 msr
|= (target_ulong
)1 << MSR_TM
; /* Transactional memory */
9655 #if !defined(TARGET_WORDS_BIGENDIAN)
9656 msr
|= (target_ulong
)1 << MSR_LE
; /* Little-endian user mode */
9657 if (!((env
->msr_mask
>> MSR_LE
) & 1)) {
9658 fprintf(stderr
, "Selected CPU does not support little-endian.\n");
9664 #if defined(TARGET_PPC64)
9665 if (env
->mmu_model
& POWERPC_MMU_64
) {
9666 env
->msr
|= (1ULL << MSR_SF
);
9670 hreg_store_msr(env
, msr
, 1);
9672 #if !defined(CONFIG_USER_ONLY)
9673 env
->nip
= env
->hreset_vector
| env
->excp_prefix
;
9674 if (env
->mmu_model
!= POWERPC_MMU_REAL
) {
9675 ppc_tlb_invalidate_all(env
);
9679 hreg_compute_hflags(env
);
9680 env
->reserve_addr
= (target_ulong
)-1ULL;
9681 /* Be sure no exception or interrupt is pending */
9682 env
->pending_interrupts
= 0;
9683 s
->exception_index
= POWERPC_EXCP_NONE
;
9684 env
->error_code
= 0;
9686 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
9688 env
->slb_shadow_addr
= 0;
9689 env
->slb_shadow_size
= 0;
9692 #endif /* TARGET_PPC64 */
9694 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
9695 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
9700 env
->spr
[i
] = spr
->default_value
;
9703 /* Flush all TLBs */
9707 #ifndef CONFIG_USER_ONLY
9708 static bool ppc_cpu_is_big_endian(CPUState
*cs
)
9710 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9711 CPUPPCState
*env
= &cpu
->env
;
9713 cpu_synchronize_state(cs
);
9719 static void ppc_cpu_initfn(Object
*obj
)
9721 CPUState
*cs
= CPU(obj
);
9722 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
9723 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9724 CPUPPCState
*env
= &cpu
->env
;
9728 env
->msr_mask
= pcc
->msr_mask
;
9729 env
->mmu_model
= pcc
->mmu_model
;
9730 env
->excp_model
= pcc
->excp_model
;
9731 env
->bus_model
= pcc
->bus_model
;
9732 env
->insns_flags
= pcc
->insns_flags
;
9733 env
->insns_flags2
= pcc
->insns_flags2
;
9734 env
->flags
= pcc
->flags
;
9735 env
->bfd_mach
= pcc
->bfd_mach
;
9736 env
->check_pow
= pcc
->check_pow
;
9738 #if defined(TARGET_PPC64)
9740 env
->sps
= *pcc
->sps
;
9741 } else if (env
->mmu_model
& POWERPC_MMU_64
) {
9742 /* Use default sets of page sizes */
9743 static const struct ppc_segment_page_sizes defsps
= {
9745 { .page_shift
= 12, /* 4K */
9747 .enc
= { { .page_shift
= 12, .pte_enc
= 0 } }
9749 { .page_shift
= 24, /* 16M */
9751 .enc
= { { .page_shift
= 24, .pte_enc
= 0 } }
9757 #endif /* defined(TARGET_PPC64) */
9759 if (tcg_enabled()) {
9760 ppc_translate_init();
9764 static bool ppc_pvr_match_default(PowerPCCPUClass
*pcc
, uint32_t pvr
)
9766 return pcc
->pvr
== pvr
;
9769 static gchar
*ppc_gdb_arch_name(CPUState
*cs
)
9771 #if defined(TARGET_PPC64)
9772 return g_strdup("powerpc:common64");
9774 return g_strdup("powerpc:common");
9778 static void ppc_cpu_class_init(ObjectClass
*oc
, void *data
)
9780 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9781 CPUClass
*cc
= CPU_CLASS(oc
);
9782 DeviceClass
*dc
= DEVICE_CLASS(oc
);
9784 pcc
->parent_realize
= dc
->realize
;
9785 pcc
->pvr_match
= ppc_pvr_match_default
;
9786 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_always
;
9787 dc
->realize
= ppc_cpu_realizefn
;
9788 dc
->unrealize
= ppc_cpu_unrealizefn
;
9790 pcc
->parent_reset
= cc
->reset
;
9791 cc
->reset
= ppc_cpu_reset
;
9793 cc
->class_by_name
= ppc_cpu_class_by_name
;
9794 cc
->has_work
= ppc_cpu_has_work
;
9795 cc
->do_interrupt
= ppc_cpu_do_interrupt
;
9796 cc
->cpu_exec_interrupt
= ppc_cpu_exec_interrupt
;
9797 cc
->dump_state
= ppc_cpu_dump_state
;
9798 cc
->dump_statistics
= ppc_cpu_dump_statistics
;
9799 cc
->set_pc
= ppc_cpu_set_pc
;
9800 cc
->gdb_read_register
= ppc_cpu_gdb_read_register
;
9801 cc
->gdb_write_register
= ppc_cpu_gdb_write_register
;
9802 #ifdef CONFIG_USER_ONLY
9803 cc
->handle_mmu_fault
= ppc_cpu_handle_mmu_fault
;
9805 cc
->get_phys_page_debug
= ppc_cpu_get_phys_page_debug
;
9806 cc
->vmsd
= &vmstate_ppc_cpu
;
9807 #if defined(TARGET_PPC64)
9808 cc
->write_elf64_note
= ppc64_cpu_write_elf64_note
;
9811 cc
->cpu_exec_enter
= ppc_cpu_exec_enter
;
9813 cc
->gdb_num_core_regs
= 71;
9815 #ifdef USE_APPLE_GDB
9816 cc
->gdb_read_register
= ppc_cpu_gdb_read_register_apple
;
9817 cc
->gdb_write_register
= ppc_cpu_gdb_write_register_apple
;
9818 cc
->gdb_num_core_regs
= 71 + 32;
9821 cc
->gdb_arch_name
= ppc_gdb_arch_name
;
9822 #if defined(TARGET_PPC64)
9823 cc
->gdb_core_xml_file
= "power64-core.xml";
9825 cc
->gdb_core_xml_file
= "power-core.xml";
9827 #ifndef CONFIG_USER_ONLY
9828 cc
->virtio_is_big_endian
= ppc_cpu_is_big_endian
;
9831 dc
->fw_name
= "PowerPC,UNKNOWN";
9834 static const TypeInfo ppc_cpu_type_info
= {
9835 .name
= TYPE_POWERPC_CPU
,
9837 .instance_size
= sizeof(PowerPCCPU
),
9838 .instance_init
= ppc_cpu_initfn
,
9840 .class_size
= sizeof(PowerPCCPUClass
),
9841 .class_init
= ppc_cpu_class_init
,
9844 static void ppc_cpu_register_types(void)
9846 type_register_static(&ppc_cpu_type_info
);
9849 type_init(ppc_cpu_register_types
)