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)
582 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
583 oea_read, oea_write, hea_read, hea_write, \
584 one_reg_id, initial_value) \
585 _spr_register(env, num, name, uea_read, uea_write, initial_value)
587 #if !defined(CONFIG_KVM)
588 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
589 oea_read, oea_write, one_reg_id, initial_value) \
590 _spr_register(env, num, name, uea_read, uea_write, \
591 oea_read, oea_write, oea_read, oea_write, initial_value)
592 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
593 oea_read, oea_write, hea_read, hea_write, \
594 one_reg_id, initial_value) \
595 _spr_register(env, num, name, uea_read, uea_write, \
596 oea_read, oea_write, hea_read, hea_write, initial_value)
598 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
599 oea_read, oea_write, one_reg_id, initial_value) \
600 _spr_register(env, num, name, uea_read, uea_write, \
601 oea_read, oea_write, oea_read, oea_write, \
602 one_reg_id, initial_value)
603 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
604 oea_read, oea_write, hea_read, hea_write, \
605 one_reg_id, initial_value) \
606 _spr_register(env, num, name, uea_read, uea_write, \
607 oea_read, oea_write, hea_read, hea_write, \
608 one_reg_id, initial_value)
612 #define spr_register(env, num, name, uea_read, uea_write, \
613 oea_read, oea_write, initial_value) \
614 spr_register_kvm(env, num, name, uea_read, uea_write, \
615 oea_read, oea_write, 0, initial_value)
617 #define spr_register_hv(env, num, name, uea_read, uea_write, \
618 oea_read, oea_write, hea_read, hea_write, \
620 spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
621 oea_read, oea_write, hea_read, hea_write, \
624 static inline void _spr_register(CPUPPCState
*env
, int num
,
626 void (*uea_read
)(DisasContext
*ctx
, int gprn
, int sprn
),
627 void (*uea_write
)(DisasContext
*ctx
, int sprn
, int gprn
),
628 #if !defined(CONFIG_USER_ONLY)
630 void (*oea_read
)(DisasContext
*ctx
, int gprn
, int sprn
),
631 void (*oea_write
)(DisasContext
*ctx
, int sprn
, int gprn
),
632 void (*hea_read
)(DisasContext
*opaque
, int gprn
, int sprn
),
633 void (*hea_write
)(DisasContext
*opaque
, int sprn
, int gprn
),
635 #if defined(CONFIG_KVM)
638 target_ulong initial_value
)
642 spr
= &env
->spr_cb
[num
];
643 if (spr
->name
!= NULL
||env
-> spr
[num
] != 0x00000000 ||
644 #if !defined(CONFIG_USER_ONLY)
645 spr
->oea_read
!= NULL
|| spr
->oea_write
!= NULL
||
647 spr
->uea_read
!= NULL
|| spr
->uea_write
!= NULL
) {
648 printf("Error: Trying to register SPR %d (%03x) twice !\n", num
, num
);
651 #if defined(PPC_DEBUG_SPR)
652 printf("*** register spr %d (%03x) %s val " TARGET_FMT_lx
"\n", num
, num
,
653 name
, initial_value
);
656 spr
->uea_read
= uea_read
;
657 spr
->uea_write
= uea_write
;
658 #if !defined(CONFIG_USER_ONLY)
659 spr
->oea_read
= oea_read
;
660 spr
->oea_write
= oea_write
;
661 spr
->hea_read
= hea_read
;
662 spr
->hea_write
= hea_write
;
664 #if defined(CONFIG_KVM)
665 spr
->one_reg_id
= one_reg_id
,
667 env
->spr
[num
] = spr
->default_value
= initial_value
;
670 /* Generic PowerPC SPRs */
671 static void gen_spr_generic (CPUPPCState
*env
)
673 /* Integer processing */
674 spr_register(env
, SPR_XER
, "XER",
675 &spr_read_xer
, &spr_write_xer
,
676 &spr_read_xer
, &spr_write_xer
,
679 spr_register(env
, SPR_LR
, "LR",
680 &spr_read_lr
, &spr_write_lr
,
681 &spr_read_lr
, &spr_write_lr
,
683 spr_register(env
, SPR_CTR
, "CTR",
684 &spr_read_ctr
, &spr_write_ctr
,
685 &spr_read_ctr
, &spr_write_ctr
,
687 /* Interrupt processing */
688 spr_register(env
, SPR_SRR0
, "SRR0",
689 SPR_NOACCESS
, SPR_NOACCESS
,
690 &spr_read_generic
, &spr_write_generic
,
692 spr_register(env
, SPR_SRR1
, "SRR1",
693 SPR_NOACCESS
, SPR_NOACCESS
,
694 &spr_read_generic
, &spr_write_generic
,
696 /* Processor control */
697 spr_register(env
, SPR_SPRG0
, "SPRG0",
698 SPR_NOACCESS
, SPR_NOACCESS
,
699 &spr_read_generic
, &spr_write_generic
,
701 spr_register(env
, SPR_SPRG1
, "SPRG1",
702 SPR_NOACCESS
, SPR_NOACCESS
,
703 &spr_read_generic
, &spr_write_generic
,
705 spr_register(env
, SPR_SPRG2
, "SPRG2",
706 SPR_NOACCESS
, SPR_NOACCESS
,
707 &spr_read_generic
, &spr_write_generic
,
709 spr_register(env
, SPR_SPRG3
, "SPRG3",
710 SPR_NOACCESS
, SPR_NOACCESS
,
711 &spr_read_generic
, &spr_write_generic
,
715 /* SPR common to all non-embedded PowerPC, including 601 */
716 static void gen_spr_ne_601 (CPUPPCState
*env
)
718 /* Exception processing */
719 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
720 SPR_NOACCESS
, SPR_NOACCESS
,
721 &spr_read_generic
, &spr_write_generic
,
722 KVM_REG_PPC_DSISR
, 0x00000000);
723 spr_register_kvm(env
, SPR_DAR
, "DAR",
724 SPR_NOACCESS
, SPR_NOACCESS
,
725 &spr_read_generic
, &spr_write_generic
,
726 KVM_REG_PPC_DAR
, 0x00000000);
728 spr_register(env
, SPR_DECR
, "DECR",
729 SPR_NOACCESS
, SPR_NOACCESS
,
730 &spr_read_decr
, &spr_write_decr
,
732 /* Memory management */
733 spr_register(env
, SPR_SDR1
, "SDR1",
734 SPR_NOACCESS
, SPR_NOACCESS
,
735 &spr_read_generic
, &spr_write_sdr1
,
740 static void gen_low_BATs (CPUPPCState
*env
)
742 #if !defined(CONFIG_USER_ONLY)
743 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
744 SPR_NOACCESS
, SPR_NOACCESS
,
745 &spr_read_ibat
, &spr_write_ibatu
,
747 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
748 SPR_NOACCESS
, SPR_NOACCESS
,
749 &spr_read_ibat
, &spr_write_ibatl
,
751 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
752 SPR_NOACCESS
, SPR_NOACCESS
,
753 &spr_read_ibat
, &spr_write_ibatu
,
755 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
756 SPR_NOACCESS
, SPR_NOACCESS
,
757 &spr_read_ibat
, &spr_write_ibatl
,
759 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
760 SPR_NOACCESS
, SPR_NOACCESS
,
761 &spr_read_ibat
, &spr_write_ibatu
,
763 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
764 SPR_NOACCESS
, SPR_NOACCESS
,
765 &spr_read_ibat
, &spr_write_ibatl
,
767 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
768 SPR_NOACCESS
, SPR_NOACCESS
,
769 &spr_read_ibat
, &spr_write_ibatu
,
771 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
772 SPR_NOACCESS
, SPR_NOACCESS
,
773 &spr_read_ibat
, &spr_write_ibatl
,
775 spr_register(env
, SPR_DBAT0U
, "DBAT0U",
776 SPR_NOACCESS
, SPR_NOACCESS
,
777 &spr_read_dbat
, &spr_write_dbatu
,
779 spr_register(env
, SPR_DBAT0L
, "DBAT0L",
780 SPR_NOACCESS
, SPR_NOACCESS
,
781 &spr_read_dbat
, &spr_write_dbatl
,
783 spr_register(env
, SPR_DBAT1U
, "DBAT1U",
784 SPR_NOACCESS
, SPR_NOACCESS
,
785 &spr_read_dbat
, &spr_write_dbatu
,
787 spr_register(env
, SPR_DBAT1L
, "DBAT1L",
788 SPR_NOACCESS
, SPR_NOACCESS
,
789 &spr_read_dbat
, &spr_write_dbatl
,
791 spr_register(env
, SPR_DBAT2U
, "DBAT2U",
792 SPR_NOACCESS
, SPR_NOACCESS
,
793 &spr_read_dbat
, &spr_write_dbatu
,
795 spr_register(env
, SPR_DBAT2L
, "DBAT2L",
796 SPR_NOACCESS
, SPR_NOACCESS
,
797 &spr_read_dbat
, &spr_write_dbatl
,
799 spr_register(env
, SPR_DBAT3U
, "DBAT3U",
800 SPR_NOACCESS
, SPR_NOACCESS
,
801 &spr_read_dbat
, &spr_write_dbatu
,
803 spr_register(env
, SPR_DBAT3L
, "DBAT3L",
804 SPR_NOACCESS
, SPR_NOACCESS
,
805 &spr_read_dbat
, &spr_write_dbatl
,
812 static void gen_high_BATs (CPUPPCState
*env
)
814 #if !defined(CONFIG_USER_ONLY)
815 spr_register(env
, SPR_IBAT4U
, "IBAT4U",
816 SPR_NOACCESS
, SPR_NOACCESS
,
817 &spr_read_ibat_h
, &spr_write_ibatu_h
,
819 spr_register(env
, SPR_IBAT4L
, "IBAT4L",
820 SPR_NOACCESS
, SPR_NOACCESS
,
821 &spr_read_ibat_h
, &spr_write_ibatl_h
,
823 spr_register(env
, SPR_IBAT5U
, "IBAT5U",
824 SPR_NOACCESS
, SPR_NOACCESS
,
825 &spr_read_ibat_h
, &spr_write_ibatu_h
,
827 spr_register(env
, SPR_IBAT5L
, "IBAT5L",
828 SPR_NOACCESS
, SPR_NOACCESS
,
829 &spr_read_ibat_h
, &spr_write_ibatl_h
,
831 spr_register(env
, SPR_IBAT6U
, "IBAT6U",
832 SPR_NOACCESS
, SPR_NOACCESS
,
833 &spr_read_ibat_h
, &spr_write_ibatu_h
,
835 spr_register(env
, SPR_IBAT6L
, "IBAT6L",
836 SPR_NOACCESS
, SPR_NOACCESS
,
837 &spr_read_ibat_h
, &spr_write_ibatl_h
,
839 spr_register(env
, SPR_IBAT7U
, "IBAT7U",
840 SPR_NOACCESS
, SPR_NOACCESS
,
841 &spr_read_ibat_h
, &spr_write_ibatu_h
,
843 spr_register(env
, SPR_IBAT7L
, "IBAT7L",
844 SPR_NOACCESS
, SPR_NOACCESS
,
845 &spr_read_ibat_h
, &spr_write_ibatl_h
,
847 spr_register(env
, SPR_DBAT4U
, "DBAT4U",
848 SPR_NOACCESS
, SPR_NOACCESS
,
849 &spr_read_dbat_h
, &spr_write_dbatu_h
,
851 spr_register(env
, SPR_DBAT4L
, "DBAT4L",
852 SPR_NOACCESS
, SPR_NOACCESS
,
853 &spr_read_dbat_h
, &spr_write_dbatl_h
,
855 spr_register(env
, SPR_DBAT5U
, "DBAT5U",
856 SPR_NOACCESS
, SPR_NOACCESS
,
857 &spr_read_dbat_h
, &spr_write_dbatu_h
,
859 spr_register(env
, SPR_DBAT5L
, "DBAT5L",
860 SPR_NOACCESS
, SPR_NOACCESS
,
861 &spr_read_dbat_h
, &spr_write_dbatl_h
,
863 spr_register(env
, SPR_DBAT6U
, "DBAT6U",
864 SPR_NOACCESS
, SPR_NOACCESS
,
865 &spr_read_dbat_h
, &spr_write_dbatu_h
,
867 spr_register(env
, SPR_DBAT6L
, "DBAT6L",
868 SPR_NOACCESS
, SPR_NOACCESS
,
869 &spr_read_dbat_h
, &spr_write_dbatl_h
,
871 spr_register(env
, SPR_DBAT7U
, "DBAT7U",
872 SPR_NOACCESS
, SPR_NOACCESS
,
873 &spr_read_dbat_h
, &spr_write_dbatu_h
,
875 spr_register(env
, SPR_DBAT7L
, "DBAT7L",
876 SPR_NOACCESS
, SPR_NOACCESS
,
877 &spr_read_dbat_h
, &spr_write_dbatl_h
,
883 /* Generic PowerPC time base */
884 static void gen_tbl (CPUPPCState
*env
)
886 spr_register(env
, SPR_VTBL
, "TBL",
887 &spr_read_tbl
, SPR_NOACCESS
,
888 &spr_read_tbl
, SPR_NOACCESS
,
890 spr_register(env
, SPR_TBL
, "TBL",
891 &spr_read_tbl
, SPR_NOACCESS
,
892 &spr_read_tbl
, &spr_write_tbl
,
894 spr_register(env
, SPR_VTBU
, "TBU",
895 &spr_read_tbu
, SPR_NOACCESS
,
896 &spr_read_tbu
, SPR_NOACCESS
,
898 spr_register(env
, SPR_TBU
, "TBU",
899 &spr_read_tbu
, SPR_NOACCESS
,
900 &spr_read_tbu
, &spr_write_tbu
,
904 /* Softare table search registers */
905 static void gen_6xx_7xx_soft_tlb (CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
907 #if !defined(CONFIG_USER_ONLY)
908 env
->nb_tlb
= nb_tlbs
;
909 env
->nb_ways
= nb_ways
;
911 env
->tlb_type
= TLB_6XX
;
912 spr_register(env
, SPR_DMISS
, "DMISS",
913 SPR_NOACCESS
, SPR_NOACCESS
,
914 &spr_read_generic
, SPR_NOACCESS
,
916 spr_register(env
, SPR_DCMP
, "DCMP",
917 SPR_NOACCESS
, SPR_NOACCESS
,
918 &spr_read_generic
, SPR_NOACCESS
,
920 spr_register(env
, SPR_HASH1
, "HASH1",
921 SPR_NOACCESS
, SPR_NOACCESS
,
922 &spr_read_generic
, SPR_NOACCESS
,
924 spr_register(env
, SPR_HASH2
, "HASH2",
925 SPR_NOACCESS
, SPR_NOACCESS
,
926 &spr_read_generic
, SPR_NOACCESS
,
928 spr_register(env
, SPR_IMISS
, "IMISS",
929 SPR_NOACCESS
, SPR_NOACCESS
,
930 &spr_read_generic
, SPR_NOACCESS
,
932 spr_register(env
, SPR_ICMP
, "ICMP",
933 SPR_NOACCESS
, SPR_NOACCESS
,
934 &spr_read_generic
, SPR_NOACCESS
,
936 spr_register(env
, SPR_RPA
, "RPA",
937 SPR_NOACCESS
, SPR_NOACCESS
,
938 &spr_read_generic
, &spr_write_generic
,
943 /* SPR common to MPC755 and G2 */
944 static void gen_spr_G2_755 (CPUPPCState
*env
)
947 spr_register(env
, SPR_SPRG4
, "SPRG4",
948 SPR_NOACCESS
, SPR_NOACCESS
,
949 &spr_read_generic
, &spr_write_generic
,
951 spr_register(env
, SPR_SPRG5
, "SPRG5",
952 SPR_NOACCESS
, SPR_NOACCESS
,
953 &spr_read_generic
, &spr_write_generic
,
955 spr_register(env
, SPR_SPRG6
, "SPRG6",
956 SPR_NOACCESS
, SPR_NOACCESS
,
957 &spr_read_generic
, &spr_write_generic
,
959 spr_register(env
, SPR_SPRG7
, "SPRG7",
960 SPR_NOACCESS
, SPR_NOACCESS
,
961 &spr_read_generic
, &spr_write_generic
,
965 /* SPR common to all 7xx PowerPC implementations */
966 static void gen_spr_7xx (CPUPPCState
*env
)
969 /* XXX : not implemented */
970 spr_register_kvm(env
, SPR_DABR
, "DABR",
971 SPR_NOACCESS
, SPR_NOACCESS
,
972 &spr_read_generic
, &spr_write_generic
,
973 KVM_REG_PPC_DABR
, 0x00000000);
974 /* XXX : not implemented */
975 spr_register(env
, SPR_IABR
, "IABR",
976 SPR_NOACCESS
, SPR_NOACCESS
,
977 &spr_read_generic
, &spr_write_generic
,
979 /* Cache management */
980 /* XXX : not implemented */
981 spr_register(env
, SPR_ICTC
, "ICTC",
982 SPR_NOACCESS
, SPR_NOACCESS
,
983 &spr_read_generic
, &spr_write_generic
,
985 /* Performance monitors */
986 /* XXX : not implemented */
987 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
988 SPR_NOACCESS
, SPR_NOACCESS
,
989 &spr_read_generic
, &spr_write_generic
,
991 /* XXX : not implemented */
992 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
993 SPR_NOACCESS
, SPR_NOACCESS
,
994 &spr_read_generic
, &spr_write_generic
,
996 /* XXX : not implemented */
997 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
998 SPR_NOACCESS
, SPR_NOACCESS
,
999 &spr_read_generic
, &spr_write_generic
,
1001 /* XXX : not implemented */
1002 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
1003 SPR_NOACCESS
, SPR_NOACCESS
,
1004 &spr_read_generic
, &spr_write_generic
,
1006 /* XXX : not implemented */
1007 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
1008 SPR_NOACCESS
, SPR_NOACCESS
,
1009 &spr_read_generic
, &spr_write_generic
,
1011 /* XXX : not implemented */
1012 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
1013 SPR_NOACCESS
, SPR_NOACCESS
,
1014 &spr_read_generic
, &spr_write_generic
,
1016 /* XXX : not implemented */
1017 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
1018 SPR_NOACCESS
, SPR_NOACCESS
,
1019 &spr_read_generic
, SPR_NOACCESS
,
1021 /* XXX : not implemented */
1022 spr_register(env
, SPR_7XX_UMMCR0
, "UMMCR0",
1023 &spr_read_ureg
, SPR_NOACCESS
,
1024 &spr_read_ureg
, SPR_NOACCESS
,
1026 /* XXX : not implemented */
1027 spr_register(env
, SPR_7XX_UMMCR1
, "UMMCR1",
1028 &spr_read_ureg
, SPR_NOACCESS
,
1029 &spr_read_ureg
, SPR_NOACCESS
,
1031 /* XXX : not implemented */
1032 spr_register(env
, SPR_7XX_UPMC1
, "UPMC1",
1033 &spr_read_ureg
, SPR_NOACCESS
,
1034 &spr_read_ureg
, SPR_NOACCESS
,
1036 /* XXX : not implemented */
1037 spr_register(env
, SPR_7XX_UPMC2
, "UPMC2",
1038 &spr_read_ureg
, SPR_NOACCESS
,
1039 &spr_read_ureg
, SPR_NOACCESS
,
1041 /* XXX : not implemented */
1042 spr_register(env
, SPR_7XX_UPMC3
, "UPMC3",
1043 &spr_read_ureg
, SPR_NOACCESS
,
1044 &spr_read_ureg
, SPR_NOACCESS
,
1046 /* XXX : not implemented */
1047 spr_register(env
, SPR_7XX_UPMC4
, "UPMC4",
1048 &spr_read_ureg
, SPR_NOACCESS
,
1049 &spr_read_ureg
, SPR_NOACCESS
,
1051 /* XXX : not implemented */
1052 spr_register(env
, SPR_7XX_USIAR
, "USIAR",
1053 &spr_read_ureg
, SPR_NOACCESS
,
1054 &spr_read_ureg
, SPR_NOACCESS
,
1056 /* External access control */
1057 /* XXX : not implemented */
1058 spr_register(env
, SPR_EAR
, "EAR",
1059 SPR_NOACCESS
, SPR_NOACCESS
,
1060 &spr_read_generic
, &spr_write_generic
,
1065 #ifndef CONFIG_USER_ONLY
1066 static void spr_write_amr(DisasContext
*ctx
, int sprn
, int gprn
)
1068 TCGv t0
= tcg_temp_new();
1069 TCGv t1
= tcg_temp_new();
1070 TCGv t2
= tcg_temp_new();
1072 /* Note, the HV=1 PR=0 case is handled earlier by simply using
1073 * spr_write_generic for HV mode in the SPR table
1076 /* Build insertion mask into t1 based on context */
1078 gen_load_spr(t1
, SPR_UAMOR
);
1080 gen_load_spr(t1
, SPR_AMOR
);
1083 /* Mask new bits into t2 */
1084 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1086 /* Load AMR and clear new bits in t0 */
1087 gen_load_spr(t0
, SPR_AMR
);
1088 tcg_gen_andc_tl(t0
, t0
, t1
);
1090 /* Or'in new bits and write it out */
1091 tcg_gen_or_tl(t0
, t0
, t2
);
1092 gen_store_spr(SPR_AMR
, t0
);
1093 spr_store_dump_spr(SPR_AMR
);
1100 static void spr_write_uamor(DisasContext
*ctx
, int sprn
, int gprn
)
1102 TCGv t0
= tcg_temp_new();
1103 TCGv t1
= tcg_temp_new();
1104 TCGv t2
= tcg_temp_new();
1106 /* Note, the HV=1 case is handled earlier by simply using
1107 * spr_write_generic for HV mode in the SPR table
1110 /* Build insertion mask into t1 based on context */
1111 gen_load_spr(t1
, SPR_AMOR
);
1113 /* Mask new bits into t2 */
1114 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1116 /* Load AMR and clear new bits in t0 */
1117 gen_load_spr(t0
, SPR_UAMOR
);
1118 tcg_gen_andc_tl(t0
, t0
, t1
);
1120 /* Or'in new bits and write it out */
1121 tcg_gen_or_tl(t0
, t0
, t2
);
1122 gen_store_spr(SPR_UAMOR
, t0
);
1123 spr_store_dump_spr(SPR_UAMOR
);
1130 static void spr_write_iamr(DisasContext
*ctx
, int sprn
, int gprn
)
1132 TCGv t0
= tcg_temp_new();
1133 TCGv t1
= tcg_temp_new();
1134 TCGv t2
= tcg_temp_new();
1136 /* Note, the HV=1 case is handled earlier by simply using
1137 * spr_write_generic for HV mode in the SPR table
1140 /* Build insertion mask into t1 based on context */
1141 gen_load_spr(t1
, SPR_AMOR
);
1143 /* Mask new bits into t2 */
1144 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1146 /* Load AMR and clear new bits in t0 */
1147 gen_load_spr(t0
, SPR_IAMR
);
1148 tcg_gen_andc_tl(t0
, t0
, t1
);
1150 /* Or'in new bits and write it out */
1151 tcg_gen_or_tl(t0
, t0
, t2
);
1152 gen_store_spr(SPR_IAMR
, t0
);
1153 spr_store_dump_spr(SPR_IAMR
);
1159 #endif /* CONFIG_USER_ONLY */
1161 static void gen_spr_amr(CPUPPCState
*env
, bool has_iamr
)
1163 #ifndef CONFIG_USER_ONLY
1164 /* Virtual Page Class Key protection */
1165 /* The AMR is accessible either via SPR 13 or SPR 29. 13 is
1166 * userspace accessible, 29 is privileged. So we only need to set
1167 * the kvm ONE_REG id on one of them, we use 29 */
1168 spr_register(env
, SPR_UAMR
, "UAMR",
1169 &spr_read_generic
, &spr_write_amr
,
1170 &spr_read_generic
, &spr_write_amr
,
1172 spr_register_kvm_hv(env
, SPR_AMR
, "AMR",
1173 SPR_NOACCESS
, SPR_NOACCESS
,
1174 &spr_read_generic
, &spr_write_amr
,
1175 &spr_read_generic
, &spr_write_generic
,
1176 KVM_REG_PPC_AMR
, 0);
1177 spr_register_kvm_hv(env
, SPR_UAMOR
, "UAMOR",
1178 SPR_NOACCESS
, SPR_NOACCESS
,
1179 &spr_read_generic
, &spr_write_uamor
,
1180 &spr_read_generic
, &spr_write_generic
,
1181 KVM_REG_PPC_UAMOR
, 0);
1182 spr_register_hv(env
, SPR_AMOR
, "AMOR",
1183 SPR_NOACCESS
, SPR_NOACCESS
,
1184 SPR_NOACCESS
, SPR_NOACCESS
,
1185 &spr_read_generic
, &spr_write_generic
,
1188 spr_register_kvm_hv(env
, SPR_IAMR
, "IAMR",
1189 SPR_NOACCESS
, SPR_NOACCESS
,
1190 &spr_read_generic
, &spr_write_iamr
,
1191 &spr_read_generic
, &spr_write_generic
,
1192 KVM_REG_PPC_IAMR
, 0);
1194 #endif /* !CONFIG_USER_ONLY */
1196 #endif /* TARGET_PPC64 */
1198 static void gen_spr_thrm (CPUPPCState
*env
)
1200 /* Thermal management */
1201 /* XXX : not implemented */
1202 spr_register(env
, SPR_THRM1
, "THRM1",
1203 SPR_NOACCESS
, SPR_NOACCESS
,
1204 &spr_read_generic
, &spr_write_generic
,
1206 /* XXX : not implemented */
1207 spr_register(env
, SPR_THRM2
, "THRM2",
1208 SPR_NOACCESS
, SPR_NOACCESS
,
1209 &spr_read_generic
, &spr_write_generic
,
1211 /* XXX : not implemented */
1212 spr_register(env
, SPR_THRM3
, "THRM3",
1213 SPR_NOACCESS
, SPR_NOACCESS
,
1214 &spr_read_generic
, &spr_write_generic
,
1218 /* SPR specific to PowerPC 604 implementation */
1219 static void gen_spr_604 (CPUPPCState
*env
)
1221 /* Processor identification */
1222 spr_register(env
, SPR_PIR
, "PIR",
1223 SPR_NOACCESS
, SPR_NOACCESS
,
1224 &spr_read_generic
, &spr_write_pir
,
1227 /* XXX : not implemented */
1228 spr_register(env
, SPR_IABR
, "IABR",
1229 SPR_NOACCESS
, SPR_NOACCESS
,
1230 &spr_read_generic
, &spr_write_generic
,
1232 /* XXX : not implemented */
1233 spr_register_kvm(env
, SPR_DABR
, "DABR",
1234 SPR_NOACCESS
, SPR_NOACCESS
,
1235 &spr_read_generic
, &spr_write_generic
,
1236 KVM_REG_PPC_DABR
, 0x00000000);
1237 /* Performance counters */
1238 /* XXX : not implemented */
1239 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
1240 SPR_NOACCESS
, SPR_NOACCESS
,
1241 &spr_read_generic
, &spr_write_generic
,
1243 /* XXX : not implemented */
1244 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
1245 SPR_NOACCESS
, SPR_NOACCESS
,
1246 &spr_read_generic
, &spr_write_generic
,
1248 /* XXX : not implemented */
1249 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
1250 SPR_NOACCESS
, SPR_NOACCESS
,
1251 &spr_read_generic
, &spr_write_generic
,
1253 /* XXX : not implemented */
1254 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
1255 SPR_NOACCESS
, SPR_NOACCESS
,
1256 &spr_read_generic
, SPR_NOACCESS
,
1258 /* XXX : not implemented */
1259 spr_register(env
, SPR_SDA
, "SDA",
1260 SPR_NOACCESS
, SPR_NOACCESS
,
1261 &spr_read_generic
, SPR_NOACCESS
,
1263 /* External access control */
1264 /* XXX : not implemented */
1265 spr_register(env
, SPR_EAR
, "EAR",
1266 SPR_NOACCESS
, SPR_NOACCESS
,
1267 &spr_read_generic
, &spr_write_generic
,
1271 /* SPR specific to PowerPC 603 implementation */
1272 static void gen_spr_603 (CPUPPCState
*env
)
1274 /* External access control */
1275 /* XXX : not implemented */
1276 spr_register(env
, SPR_EAR
, "EAR",
1277 SPR_NOACCESS
, SPR_NOACCESS
,
1278 &spr_read_generic
, &spr_write_generic
,
1281 /* XXX : not implemented */
1282 spr_register(env
, SPR_IABR
, "IABR",
1283 SPR_NOACCESS
, SPR_NOACCESS
,
1284 &spr_read_generic
, &spr_write_generic
,
1289 /* SPR specific to PowerPC G2 implementation */
1290 static void gen_spr_G2 (CPUPPCState
*env
)
1292 /* Memory base address */
1294 /* XXX : not implemented */
1295 spr_register(env
, SPR_MBAR
, "MBAR",
1296 SPR_NOACCESS
, SPR_NOACCESS
,
1297 &spr_read_generic
, &spr_write_generic
,
1299 /* Exception processing */
1300 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1301 SPR_NOACCESS
, SPR_NOACCESS
,
1302 &spr_read_generic
, &spr_write_generic
,
1304 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1305 SPR_NOACCESS
, SPR_NOACCESS
,
1306 &spr_read_generic
, &spr_write_generic
,
1309 /* XXX : not implemented */
1310 spr_register(env
, SPR_DABR
, "DABR",
1311 SPR_NOACCESS
, SPR_NOACCESS
,
1312 &spr_read_generic
, &spr_write_generic
,
1314 /* XXX : not implemented */
1315 spr_register(env
, SPR_DABR2
, "DABR2",
1316 SPR_NOACCESS
, SPR_NOACCESS
,
1317 &spr_read_generic
, &spr_write_generic
,
1319 /* XXX : not implemented */
1320 spr_register(env
, SPR_IABR
, "IABR",
1321 SPR_NOACCESS
, SPR_NOACCESS
,
1322 &spr_read_generic
, &spr_write_generic
,
1324 /* XXX : not implemented */
1325 spr_register(env
, SPR_IABR2
, "IABR2",
1326 SPR_NOACCESS
, SPR_NOACCESS
,
1327 &spr_read_generic
, &spr_write_generic
,
1329 /* XXX : not implemented */
1330 spr_register(env
, SPR_IBCR
, "IBCR",
1331 SPR_NOACCESS
, SPR_NOACCESS
,
1332 &spr_read_generic
, &spr_write_generic
,
1334 /* XXX : not implemented */
1335 spr_register(env
, SPR_DBCR
, "DBCR",
1336 SPR_NOACCESS
, SPR_NOACCESS
,
1337 &spr_read_generic
, &spr_write_generic
,
1341 /* SPR specific to PowerPC 602 implementation */
1342 static void gen_spr_602 (CPUPPCState
*env
)
1345 /* XXX : not implemented */
1346 spr_register(env
, SPR_SER
, "SER",
1347 SPR_NOACCESS
, SPR_NOACCESS
,
1348 &spr_read_generic
, &spr_write_generic
,
1350 /* XXX : not implemented */
1351 spr_register(env
, SPR_SEBR
, "SEBR",
1352 SPR_NOACCESS
, SPR_NOACCESS
,
1353 &spr_read_generic
, &spr_write_generic
,
1355 /* XXX : not implemented */
1356 spr_register(env
, SPR_ESASRR
, "ESASRR",
1357 SPR_NOACCESS
, SPR_NOACCESS
,
1358 &spr_read_generic
, &spr_write_generic
,
1360 /* Floating point status */
1361 /* XXX : not implemented */
1362 spr_register(env
, SPR_SP
, "SP",
1363 SPR_NOACCESS
, SPR_NOACCESS
,
1364 &spr_read_generic
, &spr_write_generic
,
1366 /* XXX : not implemented */
1367 spr_register(env
, SPR_LT
, "LT",
1368 SPR_NOACCESS
, SPR_NOACCESS
,
1369 &spr_read_generic
, &spr_write_generic
,
1371 /* Watchdog timer */
1372 /* XXX : not implemented */
1373 spr_register(env
, SPR_TCR
, "TCR",
1374 SPR_NOACCESS
, SPR_NOACCESS
,
1375 &spr_read_generic
, &spr_write_generic
,
1377 /* Interrupt base */
1378 spr_register(env
, SPR_IBR
, "IBR",
1379 SPR_NOACCESS
, SPR_NOACCESS
,
1380 &spr_read_generic
, &spr_write_generic
,
1382 /* XXX : not implemented */
1383 spr_register(env
, SPR_IABR
, "IABR",
1384 SPR_NOACCESS
, SPR_NOACCESS
,
1385 &spr_read_generic
, &spr_write_generic
,
1389 /* SPR specific to PowerPC 601 implementation */
1390 static void gen_spr_601 (CPUPPCState
*env
)
1392 /* Multiplication/division register */
1394 spr_register(env
, SPR_MQ
, "MQ",
1395 &spr_read_generic
, &spr_write_generic
,
1396 &spr_read_generic
, &spr_write_generic
,
1399 spr_register(env
, SPR_601_RTCU
, "RTCU",
1400 SPR_NOACCESS
, SPR_NOACCESS
,
1401 SPR_NOACCESS
, &spr_write_601_rtcu
,
1403 spr_register(env
, SPR_601_VRTCU
, "RTCU",
1404 &spr_read_601_rtcu
, SPR_NOACCESS
,
1405 &spr_read_601_rtcu
, SPR_NOACCESS
,
1407 spr_register(env
, SPR_601_RTCL
, "RTCL",
1408 SPR_NOACCESS
, SPR_NOACCESS
,
1409 SPR_NOACCESS
, &spr_write_601_rtcl
,
1411 spr_register(env
, SPR_601_VRTCL
, "RTCL",
1412 &spr_read_601_rtcl
, SPR_NOACCESS
,
1413 &spr_read_601_rtcl
, SPR_NOACCESS
,
1417 spr_register(env
, SPR_601_UDECR
, "UDECR",
1418 &spr_read_decr
, SPR_NOACCESS
,
1419 &spr_read_decr
, SPR_NOACCESS
,
1422 /* External access control */
1423 /* XXX : not implemented */
1424 spr_register(env
, SPR_EAR
, "EAR",
1425 SPR_NOACCESS
, SPR_NOACCESS
,
1426 &spr_read_generic
, &spr_write_generic
,
1428 /* Memory management */
1429 #if !defined(CONFIG_USER_ONLY)
1430 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
1431 SPR_NOACCESS
, SPR_NOACCESS
,
1432 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1434 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
1435 SPR_NOACCESS
, SPR_NOACCESS
,
1436 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1438 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
1439 SPR_NOACCESS
, SPR_NOACCESS
,
1440 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1442 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
1443 SPR_NOACCESS
, SPR_NOACCESS
,
1444 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1446 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
1447 SPR_NOACCESS
, SPR_NOACCESS
,
1448 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1450 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
1451 SPR_NOACCESS
, SPR_NOACCESS
,
1452 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1454 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
1455 SPR_NOACCESS
, SPR_NOACCESS
,
1456 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1458 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
1459 SPR_NOACCESS
, SPR_NOACCESS
,
1460 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1466 static void gen_spr_74xx (CPUPPCState
*env
)
1468 /* Processor identification */
1469 spr_register(env
, SPR_PIR
, "PIR",
1470 SPR_NOACCESS
, SPR_NOACCESS
,
1471 &spr_read_generic
, &spr_write_pir
,
1473 /* XXX : not implemented */
1474 spr_register(env
, SPR_74XX_MMCR2
, "MMCR2",
1475 SPR_NOACCESS
, SPR_NOACCESS
,
1476 &spr_read_generic
, &spr_write_generic
,
1478 /* XXX : not implemented */
1479 spr_register(env
, SPR_74XX_UMMCR2
, "UMMCR2",
1480 &spr_read_ureg
, SPR_NOACCESS
,
1481 &spr_read_ureg
, SPR_NOACCESS
,
1483 /* XXX: not implemented */
1484 spr_register(env
, SPR_BAMR
, "BAMR",
1485 SPR_NOACCESS
, SPR_NOACCESS
,
1486 &spr_read_generic
, &spr_write_generic
,
1488 /* XXX : not implemented */
1489 spr_register(env
, SPR_MSSCR0
, "MSSCR0",
1490 SPR_NOACCESS
, SPR_NOACCESS
,
1491 &spr_read_generic
, &spr_write_generic
,
1493 /* Hardware implementation registers */
1494 /* XXX : not implemented */
1495 spr_register(env
, SPR_HID0
, "HID0",
1496 SPR_NOACCESS
, SPR_NOACCESS
,
1497 &spr_read_generic
, &spr_write_generic
,
1499 /* XXX : not implemented */
1500 spr_register(env
, SPR_HID1
, "HID1",
1501 SPR_NOACCESS
, SPR_NOACCESS
,
1502 &spr_read_generic
, &spr_write_generic
,
1505 spr_register(env
, SPR_VRSAVE
, "VRSAVE",
1506 &spr_read_generic
, &spr_write_generic
,
1507 &spr_read_generic
, &spr_write_generic
,
1509 /* XXX : not implemented */
1510 spr_register(env
, SPR_L2CR
, "L2CR",
1511 SPR_NOACCESS
, SPR_NOACCESS
,
1512 &spr_read_generic
, spr_access_nop
,
1514 /* Not strictly an SPR */
1515 vscr_init(env
, 0x00010000);
1518 static void gen_l3_ctrl (CPUPPCState
*env
)
1521 /* XXX : not implemented */
1522 spr_register(env
, SPR_L3CR
, "L3CR",
1523 SPR_NOACCESS
, SPR_NOACCESS
,
1524 &spr_read_generic
, &spr_write_generic
,
1527 /* XXX : not implemented */
1528 spr_register(env
, SPR_L3ITCR0
, "L3ITCR0",
1529 SPR_NOACCESS
, SPR_NOACCESS
,
1530 &spr_read_generic
, &spr_write_generic
,
1533 /* XXX : not implemented */
1534 spr_register(env
, SPR_L3PM
, "L3PM",
1535 SPR_NOACCESS
, SPR_NOACCESS
,
1536 &spr_read_generic
, &spr_write_generic
,
1540 static void gen_74xx_soft_tlb (CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
1542 #if !defined(CONFIG_USER_ONLY)
1543 env
->nb_tlb
= nb_tlbs
;
1544 env
->nb_ways
= nb_ways
;
1546 env
->tlb_type
= TLB_6XX
;
1547 /* XXX : not implemented */
1548 spr_register(env
, SPR_PTEHI
, "PTEHI",
1549 SPR_NOACCESS
, SPR_NOACCESS
,
1550 &spr_read_generic
, &spr_write_generic
,
1552 /* XXX : not implemented */
1553 spr_register(env
, SPR_PTELO
, "PTELO",
1554 SPR_NOACCESS
, SPR_NOACCESS
,
1555 &spr_read_generic
, &spr_write_generic
,
1557 /* XXX : not implemented */
1558 spr_register(env
, SPR_TLBMISS
, "TLBMISS",
1559 SPR_NOACCESS
, SPR_NOACCESS
,
1560 &spr_read_generic
, &spr_write_generic
,
1565 #if !defined(CONFIG_USER_ONLY)
1566 static void spr_write_e500_l1csr0 (DisasContext
*ctx
, int sprn
, int gprn
)
1568 TCGv t0
= tcg_temp_new();
1570 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR0_DCE
| L1CSR0_CPE
);
1571 gen_store_spr(sprn
, t0
);
1575 static void spr_write_e500_l1csr1(DisasContext
*ctx
, int sprn
, int gprn
)
1577 TCGv t0
= tcg_temp_new();
1579 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR1_ICE
| L1CSR1_CPE
);
1580 gen_store_spr(sprn
, t0
);
1584 static void spr_write_booke206_mmucsr0 (DisasContext
*ctx
, int sprn
, int gprn
)
1586 gen_helper_booke206_tlbflush(cpu_env
, cpu_gpr
[gprn
]);
1589 static void spr_write_booke_pid (DisasContext
*ctx
, int sprn
, int gprn
)
1591 TCGv_i32 t0
= tcg_const_i32(sprn
);
1592 gen_helper_booke_setpid(cpu_env
, t0
, cpu_gpr
[gprn
]);
1593 tcg_temp_free_i32(t0
);
1597 static void gen_spr_usprgh (CPUPPCState
*env
)
1599 spr_register(env
, SPR_USPRG4
, "USPRG4",
1600 &spr_read_ureg
, SPR_NOACCESS
,
1601 &spr_read_ureg
, SPR_NOACCESS
,
1603 spr_register(env
, SPR_USPRG5
, "USPRG5",
1604 &spr_read_ureg
, SPR_NOACCESS
,
1605 &spr_read_ureg
, SPR_NOACCESS
,
1607 spr_register(env
, SPR_USPRG6
, "USPRG6",
1608 &spr_read_ureg
, SPR_NOACCESS
,
1609 &spr_read_ureg
, SPR_NOACCESS
,
1611 spr_register(env
, SPR_USPRG7
, "USPRG7",
1612 &spr_read_ureg
, SPR_NOACCESS
,
1613 &spr_read_ureg
, SPR_NOACCESS
,
1617 /* PowerPC BookE SPR */
1618 static void gen_spr_BookE (CPUPPCState
*env
, uint64_t ivor_mask
)
1620 const char *ivor_names
[64] = {
1621 "IVOR0", "IVOR1", "IVOR2", "IVOR3",
1622 "IVOR4", "IVOR5", "IVOR6", "IVOR7",
1623 "IVOR8", "IVOR9", "IVOR10", "IVOR11",
1624 "IVOR12", "IVOR13", "IVOR14", "IVOR15",
1625 "IVOR16", "IVOR17", "IVOR18", "IVOR19",
1626 "IVOR20", "IVOR21", "IVOR22", "IVOR23",
1627 "IVOR24", "IVOR25", "IVOR26", "IVOR27",
1628 "IVOR28", "IVOR29", "IVOR30", "IVOR31",
1629 "IVOR32", "IVOR33", "IVOR34", "IVOR35",
1630 "IVOR36", "IVOR37", "IVOR38", "IVOR39",
1631 "IVOR40", "IVOR41", "IVOR42", "IVOR43",
1632 "IVOR44", "IVOR45", "IVOR46", "IVOR47",
1633 "IVOR48", "IVOR49", "IVOR50", "IVOR51",
1634 "IVOR52", "IVOR53", "IVOR54", "IVOR55",
1635 "IVOR56", "IVOR57", "IVOR58", "IVOR59",
1636 "IVOR60", "IVOR61", "IVOR62", "IVOR63",
1638 #define SPR_BOOKE_IVORxx (-1)
1639 int ivor_sprn
[64] = {
1640 SPR_BOOKE_IVOR0
, SPR_BOOKE_IVOR1
, SPR_BOOKE_IVOR2
, SPR_BOOKE_IVOR3
,
1641 SPR_BOOKE_IVOR4
, SPR_BOOKE_IVOR5
, SPR_BOOKE_IVOR6
, SPR_BOOKE_IVOR7
,
1642 SPR_BOOKE_IVOR8
, SPR_BOOKE_IVOR9
, SPR_BOOKE_IVOR10
, SPR_BOOKE_IVOR11
,
1643 SPR_BOOKE_IVOR12
, SPR_BOOKE_IVOR13
, SPR_BOOKE_IVOR14
, SPR_BOOKE_IVOR15
,
1644 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1645 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1646 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1647 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1648 SPR_BOOKE_IVOR32
, SPR_BOOKE_IVOR33
, SPR_BOOKE_IVOR34
, SPR_BOOKE_IVOR35
,
1649 SPR_BOOKE_IVOR36
, SPR_BOOKE_IVOR37
, SPR_BOOKE_IVOR38
, SPR_BOOKE_IVOR39
,
1650 SPR_BOOKE_IVOR40
, SPR_BOOKE_IVOR41
, SPR_BOOKE_IVOR42
, SPR_BOOKE_IVORxx
,
1651 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1652 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1653 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1654 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1655 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1659 /* Interrupt processing */
1660 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1661 SPR_NOACCESS
, SPR_NOACCESS
,
1662 &spr_read_generic
, &spr_write_generic
,
1664 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1665 SPR_NOACCESS
, SPR_NOACCESS
,
1666 &spr_read_generic
, &spr_write_generic
,
1669 /* XXX : not implemented */
1670 spr_register(env
, SPR_BOOKE_IAC1
, "IAC1",
1671 SPR_NOACCESS
, SPR_NOACCESS
,
1672 &spr_read_generic
, &spr_write_generic
,
1674 /* XXX : not implemented */
1675 spr_register(env
, SPR_BOOKE_IAC2
, "IAC2",
1676 SPR_NOACCESS
, SPR_NOACCESS
,
1677 &spr_read_generic
, &spr_write_generic
,
1679 /* XXX : not implemented */
1680 spr_register(env
, SPR_BOOKE_DAC1
, "DAC1",
1681 SPR_NOACCESS
, SPR_NOACCESS
,
1682 &spr_read_generic
, &spr_write_generic
,
1684 /* XXX : not implemented */
1685 spr_register(env
, SPR_BOOKE_DAC2
, "DAC2",
1686 SPR_NOACCESS
, SPR_NOACCESS
,
1687 &spr_read_generic
, &spr_write_generic
,
1689 /* XXX : not implemented */
1690 spr_register(env
, SPR_BOOKE_DBCR0
, "DBCR0",
1691 SPR_NOACCESS
, SPR_NOACCESS
,
1692 &spr_read_generic
, &spr_write_40x_dbcr0
,
1694 /* XXX : not implemented */
1695 spr_register(env
, SPR_BOOKE_DBCR1
, "DBCR1",
1696 SPR_NOACCESS
, SPR_NOACCESS
,
1697 &spr_read_generic
, &spr_write_generic
,
1699 /* XXX : not implemented */
1700 spr_register(env
, SPR_BOOKE_DBCR2
, "DBCR2",
1701 SPR_NOACCESS
, SPR_NOACCESS
,
1702 &spr_read_generic
, &spr_write_generic
,
1704 /* XXX : not implemented */
1705 spr_register(env
, SPR_BOOKE_DBSR
, "DBSR",
1706 SPR_NOACCESS
, SPR_NOACCESS
,
1707 &spr_read_generic
, &spr_write_clear
,
1709 spr_register(env
, SPR_BOOKE_DEAR
, "DEAR",
1710 SPR_NOACCESS
, SPR_NOACCESS
,
1711 &spr_read_generic
, &spr_write_generic
,
1713 spr_register(env
, SPR_BOOKE_ESR
, "ESR",
1714 SPR_NOACCESS
, SPR_NOACCESS
,
1715 &spr_read_generic
, &spr_write_generic
,
1717 spr_register(env
, SPR_BOOKE_IVPR
, "IVPR",
1718 SPR_NOACCESS
, SPR_NOACCESS
,
1719 &spr_read_generic
, &spr_write_excp_prefix
,
1721 /* Exception vectors */
1722 for (i
= 0; i
< 64; i
++) {
1723 if (ivor_mask
& (1ULL << i
)) {
1724 if (ivor_sprn
[i
] == SPR_BOOKE_IVORxx
) {
1725 fprintf(stderr
, "ERROR: IVOR %d SPR is not defined\n", i
);
1728 spr_register(env
, ivor_sprn
[i
], ivor_names
[i
],
1729 SPR_NOACCESS
, SPR_NOACCESS
,
1730 &spr_read_generic
, &spr_write_excp_vector
,
1734 spr_register(env
, SPR_BOOKE_PID
, "PID",
1735 SPR_NOACCESS
, SPR_NOACCESS
,
1736 &spr_read_generic
, &spr_write_booke_pid
,
1738 spr_register(env
, SPR_BOOKE_TCR
, "TCR",
1739 SPR_NOACCESS
, SPR_NOACCESS
,
1740 &spr_read_generic
, &spr_write_booke_tcr
,
1742 spr_register(env
, SPR_BOOKE_TSR
, "TSR",
1743 SPR_NOACCESS
, SPR_NOACCESS
,
1744 &spr_read_generic
, &spr_write_booke_tsr
,
1747 spr_register(env
, SPR_DECR
, "DECR",
1748 SPR_NOACCESS
, SPR_NOACCESS
,
1749 &spr_read_decr
, &spr_write_decr
,
1751 spr_register(env
, SPR_BOOKE_DECAR
, "DECAR",
1752 SPR_NOACCESS
, SPR_NOACCESS
,
1753 SPR_NOACCESS
, &spr_write_generic
,
1756 spr_register(env
, SPR_USPRG0
, "USPRG0",
1757 &spr_read_generic
, &spr_write_generic
,
1758 &spr_read_generic
, &spr_write_generic
,
1760 spr_register(env
, SPR_SPRG4
, "SPRG4",
1761 SPR_NOACCESS
, SPR_NOACCESS
,
1762 &spr_read_generic
, &spr_write_generic
,
1764 spr_register(env
, SPR_SPRG5
, "SPRG5",
1765 SPR_NOACCESS
, SPR_NOACCESS
,
1766 &spr_read_generic
, &spr_write_generic
,
1768 spr_register(env
, SPR_SPRG6
, "SPRG6",
1769 SPR_NOACCESS
, SPR_NOACCESS
,
1770 &spr_read_generic
, &spr_write_generic
,
1772 spr_register(env
, SPR_SPRG7
, "SPRG7",
1773 SPR_NOACCESS
, SPR_NOACCESS
,
1774 &spr_read_generic
, &spr_write_generic
,
1778 static inline uint32_t gen_tlbncfg(uint32_t assoc
, uint32_t minsize
,
1779 uint32_t maxsize
, uint32_t flags
,
1782 return (assoc
<< TLBnCFG_ASSOC_SHIFT
) |
1783 (minsize
<< TLBnCFG_MINSIZE_SHIFT
) |
1784 (maxsize
<< TLBnCFG_MAXSIZE_SHIFT
) |
1788 /* BookE 2.06 storage control registers */
1789 static void gen_spr_BookE206(CPUPPCState
*env
, uint32_t mas_mask
,
1792 #if !defined(CONFIG_USER_ONLY)
1793 const char *mas_names
[8] = {
1794 "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
1797 SPR_BOOKE_MAS0
, SPR_BOOKE_MAS1
, SPR_BOOKE_MAS2
, SPR_BOOKE_MAS3
,
1798 SPR_BOOKE_MAS4
, SPR_BOOKE_MAS5
, SPR_BOOKE_MAS6
, SPR_BOOKE_MAS7
,
1802 /* TLB assist registers */
1803 /* XXX : not implemented */
1804 for (i
= 0; i
< 8; i
++) {
1805 void (*uea_write
)(DisasContext
*ctx
, int sprn
, int gprn
) = &spr_write_generic32
;
1806 if (i
== 2 && (mas_mask
& (1 << i
)) && (env
->insns_flags
& PPC_64B
)) {
1807 uea_write
= &spr_write_generic
;
1809 if (mas_mask
& (1 << i
)) {
1810 spr_register(env
, mas_sprn
[i
], mas_names
[i
],
1811 SPR_NOACCESS
, SPR_NOACCESS
,
1812 &spr_read_generic
, uea_write
,
1816 if (env
->nb_pids
> 1) {
1817 /* XXX : not implemented */
1818 spr_register(env
, SPR_BOOKE_PID1
, "PID1",
1819 SPR_NOACCESS
, SPR_NOACCESS
,
1820 &spr_read_generic
, &spr_write_booke_pid
,
1823 if (env
->nb_pids
> 2) {
1824 /* XXX : not implemented */
1825 spr_register(env
, SPR_BOOKE_PID2
, "PID2",
1826 SPR_NOACCESS
, SPR_NOACCESS
,
1827 &spr_read_generic
, &spr_write_booke_pid
,
1830 /* XXX : not implemented */
1831 spr_register(env
, SPR_MMUCFG
, "MMUCFG",
1832 SPR_NOACCESS
, SPR_NOACCESS
,
1833 &spr_read_generic
, SPR_NOACCESS
,
1834 0x00000000); /* TOFIX */
1835 switch (env
->nb_ways
) {
1837 spr_register(env
, SPR_BOOKE_TLB3CFG
, "TLB3CFG",
1838 SPR_NOACCESS
, SPR_NOACCESS
,
1839 &spr_read_generic
, SPR_NOACCESS
,
1843 spr_register(env
, SPR_BOOKE_TLB2CFG
, "TLB2CFG",
1844 SPR_NOACCESS
, SPR_NOACCESS
,
1845 &spr_read_generic
, SPR_NOACCESS
,
1849 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
1850 SPR_NOACCESS
, SPR_NOACCESS
,
1851 &spr_read_generic
, SPR_NOACCESS
,
1855 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
1856 SPR_NOACCESS
, SPR_NOACCESS
,
1857 &spr_read_generic
, SPR_NOACCESS
,
1866 gen_spr_usprgh(env
);
1869 /* SPR specific to PowerPC 440 implementation */
1870 static void gen_spr_440 (CPUPPCState
*env
)
1873 /* XXX : not implemented */
1874 spr_register(env
, SPR_440_DNV0
, "DNV0",
1875 SPR_NOACCESS
, SPR_NOACCESS
,
1876 &spr_read_generic
, &spr_write_generic
,
1878 /* XXX : not implemented */
1879 spr_register(env
, SPR_440_DNV1
, "DNV1",
1880 SPR_NOACCESS
, SPR_NOACCESS
,
1881 &spr_read_generic
, &spr_write_generic
,
1883 /* XXX : not implemented */
1884 spr_register(env
, SPR_440_DNV2
, "DNV2",
1885 SPR_NOACCESS
, SPR_NOACCESS
,
1886 &spr_read_generic
, &spr_write_generic
,
1888 /* XXX : not implemented */
1889 spr_register(env
, SPR_440_DNV3
, "DNV3",
1890 SPR_NOACCESS
, SPR_NOACCESS
,
1891 &spr_read_generic
, &spr_write_generic
,
1893 /* XXX : not implemented */
1894 spr_register(env
, SPR_440_DTV0
, "DTV0",
1895 SPR_NOACCESS
, SPR_NOACCESS
,
1896 &spr_read_generic
, &spr_write_generic
,
1898 /* XXX : not implemented */
1899 spr_register(env
, SPR_440_DTV1
, "DTV1",
1900 SPR_NOACCESS
, SPR_NOACCESS
,
1901 &spr_read_generic
, &spr_write_generic
,
1903 /* XXX : not implemented */
1904 spr_register(env
, SPR_440_DTV2
, "DTV2",
1905 SPR_NOACCESS
, SPR_NOACCESS
,
1906 &spr_read_generic
, &spr_write_generic
,
1908 /* XXX : not implemented */
1909 spr_register(env
, SPR_440_DTV3
, "DTV3",
1910 SPR_NOACCESS
, SPR_NOACCESS
,
1911 &spr_read_generic
, &spr_write_generic
,
1913 /* XXX : not implemented */
1914 spr_register(env
, SPR_440_DVLIM
, "DVLIM",
1915 SPR_NOACCESS
, SPR_NOACCESS
,
1916 &spr_read_generic
, &spr_write_generic
,
1918 /* XXX : not implemented */
1919 spr_register(env
, SPR_440_INV0
, "INV0",
1920 SPR_NOACCESS
, SPR_NOACCESS
,
1921 &spr_read_generic
, &spr_write_generic
,
1923 /* XXX : not implemented */
1924 spr_register(env
, SPR_440_INV1
, "INV1",
1925 SPR_NOACCESS
, SPR_NOACCESS
,
1926 &spr_read_generic
, &spr_write_generic
,
1928 /* XXX : not implemented */
1929 spr_register(env
, SPR_440_INV2
, "INV2",
1930 SPR_NOACCESS
, SPR_NOACCESS
,
1931 &spr_read_generic
, &spr_write_generic
,
1933 /* XXX : not implemented */
1934 spr_register(env
, SPR_440_INV3
, "INV3",
1935 SPR_NOACCESS
, SPR_NOACCESS
,
1936 &spr_read_generic
, &spr_write_generic
,
1938 /* XXX : not implemented */
1939 spr_register(env
, SPR_440_ITV0
, "ITV0",
1940 SPR_NOACCESS
, SPR_NOACCESS
,
1941 &spr_read_generic
, &spr_write_generic
,
1943 /* XXX : not implemented */
1944 spr_register(env
, SPR_440_ITV1
, "ITV1",
1945 SPR_NOACCESS
, SPR_NOACCESS
,
1946 &spr_read_generic
, &spr_write_generic
,
1948 /* XXX : not implemented */
1949 spr_register(env
, SPR_440_ITV2
, "ITV2",
1950 SPR_NOACCESS
, SPR_NOACCESS
,
1951 &spr_read_generic
, &spr_write_generic
,
1953 /* XXX : not implemented */
1954 spr_register(env
, SPR_440_ITV3
, "ITV3",
1955 SPR_NOACCESS
, SPR_NOACCESS
,
1956 &spr_read_generic
, &spr_write_generic
,
1958 /* XXX : not implemented */
1959 spr_register(env
, SPR_440_IVLIM
, "IVLIM",
1960 SPR_NOACCESS
, SPR_NOACCESS
,
1961 &spr_read_generic
, &spr_write_generic
,
1964 /* XXX : not implemented */
1965 spr_register(env
, SPR_BOOKE_DCDBTRH
, "DCDBTRH",
1966 SPR_NOACCESS
, SPR_NOACCESS
,
1967 &spr_read_generic
, SPR_NOACCESS
,
1969 /* XXX : not implemented */
1970 spr_register(env
, SPR_BOOKE_DCDBTRL
, "DCDBTRL",
1971 SPR_NOACCESS
, SPR_NOACCESS
,
1972 &spr_read_generic
, SPR_NOACCESS
,
1974 /* XXX : not implemented */
1975 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
1976 SPR_NOACCESS
, SPR_NOACCESS
,
1977 &spr_read_generic
, SPR_NOACCESS
,
1979 /* XXX : not implemented */
1980 spr_register(env
, SPR_BOOKE_ICDBTRH
, "ICDBTRH",
1981 SPR_NOACCESS
, SPR_NOACCESS
,
1982 &spr_read_generic
, SPR_NOACCESS
,
1984 /* XXX : not implemented */
1985 spr_register(env
, SPR_BOOKE_ICDBTRL
, "ICDBTRL",
1986 SPR_NOACCESS
, SPR_NOACCESS
,
1987 &spr_read_generic
, SPR_NOACCESS
,
1989 /* XXX : not implemented */
1990 spr_register(env
, SPR_440_DBDR
, "DBDR",
1991 SPR_NOACCESS
, SPR_NOACCESS
,
1992 &spr_read_generic
, &spr_write_generic
,
1994 /* Processor control */
1995 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
1996 SPR_NOACCESS
, SPR_NOACCESS
,
1997 &spr_read_generic
, &spr_write_generic
,
1999 spr_register(env
, SPR_440_RSTCFG
, "RSTCFG",
2000 SPR_NOACCESS
, SPR_NOACCESS
,
2001 &spr_read_generic
, SPR_NOACCESS
,
2003 /* Storage control */
2004 spr_register(env
, SPR_440_MMUCR
, "MMUCR",
2005 SPR_NOACCESS
, SPR_NOACCESS
,
2006 &spr_read_generic
, &spr_write_generic
,
2010 /* SPR shared between PowerPC 40x implementations */
2011 static void gen_spr_40x (CPUPPCState
*env
)
2014 /* not emulated, as QEMU do not emulate caches */
2015 spr_register(env
, SPR_40x_DCCR
, "DCCR",
2016 SPR_NOACCESS
, SPR_NOACCESS
,
2017 &spr_read_generic
, &spr_write_generic
,
2019 /* not emulated, as QEMU do not emulate caches */
2020 spr_register(env
, SPR_40x_ICCR
, "ICCR",
2021 SPR_NOACCESS
, SPR_NOACCESS
,
2022 &spr_read_generic
, &spr_write_generic
,
2024 /* not emulated, as QEMU do not emulate caches */
2025 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
2026 SPR_NOACCESS
, SPR_NOACCESS
,
2027 &spr_read_generic
, SPR_NOACCESS
,
2030 spr_register(env
, SPR_40x_DEAR
, "DEAR",
2031 SPR_NOACCESS
, SPR_NOACCESS
,
2032 &spr_read_generic
, &spr_write_generic
,
2034 spr_register(env
, SPR_40x_ESR
, "ESR",
2035 SPR_NOACCESS
, SPR_NOACCESS
,
2036 &spr_read_generic
, &spr_write_generic
,
2038 spr_register(env
, SPR_40x_EVPR
, "EVPR",
2039 SPR_NOACCESS
, SPR_NOACCESS
,
2040 &spr_read_generic
, &spr_write_excp_prefix
,
2042 spr_register(env
, SPR_40x_SRR2
, "SRR2",
2043 &spr_read_generic
, &spr_write_generic
,
2044 &spr_read_generic
, &spr_write_generic
,
2046 spr_register(env
, SPR_40x_SRR3
, "SRR3",
2047 &spr_read_generic
, &spr_write_generic
,
2048 &spr_read_generic
, &spr_write_generic
,
2051 spr_register(env
, SPR_40x_PIT
, "PIT",
2052 SPR_NOACCESS
, SPR_NOACCESS
,
2053 &spr_read_40x_pit
, &spr_write_40x_pit
,
2055 spr_register(env
, SPR_40x_TCR
, "TCR",
2056 SPR_NOACCESS
, SPR_NOACCESS
,
2057 &spr_read_generic
, &spr_write_booke_tcr
,
2059 spr_register(env
, SPR_40x_TSR
, "TSR",
2060 SPR_NOACCESS
, SPR_NOACCESS
,
2061 &spr_read_generic
, &spr_write_booke_tsr
,
2065 /* SPR specific to PowerPC 405 implementation */
2066 static void gen_spr_405 (CPUPPCState
*env
)
2069 spr_register(env
, SPR_40x_PID
, "PID",
2070 SPR_NOACCESS
, SPR_NOACCESS
,
2071 &spr_read_generic
, &spr_write_generic
,
2073 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
2074 SPR_NOACCESS
, SPR_NOACCESS
,
2075 &spr_read_generic
, &spr_write_generic
,
2077 /* Debug interface */
2078 /* XXX : not implemented */
2079 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2080 SPR_NOACCESS
, SPR_NOACCESS
,
2081 &spr_read_generic
, &spr_write_40x_dbcr0
,
2083 /* XXX : not implemented */
2084 spr_register(env
, SPR_405_DBCR1
, "DBCR1",
2085 SPR_NOACCESS
, SPR_NOACCESS
,
2086 &spr_read_generic
, &spr_write_generic
,
2088 /* XXX : not implemented */
2089 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2090 SPR_NOACCESS
, SPR_NOACCESS
,
2091 &spr_read_generic
, &spr_write_clear
,
2092 /* Last reset was system reset */
2094 /* XXX : not implemented */
2095 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2096 SPR_NOACCESS
, SPR_NOACCESS
,
2097 &spr_read_generic
, &spr_write_generic
,
2099 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2100 SPR_NOACCESS
, SPR_NOACCESS
,
2101 &spr_read_generic
, &spr_write_generic
,
2103 /* XXX : not implemented */
2104 spr_register(env
, SPR_405_DVC1
, "DVC1",
2105 SPR_NOACCESS
, SPR_NOACCESS
,
2106 &spr_read_generic
, &spr_write_generic
,
2108 /* XXX : not implemented */
2109 spr_register(env
, SPR_405_DVC2
, "DVC2",
2110 SPR_NOACCESS
, SPR_NOACCESS
,
2111 &spr_read_generic
, &spr_write_generic
,
2113 /* XXX : not implemented */
2114 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2115 SPR_NOACCESS
, SPR_NOACCESS
,
2116 &spr_read_generic
, &spr_write_generic
,
2118 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2119 SPR_NOACCESS
, SPR_NOACCESS
,
2120 &spr_read_generic
, &spr_write_generic
,
2122 /* XXX : not implemented */
2123 spr_register(env
, SPR_405_IAC3
, "IAC3",
2124 SPR_NOACCESS
, SPR_NOACCESS
,
2125 &spr_read_generic
, &spr_write_generic
,
2127 /* XXX : not implemented */
2128 spr_register(env
, SPR_405_IAC4
, "IAC4",
2129 SPR_NOACCESS
, SPR_NOACCESS
,
2130 &spr_read_generic
, &spr_write_generic
,
2132 /* Storage control */
2133 /* XXX: TODO: not implemented */
2134 spr_register(env
, SPR_405_SLER
, "SLER",
2135 SPR_NOACCESS
, SPR_NOACCESS
,
2136 &spr_read_generic
, &spr_write_40x_sler
,
2138 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2139 SPR_NOACCESS
, SPR_NOACCESS
,
2140 &spr_read_generic
, &spr_write_generic
,
2142 /* XXX : not implemented */
2143 spr_register(env
, SPR_405_SU0R
, "SU0R",
2144 SPR_NOACCESS
, SPR_NOACCESS
,
2145 &spr_read_generic
, &spr_write_generic
,
2148 spr_register(env
, SPR_USPRG0
, "USPRG0",
2149 &spr_read_ureg
, SPR_NOACCESS
,
2150 &spr_read_ureg
, SPR_NOACCESS
,
2152 spr_register(env
, SPR_SPRG4
, "SPRG4",
2153 SPR_NOACCESS
, SPR_NOACCESS
,
2154 &spr_read_generic
, &spr_write_generic
,
2156 spr_register(env
, SPR_SPRG5
, "SPRG5",
2157 SPR_NOACCESS
, SPR_NOACCESS
,
2158 spr_read_generic
, &spr_write_generic
,
2160 spr_register(env
, SPR_SPRG6
, "SPRG6",
2161 SPR_NOACCESS
, SPR_NOACCESS
,
2162 spr_read_generic
, &spr_write_generic
,
2164 spr_register(env
, SPR_SPRG7
, "SPRG7",
2165 SPR_NOACCESS
, SPR_NOACCESS
,
2166 spr_read_generic
, &spr_write_generic
,
2168 gen_spr_usprgh(env
);
2171 /* SPR shared between PowerPC 401 & 403 implementations */
2172 static void gen_spr_401_403 (CPUPPCState
*env
)
2175 spr_register(env
, SPR_403_VTBL
, "TBL",
2176 &spr_read_tbl
, SPR_NOACCESS
,
2177 &spr_read_tbl
, SPR_NOACCESS
,
2179 spr_register(env
, SPR_403_TBL
, "TBL",
2180 SPR_NOACCESS
, SPR_NOACCESS
,
2181 SPR_NOACCESS
, &spr_write_tbl
,
2183 spr_register(env
, SPR_403_VTBU
, "TBU",
2184 &spr_read_tbu
, SPR_NOACCESS
,
2185 &spr_read_tbu
, SPR_NOACCESS
,
2187 spr_register(env
, SPR_403_TBU
, "TBU",
2188 SPR_NOACCESS
, SPR_NOACCESS
,
2189 SPR_NOACCESS
, &spr_write_tbu
,
2192 /* not emulated, as QEMU do not emulate caches */
2193 spr_register(env
, SPR_403_CDBCR
, "CDBCR",
2194 SPR_NOACCESS
, SPR_NOACCESS
,
2195 &spr_read_generic
, &spr_write_generic
,
2199 /* SPR specific to PowerPC 401 implementation */
2200 static void gen_spr_401 (CPUPPCState
*env
)
2202 /* Debug interface */
2203 /* XXX : not implemented */
2204 spr_register(env
, SPR_40x_DBCR0
, "DBCR",
2205 SPR_NOACCESS
, SPR_NOACCESS
,
2206 &spr_read_generic
, &spr_write_40x_dbcr0
,
2208 /* XXX : not implemented */
2209 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2210 SPR_NOACCESS
, SPR_NOACCESS
,
2211 &spr_read_generic
, &spr_write_clear
,
2212 /* Last reset was system reset */
2214 /* XXX : not implemented */
2215 spr_register(env
, SPR_40x_DAC1
, "DAC",
2216 SPR_NOACCESS
, SPR_NOACCESS
,
2217 &spr_read_generic
, &spr_write_generic
,
2219 /* XXX : not implemented */
2220 spr_register(env
, SPR_40x_IAC1
, "IAC",
2221 SPR_NOACCESS
, SPR_NOACCESS
,
2222 &spr_read_generic
, &spr_write_generic
,
2224 /* Storage control */
2225 /* XXX: TODO: not implemented */
2226 spr_register(env
, SPR_405_SLER
, "SLER",
2227 SPR_NOACCESS
, SPR_NOACCESS
,
2228 &spr_read_generic
, &spr_write_40x_sler
,
2230 /* not emulated, as QEMU never does speculative access */
2231 spr_register(env
, SPR_40x_SGR
, "SGR",
2232 SPR_NOACCESS
, SPR_NOACCESS
,
2233 &spr_read_generic
, &spr_write_generic
,
2235 /* not emulated, as QEMU do not emulate caches */
2236 spr_register(env
, SPR_40x_DCWR
, "DCWR",
2237 SPR_NOACCESS
, SPR_NOACCESS
,
2238 &spr_read_generic
, &spr_write_generic
,
2242 static void gen_spr_401x2 (CPUPPCState
*env
)
2245 spr_register(env
, SPR_40x_PID
, "PID",
2246 SPR_NOACCESS
, SPR_NOACCESS
,
2247 &spr_read_generic
, &spr_write_generic
,
2249 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2250 SPR_NOACCESS
, SPR_NOACCESS
,
2251 &spr_read_generic
, &spr_write_generic
,
2255 /* SPR specific to PowerPC 403 implementation */
2256 static void gen_spr_403 (CPUPPCState
*env
)
2258 /* Debug interface */
2259 /* XXX : not implemented */
2260 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2261 SPR_NOACCESS
, SPR_NOACCESS
,
2262 &spr_read_generic
, &spr_write_40x_dbcr0
,
2264 /* XXX : not implemented */
2265 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2266 SPR_NOACCESS
, SPR_NOACCESS
,
2267 &spr_read_generic
, &spr_write_clear
,
2268 /* Last reset was system reset */
2270 /* XXX : not implemented */
2271 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2272 SPR_NOACCESS
, SPR_NOACCESS
,
2273 &spr_read_generic
, &spr_write_generic
,
2275 /* XXX : not implemented */
2276 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2277 SPR_NOACCESS
, SPR_NOACCESS
,
2278 &spr_read_generic
, &spr_write_generic
,
2280 /* XXX : not implemented */
2281 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2282 SPR_NOACCESS
, SPR_NOACCESS
,
2283 &spr_read_generic
, &spr_write_generic
,
2285 /* XXX : not implemented */
2286 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2287 SPR_NOACCESS
, SPR_NOACCESS
,
2288 &spr_read_generic
, &spr_write_generic
,
2292 static void gen_spr_403_real (CPUPPCState
*env
)
2294 spr_register(env
, SPR_403_PBL1
, "PBL1",
2295 SPR_NOACCESS
, SPR_NOACCESS
,
2296 &spr_read_403_pbr
, &spr_write_403_pbr
,
2298 spr_register(env
, SPR_403_PBU1
, "PBU1",
2299 SPR_NOACCESS
, SPR_NOACCESS
,
2300 &spr_read_403_pbr
, &spr_write_403_pbr
,
2302 spr_register(env
, SPR_403_PBL2
, "PBL2",
2303 SPR_NOACCESS
, SPR_NOACCESS
,
2304 &spr_read_403_pbr
, &spr_write_403_pbr
,
2306 spr_register(env
, SPR_403_PBU2
, "PBU2",
2307 SPR_NOACCESS
, SPR_NOACCESS
,
2308 &spr_read_403_pbr
, &spr_write_403_pbr
,
2312 static void gen_spr_403_mmu (CPUPPCState
*env
)
2315 spr_register(env
, SPR_40x_PID
, "PID",
2316 SPR_NOACCESS
, SPR_NOACCESS
,
2317 &spr_read_generic
, &spr_write_generic
,
2319 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2320 SPR_NOACCESS
, SPR_NOACCESS
,
2321 &spr_read_generic
, &spr_write_generic
,
2325 /* SPR specific to PowerPC compression coprocessor extension */
2326 static void gen_spr_compress (CPUPPCState
*env
)
2328 /* XXX : not implemented */
2329 spr_register(env
, SPR_401_SKR
, "SKR",
2330 SPR_NOACCESS
, SPR_NOACCESS
,
2331 &spr_read_generic
, &spr_write_generic
,
2335 static void gen_spr_5xx_8xx (CPUPPCState
*env
)
2337 /* Exception processing */
2338 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
2339 SPR_NOACCESS
, SPR_NOACCESS
,
2340 &spr_read_generic
, &spr_write_generic
,
2341 KVM_REG_PPC_DSISR
, 0x00000000);
2342 spr_register_kvm(env
, SPR_DAR
, "DAR",
2343 SPR_NOACCESS
, SPR_NOACCESS
,
2344 &spr_read_generic
, &spr_write_generic
,
2345 KVM_REG_PPC_DAR
, 0x00000000);
2347 spr_register(env
, SPR_DECR
, "DECR",
2348 SPR_NOACCESS
, SPR_NOACCESS
,
2349 &spr_read_decr
, &spr_write_decr
,
2351 /* XXX : not implemented */
2352 spr_register(env
, SPR_MPC_EIE
, "EIE",
2353 SPR_NOACCESS
, SPR_NOACCESS
,
2354 &spr_read_generic
, &spr_write_generic
,
2356 /* XXX : not implemented */
2357 spr_register(env
, SPR_MPC_EID
, "EID",
2358 SPR_NOACCESS
, SPR_NOACCESS
,
2359 &spr_read_generic
, &spr_write_generic
,
2361 /* XXX : not implemented */
2362 spr_register(env
, SPR_MPC_NRI
, "NRI",
2363 SPR_NOACCESS
, SPR_NOACCESS
,
2364 &spr_read_generic
, &spr_write_generic
,
2366 /* XXX : not implemented */
2367 spr_register(env
, SPR_MPC_CMPA
, "CMPA",
2368 SPR_NOACCESS
, SPR_NOACCESS
,
2369 &spr_read_generic
, &spr_write_generic
,
2371 /* XXX : not implemented */
2372 spr_register(env
, SPR_MPC_CMPB
, "CMPB",
2373 SPR_NOACCESS
, SPR_NOACCESS
,
2374 &spr_read_generic
, &spr_write_generic
,
2376 /* XXX : not implemented */
2377 spr_register(env
, SPR_MPC_CMPC
, "CMPC",
2378 SPR_NOACCESS
, SPR_NOACCESS
,
2379 &spr_read_generic
, &spr_write_generic
,
2381 /* XXX : not implemented */
2382 spr_register(env
, SPR_MPC_CMPD
, "CMPD",
2383 SPR_NOACCESS
, SPR_NOACCESS
,
2384 &spr_read_generic
, &spr_write_generic
,
2386 /* XXX : not implemented */
2387 spr_register(env
, SPR_MPC_ECR
, "ECR",
2388 SPR_NOACCESS
, SPR_NOACCESS
,
2389 &spr_read_generic
, &spr_write_generic
,
2391 /* XXX : not implemented */
2392 spr_register(env
, SPR_MPC_DER
, "DER",
2393 SPR_NOACCESS
, SPR_NOACCESS
,
2394 &spr_read_generic
, &spr_write_generic
,
2396 /* XXX : not implemented */
2397 spr_register(env
, SPR_MPC_COUNTA
, "COUNTA",
2398 SPR_NOACCESS
, SPR_NOACCESS
,
2399 &spr_read_generic
, &spr_write_generic
,
2401 /* XXX : not implemented */
2402 spr_register(env
, SPR_MPC_COUNTB
, "COUNTB",
2403 SPR_NOACCESS
, SPR_NOACCESS
,
2404 &spr_read_generic
, &spr_write_generic
,
2406 /* XXX : not implemented */
2407 spr_register(env
, SPR_MPC_CMPE
, "CMPE",
2408 SPR_NOACCESS
, SPR_NOACCESS
,
2409 &spr_read_generic
, &spr_write_generic
,
2411 /* XXX : not implemented */
2412 spr_register(env
, SPR_MPC_CMPF
, "CMPF",
2413 SPR_NOACCESS
, SPR_NOACCESS
,
2414 &spr_read_generic
, &spr_write_generic
,
2416 /* XXX : not implemented */
2417 spr_register(env
, SPR_MPC_CMPG
, "CMPG",
2418 SPR_NOACCESS
, SPR_NOACCESS
,
2419 &spr_read_generic
, &spr_write_generic
,
2421 /* XXX : not implemented */
2422 spr_register(env
, SPR_MPC_CMPH
, "CMPH",
2423 SPR_NOACCESS
, SPR_NOACCESS
,
2424 &spr_read_generic
, &spr_write_generic
,
2426 /* XXX : not implemented */
2427 spr_register(env
, SPR_MPC_LCTRL1
, "LCTRL1",
2428 SPR_NOACCESS
, SPR_NOACCESS
,
2429 &spr_read_generic
, &spr_write_generic
,
2431 /* XXX : not implemented */
2432 spr_register(env
, SPR_MPC_LCTRL2
, "LCTRL2",
2433 SPR_NOACCESS
, SPR_NOACCESS
,
2434 &spr_read_generic
, &spr_write_generic
,
2436 /* XXX : not implemented */
2437 spr_register(env
, SPR_MPC_BAR
, "BAR",
2438 SPR_NOACCESS
, SPR_NOACCESS
,
2439 &spr_read_generic
, &spr_write_generic
,
2441 /* XXX : not implemented */
2442 spr_register(env
, SPR_MPC_DPDR
, "DPDR",
2443 SPR_NOACCESS
, SPR_NOACCESS
,
2444 &spr_read_generic
, &spr_write_generic
,
2446 /* XXX : not implemented */
2447 spr_register(env
, SPR_MPC_IMMR
, "IMMR",
2448 SPR_NOACCESS
, SPR_NOACCESS
,
2449 &spr_read_generic
, &spr_write_generic
,
2453 static void gen_spr_5xx (CPUPPCState
*env
)
2455 /* XXX : not implemented */
2456 spr_register(env
, SPR_RCPU_MI_GRA
, "MI_GRA",
2457 SPR_NOACCESS
, SPR_NOACCESS
,
2458 &spr_read_generic
, &spr_write_generic
,
2460 /* XXX : not implemented */
2461 spr_register(env
, SPR_RCPU_L2U_GRA
, "L2U_GRA",
2462 SPR_NOACCESS
, SPR_NOACCESS
,
2463 &spr_read_generic
, &spr_write_generic
,
2465 /* XXX : not implemented */
2466 spr_register(env
, SPR_RPCU_BBCMCR
, "L2U_BBCMCR",
2467 SPR_NOACCESS
, SPR_NOACCESS
,
2468 &spr_read_generic
, &spr_write_generic
,
2470 /* XXX : not implemented */
2471 spr_register(env
, SPR_RCPU_L2U_MCR
, "L2U_MCR",
2472 SPR_NOACCESS
, SPR_NOACCESS
,
2473 &spr_read_generic
, &spr_write_generic
,
2475 /* XXX : not implemented */
2476 spr_register(env
, SPR_RCPU_MI_RBA0
, "MI_RBA0",
2477 SPR_NOACCESS
, SPR_NOACCESS
,
2478 &spr_read_generic
, &spr_write_generic
,
2480 /* XXX : not implemented */
2481 spr_register(env
, SPR_RCPU_MI_RBA1
, "MI_RBA1",
2482 SPR_NOACCESS
, SPR_NOACCESS
,
2483 &spr_read_generic
, &spr_write_generic
,
2485 /* XXX : not implemented */
2486 spr_register(env
, SPR_RCPU_MI_RBA2
, "MI_RBA2",
2487 SPR_NOACCESS
, SPR_NOACCESS
,
2488 &spr_read_generic
, &spr_write_generic
,
2490 /* XXX : not implemented */
2491 spr_register(env
, SPR_RCPU_MI_RBA3
, "MI_RBA3",
2492 SPR_NOACCESS
, SPR_NOACCESS
,
2493 &spr_read_generic
, &spr_write_generic
,
2495 /* XXX : not implemented */
2496 spr_register(env
, SPR_RCPU_L2U_RBA0
, "L2U_RBA0",
2497 SPR_NOACCESS
, SPR_NOACCESS
,
2498 &spr_read_generic
, &spr_write_generic
,
2500 /* XXX : not implemented */
2501 spr_register(env
, SPR_RCPU_L2U_RBA1
, "L2U_RBA1",
2502 SPR_NOACCESS
, SPR_NOACCESS
,
2503 &spr_read_generic
, &spr_write_generic
,
2505 /* XXX : not implemented */
2506 spr_register(env
, SPR_RCPU_L2U_RBA2
, "L2U_RBA2",
2507 SPR_NOACCESS
, SPR_NOACCESS
,
2508 &spr_read_generic
, &spr_write_generic
,
2510 /* XXX : not implemented */
2511 spr_register(env
, SPR_RCPU_L2U_RBA3
, "L2U_RBA3",
2512 SPR_NOACCESS
, SPR_NOACCESS
,
2513 &spr_read_generic
, &spr_write_generic
,
2515 /* XXX : not implemented */
2516 spr_register(env
, SPR_RCPU_MI_RA0
, "MI_RA0",
2517 SPR_NOACCESS
, SPR_NOACCESS
,
2518 &spr_read_generic
, &spr_write_generic
,
2520 /* XXX : not implemented */
2521 spr_register(env
, SPR_RCPU_MI_RA1
, "MI_RA1",
2522 SPR_NOACCESS
, SPR_NOACCESS
,
2523 &spr_read_generic
, &spr_write_generic
,
2525 /* XXX : not implemented */
2526 spr_register(env
, SPR_RCPU_MI_RA2
, "MI_RA2",
2527 SPR_NOACCESS
, SPR_NOACCESS
,
2528 &spr_read_generic
, &spr_write_generic
,
2530 /* XXX : not implemented */
2531 spr_register(env
, SPR_RCPU_MI_RA3
, "MI_RA3",
2532 SPR_NOACCESS
, SPR_NOACCESS
,
2533 &spr_read_generic
, &spr_write_generic
,
2535 /* XXX : not implemented */
2536 spr_register(env
, SPR_RCPU_L2U_RA0
, "L2U_RA0",
2537 SPR_NOACCESS
, SPR_NOACCESS
,
2538 &spr_read_generic
, &spr_write_generic
,
2540 /* XXX : not implemented */
2541 spr_register(env
, SPR_RCPU_L2U_RA1
, "L2U_RA1",
2542 SPR_NOACCESS
, SPR_NOACCESS
,
2543 &spr_read_generic
, &spr_write_generic
,
2545 /* XXX : not implemented */
2546 spr_register(env
, SPR_RCPU_L2U_RA2
, "L2U_RA2",
2547 SPR_NOACCESS
, SPR_NOACCESS
,
2548 &spr_read_generic
, &spr_write_generic
,
2550 /* XXX : not implemented */
2551 spr_register(env
, SPR_RCPU_L2U_RA3
, "L2U_RA3",
2552 SPR_NOACCESS
, SPR_NOACCESS
,
2553 &spr_read_generic
, &spr_write_generic
,
2555 /* XXX : not implemented */
2556 spr_register(env
, SPR_RCPU_FPECR
, "FPECR",
2557 SPR_NOACCESS
, SPR_NOACCESS
,
2558 &spr_read_generic
, &spr_write_generic
,
2562 static void gen_spr_8xx (CPUPPCState
*env
)
2564 /* XXX : not implemented */
2565 spr_register(env
, SPR_MPC_IC_CST
, "IC_CST",
2566 SPR_NOACCESS
, SPR_NOACCESS
,
2567 &spr_read_generic
, &spr_write_generic
,
2569 /* XXX : not implemented */
2570 spr_register(env
, SPR_MPC_IC_ADR
, "IC_ADR",
2571 SPR_NOACCESS
, SPR_NOACCESS
,
2572 &spr_read_generic
, &spr_write_generic
,
2574 /* XXX : not implemented */
2575 spr_register(env
, SPR_MPC_IC_DAT
, "IC_DAT",
2576 SPR_NOACCESS
, SPR_NOACCESS
,
2577 &spr_read_generic
, &spr_write_generic
,
2579 /* XXX : not implemented */
2580 spr_register(env
, SPR_MPC_DC_CST
, "DC_CST",
2581 SPR_NOACCESS
, SPR_NOACCESS
,
2582 &spr_read_generic
, &spr_write_generic
,
2584 /* XXX : not implemented */
2585 spr_register(env
, SPR_MPC_DC_ADR
, "DC_ADR",
2586 SPR_NOACCESS
, SPR_NOACCESS
,
2587 &spr_read_generic
, &spr_write_generic
,
2589 /* XXX : not implemented */
2590 spr_register(env
, SPR_MPC_DC_DAT
, "DC_DAT",
2591 SPR_NOACCESS
, SPR_NOACCESS
,
2592 &spr_read_generic
, &spr_write_generic
,
2594 /* XXX : not implemented */
2595 spr_register(env
, SPR_MPC_MI_CTR
, "MI_CTR",
2596 SPR_NOACCESS
, SPR_NOACCESS
,
2597 &spr_read_generic
, &spr_write_generic
,
2599 /* XXX : not implemented */
2600 spr_register(env
, SPR_MPC_MI_AP
, "MI_AP",
2601 SPR_NOACCESS
, SPR_NOACCESS
,
2602 &spr_read_generic
, &spr_write_generic
,
2604 /* XXX : not implemented */
2605 spr_register(env
, SPR_MPC_MI_EPN
, "MI_EPN",
2606 SPR_NOACCESS
, SPR_NOACCESS
,
2607 &spr_read_generic
, &spr_write_generic
,
2609 /* XXX : not implemented */
2610 spr_register(env
, SPR_MPC_MI_TWC
, "MI_TWC",
2611 SPR_NOACCESS
, SPR_NOACCESS
,
2612 &spr_read_generic
, &spr_write_generic
,
2614 /* XXX : not implemented */
2615 spr_register(env
, SPR_MPC_MI_RPN
, "MI_RPN",
2616 SPR_NOACCESS
, SPR_NOACCESS
,
2617 &spr_read_generic
, &spr_write_generic
,
2619 /* XXX : not implemented */
2620 spr_register(env
, SPR_MPC_MI_DBCAM
, "MI_DBCAM",
2621 SPR_NOACCESS
, SPR_NOACCESS
,
2622 &spr_read_generic
, &spr_write_generic
,
2624 /* XXX : not implemented */
2625 spr_register(env
, SPR_MPC_MI_DBRAM0
, "MI_DBRAM0",
2626 SPR_NOACCESS
, SPR_NOACCESS
,
2627 &spr_read_generic
, &spr_write_generic
,
2629 /* XXX : not implemented */
2630 spr_register(env
, SPR_MPC_MI_DBRAM1
, "MI_DBRAM1",
2631 SPR_NOACCESS
, SPR_NOACCESS
,
2632 &spr_read_generic
, &spr_write_generic
,
2634 /* XXX : not implemented */
2635 spr_register(env
, SPR_MPC_MD_CTR
, "MD_CTR",
2636 SPR_NOACCESS
, SPR_NOACCESS
,
2637 &spr_read_generic
, &spr_write_generic
,
2639 /* XXX : not implemented */
2640 spr_register(env
, SPR_MPC_MD_CASID
, "MD_CASID",
2641 SPR_NOACCESS
, SPR_NOACCESS
,
2642 &spr_read_generic
, &spr_write_generic
,
2644 /* XXX : not implemented */
2645 spr_register(env
, SPR_MPC_MD_AP
, "MD_AP",
2646 SPR_NOACCESS
, SPR_NOACCESS
,
2647 &spr_read_generic
, &spr_write_generic
,
2649 /* XXX : not implemented */
2650 spr_register(env
, SPR_MPC_MD_EPN
, "MD_EPN",
2651 SPR_NOACCESS
, SPR_NOACCESS
,
2652 &spr_read_generic
, &spr_write_generic
,
2654 /* XXX : not implemented */
2655 spr_register(env
, SPR_MPC_MD_TWB
, "MD_TWB",
2656 SPR_NOACCESS
, SPR_NOACCESS
,
2657 &spr_read_generic
, &spr_write_generic
,
2659 /* XXX : not implemented */
2660 spr_register(env
, SPR_MPC_MD_TWC
, "MD_TWC",
2661 SPR_NOACCESS
, SPR_NOACCESS
,
2662 &spr_read_generic
, &spr_write_generic
,
2664 /* XXX : not implemented */
2665 spr_register(env
, SPR_MPC_MD_RPN
, "MD_RPN",
2666 SPR_NOACCESS
, SPR_NOACCESS
,
2667 &spr_read_generic
, &spr_write_generic
,
2669 /* XXX : not implemented */
2670 spr_register(env
, SPR_MPC_MD_TW
, "MD_TW",
2671 SPR_NOACCESS
, SPR_NOACCESS
,
2672 &spr_read_generic
, &spr_write_generic
,
2674 /* XXX : not implemented */
2675 spr_register(env
, SPR_MPC_MD_DBCAM
, "MD_DBCAM",
2676 SPR_NOACCESS
, SPR_NOACCESS
,
2677 &spr_read_generic
, &spr_write_generic
,
2679 /* XXX : not implemented */
2680 spr_register(env
, SPR_MPC_MD_DBRAM0
, "MD_DBRAM0",
2681 SPR_NOACCESS
, SPR_NOACCESS
,
2682 &spr_read_generic
, &spr_write_generic
,
2684 /* XXX : not implemented */
2685 spr_register(env
, SPR_MPC_MD_DBRAM1
, "MD_DBRAM1",
2686 SPR_NOACCESS
, SPR_NOACCESS
,
2687 &spr_read_generic
, &spr_write_generic
,
2693 * AMR => SPR 29 (Power 2.04)
2694 * CTRL => SPR 136 (Power 2.04)
2695 * CTRL => SPR 152 (Power 2.04)
2696 * SCOMC => SPR 276 (64 bits ?)
2697 * SCOMD => SPR 277 (64 bits ?)
2698 * TBU40 => SPR 286 (Power 2.04 hypv)
2699 * HSPRG0 => SPR 304 (Power 2.04 hypv)
2700 * HSPRG1 => SPR 305 (Power 2.04 hypv)
2701 * HDSISR => SPR 306 (Power 2.04 hypv)
2702 * HDAR => SPR 307 (Power 2.04 hypv)
2703 * PURR => SPR 309 (Power 2.04 hypv)
2704 * HDEC => SPR 310 (Power 2.04 hypv)
2705 * HIOR => SPR 311 (hypv)
2706 * RMOR => SPR 312 (970)
2707 * HRMOR => SPR 313 (Power 2.04 hypv)
2708 * HSRR0 => SPR 314 (Power 2.04 hypv)
2709 * HSRR1 => SPR 315 (Power 2.04 hypv)
2710 * LPIDR => SPR 317 (970)
2711 * EPR => SPR 702 (Power 2.04 emb)
2712 * perf => 768-783 (Power 2.04)
2713 * perf => 784-799 (Power 2.04)
2714 * PPR => SPR 896 (Power 2.04)
2715 * EPLC => SPR 947 (Power 2.04 emb)
2716 * EPSC => SPR 948 (Power 2.04 emb)
2717 * DABRX => 1015 (Power 2.04 hypv)
2718 * FPECR => SPR 1022 (?)
2719 * ... and more (thermal management, performance counters, ...)
2722 /*****************************************************************************/
2723 /* Exception vectors models */
2724 static void init_excp_4xx_real (CPUPPCState
*env
)
2726 #if !defined(CONFIG_USER_ONLY)
2727 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2728 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2729 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2730 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2731 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2732 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2733 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2734 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2735 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2736 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2737 env
->ivor_mask
= 0x0000FFF0UL
;
2738 env
->ivpr_mask
= 0xFFFF0000UL
;
2739 /* Hardware reset vector */
2740 env
->hreset_vector
= 0xFFFFFFFCUL
;
2744 static void init_excp_4xx_softmmu (CPUPPCState
*env
)
2746 #if !defined(CONFIG_USER_ONLY)
2747 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2748 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2749 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2750 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2751 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2752 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2753 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2754 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2755 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2756 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2757 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2758 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001100;
2759 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001200;
2760 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2761 env
->ivor_mask
= 0x0000FFF0UL
;
2762 env
->ivpr_mask
= 0xFFFF0000UL
;
2763 /* Hardware reset vector */
2764 env
->hreset_vector
= 0xFFFFFFFCUL
;
2768 static void init_excp_MPC5xx (CPUPPCState
*env
)
2770 #if !defined(CONFIG_USER_ONLY)
2771 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2772 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2773 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2774 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2775 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2776 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2777 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2778 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2779 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2780 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2781 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2782 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2783 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2784 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2785 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2786 env
->ivor_mask
= 0x0000FFF0UL
;
2787 env
->ivpr_mask
= 0xFFFF0000UL
;
2788 /* Hardware reset vector */
2789 env
->hreset_vector
= 0x00000100UL
;
2793 static void init_excp_MPC8xx (CPUPPCState
*env
)
2795 #if !defined(CONFIG_USER_ONLY)
2796 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2797 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2798 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2799 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2800 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2801 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2802 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2803 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2804 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2805 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2806 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2807 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2808 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2809 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001100;
2810 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001200;
2811 env
->excp_vectors
[POWERPC_EXCP_ITLBE
] = 0x00001300;
2812 env
->excp_vectors
[POWERPC_EXCP_DTLBE
] = 0x00001400;
2813 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2814 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2815 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2816 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2817 env
->ivor_mask
= 0x0000FFF0UL
;
2818 env
->ivpr_mask
= 0xFFFF0000UL
;
2819 /* Hardware reset vector */
2820 env
->hreset_vector
= 0x00000100UL
;
2824 static void init_excp_G2 (CPUPPCState
*env
)
2826 #if !defined(CONFIG_USER_ONLY)
2827 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2828 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2829 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2830 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2831 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2832 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2833 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2834 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2835 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2836 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000A00;
2837 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2838 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2839 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2840 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2841 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2842 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2843 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2844 /* Hardware reset vector */
2845 env
->hreset_vector
= 0x00000100UL
;
2849 static void init_excp_e200(CPUPPCState
*env
, target_ulong ivpr_mask
)
2851 #if !defined(CONFIG_USER_ONLY)
2852 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000FFC;
2853 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2854 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2855 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2856 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2857 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2858 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2859 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2860 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2861 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2862 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2863 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2864 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2865 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2866 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2867 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2868 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2869 env
->excp_vectors
[POWERPC_EXCP_SPEU
] = 0x00000000;
2870 env
->excp_vectors
[POWERPC_EXCP_EFPDI
] = 0x00000000;
2871 env
->excp_vectors
[POWERPC_EXCP_EFPRI
] = 0x00000000;
2872 env
->ivor_mask
= 0x0000FFF7UL
;
2873 env
->ivpr_mask
= ivpr_mask
;
2874 /* Hardware reset vector */
2875 env
->hreset_vector
= 0xFFFFFFFCUL
;
2879 static void init_excp_BookE (CPUPPCState
*env
)
2881 #if !defined(CONFIG_USER_ONLY)
2882 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2883 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2884 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2885 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2886 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2887 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2888 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2889 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2890 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2891 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2892 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2893 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2894 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2895 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2896 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2897 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2898 env
->ivor_mask
= 0x0000FFF0UL
;
2899 env
->ivpr_mask
= 0xFFFF0000UL
;
2900 /* Hardware reset vector */
2901 env
->hreset_vector
= 0xFFFFFFFCUL
;
2905 static void init_excp_601 (CPUPPCState
*env
)
2907 #if !defined(CONFIG_USER_ONLY)
2908 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2909 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2910 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2911 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2912 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2913 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2914 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2915 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2916 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2917 env
->excp_vectors
[POWERPC_EXCP_IO
] = 0x00000A00;
2918 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2919 env
->excp_vectors
[POWERPC_EXCP_RUNM
] = 0x00002000;
2920 /* Hardware reset vector */
2921 env
->hreset_vector
= 0x00000100UL
;
2925 static void init_excp_602 (CPUPPCState
*env
)
2927 #if !defined(CONFIG_USER_ONLY)
2928 /* XXX: exception prefix has a special behavior on 602 */
2929 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2930 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2931 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2932 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2933 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2934 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2935 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2936 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2937 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2938 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2939 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2940 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2941 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2942 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2943 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2944 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2945 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001500;
2946 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001600;
2947 /* Hardware reset vector */
2948 env
->hreset_vector
= 0x00000100UL
;
2952 static void init_excp_603 (CPUPPCState
*env
)
2954 #if !defined(CONFIG_USER_ONLY)
2955 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2956 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2957 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2958 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2959 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2960 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2961 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2962 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2963 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2964 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2965 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2966 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2967 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2968 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2969 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2970 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2971 /* Hardware reset vector */
2972 env
->hreset_vector
= 0x00000100UL
;
2976 static void init_excp_604 (CPUPPCState
*env
)
2978 #if !defined(CONFIG_USER_ONLY)
2979 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2980 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2981 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2982 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2983 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2984 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2985 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2986 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2987 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2988 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2989 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2990 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2991 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2992 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2993 /* Hardware reset vector */
2994 env
->hreset_vector
= 0x00000100UL
;
2998 static void init_excp_7x0 (CPUPPCState
*env
)
3000 #if !defined(CONFIG_USER_ONLY)
3001 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3002 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3003 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3004 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3005 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3006 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3007 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3008 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3009 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3010 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3011 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3012 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3013 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3014 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3015 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3016 /* Hardware reset vector */
3017 env
->hreset_vector
= 0x00000100UL
;
3021 static void init_excp_750cl (CPUPPCState
*env
)
3023 #if !defined(CONFIG_USER_ONLY)
3024 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3025 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3026 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3027 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3028 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3029 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3030 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3031 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3032 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3033 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3034 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3035 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3036 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3037 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3038 /* Hardware reset vector */
3039 env
->hreset_vector
= 0x00000100UL
;
3043 static void init_excp_750cx (CPUPPCState
*env
)
3045 #if !defined(CONFIG_USER_ONLY)
3046 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3047 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3048 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3049 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3050 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3051 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3052 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3053 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3054 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3055 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3056 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3057 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3058 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3059 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3060 /* Hardware reset vector */
3061 env
->hreset_vector
= 0x00000100UL
;
3065 /* XXX: Check if this is correct */
3066 static void init_excp_7x5 (CPUPPCState
*env
)
3068 #if !defined(CONFIG_USER_ONLY)
3069 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3070 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3071 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3072 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3073 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3074 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3075 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3076 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3077 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3078 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3079 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3080 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3081 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3082 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3083 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3084 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3085 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3086 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3087 /* Hardware reset vector */
3088 env
->hreset_vector
= 0x00000100UL
;
3092 static void init_excp_7400 (CPUPPCState
*env
)
3094 #if !defined(CONFIG_USER_ONLY)
3095 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3096 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3097 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3098 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3099 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3100 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3101 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3102 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3103 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3104 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3105 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3106 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3107 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3108 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3109 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3110 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3111 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3112 /* Hardware reset vector */
3113 env
->hreset_vector
= 0x00000100UL
;
3117 static void init_excp_7450 (CPUPPCState
*env
)
3119 #if !defined(CONFIG_USER_ONLY)
3120 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3121 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3122 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3123 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3124 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3125 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3126 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3127 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3128 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3129 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3130 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3131 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3132 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3133 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3134 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3135 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3136 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3137 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3138 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3139 /* Hardware reset vector */
3140 env
->hreset_vector
= 0x00000100UL
;
3144 #if defined (TARGET_PPC64)
3145 static void init_excp_970 (CPUPPCState
*env
)
3147 #if !defined(CONFIG_USER_ONLY)
3148 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3149 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3150 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3151 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3152 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3153 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3154 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3155 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3156 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3157 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3158 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3159 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3160 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3161 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3162 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3163 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3164 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3165 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
3166 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
3167 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
3168 /* Hardware reset vector */
3169 env
->hreset_vector
= 0x0000000000000100ULL
;
3173 static void init_excp_POWER7 (CPUPPCState
*env
)
3175 #if !defined(CONFIG_USER_ONLY)
3176 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3177 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3178 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3179 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3180 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3181 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3182 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3183 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3184 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3185 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3186 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3187 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3188 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3189 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3190 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3191 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3192 env
->excp_vectors
[POWERPC_EXCP_VSXU
] = 0x00000F40;
3193 env
->excp_vectors
[POWERPC_EXCP_FU
] = 0x00000F60;
3194 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3195 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
3196 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
3197 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
3198 /* Hardware reset vector */
3199 env
->hreset_vector
= 0x0000000000000100ULL
;
3204 /*****************************************************************************/
3205 /* Power management enable checks */
3206 static int check_pow_none (CPUPPCState
*env
)
3211 static int check_pow_nocheck (CPUPPCState
*env
)
3216 static int check_pow_hid0 (CPUPPCState
*env
)
3218 if (env
->spr
[SPR_HID0
] & 0x00E00000)
3224 static int check_pow_hid0_74xx (CPUPPCState
*env
)
3226 if (env
->spr
[SPR_HID0
] & 0x00600000)
3232 static bool ppc_cpu_interrupts_big_endian_always(PowerPCCPU
*cpu
)
3238 static bool ppc_cpu_interrupts_big_endian_lpcr(PowerPCCPU
*cpu
)
3240 return !(cpu
->env
.spr
[SPR_LPCR
] & LPCR_ILE
);
3244 /*****************************************************************************/
3245 /* PowerPC implementations definitions */
3247 #define POWERPC_FAMILY(_name) \
3249 glue(glue(ppc_, _name), _cpu_family_class_init)(ObjectClass *, void *); \
3251 static const TypeInfo \
3252 glue(glue(ppc_, _name), _cpu_family_type_info) = { \
3253 .name = stringify(_name) "-family-" TYPE_POWERPC_CPU, \
3254 .parent = TYPE_POWERPC_CPU, \
3256 .class_init = glue(glue(ppc_, _name), _cpu_family_class_init), \
3259 static void glue(glue(ppc_, _name), _cpu_family_register_types)(void) \
3261 type_register_static( \
3262 &glue(glue(ppc_, _name), _cpu_family_type_info)); \
3265 type_init(glue(glue(ppc_, _name), _cpu_family_register_types)) \
3267 static void glue(glue(ppc_, _name), _cpu_family_class_init)
3269 static void init_proc_401 (CPUPPCState
*env
)
3272 gen_spr_401_403(env
);
3274 init_excp_4xx_real(env
);
3275 env
->dcache_line_size
= 32;
3276 env
->icache_line_size
= 32;
3277 /* Allocate hardware IRQ controller */
3278 ppc40x_irq_init(env
);
3280 SET_FIT_PERIOD(12, 16, 20, 24);
3281 SET_WDT_PERIOD(16, 20, 24, 28);
3284 POWERPC_FAMILY(401)(ObjectClass
*oc
, void *data
)
3286 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3287 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3289 dc
->desc
= "PowerPC 401";
3290 pcc
->init_proc
= init_proc_401
;
3291 pcc
->check_pow
= check_pow_nocheck
;
3292 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3293 PPC_WRTEE
| PPC_DCR
|
3294 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3296 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3297 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3298 pcc
->msr_mask
= (1ull << MSR_KEY
) |
3307 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3308 pcc
->excp_model
= POWERPC_EXCP_40x
;
3309 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3310 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3311 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3312 POWERPC_FLAG_BUS_CLK
;
3315 static void init_proc_401x2 (CPUPPCState
*env
)
3318 gen_spr_401_403(env
);
3320 gen_spr_compress(env
);
3321 /* Memory management */
3322 #if !defined(CONFIG_USER_ONLY)
3326 env
->tlb_type
= TLB_EMB
;
3328 init_excp_4xx_softmmu(env
);
3329 env
->dcache_line_size
= 32;
3330 env
->icache_line_size
= 32;
3331 /* Allocate hardware IRQ controller */
3332 ppc40x_irq_init(env
);
3334 SET_FIT_PERIOD(12, 16, 20, 24);
3335 SET_WDT_PERIOD(16, 20, 24, 28);
3338 POWERPC_FAMILY(401x2
)(ObjectClass
*oc
, void *data
)
3340 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3341 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3343 dc
->desc
= "PowerPC 401x2";
3344 pcc
->init_proc
= init_proc_401x2
;
3345 pcc
->check_pow
= check_pow_nocheck
;
3346 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3347 PPC_DCR
| PPC_WRTEE
|
3348 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3349 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3350 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3351 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3352 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3353 pcc
->msr_mask
= (1ull << 20) |
3365 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3366 pcc
->excp_model
= POWERPC_EXCP_40x
;
3367 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3368 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3369 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3370 POWERPC_FLAG_BUS_CLK
;
3373 static void init_proc_401x3 (CPUPPCState
*env
)
3376 gen_spr_401_403(env
);
3379 gen_spr_compress(env
);
3380 init_excp_4xx_softmmu(env
);
3381 env
->dcache_line_size
= 32;
3382 env
->icache_line_size
= 32;
3383 /* Allocate hardware IRQ controller */
3384 ppc40x_irq_init(env
);
3386 SET_FIT_PERIOD(12, 16, 20, 24);
3387 SET_WDT_PERIOD(16, 20, 24, 28);
3390 POWERPC_FAMILY(401x3
)(ObjectClass
*oc
, void *data
)
3392 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3393 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3395 dc
->desc
= "PowerPC 401x3";
3396 pcc
->init_proc
= init_proc_401x3
;
3397 pcc
->check_pow
= check_pow_nocheck
;
3398 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3399 PPC_DCR
| PPC_WRTEE
|
3400 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3401 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3402 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3403 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3404 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3405 pcc
->msr_mask
= (1ull << 20) |
3418 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3419 pcc
->excp_model
= POWERPC_EXCP_40x
;
3420 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3421 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3422 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3423 POWERPC_FLAG_BUS_CLK
;
3426 static void init_proc_IOP480 (CPUPPCState
*env
)
3429 gen_spr_401_403(env
);
3431 gen_spr_compress(env
);
3432 /* Memory management */
3433 #if !defined(CONFIG_USER_ONLY)
3437 env
->tlb_type
= TLB_EMB
;
3439 init_excp_4xx_softmmu(env
);
3440 env
->dcache_line_size
= 32;
3441 env
->icache_line_size
= 32;
3442 /* Allocate hardware IRQ controller */
3443 ppc40x_irq_init(env
);
3445 SET_FIT_PERIOD(8, 12, 16, 20);
3446 SET_WDT_PERIOD(16, 20, 24, 28);
3449 POWERPC_FAMILY(IOP480
)(ObjectClass
*oc
, void *data
)
3451 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3452 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3454 dc
->desc
= "IOP480";
3455 pcc
->init_proc
= init_proc_IOP480
;
3456 pcc
->check_pow
= check_pow_nocheck
;
3457 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3458 PPC_DCR
| PPC_WRTEE
|
3459 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3460 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3461 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3462 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3463 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3464 pcc
->msr_mask
= (1ull << 20) |
3476 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3477 pcc
->excp_model
= POWERPC_EXCP_40x
;
3478 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3479 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3480 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3481 POWERPC_FLAG_BUS_CLK
;
3484 static void init_proc_403 (CPUPPCState
*env
)
3487 gen_spr_401_403(env
);
3489 gen_spr_403_real(env
);
3490 init_excp_4xx_real(env
);
3491 env
->dcache_line_size
= 32;
3492 env
->icache_line_size
= 32;
3493 /* Allocate hardware IRQ controller */
3494 ppc40x_irq_init(env
);
3496 SET_FIT_PERIOD(8, 12, 16, 20);
3497 SET_WDT_PERIOD(16, 20, 24, 28);
3500 POWERPC_FAMILY(403)(ObjectClass
*oc
, void *data
)
3502 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3503 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3505 dc
->desc
= "PowerPC 403";
3506 pcc
->init_proc
= init_proc_403
;
3507 pcc
->check_pow
= check_pow_nocheck
;
3508 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3509 PPC_DCR
| PPC_WRTEE
|
3510 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3512 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3513 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3514 pcc
->msr_mask
= (1ull << MSR_POW
) |
3523 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3524 pcc
->excp_model
= POWERPC_EXCP_40x
;
3525 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3526 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3527 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3528 POWERPC_FLAG_BUS_CLK
;
3531 static void init_proc_403GCX (CPUPPCState
*env
)
3534 gen_spr_401_403(env
);
3536 gen_spr_403_real(env
);
3537 gen_spr_403_mmu(env
);
3538 /* Bus access control */
3539 /* not emulated, as QEMU never does speculative access */
3540 spr_register(env
, SPR_40x_SGR
, "SGR",
3541 SPR_NOACCESS
, SPR_NOACCESS
,
3542 &spr_read_generic
, &spr_write_generic
,
3544 /* not emulated, as QEMU do not emulate caches */
3545 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3546 SPR_NOACCESS
, SPR_NOACCESS
,
3547 &spr_read_generic
, &spr_write_generic
,
3549 /* Memory management */
3550 #if !defined(CONFIG_USER_ONLY)
3554 env
->tlb_type
= TLB_EMB
;
3556 init_excp_4xx_softmmu(env
);
3557 env
->dcache_line_size
= 32;
3558 env
->icache_line_size
= 32;
3559 /* Allocate hardware IRQ controller */
3560 ppc40x_irq_init(env
);
3562 SET_FIT_PERIOD(8, 12, 16, 20);
3563 SET_WDT_PERIOD(16, 20, 24, 28);
3566 POWERPC_FAMILY(403GCX
)(ObjectClass
*oc
, void *data
)
3568 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3569 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3571 dc
->desc
= "PowerPC 403 GCX";
3572 pcc
->init_proc
= init_proc_403GCX
;
3573 pcc
->check_pow
= check_pow_nocheck
;
3574 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3575 PPC_DCR
| PPC_WRTEE
|
3576 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3578 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3579 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3580 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3581 pcc
->msr_mask
= (1ull << MSR_POW
) |
3590 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3591 pcc
->excp_model
= POWERPC_EXCP_40x
;
3592 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3593 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3594 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3595 POWERPC_FLAG_BUS_CLK
;
3598 static void init_proc_405 (CPUPPCState
*env
)
3604 /* Bus access control */
3605 /* not emulated, as QEMU never does speculative access */
3606 spr_register(env
, SPR_40x_SGR
, "SGR",
3607 SPR_NOACCESS
, SPR_NOACCESS
,
3608 &spr_read_generic
, &spr_write_generic
,
3610 /* not emulated, as QEMU do not emulate caches */
3611 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3612 SPR_NOACCESS
, SPR_NOACCESS
,
3613 &spr_read_generic
, &spr_write_generic
,
3615 /* Memory management */
3616 #if !defined(CONFIG_USER_ONLY)
3620 env
->tlb_type
= TLB_EMB
;
3622 init_excp_4xx_softmmu(env
);
3623 env
->dcache_line_size
= 32;
3624 env
->icache_line_size
= 32;
3625 /* Allocate hardware IRQ controller */
3626 ppc40x_irq_init(env
);
3628 SET_FIT_PERIOD(8, 12, 16, 20);
3629 SET_WDT_PERIOD(16, 20, 24, 28);
3632 POWERPC_FAMILY(405)(ObjectClass
*oc
, void *data
)
3634 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3635 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3637 dc
->desc
= "PowerPC 405";
3638 pcc
->init_proc
= init_proc_405
;
3639 pcc
->check_pow
= check_pow_nocheck
;
3640 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3641 PPC_DCR
| PPC_WRTEE
|
3642 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3643 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3644 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3645 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3646 PPC_4xx_COMMON
| PPC_405_MAC
| PPC_40x_EXCP
;
3647 pcc
->msr_mask
= (1ull << MSR_POW
) |
3656 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx
;
3657 pcc
->excp_model
= POWERPC_EXCP_40x
;
3658 pcc
->bus_model
= PPC_FLAGS_INPUT_405
;
3659 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3660 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3661 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3664 static void init_proc_440EP (CPUPPCState
*env
)
3668 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3670 gen_spr_usprgh(env
);
3671 /* Processor identification */
3672 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3673 SPR_NOACCESS
, SPR_NOACCESS
,
3674 &spr_read_generic
, &spr_write_pir
,
3676 /* XXX : not implemented */
3677 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3678 SPR_NOACCESS
, SPR_NOACCESS
,
3679 &spr_read_generic
, &spr_write_generic
,
3681 /* XXX : not implemented */
3682 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3683 SPR_NOACCESS
, SPR_NOACCESS
,
3684 &spr_read_generic
, &spr_write_generic
,
3686 /* XXX : not implemented */
3687 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3688 SPR_NOACCESS
, SPR_NOACCESS
,
3689 &spr_read_generic
, &spr_write_generic
,
3691 /* XXX : not implemented */
3692 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3693 SPR_NOACCESS
, SPR_NOACCESS
,
3694 &spr_read_generic
, &spr_write_generic
,
3696 /* XXX : not implemented */
3697 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3698 SPR_NOACCESS
, SPR_NOACCESS
,
3699 &spr_read_generic
, &spr_write_generic
,
3701 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3702 SPR_NOACCESS
, SPR_NOACCESS
,
3703 &spr_read_generic
, &spr_write_generic
,
3705 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3706 SPR_NOACCESS
, SPR_NOACCESS
,
3707 &spr_read_generic
, &spr_write_generic
,
3709 /* XXX : not implemented */
3710 spr_register(env
, SPR_440_CCR1
, "CCR1",
3711 SPR_NOACCESS
, SPR_NOACCESS
,
3712 &spr_read_generic
, &spr_write_generic
,
3714 /* Memory management */
3715 #if !defined(CONFIG_USER_ONLY)
3719 env
->tlb_type
= TLB_EMB
;
3721 init_excp_BookE(env
);
3722 env
->dcache_line_size
= 32;
3723 env
->icache_line_size
= 32;
3724 ppc40x_irq_init(env
);
3726 SET_FIT_PERIOD(12, 16, 20, 24);
3727 SET_WDT_PERIOD(20, 24, 28, 32);
3730 POWERPC_FAMILY(440EP
)(ObjectClass
*oc
, void *data
)
3732 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3733 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3735 dc
->desc
= "PowerPC 440 EP";
3736 pcc
->init_proc
= init_proc_440EP
;
3737 pcc
->check_pow
= check_pow_nocheck
;
3738 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3739 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
3740 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
3742 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
3743 PPC_CACHE
| PPC_CACHE_ICBI
|
3744 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3745 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3746 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3748 pcc
->msr_mask
= (1ull << MSR_POW
) |
3760 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3761 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3762 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3763 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3764 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3765 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3768 static void init_proc_440GP (CPUPPCState
*env
)
3772 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3774 gen_spr_usprgh(env
);
3775 /* Processor identification */
3776 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3777 SPR_NOACCESS
, SPR_NOACCESS
,
3778 &spr_read_generic
, &spr_write_pir
,
3780 /* XXX : not implemented */
3781 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3782 SPR_NOACCESS
, SPR_NOACCESS
,
3783 &spr_read_generic
, &spr_write_generic
,
3785 /* XXX : not implemented */
3786 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3787 SPR_NOACCESS
, SPR_NOACCESS
,
3788 &spr_read_generic
, &spr_write_generic
,
3790 /* XXX : not implemented */
3791 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3792 SPR_NOACCESS
, SPR_NOACCESS
,
3793 &spr_read_generic
, &spr_write_generic
,
3795 /* XXX : not implemented */
3796 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3797 SPR_NOACCESS
, SPR_NOACCESS
,
3798 &spr_read_generic
, &spr_write_generic
,
3800 /* Memory management */
3801 #if !defined(CONFIG_USER_ONLY)
3805 env
->tlb_type
= TLB_EMB
;
3807 init_excp_BookE(env
);
3808 env
->dcache_line_size
= 32;
3809 env
->icache_line_size
= 32;
3810 /* XXX: TODO: allocate internal IRQ controller */
3812 SET_FIT_PERIOD(12, 16, 20, 24);
3813 SET_WDT_PERIOD(20, 24, 28, 32);
3816 POWERPC_FAMILY(440GP
)(ObjectClass
*oc
, void *data
)
3818 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3819 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3821 dc
->desc
= "PowerPC 440 GP";
3822 pcc
->init_proc
= init_proc_440GP
;
3823 pcc
->check_pow
= check_pow_nocheck
;
3824 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3825 PPC_DCR
| PPC_DCRX
| PPC_WRTEE
| PPC_MFAPIDI
|
3826 PPC_CACHE
| PPC_CACHE_ICBI
|
3827 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3828 PPC_MEM_TLBSYNC
| PPC_TLBIVA
| PPC_MFTB
|
3829 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3831 pcc
->msr_mask
= (1ull << MSR_POW
) |
3843 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3844 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3845 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3846 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3847 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3848 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3851 static void init_proc_440x4 (CPUPPCState
*env
)
3855 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3857 gen_spr_usprgh(env
);
3858 /* Processor identification */
3859 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3860 SPR_NOACCESS
, SPR_NOACCESS
,
3861 &spr_read_generic
, &spr_write_pir
,
3863 /* XXX : not implemented */
3864 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3865 SPR_NOACCESS
, SPR_NOACCESS
,
3866 &spr_read_generic
, &spr_write_generic
,
3868 /* XXX : not implemented */
3869 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3870 SPR_NOACCESS
, SPR_NOACCESS
,
3871 &spr_read_generic
, &spr_write_generic
,
3873 /* XXX : not implemented */
3874 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3875 SPR_NOACCESS
, SPR_NOACCESS
,
3876 &spr_read_generic
, &spr_write_generic
,
3878 /* XXX : not implemented */
3879 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3880 SPR_NOACCESS
, SPR_NOACCESS
,
3881 &spr_read_generic
, &spr_write_generic
,
3883 /* Memory management */
3884 #if !defined(CONFIG_USER_ONLY)
3888 env
->tlb_type
= TLB_EMB
;
3890 init_excp_BookE(env
);
3891 env
->dcache_line_size
= 32;
3892 env
->icache_line_size
= 32;
3893 /* XXX: TODO: allocate internal IRQ controller */
3895 SET_FIT_PERIOD(12, 16, 20, 24);
3896 SET_WDT_PERIOD(20, 24, 28, 32);
3899 POWERPC_FAMILY(440x4
)(ObjectClass
*oc
, void *data
)
3901 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3902 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3904 dc
->desc
= "PowerPC 440x4";
3905 pcc
->init_proc
= init_proc_440x4
;
3906 pcc
->check_pow
= check_pow_nocheck
;
3907 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3908 PPC_DCR
| PPC_WRTEE
|
3909 PPC_CACHE
| PPC_CACHE_ICBI
|
3910 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3911 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3912 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3914 pcc
->msr_mask
= (1ull << MSR_POW
) |
3926 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3927 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3928 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3929 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3930 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3931 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3934 static void init_proc_440x5 (CPUPPCState
*env
)
3938 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3940 gen_spr_usprgh(env
);
3941 /* Processor identification */
3942 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3943 SPR_NOACCESS
, SPR_NOACCESS
,
3944 &spr_read_generic
, &spr_write_pir
,
3946 /* XXX : not implemented */
3947 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3948 SPR_NOACCESS
, SPR_NOACCESS
,
3949 &spr_read_generic
, &spr_write_generic
,
3951 /* XXX : not implemented */
3952 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3953 SPR_NOACCESS
, SPR_NOACCESS
,
3954 &spr_read_generic
, &spr_write_generic
,
3956 /* XXX : not implemented */
3957 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3958 SPR_NOACCESS
, SPR_NOACCESS
,
3959 &spr_read_generic
, &spr_write_generic
,
3961 /* XXX : not implemented */
3962 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3963 SPR_NOACCESS
, SPR_NOACCESS
,
3964 &spr_read_generic
, &spr_write_generic
,
3966 /* XXX : not implemented */
3967 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3968 SPR_NOACCESS
, SPR_NOACCESS
,
3969 &spr_read_generic
, &spr_write_generic
,
3971 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3972 SPR_NOACCESS
, SPR_NOACCESS
,
3973 &spr_read_generic
, &spr_write_generic
,
3975 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3976 SPR_NOACCESS
, SPR_NOACCESS
,
3977 &spr_read_generic
, &spr_write_generic
,
3979 /* XXX : not implemented */
3980 spr_register(env
, SPR_440_CCR1
, "CCR1",
3981 SPR_NOACCESS
, SPR_NOACCESS
,
3982 &spr_read_generic
, &spr_write_generic
,
3984 /* Memory management */
3985 #if !defined(CONFIG_USER_ONLY)
3989 env
->tlb_type
= TLB_EMB
;
3991 init_excp_BookE(env
);
3992 env
->dcache_line_size
= 32;
3993 env
->icache_line_size
= 32;
3994 ppc40x_irq_init(env
);
3996 SET_FIT_PERIOD(12, 16, 20, 24);
3997 SET_WDT_PERIOD(20, 24, 28, 32);
4000 POWERPC_FAMILY(440x5
)(ObjectClass
*oc
, void *data
)
4002 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4003 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4005 dc
->desc
= "PowerPC 440x5";
4006 pcc
->init_proc
= init_proc_440x5
;
4007 pcc
->check_pow
= check_pow_nocheck
;
4008 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4009 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
4010 PPC_CACHE
| PPC_CACHE_ICBI
|
4011 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4012 PPC_MEM_TLBSYNC
| PPC_MFTB
|
4013 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4015 pcc
->msr_mask
= (1ull << MSR_POW
) |
4027 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4028 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4029 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4030 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4031 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4032 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4035 POWERPC_FAMILY(440x5wDFPU
)(ObjectClass
*oc
, void *data
)
4037 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4038 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4040 dc
->desc
= "PowerPC 440x5 with double precision FPU";
4041 pcc
->init_proc
= init_proc_440x5
;
4042 pcc
->check_pow
= check_pow_nocheck
;
4043 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4044 PPC_FLOAT
| PPC_FLOAT_FSQRT
|
4046 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
4047 PPC_CACHE
| PPC_CACHE_ICBI
|
4048 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4049 PPC_MEM_TLBSYNC
| PPC_MFTB
|
4050 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4052 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
4053 pcc
->msr_mask
= (1ull << MSR_POW
) |
4065 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4066 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4067 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4068 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4069 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4070 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4073 static void init_proc_460 (CPUPPCState
*env
)
4077 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4079 gen_spr_usprgh(env
);
4080 /* Processor identification */
4081 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4082 SPR_NOACCESS
, SPR_NOACCESS
,
4083 &spr_read_generic
, &spr_write_pir
,
4085 /* XXX : not implemented */
4086 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4087 SPR_NOACCESS
, SPR_NOACCESS
,
4088 &spr_read_generic
, &spr_write_generic
,
4090 /* XXX : not implemented */
4091 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4092 SPR_NOACCESS
, SPR_NOACCESS
,
4093 &spr_read_generic
, &spr_write_generic
,
4095 /* XXX : not implemented */
4096 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4097 SPR_NOACCESS
, SPR_NOACCESS
,
4098 &spr_read_generic
, &spr_write_generic
,
4100 /* XXX : not implemented */
4101 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4102 SPR_NOACCESS
, SPR_NOACCESS
,
4103 &spr_read_generic
, &spr_write_generic
,
4105 /* XXX : not implemented */
4106 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4107 SPR_NOACCESS
, SPR_NOACCESS
,
4108 &spr_read_generic
, &spr_write_generic
,
4110 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4111 SPR_NOACCESS
, SPR_NOACCESS
,
4112 &spr_read_generic
, &spr_write_generic
,
4114 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4115 SPR_NOACCESS
, SPR_NOACCESS
,
4116 &spr_read_generic
, &spr_write_generic
,
4118 /* XXX : not implemented */
4119 spr_register(env
, SPR_440_CCR1
, "CCR1",
4120 SPR_NOACCESS
, SPR_NOACCESS
,
4121 &spr_read_generic
, &spr_write_generic
,
4123 /* XXX : not implemented */
4124 spr_register(env
, SPR_DCRIPR
, "SPR_DCRIPR",
4125 &spr_read_generic
, &spr_write_generic
,
4126 &spr_read_generic
, &spr_write_generic
,
4128 /* Memory management */
4129 #if !defined(CONFIG_USER_ONLY)
4133 env
->tlb_type
= TLB_EMB
;
4135 init_excp_BookE(env
);
4136 env
->dcache_line_size
= 32;
4137 env
->icache_line_size
= 32;
4138 /* XXX: TODO: allocate internal IRQ controller */
4140 SET_FIT_PERIOD(12, 16, 20, 24);
4141 SET_WDT_PERIOD(20, 24, 28, 32);
4144 POWERPC_FAMILY(460)(ObjectClass
*oc
, void *data
)
4146 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4147 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4149 dc
->desc
= "PowerPC 460 (guessed)";
4150 pcc
->init_proc
= init_proc_460
;
4151 pcc
->check_pow
= check_pow_nocheck
;
4152 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4153 PPC_DCR
| PPC_DCRX
| PPC_DCRUX
|
4154 PPC_WRTEE
| PPC_MFAPIDI
| PPC_MFTB
|
4155 PPC_CACHE
| PPC_CACHE_ICBI
|
4156 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4157 PPC_MEM_TLBSYNC
| PPC_TLBIVA
|
4158 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4160 pcc
->msr_mask
= (1ull << MSR_POW
) |
4172 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4173 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4174 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4175 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4176 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4177 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4180 static void init_proc_460F (CPUPPCState
*env
)
4184 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4186 gen_spr_usprgh(env
);
4187 /* Processor identification */
4188 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4189 SPR_NOACCESS
, SPR_NOACCESS
,
4190 &spr_read_generic
, &spr_write_pir
,
4192 /* XXX : not implemented */
4193 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4194 SPR_NOACCESS
, SPR_NOACCESS
,
4195 &spr_read_generic
, &spr_write_generic
,
4197 /* XXX : not implemented */
4198 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4199 SPR_NOACCESS
, SPR_NOACCESS
,
4200 &spr_read_generic
, &spr_write_generic
,
4202 /* XXX : not implemented */
4203 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4204 SPR_NOACCESS
, SPR_NOACCESS
,
4205 &spr_read_generic
, &spr_write_generic
,
4207 /* XXX : not implemented */
4208 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4209 SPR_NOACCESS
, SPR_NOACCESS
,
4210 &spr_read_generic
, &spr_write_generic
,
4212 /* XXX : not implemented */
4213 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4214 SPR_NOACCESS
, SPR_NOACCESS
,
4215 &spr_read_generic
, &spr_write_generic
,
4217 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4218 SPR_NOACCESS
, SPR_NOACCESS
,
4219 &spr_read_generic
, &spr_write_generic
,
4221 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4222 SPR_NOACCESS
, SPR_NOACCESS
,
4223 &spr_read_generic
, &spr_write_generic
,
4225 /* XXX : not implemented */
4226 spr_register(env
, SPR_440_CCR1
, "CCR1",
4227 SPR_NOACCESS
, SPR_NOACCESS
,
4228 &spr_read_generic
, &spr_write_generic
,
4230 /* XXX : not implemented */
4231 spr_register(env
, SPR_DCRIPR
, "SPR_DCRIPR",
4232 &spr_read_generic
, &spr_write_generic
,
4233 &spr_read_generic
, &spr_write_generic
,
4235 /* Memory management */
4236 #if !defined(CONFIG_USER_ONLY)
4240 env
->tlb_type
= TLB_EMB
;
4242 init_excp_BookE(env
);
4243 env
->dcache_line_size
= 32;
4244 env
->icache_line_size
= 32;
4245 /* XXX: TODO: allocate internal IRQ controller */
4247 SET_FIT_PERIOD(12, 16, 20, 24);
4248 SET_WDT_PERIOD(20, 24, 28, 32);
4251 POWERPC_FAMILY(460F
)(ObjectClass
*oc
, void *data
)
4253 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4254 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4256 dc
->desc
= "PowerPC 460F (guessed)";
4257 pcc
->init_proc
= init_proc_460F
;
4258 pcc
->check_pow
= check_pow_nocheck
;
4259 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4260 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
4261 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
4262 PPC_FLOAT_STFIWX
| PPC_MFTB
|
4263 PPC_DCR
| PPC_DCRX
| PPC_DCRUX
|
4264 PPC_WRTEE
| PPC_MFAPIDI
|
4265 PPC_CACHE
| PPC_CACHE_ICBI
|
4266 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4267 PPC_MEM_TLBSYNC
| PPC_TLBIVA
|
4268 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4270 pcc
->msr_mask
= (1ull << MSR_POW
) |
4282 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4283 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4284 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4285 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4286 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4287 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4290 static void init_proc_MPC5xx (CPUPPCState
*env
)
4294 gen_spr_5xx_8xx(env
);
4296 init_excp_MPC5xx(env
);
4297 env
->dcache_line_size
= 32;
4298 env
->icache_line_size
= 32;
4299 /* XXX: TODO: allocate internal IRQ controller */
4302 POWERPC_FAMILY(MPC5xx
)(ObjectClass
*oc
, void *data
)
4304 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4305 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4307 dc
->desc
= "Freescale 5xx cores (aka RCPU)";
4308 pcc
->init_proc
= init_proc_MPC5xx
;
4309 pcc
->check_pow
= check_pow_none
;
4310 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4311 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4312 PPC_CACHE_ICBI
| PPC_FLOAT
| PPC_FLOAT_STFIWX
|
4314 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4326 pcc
->mmu_model
= POWERPC_MMU_REAL
;
4327 pcc
->excp_model
= POWERPC_EXCP_603
;
4328 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4329 pcc
->bfd_mach
= bfd_mach_ppc_505
;
4330 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4331 POWERPC_FLAG_BUS_CLK
;
4334 static void init_proc_MPC8xx (CPUPPCState
*env
)
4338 gen_spr_5xx_8xx(env
);
4340 init_excp_MPC8xx(env
);
4341 env
->dcache_line_size
= 32;
4342 env
->icache_line_size
= 32;
4343 /* XXX: TODO: allocate internal IRQ controller */
4346 POWERPC_FAMILY(MPC8xx
)(ObjectClass
*oc
, void *data
)
4348 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4349 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4351 dc
->desc
= "Freescale 8xx cores (aka PowerQUICC)";
4352 pcc
->init_proc
= init_proc_MPC8xx
;
4353 pcc
->check_pow
= check_pow_none
;
4354 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4355 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4356 PPC_CACHE_ICBI
| PPC_MFTB
;
4357 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4369 pcc
->mmu_model
= POWERPC_MMU_MPC8xx
;
4370 pcc
->excp_model
= POWERPC_EXCP_603
;
4371 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4372 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4373 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4374 POWERPC_FLAG_BUS_CLK
;
4377 /* Freescale 82xx cores (aka PowerQUICC-II) */
4379 static void init_proc_G2 (CPUPPCState
*env
)
4381 gen_spr_ne_601(env
);
4382 gen_spr_G2_755(env
);
4386 /* External access control */
4387 /* XXX : not implemented */
4388 spr_register(env
, SPR_EAR
, "EAR",
4389 SPR_NOACCESS
, SPR_NOACCESS
,
4390 &spr_read_generic
, &spr_write_generic
,
4392 /* Hardware implementation register */
4393 /* XXX : not implemented */
4394 spr_register(env
, SPR_HID0
, "HID0",
4395 SPR_NOACCESS
, SPR_NOACCESS
,
4396 &spr_read_generic
, &spr_write_generic
,
4398 /* XXX : not implemented */
4399 spr_register(env
, SPR_HID1
, "HID1",
4400 SPR_NOACCESS
, SPR_NOACCESS
,
4401 &spr_read_generic
, &spr_write_generic
,
4403 /* XXX : not implemented */
4404 spr_register(env
, SPR_HID2
, "HID2",
4405 SPR_NOACCESS
, SPR_NOACCESS
,
4406 &spr_read_generic
, &spr_write_generic
,
4408 /* Memory management */
4411 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4413 env
->dcache_line_size
= 32;
4414 env
->icache_line_size
= 32;
4415 /* Allocate hardware IRQ controller */
4416 ppc6xx_irq_init(env
);
4419 POWERPC_FAMILY(G2
)(ObjectClass
*oc
, void *data
)
4421 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4422 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4424 dc
->desc
= "PowerPC G2";
4425 pcc
->init_proc
= init_proc_G2
;
4426 pcc
->check_pow
= check_pow_hid0
;
4427 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4428 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4430 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4431 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4432 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4433 PPC_SEGMENT
| PPC_EXTERN
;
4434 pcc
->msr_mask
= (1ull << MSR_POW
) |
4435 (1ull << MSR_TGPR
) |
4449 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4450 pcc
->excp_model
= POWERPC_EXCP_G2
;
4451 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4452 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4453 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4454 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4457 static void init_proc_G2LE (CPUPPCState
*env
)
4459 gen_spr_ne_601(env
);
4460 gen_spr_G2_755(env
);
4464 /* External access control */
4465 /* XXX : not implemented */
4466 spr_register(env
, SPR_EAR
, "EAR",
4467 SPR_NOACCESS
, SPR_NOACCESS
,
4468 &spr_read_generic
, &spr_write_generic
,
4470 /* Hardware implementation register */
4471 /* XXX : not implemented */
4472 spr_register(env
, SPR_HID0
, "HID0",
4473 SPR_NOACCESS
, SPR_NOACCESS
,
4474 &spr_read_generic
, &spr_write_generic
,
4476 /* XXX : not implemented */
4477 spr_register(env
, SPR_HID1
, "HID1",
4478 SPR_NOACCESS
, SPR_NOACCESS
,
4479 &spr_read_generic
, &spr_write_generic
,
4481 /* XXX : not implemented */
4482 spr_register(env
, SPR_HID2
, "HID2",
4483 SPR_NOACCESS
, SPR_NOACCESS
,
4484 &spr_read_generic
, &spr_write_generic
,
4487 /* Memory management */
4490 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4492 env
->dcache_line_size
= 32;
4493 env
->icache_line_size
= 32;
4494 /* Allocate hardware IRQ controller */
4495 ppc6xx_irq_init(env
);
4498 POWERPC_FAMILY(G2LE
)(ObjectClass
*oc
, void *data
)
4500 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4501 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4503 dc
->desc
= "PowerPC G2LE";
4504 pcc
->init_proc
= init_proc_G2LE
;
4505 pcc
->check_pow
= check_pow_hid0
;
4506 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4507 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4509 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4510 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4511 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4512 PPC_SEGMENT
| PPC_EXTERN
;
4513 pcc
->msr_mask
= (1ull << MSR_POW
) |
4514 (1ull << MSR_TGPR
) |
4530 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4531 pcc
->excp_model
= POWERPC_EXCP_G2
;
4532 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4533 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4534 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4535 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4538 static void init_proc_e200 (CPUPPCState
*env
)
4542 gen_spr_BookE(env
, 0x000000070000FFFFULL
);
4543 /* XXX : not implemented */
4544 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4545 &spr_read_spefscr
, &spr_write_spefscr
,
4546 &spr_read_spefscr
, &spr_write_spefscr
,
4548 /* Memory management */
4549 gen_spr_BookE206(env
, 0x0000005D, NULL
);
4550 /* XXX : not implemented */
4551 spr_register(env
, SPR_HID0
, "HID0",
4552 SPR_NOACCESS
, SPR_NOACCESS
,
4553 &spr_read_generic
, &spr_write_generic
,
4555 /* XXX : not implemented */
4556 spr_register(env
, SPR_HID1
, "HID1",
4557 SPR_NOACCESS
, SPR_NOACCESS
,
4558 &spr_read_generic
, &spr_write_generic
,
4560 /* XXX : not implemented */
4561 spr_register(env
, SPR_Exxx_ALTCTXCR
, "ALTCTXCR",
4562 SPR_NOACCESS
, SPR_NOACCESS
,
4563 &spr_read_generic
, &spr_write_generic
,
4565 /* XXX : not implemented */
4566 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4567 SPR_NOACCESS
, SPR_NOACCESS
,
4568 &spr_read_generic
, &spr_write_generic
,
4570 /* XXX : not implemented */
4571 spr_register(env
, SPR_Exxx_CTXCR
, "CTXCR",
4572 SPR_NOACCESS
, SPR_NOACCESS
,
4573 &spr_read_generic
, &spr_write_generic
,
4575 /* XXX : not implemented */
4576 spr_register(env
, SPR_Exxx_DBCNT
, "DBCNT",
4577 SPR_NOACCESS
, SPR_NOACCESS
,
4578 &spr_read_generic
, &spr_write_generic
,
4580 /* XXX : not implemented */
4581 spr_register(env
, SPR_Exxx_DBCR3
, "DBCR3",
4582 SPR_NOACCESS
, SPR_NOACCESS
,
4583 &spr_read_generic
, &spr_write_generic
,
4585 /* XXX : not implemented */
4586 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4587 &spr_read_generic
, SPR_NOACCESS
,
4588 &spr_read_generic
, SPR_NOACCESS
,
4590 /* XXX : not implemented */
4591 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4592 SPR_NOACCESS
, SPR_NOACCESS
,
4593 &spr_read_generic
, &spr_write_generic
,
4595 /* XXX : not implemented */
4596 spr_register(env
, SPR_Exxx_L1FINV0
, "L1FINV0",
4597 SPR_NOACCESS
, SPR_NOACCESS
,
4598 &spr_read_generic
, &spr_write_generic
,
4600 /* XXX : not implemented */
4601 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
4602 SPR_NOACCESS
, SPR_NOACCESS
,
4603 &spr_read_generic
, &spr_write_generic
,
4605 /* XXX : not implemented */
4606 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
4607 SPR_NOACCESS
, SPR_NOACCESS
,
4608 &spr_read_generic
, &spr_write_generic
,
4610 /* XXX : not implemented */
4611 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4612 SPR_NOACCESS
, SPR_NOACCESS
,
4613 &spr_read_generic
, &spr_write_generic
,
4615 /* XXX : not implemented */
4616 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4617 SPR_NOACCESS
, SPR_NOACCESS
,
4618 &spr_read_generic
, &spr_write_generic
,
4620 /* XXX : not implemented */
4621 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4622 SPR_NOACCESS
, SPR_NOACCESS
,
4623 &spr_read_generic
, &spr_write_generic
,
4624 0x00000000); /* TOFIX */
4625 spr_register(env
, SPR_BOOKE_DSRR0
, "DSRR0",
4626 SPR_NOACCESS
, SPR_NOACCESS
,
4627 &spr_read_generic
, &spr_write_generic
,
4629 spr_register(env
, SPR_BOOKE_DSRR1
, "DSRR1",
4630 SPR_NOACCESS
, SPR_NOACCESS
,
4631 &spr_read_generic
, &spr_write_generic
,
4633 #if !defined(CONFIG_USER_ONLY)
4637 env
->tlb_type
= TLB_EMB
;
4639 init_excp_e200(env
, 0xFFFF0000UL
);
4640 env
->dcache_line_size
= 32;
4641 env
->icache_line_size
= 32;
4642 /* XXX: TODO: allocate internal IRQ controller */
4645 POWERPC_FAMILY(e200
)(ObjectClass
*oc
, void *data
)
4647 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4648 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4650 dc
->desc
= "e200 core";
4651 pcc
->init_proc
= init_proc_e200
;
4652 pcc
->check_pow
= check_pow_hid0
;
4653 /* XXX: unimplemented instructions:
4660 * all SPE multiply-accumulate instructions
4662 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4663 PPC_SPE
| PPC_SPE_SINGLE
|
4664 PPC_WRTEE
| PPC_RFDI
|
4665 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4666 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4667 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
|
4669 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4683 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4684 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4685 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4686 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4687 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4688 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4689 POWERPC_FLAG_BUS_CLK
;
4692 static void init_proc_e300 (CPUPPCState
*env
)
4694 gen_spr_ne_601(env
);
4698 /* hardware implementation registers */
4699 /* XXX : not implemented */
4700 spr_register(env
, SPR_HID0
, "HID0",
4701 SPR_NOACCESS
, SPR_NOACCESS
,
4702 &spr_read_generic
, &spr_write_generic
,
4704 /* XXX : not implemented */
4705 spr_register(env
, SPR_HID1
, "HID1",
4706 SPR_NOACCESS
, SPR_NOACCESS
,
4707 &spr_read_generic
, &spr_write_generic
,
4709 /* XXX : not implemented */
4710 spr_register(env
, SPR_HID2
, "HID2",
4711 SPR_NOACCESS
, SPR_NOACCESS
,
4712 &spr_read_generic
, &spr_write_generic
,
4715 /* XXX : not implemented */
4716 spr_register(env
, SPR_DABR
, "DABR",
4717 SPR_NOACCESS
, SPR_NOACCESS
,
4718 &spr_read_generic
, &spr_write_generic
,
4720 /* XXX : not implemented */
4721 spr_register(env
, SPR_DABR2
, "DABR2",
4722 SPR_NOACCESS
, SPR_NOACCESS
,
4723 &spr_read_generic
, &spr_write_generic
,
4725 /* XXX : not implemented */
4726 spr_register(env
, SPR_IABR2
, "IABR2",
4727 SPR_NOACCESS
, SPR_NOACCESS
,
4728 &spr_read_generic
, &spr_write_generic
,
4730 /* XXX : not implemented */
4731 spr_register(env
, SPR_IBCR
, "IBCR",
4732 SPR_NOACCESS
, SPR_NOACCESS
,
4733 &spr_read_generic
, &spr_write_generic
,
4735 /* XXX : not implemented */
4736 spr_register(env
, SPR_DBCR
, "DBCR",
4737 SPR_NOACCESS
, SPR_NOACCESS
,
4738 &spr_read_generic
, &spr_write_generic
,
4740 /* Memory management */
4743 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4745 env
->dcache_line_size
= 32;
4746 env
->icache_line_size
= 32;
4747 /* Allocate hardware IRQ controller */
4748 ppc6xx_irq_init(env
);
4751 POWERPC_FAMILY(e300
)(ObjectClass
*oc
, void *data
)
4753 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4754 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4756 dc
->desc
= "e300 core";
4757 pcc
->init_proc
= init_proc_e300
;
4758 pcc
->check_pow
= check_pow_hid0
;
4759 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4760 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4762 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4763 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4764 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4765 PPC_SEGMENT
| PPC_EXTERN
;
4766 pcc
->msr_mask
= (1ull << MSR_POW
) |
4767 (1ull << MSR_TGPR
) |
4783 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4784 pcc
->excp_model
= POWERPC_EXCP_603
;
4785 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4786 pcc
->bfd_mach
= bfd_mach_ppc_603
;
4787 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4788 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4791 #if !defined(CONFIG_USER_ONLY)
4792 static void spr_write_mas73(DisasContext
*ctx
, int sprn
, int gprn
)
4794 TCGv val
= tcg_temp_new();
4795 tcg_gen_ext32u_tl(val
, cpu_gpr
[gprn
]);
4796 gen_store_spr(SPR_BOOKE_MAS3
, val
);
4797 tcg_gen_shri_tl(val
, cpu_gpr
[gprn
], 32);
4798 gen_store_spr(SPR_BOOKE_MAS7
, val
);
4802 static void spr_read_mas73(DisasContext
*ctx
, int gprn
, int sprn
)
4804 TCGv mas7
= tcg_temp_new();
4805 TCGv mas3
= tcg_temp_new();
4806 gen_load_spr(mas7
, SPR_BOOKE_MAS7
);
4807 tcg_gen_shli_tl(mas7
, mas7
, 32);
4808 gen_load_spr(mas3
, SPR_BOOKE_MAS3
);
4809 tcg_gen_or_tl(cpu_gpr
[gprn
], mas3
, mas7
);
4810 tcg_temp_free(mas3
);
4811 tcg_temp_free(mas7
);
4816 enum fsl_e500_version
{
4823 static void init_proc_e500 (CPUPPCState
*env
, int version
)
4825 PowerPCCPU
*cpu
= ppc_env_get_cpu(env
);
4826 uint32_t tlbncfg
[2];
4828 uint64_t ivpr_mask
= 0xFFFF0000ULL
;
4829 uint32_t l1cfg0
= 0x3800 /* 8 ways */
4830 | 0x0020; /* 32 kb */
4831 uint32_t l1cfg1
= 0x3800 /* 8 ways */
4832 | 0x0020; /* 32 kb */
4833 #if !defined(CONFIG_USER_ONLY)
4840 * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't
4841 * complain when accessing them.
4842 * gen_spr_BookE(env, 0x0000000F0000FD7FULL);
4848 ivor_mask
= 0x0000000F0000FFFFULL
;
4852 ivor_mask
= 0x000003FE0000FFFFULL
;
4855 gen_spr_BookE(env
, ivor_mask
);
4856 /* Processor identification */
4857 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4858 SPR_NOACCESS
, SPR_NOACCESS
,
4859 &spr_read_generic
, &spr_write_pir
,
4861 /* XXX : not implemented */
4862 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4863 &spr_read_spefscr
, &spr_write_spefscr
,
4864 &spr_read_spefscr
, &spr_write_spefscr
,
4866 #if !defined(CONFIG_USER_ONLY)
4867 /* Memory management */
4873 tlbncfg
[0] = gen_tlbncfg(2, 1, 1, 0, 256);
4874 tlbncfg
[1] = gen_tlbncfg(16, 1, 9, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4877 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4878 tlbncfg
[1] = gen_tlbncfg(16, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4882 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4883 tlbncfg
[1] = gen_tlbncfg(64, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 64);
4886 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4893 env
->dcache_line_size
= 32;
4894 env
->icache_line_size
= 32;
4898 env
->dcache_line_size
= 64;
4899 env
->icache_line_size
= 64;
4900 l1cfg0
|= 0x1000000; /* 64 byte cache block size */
4901 l1cfg1
|= 0x1000000; /* 64 byte cache block size */
4904 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4906 gen_spr_BookE206(env
, 0x000000DF, tlbncfg
);
4907 /* XXX : not implemented */
4908 spr_register(env
, SPR_HID0
, "HID0",
4909 SPR_NOACCESS
, SPR_NOACCESS
,
4910 &spr_read_generic
, &spr_write_generic
,
4912 /* XXX : not implemented */
4913 spr_register(env
, SPR_HID1
, "HID1",
4914 SPR_NOACCESS
, SPR_NOACCESS
,
4915 &spr_read_generic
, &spr_write_generic
,
4917 /* XXX : not implemented */
4918 spr_register(env
, SPR_Exxx_BBEAR
, "BBEAR",
4919 SPR_NOACCESS
, SPR_NOACCESS
,
4920 &spr_read_generic
, &spr_write_generic
,
4922 /* XXX : not implemented */
4923 spr_register(env
, SPR_Exxx_BBTAR
, "BBTAR",
4924 SPR_NOACCESS
, SPR_NOACCESS
,
4925 &spr_read_generic
, &spr_write_generic
,
4927 /* XXX : not implemented */
4928 spr_register(env
, SPR_Exxx_MCAR
, "MCAR",
4929 SPR_NOACCESS
, SPR_NOACCESS
,
4930 &spr_read_generic
, &spr_write_generic
,
4932 /* XXX : not implemented */
4933 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4934 SPR_NOACCESS
, SPR_NOACCESS
,
4935 &spr_read_generic
, &spr_write_generic
,
4937 /* XXX : not implemented */
4938 spr_register(env
, SPR_Exxx_NPIDR
, "NPIDR",
4939 SPR_NOACCESS
, SPR_NOACCESS
,
4940 &spr_read_generic
, &spr_write_generic
,
4942 /* XXX : not implemented */
4943 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4944 SPR_NOACCESS
, SPR_NOACCESS
,
4945 &spr_read_generic
, &spr_write_generic
,
4947 /* XXX : not implemented */
4948 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4949 &spr_read_generic
, SPR_NOACCESS
,
4950 &spr_read_generic
, SPR_NOACCESS
,
4952 spr_register(env
, SPR_Exxx_L1CFG1
, "L1CFG1",
4953 &spr_read_generic
, SPR_NOACCESS
,
4954 &spr_read_generic
, SPR_NOACCESS
,
4956 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4957 SPR_NOACCESS
, SPR_NOACCESS
,
4958 &spr_read_generic
, &spr_write_e500_l1csr0
,
4960 spr_register(env
, SPR_Exxx_L1CSR1
, "L1CSR1",
4961 SPR_NOACCESS
, SPR_NOACCESS
,
4962 &spr_read_generic
, &spr_write_e500_l1csr1
,
4964 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4965 SPR_NOACCESS
, SPR_NOACCESS
,
4966 &spr_read_generic
, &spr_write_generic
,
4968 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4969 SPR_NOACCESS
, SPR_NOACCESS
,
4970 &spr_read_generic
, &spr_write_generic
,
4972 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4973 SPR_NOACCESS
, SPR_NOACCESS
,
4974 &spr_read_generic
, &spr_write_booke206_mmucsr0
,
4976 spr_register(env
, SPR_BOOKE_EPR
, "EPR",
4977 SPR_NOACCESS
, SPR_NOACCESS
,
4978 &spr_read_generic
, SPR_NOACCESS
,
4980 /* XXX better abstract into Emb.xxx features */
4981 if (version
== fsl_e5500
) {
4982 spr_register(env
, SPR_BOOKE_EPCR
, "EPCR",
4983 SPR_NOACCESS
, SPR_NOACCESS
,
4984 &spr_read_generic
, &spr_write_generic
,
4986 spr_register(env
, SPR_BOOKE_MAS7_MAS3
, "MAS7_MAS3",
4987 SPR_NOACCESS
, SPR_NOACCESS
,
4988 &spr_read_mas73
, &spr_write_mas73
,
4990 ivpr_mask
= (target_ulong
)~0xFFFFULL
;
4993 #if !defined(CONFIG_USER_ONLY)
4995 env
->tlb_type
= TLB_MAS
;
4996 for (i
= 0; i
< BOOKE206_MAX_TLBN
; i
++) {
4997 env
->nb_tlb
+= booke206_tlb_size(env
, i
);
5001 init_excp_e200(env
, ivpr_mask
);
5002 /* Allocate hardware IRQ controller */
5003 ppce500_irq_init(env
);
5006 static void init_proc_e500v1(CPUPPCState
*env
)
5008 init_proc_e500(env
, fsl_e500v1
);
5011 POWERPC_FAMILY(e500v1
)(ObjectClass
*oc
, void *data
)
5013 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5014 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5016 dc
->desc
= "e500v1 core";
5017 pcc
->init_proc
= init_proc_e500v1
;
5018 pcc
->check_pow
= check_pow_hid0
;
5019 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5020 PPC_SPE
| PPC_SPE_SINGLE
|
5021 PPC_WRTEE
| PPC_RFDI
|
5022 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5023 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5024 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5025 pcc
->insns_flags2
= PPC2_BOOKE206
;
5026 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
5040 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5041 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5042 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5043 pcc
->bfd_mach
= bfd_mach_ppc_860
;
5044 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
5045 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
5046 POWERPC_FLAG_BUS_CLK
;
5049 static void init_proc_e500v2(CPUPPCState
*env
)
5051 init_proc_e500(env
, fsl_e500v2
);
5054 POWERPC_FAMILY(e500v2
)(ObjectClass
*oc
, void *data
)
5056 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5057 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5059 dc
->desc
= "e500v2 core";
5060 pcc
->init_proc
= init_proc_e500v2
;
5061 pcc
->check_pow
= check_pow_hid0
;
5062 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5063 PPC_SPE
| PPC_SPE_SINGLE
| PPC_SPE_DOUBLE
|
5064 PPC_WRTEE
| PPC_RFDI
|
5065 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5066 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5067 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5068 pcc
->insns_flags2
= PPC2_BOOKE206
;
5069 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
5083 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5084 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5085 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5086 pcc
->bfd_mach
= bfd_mach_ppc_860
;
5087 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
5088 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
5089 POWERPC_FLAG_BUS_CLK
;
5092 static void init_proc_e500mc(CPUPPCState
*env
)
5094 init_proc_e500(env
, fsl_e500mc
);
5097 POWERPC_FAMILY(e500mc
)(ObjectClass
*oc
, void *data
)
5099 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5100 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5102 dc
->desc
= "e500mc core";
5103 pcc
->init_proc
= init_proc_e500mc
;
5104 pcc
->check_pow
= check_pow_none
;
5105 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5106 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5107 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5108 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5109 PPC_FLOAT
| PPC_FLOAT_FRES
|
5110 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5111 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5112 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5113 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
;
5114 pcc
->msr_mask
= (1ull << MSR_GS
) |
5115 (1ull << MSR_UCLE
) |
5128 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5129 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5130 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5131 /* FIXME: figure out the correct flag for e500mc */
5132 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5133 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5134 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5138 static void init_proc_e5500(CPUPPCState
*env
)
5140 init_proc_e500(env
, fsl_e5500
);
5143 POWERPC_FAMILY(e5500
)(ObjectClass
*oc
, void *data
)
5145 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5146 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5148 dc
->desc
= "e5500 core";
5149 pcc
->init_proc
= init_proc_e5500
;
5150 pcc
->check_pow
= check_pow_none
;
5151 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5152 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5153 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5154 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5155 PPC_FLOAT
| PPC_FLOAT_FRES
|
5156 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5157 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5158 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
5159 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
;
5160 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
| \
5162 pcc
->msr_mask
= (1ull << MSR_CM
) |
5164 (1ull << MSR_UCLE
) |
5177 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5178 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5179 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5180 /* FIXME: figure out the correct flag for e5500 */
5181 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5182 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5183 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5187 /* Non-embedded PowerPC */
5189 /* POWER : same as 601, without mfmsr, mfsr */
5190 POWERPC_FAMILY(POWER
)(ObjectClass
*oc
, void *data
)
5192 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5193 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5196 /* pcc->insns_flags = XXX_TODO; */
5197 /* POWER RSC (from RAD6000) */
5198 pcc
->msr_mask
= (1ull << MSR_EE
) |
5211 #define POWERPC_MSRR_601 (0x0000000000001040ULL)
5213 static void init_proc_601 (CPUPPCState
*env
)
5215 gen_spr_ne_601(env
);
5217 /* Hardware implementation registers */
5218 /* XXX : not implemented */
5219 spr_register(env
, SPR_HID0
, "HID0",
5220 SPR_NOACCESS
, SPR_NOACCESS
,
5221 &spr_read_generic
, &spr_write_hid0_601
,
5223 /* XXX : not implemented */
5224 spr_register(env
, SPR_HID1
, "HID1",
5225 SPR_NOACCESS
, SPR_NOACCESS
,
5226 &spr_read_generic
, &spr_write_generic
,
5228 /* XXX : not implemented */
5229 spr_register(env
, SPR_601_HID2
, "HID2",
5230 SPR_NOACCESS
, SPR_NOACCESS
,
5231 &spr_read_generic
, &spr_write_generic
,
5233 /* XXX : not implemented */
5234 spr_register(env
, SPR_601_HID5
, "HID5",
5235 SPR_NOACCESS
, SPR_NOACCESS
,
5236 &spr_read_generic
, &spr_write_generic
,
5238 /* Memory management */
5240 /* XXX: beware that dcache line size is 64
5241 * but dcbz uses 32 bytes "sectors"
5242 * XXX: this breaks clcs instruction !
5244 env
->dcache_line_size
= 32;
5245 env
->icache_line_size
= 64;
5246 /* Allocate hardware IRQ controller */
5247 ppc6xx_irq_init(env
);
5250 POWERPC_FAMILY(601)(ObjectClass
*oc
, void *data
)
5252 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5253 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5255 dc
->desc
= "PowerPC 601";
5256 pcc
->init_proc
= init_proc_601
;
5257 pcc
->check_pow
= check_pow_none
;
5258 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5260 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5261 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5262 PPC_SEGMENT
| PPC_EXTERN
;
5263 pcc
->msr_mask
= (1ull << MSR_EE
) |
5273 pcc
->mmu_model
= POWERPC_MMU_601
;
5274 #if defined(CONFIG_SOFTMMU)
5275 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5277 pcc
->excp_model
= POWERPC_EXCP_601
;
5278 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5279 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5280 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5283 #define POWERPC_MSRR_601v (0x0000000000001040ULL)
5285 static void init_proc_601v (CPUPPCState
*env
)
5288 /* XXX : not implemented */
5289 spr_register(env
, SPR_601_HID15
, "HID15",
5290 SPR_NOACCESS
, SPR_NOACCESS
,
5291 &spr_read_generic
, &spr_write_generic
,
5295 POWERPC_FAMILY(601v
)(ObjectClass
*oc
, void *data
)
5297 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5298 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5300 dc
->desc
= "PowerPC 601v";
5301 pcc
->init_proc
= init_proc_601v
;
5302 pcc
->check_pow
= check_pow_none
;
5303 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5305 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5306 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5307 PPC_SEGMENT
| PPC_EXTERN
;
5308 pcc
->msr_mask
= (1ull << MSR_EE
) |
5318 pcc
->mmu_model
= POWERPC_MMU_601
;
5319 #if defined(CONFIG_SOFTMMU)
5320 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5322 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5323 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5324 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5327 static void init_proc_602 (CPUPPCState
*env
)
5329 gen_spr_ne_601(env
);
5333 /* hardware implementation registers */
5334 /* XXX : not implemented */
5335 spr_register(env
, SPR_HID0
, "HID0",
5336 SPR_NOACCESS
, SPR_NOACCESS
,
5337 &spr_read_generic
, &spr_write_generic
,
5339 /* XXX : not implemented */
5340 spr_register(env
, SPR_HID1
, "HID1",
5341 SPR_NOACCESS
, SPR_NOACCESS
,
5342 &spr_read_generic
, &spr_write_generic
,
5344 /* Memory management */
5346 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5348 env
->dcache_line_size
= 32;
5349 env
->icache_line_size
= 32;
5350 /* Allocate hardware IRQ controller */
5351 ppc6xx_irq_init(env
);
5354 POWERPC_FAMILY(602)(ObjectClass
*oc
, void *data
)
5356 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5357 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5359 dc
->desc
= "PowerPC 602";
5360 pcc
->init_proc
= init_proc_602
;
5361 pcc
->check_pow
= check_pow_hid0
;
5362 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5363 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5364 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5365 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5366 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5367 PPC_MEM_TLBIE
| PPC_6xx_TLB
| PPC_MEM_TLBSYNC
|
5368 PPC_SEGMENT
| PPC_602_SPEC
;
5369 pcc
->msr_mask
= (1ull << MSR_VSX
) |
5372 (1ull << MSR_TGPR
) |
5387 /* XXX: 602 MMU is quite specific. Should add a special case */
5388 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5389 pcc
->excp_model
= POWERPC_EXCP_602
;
5390 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5391 pcc
->bfd_mach
= bfd_mach_ppc_602
;
5392 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5393 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5396 static void init_proc_603 (CPUPPCState
*env
)
5398 gen_spr_ne_601(env
);
5402 /* hardware implementation registers */
5403 /* XXX : not implemented */
5404 spr_register(env
, SPR_HID0
, "HID0",
5405 SPR_NOACCESS
, SPR_NOACCESS
,
5406 &spr_read_generic
, &spr_write_generic
,
5408 /* XXX : not implemented */
5409 spr_register(env
, SPR_HID1
, "HID1",
5410 SPR_NOACCESS
, SPR_NOACCESS
,
5411 &spr_read_generic
, &spr_write_generic
,
5413 /* Memory management */
5415 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5417 env
->dcache_line_size
= 32;
5418 env
->icache_line_size
= 32;
5419 /* Allocate hardware IRQ controller */
5420 ppc6xx_irq_init(env
);
5423 POWERPC_FAMILY(603)(ObjectClass
*oc
, void *data
)
5425 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5426 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5428 dc
->desc
= "PowerPC 603";
5429 pcc
->init_proc
= init_proc_603
;
5430 pcc
->check_pow
= check_pow_hid0
;
5431 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5432 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5433 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5434 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5435 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5436 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5437 PPC_SEGMENT
| PPC_EXTERN
;
5438 pcc
->msr_mask
= (1ull << MSR_POW
) |
5439 (1ull << MSR_TGPR
) |
5454 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5455 pcc
->excp_model
= POWERPC_EXCP_603
;
5456 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5457 pcc
->bfd_mach
= bfd_mach_ppc_603
;
5458 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5459 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5462 static void init_proc_603E (CPUPPCState
*env
)
5464 gen_spr_ne_601(env
);
5468 /* hardware implementation registers */
5469 /* XXX : not implemented */
5470 spr_register(env
, SPR_HID0
, "HID0",
5471 SPR_NOACCESS
, SPR_NOACCESS
,
5472 &spr_read_generic
, &spr_write_generic
,
5474 /* XXX : not implemented */
5475 spr_register(env
, SPR_HID1
, "HID1",
5476 SPR_NOACCESS
, SPR_NOACCESS
,
5477 &spr_read_generic
, &spr_write_generic
,
5479 /* Memory management */
5481 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5483 env
->dcache_line_size
= 32;
5484 env
->icache_line_size
= 32;
5485 /* Allocate hardware IRQ controller */
5486 ppc6xx_irq_init(env
);
5489 POWERPC_FAMILY(603E
)(ObjectClass
*oc
, void *data
)
5491 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5492 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5494 dc
->desc
= "PowerPC 603e";
5495 pcc
->init_proc
= init_proc_603E
;
5496 pcc
->check_pow
= check_pow_hid0
;
5497 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5498 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5499 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5500 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5501 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5502 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5503 PPC_SEGMENT
| PPC_EXTERN
;
5504 pcc
->msr_mask
= (1ull << MSR_POW
) |
5505 (1ull << MSR_TGPR
) |
5520 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5521 pcc
->excp_model
= POWERPC_EXCP_603E
;
5522 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5523 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
5524 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5525 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5528 static void init_proc_604 (CPUPPCState
*env
)
5530 gen_spr_ne_601(env
);
5534 /* Hardware implementation registers */
5535 /* XXX : not implemented */
5536 spr_register(env
, SPR_HID0
, "HID0",
5537 SPR_NOACCESS
, SPR_NOACCESS
,
5538 &spr_read_generic
, &spr_write_generic
,
5540 /* Memory management */
5543 env
->dcache_line_size
= 32;
5544 env
->icache_line_size
= 32;
5545 /* Allocate hardware IRQ controller */
5546 ppc6xx_irq_init(env
);
5549 POWERPC_FAMILY(604)(ObjectClass
*oc
, void *data
)
5551 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5552 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5554 dc
->desc
= "PowerPC 604";
5555 pcc
->init_proc
= init_proc_604
;
5556 pcc
->check_pow
= check_pow_nocheck
;
5557 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5558 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5559 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5560 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5561 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5562 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5563 PPC_SEGMENT
| PPC_EXTERN
;
5564 pcc
->msr_mask
= (1ull << MSR_POW
) |
5580 pcc
->mmu_model
= POWERPC_MMU_32B
;
5581 #if defined(CONFIG_SOFTMMU)
5582 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5584 pcc
->excp_model
= POWERPC_EXCP_604
;
5585 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5586 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5587 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5588 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5591 static void init_proc_604E (CPUPPCState
*env
)
5593 gen_spr_ne_601(env
);
5595 /* XXX : not implemented */
5596 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
5597 SPR_NOACCESS
, SPR_NOACCESS
,
5598 &spr_read_generic
, &spr_write_generic
,
5600 /* XXX : not implemented */
5601 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
5602 SPR_NOACCESS
, SPR_NOACCESS
,
5603 &spr_read_generic
, &spr_write_generic
,
5605 /* XXX : not implemented */
5606 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
5607 SPR_NOACCESS
, SPR_NOACCESS
,
5608 &spr_read_generic
, &spr_write_generic
,
5612 /* Hardware implementation registers */
5613 /* XXX : not implemented */
5614 spr_register(env
, SPR_HID0
, "HID0",
5615 SPR_NOACCESS
, SPR_NOACCESS
,
5616 &spr_read_generic
, &spr_write_generic
,
5618 /* XXX : not implemented */
5619 spr_register(env
, SPR_HID1
, "HID1",
5620 SPR_NOACCESS
, SPR_NOACCESS
,
5621 &spr_read_generic
, &spr_write_generic
,
5623 /* Memory management */
5626 env
->dcache_line_size
= 32;
5627 env
->icache_line_size
= 32;
5628 /* Allocate hardware IRQ controller */
5629 ppc6xx_irq_init(env
);
5632 POWERPC_FAMILY(604E
)(ObjectClass
*oc
, void *data
)
5634 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5635 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5637 dc
->desc
= "PowerPC 604E";
5638 pcc
->init_proc
= init_proc_604E
;
5639 pcc
->check_pow
= check_pow_nocheck
;
5640 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5641 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5642 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5643 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5644 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5645 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5646 PPC_SEGMENT
| PPC_EXTERN
;
5647 pcc
->msr_mask
= (1ull << MSR_POW
) |
5663 pcc
->mmu_model
= POWERPC_MMU_32B
;
5664 #if defined(CONFIG_SOFTMMU)
5665 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5667 pcc
->excp_model
= POWERPC_EXCP_604
;
5668 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5669 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5670 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5671 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5674 static void init_proc_740 (CPUPPCState
*env
)
5676 gen_spr_ne_601(env
);
5680 /* Thermal management */
5682 /* Hardware implementation registers */
5683 /* XXX : not implemented */
5684 spr_register(env
, SPR_HID0
, "HID0",
5685 SPR_NOACCESS
, SPR_NOACCESS
,
5686 &spr_read_generic
, &spr_write_generic
,
5688 /* XXX : not implemented */
5689 spr_register(env
, SPR_HID1
, "HID1",
5690 SPR_NOACCESS
, SPR_NOACCESS
,
5691 &spr_read_generic
, &spr_write_generic
,
5693 /* Memory management */
5696 env
->dcache_line_size
= 32;
5697 env
->icache_line_size
= 32;
5698 /* Allocate hardware IRQ controller */
5699 ppc6xx_irq_init(env
);
5702 POWERPC_FAMILY(740)(ObjectClass
*oc
, void *data
)
5704 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5705 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5707 dc
->desc
= "PowerPC 740";
5708 pcc
->init_proc
= init_proc_740
;
5709 pcc
->check_pow
= check_pow_hid0
;
5710 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5711 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5712 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5713 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5714 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5715 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5716 PPC_SEGMENT
| PPC_EXTERN
;
5717 pcc
->msr_mask
= (1ull << MSR_POW
) |
5733 pcc
->mmu_model
= POWERPC_MMU_32B
;
5734 #if defined(CONFIG_SOFTMMU)
5735 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5737 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5738 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5739 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5740 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5741 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5744 static void init_proc_750 (CPUPPCState
*env
)
5746 gen_spr_ne_601(env
);
5748 /* XXX : not implemented */
5749 spr_register(env
, SPR_L2CR
, "L2CR",
5750 SPR_NOACCESS
, SPR_NOACCESS
,
5751 &spr_read_generic
, spr_access_nop
,
5755 /* Thermal management */
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 /* Memory management */
5770 /* XXX: high BATs are also present but are known to be bugged on
5774 env
->dcache_line_size
= 32;
5775 env
->icache_line_size
= 32;
5776 /* Allocate hardware IRQ controller */
5777 ppc6xx_irq_init(env
);
5780 POWERPC_FAMILY(750)(ObjectClass
*oc
, void *data
)
5782 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5783 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5785 dc
->desc
= "PowerPC 750";
5786 pcc
->init_proc
= init_proc_750
;
5787 pcc
->check_pow
= check_pow_hid0
;
5788 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5789 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5790 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5791 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5792 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5793 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5794 PPC_SEGMENT
| PPC_EXTERN
;
5795 pcc
->msr_mask
= (1ull << MSR_POW
) |
5811 pcc
->mmu_model
= POWERPC_MMU_32B
;
5812 #if defined(CONFIG_SOFTMMU)
5813 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5815 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5816 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5817 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5818 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5819 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5822 static void init_proc_750cl (CPUPPCState
*env
)
5824 gen_spr_ne_601(env
);
5826 /* XXX : not implemented */
5827 spr_register(env
, SPR_L2CR
, "L2CR",
5828 SPR_NOACCESS
, SPR_NOACCESS
,
5829 &spr_read_generic
, spr_access_nop
,
5833 /* Thermal management */
5834 /* Those registers are fake on 750CL */
5835 spr_register(env
, SPR_THRM1
, "THRM1",
5836 SPR_NOACCESS
, SPR_NOACCESS
,
5837 &spr_read_generic
, &spr_write_generic
,
5839 spr_register(env
, SPR_THRM2
, "THRM2",
5840 SPR_NOACCESS
, SPR_NOACCESS
,
5841 &spr_read_generic
, &spr_write_generic
,
5843 spr_register(env
, SPR_THRM3
, "THRM3",
5844 SPR_NOACCESS
, SPR_NOACCESS
,
5845 &spr_read_generic
, &spr_write_generic
,
5847 /* XXX: not implemented */
5848 spr_register(env
, SPR_750_TDCL
, "TDCL",
5849 SPR_NOACCESS
, SPR_NOACCESS
,
5850 &spr_read_generic
, &spr_write_generic
,
5852 spr_register(env
, SPR_750_TDCH
, "TDCH",
5853 SPR_NOACCESS
, SPR_NOACCESS
,
5854 &spr_read_generic
, &spr_write_generic
,
5857 /* XXX : not implemented */
5858 spr_register(env
, SPR_750_WPAR
, "WPAR",
5859 SPR_NOACCESS
, SPR_NOACCESS
,
5860 &spr_read_generic
, &spr_write_generic
,
5862 spr_register(env
, SPR_750_DMAL
, "DMAL",
5863 SPR_NOACCESS
, SPR_NOACCESS
,
5864 &spr_read_generic
, &spr_write_generic
,
5866 spr_register(env
, SPR_750_DMAU
, "DMAU",
5867 SPR_NOACCESS
, SPR_NOACCESS
,
5868 &spr_read_generic
, &spr_write_generic
,
5870 /* Hardware implementation registers */
5871 /* XXX : not implemented */
5872 spr_register(env
, SPR_HID0
, "HID0",
5873 SPR_NOACCESS
, SPR_NOACCESS
,
5874 &spr_read_generic
, &spr_write_generic
,
5876 /* XXX : not implemented */
5877 spr_register(env
, SPR_HID1
, "HID1",
5878 SPR_NOACCESS
, SPR_NOACCESS
,
5879 &spr_read_generic
, &spr_write_generic
,
5881 /* XXX : not implemented */
5882 spr_register(env
, SPR_750CL_HID2
, "HID2",
5883 SPR_NOACCESS
, SPR_NOACCESS
,
5884 &spr_read_generic
, &spr_write_generic
,
5886 /* XXX : not implemented */
5887 spr_register(env
, SPR_750CL_HID4
, "HID4",
5888 SPR_NOACCESS
, SPR_NOACCESS
,
5889 &spr_read_generic
, &spr_write_generic
,
5891 /* Quantization registers */
5892 /* XXX : not implemented */
5893 spr_register(env
, SPR_750_GQR0
, "GQR0",
5894 SPR_NOACCESS
, SPR_NOACCESS
,
5895 &spr_read_generic
, &spr_write_generic
,
5897 /* XXX : not implemented */
5898 spr_register(env
, SPR_750_GQR1
, "GQR1",
5899 SPR_NOACCESS
, SPR_NOACCESS
,
5900 &spr_read_generic
, &spr_write_generic
,
5902 /* XXX : not implemented */
5903 spr_register(env
, SPR_750_GQR2
, "GQR2",
5904 SPR_NOACCESS
, SPR_NOACCESS
,
5905 &spr_read_generic
, &spr_write_generic
,
5907 /* XXX : not implemented */
5908 spr_register(env
, SPR_750_GQR3
, "GQR3",
5909 SPR_NOACCESS
, SPR_NOACCESS
,
5910 &spr_read_generic
, &spr_write_generic
,
5912 /* XXX : not implemented */
5913 spr_register(env
, SPR_750_GQR4
, "GQR4",
5914 SPR_NOACCESS
, SPR_NOACCESS
,
5915 &spr_read_generic
, &spr_write_generic
,
5917 /* XXX : not implemented */
5918 spr_register(env
, SPR_750_GQR5
, "GQR5",
5919 SPR_NOACCESS
, SPR_NOACCESS
,
5920 &spr_read_generic
, &spr_write_generic
,
5922 /* XXX : not implemented */
5923 spr_register(env
, SPR_750_GQR6
, "GQR6",
5924 SPR_NOACCESS
, SPR_NOACCESS
,
5925 &spr_read_generic
, &spr_write_generic
,
5927 /* XXX : not implemented */
5928 spr_register(env
, SPR_750_GQR7
, "GQR7",
5929 SPR_NOACCESS
, SPR_NOACCESS
,
5930 &spr_read_generic
, &spr_write_generic
,
5932 /* Memory management */
5934 /* PowerPC 750cl has 8 DBATs and 8 IBATs */
5936 init_excp_750cl(env
);
5937 env
->dcache_line_size
= 32;
5938 env
->icache_line_size
= 32;
5939 /* Allocate hardware IRQ controller */
5940 ppc6xx_irq_init(env
);
5943 POWERPC_FAMILY(750cl
)(ObjectClass
*oc
, void *data
)
5945 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5946 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5948 dc
->desc
= "PowerPC 750 CL";
5949 pcc
->init_proc
= init_proc_750cl
;
5950 pcc
->check_pow
= check_pow_hid0
;
5951 /* XXX: not implemented:
5952 * cache lock instructions:
5954 * floating point paired instructions
5989 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5990 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5991 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5992 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5993 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5994 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5995 PPC_SEGMENT
| PPC_EXTERN
;
5996 pcc
->msr_mask
= (1ull << MSR_POW
) |
6012 pcc
->mmu_model
= POWERPC_MMU_32B
;
6013 #if defined(CONFIG_SOFTMMU)
6014 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6016 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6017 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6018 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6019 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6020 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6023 static void init_proc_750cx (CPUPPCState
*env
)
6025 gen_spr_ne_601(env
);
6027 /* XXX : not implemented */
6028 spr_register(env
, SPR_L2CR
, "L2CR",
6029 SPR_NOACCESS
, SPR_NOACCESS
,
6030 &spr_read_generic
, spr_access_nop
,
6034 /* Thermal management */
6036 /* This register is not implemented but is present for compatibility */
6037 spr_register(env
, SPR_SDA
, "SDA",
6038 SPR_NOACCESS
, SPR_NOACCESS
,
6039 &spr_read_generic
, &spr_write_generic
,
6041 /* Hardware implementation registers */
6042 /* XXX : not implemented */
6043 spr_register(env
, SPR_HID0
, "HID0",
6044 SPR_NOACCESS
, SPR_NOACCESS
,
6045 &spr_read_generic
, &spr_write_generic
,
6047 /* XXX : not implemented */
6048 spr_register(env
, SPR_HID1
, "HID1",
6049 SPR_NOACCESS
, SPR_NOACCESS
,
6050 &spr_read_generic
, &spr_write_generic
,
6052 /* Memory management */
6054 /* PowerPC 750cx has 8 DBATs and 8 IBATs */
6056 init_excp_750cx(env
);
6057 env
->dcache_line_size
= 32;
6058 env
->icache_line_size
= 32;
6059 /* Allocate hardware IRQ controller */
6060 ppc6xx_irq_init(env
);
6063 POWERPC_FAMILY(750cx
)(ObjectClass
*oc
, void *data
)
6065 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6066 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6068 dc
->desc
= "PowerPC 750CX";
6069 pcc
->init_proc
= init_proc_750cx
;
6070 pcc
->check_pow
= check_pow_hid0
;
6071 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6072 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6073 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6074 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6075 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6076 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6077 PPC_SEGMENT
| PPC_EXTERN
;
6078 pcc
->msr_mask
= (1ull << MSR_POW
) |
6094 pcc
->mmu_model
= POWERPC_MMU_32B
;
6095 #if defined(CONFIG_SOFTMMU)
6096 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6098 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6099 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6100 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6101 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6102 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6105 static void init_proc_750fx (CPUPPCState
*env
)
6107 gen_spr_ne_601(env
);
6109 /* XXX : not implemented */
6110 spr_register(env
, SPR_L2CR
, "L2CR",
6111 SPR_NOACCESS
, SPR_NOACCESS
,
6112 &spr_read_generic
, spr_access_nop
,
6116 /* Thermal management */
6118 /* XXX : not implemented */
6119 spr_register(env
, SPR_750_THRM4
, "THRM4",
6120 SPR_NOACCESS
, SPR_NOACCESS
,
6121 &spr_read_generic
, &spr_write_generic
,
6123 /* Hardware implementation registers */
6124 /* XXX : not implemented */
6125 spr_register(env
, SPR_HID0
, "HID0",
6126 SPR_NOACCESS
, SPR_NOACCESS
,
6127 &spr_read_generic
, &spr_write_generic
,
6129 /* XXX : not implemented */
6130 spr_register(env
, SPR_HID1
, "HID1",
6131 SPR_NOACCESS
, SPR_NOACCESS
,
6132 &spr_read_generic
, &spr_write_generic
,
6134 /* XXX : not implemented */
6135 spr_register(env
, SPR_750FX_HID2
, "HID2",
6136 SPR_NOACCESS
, SPR_NOACCESS
,
6137 &spr_read_generic
, &spr_write_generic
,
6139 /* Memory management */
6141 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6144 env
->dcache_line_size
= 32;
6145 env
->icache_line_size
= 32;
6146 /* Allocate hardware IRQ controller */
6147 ppc6xx_irq_init(env
);
6150 POWERPC_FAMILY(750fx
)(ObjectClass
*oc
, void *data
)
6152 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6153 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6155 dc
->desc
= "PowerPC 750FX";
6156 pcc
->init_proc
= init_proc_750fx
;
6157 pcc
->check_pow
= check_pow_hid0
;
6158 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6159 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6160 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6161 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6162 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6163 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6164 PPC_SEGMENT
| PPC_EXTERN
;
6165 pcc
->msr_mask
= (1ull << MSR_POW
) |
6181 pcc
->mmu_model
= POWERPC_MMU_32B
;
6182 #if defined(CONFIG_SOFTMMU)
6183 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6185 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6186 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6187 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6188 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6189 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6192 static void init_proc_750gx (CPUPPCState
*env
)
6194 gen_spr_ne_601(env
);
6196 /* XXX : not implemented (XXX: different from 750fx) */
6197 spr_register(env
, SPR_L2CR
, "L2CR",
6198 SPR_NOACCESS
, SPR_NOACCESS
,
6199 &spr_read_generic
, spr_access_nop
,
6203 /* Thermal management */
6205 /* XXX : not implemented */
6206 spr_register(env
, SPR_750_THRM4
, "THRM4",
6207 SPR_NOACCESS
, SPR_NOACCESS
,
6208 &spr_read_generic
, &spr_write_generic
,
6210 /* Hardware implementation registers */
6211 /* XXX : not implemented (XXX: different from 750fx) */
6212 spr_register(env
, SPR_HID0
, "HID0",
6213 SPR_NOACCESS
, SPR_NOACCESS
,
6214 &spr_read_generic
, &spr_write_generic
,
6216 /* XXX : not implemented */
6217 spr_register(env
, SPR_HID1
, "HID1",
6218 SPR_NOACCESS
, SPR_NOACCESS
,
6219 &spr_read_generic
, &spr_write_generic
,
6221 /* XXX : not implemented (XXX: different from 750fx) */
6222 spr_register(env
, SPR_750FX_HID2
, "HID2",
6223 SPR_NOACCESS
, SPR_NOACCESS
,
6224 &spr_read_generic
, &spr_write_generic
,
6226 /* Memory management */
6228 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6231 env
->dcache_line_size
= 32;
6232 env
->icache_line_size
= 32;
6233 /* Allocate hardware IRQ controller */
6234 ppc6xx_irq_init(env
);
6237 POWERPC_FAMILY(750gx
)(ObjectClass
*oc
, void *data
)
6239 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6240 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6242 dc
->desc
= "PowerPC 750GX";
6243 pcc
->init_proc
= init_proc_750gx
;
6244 pcc
->check_pow
= check_pow_hid0
;
6245 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6246 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6247 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6248 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6249 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6250 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6251 PPC_SEGMENT
| PPC_EXTERN
;
6252 pcc
->msr_mask
= (1ull << MSR_POW
) |
6268 pcc
->mmu_model
= POWERPC_MMU_32B
;
6269 #if defined(CONFIG_SOFTMMU)
6270 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6272 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6273 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6274 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6275 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6276 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6279 static void init_proc_745 (CPUPPCState
*env
)
6281 gen_spr_ne_601(env
);
6283 gen_spr_G2_755(env
);
6286 /* Thermal management */
6288 /* Hardware implementation registers */
6289 /* XXX : not implemented */
6290 spr_register(env
, SPR_HID0
, "HID0",
6291 SPR_NOACCESS
, SPR_NOACCESS
,
6292 &spr_read_generic
, &spr_write_generic
,
6294 /* XXX : not implemented */
6295 spr_register(env
, SPR_HID1
, "HID1",
6296 SPR_NOACCESS
, SPR_NOACCESS
,
6297 &spr_read_generic
, &spr_write_generic
,
6299 /* XXX : not implemented */
6300 spr_register(env
, SPR_HID2
, "HID2",
6301 SPR_NOACCESS
, SPR_NOACCESS
,
6302 &spr_read_generic
, &spr_write_generic
,
6304 /* Memory management */
6307 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6309 env
->dcache_line_size
= 32;
6310 env
->icache_line_size
= 32;
6311 /* Allocate hardware IRQ controller */
6312 ppc6xx_irq_init(env
);
6315 POWERPC_FAMILY(745)(ObjectClass
*oc
, void *data
)
6317 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6318 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6320 dc
->desc
= "PowerPC 745";
6321 pcc
->init_proc
= init_proc_745
;
6322 pcc
->check_pow
= check_pow_hid0
;
6323 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6324 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6325 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6326 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6327 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6328 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6329 PPC_SEGMENT
| PPC_EXTERN
;
6330 pcc
->msr_mask
= (1ull << MSR_POW
) |
6346 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6347 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6348 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6349 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6350 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6351 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6354 static void init_proc_755 (CPUPPCState
*env
)
6356 gen_spr_ne_601(env
);
6358 gen_spr_G2_755(env
);
6361 /* L2 cache control */
6362 /* XXX : not implemented */
6363 spr_register(env
, SPR_L2CR
, "L2CR",
6364 SPR_NOACCESS
, SPR_NOACCESS
,
6365 &spr_read_generic
, spr_access_nop
,
6367 /* XXX : not implemented */
6368 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6369 SPR_NOACCESS
, SPR_NOACCESS
,
6370 &spr_read_generic
, &spr_write_generic
,
6372 /* Thermal management */
6374 /* Hardware implementation registers */
6375 /* XXX : not implemented */
6376 spr_register(env
, SPR_HID0
, "HID0",
6377 SPR_NOACCESS
, SPR_NOACCESS
,
6378 &spr_read_generic
, &spr_write_generic
,
6380 /* XXX : not implemented */
6381 spr_register(env
, SPR_HID1
, "HID1",
6382 SPR_NOACCESS
, SPR_NOACCESS
,
6383 &spr_read_generic
, &spr_write_generic
,
6385 /* XXX : not implemented */
6386 spr_register(env
, SPR_HID2
, "HID2",
6387 SPR_NOACCESS
, SPR_NOACCESS
,
6388 &spr_read_generic
, &spr_write_generic
,
6390 /* Memory management */
6393 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6395 env
->dcache_line_size
= 32;
6396 env
->icache_line_size
= 32;
6397 /* Allocate hardware IRQ controller */
6398 ppc6xx_irq_init(env
);
6401 POWERPC_FAMILY(755)(ObjectClass
*oc
, void *data
)
6403 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6404 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6406 dc
->desc
= "PowerPC 755";
6407 pcc
->init_proc
= init_proc_755
;
6408 pcc
->check_pow
= check_pow_hid0
;
6409 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6410 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6411 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6412 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6413 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6414 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6415 PPC_SEGMENT
| PPC_EXTERN
;
6416 pcc
->msr_mask
= (1ull << MSR_POW
) |
6432 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6433 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6434 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6435 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6436 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6437 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6440 static void init_proc_7400 (CPUPPCState
*env
)
6442 gen_spr_ne_601(env
);
6446 /* 74xx specific SPR */
6448 /* XXX : not implemented */
6449 spr_register(env
, SPR_UBAMR
, "UBAMR",
6450 &spr_read_ureg
, SPR_NOACCESS
,
6451 &spr_read_ureg
, SPR_NOACCESS
,
6453 /* XXX: this seems not implemented on all revisions. */
6454 /* XXX : not implemented */
6455 spr_register(env
, SPR_MSSCR1
, "MSSCR1",
6456 SPR_NOACCESS
, SPR_NOACCESS
,
6457 &spr_read_generic
, &spr_write_generic
,
6459 /* Thermal management */
6461 /* Memory management */
6463 init_excp_7400(env
);
6464 env
->dcache_line_size
= 32;
6465 env
->icache_line_size
= 32;
6466 /* Allocate hardware IRQ controller */
6467 ppc6xx_irq_init(env
);
6470 POWERPC_FAMILY(7400)(ObjectClass
*oc
, void *data
)
6472 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6473 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6475 dc
->desc
= "PowerPC 7400 (aka G4)";
6476 pcc
->init_proc
= init_proc_7400
;
6477 pcc
->check_pow
= check_pow_hid0
;
6478 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6479 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6480 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6482 PPC_CACHE
| PPC_CACHE_ICBI
|
6483 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6484 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6485 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6487 PPC_SEGMENT
| PPC_EXTERN
|
6489 pcc
->msr_mask
= (1ull << MSR_VR
) |
6506 pcc
->mmu_model
= POWERPC_MMU_32B
;
6507 #if defined(CONFIG_SOFTMMU)
6508 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6510 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6511 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6512 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6513 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6514 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6515 POWERPC_FLAG_BUS_CLK
;
6518 static void init_proc_7410 (CPUPPCState
*env
)
6520 gen_spr_ne_601(env
);
6524 /* 74xx specific SPR */
6526 /* XXX : not implemented */
6527 spr_register(env
, SPR_UBAMR
, "UBAMR",
6528 &spr_read_ureg
, SPR_NOACCESS
,
6529 &spr_read_ureg
, SPR_NOACCESS
,
6531 /* Thermal management */
6534 /* XXX : not implemented */
6535 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6536 SPR_NOACCESS
, SPR_NOACCESS
,
6537 &spr_read_generic
, &spr_write_generic
,
6540 /* XXX : not implemented */
6541 spr_register(env
, SPR_LDSTDB
, "LDSTDB",
6542 SPR_NOACCESS
, SPR_NOACCESS
,
6543 &spr_read_generic
, &spr_write_generic
,
6545 /* Memory management */
6547 init_excp_7400(env
);
6548 env
->dcache_line_size
= 32;
6549 env
->icache_line_size
= 32;
6550 /* Allocate hardware IRQ controller */
6551 ppc6xx_irq_init(env
);
6554 POWERPC_FAMILY(7410)(ObjectClass
*oc
, void *data
)
6556 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6557 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6559 dc
->desc
= "PowerPC 7410 (aka G4)";
6560 pcc
->init_proc
= init_proc_7410
;
6561 pcc
->check_pow
= check_pow_hid0
;
6562 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6563 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6564 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6566 PPC_CACHE
| PPC_CACHE_ICBI
|
6567 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6568 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6569 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6571 PPC_SEGMENT
| PPC_EXTERN
|
6573 pcc
->msr_mask
= (1ull << MSR_VR
) |
6590 pcc
->mmu_model
= POWERPC_MMU_32B
;
6591 #if defined(CONFIG_SOFTMMU)
6592 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6594 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6595 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6596 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6597 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6598 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6599 POWERPC_FLAG_BUS_CLK
;
6602 static void init_proc_7440 (CPUPPCState
*env
)
6604 gen_spr_ne_601(env
);
6608 /* 74xx specific SPR */
6610 /* XXX : not implemented */
6611 spr_register(env
, SPR_UBAMR
, "UBAMR",
6612 &spr_read_ureg
, SPR_NOACCESS
,
6613 &spr_read_ureg
, SPR_NOACCESS
,
6616 /* XXX : not implemented */
6617 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6618 SPR_NOACCESS
, SPR_NOACCESS
,
6619 &spr_read_generic
, &spr_write_generic
,
6622 /* XXX : not implemented */
6623 spr_register(env
, SPR_ICTRL
, "ICTRL",
6624 SPR_NOACCESS
, SPR_NOACCESS
,
6625 &spr_read_generic
, &spr_write_generic
,
6628 /* XXX : not implemented */
6629 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6630 SPR_NOACCESS
, SPR_NOACCESS
,
6631 &spr_read_generic
, &spr_write_generic
,
6634 /* XXX : not implemented */
6635 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6636 SPR_NOACCESS
, SPR_NOACCESS
,
6637 &spr_read_generic
, &spr_write_generic
,
6639 /* XXX : not implemented */
6640 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6641 &spr_read_ureg
, SPR_NOACCESS
,
6642 &spr_read_ureg
, SPR_NOACCESS
,
6644 /* XXX : not implemented */
6645 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6646 SPR_NOACCESS
, SPR_NOACCESS
,
6647 &spr_read_generic
, &spr_write_generic
,
6649 /* XXX : not implemented */
6650 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6651 &spr_read_ureg
, SPR_NOACCESS
,
6652 &spr_read_ureg
, SPR_NOACCESS
,
6654 /* Memory management */
6656 gen_74xx_soft_tlb(env
, 128, 2);
6657 init_excp_7450(env
);
6658 env
->dcache_line_size
= 32;
6659 env
->icache_line_size
= 32;
6660 /* Allocate hardware IRQ controller */
6661 ppc6xx_irq_init(env
);
6664 POWERPC_FAMILY(7440)(ObjectClass
*oc
, void *data
)
6666 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6667 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6669 dc
->desc
= "PowerPC 7440 (aka G4)";
6670 pcc
->init_proc
= init_proc_7440
;
6671 pcc
->check_pow
= check_pow_hid0_74xx
;
6672 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6673 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6674 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6676 PPC_CACHE
| PPC_CACHE_ICBI
|
6677 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6678 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6679 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6680 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6681 PPC_SEGMENT
| PPC_EXTERN
|
6683 pcc
->msr_mask
= (1ull << MSR_VR
) |
6700 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6701 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6702 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6703 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6704 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6705 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6706 POWERPC_FLAG_BUS_CLK
;
6709 static void init_proc_7450 (CPUPPCState
*env
)
6711 gen_spr_ne_601(env
);
6715 /* 74xx specific SPR */
6717 /* Level 3 cache control */
6720 /* XXX : not implemented */
6721 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
6722 SPR_NOACCESS
, SPR_NOACCESS
,
6723 &spr_read_generic
, &spr_write_generic
,
6726 /* XXX : not implemented */
6727 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
6728 SPR_NOACCESS
, SPR_NOACCESS
,
6729 &spr_read_generic
, &spr_write_generic
,
6732 /* XXX : not implemented */
6733 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
6734 SPR_NOACCESS
, SPR_NOACCESS
,
6735 &spr_read_generic
, &spr_write_generic
,
6738 /* XXX : not implemented */
6739 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
6740 SPR_NOACCESS
, SPR_NOACCESS
,
6741 &spr_read_generic
, &spr_write_generic
,
6743 /* XXX : not implemented */
6744 spr_register(env
, SPR_UBAMR
, "UBAMR",
6745 &spr_read_ureg
, SPR_NOACCESS
,
6746 &spr_read_ureg
, SPR_NOACCESS
,
6749 /* XXX : not implemented */
6750 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6751 SPR_NOACCESS
, SPR_NOACCESS
,
6752 &spr_read_generic
, &spr_write_generic
,
6755 /* XXX : not implemented */
6756 spr_register(env
, SPR_ICTRL
, "ICTRL",
6757 SPR_NOACCESS
, SPR_NOACCESS
,
6758 &spr_read_generic
, &spr_write_generic
,
6761 /* XXX : not implemented */
6762 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6763 SPR_NOACCESS
, SPR_NOACCESS
,
6764 &spr_read_generic
, &spr_write_generic
,
6767 /* XXX : not implemented */
6768 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6769 SPR_NOACCESS
, SPR_NOACCESS
,
6770 &spr_read_generic
, &spr_write_generic
,
6772 /* XXX : not implemented */
6773 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6774 &spr_read_ureg
, SPR_NOACCESS
,
6775 &spr_read_ureg
, SPR_NOACCESS
,
6777 /* XXX : not implemented */
6778 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6779 SPR_NOACCESS
, SPR_NOACCESS
,
6780 &spr_read_generic
, &spr_write_generic
,
6782 /* XXX : not implemented */
6783 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6784 &spr_read_ureg
, SPR_NOACCESS
,
6785 &spr_read_ureg
, SPR_NOACCESS
,
6787 /* Memory management */
6789 gen_74xx_soft_tlb(env
, 128, 2);
6790 init_excp_7450(env
);
6791 env
->dcache_line_size
= 32;
6792 env
->icache_line_size
= 32;
6793 /* Allocate hardware IRQ controller */
6794 ppc6xx_irq_init(env
);
6797 POWERPC_FAMILY(7450)(ObjectClass
*oc
, void *data
)
6799 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6800 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6802 dc
->desc
= "PowerPC 7450 (aka G4)";
6803 pcc
->init_proc
= init_proc_7450
;
6804 pcc
->check_pow
= check_pow_hid0_74xx
;
6805 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6806 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6807 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6809 PPC_CACHE
| PPC_CACHE_ICBI
|
6810 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6811 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6812 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6813 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6814 PPC_SEGMENT
| PPC_EXTERN
|
6816 pcc
->msr_mask
= (1ull << MSR_VR
) |
6833 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6834 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6835 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6836 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6837 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6838 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6839 POWERPC_FLAG_BUS_CLK
;
6842 static void init_proc_7445 (CPUPPCState
*env
)
6844 gen_spr_ne_601(env
);
6848 /* 74xx specific SPR */
6851 /* XXX : not implemented */
6852 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6853 SPR_NOACCESS
, SPR_NOACCESS
,
6854 &spr_read_generic
, &spr_write_generic
,
6857 /* XXX : not implemented */
6858 spr_register(env
, SPR_ICTRL
, "ICTRL",
6859 SPR_NOACCESS
, SPR_NOACCESS
,
6860 &spr_read_generic
, &spr_write_generic
,
6863 /* XXX : not implemented */
6864 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6865 SPR_NOACCESS
, SPR_NOACCESS
,
6866 &spr_read_generic
, &spr_write_generic
,
6869 /* XXX : not implemented */
6870 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6871 SPR_NOACCESS
, SPR_NOACCESS
,
6872 &spr_read_generic
, &spr_write_generic
,
6874 /* XXX : not implemented */
6875 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6876 &spr_read_ureg
, SPR_NOACCESS
,
6877 &spr_read_ureg
, SPR_NOACCESS
,
6879 /* XXX : not implemented */
6880 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6881 SPR_NOACCESS
, SPR_NOACCESS
,
6882 &spr_read_generic
, &spr_write_generic
,
6884 /* XXX : not implemented */
6885 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6886 &spr_read_ureg
, SPR_NOACCESS
,
6887 &spr_read_ureg
, SPR_NOACCESS
,
6890 spr_register(env
, SPR_SPRG4
, "SPRG4",
6891 SPR_NOACCESS
, SPR_NOACCESS
,
6892 &spr_read_generic
, &spr_write_generic
,
6894 spr_register(env
, SPR_USPRG4
, "USPRG4",
6895 &spr_read_ureg
, SPR_NOACCESS
,
6896 &spr_read_ureg
, SPR_NOACCESS
,
6898 spr_register(env
, SPR_SPRG5
, "SPRG5",
6899 SPR_NOACCESS
, SPR_NOACCESS
,
6900 &spr_read_generic
, &spr_write_generic
,
6902 spr_register(env
, SPR_USPRG5
, "USPRG5",
6903 &spr_read_ureg
, SPR_NOACCESS
,
6904 &spr_read_ureg
, SPR_NOACCESS
,
6906 spr_register(env
, SPR_SPRG6
, "SPRG6",
6907 SPR_NOACCESS
, SPR_NOACCESS
,
6908 &spr_read_generic
, &spr_write_generic
,
6910 spr_register(env
, SPR_USPRG6
, "USPRG6",
6911 &spr_read_ureg
, SPR_NOACCESS
,
6912 &spr_read_ureg
, SPR_NOACCESS
,
6914 spr_register(env
, SPR_SPRG7
, "SPRG7",
6915 SPR_NOACCESS
, SPR_NOACCESS
,
6916 &spr_read_generic
, &spr_write_generic
,
6918 spr_register(env
, SPR_USPRG7
, "USPRG7",
6919 &spr_read_ureg
, SPR_NOACCESS
,
6920 &spr_read_ureg
, SPR_NOACCESS
,
6922 /* Memory management */
6925 gen_74xx_soft_tlb(env
, 128, 2);
6926 init_excp_7450(env
);
6927 env
->dcache_line_size
= 32;
6928 env
->icache_line_size
= 32;
6929 /* Allocate hardware IRQ controller */
6930 ppc6xx_irq_init(env
);
6933 POWERPC_FAMILY(7445)(ObjectClass
*oc
, void *data
)
6935 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6936 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6938 dc
->desc
= "PowerPC 7445 (aka G4)";
6939 pcc
->init_proc
= init_proc_7445
;
6940 pcc
->check_pow
= check_pow_hid0_74xx
;
6941 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6942 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6943 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6945 PPC_CACHE
| PPC_CACHE_ICBI
|
6946 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6947 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6948 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6949 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6950 PPC_SEGMENT
| PPC_EXTERN
|
6952 pcc
->msr_mask
= (1ull << MSR_VR
) |
6969 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6970 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6971 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6972 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6973 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6974 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6975 POWERPC_FLAG_BUS_CLK
;
6978 static void init_proc_7455 (CPUPPCState
*env
)
6980 gen_spr_ne_601(env
);
6984 /* 74xx specific SPR */
6986 /* Level 3 cache control */
6989 /* XXX : not implemented */
6990 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6991 SPR_NOACCESS
, SPR_NOACCESS
,
6992 &spr_read_generic
, &spr_write_generic
,
6995 /* XXX : not implemented */
6996 spr_register(env
, SPR_ICTRL
, "ICTRL",
6997 SPR_NOACCESS
, SPR_NOACCESS
,
6998 &spr_read_generic
, &spr_write_generic
,
7001 /* XXX : not implemented */
7002 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7003 SPR_NOACCESS
, SPR_NOACCESS
,
7004 &spr_read_generic
, &spr_write_generic
,
7007 /* XXX : not implemented */
7008 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7009 SPR_NOACCESS
, SPR_NOACCESS
,
7010 &spr_read_generic
, &spr_write_generic
,
7012 /* XXX : not implemented */
7013 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7014 &spr_read_ureg
, SPR_NOACCESS
,
7015 &spr_read_ureg
, SPR_NOACCESS
,
7017 /* XXX : not implemented */
7018 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7019 SPR_NOACCESS
, SPR_NOACCESS
,
7020 &spr_read_generic
, &spr_write_generic
,
7022 /* XXX : not implemented */
7023 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7024 &spr_read_ureg
, SPR_NOACCESS
,
7025 &spr_read_ureg
, SPR_NOACCESS
,
7028 spr_register(env
, SPR_SPRG4
, "SPRG4",
7029 SPR_NOACCESS
, SPR_NOACCESS
,
7030 &spr_read_generic
, &spr_write_generic
,
7032 spr_register(env
, SPR_USPRG4
, "USPRG4",
7033 &spr_read_ureg
, SPR_NOACCESS
,
7034 &spr_read_ureg
, SPR_NOACCESS
,
7036 spr_register(env
, SPR_SPRG5
, "SPRG5",
7037 SPR_NOACCESS
, SPR_NOACCESS
,
7038 &spr_read_generic
, &spr_write_generic
,
7040 spr_register(env
, SPR_USPRG5
, "USPRG5",
7041 &spr_read_ureg
, SPR_NOACCESS
,
7042 &spr_read_ureg
, SPR_NOACCESS
,
7044 spr_register(env
, SPR_SPRG6
, "SPRG6",
7045 SPR_NOACCESS
, SPR_NOACCESS
,
7046 &spr_read_generic
, &spr_write_generic
,
7048 spr_register(env
, SPR_USPRG6
, "USPRG6",
7049 &spr_read_ureg
, SPR_NOACCESS
,
7050 &spr_read_ureg
, SPR_NOACCESS
,
7052 spr_register(env
, SPR_SPRG7
, "SPRG7",
7053 SPR_NOACCESS
, SPR_NOACCESS
,
7054 &spr_read_generic
, &spr_write_generic
,
7056 spr_register(env
, SPR_USPRG7
, "USPRG7",
7057 &spr_read_ureg
, SPR_NOACCESS
,
7058 &spr_read_ureg
, SPR_NOACCESS
,
7060 /* Memory management */
7063 gen_74xx_soft_tlb(env
, 128, 2);
7064 init_excp_7450(env
);
7065 env
->dcache_line_size
= 32;
7066 env
->icache_line_size
= 32;
7067 /* Allocate hardware IRQ controller */
7068 ppc6xx_irq_init(env
);
7071 POWERPC_FAMILY(7455)(ObjectClass
*oc
, void *data
)
7073 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7074 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7076 dc
->desc
= "PowerPC 7455 (aka G4)";
7077 pcc
->init_proc
= init_proc_7455
;
7078 pcc
->check_pow
= check_pow_hid0_74xx
;
7079 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7080 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7081 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7083 PPC_CACHE
| PPC_CACHE_ICBI
|
7084 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7085 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7086 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7087 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7088 PPC_SEGMENT
| PPC_EXTERN
|
7090 pcc
->msr_mask
= (1ull << MSR_VR
) |
7107 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7108 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7109 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7110 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7111 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7112 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7113 POWERPC_FLAG_BUS_CLK
;
7116 static void init_proc_7457 (CPUPPCState
*env
)
7118 gen_spr_ne_601(env
);
7122 /* 74xx specific SPR */
7124 /* Level 3 cache control */
7127 /* XXX : not implemented */
7128 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
7129 SPR_NOACCESS
, SPR_NOACCESS
,
7130 &spr_read_generic
, &spr_write_generic
,
7133 /* XXX : not implemented */
7134 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
7135 SPR_NOACCESS
, SPR_NOACCESS
,
7136 &spr_read_generic
, &spr_write_generic
,
7139 /* XXX : not implemented */
7140 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
7141 SPR_NOACCESS
, SPR_NOACCESS
,
7142 &spr_read_generic
, &spr_write_generic
,
7145 /* XXX : not implemented */
7146 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
7147 SPR_NOACCESS
, SPR_NOACCESS
,
7148 &spr_read_generic
, &spr_write_generic
,
7151 /* XXX : not implemented */
7152 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7153 SPR_NOACCESS
, SPR_NOACCESS
,
7154 &spr_read_generic
, &spr_write_generic
,
7157 /* XXX : not implemented */
7158 spr_register(env
, SPR_ICTRL
, "ICTRL",
7159 SPR_NOACCESS
, SPR_NOACCESS
,
7160 &spr_read_generic
, &spr_write_generic
,
7163 /* XXX : not implemented */
7164 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7165 SPR_NOACCESS
, SPR_NOACCESS
,
7166 &spr_read_generic
, &spr_write_generic
,
7169 /* XXX : not implemented */
7170 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7171 SPR_NOACCESS
, SPR_NOACCESS
,
7172 &spr_read_generic
, &spr_write_generic
,
7174 /* XXX : not implemented */
7175 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7176 &spr_read_ureg
, SPR_NOACCESS
,
7177 &spr_read_ureg
, SPR_NOACCESS
,
7179 /* XXX : not implemented */
7180 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7181 SPR_NOACCESS
, SPR_NOACCESS
,
7182 &spr_read_generic
, &spr_write_generic
,
7184 /* XXX : not implemented */
7185 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7186 &spr_read_ureg
, SPR_NOACCESS
,
7187 &spr_read_ureg
, SPR_NOACCESS
,
7190 spr_register(env
, SPR_SPRG4
, "SPRG4",
7191 SPR_NOACCESS
, SPR_NOACCESS
,
7192 &spr_read_generic
, &spr_write_generic
,
7194 spr_register(env
, SPR_USPRG4
, "USPRG4",
7195 &spr_read_ureg
, SPR_NOACCESS
,
7196 &spr_read_ureg
, SPR_NOACCESS
,
7198 spr_register(env
, SPR_SPRG5
, "SPRG5",
7199 SPR_NOACCESS
, SPR_NOACCESS
,
7200 &spr_read_generic
, &spr_write_generic
,
7202 spr_register(env
, SPR_USPRG5
, "USPRG5",
7203 &spr_read_ureg
, SPR_NOACCESS
,
7204 &spr_read_ureg
, SPR_NOACCESS
,
7206 spr_register(env
, SPR_SPRG6
, "SPRG6",
7207 SPR_NOACCESS
, SPR_NOACCESS
,
7208 &spr_read_generic
, &spr_write_generic
,
7210 spr_register(env
, SPR_USPRG6
, "USPRG6",
7211 &spr_read_ureg
, SPR_NOACCESS
,
7212 &spr_read_ureg
, SPR_NOACCESS
,
7214 spr_register(env
, SPR_SPRG7
, "SPRG7",
7215 SPR_NOACCESS
, SPR_NOACCESS
,
7216 &spr_read_generic
, &spr_write_generic
,
7218 spr_register(env
, SPR_USPRG7
, "USPRG7",
7219 &spr_read_ureg
, SPR_NOACCESS
,
7220 &spr_read_ureg
, SPR_NOACCESS
,
7222 /* Memory management */
7225 gen_74xx_soft_tlb(env
, 128, 2);
7226 init_excp_7450(env
);
7227 env
->dcache_line_size
= 32;
7228 env
->icache_line_size
= 32;
7229 /* Allocate hardware IRQ controller */
7230 ppc6xx_irq_init(env
);
7233 POWERPC_FAMILY(7457)(ObjectClass
*oc
, void *data
)
7235 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7236 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7238 dc
->desc
= "PowerPC 7457 (aka G4)";
7239 pcc
->init_proc
= init_proc_7457
;
7240 pcc
->check_pow
= check_pow_hid0_74xx
;
7241 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7242 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7243 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7245 PPC_CACHE
| PPC_CACHE_ICBI
|
7246 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7247 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7248 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7249 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7250 PPC_SEGMENT
| PPC_EXTERN
|
7252 pcc
->msr_mask
= (1ull << MSR_VR
) |
7269 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7270 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7271 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7272 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7273 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7274 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7275 POWERPC_FLAG_BUS_CLK
;
7278 static void init_proc_e600 (CPUPPCState
*env
)
7280 gen_spr_ne_601(env
);
7284 /* 74xx specific SPR */
7286 /* XXX : not implemented */
7287 spr_register(env
, SPR_UBAMR
, "UBAMR",
7288 &spr_read_ureg
, SPR_NOACCESS
,
7289 &spr_read_ureg
, SPR_NOACCESS
,
7291 /* XXX : not implemented */
7292 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7293 SPR_NOACCESS
, SPR_NOACCESS
,
7294 &spr_read_generic
, &spr_write_generic
,
7296 /* XXX : not implemented */
7297 spr_register(env
, SPR_ICTRL
, "ICTRL",
7298 SPR_NOACCESS
, SPR_NOACCESS
,
7299 &spr_read_generic
, &spr_write_generic
,
7301 /* XXX : not implemented */
7302 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7303 SPR_NOACCESS
, SPR_NOACCESS
,
7304 &spr_read_generic
, &spr_write_generic
,
7306 /* XXX : not implemented */
7307 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7308 SPR_NOACCESS
, SPR_NOACCESS
,
7309 &spr_read_generic
, &spr_write_generic
,
7311 /* XXX : not implemented */
7312 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7313 &spr_read_ureg
, SPR_NOACCESS
,
7314 &spr_read_ureg
, SPR_NOACCESS
,
7316 /* XXX : not implemented */
7317 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7318 SPR_NOACCESS
, SPR_NOACCESS
,
7319 &spr_read_generic
, &spr_write_generic
,
7321 /* XXX : not implemented */
7322 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7323 &spr_read_ureg
, SPR_NOACCESS
,
7324 &spr_read_ureg
, SPR_NOACCESS
,
7327 spr_register(env
, SPR_SPRG4
, "SPRG4",
7328 SPR_NOACCESS
, SPR_NOACCESS
,
7329 &spr_read_generic
, &spr_write_generic
,
7331 spr_register(env
, SPR_USPRG4
, "USPRG4",
7332 &spr_read_ureg
, SPR_NOACCESS
,
7333 &spr_read_ureg
, SPR_NOACCESS
,
7335 spr_register(env
, SPR_SPRG5
, "SPRG5",
7336 SPR_NOACCESS
, SPR_NOACCESS
,
7337 &spr_read_generic
, &spr_write_generic
,
7339 spr_register(env
, SPR_USPRG5
, "USPRG5",
7340 &spr_read_ureg
, SPR_NOACCESS
,
7341 &spr_read_ureg
, SPR_NOACCESS
,
7343 spr_register(env
, SPR_SPRG6
, "SPRG6",
7344 SPR_NOACCESS
, SPR_NOACCESS
,
7345 &spr_read_generic
, &spr_write_generic
,
7347 spr_register(env
, SPR_USPRG6
, "USPRG6",
7348 &spr_read_ureg
, SPR_NOACCESS
,
7349 &spr_read_ureg
, SPR_NOACCESS
,
7351 spr_register(env
, SPR_SPRG7
, "SPRG7",
7352 SPR_NOACCESS
, SPR_NOACCESS
,
7353 &spr_read_generic
, &spr_write_generic
,
7355 spr_register(env
, SPR_USPRG7
, "USPRG7",
7356 &spr_read_ureg
, SPR_NOACCESS
,
7357 &spr_read_ureg
, SPR_NOACCESS
,
7359 /* Memory management */
7362 gen_74xx_soft_tlb(env
, 128, 2);
7363 init_excp_7450(env
);
7364 env
->dcache_line_size
= 32;
7365 env
->icache_line_size
= 32;
7366 /* Allocate hardware IRQ controller */
7367 ppc6xx_irq_init(env
);
7370 POWERPC_FAMILY(e600
)(ObjectClass
*oc
, void *data
)
7372 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7373 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7375 dc
->desc
= "PowerPC e600";
7376 pcc
->init_proc
= init_proc_e600
;
7377 pcc
->check_pow
= check_pow_hid0_74xx
;
7378 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7379 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7380 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7382 PPC_CACHE
| PPC_CACHE_ICBI
|
7383 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7384 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7385 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7386 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7387 PPC_SEGMENT
| PPC_EXTERN
|
7389 pcc
->insns_flags2
= PPC_NONE
;
7390 pcc
->msr_mask
= (1ull << MSR_VR
) |
7407 pcc
->mmu_model
= POWERPC_MMU_32B
;
7408 #if defined(CONFIG_SOFTMMU)
7409 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
7411 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7412 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7413 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7414 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7415 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7416 POWERPC_FLAG_BUS_CLK
;
7419 #if defined (TARGET_PPC64)
7420 #if defined(CONFIG_USER_ONLY)
7421 #define POWERPC970_HID5_INIT 0x00000080
7423 #define POWERPC970_HID5_INIT 0x00000000
7426 enum BOOK3S_CPU_TYPE
{
7428 BOOK3S_CPU_POWER5PLUS
,
7434 static void gen_fscr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7435 int bit
, int sprn
, int cause
)
7437 TCGv_i32 t1
= tcg_const_i32(bit
);
7438 TCGv_i32 t2
= tcg_const_i32(sprn
);
7439 TCGv_i32 t3
= tcg_const_i32(cause
);
7441 gen_update_current_nip(ctx
);
7442 gen_helper_fscr_facility_check(cpu_env
, t1
, t2
, t3
);
7444 tcg_temp_free_i32(t3
);
7445 tcg_temp_free_i32(t2
);
7446 tcg_temp_free_i32(t1
);
7449 static void gen_msr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7450 int bit
, int sprn
, int cause
)
7452 TCGv_i32 t1
= tcg_const_i32(bit
);
7453 TCGv_i32 t2
= tcg_const_i32(sprn
);
7454 TCGv_i32 t3
= tcg_const_i32(cause
);
7456 gen_update_current_nip(ctx
);
7457 gen_helper_msr_facility_check(cpu_env
, t1
, t2
, t3
);
7459 tcg_temp_free_i32(t3
);
7460 tcg_temp_free_i32(t2
);
7461 tcg_temp_free_i32(t1
);
7464 static void spr_read_prev_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
7466 TCGv spr_up
= tcg_temp_new();
7467 TCGv spr
= tcg_temp_new();
7469 gen_load_spr(spr
, sprn
- 1);
7470 tcg_gen_shri_tl(spr_up
, spr
, 32);
7471 tcg_gen_ext32u_tl(cpu_gpr
[gprn
], spr_up
);
7474 tcg_temp_free(spr_up
);
7477 static void spr_write_prev_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
7479 TCGv spr
= tcg_temp_new();
7481 gen_load_spr(spr
, sprn
- 1);
7482 tcg_gen_deposit_tl(spr
, spr
, cpu_gpr
[gprn
], 32, 32);
7483 gen_store_spr(sprn
- 1, spr
);
7488 static int check_pow_970 (CPUPPCState
*env
)
7490 if (env
->spr
[SPR_HID0
] & (HID0_DEEPNAP
| HID0_DOZE
| HID0_NAP
)) {
7497 static void gen_spr_970_hid(CPUPPCState
*env
)
7499 /* Hardware implementation registers */
7500 /* XXX : not implemented */
7501 spr_register(env
, SPR_HID0
, "HID0",
7502 SPR_NOACCESS
, SPR_NOACCESS
,
7503 &spr_read_generic
, &spr_write_clear
,
7505 spr_register(env
, SPR_HID1
, "HID1",
7506 SPR_NOACCESS
, SPR_NOACCESS
,
7507 &spr_read_generic
, &spr_write_generic
,
7509 spr_register(env
, SPR_970_HID5
, "HID5",
7510 SPR_NOACCESS
, SPR_NOACCESS
,
7511 &spr_read_generic
, &spr_write_generic
,
7512 POWERPC970_HID5_INIT
);
7515 static void gen_spr_970_hior(CPUPPCState
*env
)
7517 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7518 SPR_NOACCESS
, SPR_NOACCESS
,
7519 &spr_read_hior
, &spr_write_hior
,
7523 static void gen_spr_970_lpar(CPUPPCState
*env
)
7525 /* Logical partitionning */
7526 /* PPC970: HID4 is effectively the LPCR */
7527 spr_register(env
, SPR_970_HID4
, "HID4",
7528 SPR_NOACCESS
, SPR_NOACCESS
,
7529 &spr_read_generic
, &spr_write_generic
,
7533 static void gen_spr_book3s_common(CPUPPCState
*env
)
7535 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
7536 SPR_NOACCESS
, SPR_NOACCESS
,
7537 SPR_NOACCESS
, &spr_write_generic
,
7539 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
7540 &spr_read_ureg
, SPR_NOACCESS
,
7541 &spr_read_ureg
, SPR_NOACCESS
,
7545 static void gen_spr_book3s_altivec(CPUPPCState
*env
)
7547 if (!(env
->insns_flags
& PPC_ALTIVEC
)) {
7551 spr_register_kvm(env
, SPR_VRSAVE
, "VRSAVE",
7552 &spr_read_generic
, &spr_write_generic
,
7553 &spr_read_generic
, &spr_write_generic
,
7554 KVM_REG_PPC_VRSAVE
, 0x00000000);
7556 /* Can't find information on what this should be on reset. This
7557 * value is the one used by 74xx processors. */
7558 vscr_init(env
, 0x00010000);
7561 static void gen_spr_book3s_dbg(CPUPPCState
*env
)
7564 * TODO: different specs define different scopes for these,
7565 * will have to address this:
7566 * 970: super/write and super/read
7567 * powerisa 2.03..2.04: hypv/write and super/read.
7568 * powerisa 2.05 and newer: hypv/write and hypv/read.
7570 spr_register_kvm(env
, SPR_DABR
, "DABR",
7571 SPR_NOACCESS
, SPR_NOACCESS
,
7572 &spr_read_generic
, &spr_write_generic
,
7573 KVM_REG_PPC_DABR
, 0x00000000);
7574 spr_register_kvm(env
, SPR_DABRX
, "DABRX",
7575 SPR_NOACCESS
, SPR_NOACCESS
,
7576 &spr_read_generic
, &spr_write_generic
,
7577 KVM_REG_PPC_DABRX
, 0x00000000);
7580 static void gen_spr_book3s_207_dbg(CPUPPCState
*env
)
7582 spr_register_kvm_hv(env
, SPR_DAWR
, "DAWR",
7583 SPR_NOACCESS
, SPR_NOACCESS
,
7584 SPR_NOACCESS
, SPR_NOACCESS
,
7585 &spr_read_generic
, &spr_write_generic
,
7586 KVM_REG_PPC_DAWR
, 0x00000000);
7587 spr_register_kvm_hv(env
, SPR_DAWRX
, "DAWRX",
7588 SPR_NOACCESS
, SPR_NOACCESS
,
7589 SPR_NOACCESS
, SPR_NOACCESS
,
7590 &spr_read_generic
, &spr_write_generic
,
7591 KVM_REG_PPC_DAWRX
, 0x00000000);
7592 spr_register_kvm_hv(env
, SPR_CIABR
, "CIABR",
7593 SPR_NOACCESS
, SPR_NOACCESS
,
7594 SPR_NOACCESS
, SPR_NOACCESS
,
7595 &spr_read_generic
, &spr_write_generic
,
7596 KVM_REG_PPC_CIABR
, 0x00000000);
7599 static void gen_spr_970_dbg(CPUPPCState
*env
)
7602 spr_register(env
, SPR_IABR
, "IABR",
7603 SPR_NOACCESS
, SPR_NOACCESS
,
7604 &spr_read_generic
, &spr_write_generic
,
7608 static void gen_spr_book3s_pmu_sup(CPUPPCState
*env
)
7610 spr_register_kvm(env
, SPR_POWER_MMCR0
, "MMCR0",
7611 SPR_NOACCESS
, SPR_NOACCESS
,
7612 &spr_read_generic
, &spr_write_generic
,
7613 KVM_REG_PPC_MMCR0
, 0x00000000);
7614 spr_register_kvm(env
, SPR_POWER_MMCR1
, "MMCR1",
7615 SPR_NOACCESS
, SPR_NOACCESS
,
7616 &spr_read_generic
, &spr_write_generic
,
7617 KVM_REG_PPC_MMCR1
, 0x00000000);
7618 spr_register_kvm(env
, SPR_POWER_MMCRA
, "MMCRA",
7619 SPR_NOACCESS
, SPR_NOACCESS
,
7620 &spr_read_generic
, &spr_write_generic
,
7621 KVM_REG_PPC_MMCRA
, 0x00000000);
7622 spr_register_kvm(env
, SPR_POWER_PMC1
, "PMC1",
7623 SPR_NOACCESS
, SPR_NOACCESS
,
7624 &spr_read_generic
, &spr_write_generic
,
7625 KVM_REG_PPC_PMC1
, 0x00000000);
7626 spr_register_kvm(env
, SPR_POWER_PMC2
, "PMC2",
7627 SPR_NOACCESS
, SPR_NOACCESS
,
7628 &spr_read_generic
, &spr_write_generic
,
7629 KVM_REG_PPC_PMC2
, 0x00000000);
7630 spr_register_kvm(env
, SPR_POWER_PMC3
, "PMC3",
7631 SPR_NOACCESS
, SPR_NOACCESS
,
7632 &spr_read_generic
, &spr_write_generic
,
7633 KVM_REG_PPC_PMC3
, 0x00000000);
7634 spr_register_kvm(env
, SPR_POWER_PMC4
, "PMC4",
7635 SPR_NOACCESS
, SPR_NOACCESS
,
7636 &spr_read_generic
, &spr_write_generic
,
7637 KVM_REG_PPC_PMC4
, 0x00000000);
7638 spr_register_kvm(env
, SPR_POWER_PMC5
, "PMC5",
7639 SPR_NOACCESS
, SPR_NOACCESS
,
7640 &spr_read_generic
, &spr_write_generic
,
7641 KVM_REG_PPC_PMC5
, 0x00000000);
7642 spr_register_kvm(env
, SPR_POWER_PMC6
, "PMC6",
7643 SPR_NOACCESS
, SPR_NOACCESS
,
7644 &spr_read_generic
, &spr_write_generic
,
7645 KVM_REG_PPC_PMC6
, 0x00000000);
7646 spr_register_kvm(env
, SPR_POWER_SIAR
, "SIAR",
7647 SPR_NOACCESS
, SPR_NOACCESS
,
7648 &spr_read_generic
, &spr_write_generic
,
7649 KVM_REG_PPC_SIAR
, 0x00000000);
7650 spr_register_kvm(env
, SPR_POWER_SDAR
, "SDAR",
7651 SPR_NOACCESS
, SPR_NOACCESS
,
7652 &spr_read_generic
, &spr_write_generic
,
7653 KVM_REG_PPC_SDAR
, 0x00000000);
7656 static void gen_spr_book3s_pmu_user(CPUPPCState
*env
)
7658 spr_register(env
, SPR_POWER_UMMCR0
, "UMMCR0",
7659 &spr_read_ureg
, SPR_NOACCESS
,
7660 &spr_read_ureg
, &spr_write_ureg
,
7662 spr_register(env
, SPR_POWER_UMMCR1
, "UMMCR1",
7663 &spr_read_ureg
, SPR_NOACCESS
,
7664 &spr_read_ureg
, &spr_write_ureg
,
7666 spr_register(env
, SPR_POWER_UMMCRA
, "UMMCRA",
7667 &spr_read_ureg
, SPR_NOACCESS
,
7668 &spr_read_ureg
, &spr_write_ureg
,
7670 spr_register(env
, SPR_POWER_UPMC1
, "UPMC1",
7671 &spr_read_ureg
, SPR_NOACCESS
,
7672 &spr_read_ureg
, &spr_write_ureg
,
7674 spr_register(env
, SPR_POWER_UPMC2
, "UPMC2",
7675 &spr_read_ureg
, SPR_NOACCESS
,
7676 &spr_read_ureg
, &spr_write_ureg
,
7678 spr_register(env
, SPR_POWER_UPMC3
, "UPMC3",
7679 &spr_read_ureg
, SPR_NOACCESS
,
7680 &spr_read_ureg
, &spr_write_ureg
,
7682 spr_register(env
, SPR_POWER_UPMC4
, "UPMC4",
7683 &spr_read_ureg
, SPR_NOACCESS
,
7684 &spr_read_ureg
, &spr_write_ureg
,
7686 spr_register(env
, SPR_POWER_UPMC5
, "UPMC5",
7687 &spr_read_ureg
, SPR_NOACCESS
,
7688 &spr_read_ureg
, &spr_write_ureg
,
7690 spr_register(env
, SPR_POWER_UPMC6
, "UPMC6",
7691 &spr_read_ureg
, SPR_NOACCESS
,
7692 &spr_read_ureg
, &spr_write_ureg
,
7694 spr_register(env
, SPR_POWER_USIAR
, "USIAR",
7695 &spr_read_ureg
, SPR_NOACCESS
,
7696 &spr_read_ureg
, &spr_write_ureg
,
7698 spr_register(env
, SPR_POWER_USDAR
, "USDAR",
7699 &spr_read_ureg
, SPR_NOACCESS
,
7700 &spr_read_ureg
, &spr_write_ureg
,
7704 static void gen_spr_970_pmu_sup(CPUPPCState
*env
)
7706 spr_register_kvm(env
, SPR_970_PMC7
, "PMC7",
7707 SPR_NOACCESS
, SPR_NOACCESS
,
7708 &spr_read_generic
, &spr_write_generic
,
7709 KVM_REG_PPC_PMC7
, 0x00000000);
7710 spr_register_kvm(env
, SPR_970_PMC8
, "PMC8",
7711 SPR_NOACCESS
, SPR_NOACCESS
,
7712 &spr_read_generic
, &spr_write_generic
,
7713 KVM_REG_PPC_PMC8
, 0x00000000);
7716 static void gen_spr_970_pmu_user(CPUPPCState
*env
)
7718 spr_register(env
, SPR_970_UPMC7
, "UPMC7",
7719 &spr_read_ureg
, SPR_NOACCESS
,
7720 &spr_read_ureg
, &spr_write_ureg
,
7722 spr_register(env
, SPR_970_UPMC8
, "UPMC8",
7723 &spr_read_ureg
, SPR_NOACCESS
,
7724 &spr_read_ureg
, &spr_write_ureg
,
7728 static void gen_spr_power8_pmu_sup(CPUPPCState
*env
)
7730 spr_register_kvm(env
, SPR_POWER_MMCR2
, "MMCR2",
7731 SPR_NOACCESS
, SPR_NOACCESS
,
7732 &spr_read_generic
, &spr_write_generic
,
7733 KVM_REG_PPC_MMCR2
, 0x00000000);
7734 spr_register_kvm(env
, SPR_POWER_MMCRS
, "MMCRS",
7735 SPR_NOACCESS
, SPR_NOACCESS
,
7736 &spr_read_generic
, &spr_write_generic
,
7737 KVM_REG_PPC_MMCRS
, 0x00000000);
7738 spr_register_kvm(env
, SPR_POWER_SIER
, "SIER",
7739 SPR_NOACCESS
, SPR_NOACCESS
,
7740 &spr_read_generic
, &spr_write_generic
,
7741 KVM_REG_PPC_SIER
, 0x00000000);
7742 spr_register_kvm(env
, SPR_POWER_SPMC1
, "SPMC1",
7743 SPR_NOACCESS
, SPR_NOACCESS
,
7744 &spr_read_generic
, &spr_write_generic
,
7745 KVM_REG_PPC_SPMC1
, 0x00000000);
7746 spr_register_kvm(env
, SPR_POWER_SPMC2
, "SPMC2",
7747 SPR_NOACCESS
, SPR_NOACCESS
,
7748 &spr_read_generic
, &spr_write_generic
,
7749 KVM_REG_PPC_SPMC2
, 0x00000000);
7750 spr_register_kvm(env
, SPR_TACR
, "TACR",
7751 SPR_NOACCESS
, SPR_NOACCESS
,
7752 &spr_read_generic
, &spr_write_generic
,
7753 KVM_REG_PPC_TACR
, 0x00000000);
7754 spr_register_kvm(env
, SPR_TCSCR
, "TCSCR",
7755 SPR_NOACCESS
, SPR_NOACCESS
,
7756 &spr_read_generic
, &spr_write_generic
,
7757 KVM_REG_PPC_TCSCR
, 0x00000000);
7758 spr_register_kvm(env
, SPR_CSIGR
, "CSIGR",
7759 SPR_NOACCESS
, SPR_NOACCESS
,
7760 &spr_read_generic
, &spr_write_generic
,
7761 KVM_REG_PPC_CSIGR
, 0x00000000);
7764 static void gen_spr_power8_pmu_user(CPUPPCState
*env
)
7766 spr_register(env
, SPR_POWER_UMMCR2
, "UMMCR2",
7767 &spr_read_ureg
, SPR_NOACCESS
,
7768 &spr_read_ureg
, &spr_write_ureg
,
7770 spr_register(env
, SPR_POWER_USIER
, "USIER",
7771 &spr_read_generic
, SPR_NOACCESS
,
7772 &spr_read_generic
, &spr_write_generic
,
7776 static void gen_spr_power5p_ear(CPUPPCState
*env
)
7778 /* External access control */
7779 spr_register(env
, SPR_EAR
, "EAR",
7780 SPR_NOACCESS
, SPR_NOACCESS
,
7781 &spr_read_generic
, &spr_write_generic
,
7785 static void gen_spr_power5p_lpar(CPUPPCState
*env
)
7787 /* Logical partitionning */
7788 spr_register_kvm(env
, SPR_LPCR
, "LPCR",
7789 SPR_NOACCESS
, SPR_NOACCESS
,
7790 &spr_read_generic
, &spr_write_generic
,
7791 KVM_REG_PPC_LPCR
, 0x00000000);
7794 static void gen_spr_book3s_ids(CPUPPCState
*env
)
7796 /* Processor identification */
7797 spr_register(env
, SPR_PIR
, "PIR",
7798 SPR_NOACCESS
, SPR_NOACCESS
,
7799 &spr_read_generic
, &spr_write_pir
,
7803 static void gen_spr_power8_ids(CPUPPCState
*env
)
7805 /* Thread identification */
7806 spr_register(env
, SPR_TIR
, "TIR",
7807 SPR_NOACCESS
, SPR_NOACCESS
,
7808 &spr_read_generic
, SPR_NOACCESS
,
7812 static void gen_spr_book3s_purr(CPUPPCState
*env
)
7814 #if !defined(CONFIG_USER_ONLY)
7815 /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
7816 spr_register_kvm(env
, SPR_PURR
, "PURR",
7817 &spr_read_purr
, SPR_NOACCESS
,
7818 &spr_read_purr
, SPR_NOACCESS
,
7819 KVM_REG_PPC_PURR
, 0x00000000);
7820 spr_register_kvm(env
, SPR_SPURR
, "SPURR",
7821 &spr_read_purr
, SPR_NOACCESS
,
7822 &spr_read_purr
, SPR_NOACCESS
,
7823 KVM_REG_PPC_SPURR
, 0x00000000);
7827 static void gen_spr_power6_dbg(CPUPPCState
*env
)
7829 #if !defined(CONFIG_USER_ONLY)
7830 spr_register(env
, SPR_CFAR
, "SPR_CFAR",
7831 SPR_NOACCESS
, SPR_NOACCESS
,
7832 &spr_read_cfar
, &spr_write_cfar
,
7837 static void gen_spr_power5p_common(CPUPPCState
*env
)
7839 spr_register_kvm(env
, SPR_PPR
, "PPR",
7840 &spr_read_generic
, &spr_write_generic
,
7841 &spr_read_generic
, &spr_write_generic
,
7842 KVM_REG_PPC_PPR
, 0x00000000);
7845 static void gen_spr_power6_common(CPUPPCState
*env
)
7847 #if !defined(CONFIG_USER_ONLY)
7848 spr_register_kvm(env
, SPR_DSCR
, "SPR_DSCR",
7849 SPR_NOACCESS
, SPR_NOACCESS
,
7850 &spr_read_generic
, &spr_write_generic
,
7851 KVM_REG_PPC_DSCR
, 0x00000000);
7854 * Register PCR to report POWERPC_EXCP_PRIV_REG instead of
7855 * POWERPC_EXCP_INVAL_SPR.
7857 spr_register(env
, SPR_PCR
, "PCR",
7858 SPR_NOACCESS
, SPR_NOACCESS
,
7859 SPR_NOACCESS
, SPR_NOACCESS
,
7863 static void spr_read_tar(DisasContext
*ctx
, int gprn
, int sprn
)
7865 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
7866 spr_read_generic(ctx
, gprn
, sprn
);
7869 static void spr_write_tar(DisasContext
*ctx
, int sprn
, int gprn
)
7871 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
7872 spr_write_generic(ctx
, sprn
, gprn
);
7875 static void gen_spr_power8_tce_address_control(CPUPPCState
*env
)
7877 spr_register_kvm(env
, SPR_TAR
, "TAR",
7878 &spr_read_tar
, &spr_write_tar
,
7879 &spr_read_generic
, &spr_write_generic
,
7880 KVM_REG_PPC_TAR
, 0x00000000);
7883 static void spr_read_tm(DisasContext
*ctx
, int gprn
, int sprn
)
7885 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
7886 spr_read_generic(ctx
, gprn
, sprn
);
7889 static void spr_write_tm(DisasContext
*ctx
, int sprn
, int gprn
)
7891 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
7892 spr_write_generic(ctx
, sprn
, gprn
);
7895 static void spr_read_tm_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
7897 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
7898 spr_read_prev_upper32(ctx
, gprn
, sprn
);
7901 static void spr_write_tm_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
7903 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
7904 spr_write_prev_upper32(ctx
, sprn
, gprn
);
7907 static void gen_spr_power8_tm(CPUPPCState
*env
)
7909 spr_register_kvm(env
, SPR_TFHAR
, "TFHAR",
7910 &spr_read_tm
, &spr_write_tm
,
7911 &spr_read_tm
, &spr_write_tm
,
7912 KVM_REG_PPC_TFHAR
, 0x00000000);
7913 spr_register_kvm(env
, SPR_TFIAR
, "TFIAR",
7914 &spr_read_tm
, &spr_write_tm
,
7915 &spr_read_tm
, &spr_write_tm
,
7916 KVM_REG_PPC_TFIAR
, 0x00000000);
7917 spr_register_kvm(env
, SPR_TEXASR
, "TEXASR",
7918 &spr_read_tm
, &spr_write_tm
,
7919 &spr_read_tm
, &spr_write_tm
,
7920 KVM_REG_PPC_TEXASR
, 0x00000000);
7921 spr_register(env
, SPR_TEXASRU
, "TEXASRU",
7922 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
7923 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
7927 static void spr_read_ebb(DisasContext
*ctx
, int gprn
, int sprn
)
7929 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
7930 spr_read_generic(ctx
, gprn
, sprn
);
7933 static void spr_write_ebb(DisasContext
*ctx
, int sprn
, int gprn
)
7935 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
7936 spr_write_generic(ctx
, sprn
, gprn
);
7939 static void spr_read_ebb_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
7941 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
7942 spr_read_prev_upper32(ctx
, gprn
, sprn
);
7945 static void spr_write_ebb_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
7947 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
7948 spr_write_prev_upper32(ctx
, sprn
, gprn
);
7951 static void gen_spr_power8_ebb(CPUPPCState
*env
)
7953 spr_register(env
, SPR_BESCRS
, "BESCRS",
7954 &spr_read_ebb
, &spr_write_ebb
,
7955 &spr_read_generic
, &spr_write_generic
,
7957 spr_register(env
, SPR_BESCRSU
, "BESCRSU",
7958 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
7959 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
7961 spr_register(env
, SPR_BESCRR
, "BESCRR",
7962 &spr_read_ebb
, &spr_write_ebb
,
7963 &spr_read_generic
, &spr_write_generic
,
7965 spr_register(env
, SPR_BESCRRU
, "BESCRRU",
7966 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
7967 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
7969 spr_register_kvm(env
, SPR_EBBHR
, "EBBHR",
7970 &spr_read_ebb
, &spr_write_ebb
,
7971 &spr_read_generic
, &spr_write_generic
,
7972 KVM_REG_PPC_EBBHR
, 0x00000000);
7973 spr_register_kvm(env
, SPR_EBBRR
, "EBBRR",
7974 &spr_read_ebb
, &spr_write_ebb
,
7975 &spr_read_generic
, &spr_write_generic
,
7976 KVM_REG_PPC_EBBRR
, 0x00000000);
7977 spr_register_kvm(env
, SPR_BESCR
, "BESCR",
7978 &spr_read_ebb
, &spr_write_ebb
,
7979 &spr_read_generic
, &spr_write_generic
,
7980 KVM_REG_PPC_BESCR
, 0x00000000);
7983 /* Virtual Time Base */
7984 static void gen_spr_vtb(CPUPPCState
*env
)
7986 spr_register(env
, SPR_VTB
, "VTB",
7987 SPR_NOACCESS
, SPR_NOACCESS
,
7988 &spr_read_tbl
, SPR_NOACCESS
,
7992 static void gen_spr_power8_fscr(CPUPPCState
*env
)
7994 #if defined(CONFIG_USER_ONLY)
7995 target_ulong initval
= 1ULL << FSCR_TAR
;
7997 target_ulong initval
= 0;
7999 spr_register_kvm(env
, SPR_FSCR
, "FSCR",
8000 SPR_NOACCESS
, SPR_NOACCESS
,
8001 &spr_read_generic
, &spr_write_generic
,
8002 KVM_REG_PPC_FSCR
, initval
);
8005 static void gen_spr_power8_pspb(CPUPPCState
*env
)
8007 spr_register_kvm(env
, SPR_PSPB
, "PSPB",
8008 SPR_NOACCESS
, SPR_NOACCESS
,
8009 &spr_read_generic
, &spr_write_generic32
,
8010 KVM_REG_PPC_PSPB
, 0);
8013 static void gen_spr_power8_ic(CPUPPCState
*env
)
8015 #if !defined(CONFIG_USER_ONLY)
8016 spr_register_hv(env
, SPR_IC
, "IC",
8017 SPR_NOACCESS
, SPR_NOACCESS
,
8018 &spr_read_generic
, SPR_NOACCESS
,
8019 &spr_read_generic
, &spr_write_generic
,
8024 static void gen_spr_power8_book4(CPUPPCState
*env
)
8026 /* Add a number of P8 book4 registers */
8027 #if !defined(CONFIG_USER_ONLY)
8028 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
8029 SPR_NOACCESS
, SPR_NOACCESS
,
8030 &spr_read_generic
, &spr_write_generic
,
8031 KVM_REG_PPC_ACOP
, 0);
8032 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
8033 SPR_NOACCESS
, SPR_NOACCESS
,
8034 &spr_read_generic
, &spr_write_generic
,
8035 KVM_REG_PPC_PID
, 0);
8036 spr_register_kvm(env
, SPR_WORT
, "WORT",
8037 SPR_NOACCESS
, SPR_NOACCESS
,
8038 &spr_read_generic
, &spr_write_generic
,
8039 KVM_REG_PPC_WORT
, 0);
8043 static void init_proc_book3s_64(CPUPPCState
*env
, int version
)
8045 gen_spr_ne_601(env
);
8047 gen_spr_book3s_altivec(env
);
8048 gen_spr_book3s_pmu_sup(env
);
8049 gen_spr_book3s_pmu_user(env
);
8050 gen_spr_book3s_common(env
);
8053 case BOOK3S_CPU_970
:
8054 case BOOK3S_CPU_POWER5PLUS
:
8055 gen_spr_970_hid(env
);
8056 gen_spr_970_hior(env
);
8058 gen_spr_970_pmu_sup(env
);
8059 gen_spr_970_pmu_user(env
);
8061 case BOOK3S_CPU_POWER7
:
8062 case BOOK3S_CPU_POWER8
:
8063 gen_spr_book3s_ids(env
);
8064 gen_spr_amr(env
, version
>= BOOK3S_CPU_POWER8
);
8065 gen_spr_book3s_purr(env
);
8066 env
->ci_large_pages
= true;
8069 g_assert_not_reached();
8071 if (version
>= BOOK3S_CPU_POWER5PLUS
) {
8072 gen_spr_power5p_common(env
);
8073 gen_spr_power5p_lpar(env
);
8074 gen_spr_power5p_ear(env
);
8076 gen_spr_970_lpar(env
);
8078 if (version
== BOOK3S_CPU_970
) {
8079 gen_spr_970_dbg(env
);
8081 if (version
>= BOOK3S_CPU_POWER6
) {
8082 gen_spr_power6_common(env
);
8083 gen_spr_power6_dbg(env
);
8085 if (version
>= BOOK3S_CPU_POWER8
) {
8086 gen_spr_power8_tce_address_control(env
);
8087 gen_spr_power8_ids(env
);
8088 gen_spr_power8_ebb(env
);
8089 gen_spr_power8_fscr(env
);
8090 gen_spr_power8_pmu_sup(env
);
8091 gen_spr_power8_pmu_user(env
);
8092 gen_spr_power8_tm(env
);
8093 gen_spr_power8_pspb(env
);
8095 gen_spr_power8_ic(env
);
8096 gen_spr_power8_book4(env
);
8098 if (version
< BOOK3S_CPU_POWER8
) {
8099 gen_spr_book3s_dbg(env
);
8101 gen_spr_book3s_207_dbg(env
);
8103 #if !defined(CONFIG_USER_ONLY)
8105 case BOOK3S_CPU_970
:
8106 case BOOK3S_CPU_POWER5PLUS
:
8109 case BOOK3S_CPU_POWER7
:
8110 case BOOK3S_CPU_POWER8
:
8116 /* Allocate hardware IRQ controller */
8118 case BOOK3S_CPU_970
:
8119 case BOOK3S_CPU_POWER5PLUS
:
8121 ppc970_irq_init(env
);
8123 case BOOK3S_CPU_POWER7
:
8124 case BOOK3S_CPU_POWER8
:
8125 init_excp_POWER7(env
);
8126 ppcPOWER7_irq_init(env
);
8129 g_assert_not_reached();
8132 env
->dcache_line_size
= 128;
8133 env
->icache_line_size
= 128;
8136 static void init_proc_970(CPUPPCState
*env
)
8138 init_proc_book3s_64(env
, BOOK3S_CPU_970
);
8141 POWERPC_FAMILY(970)(ObjectClass
*oc
, void *data
)
8143 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8144 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8146 dc
->desc
= "PowerPC 970";
8147 pcc
->init_proc
= init_proc_970
;
8148 pcc
->check_pow
= check_pow_970
;
8149 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8150 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8151 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8153 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8154 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8155 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8156 PPC_64B
| PPC_ALTIVEC
|
8157 PPC_SEGMENT_64B
| PPC_SLBI
;
8158 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8159 pcc
->msr_mask
= (1ull << MSR_SF
) |
8174 pcc
->mmu_model
= POWERPC_MMU_64B
;
8175 #if defined(CONFIG_SOFTMMU)
8176 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8178 pcc
->excp_model
= POWERPC_EXCP_970
;
8179 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8180 pcc
->bfd_mach
= bfd_mach_ppc64
;
8181 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8182 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8183 POWERPC_FLAG_BUS_CLK
;
8184 pcc
->l1_dcache_size
= 0x8000;
8185 pcc
->l1_icache_size
= 0x10000;
8188 static void init_proc_power5plus(CPUPPCState
*env
)
8190 init_proc_book3s_64(env
, BOOK3S_CPU_POWER5PLUS
);
8193 POWERPC_FAMILY(POWER5P
)(ObjectClass
*oc
, void *data
)
8195 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8196 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8198 dc
->fw_name
= "PowerPC,POWER5";
8199 dc
->desc
= "POWER5+";
8200 pcc
->init_proc
= init_proc_power5plus
;
8201 pcc
->check_pow
= check_pow_970
;
8202 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8203 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8204 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8206 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8207 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8208 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8210 PPC_SEGMENT_64B
| PPC_SLBI
;
8211 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8212 pcc
->msr_mask
= (1ull << MSR_SF
) |
8227 pcc
->mmu_model
= POWERPC_MMU_2_03
;
8228 #if defined(CONFIG_SOFTMMU)
8229 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8231 pcc
->excp_model
= POWERPC_EXCP_970
;
8232 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8233 pcc
->bfd_mach
= bfd_mach_ppc64
;
8234 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8235 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8236 POWERPC_FLAG_BUS_CLK
;
8237 pcc
->l1_dcache_size
= 0x8000;
8238 pcc
->l1_icache_size
= 0x10000;
8241 static void powerpc_get_compat(Object
*obj
, Visitor
*v
, const char *name
,
8242 void *opaque
, Error
**errp
)
8244 char *value
= (char *)"";
8245 Property
*prop
= opaque
;
8246 uint32_t *max_compat
= qdev_get_prop_ptr(DEVICE(obj
), prop
);
8248 switch (*max_compat
) {
8249 case CPU_POWERPC_LOGICAL_2_05
:
8250 value
= (char *)"power6";
8252 case CPU_POWERPC_LOGICAL_2_06
:
8253 value
= (char *)"power7";
8255 case CPU_POWERPC_LOGICAL_2_07
:
8256 value
= (char *)"power8";
8261 error_setg(errp
, "Internal error: compat is set to %x",
8262 max_compat
? *max_compat
: -1);
8266 visit_type_str(v
, name
, &value
, errp
);
8269 static void powerpc_set_compat(Object
*obj
, Visitor
*v
, const char *name
,
8270 void *opaque
, Error
**errp
)
8272 Error
*error
= NULL
;
8274 Property
*prop
= opaque
;
8275 uint32_t *max_compat
= qdev_get_prop_ptr(DEVICE(obj
), prop
);
8277 visit_type_str(v
, name
, &value
, &error
);
8279 error_propagate(errp
, error
);
8283 if (strcmp(value
, "power6") == 0) {
8284 *max_compat
= CPU_POWERPC_LOGICAL_2_05
;
8285 } else if (strcmp(value
, "power7") == 0) {
8286 *max_compat
= CPU_POWERPC_LOGICAL_2_06
;
8287 } else if (strcmp(value
, "power8") == 0) {
8288 *max_compat
= CPU_POWERPC_LOGICAL_2_07
;
8290 error_setg(errp
, "Invalid compatibility mode \"%s\"", value
);
8296 static PropertyInfo powerpc_compat_propinfo
= {
8298 .description
= "compatibility mode, power6/power7/power8",
8299 .get
= powerpc_get_compat
,
8300 .set
= powerpc_set_compat
,
8303 #define DEFINE_PROP_POWERPC_COMPAT(_n, _s, _f) \
8304 DEFINE_PROP(_n, _s, _f, powerpc_compat_propinfo, uint32_t)
8306 static Property powerpc_servercpu_properties
[] = {
8307 DEFINE_PROP_POWERPC_COMPAT("compat", PowerPCCPU
, max_compat
),
8308 DEFINE_PROP_END_OF_LIST(),
8311 #ifdef CONFIG_SOFTMMU
8312 static const struct ppc_segment_page_sizes POWER7_POWER8_sps
= {
8315 .page_shift
= 12, /* 4K */
8317 .enc
= { { .page_shift
= 12, .pte_enc
= 0 },
8318 { .page_shift
= 16, .pte_enc
= 0x7 },
8319 { .page_shift
= 24, .pte_enc
= 0x38 }, },
8322 .page_shift
= 16, /* 64K */
8323 .slb_enc
= SLB_VSID_64K
,
8324 .enc
= { { .page_shift
= 16, .pte_enc
= 0x1 },
8325 { .page_shift
= 24, .pte_enc
= 0x8 }, },
8328 .page_shift
= 24, /* 16M */
8329 .slb_enc
= SLB_VSID_16M
,
8330 .enc
= { { .page_shift
= 24, .pte_enc
= 0 }, },
8333 .page_shift
= 34, /* 16G */
8334 .slb_enc
= SLB_VSID_16G
,
8335 .enc
= { { .page_shift
= 34, .pte_enc
= 0x3 }, },
8339 #endif /* CONFIG_SOFTMMU */
8341 static void init_proc_POWER7 (CPUPPCState
*env
)
8343 init_proc_book3s_64(env
, BOOK3S_CPU_POWER7
);
8346 static bool ppc_pvr_match_power7(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8348 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7P_BASE
) {
8351 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7_BASE
) {
8357 POWERPC_FAMILY(POWER7
)(ObjectClass
*oc
, void *data
)
8359 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8360 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8362 dc
->fw_name
= "PowerPC,POWER7";
8363 dc
->desc
= "POWER7";
8364 dc
->props
= powerpc_servercpu_properties
;
8365 pcc
->pvr_match
= ppc_pvr_match_power7
;
8366 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
;
8367 pcc
->init_proc
= init_proc_POWER7
;
8368 pcc
->check_pow
= check_pow_nocheck
;
8369 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8370 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8371 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8372 PPC_FLOAT_FRSQRTES
|
8375 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8376 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8377 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8378 PPC_64B
| PPC_ALTIVEC
|
8379 PPC_SEGMENT_64B
| PPC_SLBI
|
8380 PPC_POPCNTB
| PPC_POPCNTWD
;
8381 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
8382 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8383 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8384 PPC2_FP_TST_ISA206
| PPC2_FP_CVT_S64
;
8385 pcc
->msr_mask
= (1ull << MSR_SF
) |
8401 pcc
->mmu_model
= POWERPC_MMU_2_06
;
8402 #if defined(CONFIG_SOFTMMU)
8403 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8404 pcc
->sps
= &POWER7_POWER8_sps
;
8406 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
8407 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8408 pcc
->bfd_mach
= bfd_mach_ppc64
;
8409 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8410 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8411 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8413 pcc
->l1_dcache_size
= 0x8000;
8414 pcc
->l1_icache_size
= 0x8000;
8415 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8418 static void init_proc_POWER8(CPUPPCState
*env
)
8420 init_proc_book3s_64(env
, BOOK3S_CPU_POWER8
);
8423 static bool ppc_pvr_match_power8(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8425 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8NVL_BASE
) {
8428 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8E_BASE
) {
8431 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8_BASE
) {
8437 POWERPC_FAMILY(POWER8
)(ObjectClass
*oc
, void *data
)
8439 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8440 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8442 dc
->fw_name
= "PowerPC,POWER8";
8443 dc
->desc
= "POWER8";
8444 dc
->props
= powerpc_servercpu_properties
;
8445 pcc
->pvr_match
= ppc_pvr_match_power8
;
8446 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
;
8447 pcc
->init_proc
= init_proc_POWER8
;
8448 pcc
->check_pow
= check_pow_nocheck
;
8449 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8450 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8451 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8452 PPC_FLOAT_FRSQRTES
|
8455 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8456 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8457 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8458 PPC_64B
| PPC_64BX
| PPC_ALTIVEC
|
8459 PPC_SEGMENT_64B
| PPC_SLBI
|
8460 PPC_POPCNTB
| PPC_POPCNTWD
;
8461 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
8462 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8463 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8464 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
8465 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
8466 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
8468 pcc
->msr_mask
= (1ull << MSR_SF
) |
8485 pcc
->mmu_model
= POWERPC_MMU_2_07
;
8486 #if defined(CONFIG_SOFTMMU)
8487 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8488 pcc
->sps
= &POWER7_POWER8_sps
;
8490 pcc
->excp_model
= POWERPC_EXCP_POWER8
;
8491 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8492 pcc
->bfd_mach
= bfd_mach_ppc64
;
8493 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8494 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8495 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8496 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
;
8497 pcc
->l1_dcache_size
= 0x8000;
8498 pcc
->l1_icache_size
= 0x8000;
8499 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8502 #if !defined(CONFIG_USER_ONLY)
8504 void cpu_ppc_set_papr(PowerPCCPU
*cpu
)
8506 CPUPPCState
*env
= &cpu
->env
;
8507 ppc_spr_t
*amor
= &env
->spr_cb
[SPR_AMOR
];
8509 /* PAPR always has exception vectors in RAM not ROM. To ensure this,
8510 * MSR[IP] should never be set.
8512 * We also disallow setting of MSR_HV
8514 env
->msr_mask
&= ~((1ull << MSR_EP
) | MSR_HVB
);
8516 /* Set a full AMOR so guest can use the AMR as it sees fit */
8517 env
->spr
[SPR_AMOR
] = amor
->default_value
= 0xffffffffffffffffull
;
8519 /* Tell KVM that we're in PAPR mode */
8520 if (kvm_enabled()) {
8521 kvmppc_set_papr(cpu
);
8525 #endif /* !defined(CONFIG_USER_ONLY) */
8527 #endif /* defined (TARGET_PPC64) */
8529 /*****************************************************************************/
8530 /* Generic CPU instantiation routine */
8531 static void init_ppc_proc(PowerPCCPU
*cpu
)
8533 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8534 CPUPPCState
*env
= &cpu
->env
;
8535 #if !defined(CONFIG_USER_ONLY)
8538 env
->irq_inputs
= NULL
;
8539 /* Set all exception vectors to an invalid address */
8540 for (i
= 0; i
< POWERPC_EXCP_NB
; i
++)
8541 env
->excp_vectors
[i
] = (target_ulong
)(-1ULL);
8542 env
->ivor_mask
= 0x00000000;
8543 env
->ivpr_mask
= 0x00000000;
8544 /* Default MMU definitions */
8548 env
->tlb_type
= TLB_NONE
;
8550 /* Register SPR common to all PowerPC implementations */
8551 gen_spr_generic(env
);
8552 spr_register(env
, SPR_PVR
, "PVR",
8553 /* Linux permits userspace to read PVR */
8554 #if defined(CONFIG_LINUX_USER)
8560 &spr_read_generic
, SPR_NOACCESS
,
8562 /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
8563 if (pcc
->svr
!= POWERPC_SVR_NONE
) {
8564 if (pcc
->svr
& POWERPC_SVR_E500
) {
8565 spr_register(env
, SPR_E500_SVR
, "SVR",
8566 SPR_NOACCESS
, SPR_NOACCESS
,
8567 &spr_read_generic
, SPR_NOACCESS
,
8568 pcc
->svr
& ~POWERPC_SVR_E500
);
8570 spr_register(env
, SPR_SVR
, "SVR",
8571 SPR_NOACCESS
, SPR_NOACCESS
,
8572 &spr_read_generic
, SPR_NOACCESS
,
8576 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
8577 (*pcc
->init_proc
)(env
);
8579 /* MSR bits & flags consistency checks */
8580 if (env
->msr_mask
& (1 << 25)) {
8581 switch (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
8582 case POWERPC_FLAG_SPE
:
8583 case POWERPC_FLAG_VRE
:
8586 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8587 "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
8590 } else if (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
8591 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8592 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
8595 if (env
->msr_mask
& (1 << 17)) {
8596 switch (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8597 case POWERPC_FLAG_TGPR
:
8598 case POWERPC_FLAG_CE
:
8601 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8602 "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
8605 } else if (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8606 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8607 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
8610 if (env
->msr_mask
& (1 << 10)) {
8611 switch (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8612 POWERPC_FLAG_UBLE
)) {
8613 case POWERPC_FLAG_SE
:
8614 case POWERPC_FLAG_DWE
:
8615 case POWERPC_FLAG_UBLE
:
8618 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8619 "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
8620 "POWERPC_FLAG_UBLE\n");
8623 } else if (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8624 POWERPC_FLAG_UBLE
)) {
8625 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8626 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
8627 "POWERPC_FLAG_UBLE\n");
8630 if (env
->msr_mask
& (1 << 9)) {
8631 switch (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8632 case POWERPC_FLAG_BE
:
8633 case POWERPC_FLAG_DE
:
8636 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8637 "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
8640 } else if (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8641 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8642 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
8645 if (env
->msr_mask
& (1 << 2)) {
8646 switch (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8647 case POWERPC_FLAG_PX
:
8648 case POWERPC_FLAG_PMM
:
8651 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8652 "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
8655 } else if (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8656 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8657 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
8660 if ((env
->flags
& (POWERPC_FLAG_RTC_CLK
| POWERPC_FLAG_BUS_CLK
)) == 0) {
8661 fprintf(stderr
, "PowerPC flags inconsistency\n"
8662 "Should define the time-base and decrementer clock source\n");
8665 /* Allocate TLBs buffer when needed */
8666 #if !defined(CONFIG_USER_ONLY)
8667 if (env
->nb_tlb
!= 0) {
8668 int nb_tlb
= env
->nb_tlb
;
8669 if (env
->id_tlbs
!= 0)
8671 switch (env
->tlb_type
) {
8673 env
->tlb
.tlb6
= g_malloc0(nb_tlb
* sizeof(ppc6xx_tlb_t
));
8676 env
->tlb
.tlbe
= g_malloc0(nb_tlb
* sizeof(ppcemb_tlb_t
));
8679 env
->tlb
.tlbm
= g_malloc0(nb_tlb
* sizeof(ppcmas_tlb_t
));
8682 /* Pre-compute some useful values */
8683 env
->tlb_per_way
= env
->nb_tlb
/ env
->nb_ways
;
8685 if (env
->irq_inputs
== NULL
) {
8686 fprintf(stderr
, "WARNING: no internal IRQ controller registered.\n"
8687 " Attempt QEMU to crash very soon !\n");
8690 if (env
->check_pow
== NULL
) {
8691 fprintf(stderr
, "WARNING: no power management check handler "
8693 " Attempt QEMU to crash very soon !\n");
8697 #if defined(PPC_DUMP_CPU)
8698 static void dump_ppc_sprs (CPUPPCState
*env
)
8701 #if !defined(CONFIG_USER_ONLY)
8707 printf("Special purpose registers:\n");
8708 for (i
= 0; i
< 32; i
++) {
8709 for (j
= 0; j
< 32; j
++) {
8711 spr
= &env
->spr_cb
[n
];
8712 uw
= spr
->uea_write
!= NULL
&& spr
->uea_write
!= SPR_NOACCESS
;
8713 ur
= spr
->uea_read
!= NULL
&& spr
->uea_read
!= SPR_NOACCESS
;
8714 #if !defined(CONFIG_USER_ONLY)
8715 sw
= spr
->oea_write
!= NULL
&& spr
->oea_write
!= SPR_NOACCESS
;
8716 sr
= spr
->oea_read
!= NULL
&& spr
->oea_read
!= SPR_NOACCESS
;
8717 if (sw
|| sr
|| uw
|| ur
) {
8718 printf("SPR: %4d (%03x) %-8s s%c%c u%c%c\n",
8719 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
8720 sw
? 'w' : '-', sr
? 'r' : '-',
8721 uw
? 'w' : '-', ur
? 'r' : '-');
8725 printf("SPR: %4d (%03x) %-8s u%c%c\n",
8726 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
8727 uw
? 'w' : '-', ur
? 'r' : '-');
8737 /*****************************************************************************/
8741 PPC_DIRECT
= 0, /* Opcode routine */
8742 PPC_INDIRECT
= 1, /* Indirect opcode table */
8745 #define PPC_OPCODE_MASK 0x3
8747 static inline int is_indirect_opcode (void *handler
)
8749 return ((uintptr_t)handler
& PPC_OPCODE_MASK
) == PPC_INDIRECT
;
8752 static inline opc_handler_t
**ind_table(void *handler
)
8754 return (opc_handler_t
**)((uintptr_t)handler
& ~PPC_OPCODE_MASK
);
8757 /* Instruction table creation */
8758 /* Opcodes tables creation */
8759 static void fill_new_table (opc_handler_t
**table
, int len
)
8763 for (i
= 0; i
< len
; i
++)
8764 table
[i
] = &invalid_handler
;
8767 static int create_new_table (opc_handler_t
**table
, unsigned char idx
)
8769 opc_handler_t
**tmp
;
8771 tmp
= g_new(opc_handler_t
*, PPC_CPU_INDIRECT_OPCODES_LEN
);
8772 fill_new_table(tmp
, PPC_CPU_INDIRECT_OPCODES_LEN
);
8773 table
[idx
] = (opc_handler_t
*)((uintptr_t)tmp
| PPC_INDIRECT
);
8778 static int insert_in_table (opc_handler_t
**table
, unsigned char idx
,
8779 opc_handler_t
*handler
)
8781 if (table
[idx
] != &invalid_handler
)
8783 table
[idx
] = handler
;
8788 static int register_direct_insn (opc_handler_t
**ppc_opcodes
,
8789 unsigned char idx
, opc_handler_t
*handler
)
8791 if (insert_in_table(ppc_opcodes
, idx
, handler
) < 0) {
8792 printf("*** ERROR: opcode %02x already assigned in main "
8793 "opcode table\n", idx
);
8794 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8795 printf(" Registered handler '%s' - new handler '%s'\n",
8796 ppc_opcodes
[idx
]->oname
, handler
->oname
);
8804 static int register_ind_in_table (opc_handler_t
**table
,
8805 unsigned char idx1
, unsigned char idx2
,
8806 opc_handler_t
*handler
)
8808 if (table
[idx1
] == &invalid_handler
) {
8809 if (create_new_table(table
, idx1
) < 0) {
8810 printf("*** ERROR: unable to create indirect table "
8811 "idx=%02x\n", idx1
);
8815 if (!is_indirect_opcode(table
[idx1
])) {
8816 printf("*** ERROR: idx %02x already assigned to a direct "
8818 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8819 printf(" Registered handler '%s' - new handler '%s'\n",
8820 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
8825 if (handler
!= NULL
&&
8826 insert_in_table(ind_table(table
[idx1
]), idx2
, handler
) < 0) {
8827 printf("*** ERROR: opcode %02x already assigned in "
8828 "opcode table %02x\n", idx2
, idx1
);
8829 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8830 printf(" Registered handler '%s' - new handler '%s'\n",
8831 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
8839 static int register_ind_insn (opc_handler_t
**ppc_opcodes
,
8840 unsigned char idx1
, unsigned char idx2
,
8841 opc_handler_t
*handler
)
8843 return register_ind_in_table(ppc_opcodes
, idx1
, idx2
, handler
);
8846 static int register_dblind_insn (opc_handler_t
**ppc_opcodes
,
8847 unsigned char idx1
, unsigned char idx2
,
8848 unsigned char idx3
, opc_handler_t
*handler
)
8850 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
8851 printf("*** ERROR: unable to join indirect table idx "
8852 "[%02x-%02x]\n", idx1
, idx2
);
8855 if (register_ind_in_table(ind_table(ppc_opcodes
[idx1
]), idx2
, idx3
,
8857 printf("*** ERROR: unable to insert opcode "
8858 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
8865 static int register_insn (opc_handler_t
**ppc_opcodes
, opcode_t
*insn
)
8867 if (insn
->opc2
!= 0xFF) {
8868 if (insn
->opc3
!= 0xFF) {
8869 if (register_dblind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
8870 insn
->opc3
, &insn
->handler
) < 0)
8873 if (register_ind_insn(ppc_opcodes
, insn
->opc1
,
8874 insn
->opc2
, &insn
->handler
) < 0)
8878 if (register_direct_insn(ppc_opcodes
, insn
->opc1
, &insn
->handler
) < 0)
8885 static int test_opcode_table (opc_handler_t
**table
, int len
)
8889 for (i
= 0, count
= 0; i
< len
; i
++) {
8890 /* Consistency fixup */
8891 if (table
[i
] == NULL
)
8892 table
[i
] = &invalid_handler
;
8893 if (table
[i
] != &invalid_handler
) {
8894 if (is_indirect_opcode(table
[i
])) {
8895 tmp
= test_opcode_table(ind_table(table
[i
]),
8896 PPC_CPU_INDIRECT_OPCODES_LEN
);
8899 table
[i
] = &invalid_handler
;
8912 static void fix_opcode_tables (opc_handler_t
**ppc_opcodes
)
8914 if (test_opcode_table(ppc_opcodes
, PPC_CPU_OPCODES_LEN
) == 0)
8915 printf("*** WARNING: no opcode defined !\n");
8918 /*****************************************************************************/
8919 static void create_ppc_opcodes(PowerPCCPU
*cpu
, Error
**errp
)
8921 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8922 CPUPPCState
*env
= &cpu
->env
;
8925 fill_new_table(env
->opcodes
, PPC_CPU_OPCODES_LEN
);
8926 for (opc
= opcodes
; opc
< &opcodes
[ARRAY_SIZE(opcodes
)]; opc
++) {
8927 if (((opc
->handler
.type
& pcc
->insns_flags
) != 0) ||
8928 ((opc
->handler
.type2
& pcc
->insns_flags2
) != 0)) {
8929 if (register_insn(env
->opcodes
, opc
) < 0) {
8930 error_setg(errp
, "ERROR initializing PowerPC instruction "
8931 "0x%02x 0x%02x 0x%02x", opc
->opc1
, opc
->opc2
,
8937 fix_opcode_tables(env
->opcodes
);
8942 #if defined(PPC_DUMP_CPU)
8943 static void dump_ppc_insns (CPUPPCState
*env
)
8945 opc_handler_t
**table
, *handler
;
8947 uint8_t opc1
, opc2
, opc3
;
8949 printf("Instructions set:\n");
8950 /* opc1 is 6 bits long */
8951 for (opc1
= 0x00; opc1
< PPC_CPU_OPCODES_LEN
; opc1
++) {
8952 table
= env
->opcodes
;
8953 handler
= table
[opc1
];
8954 if (is_indirect_opcode(handler
)) {
8955 /* opc2 is 5 bits long */
8956 for (opc2
= 0; opc2
< PPC_CPU_INDIRECT_OPCODES_LEN
; opc2
++) {
8957 table
= env
->opcodes
;
8958 handler
= env
->opcodes
[opc1
];
8959 table
= ind_table(handler
);
8960 handler
= table
[opc2
];
8961 if (is_indirect_opcode(handler
)) {
8962 table
= ind_table(handler
);
8963 /* opc3 is 5 bits long */
8964 for (opc3
= 0; opc3
< PPC_CPU_INDIRECT_OPCODES_LEN
;
8966 handler
= table
[opc3
];
8967 if (handler
->handler
!= &gen_invalid
) {
8968 /* Special hack to properly dump SPE insns */
8969 p
= strchr(handler
->oname
, '_');
8971 printf("INSN: %02x %02x %02x (%02d %04d) : "
8973 opc1
, opc2
, opc3
, opc1
,
8978 if ((p
- handler
->oname
) != strlen(q
) ||
8979 memcmp(handler
->oname
, q
, strlen(q
)) != 0) {
8980 /* First instruction */
8981 printf("INSN: %02x %02x %02x (%02d %04d) : "
8983 opc1
, opc2
<< 1, opc3
, opc1
,
8984 (opc3
<< 6) | (opc2
<< 1),
8985 (int)(p
- handler
->oname
),
8988 if (strcmp(p
+ 1, q
) != 0) {
8989 /* Second instruction */
8990 printf("INSN: %02x %02x %02x (%02d %04d) : "
8992 opc1
, (opc2
<< 1) | 1, opc3
, opc1
,
8993 (opc3
<< 6) | (opc2
<< 1) | 1,
9000 if (handler
->handler
!= &gen_invalid
) {
9001 printf("INSN: %02x %02x -- (%02d %04d) : %s\n",
9002 opc1
, opc2
, opc1
, opc2
, handler
->oname
);
9007 if (handler
->handler
!= &gen_invalid
) {
9008 printf("INSN: %02x -- -- (%02d ----) : %s\n",
9009 opc1
, opc1
, handler
->oname
);
9016 static bool avr_need_swap(CPUPPCState
*env
)
9018 #ifdef HOST_WORDS_BIGENDIAN
9025 static int gdb_get_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9028 stfq_p(mem_buf
, env
->fpr
[n
]);
9029 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9033 stl_p(mem_buf
, env
->fpscr
);
9034 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9040 static int gdb_set_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9043 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9044 env
->fpr
[n
] = ldfq_p(mem_buf
);
9048 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9049 helper_store_fpscr(env
, ldl_p(mem_buf
), 0xffffffff);
9055 static int gdb_get_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9058 if (!avr_need_swap(env
)) {
9059 stq_p(mem_buf
, env
->avr
[n
].u64
[0]);
9060 stq_p(mem_buf
+8, env
->avr
[n
].u64
[1]);
9062 stq_p(mem_buf
, env
->avr
[n
].u64
[1]);
9063 stq_p(mem_buf
+8, env
->avr
[n
].u64
[0]);
9065 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9066 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
9070 stl_p(mem_buf
, env
->vscr
);
9071 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9075 stl_p(mem_buf
, (uint32_t)env
->spr
[SPR_VRSAVE
]);
9076 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9082 static int gdb_set_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9085 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9086 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
9087 if (!avr_need_swap(env
)) {
9088 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
);
9089 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
+8);
9091 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
);
9092 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
+8);
9097 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9098 env
->vscr
= ldl_p(mem_buf
);
9102 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9103 env
->spr
[SPR_VRSAVE
] = (target_ulong
)ldl_p(mem_buf
);
9109 static int gdb_get_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9112 #if defined(TARGET_PPC64)
9113 stl_p(mem_buf
, env
->gpr
[n
] >> 32);
9114 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9116 stl_p(mem_buf
, env
->gprh
[n
]);
9121 stq_p(mem_buf
, env
->spe_acc
);
9122 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9126 stl_p(mem_buf
, env
->spe_fscr
);
9127 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9133 static int gdb_set_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9136 #if defined(TARGET_PPC64)
9137 target_ulong lo
= (uint32_t)env
->gpr
[n
];
9140 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9142 hi
= (target_ulong
)ldl_p(mem_buf
) << 32;
9143 env
->gpr
[n
] = lo
| hi
;
9145 env
->gprh
[n
] = ldl_p(mem_buf
);
9150 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9151 env
->spe_acc
= ldq_p(mem_buf
);
9155 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9156 env
->spe_fscr
= ldl_p(mem_buf
);
9162 static int gdb_get_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9165 stq_p(mem_buf
, env
->vsr
[n
]);
9166 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9172 static int gdb_set_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9175 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9176 env
->vsr
[n
] = ldq_p(mem_buf
);
9182 static int ppc_fixup_cpu(PowerPCCPU
*cpu
)
9184 CPUPPCState
*env
= &cpu
->env
;
9186 /* TCG doesn't (yet) emulate some groups of instructions that
9187 * are implemented on some otherwise supported CPUs (e.g. VSX
9188 * and decimal floating point instructions on POWER7). We
9189 * remove unsupported instruction groups from the cpu state's
9190 * instruction masks and hope the guest can cope. For at
9191 * least the pseries machine, the unavailability of these
9192 * instructions can be advertised to the guest via the device
9194 if ((env
->insns_flags
& ~PPC_TCG_INSNS
)
9195 || (env
->insns_flags2
& ~PPC_TCG_INSNS2
)) {
9196 fprintf(stderr
, "Warning: Disabling some instructions which are not "
9197 "emulated by TCG (0x%" PRIx64
", 0x%" PRIx64
")\n",
9198 env
->insns_flags
& ~PPC_TCG_INSNS
,
9199 env
->insns_flags2
& ~PPC_TCG_INSNS2
);
9201 env
->insns_flags
&= PPC_TCG_INSNS
;
9202 env
->insns_flags2
&= PPC_TCG_INSNS2
;
9206 static inline bool ppc_cpu_is_valid(PowerPCCPUClass
*pcc
)
9208 #ifdef TARGET_PPCEMB
9209 return pcc
->mmu_model
== POWERPC_MMU_BOOKE
||
9210 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx
||
9211 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx_Z
;
9217 static void ppc_cpu_realizefn(DeviceState
*dev
, Error
**errp
)
9219 CPUState
*cs
= CPU(dev
);
9220 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
9221 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9222 Error
*local_err
= NULL
;
9223 #if !defined(CONFIG_USER_ONLY)
9224 int max_smt
= kvm_enabled() ? kvmppc_smt_threads() : 1;
9227 #if !defined(CONFIG_USER_ONLY)
9228 if (smp_threads
> max_smt
) {
9229 error_setg(errp
, "Cannot support more than %d threads on PPC with %s",
9230 max_smt
, kvm_enabled() ? "KVM" : "TCG");
9233 if (!is_power_of_2(smp_threads
)) {
9234 error_setg(errp
, "Cannot support %d threads on PPC with %s, "
9235 "threads count must be a power of 2.",
9236 smp_threads
, kvm_enabled() ? "KVM" : "TCG");
9241 cpu_exec_init(cs
, &local_err
);
9242 if (local_err
!= NULL
) {
9243 error_propagate(errp
, local_err
);
9247 #if !defined(CONFIG_USER_ONLY)
9248 cpu
->cpu_dt_id
= (cs
->cpu_index
/ smp_threads
) * max_smt
9249 + (cs
->cpu_index
% smp_threads
);
9252 if (tcg_enabled()) {
9253 if (ppc_fixup_cpu(cpu
) != 0) {
9254 error_setg(errp
, "Unable to emulate selected CPU with TCG");
9259 #if defined(TARGET_PPCEMB)
9260 if (!ppc_cpu_is_valid(pcc
)) {
9261 error_setg(errp
, "CPU does not possess a BookE or 4xx MMU. "
9262 "Please use qemu-system-ppc or qemu-system-ppc64 instead "
9263 "or choose another CPU model.");
9268 create_ppc_opcodes(cpu
, &local_err
);
9269 if (local_err
!= NULL
) {
9270 error_propagate(errp
, local_err
);
9275 if (pcc
->insns_flags
& PPC_FLOAT
) {
9276 gdb_register_coprocessor(cs
, gdb_get_float_reg
, gdb_set_float_reg
,
9277 33, "power-fpu.xml", 0);
9279 if (pcc
->insns_flags
& PPC_ALTIVEC
) {
9280 gdb_register_coprocessor(cs
, gdb_get_avr_reg
, gdb_set_avr_reg
,
9281 34, "power-altivec.xml", 0);
9283 if (pcc
->insns_flags
& PPC_SPE
) {
9284 gdb_register_coprocessor(cs
, gdb_get_spe_reg
, gdb_set_spe_reg
,
9285 34, "power-spe.xml", 0);
9287 if (pcc
->insns_flags2
& PPC2_VSX
) {
9288 gdb_register_coprocessor(cs
, gdb_get_vsx_reg
, gdb_set_vsx_reg
,
9289 32, "power-vsx.xml", 0);
9294 pcc
->parent_realize(dev
, errp
);
9296 #if defined(PPC_DUMP_CPU)
9298 CPUPPCState
*env
= &cpu
->env
;
9299 const char *mmu_model
, *excp_model
, *bus_model
;
9300 switch (env
->mmu_model
) {
9301 case POWERPC_MMU_32B
:
9302 mmu_model
= "PowerPC 32";
9304 case POWERPC_MMU_SOFT_6xx
:
9305 mmu_model
= "PowerPC 6xx/7xx with software driven TLBs";
9307 case POWERPC_MMU_SOFT_74xx
:
9308 mmu_model
= "PowerPC 74xx with software driven TLBs";
9310 case POWERPC_MMU_SOFT_4xx
:
9311 mmu_model
= "PowerPC 4xx with software driven TLBs";
9313 case POWERPC_MMU_SOFT_4xx_Z
:
9314 mmu_model
= "PowerPC 4xx with software driven TLBs "
9315 "and zones protections";
9317 case POWERPC_MMU_REAL
:
9318 mmu_model
= "PowerPC real mode only";
9320 case POWERPC_MMU_MPC8xx
:
9321 mmu_model
= "PowerPC MPC8xx";
9323 case POWERPC_MMU_BOOKE
:
9324 mmu_model
= "PowerPC BookE";
9326 case POWERPC_MMU_BOOKE206
:
9327 mmu_model
= "PowerPC BookE 2.06";
9329 case POWERPC_MMU_601
:
9330 mmu_model
= "PowerPC 601";
9332 #if defined (TARGET_PPC64)
9333 case POWERPC_MMU_64B
:
9334 mmu_model
= "PowerPC 64";
9338 mmu_model
= "Unknown or invalid";
9341 switch (env
->excp_model
) {
9342 case POWERPC_EXCP_STD
:
9343 excp_model
= "PowerPC";
9345 case POWERPC_EXCP_40x
:
9346 excp_model
= "PowerPC 40x";
9348 case POWERPC_EXCP_601
:
9349 excp_model
= "PowerPC 601";
9351 case POWERPC_EXCP_602
:
9352 excp_model
= "PowerPC 602";
9354 case POWERPC_EXCP_603
:
9355 excp_model
= "PowerPC 603";
9357 case POWERPC_EXCP_603E
:
9358 excp_model
= "PowerPC 603e";
9360 case POWERPC_EXCP_604
:
9361 excp_model
= "PowerPC 604";
9363 case POWERPC_EXCP_7x0
:
9364 excp_model
= "PowerPC 740/750";
9366 case POWERPC_EXCP_7x5
:
9367 excp_model
= "PowerPC 745/755";
9369 case POWERPC_EXCP_74xx
:
9370 excp_model
= "PowerPC 74xx";
9372 case POWERPC_EXCP_BOOKE
:
9373 excp_model
= "PowerPC BookE";
9375 #if defined (TARGET_PPC64)
9376 case POWERPC_EXCP_970
:
9377 excp_model
= "PowerPC 970";
9381 excp_model
= "Unknown or invalid";
9384 switch (env
->bus_model
) {
9385 case PPC_FLAGS_INPUT_6xx
:
9386 bus_model
= "PowerPC 6xx";
9388 case PPC_FLAGS_INPUT_BookE
:
9389 bus_model
= "PowerPC BookE";
9391 case PPC_FLAGS_INPUT_405
:
9392 bus_model
= "PowerPC 405";
9394 case PPC_FLAGS_INPUT_401
:
9395 bus_model
= "PowerPC 401/403";
9397 case PPC_FLAGS_INPUT_RCPU
:
9398 bus_model
= "RCPU / MPC8xx";
9400 #if defined (TARGET_PPC64)
9401 case PPC_FLAGS_INPUT_970
:
9402 bus_model
= "PowerPC 970";
9406 bus_model
= "Unknown or invalid";
9409 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64
"\n"
9410 " MMU model : %s\n",
9411 object_class_get_name(OBJECT_CLASS(pcc
)),
9412 pcc
->pvr
, pcc
->msr_mask
, mmu_model
);
9413 #if !defined(CONFIG_USER_ONLY)
9414 if (env
->tlb
.tlb6
) {
9415 printf(" %d %s TLB in %d ways\n",
9416 env
->nb_tlb
, env
->id_tlbs
? "splitted" : "merged",
9420 printf(" Exceptions model : %s\n"
9421 " Bus model : %s\n",
9422 excp_model
, bus_model
);
9423 printf(" MSR features :\n");
9424 if (env
->flags
& POWERPC_FLAG_SPE
)
9425 printf(" signal processing engine enable"
9427 else if (env
->flags
& POWERPC_FLAG_VRE
)
9428 printf(" vector processor enable\n");
9429 if (env
->flags
& POWERPC_FLAG_TGPR
)
9430 printf(" temporary GPRs\n");
9431 else if (env
->flags
& POWERPC_FLAG_CE
)
9432 printf(" critical input enable\n");
9433 if (env
->flags
& POWERPC_FLAG_SE
)
9434 printf(" single-step trace mode\n");
9435 else if (env
->flags
& POWERPC_FLAG_DWE
)
9436 printf(" debug wait enable\n");
9437 else if (env
->flags
& POWERPC_FLAG_UBLE
)
9438 printf(" user BTB lock enable\n");
9439 if (env
->flags
& POWERPC_FLAG_BE
)
9440 printf(" branch-step trace mode\n");
9441 else if (env
->flags
& POWERPC_FLAG_DE
)
9442 printf(" debug interrupt enable\n");
9443 if (env
->flags
& POWERPC_FLAG_PX
)
9444 printf(" inclusive protection\n");
9445 else if (env
->flags
& POWERPC_FLAG_PMM
)
9446 printf(" performance monitor mark\n");
9447 if (env
->flags
== POWERPC_FLAG_NONE
)
9449 printf(" Time-base/decrementer clock source: %s\n",
9450 env
->flags
& POWERPC_FLAG_RTC_CLK
? "RTC clock" : "bus clock");
9451 dump_ppc_insns(env
);
9458 static void ppc_cpu_unrealizefn(DeviceState
*dev
, Error
**errp
)
9460 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
9461 CPUPPCState
*env
= &cpu
->env
;
9462 opc_handler_t
**table
;
9465 cpu_exec_exit(CPU(dev
));
9467 for (i
= 0; i
< PPC_CPU_OPCODES_LEN
; i
++) {
9468 if (env
->opcodes
[i
] == &invalid_handler
) {
9471 if (is_indirect_opcode(env
->opcodes
[i
])) {
9472 table
= ind_table(env
->opcodes
[i
]);
9473 for (j
= 0; j
< PPC_CPU_INDIRECT_OPCODES_LEN
; j
++) {
9474 if (table
[j
] != &invalid_handler
&&
9475 is_indirect_opcode(table
[j
])) {
9476 g_free((opc_handler_t
*)((uintptr_t)table
[j
] &
9480 g_free((opc_handler_t
*)((uintptr_t)env
->opcodes
[i
] &
9486 int ppc_get_compat_smt_threads(PowerPCCPU
*cpu
)
9488 int ret
= MIN(smp_threads
, kvmppc_smt_threads());
9490 switch (cpu
->cpu_version
) {
9491 case CPU_POWERPC_LOGICAL_2_05
:
9494 case CPU_POWERPC_LOGICAL_2_06
:
9497 case CPU_POWERPC_LOGICAL_2_07
:
9505 void ppc_set_compat(PowerPCCPU
*cpu
, uint32_t cpu_version
, Error
**errp
)
9508 CPUPPCState
*env
= &cpu
->env
;
9510 cpu
->cpu_version
= cpu_version
;
9512 switch (cpu_version
) {
9513 case CPU_POWERPC_LOGICAL_2_05
:
9514 env
->spr
[SPR_PCR
] = PCR_COMPAT_2_05
;
9516 case CPU_POWERPC_LOGICAL_2_06
:
9517 env
->spr
[SPR_PCR
] = PCR_COMPAT_2_06
;
9519 case CPU_POWERPC_LOGICAL_2_06_PLUS
:
9520 env
->spr
[SPR_PCR
] = PCR_COMPAT_2_06
;
9523 env
->spr
[SPR_PCR
] = 0;
9527 if (kvm_enabled()) {
9528 ret
= kvmppc_set_compat(cpu
, cpu
->cpu_version
);
9530 error_setg_errno(errp
, -ret
,
9531 "Unable to set CPU compatibility mode in KVM");
9536 static gint
ppc_cpu_compare_class_pvr(gconstpointer a
, gconstpointer b
)
9538 ObjectClass
*oc
= (ObjectClass
*)a
;
9539 uint32_t pvr
= *(uint32_t *)b
;
9540 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
9542 /* -cpu host does a PVR lookup during construction */
9543 if (unlikely(strcmp(object_class_get_name(oc
),
9544 TYPE_HOST_POWERPC_CPU
) == 0)) {
9548 if (!ppc_cpu_is_valid(pcc
)) {
9552 return pcc
->pvr
== pvr
? 0 : -1;
9555 PowerPCCPUClass
*ppc_cpu_class_by_pvr(uint32_t pvr
)
9557 GSList
*list
, *item
;
9558 PowerPCCPUClass
*pcc
= NULL
;
9560 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9561 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr
);
9563 pcc
= POWERPC_CPU_CLASS(item
->data
);
9570 static gint
ppc_cpu_compare_class_pvr_mask(gconstpointer a
, gconstpointer b
)
9572 ObjectClass
*oc
= (ObjectClass
*)a
;
9573 uint32_t pvr
= *(uint32_t *)b
;
9574 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
9576 /* -cpu host does a PVR lookup during construction */
9577 if (unlikely(strcmp(object_class_get_name(oc
),
9578 TYPE_HOST_POWERPC_CPU
) == 0)) {
9582 if (!ppc_cpu_is_valid(pcc
)) {
9586 if (pcc
->pvr_match(pcc
, pvr
)) {
9593 PowerPCCPUClass
*ppc_cpu_class_by_pvr_mask(uint32_t pvr
)
9595 GSList
*list
, *item
;
9596 PowerPCCPUClass
*pcc
= NULL
;
9598 list
= object_class_get_list(TYPE_POWERPC_CPU
, true);
9599 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr_mask
);
9601 pcc
= POWERPC_CPU_CLASS(item
->data
);
9608 static gint
ppc_cpu_compare_class_name(gconstpointer a
, gconstpointer b
)
9610 ObjectClass
*oc
= (ObjectClass
*)a
;
9611 const char *name
= b
;
9612 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9614 if (strncasecmp(name
, object_class_get_name(oc
), strlen(name
)) == 0 &&
9615 ppc_cpu_is_valid(pcc
) &&
9616 strcmp(object_class_get_name(oc
) + strlen(name
),
9617 "-" TYPE_POWERPC_CPU
) == 0) {
9624 static ObjectClass
*ppc_cpu_class_by_name(const char *name
);
9626 static ObjectClass
*ppc_cpu_class_by_alias(PowerPCCPUAlias
*alias
)
9628 ObjectClass
*invalid_class
= (void*)ppc_cpu_class_by_alias
;
9630 /* Cache target class lookups in the alias table */
9632 alias
->oc
= ppc_cpu_class_by_name(alias
->model
);
9634 /* Fast check for non-existing aliases */
9635 alias
->oc
= invalid_class
;
9639 if (alias
->oc
== invalid_class
) {
9646 static ObjectClass
*ppc_cpu_class_by_name(const char *name
)
9648 GSList
*list
, *item
;
9649 ObjectClass
*ret
= NULL
;
9653 /* Check if the given name is a PVR */
9655 if (len
== 10 && name
[0] == '0' && name
[1] == 'x') {
9658 } else if (len
== 8) {
9661 for (i
= 0; i
< 8; i
++) {
9662 if (!qemu_isxdigit(*p
++))
9666 return OBJECT_CLASS(ppc_cpu_class_by_pvr(strtoul(name
, NULL
, 16)));
9670 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9671 item
= g_slist_find_custom(list
, name
, ppc_cpu_compare_class_name
);
9673 ret
= OBJECT_CLASS(item
->data
);
9681 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9682 if (strcmp(ppc_cpu_aliases
[i
].alias
, name
) == 0) {
9683 return ppc_cpu_class_by_alias(&ppc_cpu_aliases
[i
]);
9690 PowerPCCPU
*cpu_ppc_init(const char *cpu_model
)
9692 return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU
, cpu_model
));
9695 /* Sort by PVR, ordering special case "host" last. */
9696 static gint
ppc_cpu_list_compare(gconstpointer a
, gconstpointer b
)
9698 ObjectClass
*oc_a
= (ObjectClass
*)a
;
9699 ObjectClass
*oc_b
= (ObjectClass
*)b
;
9700 PowerPCCPUClass
*pcc_a
= POWERPC_CPU_CLASS(oc_a
);
9701 PowerPCCPUClass
*pcc_b
= POWERPC_CPU_CLASS(oc_b
);
9702 const char *name_a
= object_class_get_name(oc_a
);
9703 const char *name_b
= object_class_get_name(oc_b
);
9705 if (strcmp(name_a
, TYPE_HOST_POWERPC_CPU
) == 0) {
9707 } else if (strcmp(name_b
, TYPE_HOST_POWERPC_CPU
) == 0) {
9710 /* Avoid an integer overflow during subtraction */
9711 if (pcc_a
->pvr
< pcc_b
->pvr
) {
9713 } else if (pcc_a
->pvr
> pcc_b
->pvr
) {
9721 static void ppc_cpu_list_entry(gpointer data
, gpointer user_data
)
9723 ObjectClass
*oc
= data
;
9724 CPUListState
*s
= user_data
;
9725 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9726 const char *typename
= object_class_get_name(oc
);
9730 if (!ppc_cpu_is_valid(pcc
)) {
9733 if (unlikely(strcmp(typename
, TYPE_HOST_POWERPC_CPU
) == 0)) {
9737 name
= g_strndup(typename
,
9738 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
9739 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s PVR %08x\n",
9741 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9742 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
9743 ObjectClass
*alias_oc
= ppc_cpu_class_by_alias(alias
);
9745 if (alias_oc
!= oc
) {
9748 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s (alias for %s)\n",
9749 alias
->alias
, name
);
9754 void ppc_cpu_list(FILE *f
, fprintf_function cpu_fprintf
)
9758 .cpu_fprintf
= cpu_fprintf
,
9762 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9763 list
= g_slist_sort(list
, ppc_cpu_list_compare
);
9764 g_slist_foreach(list
, ppc_cpu_list_entry
, &s
);
9768 cpu_fprintf(f
, "\n");
9769 cpu_fprintf(f
, "PowerPC %-16s\n", "host");
9773 static void ppc_cpu_defs_entry(gpointer data
, gpointer user_data
)
9775 ObjectClass
*oc
= data
;
9776 CpuDefinitionInfoList
**first
= user_data
;
9777 const char *typename
;
9778 CpuDefinitionInfoList
*entry
;
9779 CpuDefinitionInfo
*info
;
9780 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9782 if (!ppc_cpu_is_valid(pcc
)) {
9786 typename
= object_class_get_name(oc
);
9787 info
= g_malloc0(sizeof(*info
));
9788 info
->name
= g_strndup(typename
,
9789 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
9791 entry
= g_malloc0(sizeof(*entry
));
9792 entry
->value
= info
;
9793 entry
->next
= *first
;
9797 CpuDefinitionInfoList
*arch_query_cpu_definitions(Error
**errp
)
9799 CpuDefinitionInfoList
*cpu_list
= NULL
;
9803 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9804 g_slist_foreach(list
, ppc_cpu_defs_entry
, &cpu_list
);
9807 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9808 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
9810 CpuDefinitionInfoList
*entry
;
9811 CpuDefinitionInfo
*info
;
9813 oc
= ppc_cpu_class_by_alias(alias
);
9818 info
= g_malloc0(sizeof(*info
));
9819 info
->name
= g_strdup(alias
->alias
);
9821 entry
= g_malloc0(sizeof(*entry
));
9822 entry
->value
= info
;
9823 entry
->next
= cpu_list
;
9830 static void ppc_cpu_set_pc(CPUState
*cs
, vaddr value
)
9832 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9834 cpu
->env
.nip
= value
;
9837 static bool ppc_cpu_has_work(CPUState
*cs
)
9839 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9840 CPUPPCState
*env
= &cpu
->env
;
9842 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
9845 static void ppc_cpu_exec_enter(CPUState
*cs
)
9847 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9848 CPUPPCState
*env
= &cpu
->env
;
9850 env
->reserve_addr
= -1;
9853 /* CPUClass::reset() */
9854 static void ppc_cpu_reset(CPUState
*s
)
9856 PowerPCCPU
*cpu
= POWERPC_CPU(s
);
9857 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9858 CPUPPCState
*env
= &cpu
->env
;
9862 pcc
->parent_reset(s
);
9864 msr
= (target_ulong
)0;
9866 /* XXX: find a suitable condition to enable the hypervisor mode */
9867 msr
|= (target_ulong
)MSR_HVB
;
9869 msr
|= (target_ulong
)0 << MSR_AP
; /* TO BE CHECKED */
9870 msr
|= (target_ulong
)0 << MSR_SA
; /* TO BE CHECKED */
9871 msr
|= (target_ulong
)1 << MSR_EP
;
9872 #if defined(DO_SINGLE_STEP) && 0
9873 /* Single step trace mode */
9874 msr
|= (target_ulong
)1 << MSR_SE
;
9875 msr
|= (target_ulong
)1 << MSR_BE
;
9877 #if defined(CONFIG_USER_ONLY)
9878 msr
|= (target_ulong
)1 << MSR_FP
; /* Allow floating point usage */
9879 msr
|= (target_ulong
)1 << MSR_VR
; /* Allow altivec usage */
9880 msr
|= (target_ulong
)1 << MSR_VSX
; /* Allow VSX usage */
9881 msr
|= (target_ulong
)1 << MSR_SPE
; /* Allow SPE usage */
9882 msr
|= (target_ulong
)1 << MSR_PR
;
9883 #if defined(TARGET_PPC64)
9884 msr
|= (target_ulong
)1 << MSR_TM
; /* Transactional memory */
9886 #if !defined(TARGET_WORDS_BIGENDIAN)
9887 msr
|= (target_ulong
)1 << MSR_LE
; /* Little-endian user mode */
9888 if (!((env
->msr_mask
>> MSR_LE
) & 1)) {
9889 fprintf(stderr
, "Selected CPU does not support little-endian.\n");
9895 #if defined(TARGET_PPC64)
9896 if (env
->mmu_model
& POWERPC_MMU_64
) {
9897 msr
|= (1ULL << MSR_SF
);
9901 hreg_store_msr(env
, msr
, 1);
9903 #if !defined(CONFIG_USER_ONLY)
9904 env
->nip
= env
->hreset_vector
| env
->excp_prefix
;
9905 if (env
->mmu_model
!= POWERPC_MMU_REAL
) {
9906 ppc_tlb_invalidate_all(env
);
9910 hreg_compute_hflags(env
);
9911 env
->reserve_addr
= (target_ulong
)-1ULL;
9912 /* Be sure no exception or interrupt is pending */
9913 env
->pending_interrupts
= 0;
9914 s
->exception_index
= POWERPC_EXCP_NONE
;
9915 env
->error_code
= 0;
9917 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
9919 env
->slb_shadow_addr
= 0;
9920 env
->slb_shadow_size
= 0;
9923 #endif /* TARGET_PPC64 */
9925 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
9926 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
9931 env
->spr
[i
] = spr
->default_value
;
9934 /* Flush all TLBs */
9938 #ifndef CONFIG_USER_ONLY
9939 static bool ppc_cpu_is_big_endian(CPUState
*cs
)
9941 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9942 CPUPPCState
*env
= &cpu
->env
;
9944 cpu_synchronize_state(cs
);
9950 static void ppc_cpu_initfn(Object
*obj
)
9952 CPUState
*cs
= CPU(obj
);
9953 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
9954 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9955 CPUPPCState
*env
= &cpu
->env
;
9959 env
->msr_mask
= pcc
->msr_mask
;
9960 env
->mmu_model
= pcc
->mmu_model
;
9961 env
->excp_model
= pcc
->excp_model
;
9962 env
->bus_model
= pcc
->bus_model
;
9963 env
->insns_flags
= pcc
->insns_flags
;
9964 env
->insns_flags2
= pcc
->insns_flags2
;
9965 env
->flags
= pcc
->flags
;
9966 env
->bfd_mach
= pcc
->bfd_mach
;
9967 env
->check_pow
= pcc
->check_pow
;
9969 #if defined(TARGET_PPC64)
9971 env
->sps
= *pcc
->sps
;
9972 } else if (env
->mmu_model
& POWERPC_MMU_64
) {
9973 /* Use default sets of page sizes */
9974 static const struct ppc_segment_page_sizes defsps
= {
9976 { .page_shift
= 12, /* 4K */
9978 .enc
= { { .page_shift
= 12, .pte_enc
= 0 } }
9980 { .page_shift
= 24, /* 16M */
9982 .enc
= { { .page_shift
= 24, .pte_enc
= 0 } }
9988 #endif /* defined(TARGET_PPC64) */
9990 if (tcg_enabled()) {
9991 ppc_translate_init();
9995 static bool ppc_pvr_match_default(PowerPCCPUClass
*pcc
, uint32_t pvr
)
9997 return pcc
->pvr
== pvr
;
10000 static gchar
*ppc_gdb_arch_name(CPUState
*cs
)
10002 #if defined(TARGET_PPC64)
10003 return g_strdup("powerpc:common64");
10005 return g_strdup("powerpc:common");
10009 static void ppc_cpu_class_init(ObjectClass
*oc
, void *data
)
10011 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10012 CPUClass
*cc
= CPU_CLASS(oc
);
10013 DeviceClass
*dc
= DEVICE_CLASS(oc
);
10015 pcc
->parent_realize
= dc
->realize
;
10016 pcc
->pvr_match
= ppc_pvr_match_default
;
10017 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_always
;
10018 dc
->realize
= ppc_cpu_realizefn
;
10019 dc
->unrealize
= ppc_cpu_unrealizefn
;
10021 pcc
->parent_reset
= cc
->reset
;
10022 cc
->reset
= ppc_cpu_reset
;
10024 cc
->class_by_name
= ppc_cpu_class_by_name
;
10025 cc
->has_work
= ppc_cpu_has_work
;
10026 cc
->do_interrupt
= ppc_cpu_do_interrupt
;
10027 cc
->cpu_exec_interrupt
= ppc_cpu_exec_interrupt
;
10028 cc
->dump_state
= ppc_cpu_dump_state
;
10029 cc
->dump_statistics
= ppc_cpu_dump_statistics
;
10030 cc
->set_pc
= ppc_cpu_set_pc
;
10031 cc
->gdb_read_register
= ppc_cpu_gdb_read_register
;
10032 cc
->gdb_write_register
= ppc_cpu_gdb_write_register
;
10033 #ifdef CONFIG_USER_ONLY
10034 cc
->handle_mmu_fault
= ppc_cpu_handle_mmu_fault
;
10036 cc
->get_phys_page_debug
= ppc_cpu_get_phys_page_debug
;
10037 cc
->vmsd
= &vmstate_ppc_cpu
;
10038 #if defined(TARGET_PPC64)
10039 cc
->write_elf64_note
= ppc64_cpu_write_elf64_note
;
10042 cc
->cpu_exec_enter
= ppc_cpu_exec_enter
;
10044 cc
->gdb_num_core_regs
= 71;
10046 #ifdef USE_APPLE_GDB
10047 cc
->gdb_read_register
= ppc_cpu_gdb_read_register_apple
;
10048 cc
->gdb_write_register
= ppc_cpu_gdb_write_register_apple
;
10049 cc
->gdb_num_core_regs
= 71 + 32;
10052 cc
->gdb_arch_name
= ppc_gdb_arch_name
;
10053 #if defined(TARGET_PPC64)
10054 cc
->gdb_core_xml_file
= "power64-core.xml";
10056 cc
->gdb_core_xml_file
= "power-core.xml";
10058 #ifndef CONFIG_USER_ONLY
10059 cc
->virtio_is_big_endian
= ppc_cpu_is_big_endian
;
10062 dc
->fw_name
= "PowerPC,UNKNOWN";
10065 static const TypeInfo ppc_cpu_type_info
= {
10066 .name
= TYPE_POWERPC_CPU
,
10067 .parent
= TYPE_CPU
,
10068 .instance_size
= sizeof(PowerPCCPU
),
10069 .instance_init
= ppc_cpu_initfn
,
10071 .class_size
= sizeof(PowerPCCPUClass
),
10072 .class_init
= ppc_cpu_class_init
,
10075 static void ppc_cpu_register_types(void)
10077 type_register_static(&ppc_cpu_type_info
);
10080 type_init(ppc_cpu_register_types
)