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"
34 #include "hw/ppc/ppc.h"
36 //#define PPC_DUMP_CPU
37 //#define PPC_DEBUG_SPR
38 //#define PPC_DUMP_SPR_ACCESSES
39 /* #define USE_APPLE_GDB */
42 * do nothing but store/retrieve spr value
44 static void spr_load_dump_spr(int sprn
)
46 #ifdef PPC_DUMP_SPR_ACCESSES
47 TCGv_i32 t0
= tcg_const_i32(sprn
);
48 gen_helper_load_dump_spr(cpu_env
, t0
);
49 tcg_temp_free_i32(t0
);
53 static void spr_read_generic (DisasContext
*ctx
, int gprn
, int sprn
)
55 gen_load_spr(cpu_gpr
[gprn
], sprn
);
56 spr_load_dump_spr(sprn
);
59 static void spr_store_dump_spr(int sprn
)
61 #ifdef PPC_DUMP_SPR_ACCESSES
62 TCGv_i32 t0
= tcg_const_i32(sprn
);
63 gen_helper_store_dump_spr(cpu_env
, t0
);
64 tcg_temp_free_i32(t0
);
68 static void spr_write_generic (DisasContext
*ctx
, int sprn
, int gprn
)
70 gen_store_spr(sprn
, cpu_gpr
[gprn
]);
71 spr_store_dump_spr(sprn
);
74 #if !defined(CONFIG_USER_ONLY)
75 static void spr_write_generic32(DisasContext
*ctx
, int sprn
, int gprn
)
78 TCGv t0
= tcg_temp_new();
79 tcg_gen_ext32u_tl(t0
, cpu_gpr
[gprn
]);
80 gen_store_spr(sprn
, t0
);
82 spr_store_dump_spr(sprn
);
84 spr_write_generic(ctx
, sprn
, gprn
);
88 static void spr_write_clear (DisasContext
*ctx
, int sprn
, int gprn
)
90 TCGv t0
= tcg_temp_new();
91 TCGv t1
= tcg_temp_new();
92 gen_load_spr(t0
, sprn
);
93 tcg_gen_neg_tl(t1
, cpu_gpr
[gprn
]);
94 tcg_gen_and_tl(t0
, t0
, t1
);
95 gen_store_spr(sprn
, t0
);
100 static void spr_access_nop(DisasContext
*ctx
, int sprn
, int gprn
)
106 /* SPR common to all PowerPC */
108 static void spr_read_xer (DisasContext
*ctx
, int gprn
, int sprn
)
110 gen_read_xer(cpu_gpr
[gprn
]);
113 static void spr_write_xer (DisasContext
*ctx
, int sprn
, int gprn
)
115 gen_write_xer(cpu_gpr
[gprn
]);
119 static void spr_read_lr (DisasContext
*ctx
, int gprn
, int sprn
)
121 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_lr
);
124 static void spr_write_lr (DisasContext
*ctx
, int sprn
, int gprn
)
126 tcg_gen_mov_tl(cpu_lr
, cpu_gpr
[gprn
]);
130 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
131 static void spr_read_cfar (DisasContext
*ctx
, int gprn
, int sprn
)
133 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_cfar
);
136 static void spr_write_cfar (DisasContext
*ctx
, int sprn
, int gprn
)
138 tcg_gen_mov_tl(cpu_cfar
, cpu_gpr
[gprn
]);
140 #endif /* defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) */
143 static void spr_read_ctr (DisasContext
*ctx
, int gprn
, int sprn
)
145 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_ctr
);
148 static void spr_write_ctr (DisasContext
*ctx
, int sprn
, int gprn
)
150 tcg_gen_mov_tl(cpu_ctr
, cpu_gpr
[gprn
]);
153 /* User read access to SPR */
159 static void spr_read_ureg (DisasContext
*ctx
, int gprn
, int sprn
)
161 gen_load_spr(cpu_gpr
[gprn
], sprn
+ 0x10);
164 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
165 static void spr_write_ureg(DisasContext
*ctx
, int sprn
, int gprn
)
167 gen_store_spr(sprn
+ 0x10, cpu_gpr
[gprn
]);
171 /* SPR common to all non-embedded PowerPC */
173 #if !defined(CONFIG_USER_ONLY)
174 static void spr_read_decr (DisasContext
*ctx
, int gprn
, int sprn
)
176 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
179 gen_helper_load_decr(cpu_gpr
[gprn
], cpu_env
);
180 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
182 gen_stop_exception(ctx
);
186 static void spr_write_decr (DisasContext
*ctx
, int sprn
, int gprn
)
188 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
191 gen_helper_store_decr(cpu_env
, cpu_gpr
[gprn
]);
192 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
194 gen_stop_exception(ctx
);
199 /* SPR common to all non-embedded PowerPC, except 601 */
201 static void spr_read_tbl (DisasContext
*ctx
, int gprn
, int sprn
)
203 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
206 gen_helper_load_tbl(cpu_gpr
[gprn
], cpu_env
);
207 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
209 gen_stop_exception(ctx
);
213 static void spr_read_tbu (DisasContext
*ctx
, int gprn
, int sprn
)
215 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
218 gen_helper_load_tbu(cpu_gpr
[gprn
], cpu_env
);
219 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
221 gen_stop_exception(ctx
);
225 __attribute__ (( unused
))
226 static void spr_read_atbl (DisasContext
*ctx
, int gprn
, int sprn
)
228 gen_helper_load_atbl(cpu_gpr
[gprn
], cpu_env
);
231 __attribute__ (( unused
))
232 static void spr_read_atbu (DisasContext
*ctx
, int gprn
, int sprn
)
234 gen_helper_load_atbu(cpu_gpr
[gprn
], cpu_env
);
237 #if !defined(CONFIG_USER_ONLY)
238 static void spr_write_tbl (DisasContext
*ctx
, int sprn
, int gprn
)
240 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
243 gen_helper_store_tbl(cpu_env
, cpu_gpr
[gprn
]);
244 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
246 gen_stop_exception(ctx
);
250 static void spr_write_tbu (DisasContext
*ctx
, int sprn
, int gprn
)
252 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
255 gen_helper_store_tbu(cpu_env
, cpu_gpr
[gprn
]);
256 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
258 gen_stop_exception(ctx
);
262 __attribute__ (( unused
))
263 static void spr_write_atbl (DisasContext
*ctx
, int sprn
, int gprn
)
265 gen_helper_store_atbl(cpu_env
, cpu_gpr
[gprn
]);
268 __attribute__ (( unused
))
269 static void spr_write_atbu (DisasContext
*ctx
, int sprn
, int gprn
)
271 gen_helper_store_atbu(cpu_env
, cpu_gpr
[gprn
]);
274 #if defined(TARGET_PPC64)
275 __attribute__ (( unused
))
276 static void spr_read_purr (DisasContext
*ctx
, int gprn
, int sprn
)
278 gen_helper_load_purr(cpu_gpr
[gprn
], cpu_env
);
282 static void spr_read_hdecr(DisasContext
*ctx
, int gprn
, int sprn
)
284 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
287 gen_helper_load_hdecr(cpu_gpr
[gprn
], cpu_env
);
288 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
290 gen_stop_exception(ctx
);
294 static void spr_write_hdecr(DisasContext
*ctx
, int sprn
, int gprn
)
296 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
299 gen_helper_store_hdecr(cpu_env
, cpu_gpr
[gprn
]);
300 if (ctx
->tb
->cflags
& CF_USE_ICOUNT
) {
302 gen_stop_exception(ctx
);
309 #if !defined(CONFIG_USER_ONLY)
310 /* IBAT0U...IBAT0U */
311 /* IBAT0L...IBAT7L */
312 static void spr_read_ibat (DisasContext
*ctx
, int gprn
, int sprn
)
314 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
317 static void spr_read_ibat_h (DisasContext
*ctx
, int gprn
, int sprn
)
319 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][((sprn
- SPR_IBAT4U
) / 2) + 4]));
322 static void spr_write_ibatu (DisasContext
*ctx
, int sprn
, int gprn
)
324 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
325 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
326 tcg_temp_free_i32(t0
);
329 static void spr_write_ibatu_h (DisasContext
*ctx
, int sprn
, int gprn
)
331 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4U
) / 2) + 4);
332 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
333 tcg_temp_free_i32(t0
);
336 static void spr_write_ibatl (DisasContext
*ctx
, int sprn
, int gprn
)
338 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0L
) / 2);
339 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
340 tcg_temp_free_i32(t0
);
343 static void spr_write_ibatl_h (DisasContext
*ctx
, int sprn
, int gprn
)
345 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4L
) / 2) + 4);
346 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
347 tcg_temp_free_i32(t0
);
350 /* DBAT0U...DBAT7U */
351 /* DBAT0L...DBAT7L */
352 static void spr_read_dbat (DisasContext
*ctx
, int gprn
, int sprn
)
354 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, DBAT
[sprn
& 1][(sprn
- SPR_DBAT0U
) / 2]));
357 static void spr_read_dbat_h (DisasContext
*ctx
, int gprn
, int sprn
)
359 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, DBAT
[sprn
& 1][((sprn
- SPR_DBAT4U
) / 2) + 4]));
362 static void spr_write_dbatu (DisasContext
*ctx
, int sprn
, int gprn
)
364 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0U
) / 2);
365 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
366 tcg_temp_free_i32(t0
);
369 static void spr_write_dbatu_h (DisasContext
*ctx
, int sprn
, int gprn
)
371 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4U
) / 2) + 4);
372 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
373 tcg_temp_free_i32(t0
);
376 static void spr_write_dbatl (DisasContext
*ctx
, int sprn
, int gprn
)
378 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0L
) / 2);
379 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
380 tcg_temp_free_i32(t0
);
383 static void spr_write_dbatl_h (DisasContext
*ctx
, int sprn
, int gprn
)
385 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4L
) / 2) + 4);
386 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
387 tcg_temp_free_i32(t0
);
391 static void spr_write_sdr1 (DisasContext
*ctx
, int sprn
, int gprn
)
393 gen_helper_store_sdr1(cpu_env
, cpu_gpr
[gprn
]);
396 /* 64 bits PowerPC specific SPRs */
397 #if defined(TARGET_PPC64)
398 static void spr_read_hior (DisasContext
*ctx
, int gprn
, int sprn
)
400 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
403 static void spr_write_hior (DisasContext
*ctx
, int sprn
, int gprn
)
405 TCGv t0
= tcg_temp_new();
406 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0x3FFFFF00000ULL
);
407 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
413 /* PowerPC 601 specific registers */
415 static void spr_read_601_rtcl (DisasContext
*ctx
, int gprn
, int sprn
)
417 gen_helper_load_601_rtcl(cpu_gpr
[gprn
], cpu_env
);
420 static void spr_read_601_rtcu (DisasContext
*ctx
, int gprn
, int sprn
)
422 gen_helper_load_601_rtcu(cpu_gpr
[gprn
], cpu_env
);
425 #if !defined(CONFIG_USER_ONLY)
426 static void spr_write_601_rtcu (DisasContext
*ctx
, int sprn
, int gprn
)
428 gen_helper_store_601_rtcu(cpu_env
, cpu_gpr
[gprn
]);
431 static void spr_write_601_rtcl (DisasContext
*ctx
, int sprn
, int gprn
)
433 gen_helper_store_601_rtcl(cpu_env
, cpu_gpr
[gprn
]);
436 static void spr_write_hid0_601 (DisasContext
*ctx
, int sprn
, int gprn
)
438 gen_helper_store_hid0_601(cpu_env
, cpu_gpr
[gprn
]);
439 /* Must stop the translation as endianness may have changed */
440 gen_stop_exception(ctx
);
445 #if !defined(CONFIG_USER_ONLY)
446 static void spr_read_601_ubat (DisasContext
*ctx
, int gprn
, int sprn
)
448 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
451 static void spr_write_601_ubatu (DisasContext
*ctx
, int sprn
, int gprn
)
453 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
454 gen_helper_store_601_batl(cpu_env
, t0
, cpu_gpr
[gprn
]);
455 tcg_temp_free_i32(t0
);
458 static void spr_write_601_ubatl (DisasContext
*ctx
, int sprn
, int gprn
)
460 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
461 gen_helper_store_601_batu(cpu_env
, t0
, cpu_gpr
[gprn
]);
462 tcg_temp_free_i32(t0
);
466 /* PowerPC 40x specific registers */
467 #if !defined(CONFIG_USER_ONLY)
468 static void spr_read_40x_pit (DisasContext
*ctx
, int gprn
, int sprn
)
470 gen_helper_load_40x_pit(cpu_gpr
[gprn
], cpu_env
);
473 static void spr_write_40x_pit (DisasContext
*ctx
, int sprn
, int gprn
)
475 gen_helper_store_40x_pit(cpu_env
, cpu_gpr
[gprn
]);
478 static void spr_write_40x_dbcr0 (DisasContext
*ctx
, int sprn
, int gprn
)
480 gen_helper_store_40x_dbcr0(cpu_env
, cpu_gpr
[gprn
]);
481 /* We must stop translation as we may have rebooted */
482 gen_stop_exception(ctx
);
485 static void spr_write_40x_sler (DisasContext
*ctx
, int sprn
, int gprn
)
487 gen_helper_store_40x_sler(cpu_env
, cpu_gpr
[gprn
]);
490 static void spr_write_booke_tcr (DisasContext
*ctx
, int sprn
, int gprn
)
492 gen_helper_store_booke_tcr(cpu_env
, cpu_gpr
[gprn
]);
495 static void spr_write_booke_tsr (DisasContext
*ctx
, int sprn
, int gprn
)
497 gen_helper_store_booke_tsr(cpu_env
, cpu_gpr
[gprn
]);
501 /* PowerPC 403 specific registers */
502 /* PBL1 / PBU1 / PBL2 / PBU2 */
503 #if !defined(CONFIG_USER_ONLY)
504 static void spr_read_403_pbr (DisasContext
*ctx
, int gprn
, int sprn
)
506 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, pb
[sprn
- SPR_403_PBL1
]));
509 static void spr_write_403_pbr (DisasContext
*ctx
, int sprn
, int gprn
)
511 TCGv_i32 t0
= tcg_const_i32(sprn
- SPR_403_PBL1
);
512 gen_helper_store_403_pbr(cpu_env
, t0
, cpu_gpr
[gprn
]);
513 tcg_temp_free_i32(t0
);
516 static void spr_write_pir (DisasContext
*ctx
, int sprn
, int gprn
)
518 TCGv t0
= tcg_temp_new();
519 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0xF);
520 gen_store_spr(SPR_PIR
, t0
);
525 /* SPE specific registers */
526 static void spr_read_spefscr (DisasContext
*ctx
, int gprn
, int sprn
)
528 TCGv_i32 t0
= tcg_temp_new_i32();
529 tcg_gen_ld_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
530 tcg_gen_extu_i32_tl(cpu_gpr
[gprn
], t0
);
531 tcg_temp_free_i32(t0
);
534 static void spr_write_spefscr (DisasContext
*ctx
, int sprn
, int gprn
)
536 TCGv_i32 t0
= tcg_temp_new_i32();
537 tcg_gen_trunc_tl_i32(t0
, cpu_gpr
[gprn
]);
538 tcg_gen_st_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
539 tcg_temp_free_i32(t0
);
542 #if !defined(CONFIG_USER_ONLY)
543 /* Callback used to write the exception vector base */
544 static void spr_write_excp_prefix (DisasContext
*ctx
, int sprn
, int gprn
)
546 TCGv t0
= tcg_temp_new();
547 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivpr_mask
));
548 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
549 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
550 gen_store_spr(sprn
, t0
);
554 static void spr_write_excp_vector (DisasContext
*ctx
, int sprn
, int gprn
)
558 if (sprn
>= SPR_BOOKE_IVOR0
&& sprn
<= SPR_BOOKE_IVOR15
) {
559 sprn_offs
= sprn
- SPR_BOOKE_IVOR0
;
560 } else if (sprn
>= SPR_BOOKE_IVOR32
&& sprn
<= SPR_BOOKE_IVOR37
) {
561 sprn_offs
= sprn
- SPR_BOOKE_IVOR32
+ 32;
562 } else if (sprn
>= SPR_BOOKE_IVOR38
&& sprn
<= SPR_BOOKE_IVOR42
) {
563 sprn_offs
= sprn
- SPR_BOOKE_IVOR38
+ 38;
565 printf("Trying to write an unknown exception vector %d %03x\n",
567 gen_inval_exception(ctx
, POWERPC_EXCP_PRIV_REG
);
571 TCGv t0
= tcg_temp_new();
572 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivor_mask
));
573 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
574 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_vectors
[sprn_offs
]));
575 gen_store_spr(sprn
, t0
);
580 static inline void vscr_init (CPUPPCState
*env
, uint32_t val
)
583 /* Altivec always uses round-to-nearest */
584 set_float_rounding_mode(float_round_nearest_even
, &env
->vec_status
);
585 set_flush_to_zero(vscr_nj
, &env
->vec_status
);
588 #ifdef CONFIG_USER_ONLY
589 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
590 oea_read, oea_write, one_reg_id, initial_value) \
591 _spr_register(env, num, name, uea_read, uea_write, 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, initial_value)
597 #if !defined(CONFIG_KVM)
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, initial_value)
602 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
603 oea_read, oea_write, hea_read, hea_write, \
604 one_reg_id, initial_value) \
605 _spr_register(env, num, name, uea_read, uea_write, \
606 oea_read, oea_write, hea_read, hea_write, initial_value)
608 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
609 oea_read, oea_write, one_reg_id, initial_value) \
610 _spr_register(env, num, name, uea_read, uea_write, \
611 oea_read, oea_write, oea_read, oea_write, \
612 one_reg_id, initial_value)
613 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
614 oea_read, oea_write, hea_read, hea_write, \
615 one_reg_id, initial_value) \
616 _spr_register(env, num, name, uea_read, uea_write, \
617 oea_read, oea_write, hea_read, hea_write, \
618 one_reg_id, initial_value)
622 #define spr_register(env, num, name, uea_read, uea_write, \
623 oea_read, oea_write, initial_value) \
624 spr_register_kvm(env, num, name, uea_read, uea_write, \
625 oea_read, oea_write, 0, initial_value)
627 #define spr_register_hv(env, num, name, uea_read, uea_write, \
628 oea_read, oea_write, hea_read, hea_write, \
630 spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
631 oea_read, oea_write, hea_read, hea_write, \
634 static inline void _spr_register(CPUPPCState
*env
, int num
,
636 void (*uea_read
)(DisasContext
*ctx
, int gprn
, int sprn
),
637 void (*uea_write
)(DisasContext
*ctx
, int sprn
, int gprn
),
638 #if !defined(CONFIG_USER_ONLY)
640 void (*oea_read
)(DisasContext
*ctx
, int gprn
, int sprn
),
641 void (*oea_write
)(DisasContext
*ctx
, int sprn
, int gprn
),
642 void (*hea_read
)(DisasContext
*opaque
, int gprn
, int sprn
),
643 void (*hea_write
)(DisasContext
*opaque
, int sprn
, int gprn
),
645 #if defined(CONFIG_KVM)
648 target_ulong initial_value
)
652 spr
= &env
->spr_cb
[num
];
653 if (spr
->name
!= NULL
||env
-> spr
[num
] != 0x00000000 ||
654 #if !defined(CONFIG_USER_ONLY)
655 spr
->oea_read
!= NULL
|| spr
->oea_write
!= NULL
||
657 spr
->uea_read
!= NULL
|| spr
->uea_write
!= NULL
) {
658 printf("Error: Trying to register SPR %d (%03x) twice !\n", num
, num
);
661 #if defined(PPC_DEBUG_SPR)
662 printf("*** register spr %d (%03x) %s val " TARGET_FMT_lx
"\n", num
, num
,
663 name
, initial_value
);
666 spr
->uea_read
= uea_read
;
667 spr
->uea_write
= uea_write
;
668 #if !defined(CONFIG_USER_ONLY)
669 spr
->oea_read
= oea_read
;
670 spr
->oea_write
= oea_write
;
671 spr
->hea_read
= hea_read
;
672 spr
->hea_write
= hea_write
;
674 #if defined(CONFIG_KVM)
675 spr
->one_reg_id
= one_reg_id
,
677 env
->spr
[num
] = spr
->default_value
= initial_value
;
680 /* Generic PowerPC SPRs */
681 static void gen_spr_generic (CPUPPCState
*env
)
683 /* Integer processing */
684 spr_register(env
, SPR_XER
, "XER",
685 &spr_read_xer
, &spr_write_xer
,
686 &spr_read_xer
, &spr_write_xer
,
689 spr_register(env
, SPR_LR
, "LR",
690 &spr_read_lr
, &spr_write_lr
,
691 &spr_read_lr
, &spr_write_lr
,
693 spr_register(env
, SPR_CTR
, "CTR",
694 &spr_read_ctr
, &spr_write_ctr
,
695 &spr_read_ctr
, &spr_write_ctr
,
697 /* Interrupt processing */
698 spr_register(env
, SPR_SRR0
, "SRR0",
699 SPR_NOACCESS
, SPR_NOACCESS
,
700 &spr_read_generic
, &spr_write_generic
,
702 spr_register(env
, SPR_SRR1
, "SRR1",
703 SPR_NOACCESS
, SPR_NOACCESS
,
704 &spr_read_generic
, &spr_write_generic
,
706 /* Processor control */
707 spr_register(env
, SPR_SPRG0
, "SPRG0",
708 SPR_NOACCESS
, SPR_NOACCESS
,
709 &spr_read_generic
, &spr_write_generic
,
711 spr_register(env
, SPR_SPRG1
, "SPRG1",
712 SPR_NOACCESS
, SPR_NOACCESS
,
713 &spr_read_generic
, &spr_write_generic
,
715 spr_register(env
, SPR_SPRG2
, "SPRG2",
716 SPR_NOACCESS
, SPR_NOACCESS
,
717 &spr_read_generic
, &spr_write_generic
,
719 spr_register(env
, SPR_SPRG3
, "SPRG3",
720 SPR_NOACCESS
, SPR_NOACCESS
,
721 &spr_read_generic
, &spr_write_generic
,
725 /* SPR common to all non-embedded PowerPC, including 601 */
726 static void gen_spr_ne_601 (CPUPPCState
*env
)
728 /* Exception processing */
729 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
730 SPR_NOACCESS
, SPR_NOACCESS
,
731 &spr_read_generic
, &spr_write_generic
,
732 KVM_REG_PPC_DSISR
, 0x00000000);
733 spr_register_kvm(env
, SPR_DAR
, "DAR",
734 SPR_NOACCESS
, SPR_NOACCESS
,
735 &spr_read_generic
, &spr_write_generic
,
736 KVM_REG_PPC_DAR
, 0x00000000);
738 spr_register(env
, SPR_DECR
, "DECR",
739 SPR_NOACCESS
, SPR_NOACCESS
,
740 &spr_read_decr
, &spr_write_decr
,
742 /* Memory management */
743 spr_register(env
, SPR_SDR1
, "SDR1",
744 SPR_NOACCESS
, SPR_NOACCESS
,
745 &spr_read_generic
, &spr_write_sdr1
,
750 static void gen_low_BATs (CPUPPCState
*env
)
752 #if !defined(CONFIG_USER_ONLY)
753 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
754 SPR_NOACCESS
, SPR_NOACCESS
,
755 &spr_read_ibat
, &spr_write_ibatu
,
757 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
758 SPR_NOACCESS
, SPR_NOACCESS
,
759 &spr_read_ibat
, &spr_write_ibatl
,
761 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
762 SPR_NOACCESS
, SPR_NOACCESS
,
763 &spr_read_ibat
, &spr_write_ibatu
,
765 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
766 SPR_NOACCESS
, SPR_NOACCESS
,
767 &spr_read_ibat
, &spr_write_ibatl
,
769 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
770 SPR_NOACCESS
, SPR_NOACCESS
,
771 &spr_read_ibat
, &spr_write_ibatu
,
773 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
774 SPR_NOACCESS
, SPR_NOACCESS
,
775 &spr_read_ibat
, &spr_write_ibatl
,
777 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
778 SPR_NOACCESS
, SPR_NOACCESS
,
779 &spr_read_ibat
, &spr_write_ibatu
,
781 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
782 SPR_NOACCESS
, SPR_NOACCESS
,
783 &spr_read_ibat
, &spr_write_ibatl
,
785 spr_register(env
, SPR_DBAT0U
, "DBAT0U",
786 SPR_NOACCESS
, SPR_NOACCESS
,
787 &spr_read_dbat
, &spr_write_dbatu
,
789 spr_register(env
, SPR_DBAT0L
, "DBAT0L",
790 SPR_NOACCESS
, SPR_NOACCESS
,
791 &spr_read_dbat
, &spr_write_dbatl
,
793 spr_register(env
, SPR_DBAT1U
, "DBAT1U",
794 SPR_NOACCESS
, SPR_NOACCESS
,
795 &spr_read_dbat
, &spr_write_dbatu
,
797 spr_register(env
, SPR_DBAT1L
, "DBAT1L",
798 SPR_NOACCESS
, SPR_NOACCESS
,
799 &spr_read_dbat
, &spr_write_dbatl
,
801 spr_register(env
, SPR_DBAT2U
, "DBAT2U",
802 SPR_NOACCESS
, SPR_NOACCESS
,
803 &spr_read_dbat
, &spr_write_dbatu
,
805 spr_register(env
, SPR_DBAT2L
, "DBAT2L",
806 SPR_NOACCESS
, SPR_NOACCESS
,
807 &spr_read_dbat
, &spr_write_dbatl
,
809 spr_register(env
, SPR_DBAT3U
, "DBAT3U",
810 SPR_NOACCESS
, SPR_NOACCESS
,
811 &spr_read_dbat
, &spr_write_dbatu
,
813 spr_register(env
, SPR_DBAT3L
, "DBAT3L",
814 SPR_NOACCESS
, SPR_NOACCESS
,
815 &spr_read_dbat
, &spr_write_dbatl
,
822 static void gen_high_BATs (CPUPPCState
*env
)
824 #if !defined(CONFIG_USER_ONLY)
825 spr_register(env
, SPR_IBAT4U
, "IBAT4U",
826 SPR_NOACCESS
, SPR_NOACCESS
,
827 &spr_read_ibat_h
, &spr_write_ibatu_h
,
829 spr_register(env
, SPR_IBAT4L
, "IBAT4L",
830 SPR_NOACCESS
, SPR_NOACCESS
,
831 &spr_read_ibat_h
, &spr_write_ibatl_h
,
833 spr_register(env
, SPR_IBAT5U
, "IBAT5U",
834 SPR_NOACCESS
, SPR_NOACCESS
,
835 &spr_read_ibat_h
, &spr_write_ibatu_h
,
837 spr_register(env
, SPR_IBAT5L
, "IBAT5L",
838 SPR_NOACCESS
, SPR_NOACCESS
,
839 &spr_read_ibat_h
, &spr_write_ibatl_h
,
841 spr_register(env
, SPR_IBAT6U
, "IBAT6U",
842 SPR_NOACCESS
, SPR_NOACCESS
,
843 &spr_read_ibat_h
, &spr_write_ibatu_h
,
845 spr_register(env
, SPR_IBAT6L
, "IBAT6L",
846 SPR_NOACCESS
, SPR_NOACCESS
,
847 &spr_read_ibat_h
, &spr_write_ibatl_h
,
849 spr_register(env
, SPR_IBAT7U
, "IBAT7U",
850 SPR_NOACCESS
, SPR_NOACCESS
,
851 &spr_read_ibat_h
, &spr_write_ibatu_h
,
853 spr_register(env
, SPR_IBAT7L
, "IBAT7L",
854 SPR_NOACCESS
, SPR_NOACCESS
,
855 &spr_read_ibat_h
, &spr_write_ibatl_h
,
857 spr_register(env
, SPR_DBAT4U
, "DBAT4U",
858 SPR_NOACCESS
, SPR_NOACCESS
,
859 &spr_read_dbat_h
, &spr_write_dbatu_h
,
861 spr_register(env
, SPR_DBAT4L
, "DBAT4L",
862 SPR_NOACCESS
, SPR_NOACCESS
,
863 &spr_read_dbat_h
, &spr_write_dbatl_h
,
865 spr_register(env
, SPR_DBAT5U
, "DBAT5U",
866 SPR_NOACCESS
, SPR_NOACCESS
,
867 &spr_read_dbat_h
, &spr_write_dbatu_h
,
869 spr_register(env
, SPR_DBAT5L
, "DBAT5L",
870 SPR_NOACCESS
, SPR_NOACCESS
,
871 &spr_read_dbat_h
, &spr_write_dbatl_h
,
873 spr_register(env
, SPR_DBAT6U
, "DBAT6U",
874 SPR_NOACCESS
, SPR_NOACCESS
,
875 &spr_read_dbat_h
, &spr_write_dbatu_h
,
877 spr_register(env
, SPR_DBAT6L
, "DBAT6L",
878 SPR_NOACCESS
, SPR_NOACCESS
,
879 &spr_read_dbat_h
, &spr_write_dbatl_h
,
881 spr_register(env
, SPR_DBAT7U
, "DBAT7U",
882 SPR_NOACCESS
, SPR_NOACCESS
,
883 &spr_read_dbat_h
, &spr_write_dbatu_h
,
885 spr_register(env
, SPR_DBAT7L
, "DBAT7L",
886 SPR_NOACCESS
, SPR_NOACCESS
,
887 &spr_read_dbat_h
, &spr_write_dbatl_h
,
893 /* Generic PowerPC time base */
894 static void gen_tbl (CPUPPCState
*env
)
896 spr_register(env
, SPR_VTBL
, "TBL",
897 &spr_read_tbl
, SPR_NOACCESS
,
898 &spr_read_tbl
, SPR_NOACCESS
,
900 spr_register(env
, SPR_TBL
, "TBL",
901 &spr_read_tbl
, SPR_NOACCESS
,
902 &spr_read_tbl
, &spr_write_tbl
,
904 spr_register(env
, SPR_VTBU
, "TBU",
905 &spr_read_tbu
, SPR_NOACCESS
,
906 &spr_read_tbu
, SPR_NOACCESS
,
908 spr_register(env
, SPR_TBU
, "TBU",
909 &spr_read_tbu
, SPR_NOACCESS
,
910 &spr_read_tbu
, &spr_write_tbu
,
914 /* Softare table search registers */
915 static void gen_6xx_7xx_soft_tlb (CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
917 #if !defined(CONFIG_USER_ONLY)
918 env
->nb_tlb
= nb_tlbs
;
919 env
->nb_ways
= nb_ways
;
921 env
->tlb_type
= TLB_6XX
;
922 spr_register(env
, SPR_DMISS
, "DMISS",
923 SPR_NOACCESS
, SPR_NOACCESS
,
924 &spr_read_generic
, SPR_NOACCESS
,
926 spr_register(env
, SPR_DCMP
, "DCMP",
927 SPR_NOACCESS
, SPR_NOACCESS
,
928 &spr_read_generic
, SPR_NOACCESS
,
930 spr_register(env
, SPR_HASH1
, "HASH1",
931 SPR_NOACCESS
, SPR_NOACCESS
,
932 &spr_read_generic
, SPR_NOACCESS
,
934 spr_register(env
, SPR_HASH2
, "HASH2",
935 SPR_NOACCESS
, SPR_NOACCESS
,
936 &spr_read_generic
, SPR_NOACCESS
,
938 spr_register(env
, SPR_IMISS
, "IMISS",
939 SPR_NOACCESS
, SPR_NOACCESS
,
940 &spr_read_generic
, SPR_NOACCESS
,
942 spr_register(env
, SPR_ICMP
, "ICMP",
943 SPR_NOACCESS
, SPR_NOACCESS
,
944 &spr_read_generic
, SPR_NOACCESS
,
946 spr_register(env
, SPR_RPA
, "RPA",
947 SPR_NOACCESS
, SPR_NOACCESS
,
948 &spr_read_generic
, &spr_write_generic
,
953 /* SPR common to MPC755 and G2 */
954 static void gen_spr_G2_755 (CPUPPCState
*env
)
957 spr_register(env
, SPR_SPRG4
, "SPRG4",
958 SPR_NOACCESS
, SPR_NOACCESS
,
959 &spr_read_generic
, &spr_write_generic
,
961 spr_register(env
, SPR_SPRG5
, "SPRG5",
962 SPR_NOACCESS
, SPR_NOACCESS
,
963 &spr_read_generic
, &spr_write_generic
,
965 spr_register(env
, SPR_SPRG6
, "SPRG6",
966 SPR_NOACCESS
, SPR_NOACCESS
,
967 &spr_read_generic
, &spr_write_generic
,
969 spr_register(env
, SPR_SPRG7
, "SPRG7",
970 SPR_NOACCESS
, SPR_NOACCESS
,
971 &spr_read_generic
, &spr_write_generic
,
975 /* SPR common to all 7xx PowerPC implementations */
976 static void gen_spr_7xx (CPUPPCState
*env
)
979 /* XXX : not implemented */
980 spr_register_kvm(env
, SPR_DABR
, "DABR",
981 SPR_NOACCESS
, SPR_NOACCESS
,
982 &spr_read_generic
, &spr_write_generic
,
983 KVM_REG_PPC_DABR
, 0x00000000);
984 /* XXX : not implemented */
985 spr_register(env
, SPR_IABR
, "IABR",
986 SPR_NOACCESS
, SPR_NOACCESS
,
987 &spr_read_generic
, &spr_write_generic
,
989 /* Cache management */
990 /* XXX : not implemented */
991 spr_register(env
, SPR_ICTC
, "ICTC",
992 SPR_NOACCESS
, SPR_NOACCESS
,
993 &spr_read_generic
, &spr_write_generic
,
995 /* Performance monitors */
996 /* XXX : not implemented */
997 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
998 SPR_NOACCESS
, SPR_NOACCESS
,
999 &spr_read_generic
, &spr_write_generic
,
1001 /* XXX : not implemented */
1002 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
1003 SPR_NOACCESS
, SPR_NOACCESS
,
1004 &spr_read_generic
, &spr_write_generic
,
1006 /* XXX : not implemented */
1007 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
1008 SPR_NOACCESS
, SPR_NOACCESS
,
1009 &spr_read_generic
, &spr_write_generic
,
1011 /* XXX : not implemented */
1012 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
1013 SPR_NOACCESS
, SPR_NOACCESS
,
1014 &spr_read_generic
, &spr_write_generic
,
1016 /* XXX : not implemented */
1017 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
1018 SPR_NOACCESS
, SPR_NOACCESS
,
1019 &spr_read_generic
, &spr_write_generic
,
1021 /* XXX : not implemented */
1022 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
1023 SPR_NOACCESS
, SPR_NOACCESS
,
1024 &spr_read_generic
, &spr_write_generic
,
1026 /* XXX : not implemented */
1027 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
1028 SPR_NOACCESS
, SPR_NOACCESS
,
1029 &spr_read_generic
, SPR_NOACCESS
,
1031 /* XXX : not implemented */
1032 spr_register(env
, SPR_7XX_UMMCR0
, "UMMCR0",
1033 &spr_read_ureg
, SPR_NOACCESS
,
1034 &spr_read_ureg
, SPR_NOACCESS
,
1036 /* XXX : not implemented */
1037 spr_register(env
, SPR_7XX_UMMCR1
, "UMMCR1",
1038 &spr_read_ureg
, SPR_NOACCESS
,
1039 &spr_read_ureg
, SPR_NOACCESS
,
1041 /* XXX : not implemented */
1042 spr_register(env
, SPR_7XX_UPMC1
, "UPMC1",
1043 &spr_read_ureg
, SPR_NOACCESS
,
1044 &spr_read_ureg
, SPR_NOACCESS
,
1046 /* XXX : not implemented */
1047 spr_register(env
, SPR_7XX_UPMC2
, "UPMC2",
1048 &spr_read_ureg
, SPR_NOACCESS
,
1049 &spr_read_ureg
, SPR_NOACCESS
,
1051 /* XXX : not implemented */
1052 spr_register(env
, SPR_7XX_UPMC3
, "UPMC3",
1053 &spr_read_ureg
, SPR_NOACCESS
,
1054 &spr_read_ureg
, SPR_NOACCESS
,
1056 /* XXX : not implemented */
1057 spr_register(env
, SPR_7XX_UPMC4
, "UPMC4",
1058 &spr_read_ureg
, SPR_NOACCESS
,
1059 &spr_read_ureg
, SPR_NOACCESS
,
1061 /* XXX : not implemented */
1062 spr_register(env
, SPR_7XX_USIAR
, "USIAR",
1063 &spr_read_ureg
, SPR_NOACCESS
,
1064 &spr_read_ureg
, SPR_NOACCESS
,
1066 /* External access control */
1067 /* XXX : not implemented */
1068 spr_register(env
, SPR_EAR
, "EAR",
1069 SPR_NOACCESS
, SPR_NOACCESS
,
1070 &spr_read_generic
, &spr_write_generic
,
1075 #ifndef CONFIG_USER_ONLY
1076 static void spr_write_amr(DisasContext
*ctx
, int sprn
, int gprn
)
1078 TCGv t0
= tcg_temp_new();
1079 TCGv t1
= tcg_temp_new();
1080 TCGv t2
= tcg_temp_new();
1082 /* Note, the HV=1 PR=0 case is handled earlier by simply using
1083 * spr_write_generic for HV mode in the SPR table
1086 /* Build insertion mask into t1 based on context */
1088 gen_load_spr(t1
, SPR_UAMOR
);
1090 gen_load_spr(t1
, SPR_AMOR
);
1093 /* Mask new bits into t2 */
1094 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1096 /* Load AMR and clear new bits in t0 */
1097 gen_load_spr(t0
, SPR_AMR
);
1098 tcg_gen_andc_tl(t0
, t0
, t1
);
1100 /* Or'in new bits and write it out */
1101 tcg_gen_or_tl(t0
, t0
, t2
);
1102 gen_store_spr(SPR_AMR
, t0
);
1103 spr_store_dump_spr(SPR_AMR
);
1110 static void spr_write_uamor(DisasContext
*ctx
, int sprn
, int gprn
)
1112 TCGv t0
= tcg_temp_new();
1113 TCGv t1
= tcg_temp_new();
1114 TCGv t2
= tcg_temp_new();
1116 /* Note, the HV=1 case is handled earlier by simply using
1117 * spr_write_generic for HV mode in the SPR table
1120 /* Build insertion mask into t1 based on context */
1121 gen_load_spr(t1
, SPR_AMOR
);
1123 /* Mask new bits into t2 */
1124 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1126 /* Load AMR and clear new bits in t0 */
1127 gen_load_spr(t0
, SPR_UAMOR
);
1128 tcg_gen_andc_tl(t0
, t0
, t1
);
1130 /* Or'in new bits and write it out */
1131 tcg_gen_or_tl(t0
, t0
, t2
);
1132 gen_store_spr(SPR_UAMOR
, t0
);
1133 spr_store_dump_spr(SPR_UAMOR
);
1140 static void spr_write_iamr(DisasContext
*ctx
, int sprn
, int gprn
)
1142 TCGv t0
= tcg_temp_new();
1143 TCGv t1
= tcg_temp_new();
1144 TCGv t2
= tcg_temp_new();
1146 /* Note, the HV=1 case is handled earlier by simply using
1147 * spr_write_generic for HV mode in the SPR table
1150 /* Build insertion mask into t1 based on context */
1151 gen_load_spr(t1
, SPR_AMOR
);
1153 /* Mask new bits into t2 */
1154 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1156 /* Load AMR and clear new bits in t0 */
1157 gen_load_spr(t0
, SPR_IAMR
);
1158 tcg_gen_andc_tl(t0
, t0
, t1
);
1160 /* Or'in new bits and write it out */
1161 tcg_gen_or_tl(t0
, t0
, t2
);
1162 gen_store_spr(SPR_IAMR
, t0
);
1163 spr_store_dump_spr(SPR_IAMR
);
1169 #endif /* CONFIG_USER_ONLY */
1171 static void gen_spr_amr(CPUPPCState
*env
, bool has_iamr
)
1173 #ifndef CONFIG_USER_ONLY
1174 /* Virtual Page Class Key protection */
1175 /* The AMR is accessible either via SPR 13 or SPR 29. 13 is
1176 * userspace accessible, 29 is privileged. So we only need to set
1177 * the kvm ONE_REG id on one of them, we use 29 */
1178 spr_register(env
, SPR_UAMR
, "UAMR",
1179 &spr_read_generic
, &spr_write_amr
,
1180 &spr_read_generic
, &spr_write_amr
,
1182 spr_register_kvm_hv(env
, SPR_AMR
, "AMR",
1183 SPR_NOACCESS
, SPR_NOACCESS
,
1184 &spr_read_generic
, &spr_write_amr
,
1185 &spr_read_generic
, &spr_write_generic
,
1186 KVM_REG_PPC_AMR
, 0);
1187 spr_register_kvm_hv(env
, SPR_UAMOR
, "UAMOR",
1188 SPR_NOACCESS
, SPR_NOACCESS
,
1189 &spr_read_generic
, &spr_write_uamor
,
1190 &spr_read_generic
, &spr_write_generic
,
1191 KVM_REG_PPC_UAMOR
, 0);
1192 spr_register_hv(env
, SPR_AMOR
, "AMOR",
1193 SPR_NOACCESS
, SPR_NOACCESS
,
1194 SPR_NOACCESS
, SPR_NOACCESS
,
1195 &spr_read_generic
, &spr_write_generic
,
1198 spr_register_kvm_hv(env
, SPR_IAMR
, "IAMR",
1199 SPR_NOACCESS
, SPR_NOACCESS
,
1200 &spr_read_generic
, &spr_write_iamr
,
1201 &spr_read_generic
, &spr_write_generic
,
1202 KVM_REG_PPC_IAMR
, 0);
1204 #endif /* !CONFIG_USER_ONLY */
1206 #endif /* TARGET_PPC64 */
1208 #ifndef CONFIG_USER_ONLY
1209 static void spr_read_thrm(DisasContext
*ctx
, int gprn
, int sprn
)
1211 gen_helper_fixup_thrm(cpu_env
);
1212 gen_load_spr(cpu_gpr
[gprn
], sprn
);
1213 spr_load_dump_spr(sprn
);
1215 #endif /* !CONFIG_USER_ONLY */
1217 static void gen_spr_thrm (CPUPPCState
*env
)
1219 /* Thermal management */
1220 /* XXX : not implemented */
1221 spr_register(env
, SPR_THRM1
, "THRM1",
1222 SPR_NOACCESS
, SPR_NOACCESS
,
1223 &spr_read_thrm
, &spr_write_generic
,
1225 /* XXX : not implemented */
1226 spr_register(env
, SPR_THRM2
, "THRM2",
1227 SPR_NOACCESS
, SPR_NOACCESS
,
1228 &spr_read_thrm
, &spr_write_generic
,
1230 /* XXX : not implemented */
1231 spr_register(env
, SPR_THRM3
, "THRM3",
1232 SPR_NOACCESS
, SPR_NOACCESS
,
1233 &spr_read_thrm
, &spr_write_generic
,
1237 /* SPR specific to PowerPC 604 implementation */
1238 static void gen_spr_604 (CPUPPCState
*env
)
1240 /* Processor identification */
1241 spr_register(env
, SPR_PIR
, "PIR",
1242 SPR_NOACCESS
, SPR_NOACCESS
,
1243 &spr_read_generic
, &spr_write_pir
,
1246 /* XXX : not implemented */
1247 spr_register(env
, SPR_IABR
, "IABR",
1248 SPR_NOACCESS
, SPR_NOACCESS
,
1249 &spr_read_generic
, &spr_write_generic
,
1251 /* XXX : not implemented */
1252 spr_register_kvm(env
, SPR_DABR
, "DABR",
1253 SPR_NOACCESS
, SPR_NOACCESS
,
1254 &spr_read_generic
, &spr_write_generic
,
1255 KVM_REG_PPC_DABR
, 0x00000000);
1256 /* Performance counters */
1257 /* XXX : not implemented */
1258 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
1259 SPR_NOACCESS
, SPR_NOACCESS
,
1260 &spr_read_generic
, &spr_write_generic
,
1262 /* XXX : not implemented */
1263 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
1264 SPR_NOACCESS
, SPR_NOACCESS
,
1265 &spr_read_generic
, &spr_write_generic
,
1267 /* XXX : not implemented */
1268 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
1269 SPR_NOACCESS
, SPR_NOACCESS
,
1270 &spr_read_generic
, &spr_write_generic
,
1272 /* XXX : not implemented */
1273 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
1274 SPR_NOACCESS
, SPR_NOACCESS
,
1275 &spr_read_generic
, SPR_NOACCESS
,
1277 /* XXX : not implemented */
1278 spr_register(env
, SPR_SDA
, "SDA",
1279 SPR_NOACCESS
, SPR_NOACCESS
,
1280 &spr_read_generic
, SPR_NOACCESS
,
1282 /* External access control */
1283 /* XXX : not implemented */
1284 spr_register(env
, SPR_EAR
, "EAR",
1285 SPR_NOACCESS
, SPR_NOACCESS
,
1286 &spr_read_generic
, &spr_write_generic
,
1290 /* SPR specific to PowerPC 603 implementation */
1291 static void gen_spr_603 (CPUPPCState
*env
)
1293 /* External access control */
1294 /* XXX : not implemented */
1295 spr_register(env
, SPR_EAR
, "EAR",
1296 SPR_NOACCESS
, SPR_NOACCESS
,
1297 &spr_read_generic
, &spr_write_generic
,
1300 /* XXX : not implemented */
1301 spr_register(env
, SPR_IABR
, "IABR",
1302 SPR_NOACCESS
, SPR_NOACCESS
,
1303 &spr_read_generic
, &spr_write_generic
,
1308 /* SPR specific to PowerPC G2 implementation */
1309 static void gen_spr_G2 (CPUPPCState
*env
)
1311 /* Memory base address */
1313 /* XXX : not implemented */
1314 spr_register(env
, SPR_MBAR
, "MBAR",
1315 SPR_NOACCESS
, SPR_NOACCESS
,
1316 &spr_read_generic
, &spr_write_generic
,
1318 /* Exception processing */
1319 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1320 SPR_NOACCESS
, SPR_NOACCESS
,
1321 &spr_read_generic
, &spr_write_generic
,
1323 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1324 SPR_NOACCESS
, SPR_NOACCESS
,
1325 &spr_read_generic
, &spr_write_generic
,
1328 /* XXX : not implemented */
1329 spr_register(env
, SPR_DABR
, "DABR",
1330 SPR_NOACCESS
, SPR_NOACCESS
,
1331 &spr_read_generic
, &spr_write_generic
,
1333 /* XXX : not implemented */
1334 spr_register(env
, SPR_DABR2
, "DABR2",
1335 SPR_NOACCESS
, SPR_NOACCESS
,
1336 &spr_read_generic
, &spr_write_generic
,
1338 /* XXX : not implemented */
1339 spr_register(env
, SPR_IABR
, "IABR",
1340 SPR_NOACCESS
, SPR_NOACCESS
,
1341 &spr_read_generic
, &spr_write_generic
,
1343 /* XXX : not implemented */
1344 spr_register(env
, SPR_IABR2
, "IABR2",
1345 SPR_NOACCESS
, SPR_NOACCESS
,
1346 &spr_read_generic
, &spr_write_generic
,
1348 /* XXX : not implemented */
1349 spr_register(env
, SPR_IBCR
, "IBCR",
1350 SPR_NOACCESS
, SPR_NOACCESS
,
1351 &spr_read_generic
, &spr_write_generic
,
1353 /* XXX : not implemented */
1354 spr_register(env
, SPR_DBCR
, "DBCR",
1355 SPR_NOACCESS
, SPR_NOACCESS
,
1356 &spr_read_generic
, &spr_write_generic
,
1360 /* SPR specific to PowerPC 602 implementation */
1361 static void gen_spr_602 (CPUPPCState
*env
)
1364 /* XXX : not implemented */
1365 spr_register(env
, SPR_SER
, "SER",
1366 SPR_NOACCESS
, SPR_NOACCESS
,
1367 &spr_read_generic
, &spr_write_generic
,
1369 /* XXX : not implemented */
1370 spr_register(env
, SPR_SEBR
, "SEBR",
1371 SPR_NOACCESS
, SPR_NOACCESS
,
1372 &spr_read_generic
, &spr_write_generic
,
1374 /* XXX : not implemented */
1375 spr_register(env
, SPR_ESASRR
, "ESASRR",
1376 SPR_NOACCESS
, SPR_NOACCESS
,
1377 &spr_read_generic
, &spr_write_generic
,
1379 /* Floating point status */
1380 /* XXX : not implemented */
1381 spr_register(env
, SPR_SP
, "SP",
1382 SPR_NOACCESS
, SPR_NOACCESS
,
1383 &spr_read_generic
, &spr_write_generic
,
1385 /* XXX : not implemented */
1386 spr_register(env
, SPR_LT
, "LT",
1387 SPR_NOACCESS
, SPR_NOACCESS
,
1388 &spr_read_generic
, &spr_write_generic
,
1390 /* Watchdog timer */
1391 /* XXX : not implemented */
1392 spr_register(env
, SPR_TCR
, "TCR",
1393 SPR_NOACCESS
, SPR_NOACCESS
,
1394 &spr_read_generic
, &spr_write_generic
,
1396 /* Interrupt base */
1397 spr_register(env
, SPR_IBR
, "IBR",
1398 SPR_NOACCESS
, SPR_NOACCESS
,
1399 &spr_read_generic
, &spr_write_generic
,
1401 /* XXX : not implemented */
1402 spr_register(env
, SPR_IABR
, "IABR",
1403 SPR_NOACCESS
, SPR_NOACCESS
,
1404 &spr_read_generic
, &spr_write_generic
,
1408 /* SPR specific to PowerPC 601 implementation */
1409 static void gen_spr_601 (CPUPPCState
*env
)
1411 /* Multiplication/division register */
1413 spr_register(env
, SPR_MQ
, "MQ",
1414 &spr_read_generic
, &spr_write_generic
,
1415 &spr_read_generic
, &spr_write_generic
,
1418 spr_register(env
, SPR_601_RTCU
, "RTCU",
1419 SPR_NOACCESS
, SPR_NOACCESS
,
1420 SPR_NOACCESS
, &spr_write_601_rtcu
,
1422 spr_register(env
, SPR_601_VRTCU
, "RTCU",
1423 &spr_read_601_rtcu
, SPR_NOACCESS
,
1424 &spr_read_601_rtcu
, SPR_NOACCESS
,
1426 spr_register(env
, SPR_601_RTCL
, "RTCL",
1427 SPR_NOACCESS
, SPR_NOACCESS
,
1428 SPR_NOACCESS
, &spr_write_601_rtcl
,
1430 spr_register(env
, SPR_601_VRTCL
, "RTCL",
1431 &spr_read_601_rtcl
, SPR_NOACCESS
,
1432 &spr_read_601_rtcl
, SPR_NOACCESS
,
1436 spr_register(env
, SPR_601_UDECR
, "UDECR",
1437 &spr_read_decr
, SPR_NOACCESS
,
1438 &spr_read_decr
, SPR_NOACCESS
,
1441 /* External access control */
1442 /* XXX : not implemented */
1443 spr_register(env
, SPR_EAR
, "EAR",
1444 SPR_NOACCESS
, SPR_NOACCESS
,
1445 &spr_read_generic
, &spr_write_generic
,
1447 /* Memory management */
1448 #if !defined(CONFIG_USER_ONLY)
1449 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
1450 SPR_NOACCESS
, SPR_NOACCESS
,
1451 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1453 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
1454 SPR_NOACCESS
, SPR_NOACCESS
,
1455 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1457 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
1458 SPR_NOACCESS
, SPR_NOACCESS
,
1459 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1461 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
1462 SPR_NOACCESS
, SPR_NOACCESS
,
1463 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1465 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
1466 SPR_NOACCESS
, SPR_NOACCESS
,
1467 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1469 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
1470 SPR_NOACCESS
, SPR_NOACCESS
,
1471 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1473 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
1474 SPR_NOACCESS
, SPR_NOACCESS
,
1475 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1477 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
1478 SPR_NOACCESS
, SPR_NOACCESS
,
1479 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1485 static void gen_spr_74xx (CPUPPCState
*env
)
1487 /* Processor identification */
1488 spr_register(env
, SPR_PIR
, "PIR",
1489 SPR_NOACCESS
, SPR_NOACCESS
,
1490 &spr_read_generic
, &spr_write_pir
,
1492 /* XXX : not implemented */
1493 spr_register(env
, SPR_74XX_MMCR2
, "MMCR2",
1494 SPR_NOACCESS
, SPR_NOACCESS
,
1495 &spr_read_generic
, &spr_write_generic
,
1497 /* XXX : not implemented */
1498 spr_register(env
, SPR_74XX_UMMCR2
, "UMMCR2",
1499 &spr_read_ureg
, SPR_NOACCESS
,
1500 &spr_read_ureg
, SPR_NOACCESS
,
1502 /* XXX: not implemented */
1503 spr_register(env
, SPR_BAMR
, "BAMR",
1504 SPR_NOACCESS
, SPR_NOACCESS
,
1505 &spr_read_generic
, &spr_write_generic
,
1507 /* XXX : not implemented */
1508 spr_register(env
, SPR_MSSCR0
, "MSSCR0",
1509 SPR_NOACCESS
, SPR_NOACCESS
,
1510 &spr_read_generic
, &spr_write_generic
,
1512 /* Hardware implementation registers */
1513 /* XXX : not implemented */
1514 spr_register(env
, SPR_HID0
, "HID0",
1515 SPR_NOACCESS
, SPR_NOACCESS
,
1516 &spr_read_generic
, &spr_write_generic
,
1518 /* XXX : not implemented */
1519 spr_register(env
, SPR_HID1
, "HID1",
1520 SPR_NOACCESS
, SPR_NOACCESS
,
1521 &spr_read_generic
, &spr_write_generic
,
1524 spr_register(env
, SPR_VRSAVE
, "VRSAVE",
1525 &spr_read_generic
, &spr_write_generic
,
1526 &spr_read_generic
, &spr_write_generic
,
1528 /* XXX : not implemented */
1529 spr_register(env
, SPR_L2CR
, "L2CR",
1530 SPR_NOACCESS
, SPR_NOACCESS
,
1531 &spr_read_generic
, spr_access_nop
,
1533 /* Not strictly an SPR */
1534 vscr_init(env
, 0x00010000);
1537 static void gen_l3_ctrl (CPUPPCState
*env
)
1540 /* XXX : not implemented */
1541 spr_register(env
, SPR_L3CR
, "L3CR",
1542 SPR_NOACCESS
, SPR_NOACCESS
,
1543 &spr_read_generic
, &spr_write_generic
,
1546 /* XXX : not implemented */
1547 spr_register(env
, SPR_L3ITCR0
, "L3ITCR0",
1548 SPR_NOACCESS
, SPR_NOACCESS
,
1549 &spr_read_generic
, &spr_write_generic
,
1552 /* XXX : not implemented */
1553 spr_register(env
, SPR_L3PM
, "L3PM",
1554 SPR_NOACCESS
, SPR_NOACCESS
,
1555 &spr_read_generic
, &spr_write_generic
,
1559 static void gen_74xx_soft_tlb (CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
1561 #if !defined(CONFIG_USER_ONLY)
1562 env
->nb_tlb
= nb_tlbs
;
1563 env
->nb_ways
= nb_ways
;
1565 env
->tlb_type
= TLB_6XX
;
1566 /* XXX : not implemented */
1567 spr_register(env
, SPR_PTEHI
, "PTEHI",
1568 SPR_NOACCESS
, SPR_NOACCESS
,
1569 &spr_read_generic
, &spr_write_generic
,
1571 /* XXX : not implemented */
1572 spr_register(env
, SPR_PTELO
, "PTELO",
1573 SPR_NOACCESS
, SPR_NOACCESS
,
1574 &spr_read_generic
, &spr_write_generic
,
1576 /* XXX : not implemented */
1577 spr_register(env
, SPR_TLBMISS
, "TLBMISS",
1578 SPR_NOACCESS
, SPR_NOACCESS
,
1579 &spr_read_generic
, &spr_write_generic
,
1584 #if !defined(CONFIG_USER_ONLY)
1585 static void spr_write_e500_l1csr0 (DisasContext
*ctx
, int sprn
, int gprn
)
1587 TCGv t0
= tcg_temp_new();
1589 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR0_DCE
| L1CSR0_CPE
);
1590 gen_store_spr(sprn
, t0
);
1594 static void spr_write_e500_l1csr1(DisasContext
*ctx
, int sprn
, int gprn
)
1596 TCGv t0
= tcg_temp_new();
1598 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR1_ICE
| L1CSR1_CPE
);
1599 gen_store_spr(sprn
, t0
);
1603 static void spr_write_booke206_mmucsr0 (DisasContext
*ctx
, int sprn
, int gprn
)
1605 gen_helper_booke206_tlbflush(cpu_env
, cpu_gpr
[gprn
]);
1608 static void spr_write_booke_pid (DisasContext
*ctx
, int sprn
, int gprn
)
1610 TCGv_i32 t0
= tcg_const_i32(sprn
);
1611 gen_helper_booke_setpid(cpu_env
, t0
, cpu_gpr
[gprn
]);
1612 tcg_temp_free_i32(t0
);
1616 static void gen_spr_usprgh (CPUPPCState
*env
)
1618 spr_register(env
, SPR_USPRG4
, "USPRG4",
1619 &spr_read_ureg
, SPR_NOACCESS
,
1620 &spr_read_ureg
, SPR_NOACCESS
,
1622 spr_register(env
, SPR_USPRG5
, "USPRG5",
1623 &spr_read_ureg
, SPR_NOACCESS
,
1624 &spr_read_ureg
, SPR_NOACCESS
,
1626 spr_register(env
, SPR_USPRG6
, "USPRG6",
1627 &spr_read_ureg
, SPR_NOACCESS
,
1628 &spr_read_ureg
, SPR_NOACCESS
,
1630 spr_register(env
, SPR_USPRG7
, "USPRG7",
1631 &spr_read_ureg
, SPR_NOACCESS
,
1632 &spr_read_ureg
, SPR_NOACCESS
,
1636 /* PowerPC BookE SPR */
1637 static void gen_spr_BookE (CPUPPCState
*env
, uint64_t ivor_mask
)
1639 const char *ivor_names
[64] = {
1640 "IVOR0", "IVOR1", "IVOR2", "IVOR3",
1641 "IVOR4", "IVOR5", "IVOR6", "IVOR7",
1642 "IVOR8", "IVOR9", "IVOR10", "IVOR11",
1643 "IVOR12", "IVOR13", "IVOR14", "IVOR15",
1644 "IVOR16", "IVOR17", "IVOR18", "IVOR19",
1645 "IVOR20", "IVOR21", "IVOR22", "IVOR23",
1646 "IVOR24", "IVOR25", "IVOR26", "IVOR27",
1647 "IVOR28", "IVOR29", "IVOR30", "IVOR31",
1648 "IVOR32", "IVOR33", "IVOR34", "IVOR35",
1649 "IVOR36", "IVOR37", "IVOR38", "IVOR39",
1650 "IVOR40", "IVOR41", "IVOR42", "IVOR43",
1651 "IVOR44", "IVOR45", "IVOR46", "IVOR47",
1652 "IVOR48", "IVOR49", "IVOR50", "IVOR51",
1653 "IVOR52", "IVOR53", "IVOR54", "IVOR55",
1654 "IVOR56", "IVOR57", "IVOR58", "IVOR59",
1655 "IVOR60", "IVOR61", "IVOR62", "IVOR63",
1657 #define SPR_BOOKE_IVORxx (-1)
1658 int ivor_sprn
[64] = {
1659 SPR_BOOKE_IVOR0
, SPR_BOOKE_IVOR1
, SPR_BOOKE_IVOR2
, SPR_BOOKE_IVOR3
,
1660 SPR_BOOKE_IVOR4
, SPR_BOOKE_IVOR5
, SPR_BOOKE_IVOR6
, SPR_BOOKE_IVOR7
,
1661 SPR_BOOKE_IVOR8
, SPR_BOOKE_IVOR9
, SPR_BOOKE_IVOR10
, SPR_BOOKE_IVOR11
,
1662 SPR_BOOKE_IVOR12
, SPR_BOOKE_IVOR13
, SPR_BOOKE_IVOR14
, SPR_BOOKE_IVOR15
,
1663 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1664 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1665 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1666 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1667 SPR_BOOKE_IVOR32
, SPR_BOOKE_IVOR33
, SPR_BOOKE_IVOR34
, SPR_BOOKE_IVOR35
,
1668 SPR_BOOKE_IVOR36
, SPR_BOOKE_IVOR37
, SPR_BOOKE_IVOR38
, SPR_BOOKE_IVOR39
,
1669 SPR_BOOKE_IVOR40
, SPR_BOOKE_IVOR41
, SPR_BOOKE_IVOR42
, SPR_BOOKE_IVORxx
,
1670 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1671 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1672 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1673 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1674 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1678 /* Interrupt processing */
1679 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1680 SPR_NOACCESS
, SPR_NOACCESS
,
1681 &spr_read_generic
, &spr_write_generic
,
1683 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1684 SPR_NOACCESS
, SPR_NOACCESS
,
1685 &spr_read_generic
, &spr_write_generic
,
1688 /* XXX : not implemented */
1689 spr_register(env
, SPR_BOOKE_IAC1
, "IAC1",
1690 SPR_NOACCESS
, SPR_NOACCESS
,
1691 &spr_read_generic
, &spr_write_generic
,
1693 /* XXX : not implemented */
1694 spr_register(env
, SPR_BOOKE_IAC2
, "IAC2",
1695 SPR_NOACCESS
, SPR_NOACCESS
,
1696 &spr_read_generic
, &spr_write_generic
,
1698 /* XXX : not implemented */
1699 spr_register(env
, SPR_BOOKE_DAC1
, "DAC1",
1700 SPR_NOACCESS
, SPR_NOACCESS
,
1701 &spr_read_generic
, &spr_write_generic
,
1703 /* XXX : not implemented */
1704 spr_register(env
, SPR_BOOKE_DAC2
, "DAC2",
1705 SPR_NOACCESS
, SPR_NOACCESS
,
1706 &spr_read_generic
, &spr_write_generic
,
1708 /* XXX : not implemented */
1709 spr_register(env
, SPR_BOOKE_DBCR0
, "DBCR0",
1710 SPR_NOACCESS
, SPR_NOACCESS
,
1711 &spr_read_generic
, &spr_write_40x_dbcr0
,
1713 /* XXX : not implemented */
1714 spr_register(env
, SPR_BOOKE_DBCR1
, "DBCR1",
1715 SPR_NOACCESS
, SPR_NOACCESS
,
1716 &spr_read_generic
, &spr_write_generic
,
1718 /* XXX : not implemented */
1719 spr_register(env
, SPR_BOOKE_DBCR2
, "DBCR2",
1720 SPR_NOACCESS
, SPR_NOACCESS
,
1721 &spr_read_generic
, &spr_write_generic
,
1723 /* XXX : not implemented */
1724 spr_register(env
, SPR_BOOKE_DBSR
, "DBSR",
1725 SPR_NOACCESS
, SPR_NOACCESS
,
1726 &spr_read_generic
, &spr_write_clear
,
1728 spr_register(env
, SPR_BOOKE_DEAR
, "DEAR",
1729 SPR_NOACCESS
, SPR_NOACCESS
,
1730 &spr_read_generic
, &spr_write_generic
,
1732 spr_register(env
, SPR_BOOKE_ESR
, "ESR",
1733 SPR_NOACCESS
, SPR_NOACCESS
,
1734 &spr_read_generic
, &spr_write_generic
,
1736 spr_register(env
, SPR_BOOKE_IVPR
, "IVPR",
1737 SPR_NOACCESS
, SPR_NOACCESS
,
1738 &spr_read_generic
, &spr_write_excp_prefix
,
1740 /* Exception vectors */
1741 for (i
= 0; i
< 64; i
++) {
1742 if (ivor_mask
& (1ULL << i
)) {
1743 if (ivor_sprn
[i
] == SPR_BOOKE_IVORxx
) {
1744 fprintf(stderr
, "ERROR: IVOR %d SPR is not defined\n", i
);
1747 spr_register(env
, ivor_sprn
[i
], ivor_names
[i
],
1748 SPR_NOACCESS
, SPR_NOACCESS
,
1749 &spr_read_generic
, &spr_write_excp_vector
,
1753 spr_register(env
, SPR_BOOKE_PID
, "PID",
1754 SPR_NOACCESS
, SPR_NOACCESS
,
1755 &spr_read_generic
, &spr_write_booke_pid
,
1757 spr_register(env
, SPR_BOOKE_TCR
, "TCR",
1758 SPR_NOACCESS
, SPR_NOACCESS
,
1759 &spr_read_generic
, &spr_write_booke_tcr
,
1761 spr_register(env
, SPR_BOOKE_TSR
, "TSR",
1762 SPR_NOACCESS
, SPR_NOACCESS
,
1763 &spr_read_generic
, &spr_write_booke_tsr
,
1766 spr_register(env
, SPR_DECR
, "DECR",
1767 SPR_NOACCESS
, SPR_NOACCESS
,
1768 &spr_read_decr
, &spr_write_decr
,
1770 spr_register(env
, SPR_BOOKE_DECAR
, "DECAR",
1771 SPR_NOACCESS
, SPR_NOACCESS
,
1772 SPR_NOACCESS
, &spr_write_generic
,
1775 spr_register(env
, SPR_USPRG0
, "USPRG0",
1776 &spr_read_generic
, &spr_write_generic
,
1777 &spr_read_generic
, &spr_write_generic
,
1779 spr_register(env
, SPR_SPRG4
, "SPRG4",
1780 SPR_NOACCESS
, SPR_NOACCESS
,
1781 &spr_read_generic
, &spr_write_generic
,
1783 spr_register(env
, SPR_SPRG5
, "SPRG5",
1784 SPR_NOACCESS
, SPR_NOACCESS
,
1785 &spr_read_generic
, &spr_write_generic
,
1787 spr_register(env
, SPR_SPRG6
, "SPRG6",
1788 SPR_NOACCESS
, SPR_NOACCESS
,
1789 &spr_read_generic
, &spr_write_generic
,
1791 spr_register(env
, SPR_SPRG7
, "SPRG7",
1792 SPR_NOACCESS
, SPR_NOACCESS
,
1793 &spr_read_generic
, &spr_write_generic
,
1797 static inline uint32_t gen_tlbncfg(uint32_t assoc
, uint32_t minsize
,
1798 uint32_t maxsize
, uint32_t flags
,
1801 return (assoc
<< TLBnCFG_ASSOC_SHIFT
) |
1802 (minsize
<< TLBnCFG_MINSIZE_SHIFT
) |
1803 (maxsize
<< TLBnCFG_MAXSIZE_SHIFT
) |
1807 /* BookE 2.06 storage control registers */
1808 static void gen_spr_BookE206(CPUPPCState
*env
, uint32_t mas_mask
,
1811 #if !defined(CONFIG_USER_ONLY)
1812 const char *mas_names
[8] = {
1813 "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
1816 SPR_BOOKE_MAS0
, SPR_BOOKE_MAS1
, SPR_BOOKE_MAS2
, SPR_BOOKE_MAS3
,
1817 SPR_BOOKE_MAS4
, SPR_BOOKE_MAS5
, SPR_BOOKE_MAS6
, SPR_BOOKE_MAS7
,
1821 /* TLB assist registers */
1822 /* XXX : not implemented */
1823 for (i
= 0; i
< 8; i
++) {
1824 void (*uea_write
)(DisasContext
*ctx
, int sprn
, int gprn
) = &spr_write_generic32
;
1825 if (i
== 2 && (mas_mask
& (1 << i
)) && (env
->insns_flags
& PPC_64B
)) {
1826 uea_write
= &spr_write_generic
;
1828 if (mas_mask
& (1 << i
)) {
1829 spr_register(env
, mas_sprn
[i
], mas_names
[i
],
1830 SPR_NOACCESS
, SPR_NOACCESS
,
1831 &spr_read_generic
, uea_write
,
1835 if (env
->nb_pids
> 1) {
1836 /* XXX : not implemented */
1837 spr_register(env
, SPR_BOOKE_PID1
, "PID1",
1838 SPR_NOACCESS
, SPR_NOACCESS
,
1839 &spr_read_generic
, &spr_write_booke_pid
,
1842 if (env
->nb_pids
> 2) {
1843 /* XXX : not implemented */
1844 spr_register(env
, SPR_BOOKE_PID2
, "PID2",
1845 SPR_NOACCESS
, SPR_NOACCESS
,
1846 &spr_read_generic
, &spr_write_booke_pid
,
1849 /* XXX : not implemented */
1850 spr_register(env
, SPR_MMUCFG
, "MMUCFG",
1851 SPR_NOACCESS
, SPR_NOACCESS
,
1852 &spr_read_generic
, SPR_NOACCESS
,
1853 0x00000000); /* TOFIX */
1854 switch (env
->nb_ways
) {
1856 spr_register(env
, SPR_BOOKE_TLB3CFG
, "TLB3CFG",
1857 SPR_NOACCESS
, SPR_NOACCESS
,
1858 &spr_read_generic
, SPR_NOACCESS
,
1862 spr_register(env
, SPR_BOOKE_TLB2CFG
, "TLB2CFG",
1863 SPR_NOACCESS
, SPR_NOACCESS
,
1864 &spr_read_generic
, SPR_NOACCESS
,
1868 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
1869 SPR_NOACCESS
, SPR_NOACCESS
,
1870 &spr_read_generic
, SPR_NOACCESS
,
1874 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
1875 SPR_NOACCESS
, SPR_NOACCESS
,
1876 &spr_read_generic
, SPR_NOACCESS
,
1885 gen_spr_usprgh(env
);
1888 /* SPR specific to PowerPC 440 implementation */
1889 static void gen_spr_440 (CPUPPCState
*env
)
1892 /* XXX : not implemented */
1893 spr_register(env
, SPR_440_DNV0
, "DNV0",
1894 SPR_NOACCESS
, SPR_NOACCESS
,
1895 &spr_read_generic
, &spr_write_generic
,
1897 /* XXX : not implemented */
1898 spr_register(env
, SPR_440_DNV1
, "DNV1",
1899 SPR_NOACCESS
, SPR_NOACCESS
,
1900 &spr_read_generic
, &spr_write_generic
,
1902 /* XXX : not implemented */
1903 spr_register(env
, SPR_440_DNV2
, "DNV2",
1904 SPR_NOACCESS
, SPR_NOACCESS
,
1905 &spr_read_generic
, &spr_write_generic
,
1907 /* XXX : not implemented */
1908 spr_register(env
, SPR_440_DNV3
, "DNV3",
1909 SPR_NOACCESS
, SPR_NOACCESS
,
1910 &spr_read_generic
, &spr_write_generic
,
1912 /* XXX : not implemented */
1913 spr_register(env
, SPR_440_DTV0
, "DTV0",
1914 SPR_NOACCESS
, SPR_NOACCESS
,
1915 &spr_read_generic
, &spr_write_generic
,
1917 /* XXX : not implemented */
1918 spr_register(env
, SPR_440_DTV1
, "DTV1",
1919 SPR_NOACCESS
, SPR_NOACCESS
,
1920 &spr_read_generic
, &spr_write_generic
,
1922 /* XXX : not implemented */
1923 spr_register(env
, SPR_440_DTV2
, "DTV2",
1924 SPR_NOACCESS
, SPR_NOACCESS
,
1925 &spr_read_generic
, &spr_write_generic
,
1927 /* XXX : not implemented */
1928 spr_register(env
, SPR_440_DTV3
, "DTV3",
1929 SPR_NOACCESS
, SPR_NOACCESS
,
1930 &spr_read_generic
, &spr_write_generic
,
1932 /* XXX : not implemented */
1933 spr_register(env
, SPR_440_DVLIM
, "DVLIM",
1934 SPR_NOACCESS
, SPR_NOACCESS
,
1935 &spr_read_generic
, &spr_write_generic
,
1937 /* XXX : not implemented */
1938 spr_register(env
, SPR_440_INV0
, "INV0",
1939 SPR_NOACCESS
, SPR_NOACCESS
,
1940 &spr_read_generic
, &spr_write_generic
,
1942 /* XXX : not implemented */
1943 spr_register(env
, SPR_440_INV1
, "INV1",
1944 SPR_NOACCESS
, SPR_NOACCESS
,
1945 &spr_read_generic
, &spr_write_generic
,
1947 /* XXX : not implemented */
1948 spr_register(env
, SPR_440_INV2
, "INV2",
1949 SPR_NOACCESS
, SPR_NOACCESS
,
1950 &spr_read_generic
, &spr_write_generic
,
1952 /* XXX : not implemented */
1953 spr_register(env
, SPR_440_INV3
, "INV3",
1954 SPR_NOACCESS
, SPR_NOACCESS
,
1955 &spr_read_generic
, &spr_write_generic
,
1957 /* XXX : not implemented */
1958 spr_register(env
, SPR_440_ITV0
, "ITV0",
1959 SPR_NOACCESS
, SPR_NOACCESS
,
1960 &spr_read_generic
, &spr_write_generic
,
1962 /* XXX : not implemented */
1963 spr_register(env
, SPR_440_ITV1
, "ITV1",
1964 SPR_NOACCESS
, SPR_NOACCESS
,
1965 &spr_read_generic
, &spr_write_generic
,
1967 /* XXX : not implemented */
1968 spr_register(env
, SPR_440_ITV2
, "ITV2",
1969 SPR_NOACCESS
, SPR_NOACCESS
,
1970 &spr_read_generic
, &spr_write_generic
,
1972 /* XXX : not implemented */
1973 spr_register(env
, SPR_440_ITV3
, "ITV3",
1974 SPR_NOACCESS
, SPR_NOACCESS
,
1975 &spr_read_generic
, &spr_write_generic
,
1977 /* XXX : not implemented */
1978 spr_register(env
, SPR_440_IVLIM
, "IVLIM",
1979 SPR_NOACCESS
, SPR_NOACCESS
,
1980 &spr_read_generic
, &spr_write_generic
,
1983 /* XXX : not implemented */
1984 spr_register(env
, SPR_BOOKE_DCDBTRH
, "DCDBTRH",
1985 SPR_NOACCESS
, SPR_NOACCESS
,
1986 &spr_read_generic
, SPR_NOACCESS
,
1988 /* XXX : not implemented */
1989 spr_register(env
, SPR_BOOKE_DCDBTRL
, "DCDBTRL",
1990 SPR_NOACCESS
, SPR_NOACCESS
,
1991 &spr_read_generic
, SPR_NOACCESS
,
1993 /* XXX : not implemented */
1994 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
1995 SPR_NOACCESS
, SPR_NOACCESS
,
1996 &spr_read_generic
, SPR_NOACCESS
,
1998 /* XXX : not implemented */
1999 spr_register(env
, SPR_BOOKE_ICDBTRH
, "ICDBTRH",
2000 SPR_NOACCESS
, SPR_NOACCESS
,
2001 &spr_read_generic
, SPR_NOACCESS
,
2003 /* XXX : not implemented */
2004 spr_register(env
, SPR_BOOKE_ICDBTRL
, "ICDBTRL",
2005 SPR_NOACCESS
, SPR_NOACCESS
,
2006 &spr_read_generic
, SPR_NOACCESS
,
2008 /* XXX : not implemented */
2009 spr_register(env
, SPR_440_DBDR
, "DBDR",
2010 SPR_NOACCESS
, SPR_NOACCESS
,
2011 &spr_read_generic
, &spr_write_generic
,
2013 /* Processor control */
2014 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
2015 SPR_NOACCESS
, SPR_NOACCESS
,
2016 &spr_read_generic
, &spr_write_generic
,
2018 spr_register(env
, SPR_440_RSTCFG
, "RSTCFG",
2019 SPR_NOACCESS
, SPR_NOACCESS
,
2020 &spr_read_generic
, SPR_NOACCESS
,
2022 /* Storage control */
2023 spr_register(env
, SPR_440_MMUCR
, "MMUCR",
2024 SPR_NOACCESS
, SPR_NOACCESS
,
2025 &spr_read_generic
, &spr_write_generic
,
2029 /* SPR shared between PowerPC 40x implementations */
2030 static void gen_spr_40x (CPUPPCState
*env
)
2033 /* not emulated, as QEMU do not emulate caches */
2034 spr_register(env
, SPR_40x_DCCR
, "DCCR",
2035 SPR_NOACCESS
, SPR_NOACCESS
,
2036 &spr_read_generic
, &spr_write_generic
,
2038 /* not emulated, as QEMU do not emulate caches */
2039 spr_register(env
, SPR_40x_ICCR
, "ICCR",
2040 SPR_NOACCESS
, SPR_NOACCESS
,
2041 &spr_read_generic
, &spr_write_generic
,
2043 /* not emulated, as QEMU do not emulate caches */
2044 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
2045 SPR_NOACCESS
, SPR_NOACCESS
,
2046 &spr_read_generic
, SPR_NOACCESS
,
2049 spr_register(env
, SPR_40x_DEAR
, "DEAR",
2050 SPR_NOACCESS
, SPR_NOACCESS
,
2051 &spr_read_generic
, &spr_write_generic
,
2053 spr_register(env
, SPR_40x_ESR
, "ESR",
2054 SPR_NOACCESS
, SPR_NOACCESS
,
2055 &spr_read_generic
, &spr_write_generic
,
2057 spr_register(env
, SPR_40x_EVPR
, "EVPR",
2058 SPR_NOACCESS
, SPR_NOACCESS
,
2059 &spr_read_generic
, &spr_write_excp_prefix
,
2061 spr_register(env
, SPR_40x_SRR2
, "SRR2",
2062 &spr_read_generic
, &spr_write_generic
,
2063 &spr_read_generic
, &spr_write_generic
,
2065 spr_register(env
, SPR_40x_SRR3
, "SRR3",
2066 &spr_read_generic
, &spr_write_generic
,
2067 &spr_read_generic
, &spr_write_generic
,
2070 spr_register(env
, SPR_40x_PIT
, "PIT",
2071 SPR_NOACCESS
, SPR_NOACCESS
,
2072 &spr_read_40x_pit
, &spr_write_40x_pit
,
2074 spr_register(env
, SPR_40x_TCR
, "TCR",
2075 SPR_NOACCESS
, SPR_NOACCESS
,
2076 &spr_read_generic
, &spr_write_booke_tcr
,
2078 spr_register(env
, SPR_40x_TSR
, "TSR",
2079 SPR_NOACCESS
, SPR_NOACCESS
,
2080 &spr_read_generic
, &spr_write_booke_tsr
,
2084 /* SPR specific to PowerPC 405 implementation */
2085 static void gen_spr_405 (CPUPPCState
*env
)
2088 spr_register(env
, SPR_40x_PID
, "PID",
2089 SPR_NOACCESS
, SPR_NOACCESS
,
2090 &spr_read_generic
, &spr_write_generic
,
2092 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
2093 SPR_NOACCESS
, SPR_NOACCESS
,
2094 &spr_read_generic
, &spr_write_generic
,
2096 /* Debug interface */
2097 /* XXX : not implemented */
2098 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2099 SPR_NOACCESS
, SPR_NOACCESS
,
2100 &spr_read_generic
, &spr_write_40x_dbcr0
,
2102 /* XXX : not implemented */
2103 spr_register(env
, SPR_405_DBCR1
, "DBCR1",
2104 SPR_NOACCESS
, SPR_NOACCESS
,
2105 &spr_read_generic
, &spr_write_generic
,
2107 /* XXX : not implemented */
2108 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2109 SPR_NOACCESS
, SPR_NOACCESS
,
2110 &spr_read_generic
, &spr_write_clear
,
2111 /* Last reset was system reset */
2113 /* XXX : not implemented */
2114 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2115 SPR_NOACCESS
, SPR_NOACCESS
,
2116 &spr_read_generic
, &spr_write_generic
,
2118 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2119 SPR_NOACCESS
, SPR_NOACCESS
,
2120 &spr_read_generic
, &spr_write_generic
,
2122 /* XXX : not implemented */
2123 spr_register(env
, SPR_405_DVC1
, "DVC1",
2124 SPR_NOACCESS
, SPR_NOACCESS
,
2125 &spr_read_generic
, &spr_write_generic
,
2127 /* XXX : not implemented */
2128 spr_register(env
, SPR_405_DVC2
, "DVC2",
2129 SPR_NOACCESS
, SPR_NOACCESS
,
2130 &spr_read_generic
, &spr_write_generic
,
2132 /* XXX : not implemented */
2133 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2134 SPR_NOACCESS
, SPR_NOACCESS
,
2135 &spr_read_generic
, &spr_write_generic
,
2137 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2138 SPR_NOACCESS
, SPR_NOACCESS
,
2139 &spr_read_generic
, &spr_write_generic
,
2141 /* XXX : not implemented */
2142 spr_register(env
, SPR_405_IAC3
, "IAC3",
2143 SPR_NOACCESS
, SPR_NOACCESS
,
2144 &spr_read_generic
, &spr_write_generic
,
2146 /* XXX : not implemented */
2147 spr_register(env
, SPR_405_IAC4
, "IAC4",
2148 SPR_NOACCESS
, SPR_NOACCESS
,
2149 &spr_read_generic
, &spr_write_generic
,
2151 /* Storage control */
2152 /* XXX: TODO: not implemented */
2153 spr_register(env
, SPR_405_SLER
, "SLER",
2154 SPR_NOACCESS
, SPR_NOACCESS
,
2155 &spr_read_generic
, &spr_write_40x_sler
,
2157 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2158 SPR_NOACCESS
, SPR_NOACCESS
,
2159 &spr_read_generic
, &spr_write_generic
,
2161 /* XXX : not implemented */
2162 spr_register(env
, SPR_405_SU0R
, "SU0R",
2163 SPR_NOACCESS
, SPR_NOACCESS
,
2164 &spr_read_generic
, &spr_write_generic
,
2167 spr_register(env
, SPR_USPRG0
, "USPRG0",
2168 &spr_read_ureg
, SPR_NOACCESS
,
2169 &spr_read_ureg
, SPR_NOACCESS
,
2171 spr_register(env
, SPR_SPRG4
, "SPRG4",
2172 SPR_NOACCESS
, SPR_NOACCESS
,
2173 &spr_read_generic
, &spr_write_generic
,
2175 spr_register(env
, SPR_SPRG5
, "SPRG5",
2176 SPR_NOACCESS
, SPR_NOACCESS
,
2177 spr_read_generic
, &spr_write_generic
,
2179 spr_register(env
, SPR_SPRG6
, "SPRG6",
2180 SPR_NOACCESS
, SPR_NOACCESS
,
2181 spr_read_generic
, &spr_write_generic
,
2183 spr_register(env
, SPR_SPRG7
, "SPRG7",
2184 SPR_NOACCESS
, SPR_NOACCESS
,
2185 spr_read_generic
, &spr_write_generic
,
2187 gen_spr_usprgh(env
);
2190 /* SPR shared between PowerPC 401 & 403 implementations */
2191 static void gen_spr_401_403 (CPUPPCState
*env
)
2194 spr_register(env
, SPR_403_VTBL
, "TBL",
2195 &spr_read_tbl
, SPR_NOACCESS
,
2196 &spr_read_tbl
, SPR_NOACCESS
,
2198 spr_register(env
, SPR_403_TBL
, "TBL",
2199 SPR_NOACCESS
, SPR_NOACCESS
,
2200 SPR_NOACCESS
, &spr_write_tbl
,
2202 spr_register(env
, SPR_403_VTBU
, "TBU",
2203 &spr_read_tbu
, SPR_NOACCESS
,
2204 &spr_read_tbu
, SPR_NOACCESS
,
2206 spr_register(env
, SPR_403_TBU
, "TBU",
2207 SPR_NOACCESS
, SPR_NOACCESS
,
2208 SPR_NOACCESS
, &spr_write_tbu
,
2211 /* not emulated, as QEMU do not emulate caches */
2212 spr_register(env
, SPR_403_CDBCR
, "CDBCR",
2213 SPR_NOACCESS
, SPR_NOACCESS
,
2214 &spr_read_generic
, &spr_write_generic
,
2218 /* SPR specific to PowerPC 401 implementation */
2219 static void gen_spr_401 (CPUPPCState
*env
)
2221 /* Debug interface */
2222 /* XXX : not implemented */
2223 spr_register(env
, SPR_40x_DBCR0
, "DBCR",
2224 SPR_NOACCESS
, SPR_NOACCESS
,
2225 &spr_read_generic
, &spr_write_40x_dbcr0
,
2227 /* XXX : not implemented */
2228 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2229 SPR_NOACCESS
, SPR_NOACCESS
,
2230 &spr_read_generic
, &spr_write_clear
,
2231 /* Last reset was system reset */
2233 /* XXX : not implemented */
2234 spr_register(env
, SPR_40x_DAC1
, "DAC",
2235 SPR_NOACCESS
, SPR_NOACCESS
,
2236 &spr_read_generic
, &spr_write_generic
,
2238 /* XXX : not implemented */
2239 spr_register(env
, SPR_40x_IAC1
, "IAC",
2240 SPR_NOACCESS
, SPR_NOACCESS
,
2241 &spr_read_generic
, &spr_write_generic
,
2243 /* Storage control */
2244 /* XXX: TODO: not implemented */
2245 spr_register(env
, SPR_405_SLER
, "SLER",
2246 SPR_NOACCESS
, SPR_NOACCESS
,
2247 &spr_read_generic
, &spr_write_40x_sler
,
2249 /* not emulated, as QEMU never does speculative access */
2250 spr_register(env
, SPR_40x_SGR
, "SGR",
2251 SPR_NOACCESS
, SPR_NOACCESS
,
2252 &spr_read_generic
, &spr_write_generic
,
2254 /* not emulated, as QEMU do not emulate caches */
2255 spr_register(env
, SPR_40x_DCWR
, "DCWR",
2256 SPR_NOACCESS
, SPR_NOACCESS
,
2257 &spr_read_generic
, &spr_write_generic
,
2261 static void gen_spr_401x2 (CPUPPCState
*env
)
2264 spr_register(env
, SPR_40x_PID
, "PID",
2265 SPR_NOACCESS
, SPR_NOACCESS
,
2266 &spr_read_generic
, &spr_write_generic
,
2268 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2269 SPR_NOACCESS
, SPR_NOACCESS
,
2270 &spr_read_generic
, &spr_write_generic
,
2274 /* SPR specific to PowerPC 403 implementation */
2275 static void gen_spr_403 (CPUPPCState
*env
)
2277 /* Debug interface */
2278 /* XXX : not implemented */
2279 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2280 SPR_NOACCESS
, SPR_NOACCESS
,
2281 &spr_read_generic
, &spr_write_40x_dbcr0
,
2283 /* XXX : not implemented */
2284 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2285 SPR_NOACCESS
, SPR_NOACCESS
,
2286 &spr_read_generic
, &spr_write_clear
,
2287 /* Last reset was system reset */
2289 /* XXX : not implemented */
2290 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2291 SPR_NOACCESS
, SPR_NOACCESS
,
2292 &spr_read_generic
, &spr_write_generic
,
2294 /* XXX : not implemented */
2295 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2296 SPR_NOACCESS
, SPR_NOACCESS
,
2297 &spr_read_generic
, &spr_write_generic
,
2299 /* XXX : not implemented */
2300 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2301 SPR_NOACCESS
, SPR_NOACCESS
,
2302 &spr_read_generic
, &spr_write_generic
,
2304 /* XXX : not implemented */
2305 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2306 SPR_NOACCESS
, SPR_NOACCESS
,
2307 &spr_read_generic
, &spr_write_generic
,
2311 static void gen_spr_403_real (CPUPPCState
*env
)
2313 spr_register(env
, SPR_403_PBL1
, "PBL1",
2314 SPR_NOACCESS
, SPR_NOACCESS
,
2315 &spr_read_403_pbr
, &spr_write_403_pbr
,
2317 spr_register(env
, SPR_403_PBU1
, "PBU1",
2318 SPR_NOACCESS
, SPR_NOACCESS
,
2319 &spr_read_403_pbr
, &spr_write_403_pbr
,
2321 spr_register(env
, SPR_403_PBL2
, "PBL2",
2322 SPR_NOACCESS
, SPR_NOACCESS
,
2323 &spr_read_403_pbr
, &spr_write_403_pbr
,
2325 spr_register(env
, SPR_403_PBU2
, "PBU2",
2326 SPR_NOACCESS
, SPR_NOACCESS
,
2327 &spr_read_403_pbr
, &spr_write_403_pbr
,
2331 static void gen_spr_403_mmu (CPUPPCState
*env
)
2334 spr_register(env
, SPR_40x_PID
, "PID",
2335 SPR_NOACCESS
, SPR_NOACCESS
,
2336 &spr_read_generic
, &spr_write_generic
,
2338 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2339 SPR_NOACCESS
, SPR_NOACCESS
,
2340 &spr_read_generic
, &spr_write_generic
,
2344 /* SPR specific to PowerPC compression coprocessor extension */
2345 static void gen_spr_compress (CPUPPCState
*env
)
2347 /* XXX : not implemented */
2348 spr_register(env
, SPR_401_SKR
, "SKR",
2349 SPR_NOACCESS
, SPR_NOACCESS
,
2350 &spr_read_generic
, &spr_write_generic
,
2354 static void gen_spr_5xx_8xx (CPUPPCState
*env
)
2356 /* Exception processing */
2357 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
2358 SPR_NOACCESS
, SPR_NOACCESS
,
2359 &spr_read_generic
, &spr_write_generic
,
2360 KVM_REG_PPC_DSISR
, 0x00000000);
2361 spr_register_kvm(env
, SPR_DAR
, "DAR",
2362 SPR_NOACCESS
, SPR_NOACCESS
,
2363 &spr_read_generic
, &spr_write_generic
,
2364 KVM_REG_PPC_DAR
, 0x00000000);
2366 spr_register(env
, SPR_DECR
, "DECR",
2367 SPR_NOACCESS
, SPR_NOACCESS
,
2368 &spr_read_decr
, &spr_write_decr
,
2370 /* XXX : not implemented */
2371 spr_register(env
, SPR_MPC_EIE
, "EIE",
2372 SPR_NOACCESS
, SPR_NOACCESS
,
2373 &spr_read_generic
, &spr_write_generic
,
2375 /* XXX : not implemented */
2376 spr_register(env
, SPR_MPC_EID
, "EID",
2377 SPR_NOACCESS
, SPR_NOACCESS
,
2378 &spr_read_generic
, &spr_write_generic
,
2380 /* XXX : not implemented */
2381 spr_register(env
, SPR_MPC_NRI
, "NRI",
2382 SPR_NOACCESS
, SPR_NOACCESS
,
2383 &spr_read_generic
, &spr_write_generic
,
2385 /* XXX : not implemented */
2386 spr_register(env
, SPR_MPC_CMPA
, "CMPA",
2387 SPR_NOACCESS
, SPR_NOACCESS
,
2388 &spr_read_generic
, &spr_write_generic
,
2390 /* XXX : not implemented */
2391 spr_register(env
, SPR_MPC_CMPB
, "CMPB",
2392 SPR_NOACCESS
, SPR_NOACCESS
,
2393 &spr_read_generic
, &spr_write_generic
,
2395 /* XXX : not implemented */
2396 spr_register(env
, SPR_MPC_CMPC
, "CMPC",
2397 SPR_NOACCESS
, SPR_NOACCESS
,
2398 &spr_read_generic
, &spr_write_generic
,
2400 /* XXX : not implemented */
2401 spr_register(env
, SPR_MPC_CMPD
, "CMPD",
2402 SPR_NOACCESS
, SPR_NOACCESS
,
2403 &spr_read_generic
, &spr_write_generic
,
2405 /* XXX : not implemented */
2406 spr_register(env
, SPR_MPC_ECR
, "ECR",
2407 SPR_NOACCESS
, SPR_NOACCESS
,
2408 &spr_read_generic
, &spr_write_generic
,
2410 /* XXX : not implemented */
2411 spr_register(env
, SPR_MPC_DER
, "DER",
2412 SPR_NOACCESS
, SPR_NOACCESS
,
2413 &spr_read_generic
, &spr_write_generic
,
2415 /* XXX : not implemented */
2416 spr_register(env
, SPR_MPC_COUNTA
, "COUNTA",
2417 SPR_NOACCESS
, SPR_NOACCESS
,
2418 &spr_read_generic
, &spr_write_generic
,
2420 /* XXX : not implemented */
2421 spr_register(env
, SPR_MPC_COUNTB
, "COUNTB",
2422 SPR_NOACCESS
, SPR_NOACCESS
,
2423 &spr_read_generic
, &spr_write_generic
,
2425 /* XXX : not implemented */
2426 spr_register(env
, SPR_MPC_CMPE
, "CMPE",
2427 SPR_NOACCESS
, SPR_NOACCESS
,
2428 &spr_read_generic
, &spr_write_generic
,
2430 /* XXX : not implemented */
2431 spr_register(env
, SPR_MPC_CMPF
, "CMPF",
2432 SPR_NOACCESS
, SPR_NOACCESS
,
2433 &spr_read_generic
, &spr_write_generic
,
2435 /* XXX : not implemented */
2436 spr_register(env
, SPR_MPC_CMPG
, "CMPG",
2437 SPR_NOACCESS
, SPR_NOACCESS
,
2438 &spr_read_generic
, &spr_write_generic
,
2440 /* XXX : not implemented */
2441 spr_register(env
, SPR_MPC_CMPH
, "CMPH",
2442 SPR_NOACCESS
, SPR_NOACCESS
,
2443 &spr_read_generic
, &spr_write_generic
,
2445 /* XXX : not implemented */
2446 spr_register(env
, SPR_MPC_LCTRL1
, "LCTRL1",
2447 SPR_NOACCESS
, SPR_NOACCESS
,
2448 &spr_read_generic
, &spr_write_generic
,
2450 /* XXX : not implemented */
2451 spr_register(env
, SPR_MPC_LCTRL2
, "LCTRL2",
2452 SPR_NOACCESS
, SPR_NOACCESS
,
2453 &spr_read_generic
, &spr_write_generic
,
2455 /* XXX : not implemented */
2456 spr_register(env
, SPR_MPC_BAR
, "BAR",
2457 SPR_NOACCESS
, SPR_NOACCESS
,
2458 &spr_read_generic
, &spr_write_generic
,
2460 /* XXX : not implemented */
2461 spr_register(env
, SPR_MPC_DPDR
, "DPDR",
2462 SPR_NOACCESS
, SPR_NOACCESS
,
2463 &spr_read_generic
, &spr_write_generic
,
2465 /* XXX : not implemented */
2466 spr_register(env
, SPR_MPC_IMMR
, "IMMR",
2467 SPR_NOACCESS
, SPR_NOACCESS
,
2468 &spr_read_generic
, &spr_write_generic
,
2472 static void gen_spr_5xx (CPUPPCState
*env
)
2474 /* XXX : not implemented */
2475 spr_register(env
, SPR_RCPU_MI_GRA
, "MI_GRA",
2476 SPR_NOACCESS
, SPR_NOACCESS
,
2477 &spr_read_generic
, &spr_write_generic
,
2479 /* XXX : not implemented */
2480 spr_register(env
, SPR_RCPU_L2U_GRA
, "L2U_GRA",
2481 SPR_NOACCESS
, SPR_NOACCESS
,
2482 &spr_read_generic
, &spr_write_generic
,
2484 /* XXX : not implemented */
2485 spr_register(env
, SPR_RPCU_BBCMCR
, "L2U_BBCMCR",
2486 SPR_NOACCESS
, SPR_NOACCESS
,
2487 &spr_read_generic
, &spr_write_generic
,
2489 /* XXX : not implemented */
2490 spr_register(env
, SPR_RCPU_L2U_MCR
, "L2U_MCR",
2491 SPR_NOACCESS
, SPR_NOACCESS
,
2492 &spr_read_generic
, &spr_write_generic
,
2494 /* XXX : not implemented */
2495 spr_register(env
, SPR_RCPU_MI_RBA0
, "MI_RBA0",
2496 SPR_NOACCESS
, SPR_NOACCESS
,
2497 &spr_read_generic
, &spr_write_generic
,
2499 /* XXX : not implemented */
2500 spr_register(env
, SPR_RCPU_MI_RBA1
, "MI_RBA1",
2501 SPR_NOACCESS
, SPR_NOACCESS
,
2502 &spr_read_generic
, &spr_write_generic
,
2504 /* XXX : not implemented */
2505 spr_register(env
, SPR_RCPU_MI_RBA2
, "MI_RBA2",
2506 SPR_NOACCESS
, SPR_NOACCESS
,
2507 &spr_read_generic
, &spr_write_generic
,
2509 /* XXX : not implemented */
2510 spr_register(env
, SPR_RCPU_MI_RBA3
, "MI_RBA3",
2511 SPR_NOACCESS
, SPR_NOACCESS
,
2512 &spr_read_generic
, &spr_write_generic
,
2514 /* XXX : not implemented */
2515 spr_register(env
, SPR_RCPU_L2U_RBA0
, "L2U_RBA0",
2516 SPR_NOACCESS
, SPR_NOACCESS
,
2517 &spr_read_generic
, &spr_write_generic
,
2519 /* XXX : not implemented */
2520 spr_register(env
, SPR_RCPU_L2U_RBA1
, "L2U_RBA1",
2521 SPR_NOACCESS
, SPR_NOACCESS
,
2522 &spr_read_generic
, &spr_write_generic
,
2524 /* XXX : not implemented */
2525 spr_register(env
, SPR_RCPU_L2U_RBA2
, "L2U_RBA2",
2526 SPR_NOACCESS
, SPR_NOACCESS
,
2527 &spr_read_generic
, &spr_write_generic
,
2529 /* XXX : not implemented */
2530 spr_register(env
, SPR_RCPU_L2U_RBA3
, "L2U_RBA3",
2531 SPR_NOACCESS
, SPR_NOACCESS
,
2532 &spr_read_generic
, &spr_write_generic
,
2534 /* XXX : not implemented */
2535 spr_register(env
, SPR_RCPU_MI_RA0
, "MI_RA0",
2536 SPR_NOACCESS
, SPR_NOACCESS
,
2537 &spr_read_generic
, &spr_write_generic
,
2539 /* XXX : not implemented */
2540 spr_register(env
, SPR_RCPU_MI_RA1
, "MI_RA1",
2541 SPR_NOACCESS
, SPR_NOACCESS
,
2542 &spr_read_generic
, &spr_write_generic
,
2544 /* XXX : not implemented */
2545 spr_register(env
, SPR_RCPU_MI_RA2
, "MI_RA2",
2546 SPR_NOACCESS
, SPR_NOACCESS
,
2547 &spr_read_generic
, &spr_write_generic
,
2549 /* XXX : not implemented */
2550 spr_register(env
, SPR_RCPU_MI_RA3
, "MI_RA3",
2551 SPR_NOACCESS
, SPR_NOACCESS
,
2552 &spr_read_generic
, &spr_write_generic
,
2554 /* XXX : not implemented */
2555 spr_register(env
, SPR_RCPU_L2U_RA0
, "L2U_RA0",
2556 SPR_NOACCESS
, SPR_NOACCESS
,
2557 &spr_read_generic
, &spr_write_generic
,
2559 /* XXX : not implemented */
2560 spr_register(env
, SPR_RCPU_L2U_RA1
, "L2U_RA1",
2561 SPR_NOACCESS
, SPR_NOACCESS
,
2562 &spr_read_generic
, &spr_write_generic
,
2564 /* XXX : not implemented */
2565 spr_register(env
, SPR_RCPU_L2U_RA2
, "L2U_RA2",
2566 SPR_NOACCESS
, SPR_NOACCESS
,
2567 &spr_read_generic
, &spr_write_generic
,
2569 /* XXX : not implemented */
2570 spr_register(env
, SPR_RCPU_L2U_RA3
, "L2U_RA3",
2571 SPR_NOACCESS
, SPR_NOACCESS
,
2572 &spr_read_generic
, &spr_write_generic
,
2574 /* XXX : not implemented */
2575 spr_register(env
, SPR_RCPU_FPECR
, "FPECR",
2576 SPR_NOACCESS
, SPR_NOACCESS
,
2577 &spr_read_generic
, &spr_write_generic
,
2581 static void gen_spr_8xx (CPUPPCState
*env
)
2583 /* XXX : not implemented */
2584 spr_register(env
, SPR_MPC_IC_CST
, "IC_CST",
2585 SPR_NOACCESS
, SPR_NOACCESS
,
2586 &spr_read_generic
, &spr_write_generic
,
2588 /* XXX : not implemented */
2589 spr_register(env
, SPR_MPC_IC_ADR
, "IC_ADR",
2590 SPR_NOACCESS
, SPR_NOACCESS
,
2591 &spr_read_generic
, &spr_write_generic
,
2593 /* XXX : not implemented */
2594 spr_register(env
, SPR_MPC_IC_DAT
, "IC_DAT",
2595 SPR_NOACCESS
, SPR_NOACCESS
,
2596 &spr_read_generic
, &spr_write_generic
,
2598 /* XXX : not implemented */
2599 spr_register(env
, SPR_MPC_DC_CST
, "DC_CST",
2600 SPR_NOACCESS
, SPR_NOACCESS
,
2601 &spr_read_generic
, &spr_write_generic
,
2603 /* XXX : not implemented */
2604 spr_register(env
, SPR_MPC_DC_ADR
, "DC_ADR",
2605 SPR_NOACCESS
, SPR_NOACCESS
,
2606 &spr_read_generic
, &spr_write_generic
,
2608 /* XXX : not implemented */
2609 spr_register(env
, SPR_MPC_DC_DAT
, "DC_DAT",
2610 SPR_NOACCESS
, SPR_NOACCESS
,
2611 &spr_read_generic
, &spr_write_generic
,
2613 /* XXX : not implemented */
2614 spr_register(env
, SPR_MPC_MI_CTR
, "MI_CTR",
2615 SPR_NOACCESS
, SPR_NOACCESS
,
2616 &spr_read_generic
, &spr_write_generic
,
2618 /* XXX : not implemented */
2619 spr_register(env
, SPR_MPC_MI_AP
, "MI_AP",
2620 SPR_NOACCESS
, SPR_NOACCESS
,
2621 &spr_read_generic
, &spr_write_generic
,
2623 /* XXX : not implemented */
2624 spr_register(env
, SPR_MPC_MI_EPN
, "MI_EPN",
2625 SPR_NOACCESS
, SPR_NOACCESS
,
2626 &spr_read_generic
, &spr_write_generic
,
2628 /* XXX : not implemented */
2629 spr_register(env
, SPR_MPC_MI_TWC
, "MI_TWC",
2630 SPR_NOACCESS
, SPR_NOACCESS
,
2631 &spr_read_generic
, &spr_write_generic
,
2633 /* XXX : not implemented */
2634 spr_register(env
, SPR_MPC_MI_RPN
, "MI_RPN",
2635 SPR_NOACCESS
, SPR_NOACCESS
,
2636 &spr_read_generic
, &spr_write_generic
,
2638 /* XXX : not implemented */
2639 spr_register(env
, SPR_MPC_MI_DBCAM
, "MI_DBCAM",
2640 SPR_NOACCESS
, SPR_NOACCESS
,
2641 &spr_read_generic
, &spr_write_generic
,
2643 /* XXX : not implemented */
2644 spr_register(env
, SPR_MPC_MI_DBRAM0
, "MI_DBRAM0",
2645 SPR_NOACCESS
, SPR_NOACCESS
,
2646 &spr_read_generic
, &spr_write_generic
,
2648 /* XXX : not implemented */
2649 spr_register(env
, SPR_MPC_MI_DBRAM1
, "MI_DBRAM1",
2650 SPR_NOACCESS
, SPR_NOACCESS
,
2651 &spr_read_generic
, &spr_write_generic
,
2653 /* XXX : not implemented */
2654 spr_register(env
, SPR_MPC_MD_CTR
, "MD_CTR",
2655 SPR_NOACCESS
, SPR_NOACCESS
,
2656 &spr_read_generic
, &spr_write_generic
,
2658 /* XXX : not implemented */
2659 spr_register(env
, SPR_MPC_MD_CASID
, "MD_CASID",
2660 SPR_NOACCESS
, SPR_NOACCESS
,
2661 &spr_read_generic
, &spr_write_generic
,
2663 /* XXX : not implemented */
2664 spr_register(env
, SPR_MPC_MD_AP
, "MD_AP",
2665 SPR_NOACCESS
, SPR_NOACCESS
,
2666 &spr_read_generic
, &spr_write_generic
,
2668 /* XXX : not implemented */
2669 spr_register(env
, SPR_MPC_MD_EPN
, "MD_EPN",
2670 SPR_NOACCESS
, SPR_NOACCESS
,
2671 &spr_read_generic
, &spr_write_generic
,
2673 /* XXX : not implemented */
2674 spr_register(env
, SPR_MPC_MD_TWB
, "MD_TWB",
2675 SPR_NOACCESS
, SPR_NOACCESS
,
2676 &spr_read_generic
, &spr_write_generic
,
2678 /* XXX : not implemented */
2679 spr_register(env
, SPR_MPC_MD_TWC
, "MD_TWC",
2680 SPR_NOACCESS
, SPR_NOACCESS
,
2681 &spr_read_generic
, &spr_write_generic
,
2683 /* XXX : not implemented */
2684 spr_register(env
, SPR_MPC_MD_RPN
, "MD_RPN",
2685 SPR_NOACCESS
, SPR_NOACCESS
,
2686 &spr_read_generic
, &spr_write_generic
,
2688 /* XXX : not implemented */
2689 spr_register(env
, SPR_MPC_MD_TW
, "MD_TW",
2690 SPR_NOACCESS
, SPR_NOACCESS
,
2691 &spr_read_generic
, &spr_write_generic
,
2693 /* XXX : not implemented */
2694 spr_register(env
, SPR_MPC_MD_DBCAM
, "MD_DBCAM",
2695 SPR_NOACCESS
, SPR_NOACCESS
,
2696 &spr_read_generic
, &spr_write_generic
,
2698 /* XXX : not implemented */
2699 spr_register(env
, SPR_MPC_MD_DBRAM0
, "MD_DBRAM0",
2700 SPR_NOACCESS
, SPR_NOACCESS
,
2701 &spr_read_generic
, &spr_write_generic
,
2703 /* XXX : not implemented */
2704 spr_register(env
, SPR_MPC_MD_DBRAM1
, "MD_DBRAM1",
2705 SPR_NOACCESS
, SPR_NOACCESS
,
2706 &spr_read_generic
, &spr_write_generic
,
2712 * AMR => SPR 29 (Power 2.04)
2713 * CTRL => SPR 136 (Power 2.04)
2714 * CTRL => SPR 152 (Power 2.04)
2715 * SCOMC => SPR 276 (64 bits ?)
2716 * SCOMD => SPR 277 (64 bits ?)
2717 * TBU40 => SPR 286 (Power 2.04 hypv)
2718 * HSPRG0 => SPR 304 (Power 2.04 hypv)
2719 * HSPRG1 => SPR 305 (Power 2.04 hypv)
2720 * HDSISR => SPR 306 (Power 2.04 hypv)
2721 * HDAR => SPR 307 (Power 2.04 hypv)
2722 * PURR => SPR 309 (Power 2.04 hypv)
2723 * HDEC => SPR 310 (Power 2.04 hypv)
2724 * HIOR => SPR 311 (hypv)
2725 * RMOR => SPR 312 (970)
2726 * HRMOR => SPR 313 (Power 2.04 hypv)
2727 * HSRR0 => SPR 314 (Power 2.04 hypv)
2728 * HSRR1 => SPR 315 (Power 2.04 hypv)
2729 * LPIDR => SPR 317 (970)
2730 * EPR => SPR 702 (Power 2.04 emb)
2731 * perf => 768-783 (Power 2.04)
2732 * perf => 784-799 (Power 2.04)
2733 * PPR => SPR 896 (Power 2.04)
2734 * EPLC => SPR 947 (Power 2.04 emb)
2735 * EPSC => SPR 948 (Power 2.04 emb)
2736 * DABRX => 1015 (Power 2.04 hypv)
2737 * FPECR => SPR 1022 (?)
2738 * ... and more (thermal management, performance counters, ...)
2741 /*****************************************************************************/
2742 /* Exception vectors models */
2743 static void init_excp_4xx_real (CPUPPCState
*env
)
2745 #if !defined(CONFIG_USER_ONLY)
2746 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2747 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2748 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2749 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2750 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2751 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2752 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2753 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2754 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2755 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2756 env
->ivor_mask
= 0x0000FFF0UL
;
2757 env
->ivpr_mask
= 0xFFFF0000UL
;
2758 /* Hardware reset vector */
2759 env
->hreset_vector
= 0xFFFFFFFCUL
;
2763 static void init_excp_4xx_softmmu (CPUPPCState
*env
)
2765 #if !defined(CONFIG_USER_ONLY)
2766 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2767 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2768 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2769 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2770 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2771 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2772 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2773 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2774 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2775 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2776 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2777 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001100;
2778 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001200;
2779 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2780 env
->ivor_mask
= 0x0000FFF0UL
;
2781 env
->ivpr_mask
= 0xFFFF0000UL
;
2782 /* Hardware reset vector */
2783 env
->hreset_vector
= 0xFFFFFFFCUL
;
2787 static void init_excp_MPC5xx (CPUPPCState
*env
)
2789 #if !defined(CONFIG_USER_ONLY)
2790 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2791 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2792 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2793 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2794 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2795 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2796 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2797 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2798 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2799 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2800 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2801 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2802 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2803 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2804 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2805 env
->ivor_mask
= 0x0000FFF0UL
;
2806 env
->ivpr_mask
= 0xFFFF0000UL
;
2807 /* Hardware reset vector */
2808 env
->hreset_vector
= 0x00000100UL
;
2812 static void init_excp_MPC8xx (CPUPPCState
*env
)
2814 #if !defined(CONFIG_USER_ONLY)
2815 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2816 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2817 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2818 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2819 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2820 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2821 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2822 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2823 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2824 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2825 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2826 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2827 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2828 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001100;
2829 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001200;
2830 env
->excp_vectors
[POWERPC_EXCP_ITLBE
] = 0x00001300;
2831 env
->excp_vectors
[POWERPC_EXCP_DTLBE
] = 0x00001400;
2832 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2833 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2834 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2835 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2836 env
->ivor_mask
= 0x0000FFF0UL
;
2837 env
->ivpr_mask
= 0xFFFF0000UL
;
2838 /* Hardware reset vector */
2839 env
->hreset_vector
= 0x00000100UL
;
2843 static void init_excp_G2 (CPUPPCState
*env
)
2845 #if !defined(CONFIG_USER_ONLY)
2846 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2847 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2848 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2849 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2850 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2851 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2852 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2853 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2854 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2855 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000A00;
2856 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2857 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2858 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2859 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2860 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2861 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2862 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2863 /* Hardware reset vector */
2864 env
->hreset_vector
= 0x00000100UL
;
2868 static void init_excp_e200(CPUPPCState
*env
, target_ulong ivpr_mask
)
2870 #if !defined(CONFIG_USER_ONLY)
2871 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000FFC;
2872 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2873 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2874 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2875 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2876 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2877 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2878 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2879 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2880 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2881 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2882 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2883 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2884 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2885 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2886 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2887 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2888 env
->excp_vectors
[POWERPC_EXCP_SPEU
] = 0x00000000;
2889 env
->excp_vectors
[POWERPC_EXCP_EFPDI
] = 0x00000000;
2890 env
->excp_vectors
[POWERPC_EXCP_EFPRI
] = 0x00000000;
2891 env
->ivor_mask
= 0x0000FFF7UL
;
2892 env
->ivpr_mask
= ivpr_mask
;
2893 /* Hardware reset vector */
2894 env
->hreset_vector
= 0xFFFFFFFCUL
;
2898 static void init_excp_BookE (CPUPPCState
*env
)
2900 #if !defined(CONFIG_USER_ONLY)
2901 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2902 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2903 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2904 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2905 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2906 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2907 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2908 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2909 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2910 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2911 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2912 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2913 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2914 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2915 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2916 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2917 env
->ivor_mask
= 0x0000FFF0UL
;
2918 env
->ivpr_mask
= 0xFFFF0000UL
;
2919 /* Hardware reset vector */
2920 env
->hreset_vector
= 0xFFFFFFFCUL
;
2924 static void init_excp_601 (CPUPPCState
*env
)
2926 #if !defined(CONFIG_USER_ONLY)
2927 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2928 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2929 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2930 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2931 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2932 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2933 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2934 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2935 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2936 env
->excp_vectors
[POWERPC_EXCP_IO
] = 0x00000A00;
2937 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2938 env
->excp_vectors
[POWERPC_EXCP_RUNM
] = 0x00002000;
2939 /* Hardware reset vector */
2940 env
->hreset_vector
= 0x00000100UL
;
2944 static void init_excp_602 (CPUPPCState
*env
)
2946 #if !defined(CONFIG_USER_ONLY)
2947 /* XXX: exception prefix has a special behavior on 602 */
2948 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2949 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2950 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2951 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2952 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2953 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2954 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2955 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2956 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2957 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2958 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2959 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2960 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2961 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2962 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2963 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2964 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001500;
2965 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001600;
2966 /* Hardware reset vector */
2967 env
->hreset_vector
= 0x00000100UL
;
2971 static void init_excp_603 (CPUPPCState
*env
)
2973 #if !defined(CONFIG_USER_ONLY)
2974 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2975 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2976 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2977 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2978 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2979 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2980 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2981 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2982 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2983 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2984 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2985 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2986 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2987 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2988 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2989 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2990 /* Hardware reset vector */
2991 env
->hreset_vector
= 0x00000100UL
;
2995 static void init_excp_604 (CPUPPCState
*env
)
2997 #if !defined(CONFIG_USER_ONLY)
2998 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2999 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3000 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3001 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3002 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3003 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3004 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3005 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3006 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3007 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3008 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3009 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3010 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3011 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3012 /* Hardware reset vector */
3013 env
->hreset_vector
= 0x00000100UL
;
3017 static void init_excp_7x0 (CPUPPCState
*env
)
3019 #if !defined(CONFIG_USER_ONLY)
3020 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3021 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3022 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3023 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3024 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3025 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3026 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3027 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3028 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3029 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3030 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3031 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3032 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3033 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3034 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3035 /* Hardware reset vector */
3036 env
->hreset_vector
= 0x00000100UL
;
3040 static void init_excp_750cl (CPUPPCState
*env
)
3042 #if !defined(CONFIG_USER_ONLY)
3043 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3044 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3045 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3046 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3047 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3048 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3049 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3050 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3051 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3052 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3053 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3054 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3055 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3056 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3057 /* Hardware reset vector */
3058 env
->hreset_vector
= 0x00000100UL
;
3062 static void init_excp_750cx (CPUPPCState
*env
)
3064 #if !defined(CONFIG_USER_ONLY)
3065 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3066 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3067 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3068 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3069 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3070 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3071 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3072 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3073 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3074 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3075 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3076 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3077 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3078 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3079 /* Hardware reset vector */
3080 env
->hreset_vector
= 0x00000100UL
;
3084 /* XXX: Check if this is correct */
3085 static void init_excp_7x5 (CPUPPCState
*env
)
3087 #if !defined(CONFIG_USER_ONLY)
3088 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3089 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3090 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3091 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3092 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3093 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3094 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3095 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3096 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3097 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3098 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3099 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3100 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3101 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3102 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3103 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3104 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3105 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3106 /* Hardware reset vector */
3107 env
->hreset_vector
= 0x00000100UL
;
3111 static void init_excp_7400 (CPUPPCState
*env
)
3113 #if !defined(CONFIG_USER_ONLY)
3114 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3115 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3116 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3117 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3118 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3119 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3120 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3121 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3122 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3123 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3124 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3125 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3126 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3127 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3128 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3129 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3130 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3131 /* Hardware reset vector */
3132 env
->hreset_vector
= 0x00000100UL
;
3136 static void init_excp_7450 (CPUPPCState
*env
)
3138 #if !defined(CONFIG_USER_ONLY)
3139 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3140 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3141 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3142 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3143 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3144 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3145 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3146 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3147 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3148 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3149 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3150 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3151 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3152 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3153 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3154 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3155 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3156 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3157 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3158 /* Hardware reset vector */
3159 env
->hreset_vector
= 0x00000100UL
;
3163 #if defined (TARGET_PPC64)
3164 static void init_excp_970 (CPUPPCState
*env
)
3166 #if !defined(CONFIG_USER_ONLY)
3167 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3168 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3169 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3170 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3171 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3172 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3173 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3174 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3175 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3176 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3177 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3178 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3179 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3180 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3181 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3182 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3183 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3184 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
3185 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
3186 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
3187 /* Hardware reset vector */
3188 env
->hreset_vector
= 0x0000000000000100ULL
;
3192 static void init_excp_POWER7 (CPUPPCState
*env
)
3194 #if !defined(CONFIG_USER_ONLY)
3195 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3196 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3197 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3198 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3199 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3200 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3201 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3202 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3203 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3204 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3205 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3206 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3207 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3208 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3209 env
->excp_vectors
[POWERPC_EXCP_HDSI
] = 0x00000E00;
3210 env
->excp_vectors
[POWERPC_EXCP_HISI
] = 0x00000E20;
3211 env
->excp_vectors
[POWERPC_EXCP_HV_EMU
] = 0x00000E40;
3212 env
->excp_vectors
[POWERPC_EXCP_HV_MAINT
] = 0x00000E60;
3213 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3214 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3215 env
->excp_vectors
[POWERPC_EXCP_VSXU
] = 0x00000F40;
3216 /* Hardware reset vector */
3217 env
->hreset_vector
= 0x0000000000000100ULL
;
3221 static void init_excp_POWER8(CPUPPCState
*env
)
3223 init_excp_POWER7(env
);
3225 #if !defined(CONFIG_USER_ONLY)
3226 env
->excp_vectors
[POWERPC_EXCP_SDOOR
] = 0x00000A00;
3227 env
->excp_vectors
[POWERPC_EXCP_FU
] = 0x00000F60;
3228 env
->excp_vectors
[POWERPC_EXCP_HV_FU
] = 0x00000F80;
3229 env
->excp_vectors
[POWERPC_EXCP_SDOOR_HV
] = 0x00000E80;
3235 /*****************************************************************************/
3236 /* Power management enable checks */
3237 static int check_pow_none (CPUPPCState
*env
)
3242 static int check_pow_nocheck (CPUPPCState
*env
)
3247 static int check_pow_hid0 (CPUPPCState
*env
)
3249 if (env
->spr
[SPR_HID0
] & 0x00E00000)
3255 static int check_pow_hid0_74xx (CPUPPCState
*env
)
3257 if (env
->spr
[SPR_HID0
] & 0x00600000)
3263 static bool ppc_cpu_interrupts_big_endian_always(PowerPCCPU
*cpu
)
3269 static bool ppc_cpu_interrupts_big_endian_lpcr(PowerPCCPU
*cpu
)
3271 return !(cpu
->env
.spr
[SPR_LPCR
] & LPCR_ILE
);
3275 /*****************************************************************************/
3276 /* PowerPC implementations definitions */
3278 #define POWERPC_FAMILY(_name) \
3280 glue(glue(ppc_, _name), _cpu_family_class_init)(ObjectClass *, void *); \
3282 static const TypeInfo \
3283 glue(glue(ppc_, _name), _cpu_family_type_info) = { \
3284 .name = stringify(_name) "-family-" TYPE_POWERPC_CPU, \
3285 .parent = TYPE_POWERPC_CPU, \
3287 .class_init = glue(glue(ppc_, _name), _cpu_family_class_init), \
3290 static void glue(glue(ppc_, _name), _cpu_family_register_types)(void) \
3292 type_register_static( \
3293 &glue(glue(ppc_, _name), _cpu_family_type_info)); \
3296 type_init(glue(glue(ppc_, _name), _cpu_family_register_types)) \
3298 static void glue(glue(ppc_, _name), _cpu_family_class_init)
3300 static void init_proc_401 (CPUPPCState
*env
)
3303 gen_spr_401_403(env
);
3305 init_excp_4xx_real(env
);
3306 env
->dcache_line_size
= 32;
3307 env
->icache_line_size
= 32;
3308 /* Allocate hardware IRQ controller */
3309 ppc40x_irq_init(ppc_env_get_cpu(env
));
3311 SET_FIT_PERIOD(12, 16, 20, 24);
3312 SET_WDT_PERIOD(16, 20, 24, 28);
3315 POWERPC_FAMILY(401)(ObjectClass
*oc
, void *data
)
3317 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3318 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3320 dc
->desc
= "PowerPC 401";
3321 pcc
->init_proc
= init_proc_401
;
3322 pcc
->check_pow
= check_pow_nocheck
;
3323 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3324 PPC_WRTEE
| PPC_DCR
|
3325 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3327 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3328 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3329 pcc
->msr_mask
= (1ull << MSR_KEY
) |
3338 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3339 pcc
->excp_model
= POWERPC_EXCP_40x
;
3340 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3341 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3342 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3343 POWERPC_FLAG_BUS_CLK
;
3346 static void init_proc_401x2 (CPUPPCState
*env
)
3349 gen_spr_401_403(env
);
3351 gen_spr_compress(env
);
3352 /* Memory management */
3353 #if !defined(CONFIG_USER_ONLY)
3357 env
->tlb_type
= TLB_EMB
;
3359 init_excp_4xx_softmmu(env
);
3360 env
->dcache_line_size
= 32;
3361 env
->icache_line_size
= 32;
3362 /* Allocate hardware IRQ controller */
3363 ppc40x_irq_init(ppc_env_get_cpu(env
));
3365 SET_FIT_PERIOD(12, 16, 20, 24);
3366 SET_WDT_PERIOD(16, 20, 24, 28);
3369 POWERPC_FAMILY(401x2
)(ObjectClass
*oc
, void *data
)
3371 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3372 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3374 dc
->desc
= "PowerPC 401x2";
3375 pcc
->init_proc
= init_proc_401x2
;
3376 pcc
->check_pow
= check_pow_nocheck
;
3377 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3378 PPC_DCR
| PPC_WRTEE
|
3379 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3380 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3381 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3382 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3383 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3384 pcc
->msr_mask
= (1ull << 20) |
3396 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3397 pcc
->excp_model
= POWERPC_EXCP_40x
;
3398 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3399 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3400 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3401 POWERPC_FLAG_BUS_CLK
;
3404 static void init_proc_401x3 (CPUPPCState
*env
)
3407 gen_spr_401_403(env
);
3410 gen_spr_compress(env
);
3411 init_excp_4xx_softmmu(env
);
3412 env
->dcache_line_size
= 32;
3413 env
->icache_line_size
= 32;
3414 /* Allocate hardware IRQ controller */
3415 ppc40x_irq_init(ppc_env_get_cpu(env
));
3417 SET_FIT_PERIOD(12, 16, 20, 24);
3418 SET_WDT_PERIOD(16, 20, 24, 28);
3421 POWERPC_FAMILY(401x3
)(ObjectClass
*oc
, void *data
)
3423 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3424 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3426 dc
->desc
= "PowerPC 401x3";
3427 pcc
->init_proc
= init_proc_401x3
;
3428 pcc
->check_pow
= check_pow_nocheck
;
3429 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3430 PPC_DCR
| PPC_WRTEE
|
3431 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3432 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3433 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3434 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3435 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3436 pcc
->msr_mask
= (1ull << 20) |
3449 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3450 pcc
->excp_model
= POWERPC_EXCP_40x
;
3451 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3452 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3453 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3454 POWERPC_FLAG_BUS_CLK
;
3457 static void init_proc_IOP480 (CPUPPCState
*env
)
3460 gen_spr_401_403(env
);
3462 gen_spr_compress(env
);
3463 /* Memory management */
3464 #if !defined(CONFIG_USER_ONLY)
3468 env
->tlb_type
= TLB_EMB
;
3470 init_excp_4xx_softmmu(env
);
3471 env
->dcache_line_size
= 32;
3472 env
->icache_line_size
= 32;
3473 /* Allocate hardware IRQ controller */
3474 ppc40x_irq_init(ppc_env_get_cpu(env
));
3476 SET_FIT_PERIOD(8, 12, 16, 20);
3477 SET_WDT_PERIOD(16, 20, 24, 28);
3480 POWERPC_FAMILY(IOP480
)(ObjectClass
*oc
, void *data
)
3482 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3483 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3485 dc
->desc
= "IOP480";
3486 pcc
->init_proc
= init_proc_IOP480
;
3487 pcc
->check_pow
= check_pow_nocheck
;
3488 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3489 PPC_DCR
| PPC_WRTEE
|
3490 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3491 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3492 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3493 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3494 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3495 pcc
->msr_mask
= (1ull << 20) |
3507 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3508 pcc
->excp_model
= POWERPC_EXCP_40x
;
3509 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3510 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3511 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3512 POWERPC_FLAG_BUS_CLK
;
3515 static void init_proc_403 (CPUPPCState
*env
)
3518 gen_spr_401_403(env
);
3520 gen_spr_403_real(env
);
3521 init_excp_4xx_real(env
);
3522 env
->dcache_line_size
= 32;
3523 env
->icache_line_size
= 32;
3524 /* Allocate hardware IRQ controller */
3525 ppc40x_irq_init(ppc_env_get_cpu(env
));
3527 SET_FIT_PERIOD(8, 12, 16, 20);
3528 SET_WDT_PERIOD(16, 20, 24, 28);
3531 POWERPC_FAMILY(403)(ObjectClass
*oc
, void *data
)
3533 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3534 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3536 dc
->desc
= "PowerPC 403";
3537 pcc
->init_proc
= init_proc_403
;
3538 pcc
->check_pow
= check_pow_nocheck
;
3539 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3540 PPC_DCR
| PPC_WRTEE
|
3541 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3543 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3544 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3545 pcc
->msr_mask
= (1ull << MSR_POW
) |
3554 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3555 pcc
->excp_model
= POWERPC_EXCP_40x
;
3556 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3557 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3558 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3559 POWERPC_FLAG_BUS_CLK
;
3562 static void init_proc_403GCX (CPUPPCState
*env
)
3565 gen_spr_401_403(env
);
3567 gen_spr_403_real(env
);
3568 gen_spr_403_mmu(env
);
3569 /* Bus access control */
3570 /* not emulated, as QEMU never does speculative access */
3571 spr_register(env
, SPR_40x_SGR
, "SGR",
3572 SPR_NOACCESS
, SPR_NOACCESS
,
3573 &spr_read_generic
, &spr_write_generic
,
3575 /* not emulated, as QEMU do not emulate caches */
3576 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3577 SPR_NOACCESS
, SPR_NOACCESS
,
3578 &spr_read_generic
, &spr_write_generic
,
3580 /* Memory management */
3581 #if !defined(CONFIG_USER_ONLY)
3585 env
->tlb_type
= TLB_EMB
;
3587 init_excp_4xx_softmmu(env
);
3588 env
->dcache_line_size
= 32;
3589 env
->icache_line_size
= 32;
3590 /* Allocate hardware IRQ controller */
3591 ppc40x_irq_init(ppc_env_get_cpu(env
));
3593 SET_FIT_PERIOD(8, 12, 16, 20);
3594 SET_WDT_PERIOD(16, 20, 24, 28);
3597 POWERPC_FAMILY(403GCX
)(ObjectClass
*oc
, void *data
)
3599 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3600 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3602 dc
->desc
= "PowerPC 403 GCX";
3603 pcc
->init_proc
= init_proc_403GCX
;
3604 pcc
->check_pow
= check_pow_nocheck
;
3605 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3606 PPC_DCR
| PPC_WRTEE
|
3607 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3609 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3610 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3611 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3612 pcc
->msr_mask
= (1ull << MSR_POW
) |
3621 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3622 pcc
->excp_model
= POWERPC_EXCP_40x
;
3623 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3624 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3625 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3626 POWERPC_FLAG_BUS_CLK
;
3629 static void init_proc_405 (CPUPPCState
*env
)
3635 /* Bus access control */
3636 /* not emulated, as QEMU never does speculative access */
3637 spr_register(env
, SPR_40x_SGR
, "SGR",
3638 SPR_NOACCESS
, SPR_NOACCESS
,
3639 &spr_read_generic
, &spr_write_generic
,
3641 /* not emulated, as QEMU do not emulate caches */
3642 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3643 SPR_NOACCESS
, SPR_NOACCESS
,
3644 &spr_read_generic
, &spr_write_generic
,
3646 /* Memory management */
3647 #if !defined(CONFIG_USER_ONLY)
3651 env
->tlb_type
= TLB_EMB
;
3653 init_excp_4xx_softmmu(env
);
3654 env
->dcache_line_size
= 32;
3655 env
->icache_line_size
= 32;
3656 /* Allocate hardware IRQ controller */
3657 ppc40x_irq_init(ppc_env_get_cpu(env
));
3659 SET_FIT_PERIOD(8, 12, 16, 20);
3660 SET_WDT_PERIOD(16, 20, 24, 28);
3663 POWERPC_FAMILY(405)(ObjectClass
*oc
, void *data
)
3665 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3666 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3668 dc
->desc
= "PowerPC 405";
3669 pcc
->init_proc
= init_proc_405
;
3670 pcc
->check_pow
= check_pow_nocheck
;
3671 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3672 PPC_DCR
| PPC_WRTEE
|
3673 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3674 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3675 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3676 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3677 PPC_4xx_COMMON
| PPC_405_MAC
| PPC_40x_EXCP
;
3678 pcc
->msr_mask
= (1ull << MSR_POW
) |
3687 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx
;
3688 pcc
->excp_model
= POWERPC_EXCP_40x
;
3689 pcc
->bus_model
= PPC_FLAGS_INPUT_405
;
3690 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3691 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3692 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3695 static void init_proc_440EP (CPUPPCState
*env
)
3699 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3701 gen_spr_usprgh(env
);
3702 /* Processor identification */
3703 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3704 SPR_NOACCESS
, SPR_NOACCESS
,
3705 &spr_read_generic
, &spr_write_pir
,
3707 /* XXX : not implemented */
3708 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3709 SPR_NOACCESS
, SPR_NOACCESS
,
3710 &spr_read_generic
, &spr_write_generic
,
3712 /* XXX : not implemented */
3713 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3714 SPR_NOACCESS
, SPR_NOACCESS
,
3715 &spr_read_generic
, &spr_write_generic
,
3717 /* XXX : not implemented */
3718 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3719 SPR_NOACCESS
, SPR_NOACCESS
,
3720 &spr_read_generic
, &spr_write_generic
,
3722 /* XXX : not implemented */
3723 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3724 SPR_NOACCESS
, SPR_NOACCESS
,
3725 &spr_read_generic
, &spr_write_generic
,
3727 /* XXX : not implemented */
3728 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3729 SPR_NOACCESS
, SPR_NOACCESS
,
3730 &spr_read_generic
, &spr_write_generic
,
3732 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3733 SPR_NOACCESS
, SPR_NOACCESS
,
3734 &spr_read_generic
, &spr_write_generic
,
3736 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3737 SPR_NOACCESS
, SPR_NOACCESS
,
3738 &spr_read_generic
, &spr_write_generic
,
3740 /* XXX : not implemented */
3741 spr_register(env
, SPR_440_CCR1
, "CCR1",
3742 SPR_NOACCESS
, SPR_NOACCESS
,
3743 &spr_read_generic
, &spr_write_generic
,
3745 /* Memory management */
3746 #if !defined(CONFIG_USER_ONLY)
3750 env
->tlb_type
= TLB_EMB
;
3752 init_excp_BookE(env
);
3753 env
->dcache_line_size
= 32;
3754 env
->icache_line_size
= 32;
3755 ppc40x_irq_init(ppc_env_get_cpu(env
));
3757 SET_FIT_PERIOD(12, 16, 20, 24);
3758 SET_WDT_PERIOD(20, 24, 28, 32);
3761 POWERPC_FAMILY(440EP
)(ObjectClass
*oc
, void *data
)
3763 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3764 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3766 dc
->desc
= "PowerPC 440 EP";
3767 pcc
->init_proc
= init_proc_440EP
;
3768 pcc
->check_pow
= check_pow_nocheck
;
3769 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3770 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
3771 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
3773 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
3774 PPC_CACHE
| PPC_CACHE_ICBI
|
3775 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3776 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3777 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3779 pcc
->msr_mask
= (1ull << MSR_POW
) |
3791 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3792 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3793 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3794 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3795 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3796 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3799 static void init_proc_440GP (CPUPPCState
*env
)
3803 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3805 gen_spr_usprgh(env
);
3806 /* Processor identification */
3807 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3808 SPR_NOACCESS
, SPR_NOACCESS
,
3809 &spr_read_generic
, &spr_write_pir
,
3811 /* XXX : not implemented */
3812 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3813 SPR_NOACCESS
, SPR_NOACCESS
,
3814 &spr_read_generic
, &spr_write_generic
,
3816 /* XXX : not implemented */
3817 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3818 SPR_NOACCESS
, SPR_NOACCESS
,
3819 &spr_read_generic
, &spr_write_generic
,
3821 /* XXX : not implemented */
3822 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3823 SPR_NOACCESS
, SPR_NOACCESS
,
3824 &spr_read_generic
, &spr_write_generic
,
3826 /* XXX : not implemented */
3827 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3828 SPR_NOACCESS
, SPR_NOACCESS
,
3829 &spr_read_generic
, &spr_write_generic
,
3831 /* Memory management */
3832 #if !defined(CONFIG_USER_ONLY)
3836 env
->tlb_type
= TLB_EMB
;
3838 init_excp_BookE(env
);
3839 env
->dcache_line_size
= 32;
3840 env
->icache_line_size
= 32;
3841 /* XXX: TODO: allocate internal IRQ controller */
3843 SET_FIT_PERIOD(12, 16, 20, 24);
3844 SET_WDT_PERIOD(20, 24, 28, 32);
3847 POWERPC_FAMILY(440GP
)(ObjectClass
*oc
, void *data
)
3849 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3850 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3852 dc
->desc
= "PowerPC 440 GP";
3853 pcc
->init_proc
= init_proc_440GP
;
3854 pcc
->check_pow
= check_pow_nocheck
;
3855 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3856 PPC_DCR
| PPC_DCRX
| PPC_WRTEE
| PPC_MFAPIDI
|
3857 PPC_CACHE
| PPC_CACHE_ICBI
|
3858 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3859 PPC_MEM_TLBSYNC
| PPC_TLBIVA
| PPC_MFTB
|
3860 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3862 pcc
->msr_mask
= (1ull << MSR_POW
) |
3874 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3875 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3876 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3877 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3878 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3879 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3882 static void init_proc_440x4 (CPUPPCState
*env
)
3886 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3888 gen_spr_usprgh(env
);
3889 /* Processor identification */
3890 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3891 SPR_NOACCESS
, SPR_NOACCESS
,
3892 &spr_read_generic
, &spr_write_pir
,
3894 /* XXX : not implemented */
3895 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3896 SPR_NOACCESS
, SPR_NOACCESS
,
3897 &spr_read_generic
, &spr_write_generic
,
3899 /* XXX : not implemented */
3900 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3901 SPR_NOACCESS
, SPR_NOACCESS
,
3902 &spr_read_generic
, &spr_write_generic
,
3904 /* XXX : not implemented */
3905 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3906 SPR_NOACCESS
, SPR_NOACCESS
,
3907 &spr_read_generic
, &spr_write_generic
,
3909 /* XXX : not implemented */
3910 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3911 SPR_NOACCESS
, SPR_NOACCESS
,
3912 &spr_read_generic
, &spr_write_generic
,
3914 /* Memory management */
3915 #if !defined(CONFIG_USER_ONLY)
3919 env
->tlb_type
= TLB_EMB
;
3921 init_excp_BookE(env
);
3922 env
->dcache_line_size
= 32;
3923 env
->icache_line_size
= 32;
3924 /* XXX: TODO: allocate internal IRQ controller */
3926 SET_FIT_PERIOD(12, 16, 20, 24);
3927 SET_WDT_PERIOD(20, 24, 28, 32);
3930 POWERPC_FAMILY(440x4
)(ObjectClass
*oc
, void *data
)
3932 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3933 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3935 dc
->desc
= "PowerPC 440x4";
3936 pcc
->init_proc
= init_proc_440x4
;
3937 pcc
->check_pow
= check_pow_nocheck
;
3938 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3939 PPC_DCR
| PPC_WRTEE
|
3940 PPC_CACHE
| PPC_CACHE_ICBI
|
3941 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3942 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3943 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3945 pcc
->msr_mask
= (1ull << MSR_POW
) |
3957 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3958 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3959 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3960 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3961 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3962 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3965 static void init_proc_440x5 (CPUPPCState
*env
)
3969 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3971 gen_spr_usprgh(env
);
3972 /* Processor identification */
3973 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3974 SPR_NOACCESS
, SPR_NOACCESS
,
3975 &spr_read_generic
, &spr_write_pir
,
3977 /* XXX : not implemented */
3978 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3979 SPR_NOACCESS
, SPR_NOACCESS
,
3980 &spr_read_generic
, &spr_write_generic
,
3982 /* XXX : not implemented */
3983 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3984 SPR_NOACCESS
, SPR_NOACCESS
,
3985 &spr_read_generic
, &spr_write_generic
,
3987 /* XXX : not implemented */
3988 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3989 SPR_NOACCESS
, SPR_NOACCESS
,
3990 &spr_read_generic
, &spr_write_generic
,
3992 /* XXX : not implemented */
3993 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3994 SPR_NOACCESS
, SPR_NOACCESS
,
3995 &spr_read_generic
, &spr_write_generic
,
3997 /* XXX : not implemented */
3998 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3999 SPR_NOACCESS
, SPR_NOACCESS
,
4000 &spr_read_generic
, &spr_write_generic
,
4002 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4003 SPR_NOACCESS
, SPR_NOACCESS
,
4004 &spr_read_generic
, &spr_write_generic
,
4006 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4007 SPR_NOACCESS
, SPR_NOACCESS
,
4008 &spr_read_generic
, &spr_write_generic
,
4010 /* XXX : not implemented */
4011 spr_register(env
, SPR_440_CCR1
, "CCR1",
4012 SPR_NOACCESS
, SPR_NOACCESS
,
4013 &spr_read_generic
, &spr_write_generic
,
4015 /* Memory management */
4016 #if !defined(CONFIG_USER_ONLY)
4020 env
->tlb_type
= TLB_EMB
;
4022 init_excp_BookE(env
);
4023 env
->dcache_line_size
= 32;
4024 env
->icache_line_size
= 32;
4025 ppc40x_irq_init(ppc_env_get_cpu(env
));
4027 SET_FIT_PERIOD(12, 16, 20, 24);
4028 SET_WDT_PERIOD(20, 24, 28, 32);
4031 POWERPC_FAMILY(440x5
)(ObjectClass
*oc
, void *data
)
4033 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4034 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4036 dc
->desc
= "PowerPC 440x5";
4037 pcc
->init_proc
= init_proc_440x5
;
4038 pcc
->check_pow
= check_pow_nocheck
;
4039 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4040 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
4041 PPC_CACHE
| PPC_CACHE_ICBI
|
4042 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4043 PPC_MEM_TLBSYNC
| PPC_MFTB
|
4044 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4046 pcc
->msr_mask
= (1ull << MSR_POW
) |
4058 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4059 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4060 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4061 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4062 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4063 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4066 POWERPC_FAMILY(440x5wDFPU
)(ObjectClass
*oc
, void *data
)
4068 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4069 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4071 dc
->desc
= "PowerPC 440x5 with double precision FPU";
4072 pcc
->init_proc
= init_proc_440x5
;
4073 pcc
->check_pow
= check_pow_nocheck
;
4074 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4075 PPC_FLOAT
| PPC_FLOAT_FSQRT
|
4077 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
4078 PPC_CACHE
| PPC_CACHE_ICBI
|
4079 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4080 PPC_MEM_TLBSYNC
| PPC_MFTB
|
4081 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4083 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
4084 pcc
->msr_mask
= (1ull << MSR_POW
) |
4096 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4097 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4098 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4099 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4100 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4101 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4104 static void init_proc_460 (CPUPPCState
*env
)
4108 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4110 gen_spr_usprgh(env
);
4111 /* Processor identification */
4112 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4113 SPR_NOACCESS
, SPR_NOACCESS
,
4114 &spr_read_generic
, &spr_write_pir
,
4116 /* XXX : not implemented */
4117 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4118 SPR_NOACCESS
, SPR_NOACCESS
,
4119 &spr_read_generic
, &spr_write_generic
,
4121 /* XXX : not implemented */
4122 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4123 SPR_NOACCESS
, SPR_NOACCESS
,
4124 &spr_read_generic
, &spr_write_generic
,
4126 /* XXX : not implemented */
4127 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4128 SPR_NOACCESS
, SPR_NOACCESS
,
4129 &spr_read_generic
, &spr_write_generic
,
4131 /* XXX : not implemented */
4132 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4133 SPR_NOACCESS
, SPR_NOACCESS
,
4134 &spr_read_generic
, &spr_write_generic
,
4136 /* XXX : not implemented */
4137 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4138 SPR_NOACCESS
, SPR_NOACCESS
,
4139 &spr_read_generic
, &spr_write_generic
,
4141 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4142 SPR_NOACCESS
, SPR_NOACCESS
,
4143 &spr_read_generic
, &spr_write_generic
,
4145 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4146 SPR_NOACCESS
, SPR_NOACCESS
,
4147 &spr_read_generic
, &spr_write_generic
,
4149 /* XXX : not implemented */
4150 spr_register(env
, SPR_440_CCR1
, "CCR1",
4151 SPR_NOACCESS
, SPR_NOACCESS
,
4152 &spr_read_generic
, &spr_write_generic
,
4154 /* XXX : not implemented */
4155 spr_register(env
, SPR_DCRIPR
, "SPR_DCRIPR",
4156 &spr_read_generic
, &spr_write_generic
,
4157 &spr_read_generic
, &spr_write_generic
,
4159 /* Memory management */
4160 #if !defined(CONFIG_USER_ONLY)
4164 env
->tlb_type
= TLB_EMB
;
4166 init_excp_BookE(env
);
4167 env
->dcache_line_size
= 32;
4168 env
->icache_line_size
= 32;
4169 /* XXX: TODO: allocate internal IRQ controller */
4171 SET_FIT_PERIOD(12, 16, 20, 24);
4172 SET_WDT_PERIOD(20, 24, 28, 32);
4175 POWERPC_FAMILY(460)(ObjectClass
*oc
, void *data
)
4177 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4178 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4180 dc
->desc
= "PowerPC 460 (guessed)";
4181 pcc
->init_proc
= init_proc_460
;
4182 pcc
->check_pow
= check_pow_nocheck
;
4183 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4184 PPC_DCR
| PPC_DCRX
| PPC_DCRUX
|
4185 PPC_WRTEE
| PPC_MFAPIDI
| PPC_MFTB
|
4186 PPC_CACHE
| PPC_CACHE_ICBI
|
4187 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4188 PPC_MEM_TLBSYNC
| PPC_TLBIVA
|
4189 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4191 pcc
->msr_mask
= (1ull << MSR_POW
) |
4203 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4204 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4205 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4206 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4207 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4208 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4211 static void init_proc_460F (CPUPPCState
*env
)
4215 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4217 gen_spr_usprgh(env
);
4218 /* Processor identification */
4219 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4220 SPR_NOACCESS
, SPR_NOACCESS
,
4221 &spr_read_generic
, &spr_write_pir
,
4223 /* XXX : not implemented */
4224 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4225 SPR_NOACCESS
, SPR_NOACCESS
,
4226 &spr_read_generic
, &spr_write_generic
,
4228 /* XXX : not implemented */
4229 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4230 SPR_NOACCESS
, SPR_NOACCESS
,
4231 &spr_read_generic
, &spr_write_generic
,
4233 /* XXX : not implemented */
4234 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4235 SPR_NOACCESS
, SPR_NOACCESS
,
4236 &spr_read_generic
, &spr_write_generic
,
4238 /* XXX : not implemented */
4239 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4240 SPR_NOACCESS
, SPR_NOACCESS
,
4241 &spr_read_generic
, &spr_write_generic
,
4243 /* XXX : not implemented */
4244 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4245 SPR_NOACCESS
, SPR_NOACCESS
,
4246 &spr_read_generic
, &spr_write_generic
,
4248 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4249 SPR_NOACCESS
, SPR_NOACCESS
,
4250 &spr_read_generic
, &spr_write_generic
,
4252 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4253 SPR_NOACCESS
, SPR_NOACCESS
,
4254 &spr_read_generic
, &spr_write_generic
,
4256 /* XXX : not implemented */
4257 spr_register(env
, SPR_440_CCR1
, "CCR1",
4258 SPR_NOACCESS
, SPR_NOACCESS
,
4259 &spr_read_generic
, &spr_write_generic
,
4261 /* XXX : not implemented */
4262 spr_register(env
, SPR_DCRIPR
, "SPR_DCRIPR",
4263 &spr_read_generic
, &spr_write_generic
,
4264 &spr_read_generic
, &spr_write_generic
,
4266 /* Memory management */
4267 #if !defined(CONFIG_USER_ONLY)
4271 env
->tlb_type
= TLB_EMB
;
4273 init_excp_BookE(env
);
4274 env
->dcache_line_size
= 32;
4275 env
->icache_line_size
= 32;
4276 /* XXX: TODO: allocate internal IRQ controller */
4278 SET_FIT_PERIOD(12, 16, 20, 24);
4279 SET_WDT_PERIOD(20, 24, 28, 32);
4282 POWERPC_FAMILY(460F
)(ObjectClass
*oc
, void *data
)
4284 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4285 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4287 dc
->desc
= "PowerPC 460F (guessed)";
4288 pcc
->init_proc
= init_proc_460F
;
4289 pcc
->check_pow
= check_pow_nocheck
;
4290 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4291 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
4292 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
4293 PPC_FLOAT_STFIWX
| PPC_MFTB
|
4294 PPC_DCR
| PPC_DCRX
| PPC_DCRUX
|
4295 PPC_WRTEE
| PPC_MFAPIDI
|
4296 PPC_CACHE
| PPC_CACHE_ICBI
|
4297 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4298 PPC_MEM_TLBSYNC
| PPC_TLBIVA
|
4299 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4301 pcc
->msr_mask
= (1ull << MSR_POW
) |
4313 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4314 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4315 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4316 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4317 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4318 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4321 static void init_proc_MPC5xx (CPUPPCState
*env
)
4325 gen_spr_5xx_8xx(env
);
4327 init_excp_MPC5xx(env
);
4328 env
->dcache_line_size
= 32;
4329 env
->icache_line_size
= 32;
4330 /* XXX: TODO: allocate internal IRQ controller */
4333 POWERPC_FAMILY(MPC5xx
)(ObjectClass
*oc
, void *data
)
4335 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4336 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4338 dc
->desc
= "Freescale 5xx cores (aka RCPU)";
4339 pcc
->init_proc
= init_proc_MPC5xx
;
4340 pcc
->check_pow
= check_pow_none
;
4341 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4342 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4343 PPC_CACHE_ICBI
| PPC_FLOAT
| PPC_FLOAT_STFIWX
|
4345 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4357 pcc
->mmu_model
= POWERPC_MMU_REAL
;
4358 pcc
->excp_model
= POWERPC_EXCP_603
;
4359 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4360 pcc
->bfd_mach
= bfd_mach_ppc_505
;
4361 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4362 POWERPC_FLAG_BUS_CLK
;
4365 static void init_proc_MPC8xx (CPUPPCState
*env
)
4369 gen_spr_5xx_8xx(env
);
4371 init_excp_MPC8xx(env
);
4372 env
->dcache_line_size
= 32;
4373 env
->icache_line_size
= 32;
4374 /* XXX: TODO: allocate internal IRQ controller */
4377 POWERPC_FAMILY(MPC8xx
)(ObjectClass
*oc
, void *data
)
4379 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4380 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4382 dc
->desc
= "Freescale 8xx cores (aka PowerQUICC)";
4383 pcc
->init_proc
= init_proc_MPC8xx
;
4384 pcc
->check_pow
= check_pow_none
;
4385 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4386 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4387 PPC_CACHE_ICBI
| PPC_MFTB
;
4388 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4400 pcc
->mmu_model
= POWERPC_MMU_MPC8xx
;
4401 pcc
->excp_model
= POWERPC_EXCP_603
;
4402 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4403 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4404 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4405 POWERPC_FLAG_BUS_CLK
;
4408 /* Freescale 82xx cores (aka PowerQUICC-II) */
4410 static void init_proc_G2 (CPUPPCState
*env
)
4412 gen_spr_ne_601(env
);
4413 gen_spr_G2_755(env
);
4417 /* External access control */
4418 /* XXX : not implemented */
4419 spr_register(env
, SPR_EAR
, "EAR",
4420 SPR_NOACCESS
, SPR_NOACCESS
,
4421 &spr_read_generic
, &spr_write_generic
,
4423 /* Hardware implementation register */
4424 /* XXX : not implemented */
4425 spr_register(env
, SPR_HID0
, "HID0",
4426 SPR_NOACCESS
, SPR_NOACCESS
,
4427 &spr_read_generic
, &spr_write_generic
,
4429 /* XXX : not implemented */
4430 spr_register(env
, SPR_HID1
, "HID1",
4431 SPR_NOACCESS
, SPR_NOACCESS
,
4432 &spr_read_generic
, &spr_write_generic
,
4434 /* XXX : not implemented */
4435 spr_register(env
, SPR_HID2
, "HID2",
4436 SPR_NOACCESS
, SPR_NOACCESS
,
4437 &spr_read_generic
, &spr_write_generic
,
4439 /* Memory management */
4442 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4444 env
->dcache_line_size
= 32;
4445 env
->icache_line_size
= 32;
4446 /* Allocate hardware IRQ controller */
4447 ppc6xx_irq_init(ppc_env_get_cpu(env
));
4450 POWERPC_FAMILY(G2
)(ObjectClass
*oc
, void *data
)
4452 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4453 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4455 dc
->desc
= "PowerPC G2";
4456 pcc
->init_proc
= init_proc_G2
;
4457 pcc
->check_pow
= check_pow_hid0
;
4458 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4459 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4461 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4462 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4463 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4464 PPC_SEGMENT
| PPC_EXTERN
;
4465 pcc
->msr_mask
= (1ull << MSR_POW
) |
4466 (1ull << MSR_TGPR
) |
4480 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4481 pcc
->excp_model
= POWERPC_EXCP_G2
;
4482 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4483 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4484 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4485 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4488 static void init_proc_G2LE (CPUPPCState
*env
)
4490 gen_spr_ne_601(env
);
4491 gen_spr_G2_755(env
);
4495 /* External access control */
4496 /* XXX : not implemented */
4497 spr_register(env
, SPR_EAR
, "EAR",
4498 SPR_NOACCESS
, SPR_NOACCESS
,
4499 &spr_read_generic
, &spr_write_generic
,
4501 /* Hardware implementation register */
4502 /* XXX : not implemented */
4503 spr_register(env
, SPR_HID0
, "HID0",
4504 SPR_NOACCESS
, SPR_NOACCESS
,
4505 &spr_read_generic
, &spr_write_generic
,
4507 /* XXX : not implemented */
4508 spr_register(env
, SPR_HID1
, "HID1",
4509 SPR_NOACCESS
, SPR_NOACCESS
,
4510 &spr_read_generic
, &spr_write_generic
,
4512 /* XXX : not implemented */
4513 spr_register(env
, SPR_HID2
, "HID2",
4514 SPR_NOACCESS
, SPR_NOACCESS
,
4515 &spr_read_generic
, &spr_write_generic
,
4518 /* Memory management */
4521 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4523 env
->dcache_line_size
= 32;
4524 env
->icache_line_size
= 32;
4525 /* Allocate hardware IRQ controller */
4526 ppc6xx_irq_init(ppc_env_get_cpu(env
));
4529 POWERPC_FAMILY(G2LE
)(ObjectClass
*oc
, void *data
)
4531 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4532 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4534 dc
->desc
= "PowerPC G2LE";
4535 pcc
->init_proc
= init_proc_G2LE
;
4536 pcc
->check_pow
= check_pow_hid0
;
4537 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4538 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4540 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4541 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4542 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4543 PPC_SEGMENT
| PPC_EXTERN
;
4544 pcc
->msr_mask
= (1ull << MSR_POW
) |
4545 (1ull << MSR_TGPR
) |
4561 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4562 pcc
->excp_model
= POWERPC_EXCP_G2
;
4563 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4564 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4565 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4566 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4569 static void init_proc_e200 (CPUPPCState
*env
)
4573 gen_spr_BookE(env
, 0x000000070000FFFFULL
);
4574 /* XXX : not implemented */
4575 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4576 &spr_read_spefscr
, &spr_write_spefscr
,
4577 &spr_read_spefscr
, &spr_write_spefscr
,
4579 /* Memory management */
4580 gen_spr_BookE206(env
, 0x0000005D, NULL
);
4581 /* XXX : not implemented */
4582 spr_register(env
, SPR_HID0
, "HID0",
4583 SPR_NOACCESS
, SPR_NOACCESS
,
4584 &spr_read_generic
, &spr_write_generic
,
4586 /* XXX : not implemented */
4587 spr_register(env
, SPR_HID1
, "HID1",
4588 SPR_NOACCESS
, SPR_NOACCESS
,
4589 &spr_read_generic
, &spr_write_generic
,
4591 /* XXX : not implemented */
4592 spr_register(env
, SPR_Exxx_ALTCTXCR
, "ALTCTXCR",
4593 SPR_NOACCESS
, SPR_NOACCESS
,
4594 &spr_read_generic
, &spr_write_generic
,
4596 /* XXX : not implemented */
4597 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4598 SPR_NOACCESS
, SPR_NOACCESS
,
4599 &spr_read_generic
, &spr_write_generic
,
4601 /* XXX : not implemented */
4602 spr_register(env
, SPR_Exxx_CTXCR
, "CTXCR",
4603 SPR_NOACCESS
, SPR_NOACCESS
,
4604 &spr_read_generic
, &spr_write_generic
,
4606 /* XXX : not implemented */
4607 spr_register(env
, SPR_Exxx_DBCNT
, "DBCNT",
4608 SPR_NOACCESS
, SPR_NOACCESS
,
4609 &spr_read_generic
, &spr_write_generic
,
4611 /* XXX : not implemented */
4612 spr_register(env
, SPR_Exxx_DBCR3
, "DBCR3",
4613 SPR_NOACCESS
, SPR_NOACCESS
,
4614 &spr_read_generic
, &spr_write_generic
,
4616 /* XXX : not implemented */
4617 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4618 &spr_read_generic
, SPR_NOACCESS
,
4619 &spr_read_generic
, SPR_NOACCESS
,
4621 /* XXX : not implemented */
4622 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4623 SPR_NOACCESS
, SPR_NOACCESS
,
4624 &spr_read_generic
, &spr_write_generic
,
4626 /* XXX : not implemented */
4627 spr_register(env
, SPR_Exxx_L1FINV0
, "L1FINV0",
4628 SPR_NOACCESS
, SPR_NOACCESS
,
4629 &spr_read_generic
, &spr_write_generic
,
4631 /* XXX : not implemented */
4632 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
4633 SPR_NOACCESS
, SPR_NOACCESS
,
4634 &spr_read_generic
, &spr_write_generic
,
4636 /* XXX : not implemented */
4637 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
4638 SPR_NOACCESS
, SPR_NOACCESS
,
4639 &spr_read_generic
, &spr_write_generic
,
4641 /* XXX : not implemented */
4642 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4643 SPR_NOACCESS
, SPR_NOACCESS
,
4644 &spr_read_generic
, &spr_write_generic
,
4646 /* XXX : not implemented */
4647 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4648 SPR_NOACCESS
, SPR_NOACCESS
,
4649 &spr_read_generic
, &spr_write_generic
,
4651 /* XXX : not implemented */
4652 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4653 SPR_NOACCESS
, SPR_NOACCESS
,
4654 &spr_read_generic
, &spr_write_generic
,
4655 0x00000000); /* TOFIX */
4656 spr_register(env
, SPR_BOOKE_DSRR0
, "DSRR0",
4657 SPR_NOACCESS
, SPR_NOACCESS
,
4658 &spr_read_generic
, &spr_write_generic
,
4660 spr_register(env
, SPR_BOOKE_DSRR1
, "DSRR1",
4661 SPR_NOACCESS
, SPR_NOACCESS
,
4662 &spr_read_generic
, &spr_write_generic
,
4664 #if !defined(CONFIG_USER_ONLY)
4668 env
->tlb_type
= TLB_EMB
;
4670 init_excp_e200(env
, 0xFFFF0000UL
);
4671 env
->dcache_line_size
= 32;
4672 env
->icache_line_size
= 32;
4673 /* XXX: TODO: allocate internal IRQ controller */
4676 POWERPC_FAMILY(e200
)(ObjectClass
*oc
, void *data
)
4678 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4679 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4681 dc
->desc
= "e200 core";
4682 pcc
->init_proc
= init_proc_e200
;
4683 pcc
->check_pow
= check_pow_hid0
;
4684 /* XXX: unimplemented instructions:
4691 * all SPE multiply-accumulate instructions
4693 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4694 PPC_SPE
| PPC_SPE_SINGLE
|
4695 PPC_WRTEE
| PPC_RFDI
|
4696 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4697 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4698 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
|
4700 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4714 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4715 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4716 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4717 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4718 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4719 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4720 POWERPC_FLAG_BUS_CLK
;
4723 static void init_proc_e300 (CPUPPCState
*env
)
4725 gen_spr_ne_601(env
);
4729 /* hardware implementation registers */
4730 /* XXX : not implemented */
4731 spr_register(env
, SPR_HID0
, "HID0",
4732 SPR_NOACCESS
, SPR_NOACCESS
,
4733 &spr_read_generic
, &spr_write_generic
,
4735 /* XXX : not implemented */
4736 spr_register(env
, SPR_HID1
, "HID1",
4737 SPR_NOACCESS
, SPR_NOACCESS
,
4738 &spr_read_generic
, &spr_write_generic
,
4740 /* XXX : not implemented */
4741 spr_register(env
, SPR_HID2
, "HID2",
4742 SPR_NOACCESS
, SPR_NOACCESS
,
4743 &spr_read_generic
, &spr_write_generic
,
4746 /* XXX : not implemented */
4747 spr_register(env
, SPR_DABR
, "DABR",
4748 SPR_NOACCESS
, SPR_NOACCESS
,
4749 &spr_read_generic
, &spr_write_generic
,
4751 /* XXX : not implemented */
4752 spr_register(env
, SPR_DABR2
, "DABR2",
4753 SPR_NOACCESS
, SPR_NOACCESS
,
4754 &spr_read_generic
, &spr_write_generic
,
4756 /* XXX : not implemented */
4757 spr_register(env
, SPR_IABR2
, "IABR2",
4758 SPR_NOACCESS
, SPR_NOACCESS
,
4759 &spr_read_generic
, &spr_write_generic
,
4761 /* XXX : not implemented */
4762 spr_register(env
, SPR_IBCR
, "IBCR",
4763 SPR_NOACCESS
, SPR_NOACCESS
,
4764 &spr_read_generic
, &spr_write_generic
,
4766 /* XXX : not implemented */
4767 spr_register(env
, SPR_DBCR
, "DBCR",
4768 SPR_NOACCESS
, SPR_NOACCESS
,
4769 &spr_read_generic
, &spr_write_generic
,
4771 /* Memory management */
4774 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4776 env
->dcache_line_size
= 32;
4777 env
->icache_line_size
= 32;
4778 /* Allocate hardware IRQ controller */
4779 ppc6xx_irq_init(ppc_env_get_cpu(env
));
4782 POWERPC_FAMILY(e300
)(ObjectClass
*oc
, void *data
)
4784 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4785 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4787 dc
->desc
= "e300 core";
4788 pcc
->init_proc
= init_proc_e300
;
4789 pcc
->check_pow
= check_pow_hid0
;
4790 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4791 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4793 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4794 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4795 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4796 PPC_SEGMENT
| PPC_EXTERN
;
4797 pcc
->msr_mask
= (1ull << MSR_POW
) |
4798 (1ull << MSR_TGPR
) |
4814 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4815 pcc
->excp_model
= POWERPC_EXCP_603
;
4816 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4817 pcc
->bfd_mach
= bfd_mach_ppc_603
;
4818 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4819 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4822 #if !defined(CONFIG_USER_ONLY)
4823 static void spr_write_mas73(DisasContext
*ctx
, int sprn
, int gprn
)
4825 TCGv val
= tcg_temp_new();
4826 tcg_gen_ext32u_tl(val
, cpu_gpr
[gprn
]);
4827 gen_store_spr(SPR_BOOKE_MAS3
, val
);
4828 tcg_gen_shri_tl(val
, cpu_gpr
[gprn
], 32);
4829 gen_store_spr(SPR_BOOKE_MAS7
, val
);
4833 static void spr_read_mas73(DisasContext
*ctx
, int gprn
, int sprn
)
4835 TCGv mas7
= tcg_temp_new();
4836 TCGv mas3
= tcg_temp_new();
4837 gen_load_spr(mas7
, SPR_BOOKE_MAS7
);
4838 tcg_gen_shli_tl(mas7
, mas7
, 32);
4839 gen_load_spr(mas3
, SPR_BOOKE_MAS3
);
4840 tcg_gen_or_tl(cpu_gpr
[gprn
], mas3
, mas7
);
4841 tcg_temp_free(mas3
);
4842 tcg_temp_free(mas7
);
4847 enum fsl_e500_version
{
4854 static void init_proc_e500 (CPUPPCState
*env
, int version
)
4856 PowerPCCPU
*cpu
= ppc_env_get_cpu(env
);
4857 uint32_t tlbncfg
[2];
4859 uint64_t ivpr_mask
= 0xFFFF0000ULL
;
4860 uint32_t l1cfg0
= 0x3800 /* 8 ways */
4861 | 0x0020; /* 32 kb */
4862 uint32_t l1cfg1
= 0x3800 /* 8 ways */
4863 | 0x0020; /* 32 kb */
4864 #if !defined(CONFIG_USER_ONLY)
4871 * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't
4872 * complain when accessing them.
4873 * gen_spr_BookE(env, 0x0000000F0000FD7FULL);
4879 ivor_mask
= 0x0000000F0000FFFFULL
;
4883 ivor_mask
= 0x000003FE0000FFFFULL
;
4886 gen_spr_BookE(env
, ivor_mask
);
4887 /* Processor identification */
4888 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4889 SPR_NOACCESS
, SPR_NOACCESS
,
4890 &spr_read_generic
, &spr_write_pir
,
4892 /* XXX : not implemented */
4893 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4894 &spr_read_spefscr
, &spr_write_spefscr
,
4895 &spr_read_spefscr
, &spr_write_spefscr
,
4897 #if !defined(CONFIG_USER_ONLY)
4898 /* Memory management */
4904 tlbncfg
[0] = gen_tlbncfg(2, 1, 1, 0, 256);
4905 tlbncfg
[1] = gen_tlbncfg(16, 1, 9, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4908 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4909 tlbncfg
[1] = gen_tlbncfg(16, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4913 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4914 tlbncfg
[1] = gen_tlbncfg(64, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 64);
4917 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4924 env
->dcache_line_size
= 32;
4925 env
->icache_line_size
= 32;
4929 env
->dcache_line_size
= 64;
4930 env
->icache_line_size
= 64;
4931 l1cfg0
|= 0x1000000; /* 64 byte cache block size */
4932 l1cfg1
|= 0x1000000; /* 64 byte cache block size */
4935 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4937 gen_spr_BookE206(env
, 0x000000DF, tlbncfg
);
4938 /* XXX : not implemented */
4939 spr_register(env
, SPR_HID0
, "HID0",
4940 SPR_NOACCESS
, SPR_NOACCESS
,
4941 &spr_read_generic
, &spr_write_generic
,
4943 /* XXX : not implemented */
4944 spr_register(env
, SPR_HID1
, "HID1",
4945 SPR_NOACCESS
, SPR_NOACCESS
,
4946 &spr_read_generic
, &spr_write_generic
,
4948 /* XXX : not implemented */
4949 spr_register(env
, SPR_Exxx_BBEAR
, "BBEAR",
4950 SPR_NOACCESS
, SPR_NOACCESS
,
4951 &spr_read_generic
, &spr_write_generic
,
4953 /* XXX : not implemented */
4954 spr_register(env
, SPR_Exxx_BBTAR
, "BBTAR",
4955 SPR_NOACCESS
, SPR_NOACCESS
,
4956 &spr_read_generic
, &spr_write_generic
,
4958 /* XXX : not implemented */
4959 spr_register(env
, SPR_Exxx_MCAR
, "MCAR",
4960 SPR_NOACCESS
, SPR_NOACCESS
,
4961 &spr_read_generic
, &spr_write_generic
,
4963 /* XXX : not implemented */
4964 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4965 SPR_NOACCESS
, SPR_NOACCESS
,
4966 &spr_read_generic
, &spr_write_generic
,
4968 /* XXX : not implemented */
4969 spr_register(env
, SPR_Exxx_NPIDR
, "NPIDR",
4970 SPR_NOACCESS
, SPR_NOACCESS
,
4971 &spr_read_generic
, &spr_write_generic
,
4973 /* XXX : not implemented */
4974 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4975 SPR_NOACCESS
, SPR_NOACCESS
,
4976 &spr_read_generic
, &spr_write_generic
,
4978 /* XXX : not implemented */
4979 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4980 &spr_read_generic
, SPR_NOACCESS
,
4981 &spr_read_generic
, SPR_NOACCESS
,
4983 spr_register(env
, SPR_Exxx_L1CFG1
, "L1CFG1",
4984 &spr_read_generic
, SPR_NOACCESS
,
4985 &spr_read_generic
, SPR_NOACCESS
,
4987 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4988 SPR_NOACCESS
, SPR_NOACCESS
,
4989 &spr_read_generic
, &spr_write_e500_l1csr0
,
4991 spr_register(env
, SPR_Exxx_L1CSR1
, "L1CSR1",
4992 SPR_NOACCESS
, SPR_NOACCESS
,
4993 &spr_read_generic
, &spr_write_e500_l1csr1
,
4995 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4996 SPR_NOACCESS
, SPR_NOACCESS
,
4997 &spr_read_generic
, &spr_write_generic
,
4999 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
5000 SPR_NOACCESS
, SPR_NOACCESS
,
5001 &spr_read_generic
, &spr_write_generic
,
5003 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
5004 SPR_NOACCESS
, SPR_NOACCESS
,
5005 &spr_read_generic
, &spr_write_booke206_mmucsr0
,
5007 spr_register(env
, SPR_BOOKE_EPR
, "EPR",
5008 SPR_NOACCESS
, SPR_NOACCESS
,
5009 &spr_read_generic
, SPR_NOACCESS
,
5011 /* XXX better abstract into Emb.xxx features */
5012 if (version
== fsl_e5500
) {
5013 spr_register(env
, SPR_BOOKE_EPCR
, "EPCR",
5014 SPR_NOACCESS
, SPR_NOACCESS
,
5015 &spr_read_generic
, &spr_write_generic
,
5017 spr_register(env
, SPR_BOOKE_MAS7_MAS3
, "MAS7_MAS3",
5018 SPR_NOACCESS
, SPR_NOACCESS
,
5019 &spr_read_mas73
, &spr_write_mas73
,
5021 ivpr_mask
= (target_ulong
)~0xFFFFULL
;
5024 #if !defined(CONFIG_USER_ONLY)
5026 env
->tlb_type
= TLB_MAS
;
5027 for (i
= 0; i
< BOOKE206_MAX_TLBN
; i
++) {
5028 env
->nb_tlb
+= booke206_tlb_size(env
, i
);
5032 init_excp_e200(env
, ivpr_mask
);
5033 /* Allocate hardware IRQ controller */
5034 ppce500_irq_init(ppc_env_get_cpu(env
));
5037 static void init_proc_e500v1(CPUPPCState
*env
)
5039 init_proc_e500(env
, fsl_e500v1
);
5042 POWERPC_FAMILY(e500v1
)(ObjectClass
*oc
, void *data
)
5044 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5045 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5047 dc
->desc
= "e500v1 core";
5048 pcc
->init_proc
= init_proc_e500v1
;
5049 pcc
->check_pow
= check_pow_hid0
;
5050 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5051 PPC_SPE
| PPC_SPE_SINGLE
|
5052 PPC_WRTEE
| PPC_RFDI
|
5053 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5054 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5055 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5056 pcc
->insns_flags2
= PPC2_BOOKE206
;
5057 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
5071 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5072 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5073 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5074 pcc
->bfd_mach
= bfd_mach_ppc_860
;
5075 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
5076 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
5077 POWERPC_FLAG_BUS_CLK
;
5080 static void init_proc_e500v2(CPUPPCState
*env
)
5082 init_proc_e500(env
, fsl_e500v2
);
5085 POWERPC_FAMILY(e500v2
)(ObjectClass
*oc
, void *data
)
5087 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5088 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5090 dc
->desc
= "e500v2 core";
5091 pcc
->init_proc
= init_proc_e500v2
;
5092 pcc
->check_pow
= check_pow_hid0
;
5093 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5094 PPC_SPE
| PPC_SPE_SINGLE
| PPC_SPE_DOUBLE
|
5095 PPC_WRTEE
| PPC_RFDI
|
5096 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5097 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5098 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5099 pcc
->insns_flags2
= PPC2_BOOKE206
;
5100 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
5114 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5115 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5116 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5117 pcc
->bfd_mach
= bfd_mach_ppc_860
;
5118 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
5119 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
5120 POWERPC_FLAG_BUS_CLK
;
5123 static void init_proc_e500mc(CPUPPCState
*env
)
5125 init_proc_e500(env
, fsl_e500mc
);
5128 POWERPC_FAMILY(e500mc
)(ObjectClass
*oc
, void *data
)
5130 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5131 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5133 dc
->desc
= "e500mc core";
5134 pcc
->init_proc
= init_proc_e500mc
;
5135 pcc
->check_pow
= check_pow_none
;
5136 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_MFTB
|
5137 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5138 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5139 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5140 PPC_FLOAT
| PPC_FLOAT_FRES
|
5141 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5142 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5143 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5144 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
;
5145 pcc
->msr_mask
= (1ull << MSR_GS
) |
5146 (1ull << MSR_UCLE
) |
5159 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5160 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5161 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5162 /* FIXME: figure out the correct flag for e500mc */
5163 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5164 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5165 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5169 static void init_proc_e5500(CPUPPCState
*env
)
5171 init_proc_e500(env
, fsl_e5500
);
5174 POWERPC_FAMILY(e5500
)(ObjectClass
*oc
, void *data
)
5176 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5177 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5179 dc
->desc
= "e5500 core";
5180 pcc
->init_proc
= init_proc_e5500
;
5181 pcc
->check_pow
= check_pow_none
;
5182 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_MFTB
|
5183 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5184 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5185 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5186 PPC_FLOAT
| PPC_FLOAT_FRES
|
5187 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5188 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5189 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
5190 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
;
5191 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
| \
5193 pcc
->msr_mask
= (1ull << MSR_CM
) |
5195 (1ull << MSR_UCLE
) |
5208 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5209 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5210 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5211 /* FIXME: figure out the correct flag for e5500 */
5212 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5213 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5214 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5218 /* Non-embedded PowerPC */
5220 /* POWER : same as 601, without mfmsr, mfsr */
5221 POWERPC_FAMILY(POWER
)(ObjectClass
*oc
, void *data
)
5223 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5224 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5227 /* pcc->insns_flags = XXX_TODO; */
5228 /* POWER RSC (from RAD6000) */
5229 pcc
->msr_mask
= (1ull << MSR_EE
) |
5242 #define POWERPC_MSRR_601 (0x0000000000001040ULL)
5244 static void init_proc_601 (CPUPPCState
*env
)
5246 gen_spr_ne_601(env
);
5248 /* Hardware implementation registers */
5249 /* XXX : not implemented */
5250 spr_register(env
, SPR_HID0
, "HID0",
5251 SPR_NOACCESS
, SPR_NOACCESS
,
5252 &spr_read_generic
, &spr_write_hid0_601
,
5254 /* XXX : not implemented */
5255 spr_register(env
, SPR_HID1
, "HID1",
5256 SPR_NOACCESS
, SPR_NOACCESS
,
5257 &spr_read_generic
, &spr_write_generic
,
5259 /* XXX : not implemented */
5260 spr_register(env
, SPR_601_HID2
, "HID2",
5261 SPR_NOACCESS
, SPR_NOACCESS
,
5262 &spr_read_generic
, &spr_write_generic
,
5264 /* XXX : not implemented */
5265 spr_register(env
, SPR_601_HID5
, "HID5",
5266 SPR_NOACCESS
, SPR_NOACCESS
,
5267 &spr_read_generic
, &spr_write_generic
,
5269 /* Memory management */
5271 /* XXX: beware that dcache line size is 64
5272 * but dcbz uses 32 bytes "sectors"
5273 * XXX: this breaks clcs instruction !
5275 env
->dcache_line_size
= 32;
5276 env
->icache_line_size
= 64;
5277 /* Allocate hardware IRQ controller */
5278 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5281 POWERPC_FAMILY(601)(ObjectClass
*oc
, void *data
)
5283 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5284 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5286 dc
->desc
= "PowerPC 601";
5287 pcc
->init_proc
= init_proc_601
;
5288 pcc
->check_pow
= check_pow_none
;
5289 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5291 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5292 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5293 PPC_SEGMENT
| PPC_EXTERN
;
5294 pcc
->msr_mask
= (1ull << MSR_EE
) |
5304 pcc
->mmu_model
= POWERPC_MMU_601
;
5305 #if defined(CONFIG_SOFTMMU)
5306 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5308 pcc
->excp_model
= POWERPC_EXCP_601
;
5309 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5310 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5311 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5314 #define POWERPC_MSRR_601v (0x0000000000001040ULL)
5316 static void init_proc_601v (CPUPPCState
*env
)
5319 /* XXX : not implemented */
5320 spr_register(env
, SPR_601_HID15
, "HID15",
5321 SPR_NOACCESS
, SPR_NOACCESS
,
5322 &spr_read_generic
, &spr_write_generic
,
5326 POWERPC_FAMILY(601v
)(ObjectClass
*oc
, void *data
)
5328 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5329 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5331 dc
->desc
= "PowerPC 601v";
5332 pcc
->init_proc
= init_proc_601v
;
5333 pcc
->check_pow
= check_pow_none
;
5334 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5336 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5337 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5338 PPC_SEGMENT
| PPC_EXTERN
;
5339 pcc
->msr_mask
= (1ull << MSR_EE
) |
5349 pcc
->mmu_model
= POWERPC_MMU_601
;
5350 #if defined(CONFIG_SOFTMMU)
5351 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5353 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5354 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5355 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5358 static void init_proc_602 (CPUPPCState
*env
)
5360 gen_spr_ne_601(env
);
5364 /* hardware implementation registers */
5365 /* XXX : not implemented */
5366 spr_register(env
, SPR_HID0
, "HID0",
5367 SPR_NOACCESS
, SPR_NOACCESS
,
5368 &spr_read_generic
, &spr_write_generic
,
5370 /* XXX : not implemented */
5371 spr_register(env
, SPR_HID1
, "HID1",
5372 SPR_NOACCESS
, SPR_NOACCESS
,
5373 &spr_read_generic
, &spr_write_generic
,
5375 /* Memory management */
5377 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5379 env
->dcache_line_size
= 32;
5380 env
->icache_line_size
= 32;
5381 /* Allocate hardware IRQ controller */
5382 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5385 POWERPC_FAMILY(602)(ObjectClass
*oc
, void *data
)
5387 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5388 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5390 dc
->desc
= "PowerPC 602";
5391 pcc
->init_proc
= init_proc_602
;
5392 pcc
->check_pow
= check_pow_hid0
;
5393 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5394 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5395 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5396 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5397 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5398 PPC_MEM_TLBIE
| PPC_6xx_TLB
| PPC_MEM_TLBSYNC
|
5399 PPC_SEGMENT
| PPC_602_SPEC
;
5400 pcc
->msr_mask
= (1ull << MSR_VSX
) |
5403 (1ull << MSR_TGPR
) |
5418 /* XXX: 602 MMU is quite specific. Should add a special case */
5419 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5420 pcc
->excp_model
= POWERPC_EXCP_602
;
5421 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5422 pcc
->bfd_mach
= bfd_mach_ppc_602
;
5423 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5424 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5427 static void init_proc_603 (CPUPPCState
*env
)
5429 gen_spr_ne_601(env
);
5433 /* hardware implementation registers */
5434 /* XXX : not implemented */
5435 spr_register(env
, SPR_HID0
, "HID0",
5436 SPR_NOACCESS
, SPR_NOACCESS
,
5437 &spr_read_generic
, &spr_write_generic
,
5439 /* XXX : not implemented */
5440 spr_register(env
, SPR_HID1
, "HID1",
5441 SPR_NOACCESS
, SPR_NOACCESS
,
5442 &spr_read_generic
, &spr_write_generic
,
5444 /* Memory management */
5446 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5448 env
->dcache_line_size
= 32;
5449 env
->icache_line_size
= 32;
5450 /* Allocate hardware IRQ controller */
5451 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5454 POWERPC_FAMILY(603)(ObjectClass
*oc
, void *data
)
5456 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5457 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5459 dc
->desc
= "PowerPC 603";
5460 pcc
->init_proc
= init_proc_603
;
5461 pcc
->check_pow
= check_pow_hid0
;
5462 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5463 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5464 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5465 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5466 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5467 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5468 PPC_SEGMENT
| PPC_EXTERN
;
5469 pcc
->msr_mask
= (1ull << MSR_POW
) |
5470 (1ull << MSR_TGPR
) |
5485 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5486 pcc
->excp_model
= POWERPC_EXCP_603
;
5487 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5488 pcc
->bfd_mach
= bfd_mach_ppc_603
;
5489 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5490 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5493 static void init_proc_603E (CPUPPCState
*env
)
5495 gen_spr_ne_601(env
);
5499 /* hardware implementation registers */
5500 /* XXX : not implemented */
5501 spr_register(env
, SPR_HID0
, "HID0",
5502 SPR_NOACCESS
, SPR_NOACCESS
,
5503 &spr_read_generic
, &spr_write_generic
,
5505 /* XXX : not implemented */
5506 spr_register(env
, SPR_HID1
, "HID1",
5507 SPR_NOACCESS
, SPR_NOACCESS
,
5508 &spr_read_generic
, &spr_write_generic
,
5510 /* Memory management */
5512 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5514 env
->dcache_line_size
= 32;
5515 env
->icache_line_size
= 32;
5516 /* Allocate hardware IRQ controller */
5517 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5520 POWERPC_FAMILY(603E
)(ObjectClass
*oc
, void *data
)
5522 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5523 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5525 dc
->desc
= "PowerPC 603e";
5526 pcc
->init_proc
= init_proc_603E
;
5527 pcc
->check_pow
= check_pow_hid0
;
5528 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5529 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5530 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5531 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5532 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5533 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5534 PPC_SEGMENT
| PPC_EXTERN
;
5535 pcc
->msr_mask
= (1ull << MSR_POW
) |
5536 (1ull << MSR_TGPR
) |
5551 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5552 pcc
->excp_model
= POWERPC_EXCP_603E
;
5553 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5554 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
5555 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5556 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5559 static void init_proc_604 (CPUPPCState
*env
)
5561 gen_spr_ne_601(env
);
5565 /* Hardware implementation registers */
5566 /* XXX : not implemented */
5567 spr_register(env
, SPR_HID0
, "HID0",
5568 SPR_NOACCESS
, SPR_NOACCESS
,
5569 &spr_read_generic
, &spr_write_generic
,
5571 /* Memory management */
5574 env
->dcache_line_size
= 32;
5575 env
->icache_line_size
= 32;
5576 /* Allocate hardware IRQ controller */
5577 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5580 POWERPC_FAMILY(604)(ObjectClass
*oc
, void *data
)
5582 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5583 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5585 dc
->desc
= "PowerPC 604";
5586 pcc
->init_proc
= init_proc_604
;
5587 pcc
->check_pow
= check_pow_nocheck
;
5588 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5589 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5590 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5591 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5592 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5593 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5594 PPC_SEGMENT
| PPC_EXTERN
;
5595 pcc
->msr_mask
= (1ull << MSR_POW
) |
5611 pcc
->mmu_model
= POWERPC_MMU_32B
;
5612 #if defined(CONFIG_SOFTMMU)
5613 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5615 pcc
->excp_model
= POWERPC_EXCP_604
;
5616 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5617 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5618 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5619 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5622 static void init_proc_604E (CPUPPCState
*env
)
5624 gen_spr_ne_601(env
);
5626 /* XXX : not implemented */
5627 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
5628 SPR_NOACCESS
, SPR_NOACCESS
,
5629 &spr_read_generic
, &spr_write_generic
,
5631 /* XXX : not implemented */
5632 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
5633 SPR_NOACCESS
, SPR_NOACCESS
,
5634 &spr_read_generic
, &spr_write_generic
,
5636 /* XXX : not implemented */
5637 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
5638 SPR_NOACCESS
, SPR_NOACCESS
,
5639 &spr_read_generic
, &spr_write_generic
,
5643 /* Hardware implementation registers */
5644 /* XXX : not implemented */
5645 spr_register(env
, SPR_HID0
, "HID0",
5646 SPR_NOACCESS
, SPR_NOACCESS
,
5647 &spr_read_generic
, &spr_write_generic
,
5649 /* XXX : not implemented */
5650 spr_register(env
, SPR_HID1
, "HID1",
5651 SPR_NOACCESS
, SPR_NOACCESS
,
5652 &spr_read_generic
, &spr_write_generic
,
5654 /* Memory management */
5657 env
->dcache_line_size
= 32;
5658 env
->icache_line_size
= 32;
5659 /* Allocate hardware IRQ controller */
5660 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5663 POWERPC_FAMILY(604E
)(ObjectClass
*oc
, void *data
)
5665 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5666 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5668 dc
->desc
= "PowerPC 604E";
5669 pcc
->init_proc
= init_proc_604E
;
5670 pcc
->check_pow
= check_pow_nocheck
;
5671 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5672 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5673 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5674 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5675 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5676 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5677 PPC_SEGMENT
| PPC_EXTERN
;
5678 pcc
->msr_mask
= (1ull << MSR_POW
) |
5694 pcc
->mmu_model
= POWERPC_MMU_32B
;
5695 #if defined(CONFIG_SOFTMMU)
5696 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5698 pcc
->excp_model
= POWERPC_EXCP_604
;
5699 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5700 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5701 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5702 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5705 static void init_proc_740 (CPUPPCState
*env
)
5707 gen_spr_ne_601(env
);
5711 /* Thermal management */
5713 /* Hardware implementation registers */
5714 /* XXX : not implemented */
5715 spr_register(env
, SPR_HID0
, "HID0",
5716 SPR_NOACCESS
, SPR_NOACCESS
,
5717 &spr_read_generic
, &spr_write_generic
,
5719 /* XXX : not implemented */
5720 spr_register(env
, SPR_HID1
, "HID1",
5721 SPR_NOACCESS
, SPR_NOACCESS
,
5722 &spr_read_generic
, &spr_write_generic
,
5724 /* Memory management */
5727 env
->dcache_line_size
= 32;
5728 env
->icache_line_size
= 32;
5729 /* Allocate hardware IRQ controller */
5730 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5733 POWERPC_FAMILY(740)(ObjectClass
*oc
, void *data
)
5735 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5736 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5738 dc
->desc
= "PowerPC 740";
5739 pcc
->init_proc
= init_proc_740
;
5740 pcc
->check_pow
= check_pow_hid0
;
5741 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5742 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5743 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5744 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5745 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5746 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5747 PPC_SEGMENT
| PPC_EXTERN
;
5748 pcc
->msr_mask
= (1ull << MSR_POW
) |
5764 pcc
->mmu_model
= POWERPC_MMU_32B
;
5765 #if defined(CONFIG_SOFTMMU)
5766 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5768 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5769 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5770 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5771 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5772 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5775 static void init_proc_750 (CPUPPCState
*env
)
5777 gen_spr_ne_601(env
);
5779 /* XXX : not implemented */
5780 spr_register(env
, SPR_L2CR
, "L2CR",
5781 SPR_NOACCESS
, SPR_NOACCESS
,
5782 &spr_read_generic
, spr_access_nop
,
5786 /* Thermal management */
5788 /* Hardware implementation registers */
5789 /* XXX : not implemented */
5790 spr_register(env
, SPR_HID0
, "HID0",
5791 SPR_NOACCESS
, SPR_NOACCESS
,
5792 &spr_read_generic
, &spr_write_generic
,
5794 /* XXX : not implemented */
5795 spr_register(env
, SPR_HID1
, "HID1",
5796 SPR_NOACCESS
, SPR_NOACCESS
,
5797 &spr_read_generic
, &spr_write_generic
,
5799 /* Memory management */
5801 /* XXX: high BATs are also present but are known to be bugged on
5805 env
->dcache_line_size
= 32;
5806 env
->icache_line_size
= 32;
5807 /* Allocate hardware IRQ controller */
5808 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5811 POWERPC_FAMILY(750)(ObjectClass
*oc
, void *data
)
5813 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5814 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5816 dc
->desc
= "PowerPC 750";
5817 pcc
->init_proc
= init_proc_750
;
5818 pcc
->check_pow
= check_pow_hid0
;
5819 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5820 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5821 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5822 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5823 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5824 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5825 PPC_SEGMENT
| PPC_EXTERN
;
5826 pcc
->msr_mask
= (1ull << MSR_POW
) |
5842 pcc
->mmu_model
= POWERPC_MMU_32B
;
5843 #if defined(CONFIG_SOFTMMU)
5844 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5846 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5847 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5848 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5849 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5850 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5853 static void init_proc_750cl (CPUPPCState
*env
)
5855 gen_spr_ne_601(env
);
5857 /* XXX : not implemented */
5858 spr_register(env
, SPR_L2CR
, "L2CR",
5859 SPR_NOACCESS
, SPR_NOACCESS
,
5860 &spr_read_generic
, spr_access_nop
,
5864 /* Thermal management */
5865 /* Those registers are fake on 750CL */
5866 spr_register(env
, SPR_THRM1
, "THRM1",
5867 SPR_NOACCESS
, SPR_NOACCESS
,
5868 &spr_read_generic
, &spr_write_generic
,
5870 spr_register(env
, SPR_THRM2
, "THRM2",
5871 SPR_NOACCESS
, SPR_NOACCESS
,
5872 &spr_read_generic
, &spr_write_generic
,
5874 spr_register(env
, SPR_THRM3
, "THRM3",
5875 SPR_NOACCESS
, SPR_NOACCESS
,
5876 &spr_read_generic
, &spr_write_generic
,
5878 /* XXX: not implemented */
5879 spr_register(env
, SPR_750_TDCL
, "TDCL",
5880 SPR_NOACCESS
, SPR_NOACCESS
,
5881 &spr_read_generic
, &spr_write_generic
,
5883 spr_register(env
, SPR_750_TDCH
, "TDCH",
5884 SPR_NOACCESS
, SPR_NOACCESS
,
5885 &spr_read_generic
, &spr_write_generic
,
5888 /* XXX : not implemented */
5889 spr_register(env
, SPR_750_WPAR
, "WPAR",
5890 SPR_NOACCESS
, SPR_NOACCESS
,
5891 &spr_read_generic
, &spr_write_generic
,
5893 spr_register(env
, SPR_750_DMAL
, "DMAL",
5894 SPR_NOACCESS
, SPR_NOACCESS
,
5895 &spr_read_generic
, &spr_write_generic
,
5897 spr_register(env
, SPR_750_DMAU
, "DMAU",
5898 SPR_NOACCESS
, SPR_NOACCESS
,
5899 &spr_read_generic
, &spr_write_generic
,
5901 /* Hardware implementation registers */
5902 /* XXX : not implemented */
5903 spr_register(env
, SPR_HID0
, "HID0",
5904 SPR_NOACCESS
, SPR_NOACCESS
,
5905 &spr_read_generic
, &spr_write_generic
,
5907 /* XXX : not implemented */
5908 spr_register(env
, SPR_HID1
, "HID1",
5909 SPR_NOACCESS
, SPR_NOACCESS
,
5910 &spr_read_generic
, &spr_write_generic
,
5912 /* XXX : not implemented */
5913 spr_register(env
, SPR_750CL_HID2
, "HID2",
5914 SPR_NOACCESS
, SPR_NOACCESS
,
5915 &spr_read_generic
, &spr_write_generic
,
5917 /* XXX : not implemented */
5918 spr_register(env
, SPR_750CL_HID4
, "HID4",
5919 SPR_NOACCESS
, SPR_NOACCESS
,
5920 &spr_read_generic
, &spr_write_generic
,
5922 /* Quantization registers */
5923 /* XXX : not implemented */
5924 spr_register(env
, SPR_750_GQR0
, "GQR0",
5925 SPR_NOACCESS
, SPR_NOACCESS
,
5926 &spr_read_generic
, &spr_write_generic
,
5928 /* XXX : not implemented */
5929 spr_register(env
, SPR_750_GQR1
, "GQR1",
5930 SPR_NOACCESS
, SPR_NOACCESS
,
5931 &spr_read_generic
, &spr_write_generic
,
5933 /* XXX : not implemented */
5934 spr_register(env
, SPR_750_GQR2
, "GQR2",
5935 SPR_NOACCESS
, SPR_NOACCESS
,
5936 &spr_read_generic
, &spr_write_generic
,
5938 /* XXX : not implemented */
5939 spr_register(env
, SPR_750_GQR3
, "GQR3",
5940 SPR_NOACCESS
, SPR_NOACCESS
,
5941 &spr_read_generic
, &spr_write_generic
,
5943 /* XXX : not implemented */
5944 spr_register(env
, SPR_750_GQR4
, "GQR4",
5945 SPR_NOACCESS
, SPR_NOACCESS
,
5946 &spr_read_generic
, &spr_write_generic
,
5948 /* XXX : not implemented */
5949 spr_register(env
, SPR_750_GQR5
, "GQR5",
5950 SPR_NOACCESS
, SPR_NOACCESS
,
5951 &spr_read_generic
, &spr_write_generic
,
5953 /* XXX : not implemented */
5954 spr_register(env
, SPR_750_GQR6
, "GQR6",
5955 SPR_NOACCESS
, SPR_NOACCESS
,
5956 &spr_read_generic
, &spr_write_generic
,
5958 /* XXX : not implemented */
5959 spr_register(env
, SPR_750_GQR7
, "GQR7",
5960 SPR_NOACCESS
, SPR_NOACCESS
,
5961 &spr_read_generic
, &spr_write_generic
,
5963 /* Memory management */
5965 /* PowerPC 750cl has 8 DBATs and 8 IBATs */
5967 init_excp_750cl(env
);
5968 env
->dcache_line_size
= 32;
5969 env
->icache_line_size
= 32;
5970 /* Allocate hardware IRQ controller */
5971 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5974 POWERPC_FAMILY(750cl
)(ObjectClass
*oc
, void *data
)
5976 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5977 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5979 dc
->desc
= "PowerPC 750 CL";
5980 pcc
->init_proc
= init_proc_750cl
;
5981 pcc
->check_pow
= check_pow_hid0
;
5982 /* XXX: not implemented:
5983 * cache lock instructions:
5985 * floating point paired instructions
6020 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6021 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6022 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6023 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6024 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6025 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6026 PPC_SEGMENT
| PPC_EXTERN
;
6027 pcc
->msr_mask
= (1ull << MSR_POW
) |
6043 pcc
->mmu_model
= POWERPC_MMU_32B
;
6044 #if defined(CONFIG_SOFTMMU)
6045 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6047 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6048 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6049 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6050 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6051 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6054 static void init_proc_750cx (CPUPPCState
*env
)
6056 gen_spr_ne_601(env
);
6058 /* XXX : not implemented */
6059 spr_register(env
, SPR_L2CR
, "L2CR",
6060 SPR_NOACCESS
, SPR_NOACCESS
,
6061 &spr_read_generic
, spr_access_nop
,
6065 /* Thermal management */
6067 /* This register is not implemented but is present for compatibility */
6068 spr_register(env
, SPR_SDA
, "SDA",
6069 SPR_NOACCESS
, SPR_NOACCESS
,
6070 &spr_read_generic
, &spr_write_generic
,
6072 /* Hardware implementation registers */
6073 /* XXX : not implemented */
6074 spr_register(env
, SPR_HID0
, "HID0",
6075 SPR_NOACCESS
, SPR_NOACCESS
,
6076 &spr_read_generic
, &spr_write_generic
,
6078 /* XXX : not implemented */
6079 spr_register(env
, SPR_HID1
, "HID1",
6080 SPR_NOACCESS
, SPR_NOACCESS
,
6081 &spr_read_generic
, &spr_write_generic
,
6083 /* Memory management */
6085 /* PowerPC 750cx has 8 DBATs and 8 IBATs */
6087 init_excp_750cx(env
);
6088 env
->dcache_line_size
= 32;
6089 env
->icache_line_size
= 32;
6090 /* Allocate hardware IRQ controller */
6091 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6094 POWERPC_FAMILY(750cx
)(ObjectClass
*oc
, void *data
)
6096 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6097 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6099 dc
->desc
= "PowerPC 750CX";
6100 pcc
->init_proc
= init_proc_750cx
;
6101 pcc
->check_pow
= check_pow_hid0
;
6102 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6103 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6104 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6105 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6106 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6107 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6108 PPC_SEGMENT
| PPC_EXTERN
;
6109 pcc
->msr_mask
= (1ull << MSR_POW
) |
6125 pcc
->mmu_model
= POWERPC_MMU_32B
;
6126 #if defined(CONFIG_SOFTMMU)
6127 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6129 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6130 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6131 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6132 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6133 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6136 static void init_proc_750fx (CPUPPCState
*env
)
6138 gen_spr_ne_601(env
);
6140 /* XXX : not implemented */
6141 spr_register(env
, SPR_L2CR
, "L2CR",
6142 SPR_NOACCESS
, SPR_NOACCESS
,
6143 &spr_read_generic
, spr_access_nop
,
6147 /* Thermal management */
6149 /* XXX : not implemented */
6150 spr_register(env
, SPR_750_THRM4
, "THRM4",
6151 SPR_NOACCESS
, SPR_NOACCESS
,
6152 &spr_read_generic
, &spr_write_generic
,
6154 /* Hardware implementation registers */
6155 /* XXX : not implemented */
6156 spr_register(env
, SPR_HID0
, "HID0",
6157 SPR_NOACCESS
, SPR_NOACCESS
,
6158 &spr_read_generic
, &spr_write_generic
,
6160 /* XXX : not implemented */
6161 spr_register(env
, SPR_HID1
, "HID1",
6162 SPR_NOACCESS
, SPR_NOACCESS
,
6163 &spr_read_generic
, &spr_write_generic
,
6165 /* XXX : not implemented */
6166 spr_register(env
, SPR_750FX_HID2
, "HID2",
6167 SPR_NOACCESS
, SPR_NOACCESS
,
6168 &spr_read_generic
, &spr_write_generic
,
6170 /* Memory management */
6172 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6175 env
->dcache_line_size
= 32;
6176 env
->icache_line_size
= 32;
6177 /* Allocate hardware IRQ controller */
6178 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6181 POWERPC_FAMILY(750fx
)(ObjectClass
*oc
, void *data
)
6183 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6184 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6186 dc
->desc
= "PowerPC 750FX";
6187 pcc
->init_proc
= init_proc_750fx
;
6188 pcc
->check_pow
= check_pow_hid0
;
6189 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6190 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6191 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6192 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6193 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6194 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6195 PPC_SEGMENT
| PPC_EXTERN
;
6196 pcc
->msr_mask
= (1ull << MSR_POW
) |
6212 pcc
->mmu_model
= POWERPC_MMU_32B
;
6213 #if defined(CONFIG_SOFTMMU)
6214 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6216 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6217 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6218 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6219 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6220 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6223 static void init_proc_750gx (CPUPPCState
*env
)
6225 gen_spr_ne_601(env
);
6227 /* XXX : not implemented (XXX: different from 750fx) */
6228 spr_register(env
, SPR_L2CR
, "L2CR",
6229 SPR_NOACCESS
, SPR_NOACCESS
,
6230 &spr_read_generic
, spr_access_nop
,
6234 /* Thermal management */
6236 /* XXX : not implemented */
6237 spr_register(env
, SPR_750_THRM4
, "THRM4",
6238 SPR_NOACCESS
, SPR_NOACCESS
,
6239 &spr_read_generic
, &spr_write_generic
,
6241 /* Hardware implementation registers */
6242 /* XXX : not implemented (XXX: different from 750fx) */
6243 spr_register(env
, SPR_HID0
, "HID0",
6244 SPR_NOACCESS
, SPR_NOACCESS
,
6245 &spr_read_generic
, &spr_write_generic
,
6247 /* XXX : not implemented */
6248 spr_register(env
, SPR_HID1
, "HID1",
6249 SPR_NOACCESS
, SPR_NOACCESS
,
6250 &spr_read_generic
, &spr_write_generic
,
6252 /* XXX : not implemented (XXX: different from 750fx) */
6253 spr_register(env
, SPR_750FX_HID2
, "HID2",
6254 SPR_NOACCESS
, SPR_NOACCESS
,
6255 &spr_read_generic
, &spr_write_generic
,
6257 /* Memory management */
6259 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6262 env
->dcache_line_size
= 32;
6263 env
->icache_line_size
= 32;
6264 /* Allocate hardware IRQ controller */
6265 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6268 POWERPC_FAMILY(750gx
)(ObjectClass
*oc
, void *data
)
6270 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6271 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6273 dc
->desc
= "PowerPC 750GX";
6274 pcc
->init_proc
= init_proc_750gx
;
6275 pcc
->check_pow
= check_pow_hid0
;
6276 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6277 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6278 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6279 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6280 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6281 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6282 PPC_SEGMENT
| PPC_EXTERN
;
6283 pcc
->msr_mask
= (1ull << MSR_POW
) |
6299 pcc
->mmu_model
= POWERPC_MMU_32B
;
6300 #if defined(CONFIG_SOFTMMU)
6301 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6303 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6304 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6305 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6306 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6307 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6310 static void init_proc_745 (CPUPPCState
*env
)
6312 gen_spr_ne_601(env
);
6314 gen_spr_G2_755(env
);
6317 /* Thermal management */
6319 /* Hardware implementation registers */
6320 /* XXX : not implemented */
6321 spr_register(env
, SPR_HID0
, "HID0",
6322 SPR_NOACCESS
, SPR_NOACCESS
,
6323 &spr_read_generic
, &spr_write_generic
,
6325 /* XXX : not implemented */
6326 spr_register(env
, SPR_HID1
, "HID1",
6327 SPR_NOACCESS
, SPR_NOACCESS
,
6328 &spr_read_generic
, &spr_write_generic
,
6330 /* XXX : not implemented */
6331 spr_register(env
, SPR_HID2
, "HID2",
6332 SPR_NOACCESS
, SPR_NOACCESS
,
6333 &spr_read_generic
, &spr_write_generic
,
6335 /* Memory management */
6338 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6340 env
->dcache_line_size
= 32;
6341 env
->icache_line_size
= 32;
6342 /* Allocate hardware IRQ controller */
6343 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6346 POWERPC_FAMILY(745)(ObjectClass
*oc
, void *data
)
6348 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6349 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6351 dc
->desc
= "PowerPC 745";
6352 pcc
->init_proc
= init_proc_745
;
6353 pcc
->check_pow
= check_pow_hid0
;
6354 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6355 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6356 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6357 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6358 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6359 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6360 PPC_SEGMENT
| PPC_EXTERN
;
6361 pcc
->msr_mask
= (1ull << MSR_POW
) |
6377 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6378 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6379 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6380 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6381 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6382 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6385 static void init_proc_755 (CPUPPCState
*env
)
6387 gen_spr_ne_601(env
);
6389 gen_spr_G2_755(env
);
6392 /* L2 cache control */
6393 /* XXX : not implemented */
6394 spr_register(env
, SPR_L2CR
, "L2CR",
6395 SPR_NOACCESS
, SPR_NOACCESS
,
6396 &spr_read_generic
, spr_access_nop
,
6398 /* XXX : not implemented */
6399 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6400 SPR_NOACCESS
, SPR_NOACCESS
,
6401 &spr_read_generic
, &spr_write_generic
,
6403 /* Thermal management */
6405 /* Hardware implementation registers */
6406 /* XXX : not implemented */
6407 spr_register(env
, SPR_HID0
, "HID0",
6408 SPR_NOACCESS
, SPR_NOACCESS
,
6409 &spr_read_generic
, &spr_write_generic
,
6411 /* XXX : not implemented */
6412 spr_register(env
, SPR_HID1
, "HID1",
6413 SPR_NOACCESS
, SPR_NOACCESS
,
6414 &spr_read_generic
, &spr_write_generic
,
6416 /* XXX : not implemented */
6417 spr_register(env
, SPR_HID2
, "HID2",
6418 SPR_NOACCESS
, SPR_NOACCESS
,
6419 &spr_read_generic
, &spr_write_generic
,
6421 /* Memory management */
6424 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6426 env
->dcache_line_size
= 32;
6427 env
->icache_line_size
= 32;
6428 /* Allocate hardware IRQ controller */
6429 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6432 POWERPC_FAMILY(755)(ObjectClass
*oc
, void *data
)
6434 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6435 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6437 dc
->desc
= "PowerPC 755";
6438 pcc
->init_proc
= init_proc_755
;
6439 pcc
->check_pow
= check_pow_hid0
;
6440 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6441 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6442 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6443 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6444 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6445 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6446 PPC_SEGMENT
| PPC_EXTERN
;
6447 pcc
->msr_mask
= (1ull << MSR_POW
) |
6463 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6464 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6465 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6466 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6467 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6468 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6471 static void init_proc_7400 (CPUPPCState
*env
)
6473 gen_spr_ne_601(env
);
6477 /* 74xx specific SPR */
6479 /* XXX : not implemented */
6480 spr_register(env
, SPR_UBAMR
, "UBAMR",
6481 &spr_read_ureg
, SPR_NOACCESS
,
6482 &spr_read_ureg
, SPR_NOACCESS
,
6484 /* XXX: this seems not implemented on all revisions. */
6485 /* XXX : not implemented */
6486 spr_register(env
, SPR_MSSCR1
, "MSSCR1",
6487 SPR_NOACCESS
, SPR_NOACCESS
,
6488 &spr_read_generic
, &spr_write_generic
,
6490 /* Thermal management */
6492 /* Memory management */
6494 init_excp_7400(env
);
6495 env
->dcache_line_size
= 32;
6496 env
->icache_line_size
= 32;
6497 /* Allocate hardware IRQ controller */
6498 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6501 POWERPC_FAMILY(7400)(ObjectClass
*oc
, void *data
)
6503 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6504 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6506 dc
->desc
= "PowerPC 7400 (aka G4)";
6507 pcc
->init_proc
= init_proc_7400
;
6508 pcc
->check_pow
= check_pow_hid0
;
6509 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6510 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6511 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6513 PPC_CACHE
| PPC_CACHE_ICBI
|
6514 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6515 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6516 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6518 PPC_SEGMENT
| PPC_EXTERN
|
6520 pcc
->msr_mask
= (1ull << MSR_VR
) |
6537 pcc
->mmu_model
= POWERPC_MMU_32B
;
6538 #if defined(CONFIG_SOFTMMU)
6539 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6541 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6542 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6543 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6544 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6545 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6546 POWERPC_FLAG_BUS_CLK
;
6549 static void init_proc_7410 (CPUPPCState
*env
)
6551 gen_spr_ne_601(env
);
6555 /* 74xx specific SPR */
6557 /* XXX : not implemented */
6558 spr_register(env
, SPR_UBAMR
, "UBAMR",
6559 &spr_read_ureg
, SPR_NOACCESS
,
6560 &spr_read_ureg
, SPR_NOACCESS
,
6562 /* Thermal management */
6565 /* XXX : not implemented */
6566 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6567 SPR_NOACCESS
, SPR_NOACCESS
,
6568 &spr_read_generic
, &spr_write_generic
,
6571 /* XXX : not implemented */
6572 spr_register(env
, SPR_LDSTDB
, "LDSTDB",
6573 SPR_NOACCESS
, SPR_NOACCESS
,
6574 &spr_read_generic
, &spr_write_generic
,
6576 /* Memory management */
6578 init_excp_7400(env
);
6579 env
->dcache_line_size
= 32;
6580 env
->icache_line_size
= 32;
6581 /* Allocate hardware IRQ controller */
6582 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6585 POWERPC_FAMILY(7410)(ObjectClass
*oc
, void *data
)
6587 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6588 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6590 dc
->desc
= "PowerPC 7410 (aka G4)";
6591 pcc
->init_proc
= init_proc_7410
;
6592 pcc
->check_pow
= check_pow_hid0
;
6593 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6594 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6595 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6597 PPC_CACHE
| PPC_CACHE_ICBI
|
6598 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6599 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6600 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6602 PPC_SEGMENT
| PPC_EXTERN
|
6604 pcc
->msr_mask
= (1ull << MSR_VR
) |
6621 pcc
->mmu_model
= POWERPC_MMU_32B
;
6622 #if defined(CONFIG_SOFTMMU)
6623 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6625 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6626 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6627 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6628 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6629 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6630 POWERPC_FLAG_BUS_CLK
;
6633 static void init_proc_7440 (CPUPPCState
*env
)
6635 gen_spr_ne_601(env
);
6639 /* 74xx specific SPR */
6641 /* XXX : not implemented */
6642 spr_register(env
, SPR_UBAMR
, "UBAMR",
6643 &spr_read_ureg
, SPR_NOACCESS
,
6644 &spr_read_ureg
, SPR_NOACCESS
,
6647 /* XXX : not implemented */
6648 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6649 SPR_NOACCESS
, SPR_NOACCESS
,
6650 &spr_read_generic
, &spr_write_generic
,
6653 /* XXX : not implemented */
6654 spr_register(env
, SPR_ICTRL
, "ICTRL",
6655 SPR_NOACCESS
, SPR_NOACCESS
,
6656 &spr_read_generic
, &spr_write_generic
,
6659 /* XXX : not implemented */
6660 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6661 SPR_NOACCESS
, SPR_NOACCESS
,
6662 &spr_read_generic
, &spr_write_generic
,
6665 /* XXX : not implemented */
6666 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6667 SPR_NOACCESS
, SPR_NOACCESS
,
6668 &spr_read_generic
, &spr_write_generic
,
6670 /* XXX : not implemented */
6671 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6672 &spr_read_ureg
, SPR_NOACCESS
,
6673 &spr_read_ureg
, SPR_NOACCESS
,
6675 /* XXX : not implemented */
6676 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6677 SPR_NOACCESS
, SPR_NOACCESS
,
6678 &spr_read_generic
, &spr_write_generic
,
6680 /* XXX : not implemented */
6681 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6682 &spr_read_ureg
, SPR_NOACCESS
,
6683 &spr_read_ureg
, SPR_NOACCESS
,
6685 /* Memory management */
6687 gen_74xx_soft_tlb(env
, 128, 2);
6688 init_excp_7450(env
);
6689 env
->dcache_line_size
= 32;
6690 env
->icache_line_size
= 32;
6691 /* Allocate hardware IRQ controller */
6692 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6695 POWERPC_FAMILY(7440)(ObjectClass
*oc
, void *data
)
6697 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6698 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6700 dc
->desc
= "PowerPC 7440 (aka G4)";
6701 pcc
->init_proc
= init_proc_7440
;
6702 pcc
->check_pow
= check_pow_hid0_74xx
;
6703 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6704 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6705 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6707 PPC_CACHE
| PPC_CACHE_ICBI
|
6708 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6709 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6710 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6711 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6712 PPC_SEGMENT
| PPC_EXTERN
|
6714 pcc
->msr_mask
= (1ull << MSR_VR
) |
6731 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6732 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6733 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6734 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6735 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6736 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6737 POWERPC_FLAG_BUS_CLK
;
6740 static void init_proc_7450 (CPUPPCState
*env
)
6742 gen_spr_ne_601(env
);
6746 /* 74xx specific SPR */
6748 /* Level 3 cache control */
6751 /* XXX : not implemented */
6752 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
6753 SPR_NOACCESS
, SPR_NOACCESS
,
6754 &spr_read_generic
, &spr_write_generic
,
6757 /* XXX : not implemented */
6758 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
6759 SPR_NOACCESS
, SPR_NOACCESS
,
6760 &spr_read_generic
, &spr_write_generic
,
6763 /* XXX : not implemented */
6764 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
6765 SPR_NOACCESS
, SPR_NOACCESS
,
6766 &spr_read_generic
, &spr_write_generic
,
6769 /* XXX : not implemented */
6770 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
6771 SPR_NOACCESS
, SPR_NOACCESS
,
6772 &spr_read_generic
, &spr_write_generic
,
6774 /* XXX : not implemented */
6775 spr_register(env
, SPR_UBAMR
, "UBAMR",
6776 &spr_read_ureg
, SPR_NOACCESS
,
6777 &spr_read_ureg
, SPR_NOACCESS
,
6780 /* XXX : not implemented */
6781 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6782 SPR_NOACCESS
, SPR_NOACCESS
,
6783 &spr_read_generic
, &spr_write_generic
,
6786 /* XXX : not implemented */
6787 spr_register(env
, SPR_ICTRL
, "ICTRL",
6788 SPR_NOACCESS
, SPR_NOACCESS
,
6789 &spr_read_generic
, &spr_write_generic
,
6792 /* XXX : not implemented */
6793 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6794 SPR_NOACCESS
, SPR_NOACCESS
,
6795 &spr_read_generic
, &spr_write_generic
,
6798 /* XXX : not implemented */
6799 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6800 SPR_NOACCESS
, SPR_NOACCESS
,
6801 &spr_read_generic
, &spr_write_generic
,
6803 /* XXX : not implemented */
6804 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6805 &spr_read_ureg
, SPR_NOACCESS
,
6806 &spr_read_ureg
, SPR_NOACCESS
,
6808 /* XXX : not implemented */
6809 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6810 SPR_NOACCESS
, SPR_NOACCESS
,
6811 &spr_read_generic
, &spr_write_generic
,
6813 /* XXX : not implemented */
6814 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6815 &spr_read_ureg
, SPR_NOACCESS
,
6816 &spr_read_ureg
, SPR_NOACCESS
,
6818 /* Memory management */
6820 gen_74xx_soft_tlb(env
, 128, 2);
6821 init_excp_7450(env
);
6822 env
->dcache_line_size
= 32;
6823 env
->icache_line_size
= 32;
6824 /* Allocate hardware IRQ controller */
6825 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6828 POWERPC_FAMILY(7450)(ObjectClass
*oc
, void *data
)
6830 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6831 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6833 dc
->desc
= "PowerPC 7450 (aka G4)";
6834 pcc
->init_proc
= init_proc_7450
;
6835 pcc
->check_pow
= check_pow_hid0_74xx
;
6836 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6837 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6838 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6840 PPC_CACHE
| PPC_CACHE_ICBI
|
6841 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6842 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6843 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6844 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6845 PPC_SEGMENT
| PPC_EXTERN
|
6847 pcc
->msr_mask
= (1ull << MSR_VR
) |
6864 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6865 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6866 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6867 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6868 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6869 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6870 POWERPC_FLAG_BUS_CLK
;
6873 static void init_proc_7445 (CPUPPCState
*env
)
6875 gen_spr_ne_601(env
);
6879 /* 74xx specific SPR */
6882 /* XXX : not implemented */
6883 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6884 SPR_NOACCESS
, SPR_NOACCESS
,
6885 &spr_read_generic
, &spr_write_generic
,
6888 /* XXX : not implemented */
6889 spr_register(env
, SPR_ICTRL
, "ICTRL",
6890 SPR_NOACCESS
, SPR_NOACCESS
,
6891 &spr_read_generic
, &spr_write_generic
,
6894 /* XXX : not implemented */
6895 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6896 SPR_NOACCESS
, SPR_NOACCESS
,
6897 &spr_read_generic
, &spr_write_generic
,
6900 /* XXX : not implemented */
6901 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6902 SPR_NOACCESS
, SPR_NOACCESS
,
6903 &spr_read_generic
, &spr_write_generic
,
6905 /* XXX : not implemented */
6906 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6907 &spr_read_ureg
, SPR_NOACCESS
,
6908 &spr_read_ureg
, SPR_NOACCESS
,
6910 /* XXX : not implemented */
6911 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6912 SPR_NOACCESS
, SPR_NOACCESS
,
6913 &spr_read_generic
, &spr_write_generic
,
6915 /* XXX : not implemented */
6916 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6917 &spr_read_ureg
, SPR_NOACCESS
,
6918 &spr_read_ureg
, SPR_NOACCESS
,
6921 spr_register(env
, SPR_SPRG4
, "SPRG4",
6922 SPR_NOACCESS
, SPR_NOACCESS
,
6923 &spr_read_generic
, &spr_write_generic
,
6925 spr_register(env
, SPR_USPRG4
, "USPRG4",
6926 &spr_read_ureg
, SPR_NOACCESS
,
6927 &spr_read_ureg
, SPR_NOACCESS
,
6929 spr_register(env
, SPR_SPRG5
, "SPRG5",
6930 SPR_NOACCESS
, SPR_NOACCESS
,
6931 &spr_read_generic
, &spr_write_generic
,
6933 spr_register(env
, SPR_USPRG5
, "USPRG5",
6934 &spr_read_ureg
, SPR_NOACCESS
,
6935 &spr_read_ureg
, SPR_NOACCESS
,
6937 spr_register(env
, SPR_SPRG6
, "SPRG6",
6938 SPR_NOACCESS
, SPR_NOACCESS
,
6939 &spr_read_generic
, &spr_write_generic
,
6941 spr_register(env
, SPR_USPRG6
, "USPRG6",
6942 &spr_read_ureg
, SPR_NOACCESS
,
6943 &spr_read_ureg
, SPR_NOACCESS
,
6945 spr_register(env
, SPR_SPRG7
, "SPRG7",
6946 SPR_NOACCESS
, SPR_NOACCESS
,
6947 &spr_read_generic
, &spr_write_generic
,
6949 spr_register(env
, SPR_USPRG7
, "USPRG7",
6950 &spr_read_ureg
, SPR_NOACCESS
,
6951 &spr_read_ureg
, SPR_NOACCESS
,
6953 /* Memory management */
6956 gen_74xx_soft_tlb(env
, 128, 2);
6957 init_excp_7450(env
);
6958 env
->dcache_line_size
= 32;
6959 env
->icache_line_size
= 32;
6960 /* Allocate hardware IRQ controller */
6961 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6964 POWERPC_FAMILY(7445)(ObjectClass
*oc
, void *data
)
6966 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6967 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6969 dc
->desc
= "PowerPC 7445 (aka G4)";
6970 pcc
->init_proc
= init_proc_7445
;
6971 pcc
->check_pow
= check_pow_hid0_74xx
;
6972 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6973 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6974 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6976 PPC_CACHE
| PPC_CACHE_ICBI
|
6977 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6978 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6979 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6980 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6981 PPC_SEGMENT
| PPC_EXTERN
|
6983 pcc
->msr_mask
= (1ull << MSR_VR
) |
7000 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7001 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7002 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7003 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7004 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7005 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7006 POWERPC_FLAG_BUS_CLK
;
7009 static void init_proc_7455 (CPUPPCState
*env
)
7011 gen_spr_ne_601(env
);
7015 /* 74xx specific SPR */
7017 /* Level 3 cache control */
7020 /* XXX : not implemented */
7021 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7022 SPR_NOACCESS
, SPR_NOACCESS
,
7023 &spr_read_generic
, &spr_write_generic
,
7026 /* XXX : not implemented */
7027 spr_register(env
, SPR_ICTRL
, "ICTRL",
7028 SPR_NOACCESS
, SPR_NOACCESS
,
7029 &spr_read_generic
, &spr_write_generic
,
7032 /* XXX : not implemented */
7033 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7034 SPR_NOACCESS
, SPR_NOACCESS
,
7035 &spr_read_generic
, &spr_write_generic
,
7038 /* XXX : not implemented */
7039 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7040 SPR_NOACCESS
, SPR_NOACCESS
,
7041 &spr_read_generic
, &spr_write_generic
,
7043 /* XXX : not implemented */
7044 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7045 &spr_read_ureg
, SPR_NOACCESS
,
7046 &spr_read_ureg
, SPR_NOACCESS
,
7048 /* XXX : not implemented */
7049 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7050 SPR_NOACCESS
, SPR_NOACCESS
,
7051 &spr_read_generic
, &spr_write_generic
,
7053 /* XXX : not implemented */
7054 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7055 &spr_read_ureg
, SPR_NOACCESS
,
7056 &spr_read_ureg
, SPR_NOACCESS
,
7059 spr_register(env
, SPR_SPRG4
, "SPRG4",
7060 SPR_NOACCESS
, SPR_NOACCESS
,
7061 &spr_read_generic
, &spr_write_generic
,
7063 spr_register(env
, SPR_USPRG4
, "USPRG4",
7064 &spr_read_ureg
, SPR_NOACCESS
,
7065 &spr_read_ureg
, SPR_NOACCESS
,
7067 spr_register(env
, SPR_SPRG5
, "SPRG5",
7068 SPR_NOACCESS
, SPR_NOACCESS
,
7069 &spr_read_generic
, &spr_write_generic
,
7071 spr_register(env
, SPR_USPRG5
, "USPRG5",
7072 &spr_read_ureg
, SPR_NOACCESS
,
7073 &spr_read_ureg
, SPR_NOACCESS
,
7075 spr_register(env
, SPR_SPRG6
, "SPRG6",
7076 SPR_NOACCESS
, SPR_NOACCESS
,
7077 &spr_read_generic
, &spr_write_generic
,
7079 spr_register(env
, SPR_USPRG6
, "USPRG6",
7080 &spr_read_ureg
, SPR_NOACCESS
,
7081 &spr_read_ureg
, SPR_NOACCESS
,
7083 spr_register(env
, SPR_SPRG7
, "SPRG7",
7084 SPR_NOACCESS
, SPR_NOACCESS
,
7085 &spr_read_generic
, &spr_write_generic
,
7087 spr_register(env
, SPR_USPRG7
, "USPRG7",
7088 &spr_read_ureg
, SPR_NOACCESS
,
7089 &spr_read_ureg
, SPR_NOACCESS
,
7091 /* Memory management */
7094 gen_74xx_soft_tlb(env
, 128, 2);
7095 init_excp_7450(env
);
7096 env
->dcache_line_size
= 32;
7097 env
->icache_line_size
= 32;
7098 /* Allocate hardware IRQ controller */
7099 ppc6xx_irq_init(ppc_env_get_cpu(env
));
7102 POWERPC_FAMILY(7455)(ObjectClass
*oc
, void *data
)
7104 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7105 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7107 dc
->desc
= "PowerPC 7455 (aka G4)";
7108 pcc
->init_proc
= init_proc_7455
;
7109 pcc
->check_pow
= check_pow_hid0_74xx
;
7110 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7111 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7112 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7114 PPC_CACHE
| PPC_CACHE_ICBI
|
7115 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7116 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7117 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7118 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7119 PPC_SEGMENT
| PPC_EXTERN
|
7121 pcc
->msr_mask
= (1ull << MSR_VR
) |
7138 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7139 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7140 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7141 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7142 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7143 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7144 POWERPC_FLAG_BUS_CLK
;
7147 static void init_proc_7457 (CPUPPCState
*env
)
7149 gen_spr_ne_601(env
);
7153 /* 74xx specific SPR */
7155 /* Level 3 cache control */
7158 /* XXX : not implemented */
7159 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
7160 SPR_NOACCESS
, SPR_NOACCESS
,
7161 &spr_read_generic
, &spr_write_generic
,
7164 /* XXX : not implemented */
7165 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
7166 SPR_NOACCESS
, SPR_NOACCESS
,
7167 &spr_read_generic
, &spr_write_generic
,
7170 /* XXX : not implemented */
7171 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
7172 SPR_NOACCESS
, SPR_NOACCESS
,
7173 &spr_read_generic
, &spr_write_generic
,
7176 /* XXX : not implemented */
7177 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
7178 SPR_NOACCESS
, SPR_NOACCESS
,
7179 &spr_read_generic
, &spr_write_generic
,
7182 /* XXX : not implemented */
7183 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7184 SPR_NOACCESS
, SPR_NOACCESS
,
7185 &spr_read_generic
, &spr_write_generic
,
7188 /* XXX : not implemented */
7189 spr_register(env
, SPR_ICTRL
, "ICTRL",
7190 SPR_NOACCESS
, SPR_NOACCESS
,
7191 &spr_read_generic
, &spr_write_generic
,
7194 /* XXX : not implemented */
7195 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7196 SPR_NOACCESS
, SPR_NOACCESS
,
7197 &spr_read_generic
, &spr_write_generic
,
7200 /* XXX : not implemented */
7201 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7202 SPR_NOACCESS
, SPR_NOACCESS
,
7203 &spr_read_generic
, &spr_write_generic
,
7205 /* XXX : not implemented */
7206 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7207 &spr_read_ureg
, SPR_NOACCESS
,
7208 &spr_read_ureg
, SPR_NOACCESS
,
7210 /* XXX : not implemented */
7211 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7212 SPR_NOACCESS
, SPR_NOACCESS
,
7213 &spr_read_generic
, &spr_write_generic
,
7215 /* XXX : not implemented */
7216 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7217 &spr_read_ureg
, SPR_NOACCESS
,
7218 &spr_read_ureg
, SPR_NOACCESS
,
7221 spr_register(env
, SPR_SPRG4
, "SPRG4",
7222 SPR_NOACCESS
, SPR_NOACCESS
,
7223 &spr_read_generic
, &spr_write_generic
,
7225 spr_register(env
, SPR_USPRG4
, "USPRG4",
7226 &spr_read_ureg
, SPR_NOACCESS
,
7227 &spr_read_ureg
, SPR_NOACCESS
,
7229 spr_register(env
, SPR_SPRG5
, "SPRG5",
7230 SPR_NOACCESS
, SPR_NOACCESS
,
7231 &spr_read_generic
, &spr_write_generic
,
7233 spr_register(env
, SPR_USPRG5
, "USPRG5",
7234 &spr_read_ureg
, SPR_NOACCESS
,
7235 &spr_read_ureg
, SPR_NOACCESS
,
7237 spr_register(env
, SPR_SPRG6
, "SPRG6",
7238 SPR_NOACCESS
, SPR_NOACCESS
,
7239 &spr_read_generic
, &spr_write_generic
,
7241 spr_register(env
, SPR_USPRG6
, "USPRG6",
7242 &spr_read_ureg
, SPR_NOACCESS
,
7243 &spr_read_ureg
, SPR_NOACCESS
,
7245 spr_register(env
, SPR_SPRG7
, "SPRG7",
7246 SPR_NOACCESS
, SPR_NOACCESS
,
7247 &spr_read_generic
, &spr_write_generic
,
7249 spr_register(env
, SPR_USPRG7
, "USPRG7",
7250 &spr_read_ureg
, SPR_NOACCESS
,
7251 &spr_read_ureg
, SPR_NOACCESS
,
7253 /* Memory management */
7256 gen_74xx_soft_tlb(env
, 128, 2);
7257 init_excp_7450(env
);
7258 env
->dcache_line_size
= 32;
7259 env
->icache_line_size
= 32;
7260 /* Allocate hardware IRQ controller */
7261 ppc6xx_irq_init(ppc_env_get_cpu(env
));
7264 POWERPC_FAMILY(7457)(ObjectClass
*oc
, void *data
)
7266 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7267 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7269 dc
->desc
= "PowerPC 7457 (aka G4)";
7270 pcc
->init_proc
= init_proc_7457
;
7271 pcc
->check_pow
= check_pow_hid0_74xx
;
7272 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7273 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7274 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7276 PPC_CACHE
| PPC_CACHE_ICBI
|
7277 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7278 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7279 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7280 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7281 PPC_SEGMENT
| PPC_EXTERN
|
7283 pcc
->msr_mask
= (1ull << MSR_VR
) |
7300 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7301 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7302 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7303 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7304 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7305 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7306 POWERPC_FLAG_BUS_CLK
;
7309 static void init_proc_e600 (CPUPPCState
*env
)
7311 gen_spr_ne_601(env
);
7315 /* 74xx specific SPR */
7317 /* XXX : not implemented */
7318 spr_register(env
, SPR_UBAMR
, "UBAMR",
7319 &spr_read_ureg
, SPR_NOACCESS
,
7320 &spr_read_ureg
, SPR_NOACCESS
,
7322 /* XXX : not implemented */
7323 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7324 SPR_NOACCESS
, SPR_NOACCESS
,
7325 &spr_read_generic
, &spr_write_generic
,
7327 /* XXX : not implemented */
7328 spr_register(env
, SPR_ICTRL
, "ICTRL",
7329 SPR_NOACCESS
, SPR_NOACCESS
,
7330 &spr_read_generic
, &spr_write_generic
,
7332 /* XXX : not implemented */
7333 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7334 SPR_NOACCESS
, SPR_NOACCESS
,
7335 &spr_read_generic
, &spr_write_generic
,
7337 /* XXX : not implemented */
7338 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7339 SPR_NOACCESS
, SPR_NOACCESS
,
7340 &spr_read_generic
, &spr_write_generic
,
7342 /* XXX : not implemented */
7343 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7344 &spr_read_ureg
, SPR_NOACCESS
,
7345 &spr_read_ureg
, SPR_NOACCESS
,
7347 /* XXX : not implemented */
7348 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7349 SPR_NOACCESS
, SPR_NOACCESS
,
7350 &spr_read_generic
, &spr_write_generic
,
7352 /* XXX : not implemented */
7353 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7354 &spr_read_ureg
, SPR_NOACCESS
,
7355 &spr_read_ureg
, SPR_NOACCESS
,
7358 spr_register(env
, SPR_SPRG4
, "SPRG4",
7359 SPR_NOACCESS
, SPR_NOACCESS
,
7360 &spr_read_generic
, &spr_write_generic
,
7362 spr_register(env
, SPR_USPRG4
, "USPRG4",
7363 &spr_read_ureg
, SPR_NOACCESS
,
7364 &spr_read_ureg
, SPR_NOACCESS
,
7366 spr_register(env
, SPR_SPRG5
, "SPRG5",
7367 SPR_NOACCESS
, SPR_NOACCESS
,
7368 &spr_read_generic
, &spr_write_generic
,
7370 spr_register(env
, SPR_USPRG5
, "USPRG5",
7371 &spr_read_ureg
, SPR_NOACCESS
,
7372 &spr_read_ureg
, SPR_NOACCESS
,
7374 spr_register(env
, SPR_SPRG6
, "SPRG6",
7375 SPR_NOACCESS
, SPR_NOACCESS
,
7376 &spr_read_generic
, &spr_write_generic
,
7378 spr_register(env
, SPR_USPRG6
, "USPRG6",
7379 &spr_read_ureg
, SPR_NOACCESS
,
7380 &spr_read_ureg
, SPR_NOACCESS
,
7382 spr_register(env
, SPR_SPRG7
, "SPRG7",
7383 SPR_NOACCESS
, SPR_NOACCESS
,
7384 &spr_read_generic
, &spr_write_generic
,
7386 spr_register(env
, SPR_USPRG7
, "USPRG7",
7387 &spr_read_ureg
, SPR_NOACCESS
,
7388 &spr_read_ureg
, SPR_NOACCESS
,
7390 /* Memory management */
7393 gen_74xx_soft_tlb(env
, 128, 2);
7394 init_excp_7450(env
);
7395 env
->dcache_line_size
= 32;
7396 env
->icache_line_size
= 32;
7397 /* Allocate hardware IRQ controller */
7398 ppc6xx_irq_init(ppc_env_get_cpu(env
));
7401 POWERPC_FAMILY(e600
)(ObjectClass
*oc
, void *data
)
7403 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7404 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7406 dc
->desc
= "PowerPC e600";
7407 pcc
->init_proc
= init_proc_e600
;
7408 pcc
->check_pow
= check_pow_hid0_74xx
;
7409 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7410 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7411 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7413 PPC_CACHE
| PPC_CACHE_ICBI
|
7414 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7415 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7416 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7417 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7418 PPC_SEGMENT
| PPC_EXTERN
|
7420 pcc
->insns_flags2
= PPC_NONE
;
7421 pcc
->msr_mask
= (1ull << MSR_VR
) |
7438 pcc
->mmu_model
= POWERPC_MMU_32B
;
7439 #if defined(CONFIG_SOFTMMU)
7440 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
7442 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7443 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7444 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7445 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7446 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7447 POWERPC_FLAG_BUS_CLK
;
7450 #if defined (TARGET_PPC64)
7451 #if defined(CONFIG_USER_ONLY)
7452 #define POWERPC970_HID5_INIT 0x00000080
7454 #define POWERPC970_HID5_INIT 0x00000000
7457 enum BOOK3S_CPU_TYPE
{
7459 BOOK3S_CPU_POWER5PLUS
,
7465 static void gen_fscr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7466 int bit
, int sprn
, int cause
)
7468 TCGv_i32 t1
= tcg_const_i32(bit
);
7469 TCGv_i32 t2
= tcg_const_i32(sprn
);
7470 TCGv_i32 t3
= tcg_const_i32(cause
);
7472 gen_update_current_nip(ctx
);
7473 gen_helper_fscr_facility_check(cpu_env
, t1
, t2
, t3
);
7475 tcg_temp_free_i32(t3
);
7476 tcg_temp_free_i32(t2
);
7477 tcg_temp_free_i32(t1
);
7480 static void gen_msr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7481 int bit
, int sprn
, int cause
)
7483 TCGv_i32 t1
= tcg_const_i32(bit
);
7484 TCGv_i32 t2
= tcg_const_i32(sprn
);
7485 TCGv_i32 t3
= tcg_const_i32(cause
);
7487 gen_update_current_nip(ctx
);
7488 gen_helper_msr_facility_check(cpu_env
, t1
, t2
, t3
);
7490 tcg_temp_free_i32(t3
);
7491 tcg_temp_free_i32(t2
);
7492 tcg_temp_free_i32(t1
);
7495 static void spr_read_prev_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
7497 TCGv spr_up
= tcg_temp_new();
7498 TCGv spr
= tcg_temp_new();
7500 gen_load_spr(spr
, sprn
- 1);
7501 tcg_gen_shri_tl(spr_up
, spr
, 32);
7502 tcg_gen_ext32u_tl(cpu_gpr
[gprn
], spr_up
);
7505 tcg_temp_free(spr_up
);
7508 static void spr_write_prev_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
7510 TCGv spr
= tcg_temp_new();
7512 gen_load_spr(spr
, sprn
- 1);
7513 tcg_gen_deposit_tl(spr
, spr
, cpu_gpr
[gprn
], 32, 32);
7514 gen_store_spr(sprn
- 1, spr
);
7519 static int check_pow_970 (CPUPPCState
*env
)
7521 if (env
->spr
[SPR_HID0
] & (HID0_DEEPNAP
| HID0_DOZE
| HID0_NAP
)) {
7528 static void gen_spr_970_hid(CPUPPCState
*env
)
7530 /* Hardware implementation registers */
7531 /* XXX : not implemented */
7532 spr_register(env
, SPR_HID0
, "HID0",
7533 SPR_NOACCESS
, SPR_NOACCESS
,
7534 &spr_read_generic
, &spr_write_clear
,
7536 spr_register(env
, SPR_HID1
, "HID1",
7537 SPR_NOACCESS
, SPR_NOACCESS
,
7538 &spr_read_generic
, &spr_write_generic
,
7540 spr_register(env
, SPR_970_HID5
, "HID5",
7541 SPR_NOACCESS
, SPR_NOACCESS
,
7542 &spr_read_generic
, &spr_write_generic
,
7543 POWERPC970_HID5_INIT
);
7546 static void gen_spr_970_hior(CPUPPCState
*env
)
7548 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7549 SPR_NOACCESS
, SPR_NOACCESS
,
7550 &spr_read_hior
, &spr_write_hior
,
7554 static void gen_spr_book3s_common(CPUPPCState
*env
)
7556 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
7557 SPR_NOACCESS
, SPR_NOACCESS
,
7558 SPR_NOACCESS
, &spr_write_generic
,
7560 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
7561 &spr_read_ureg
, SPR_NOACCESS
,
7562 &spr_read_ureg
, SPR_NOACCESS
,
7566 static void gen_spr_book3s_altivec(CPUPPCState
*env
)
7568 if (!(env
->insns_flags
& PPC_ALTIVEC
)) {
7572 spr_register_kvm(env
, SPR_VRSAVE
, "VRSAVE",
7573 &spr_read_generic
, &spr_write_generic
,
7574 &spr_read_generic
, &spr_write_generic
,
7575 KVM_REG_PPC_VRSAVE
, 0x00000000);
7577 /* Can't find information on what this should be on reset. This
7578 * value is the one used by 74xx processors. */
7579 vscr_init(env
, 0x00010000);
7582 static void gen_spr_book3s_dbg(CPUPPCState
*env
)
7585 * TODO: different specs define different scopes for these,
7586 * will have to address this:
7587 * 970: super/write and super/read
7588 * powerisa 2.03..2.04: hypv/write and super/read.
7589 * powerisa 2.05 and newer: hypv/write and hypv/read.
7591 spr_register_kvm(env
, SPR_DABR
, "DABR",
7592 SPR_NOACCESS
, SPR_NOACCESS
,
7593 &spr_read_generic
, &spr_write_generic
,
7594 KVM_REG_PPC_DABR
, 0x00000000);
7595 spr_register_kvm(env
, SPR_DABRX
, "DABRX",
7596 SPR_NOACCESS
, SPR_NOACCESS
,
7597 &spr_read_generic
, &spr_write_generic
,
7598 KVM_REG_PPC_DABRX
, 0x00000000);
7601 static void gen_spr_book3s_207_dbg(CPUPPCState
*env
)
7603 spr_register_kvm_hv(env
, SPR_DAWR
, "DAWR",
7604 SPR_NOACCESS
, SPR_NOACCESS
,
7605 SPR_NOACCESS
, SPR_NOACCESS
,
7606 &spr_read_generic
, &spr_write_generic
,
7607 KVM_REG_PPC_DAWR
, 0x00000000);
7608 spr_register_kvm_hv(env
, SPR_DAWRX
, "DAWRX",
7609 SPR_NOACCESS
, SPR_NOACCESS
,
7610 SPR_NOACCESS
, SPR_NOACCESS
,
7611 &spr_read_generic
, &spr_write_generic
,
7612 KVM_REG_PPC_DAWRX
, 0x00000000);
7613 spr_register_kvm_hv(env
, SPR_CIABR
, "CIABR",
7614 SPR_NOACCESS
, SPR_NOACCESS
,
7615 SPR_NOACCESS
, SPR_NOACCESS
,
7616 &spr_read_generic
, &spr_write_generic
,
7617 KVM_REG_PPC_CIABR
, 0x00000000);
7620 static void gen_spr_970_dbg(CPUPPCState
*env
)
7623 spr_register(env
, SPR_IABR
, "IABR",
7624 SPR_NOACCESS
, SPR_NOACCESS
,
7625 &spr_read_generic
, &spr_write_generic
,
7629 static void gen_spr_book3s_pmu_sup(CPUPPCState
*env
)
7631 spr_register_kvm(env
, SPR_POWER_MMCR0
, "MMCR0",
7632 SPR_NOACCESS
, SPR_NOACCESS
,
7633 &spr_read_generic
, &spr_write_generic
,
7634 KVM_REG_PPC_MMCR0
, 0x00000000);
7635 spr_register_kvm(env
, SPR_POWER_MMCR1
, "MMCR1",
7636 SPR_NOACCESS
, SPR_NOACCESS
,
7637 &spr_read_generic
, &spr_write_generic
,
7638 KVM_REG_PPC_MMCR1
, 0x00000000);
7639 spr_register_kvm(env
, SPR_POWER_MMCRA
, "MMCRA",
7640 SPR_NOACCESS
, SPR_NOACCESS
,
7641 &spr_read_generic
, &spr_write_generic
,
7642 KVM_REG_PPC_MMCRA
, 0x00000000);
7643 spr_register_kvm(env
, SPR_POWER_PMC1
, "PMC1",
7644 SPR_NOACCESS
, SPR_NOACCESS
,
7645 &spr_read_generic
, &spr_write_generic
,
7646 KVM_REG_PPC_PMC1
, 0x00000000);
7647 spr_register_kvm(env
, SPR_POWER_PMC2
, "PMC2",
7648 SPR_NOACCESS
, SPR_NOACCESS
,
7649 &spr_read_generic
, &spr_write_generic
,
7650 KVM_REG_PPC_PMC2
, 0x00000000);
7651 spr_register_kvm(env
, SPR_POWER_PMC3
, "PMC3",
7652 SPR_NOACCESS
, SPR_NOACCESS
,
7653 &spr_read_generic
, &spr_write_generic
,
7654 KVM_REG_PPC_PMC3
, 0x00000000);
7655 spr_register_kvm(env
, SPR_POWER_PMC4
, "PMC4",
7656 SPR_NOACCESS
, SPR_NOACCESS
,
7657 &spr_read_generic
, &spr_write_generic
,
7658 KVM_REG_PPC_PMC4
, 0x00000000);
7659 spr_register_kvm(env
, SPR_POWER_PMC5
, "PMC5",
7660 SPR_NOACCESS
, SPR_NOACCESS
,
7661 &spr_read_generic
, &spr_write_generic
,
7662 KVM_REG_PPC_PMC5
, 0x00000000);
7663 spr_register_kvm(env
, SPR_POWER_PMC6
, "PMC6",
7664 SPR_NOACCESS
, SPR_NOACCESS
,
7665 &spr_read_generic
, &spr_write_generic
,
7666 KVM_REG_PPC_PMC6
, 0x00000000);
7667 spr_register_kvm(env
, SPR_POWER_SIAR
, "SIAR",
7668 SPR_NOACCESS
, SPR_NOACCESS
,
7669 &spr_read_generic
, &spr_write_generic
,
7670 KVM_REG_PPC_SIAR
, 0x00000000);
7671 spr_register_kvm(env
, SPR_POWER_SDAR
, "SDAR",
7672 SPR_NOACCESS
, SPR_NOACCESS
,
7673 &spr_read_generic
, &spr_write_generic
,
7674 KVM_REG_PPC_SDAR
, 0x00000000);
7677 static void gen_spr_book3s_pmu_user(CPUPPCState
*env
)
7679 spr_register(env
, SPR_POWER_UMMCR0
, "UMMCR0",
7680 &spr_read_ureg
, SPR_NOACCESS
,
7681 &spr_read_ureg
, &spr_write_ureg
,
7683 spr_register(env
, SPR_POWER_UMMCR1
, "UMMCR1",
7684 &spr_read_ureg
, SPR_NOACCESS
,
7685 &spr_read_ureg
, &spr_write_ureg
,
7687 spr_register(env
, SPR_POWER_UMMCRA
, "UMMCRA",
7688 &spr_read_ureg
, SPR_NOACCESS
,
7689 &spr_read_ureg
, &spr_write_ureg
,
7691 spr_register(env
, SPR_POWER_UPMC1
, "UPMC1",
7692 &spr_read_ureg
, SPR_NOACCESS
,
7693 &spr_read_ureg
, &spr_write_ureg
,
7695 spr_register(env
, SPR_POWER_UPMC2
, "UPMC2",
7696 &spr_read_ureg
, SPR_NOACCESS
,
7697 &spr_read_ureg
, &spr_write_ureg
,
7699 spr_register(env
, SPR_POWER_UPMC3
, "UPMC3",
7700 &spr_read_ureg
, SPR_NOACCESS
,
7701 &spr_read_ureg
, &spr_write_ureg
,
7703 spr_register(env
, SPR_POWER_UPMC4
, "UPMC4",
7704 &spr_read_ureg
, SPR_NOACCESS
,
7705 &spr_read_ureg
, &spr_write_ureg
,
7707 spr_register(env
, SPR_POWER_UPMC5
, "UPMC5",
7708 &spr_read_ureg
, SPR_NOACCESS
,
7709 &spr_read_ureg
, &spr_write_ureg
,
7711 spr_register(env
, SPR_POWER_UPMC6
, "UPMC6",
7712 &spr_read_ureg
, SPR_NOACCESS
,
7713 &spr_read_ureg
, &spr_write_ureg
,
7715 spr_register(env
, SPR_POWER_USIAR
, "USIAR",
7716 &spr_read_ureg
, SPR_NOACCESS
,
7717 &spr_read_ureg
, &spr_write_ureg
,
7719 spr_register(env
, SPR_POWER_USDAR
, "USDAR",
7720 &spr_read_ureg
, SPR_NOACCESS
,
7721 &spr_read_ureg
, &spr_write_ureg
,
7725 static void gen_spr_970_pmu_sup(CPUPPCState
*env
)
7727 spr_register_kvm(env
, SPR_970_PMC7
, "PMC7",
7728 SPR_NOACCESS
, SPR_NOACCESS
,
7729 &spr_read_generic
, &spr_write_generic
,
7730 KVM_REG_PPC_PMC7
, 0x00000000);
7731 spr_register_kvm(env
, SPR_970_PMC8
, "PMC8",
7732 SPR_NOACCESS
, SPR_NOACCESS
,
7733 &spr_read_generic
, &spr_write_generic
,
7734 KVM_REG_PPC_PMC8
, 0x00000000);
7737 static void gen_spr_970_pmu_user(CPUPPCState
*env
)
7739 spr_register(env
, SPR_970_UPMC7
, "UPMC7",
7740 &spr_read_ureg
, SPR_NOACCESS
,
7741 &spr_read_ureg
, &spr_write_ureg
,
7743 spr_register(env
, SPR_970_UPMC8
, "UPMC8",
7744 &spr_read_ureg
, SPR_NOACCESS
,
7745 &spr_read_ureg
, &spr_write_ureg
,
7749 static void gen_spr_power8_pmu_sup(CPUPPCState
*env
)
7751 spr_register_kvm(env
, SPR_POWER_MMCR2
, "MMCR2",
7752 SPR_NOACCESS
, SPR_NOACCESS
,
7753 &spr_read_generic
, &spr_write_generic
,
7754 KVM_REG_PPC_MMCR2
, 0x00000000);
7755 spr_register_kvm(env
, SPR_POWER_MMCRS
, "MMCRS",
7756 SPR_NOACCESS
, SPR_NOACCESS
,
7757 &spr_read_generic
, &spr_write_generic
,
7758 KVM_REG_PPC_MMCRS
, 0x00000000);
7759 spr_register_kvm(env
, SPR_POWER_SIER
, "SIER",
7760 SPR_NOACCESS
, SPR_NOACCESS
,
7761 &spr_read_generic
, &spr_write_generic
,
7762 KVM_REG_PPC_SIER
, 0x00000000);
7763 spr_register_kvm(env
, SPR_POWER_SPMC1
, "SPMC1",
7764 SPR_NOACCESS
, SPR_NOACCESS
,
7765 &spr_read_generic
, &spr_write_generic
,
7766 KVM_REG_PPC_SPMC1
, 0x00000000);
7767 spr_register_kvm(env
, SPR_POWER_SPMC2
, "SPMC2",
7768 SPR_NOACCESS
, SPR_NOACCESS
,
7769 &spr_read_generic
, &spr_write_generic
,
7770 KVM_REG_PPC_SPMC2
, 0x00000000);
7771 spr_register_kvm(env
, SPR_TACR
, "TACR",
7772 SPR_NOACCESS
, SPR_NOACCESS
,
7773 &spr_read_generic
, &spr_write_generic
,
7774 KVM_REG_PPC_TACR
, 0x00000000);
7775 spr_register_kvm(env
, SPR_TCSCR
, "TCSCR",
7776 SPR_NOACCESS
, SPR_NOACCESS
,
7777 &spr_read_generic
, &spr_write_generic
,
7778 KVM_REG_PPC_TCSCR
, 0x00000000);
7779 spr_register_kvm(env
, SPR_CSIGR
, "CSIGR",
7780 SPR_NOACCESS
, SPR_NOACCESS
,
7781 &spr_read_generic
, &spr_write_generic
,
7782 KVM_REG_PPC_CSIGR
, 0x00000000);
7785 static void gen_spr_power8_pmu_user(CPUPPCState
*env
)
7787 spr_register(env
, SPR_POWER_UMMCR2
, "UMMCR2",
7788 &spr_read_ureg
, SPR_NOACCESS
,
7789 &spr_read_ureg
, &spr_write_ureg
,
7791 spr_register(env
, SPR_POWER_USIER
, "USIER",
7792 &spr_read_generic
, SPR_NOACCESS
,
7793 &spr_read_generic
, &spr_write_generic
,
7797 static void gen_spr_power5p_ear(CPUPPCState
*env
)
7799 /* External access control */
7800 spr_register(env
, SPR_EAR
, "EAR",
7801 SPR_NOACCESS
, SPR_NOACCESS
,
7802 &spr_read_generic
, &spr_write_generic
,
7806 #if !defined(CONFIG_USER_ONLY)
7807 static void spr_write_hmer(DisasContext
*ctx
, int sprn
, int gprn
)
7809 TCGv hmer
= tcg_temp_new();
7811 gen_load_spr(hmer
, sprn
);
7812 tcg_gen_and_tl(hmer
, cpu_gpr
[gprn
], hmer
);
7813 gen_store_spr(sprn
, hmer
);
7814 spr_store_dump_spr(sprn
);
7815 tcg_temp_free(hmer
);
7818 static void spr_write_lpcr(DisasContext
*ctx
, int sprn
, int gprn
)
7820 gen_helper_store_lpcr(cpu_env
, cpu_gpr
[gprn
]);
7823 static void spr_write_970_hid4(DisasContext
*ctx
, int sprn
, int gprn
)
7825 #if defined(TARGET_PPC64)
7826 spr_write_generic(ctx
, sprn
, gprn
);
7827 gen_helper_store_lpcr(cpu_env
, cpu_gpr
[gprn
]);
7831 #endif /* !defined(CONFIG_USER_ONLY) */
7833 static void gen_spr_970_lpar(CPUPPCState
*env
)
7835 #if !defined(CONFIG_USER_ONLY)
7836 /* Logical partitionning */
7837 /* PPC970: HID4 is effectively the LPCR */
7838 spr_register(env
, SPR_970_HID4
, "HID4",
7839 SPR_NOACCESS
, SPR_NOACCESS
,
7840 &spr_read_generic
, &spr_write_970_hid4
,
7845 static void gen_spr_power5p_lpar(CPUPPCState
*env
)
7847 #if !defined(CONFIG_USER_ONLY)
7848 /* Logical partitionning */
7849 spr_register_kvm_hv(env
, SPR_LPCR
, "LPCR",
7850 SPR_NOACCESS
, SPR_NOACCESS
,
7851 SPR_NOACCESS
, SPR_NOACCESS
,
7852 &spr_read_generic
, &spr_write_lpcr
,
7853 KVM_REG_PPC_LPCR
, LPCR_LPES0
| LPCR_LPES1
);
7854 spr_register_hv(env
, SPR_HDEC
, "HDEC",
7855 SPR_NOACCESS
, SPR_NOACCESS
,
7856 SPR_NOACCESS
, SPR_NOACCESS
,
7857 &spr_read_hdecr
, &spr_write_hdecr
, 0);
7861 static void gen_spr_book3s_ids(CPUPPCState
*env
)
7863 /* FIXME: Will need to deal with thread vs core only SPRs */
7865 /* Processor identification */
7866 spr_register_hv(env
, SPR_PIR
, "PIR",
7867 SPR_NOACCESS
, SPR_NOACCESS
,
7868 SPR_NOACCESS
, SPR_NOACCESS
,
7869 &spr_read_generic
, NULL
,
7871 spr_register_hv(env
, SPR_HID0
, "HID0",
7872 SPR_NOACCESS
, SPR_NOACCESS
,
7873 SPR_NOACCESS
, SPR_NOACCESS
,
7874 &spr_read_generic
, &spr_write_generic
,
7876 spr_register_hv(env
, SPR_TSCR
, "TSCR",
7877 SPR_NOACCESS
, SPR_NOACCESS
,
7878 SPR_NOACCESS
, SPR_NOACCESS
,
7879 &spr_read_generic
, &spr_write_generic
,
7881 spr_register_hv(env
, SPR_HMER
, "HMER",
7882 SPR_NOACCESS
, SPR_NOACCESS
,
7883 SPR_NOACCESS
, SPR_NOACCESS
,
7884 &spr_read_generic
, &spr_write_hmer
,
7886 spr_register_hv(env
, SPR_HMEER
, "HMEER",
7887 SPR_NOACCESS
, SPR_NOACCESS
,
7888 SPR_NOACCESS
, SPR_NOACCESS
,
7889 &spr_read_generic
, &spr_write_generic
,
7891 spr_register_hv(env
, SPR_TFMR
, "TFMR",
7892 SPR_NOACCESS
, SPR_NOACCESS
,
7893 SPR_NOACCESS
, SPR_NOACCESS
,
7894 &spr_read_generic
, &spr_write_generic
,
7896 spr_register_hv(env
, SPR_LPIDR
, "LPIDR",
7897 SPR_NOACCESS
, SPR_NOACCESS
,
7898 SPR_NOACCESS
, SPR_NOACCESS
,
7899 &spr_read_generic
, &spr_write_generic
,
7901 spr_register_hv(env
, SPR_HFSCR
, "HFSCR",
7902 SPR_NOACCESS
, SPR_NOACCESS
,
7903 SPR_NOACCESS
, SPR_NOACCESS
,
7904 &spr_read_generic
, &spr_write_generic
,
7906 spr_register_hv(env
, SPR_MMCRC
, "MMCRC",
7907 SPR_NOACCESS
, SPR_NOACCESS
,
7908 SPR_NOACCESS
, SPR_NOACCESS
,
7909 &spr_read_generic
, &spr_write_generic
,
7911 spr_register_hv(env
, SPR_MMCRH
, "MMCRH",
7912 SPR_NOACCESS
, SPR_NOACCESS
,
7913 SPR_NOACCESS
, SPR_NOACCESS
,
7914 &spr_read_generic
, &spr_write_generic
,
7916 spr_register_hv(env
, SPR_HSPRG0
, "HSPRG0",
7917 SPR_NOACCESS
, SPR_NOACCESS
,
7918 SPR_NOACCESS
, SPR_NOACCESS
,
7919 &spr_read_generic
, &spr_write_generic
,
7921 spr_register_hv(env
, SPR_HSPRG1
, "HSPRG1",
7922 SPR_NOACCESS
, SPR_NOACCESS
,
7923 SPR_NOACCESS
, SPR_NOACCESS
,
7924 &spr_read_generic
, &spr_write_generic
,
7926 spr_register_hv(env
, SPR_HSRR0
, "HSRR0",
7927 SPR_NOACCESS
, SPR_NOACCESS
,
7928 SPR_NOACCESS
, SPR_NOACCESS
,
7929 &spr_read_generic
, &spr_write_generic
,
7931 spr_register_hv(env
, SPR_HSRR1
, "HSRR1",
7932 SPR_NOACCESS
, SPR_NOACCESS
,
7933 SPR_NOACCESS
, SPR_NOACCESS
,
7934 &spr_read_generic
, &spr_write_generic
,
7936 spr_register_hv(env
, SPR_HDAR
, "HDAR",
7937 SPR_NOACCESS
, SPR_NOACCESS
,
7938 SPR_NOACCESS
, SPR_NOACCESS
,
7939 &spr_read_generic
, &spr_write_generic
,
7941 spr_register_hv(env
, SPR_HDSISR
, "HDSISR",
7942 SPR_NOACCESS
, SPR_NOACCESS
,
7943 SPR_NOACCESS
, SPR_NOACCESS
,
7944 &spr_read_generic
, &spr_write_generic
,
7946 spr_register_hv(env
, SPR_RMOR
, "RMOR",
7947 SPR_NOACCESS
, SPR_NOACCESS
,
7948 SPR_NOACCESS
, SPR_NOACCESS
,
7949 &spr_read_generic
, &spr_write_generic
,
7951 spr_register_hv(env
, SPR_HRMOR
, "HRMOR",
7952 SPR_NOACCESS
, SPR_NOACCESS
,
7953 SPR_NOACCESS
, SPR_NOACCESS
,
7954 &spr_read_generic
, &spr_write_generic
,
7958 static void gen_spr_power8_ids(CPUPPCState
*env
)
7960 /* Thread identification */
7961 spr_register(env
, SPR_TIR
, "TIR",
7962 SPR_NOACCESS
, SPR_NOACCESS
,
7963 &spr_read_generic
, SPR_NOACCESS
,
7967 static void gen_spr_book3s_purr(CPUPPCState
*env
)
7969 #if !defined(CONFIG_USER_ONLY)
7970 /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
7971 spr_register_kvm(env
, SPR_PURR
, "PURR",
7972 &spr_read_purr
, SPR_NOACCESS
,
7973 &spr_read_purr
, SPR_NOACCESS
,
7974 KVM_REG_PPC_PURR
, 0x00000000);
7975 spr_register_kvm(env
, SPR_SPURR
, "SPURR",
7976 &spr_read_purr
, SPR_NOACCESS
,
7977 &spr_read_purr
, SPR_NOACCESS
,
7978 KVM_REG_PPC_SPURR
, 0x00000000);
7982 static void gen_spr_power6_dbg(CPUPPCState
*env
)
7984 #if !defined(CONFIG_USER_ONLY)
7985 spr_register(env
, SPR_CFAR
, "SPR_CFAR",
7986 SPR_NOACCESS
, SPR_NOACCESS
,
7987 &spr_read_cfar
, &spr_write_cfar
,
7992 static void gen_spr_power5p_common(CPUPPCState
*env
)
7994 spr_register_kvm(env
, SPR_PPR
, "PPR",
7995 &spr_read_generic
, &spr_write_generic
,
7996 &spr_read_generic
, &spr_write_generic
,
7997 KVM_REG_PPC_PPR
, 0x00000000);
8000 static void gen_spr_power6_common(CPUPPCState
*env
)
8002 #if !defined(CONFIG_USER_ONLY)
8003 spr_register_kvm(env
, SPR_DSCR
, "SPR_DSCR",
8004 SPR_NOACCESS
, SPR_NOACCESS
,
8005 &spr_read_generic
, &spr_write_generic
,
8006 KVM_REG_PPC_DSCR
, 0x00000000);
8009 * Register PCR to report POWERPC_EXCP_PRIV_REG instead of
8010 * POWERPC_EXCP_INVAL_SPR.
8012 spr_register(env
, SPR_PCR
, "PCR",
8013 SPR_NOACCESS
, SPR_NOACCESS
,
8014 SPR_NOACCESS
, SPR_NOACCESS
,
8018 static void spr_read_tar(DisasContext
*ctx
, int gprn
, int sprn
)
8020 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
8021 spr_read_generic(ctx
, gprn
, sprn
);
8024 static void spr_write_tar(DisasContext
*ctx
, int sprn
, int gprn
)
8026 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
8027 spr_write_generic(ctx
, sprn
, gprn
);
8030 static void gen_spr_power8_tce_address_control(CPUPPCState
*env
)
8032 spr_register_kvm(env
, SPR_TAR
, "TAR",
8033 &spr_read_tar
, &spr_write_tar
,
8034 &spr_read_generic
, &spr_write_generic
,
8035 KVM_REG_PPC_TAR
, 0x00000000);
8038 static void spr_read_tm(DisasContext
*ctx
, int gprn
, int sprn
)
8040 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8041 spr_read_generic(ctx
, gprn
, sprn
);
8044 static void spr_write_tm(DisasContext
*ctx
, int sprn
, int gprn
)
8046 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8047 spr_write_generic(ctx
, sprn
, gprn
);
8050 static void spr_read_tm_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
8052 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8053 spr_read_prev_upper32(ctx
, gprn
, sprn
);
8056 static void spr_write_tm_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
8058 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8059 spr_write_prev_upper32(ctx
, sprn
, gprn
);
8062 static void gen_spr_power8_tm(CPUPPCState
*env
)
8064 spr_register_kvm(env
, SPR_TFHAR
, "TFHAR",
8065 &spr_read_tm
, &spr_write_tm
,
8066 &spr_read_tm
, &spr_write_tm
,
8067 KVM_REG_PPC_TFHAR
, 0x00000000);
8068 spr_register_kvm(env
, SPR_TFIAR
, "TFIAR",
8069 &spr_read_tm
, &spr_write_tm
,
8070 &spr_read_tm
, &spr_write_tm
,
8071 KVM_REG_PPC_TFIAR
, 0x00000000);
8072 spr_register_kvm(env
, SPR_TEXASR
, "TEXASR",
8073 &spr_read_tm
, &spr_write_tm
,
8074 &spr_read_tm
, &spr_write_tm
,
8075 KVM_REG_PPC_TEXASR
, 0x00000000);
8076 spr_register(env
, SPR_TEXASRU
, "TEXASRU",
8077 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
8078 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
8082 static void spr_read_ebb(DisasContext
*ctx
, int gprn
, int sprn
)
8084 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8085 spr_read_generic(ctx
, gprn
, sprn
);
8088 static void spr_write_ebb(DisasContext
*ctx
, int sprn
, int gprn
)
8090 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8091 spr_write_generic(ctx
, sprn
, gprn
);
8094 static void spr_read_ebb_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
8096 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8097 spr_read_prev_upper32(ctx
, gprn
, sprn
);
8100 static void spr_write_ebb_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
8102 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8103 spr_write_prev_upper32(ctx
, sprn
, gprn
);
8106 static void gen_spr_power8_ebb(CPUPPCState
*env
)
8108 spr_register(env
, SPR_BESCRS
, "BESCRS",
8109 &spr_read_ebb
, &spr_write_ebb
,
8110 &spr_read_generic
, &spr_write_generic
,
8112 spr_register(env
, SPR_BESCRSU
, "BESCRSU",
8113 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
8114 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
8116 spr_register(env
, SPR_BESCRR
, "BESCRR",
8117 &spr_read_ebb
, &spr_write_ebb
,
8118 &spr_read_generic
, &spr_write_generic
,
8120 spr_register(env
, SPR_BESCRRU
, "BESCRRU",
8121 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
8122 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
8124 spr_register_kvm(env
, SPR_EBBHR
, "EBBHR",
8125 &spr_read_ebb
, &spr_write_ebb
,
8126 &spr_read_generic
, &spr_write_generic
,
8127 KVM_REG_PPC_EBBHR
, 0x00000000);
8128 spr_register_kvm(env
, SPR_EBBRR
, "EBBRR",
8129 &spr_read_ebb
, &spr_write_ebb
,
8130 &spr_read_generic
, &spr_write_generic
,
8131 KVM_REG_PPC_EBBRR
, 0x00000000);
8132 spr_register_kvm(env
, SPR_BESCR
, "BESCR",
8133 &spr_read_ebb
, &spr_write_ebb
,
8134 &spr_read_generic
, &spr_write_generic
,
8135 KVM_REG_PPC_BESCR
, 0x00000000);
8138 /* Virtual Time Base */
8139 static void gen_spr_vtb(CPUPPCState
*env
)
8141 spr_register(env
, SPR_VTB
, "VTB",
8142 SPR_NOACCESS
, SPR_NOACCESS
,
8143 &spr_read_tbl
, SPR_NOACCESS
,
8147 static void gen_spr_power8_fscr(CPUPPCState
*env
)
8149 #if defined(CONFIG_USER_ONLY)
8150 target_ulong initval
= 1ULL << FSCR_TAR
;
8152 target_ulong initval
= 0;
8154 spr_register_kvm(env
, SPR_FSCR
, "FSCR",
8155 SPR_NOACCESS
, SPR_NOACCESS
,
8156 &spr_read_generic
, &spr_write_generic
,
8157 KVM_REG_PPC_FSCR
, initval
);
8160 static void gen_spr_power8_pspb(CPUPPCState
*env
)
8162 spr_register_kvm(env
, SPR_PSPB
, "PSPB",
8163 SPR_NOACCESS
, SPR_NOACCESS
,
8164 &spr_read_generic
, &spr_write_generic32
,
8165 KVM_REG_PPC_PSPB
, 0);
8168 static void gen_spr_power8_ic(CPUPPCState
*env
)
8170 #if !defined(CONFIG_USER_ONLY)
8171 spr_register_hv(env
, SPR_IC
, "IC",
8172 SPR_NOACCESS
, SPR_NOACCESS
,
8173 &spr_read_generic
, SPR_NOACCESS
,
8174 &spr_read_generic
, &spr_write_generic
,
8179 static void gen_spr_power8_book4(CPUPPCState
*env
)
8181 /* Add a number of P8 book4 registers */
8182 #if !defined(CONFIG_USER_ONLY)
8183 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
8184 SPR_NOACCESS
, SPR_NOACCESS
,
8185 &spr_read_generic
, &spr_write_generic
,
8186 KVM_REG_PPC_ACOP
, 0);
8187 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
8188 SPR_NOACCESS
, SPR_NOACCESS
,
8189 &spr_read_generic
, &spr_write_generic
,
8190 KVM_REG_PPC_PID
, 0);
8191 spr_register_kvm(env
, SPR_WORT
, "WORT",
8192 SPR_NOACCESS
, SPR_NOACCESS
,
8193 &spr_read_generic
, &spr_write_generic
,
8194 KVM_REG_PPC_WORT
, 0);
8198 static void gen_spr_power7_book4(CPUPPCState
*env
)
8200 /* Add a number of P7 book4 registers */
8201 #if !defined(CONFIG_USER_ONLY)
8202 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
8203 SPR_NOACCESS
, SPR_NOACCESS
,
8204 &spr_read_generic
, &spr_write_generic
,
8205 KVM_REG_PPC_ACOP
, 0);
8206 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
8207 SPR_NOACCESS
, SPR_NOACCESS
,
8208 &spr_read_generic
, &spr_write_generic
,
8209 KVM_REG_PPC_PID
, 0);
8213 static void gen_spr_power8_rpr(CPUPPCState
*env
)
8215 #if !defined(CONFIG_USER_ONLY)
8216 spr_register_hv(env
, SPR_RPR
, "RPR",
8217 SPR_NOACCESS
, SPR_NOACCESS
,
8218 SPR_NOACCESS
, SPR_NOACCESS
,
8219 &spr_read_generic
, &spr_write_generic
,
8220 0x00000103070F1F3F);
8224 static void init_proc_book3s_64(CPUPPCState
*env
, int version
)
8226 gen_spr_ne_601(env
);
8228 gen_spr_book3s_altivec(env
);
8229 gen_spr_book3s_pmu_sup(env
);
8230 gen_spr_book3s_pmu_user(env
);
8231 gen_spr_book3s_common(env
);
8234 case BOOK3S_CPU_970
:
8235 case BOOK3S_CPU_POWER5PLUS
:
8236 gen_spr_970_hid(env
);
8237 gen_spr_970_hior(env
);
8239 gen_spr_970_pmu_sup(env
);
8240 gen_spr_970_pmu_user(env
);
8242 case BOOK3S_CPU_POWER7
:
8243 case BOOK3S_CPU_POWER8
:
8244 gen_spr_book3s_ids(env
);
8245 gen_spr_amr(env
, version
>= BOOK3S_CPU_POWER8
);
8246 gen_spr_book3s_purr(env
);
8247 env
->ci_large_pages
= true;
8250 g_assert_not_reached();
8252 if (version
>= BOOK3S_CPU_POWER5PLUS
) {
8253 gen_spr_power5p_common(env
);
8254 gen_spr_power5p_lpar(env
);
8255 gen_spr_power5p_ear(env
);
8257 gen_spr_970_lpar(env
);
8259 if (version
== BOOK3S_CPU_970
) {
8260 gen_spr_970_dbg(env
);
8262 if (version
>= BOOK3S_CPU_POWER6
) {
8263 gen_spr_power6_common(env
);
8264 gen_spr_power6_dbg(env
);
8266 if (version
== BOOK3S_CPU_POWER7
) {
8267 gen_spr_power7_book4(env
);
8269 if (version
>= BOOK3S_CPU_POWER8
) {
8270 gen_spr_power8_tce_address_control(env
);
8271 gen_spr_power8_ids(env
);
8272 gen_spr_power8_ebb(env
);
8273 gen_spr_power8_fscr(env
);
8274 gen_spr_power8_pmu_sup(env
);
8275 gen_spr_power8_pmu_user(env
);
8276 gen_spr_power8_tm(env
);
8277 gen_spr_power8_pspb(env
);
8279 gen_spr_power8_ic(env
);
8280 gen_spr_power8_book4(env
);
8281 gen_spr_power8_rpr(env
);
8283 if (version
< BOOK3S_CPU_POWER8
) {
8284 gen_spr_book3s_dbg(env
);
8286 gen_spr_book3s_207_dbg(env
);
8288 #if !defined(CONFIG_USER_ONLY)
8290 case BOOK3S_CPU_970
:
8291 case BOOK3S_CPU_POWER5PLUS
:
8294 case BOOK3S_CPU_POWER7
:
8295 case BOOK3S_CPU_POWER8
:
8301 /* Allocate hardware IRQ controller */
8303 case BOOK3S_CPU_970
:
8304 case BOOK3S_CPU_POWER5PLUS
:
8306 ppc970_irq_init(ppc_env_get_cpu(env
));
8308 case BOOK3S_CPU_POWER7
:
8309 init_excp_POWER7(env
);
8310 ppcPOWER7_irq_init(ppc_env_get_cpu(env
));
8312 case BOOK3S_CPU_POWER8
:
8313 init_excp_POWER8(env
);
8314 ppcPOWER7_irq_init(ppc_env_get_cpu(env
));
8317 g_assert_not_reached();
8320 env
->dcache_line_size
= 128;
8321 env
->icache_line_size
= 128;
8324 static void init_proc_970(CPUPPCState
*env
)
8326 init_proc_book3s_64(env
, BOOK3S_CPU_970
);
8329 POWERPC_FAMILY(970)(ObjectClass
*oc
, void *data
)
8331 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8332 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8334 dc
->desc
= "PowerPC 970";
8335 pcc
->init_proc
= init_proc_970
;
8336 pcc
->check_pow
= check_pow_970
;
8337 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8338 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8339 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8341 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8342 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8343 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8344 PPC_64B
| PPC_ALTIVEC
|
8345 PPC_SEGMENT_64B
| PPC_SLBI
;
8346 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8347 pcc
->msr_mask
= (1ull << MSR_SF
) |
8362 pcc
->mmu_model
= POWERPC_MMU_64B
;
8363 #if defined(CONFIG_SOFTMMU)
8364 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8366 pcc
->excp_model
= POWERPC_EXCP_970
;
8367 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8368 pcc
->bfd_mach
= bfd_mach_ppc64
;
8369 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8370 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8371 POWERPC_FLAG_BUS_CLK
;
8372 pcc
->l1_dcache_size
= 0x8000;
8373 pcc
->l1_icache_size
= 0x10000;
8376 static void init_proc_power5plus(CPUPPCState
*env
)
8378 init_proc_book3s_64(env
, BOOK3S_CPU_POWER5PLUS
);
8381 POWERPC_FAMILY(POWER5P
)(ObjectClass
*oc
, void *data
)
8383 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8384 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8386 dc
->fw_name
= "PowerPC,POWER5";
8387 dc
->desc
= "POWER5+";
8388 pcc
->init_proc
= init_proc_power5plus
;
8389 pcc
->check_pow
= check_pow_970
;
8390 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8391 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8392 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8394 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8395 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8396 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8398 PPC_SEGMENT_64B
| PPC_SLBI
;
8399 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8400 pcc
->msr_mask
= (1ull << MSR_SF
) |
8415 pcc
->mmu_model
= POWERPC_MMU_2_03
;
8416 #if defined(CONFIG_SOFTMMU)
8417 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8419 pcc
->excp_model
= POWERPC_EXCP_970
;
8420 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8421 pcc
->bfd_mach
= bfd_mach_ppc64
;
8422 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8423 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8424 POWERPC_FLAG_BUS_CLK
;
8425 pcc
->l1_dcache_size
= 0x8000;
8426 pcc
->l1_icache_size
= 0x10000;
8429 static void powerpc_get_compat(Object
*obj
, Visitor
*v
, const char *name
,
8430 void *opaque
, Error
**errp
)
8432 char *value
= (char *)"";
8433 Property
*prop
= opaque
;
8434 uint32_t *max_compat
= qdev_get_prop_ptr(DEVICE(obj
), prop
);
8436 switch (*max_compat
) {
8437 case CPU_POWERPC_LOGICAL_2_05
:
8438 value
= (char *)"power6";
8440 case CPU_POWERPC_LOGICAL_2_06
:
8441 value
= (char *)"power7";
8443 case CPU_POWERPC_LOGICAL_2_07
:
8444 value
= (char *)"power8";
8449 error_report("Internal error: compat is set to %x", *max_compat
);
8454 visit_type_str(v
, name
, &value
, errp
);
8457 static void powerpc_set_compat(Object
*obj
, Visitor
*v
, const char *name
,
8458 void *opaque
, Error
**errp
)
8460 Error
*error
= NULL
;
8462 Property
*prop
= opaque
;
8463 uint32_t *max_compat
= qdev_get_prop_ptr(DEVICE(obj
), prop
);
8465 visit_type_str(v
, name
, &value
, &error
);
8467 error_propagate(errp
, error
);
8471 if (strcmp(value
, "power6") == 0) {
8472 *max_compat
= CPU_POWERPC_LOGICAL_2_05
;
8473 } else if (strcmp(value
, "power7") == 0) {
8474 *max_compat
= CPU_POWERPC_LOGICAL_2_06
;
8475 } else if (strcmp(value
, "power8") == 0) {
8476 *max_compat
= CPU_POWERPC_LOGICAL_2_07
;
8478 error_setg(errp
, "Invalid compatibility mode \"%s\"", value
);
8484 static PropertyInfo powerpc_compat_propinfo
= {
8486 .description
= "compatibility mode, power6/power7/power8",
8487 .get
= powerpc_get_compat
,
8488 .set
= powerpc_set_compat
,
8491 #define DEFINE_PROP_POWERPC_COMPAT(_n, _s, _f) \
8492 DEFINE_PROP(_n, _s, _f, powerpc_compat_propinfo, uint32_t)
8494 static Property powerpc_servercpu_properties
[] = {
8495 DEFINE_PROP_POWERPC_COMPAT("compat", PowerPCCPU
, max_compat
),
8496 DEFINE_PROP_END_OF_LIST(),
8499 #ifdef CONFIG_SOFTMMU
8500 static const struct ppc_segment_page_sizes POWER7_POWER8_sps
= {
8503 .page_shift
= 12, /* 4K */
8505 .enc
= { { .page_shift
= 12, .pte_enc
= 0 },
8506 { .page_shift
= 16, .pte_enc
= 0x7 },
8507 { .page_shift
= 24, .pte_enc
= 0x38 }, },
8510 .page_shift
= 16, /* 64K */
8511 .slb_enc
= SLB_VSID_64K
,
8512 .enc
= { { .page_shift
= 16, .pte_enc
= 0x1 },
8513 { .page_shift
= 24, .pte_enc
= 0x8 }, },
8516 .page_shift
= 24, /* 16M */
8517 .slb_enc
= SLB_VSID_16M
,
8518 .enc
= { { .page_shift
= 24, .pte_enc
= 0 }, },
8521 .page_shift
= 34, /* 16G */
8522 .slb_enc
= SLB_VSID_16G
,
8523 .enc
= { { .page_shift
= 34, .pte_enc
= 0x3 }, },
8527 #endif /* CONFIG_SOFTMMU */
8529 static void init_proc_POWER7 (CPUPPCState
*env
)
8531 init_proc_book3s_64(env
, BOOK3S_CPU_POWER7
);
8534 static bool ppc_pvr_match_power7(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8536 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7P_BASE
) {
8539 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7_BASE
) {
8545 static bool cpu_has_work_POWER7(CPUState
*cs
)
8547 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
8548 CPUPPCState
*env
= &cpu
->env
;
8551 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
8554 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
8555 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE0
)) {
8558 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
8559 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE1
)) {
8562 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
)) &&
8563 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE2
)) {
8566 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HMI
)) &&
8567 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE2
)) {
8570 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
8575 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
8579 POWERPC_FAMILY(POWER7
)(ObjectClass
*oc
, void *data
)
8581 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8582 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8583 CPUClass
*cc
= CPU_CLASS(oc
);
8585 dc
->fw_name
= "PowerPC,POWER7";
8586 dc
->desc
= "POWER7";
8587 dc
->props
= powerpc_servercpu_properties
;
8588 pcc
->pvr_match
= ppc_pvr_match_power7
;
8589 pcc
->pcr_mask
= PCR_VEC_DIS
| PCR_VSX_DIS
| PCR_COMPAT_2_05
;
8590 pcc
->pcr_supported
= PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8591 pcc
->init_proc
= init_proc_POWER7
;
8592 pcc
->check_pow
= check_pow_nocheck
;
8593 cc
->has_work
= cpu_has_work_POWER7
;
8594 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8595 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8596 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8597 PPC_FLOAT_FRSQRTES
|
8600 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8601 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8602 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8603 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
8604 PPC_SEGMENT_64B
| PPC_SLBI
|
8605 PPC_POPCNTB
| PPC_POPCNTWD
|
8607 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
8608 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8609 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8610 PPC2_FP_TST_ISA206
| PPC2_FP_CVT_S64
|
8612 pcc
->msr_mask
= (1ull << MSR_SF
) |
8628 pcc
->mmu_model
= POWERPC_MMU_2_06
;
8629 #if defined(CONFIG_SOFTMMU)
8630 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8631 pcc
->sps
= &POWER7_POWER8_sps
;
8633 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
8634 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8635 pcc
->bfd_mach
= bfd_mach_ppc64
;
8636 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8637 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8638 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8640 pcc
->l1_dcache_size
= 0x8000;
8641 pcc
->l1_icache_size
= 0x8000;
8642 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8645 static void init_proc_POWER8(CPUPPCState
*env
)
8647 init_proc_book3s_64(env
, BOOK3S_CPU_POWER8
);
8650 static bool ppc_pvr_match_power8(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8652 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8NVL_BASE
) {
8655 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8E_BASE
) {
8658 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8_BASE
) {
8664 static bool cpu_has_work_POWER8(CPUState
*cs
)
8666 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
8667 CPUPPCState
*env
= &cpu
->env
;
8670 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
8673 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
8674 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE2
)) {
8677 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
8678 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE3
)) {
8681 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
)) &&
8682 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE4
)) {
8685 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HMI
)) &&
8686 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE4
)) {
8689 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DOORBELL
)) &&
8690 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE0
)) {
8693 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HDOORBELL
)) &&
8694 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE1
)) {
8697 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
8702 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
8706 POWERPC_FAMILY(POWER8
)(ObjectClass
*oc
, void *data
)
8708 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8709 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8710 CPUClass
*cc
= CPU_CLASS(oc
);
8712 dc
->fw_name
= "PowerPC,POWER8";
8713 dc
->desc
= "POWER8";
8714 dc
->props
= powerpc_servercpu_properties
;
8715 pcc
->pvr_match
= ppc_pvr_match_power8
;
8716 pcc
->pcr_mask
= PCR_TM_DIS
| PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8717 pcc
->pcr_supported
= PCR_COMPAT_2_07
| PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8718 pcc
->init_proc
= init_proc_POWER8
;
8719 pcc
->check_pow
= check_pow_nocheck
;
8720 cc
->has_work
= cpu_has_work_POWER8
;
8721 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8722 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8723 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8724 PPC_FLOAT_FRSQRTES
|
8727 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8728 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8729 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8730 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
8731 PPC_SEGMENT_64B
| PPC_SLBI
|
8732 PPC_POPCNTB
| PPC_POPCNTWD
|
8734 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
8735 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8736 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8737 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
8738 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
8739 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
8740 PPC2_TM
| PPC2_PM_ISA206
;
8741 pcc
->msr_mask
= (1ull << MSR_SF
) |
8759 pcc
->mmu_model
= POWERPC_MMU_2_07
;
8760 #if defined(CONFIG_SOFTMMU)
8761 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8762 pcc
->sps
= &POWER7_POWER8_sps
;
8764 pcc
->excp_model
= POWERPC_EXCP_POWER8
;
8765 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8766 pcc
->bfd_mach
= bfd_mach_ppc64
;
8767 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8768 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8769 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8770 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
;
8771 pcc
->l1_dcache_size
= 0x8000;
8772 pcc
->l1_icache_size
= 0x8000;
8773 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8776 #if !defined(CONFIG_USER_ONLY)
8778 void cpu_ppc_set_papr(PowerPCCPU
*cpu
)
8780 CPUPPCState
*env
= &cpu
->env
;
8781 ppc_spr_t
*lpcr
= &env
->spr_cb
[SPR_LPCR
];
8782 ppc_spr_t
*amor
= &env
->spr_cb
[SPR_AMOR
];
8784 /* PAPR always has exception vectors in RAM not ROM. To ensure this,
8785 * MSR[IP] should never be set.
8787 * We also disallow setting of MSR_HV
8789 env
->msr_mask
&= ~((1ull << MSR_EP
) | MSR_HVB
);
8791 /* Set emulated LPCR to not send interrupts to hypervisor. Note that
8792 * under KVM, the actual HW LPCR will be set differently by KVM itself,
8793 * the settings below ensure proper operations with TCG in absence of
8794 * a real hypervisor.
8796 * Clearing VPM0 will also cause us to use RMOR in mmu-hash64.c for
8797 * real mode accesses, which thankfully defaults to 0 and isn't
8798 * accessible in guest mode.
8800 lpcr
->default_value
&= ~(LPCR_VPM0
| LPCR_VPM1
| LPCR_ISL
| LPCR_KBV
);
8801 lpcr
->default_value
|= LPCR_LPES0
| LPCR_LPES1
;
8803 /* Set RMLS to the max (ie, 16G) */
8804 lpcr
->default_value
&= ~LPCR_RMLS
;
8805 lpcr
->default_value
|= 1ull << LPCR_RMLS_SHIFT
;
8807 /* P7 and P8 has slightly different PECE bits, mostly because P8 adds
8808 * bit 47 and 48 which are reserved on P7. Here we set them all, which
8809 * will work as expected for both implementations
8811 lpcr
->default_value
|= LPCR_P8_PECE0
| LPCR_P8_PECE1
| LPCR_P8_PECE2
|
8812 LPCR_P8_PECE3
| LPCR_P8_PECE4
;
8814 /* We should be followed by a CPU reset but update the active value
8817 env
->spr
[SPR_LPCR
] = lpcr
->default_value
;
8819 /* Set a full AMOR so guest can use the AMR as it sees fit */
8820 env
->spr
[SPR_AMOR
] = amor
->default_value
= 0xffffffffffffffffull
;
8822 /* Update some env bits based on new LPCR value */
8823 ppc_hash64_update_rmls(env
);
8824 ppc_hash64_update_vrma(env
);
8826 /* Tell KVM that we're in PAPR mode */
8827 if (kvm_enabled()) {
8828 kvmppc_set_papr(cpu
);
8832 #endif /* !defined(CONFIG_USER_ONLY) */
8834 #endif /* defined (TARGET_PPC64) */
8836 /*****************************************************************************/
8837 /* Generic CPU instantiation routine */
8838 static void init_ppc_proc(PowerPCCPU
*cpu
)
8840 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8841 CPUPPCState
*env
= &cpu
->env
;
8842 #if !defined(CONFIG_USER_ONLY)
8845 env
->irq_inputs
= NULL
;
8846 /* Set all exception vectors to an invalid address */
8847 for (i
= 0; i
< POWERPC_EXCP_NB
; i
++)
8848 env
->excp_vectors
[i
] = (target_ulong
)(-1ULL);
8849 env
->ivor_mask
= 0x00000000;
8850 env
->ivpr_mask
= 0x00000000;
8851 /* Default MMU definitions */
8855 env
->tlb_type
= TLB_NONE
;
8857 /* Register SPR common to all PowerPC implementations */
8858 gen_spr_generic(env
);
8859 spr_register(env
, SPR_PVR
, "PVR",
8860 /* Linux permits userspace to read PVR */
8861 #if defined(CONFIG_LINUX_USER)
8867 &spr_read_generic
, SPR_NOACCESS
,
8869 /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
8870 if (pcc
->svr
!= POWERPC_SVR_NONE
) {
8871 if (pcc
->svr
& POWERPC_SVR_E500
) {
8872 spr_register(env
, SPR_E500_SVR
, "SVR",
8873 SPR_NOACCESS
, SPR_NOACCESS
,
8874 &spr_read_generic
, SPR_NOACCESS
,
8875 pcc
->svr
& ~POWERPC_SVR_E500
);
8877 spr_register(env
, SPR_SVR
, "SVR",
8878 SPR_NOACCESS
, SPR_NOACCESS
,
8879 &spr_read_generic
, SPR_NOACCESS
,
8883 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
8884 (*pcc
->init_proc
)(env
);
8886 /* MSR bits & flags consistency checks */
8887 if (env
->msr_mask
& (1 << 25)) {
8888 switch (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
8889 case POWERPC_FLAG_SPE
:
8890 case POWERPC_FLAG_VRE
:
8893 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8894 "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
8897 } else if (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
8898 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8899 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
8902 if (env
->msr_mask
& (1 << 17)) {
8903 switch (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8904 case POWERPC_FLAG_TGPR
:
8905 case POWERPC_FLAG_CE
:
8908 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8909 "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
8912 } else if (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8913 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8914 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
8917 if (env
->msr_mask
& (1 << 10)) {
8918 switch (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8919 POWERPC_FLAG_UBLE
)) {
8920 case POWERPC_FLAG_SE
:
8921 case POWERPC_FLAG_DWE
:
8922 case POWERPC_FLAG_UBLE
:
8925 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8926 "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
8927 "POWERPC_FLAG_UBLE\n");
8930 } else if (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8931 POWERPC_FLAG_UBLE
)) {
8932 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8933 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
8934 "POWERPC_FLAG_UBLE\n");
8937 if (env
->msr_mask
& (1 << 9)) {
8938 switch (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8939 case POWERPC_FLAG_BE
:
8940 case POWERPC_FLAG_DE
:
8943 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8944 "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
8947 } else if (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8948 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8949 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
8952 if (env
->msr_mask
& (1 << 2)) {
8953 switch (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8954 case POWERPC_FLAG_PX
:
8955 case POWERPC_FLAG_PMM
:
8958 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8959 "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
8962 } else if (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8963 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8964 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
8967 if ((env
->flags
& (POWERPC_FLAG_RTC_CLK
| POWERPC_FLAG_BUS_CLK
)) == 0) {
8968 fprintf(stderr
, "PowerPC flags inconsistency\n"
8969 "Should define the time-base and decrementer clock source\n");
8972 /* Allocate TLBs buffer when needed */
8973 #if !defined(CONFIG_USER_ONLY)
8974 if (env
->nb_tlb
!= 0) {
8975 int nb_tlb
= env
->nb_tlb
;
8976 if (env
->id_tlbs
!= 0)
8978 switch (env
->tlb_type
) {
8980 env
->tlb
.tlb6
= g_malloc0(nb_tlb
* sizeof(ppc6xx_tlb_t
));
8983 env
->tlb
.tlbe
= g_malloc0(nb_tlb
* sizeof(ppcemb_tlb_t
));
8986 env
->tlb
.tlbm
= g_malloc0(nb_tlb
* sizeof(ppcmas_tlb_t
));
8989 /* Pre-compute some useful values */
8990 env
->tlb_per_way
= env
->nb_tlb
/ env
->nb_ways
;
8992 if (env
->irq_inputs
== NULL
) {
8993 fprintf(stderr
, "WARNING: no internal IRQ controller registered.\n"
8994 " Attempt QEMU to crash very soon !\n");
8997 if (env
->check_pow
== NULL
) {
8998 fprintf(stderr
, "WARNING: no power management check handler "
9000 " Attempt QEMU to crash very soon !\n");
9004 #if defined(PPC_DUMP_CPU)
9005 static void dump_ppc_sprs (CPUPPCState
*env
)
9008 #if !defined(CONFIG_USER_ONLY)
9014 printf("Special purpose registers:\n");
9015 for (i
= 0; i
< 32; i
++) {
9016 for (j
= 0; j
< 32; j
++) {
9018 spr
= &env
->spr_cb
[n
];
9019 uw
= spr
->uea_write
!= NULL
&& spr
->uea_write
!= SPR_NOACCESS
;
9020 ur
= spr
->uea_read
!= NULL
&& spr
->uea_read
!= SPR_NOACCESS
;
9021 #if !defined(CONFIG_USER_ONLY)
9022 sw
= spr
->oea_write
!= NULL
&& spr
->oea_write
!= SPR_NOACCESS
;
9023 sr
= spr
->oea_read
!= NULL
&& spr
->oea_read
!= SPR_NOACCESS
;
9024 if (sw
|| sr
|| uw
|| ur
) {
9025 printf("SPR: %4d (%03x) %-8s s%c%c u%c%c\n",
9026 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
9027 sw
? 'w' : '-', sr
? 'r' : '-',
9028 uw
? 'w' : '-', ur
? 'r' : '-');
9032 printf("SPR: %4d (%03x) %-8s u%c%c\n",
9033 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
9034 uw
? 'w' : '-', ur
? 'r' : '-');
9044 /*****************************************************************************/
9048 PPC_DIRECT
= 0, /* Opcode routine */
9049 PPC_INDIRECT
= 1, /* Indirect opcode table */
9052 #define PPC_OPCODE_MASK 0x3
9054 static inline int is_indirect_opcode (void *handler
)
9056 return ((uintptr_t)handler
& PPC_OPCODE_MASK
) == PPC_INDIRECT
;
9059 static inline opc_handler_t
**ind_table(void *handler
)
9061 return (opc_handler_t
**)((uintptr_t)handler
& ~PPC_OPCODE_MASK
);
9064 /* Instruction table creation */
9065 /* Opcodes tables creation */
9066 static void fill_new_table (opc_handler_t
**table
, int len
)
9070 for (i
= 0; i
< len
; i
++)
9071 table
[i
] = &invalid_handler
;
9074 static int create_new_table (opc_handler_t
**table
, unsigned char idx
)
9076 opc_handler_t
**tmp
;
9078 tmp
= g_new(opc_handler_t
*, PPC_CPU_INDIRECT_OPCODES_LEN
);
9079 fill_new_table(tmp
, PPC_CPU_INDIRECT_OPCODES_LEN
);
9080 table
[idx
] = (opc_handler_t
*)((uintptr_t)tmp
| PPC_INDIRECT
);
9085 static int insert_in_table (opc_handler_t
**table
, unsigned char idx
,
9086 opc_handler_t
*handler
)
9088 if (table
[idx
] != &invalid_handler
)
9090 table
[idx
] = handler
;
9095 static int register_direct_insn (opc_handler_t
**ppc_opcodes
,
9096 unsigned char idx
, opc_handler_t
*handler
)
9098 if (insert_in_table(ppc_opcodes
, idx
, handler
) < 0) {
9099 printf("*** ERROR: opcode %02x already assigned in main "
9100 "opcode table\n", idx
);
9101 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9102 printf(" Registered handler '%s' - new handler '%s'\n",
9103 ppc_opcodes
[idx
]->oname
, handler
->oname
);
9111 static int register_ind_in_table (opc_handler_t
**table
,
9112 unsigned char idx1
, unsigned char idx2
,
9113 opc_handler_t
*handler
)
9115 if (table
[idx1
] == &invalid_handler
) {
9116 if (create_new_table(table
, idx1
) < 0) {
9117 printf("*** ERROR: unable to create indirect table "
9118 "idx=%02x\n", idx1
);
9122 if (!is_indirect_opcode(table
[idx1
])) {
9123 printf("*** ERROR: idx %02x already assigned to a direct "
9125 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9126 printf(" Registered handler '%s' - new handler '%s'\n",
9127 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
9132 if (handler
!= NULL
&&
9133 insert_in_table(ind_table(table
[idx1
]), idx2
, handler
) < 0) {
9134 printf("*** ERROR: opcode %02x already assigned in "
9135 "opcode table %02x\n", idx2
, idx1
);
9136 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9137 printf(" Registered handler '%s' - new handler '%s'\n",
9138 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
9146 static int register_ind_insn (opc_handler_t
**ppc_opcodes
,
9147 unsigned char idx1
, unsigned char idx2
,
9148 opc_handler_t
*handler
)
9150 return register_ind_in_table(ppc_opcodes
, idx1
, idx2
, handler
);
9153 static int register_dblind_insn (opc_handler_t
**ppc_opcodes
,
9154 unsigned char idx1
, unsigned char idx2
,
9155 unsigned char idx3
, opc_handler_t
*handler
)
9157 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
9158 printf("*** ERROR: unable to join indirect table idx "
9159 "[%02x-%02x]\n", idx1
, idx2
);
9162 if (register_ind_in_table(ind_table(ppc_opcodes
[idx1
]), idx2
, idx3
,
9164 printf("*** ERROR: unable to insert opcode "
9165 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
9172 static int register_insn (opc_handler_t
**ppc_opcodes
, opcode_t
*insn
)
9174 if (insn
->opc2
!= 0xFF) {
9175 if (insn
->opc3
!= 0xFF) {
9176 if (register_dblind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
9177 insn
->opc3
, &insn
->handler
) < 0)
9180 if (register_ind_insn(ppc_opcodes
, insn
->opc1
,
9181 insn
->opc2
, &insn
->handler
) < 0)
9185 if (register_direct_insn(ppc_opcodes
, insn
->opc1
, &insn
->handler
) < 0)
9192 static int test_opcode_table (opc_handler_t
**table
, int len
)
9196 for (i
= 0, count
= 0; i
< len
; i
++) {
9197 /* Consistency fixup */
9198 if (table
[i
] == NULL
)
9199 table
[i
] = &invalid_handler
;
9200 if (table
[i
] != &invalid_handler
) {
9201 if (is_indirect_opcode(table
[i
])) {
9202 tmp
= test_opcode_table(ind_table(table
[i
]),
9203 PPC_CPU_INDIRECT_OPCODES_LEN
);
9206 table
[i
] = &invalid_handler
;
9219 static void fix_opcode_tables (opc_handler_t
**ppc_opcodes
)
9221 if (test_opcode_table(ppc_opcodes
, PPC_CPU_OPCODES_LEN
) == 0)
9222 printf("*** WARNING: no opcode defined !\n");
9225 /*****************************************************************************/
9226 static void create_ppc_opcodes(PowerPCCPU
*cpu
, Error
**errp
)
9228 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9229 CPUPPCState
*env
= &cpu
->env
;
9232 fill_new_table(env
->opcodes
, PPC_CPU_OPCODES_LEN
);
9233 for (opc
= opcodes
; opc
< &opcodes
[ARRAY_SIZE(opcodes
)]; opc
++) {
9234 if (((opc
->handler
.type
& pcc
->insns_flags
) != 0) ||
9235 ((opc
->handler
.type2
& pcc
->insns_flags2
) != 0)) {
9236 if (register_insn(env
->opcodes
, opc
) < 0) {
9237 error_setg(errp
, "ERROR initializing PowerPC instruction "
9238 "0x%02x 0x%02x 0x%02x", opc
->opc1
, opc
->opc2
,
9244 fix_opcode_tables(env
->opcodes
);
9249 #if defined(PPC_DUMP_CPU)
9250 static void dump_ppc_insns (CPUPPCState
*env
)
9252 opc_handler_t
**table
, *handler
;
9254 uint8_t opc1
, opc2
, opc3
;
9256 printf("Instructions set:\n");
9257 /* opc1 is 6 bits long */
9258 for (opc1
= 0x00; opc1
< PPC_CPU_OPCODES_LEN
; opc1
++) {
9259 table
= env
->opcodes
;
9260 handler
= table
[opc1
];
9261 if (is_indirect_opcode(handler
)) {
9262 /* opc2 is 5 bits long */
9263 for (opc2
= 0; opc2
< PPC_CPU_INDIRECT_OPCODES_LEN
; opc2
++) {
9264 table
= env
->opcodes
;
9265 handler
= env
->opcodes
[opc1
];
9266 table
= ind_table(handler
);
9267 handler
= table
[opc2
];
9268 if (is_indirect_opcode(handler
)) {
9269 table
= ind_table(handler
);
9270 /* opc3 is 5 bits long */
9271 for (opc3
= 0; opc3
< PPC_CPU_INDIRECT_OPCODES_LEN
;
9273 handler
= table
[opc3
];
9274 if (handler
->handler
!= &gen_invalid
) {
9275 /* Special hack to properly dump SPE insns */
9276 p
= strchr(handler
->oname
, '_');
9278 printf("INSN: %02x %02x %02x (%02d %04d) : "
9280 opc1
, opc2
, opc3
, opc1
,
9285 if ((p
- handler
->oname
) != strlen(q
) ||
9286 memcmp(handler
->oname
, q
, strlen(q
)) != 0) {
9287 /* First instruction */
9288 printf("INSN: %02x %02x %02x (%02d %04d) : "
9290 opc1
, opc2
<< 1, opc3
, opc1
,
9291 (opc3
<< 6) | (opc2
<< 1),
9292 (int)(p
- handler
->oname
),
9295 if (strcmp(p
+ 1, q
) != 0) {
9296 /* Second instruction */
9297 printf("INSN: %02x %02x %02x (%02d %04d) : "
9299 opc1
, (opc2
<< 1) | 1, opc3
, opc1
,
9300 (opc3
<< 6) | (opc2
<< 1) | 1,
9307 if (handler
->handler
!= &gen_invalid
) {
9308 printf("INSN: %02x %02x -- (%02d %04d) : %s\n",
9309 opc1
, opc2
, opc1
, opc2
, handler
->oname
);
9314 if (handler
->handler
!= &gen_invalid
) {
9315 printf("INSN: %02x -- -- (%02d ----) : %s\n",
9316 opc1
, opc1
, handler
->oname
);
9323 static bool avr_need_swap(CPUPPCState
*env
)
9325 #ifdef HOST_WORDS_BIGENDIAN
9332 static int gdb_get_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9335 stfq_p(mem_buf
, env
->fpr
[n
]);
9336 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9340 stl_p(mem_buf
, env
->fpscr
);
9341 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9347 static int gdb_set_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9350 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9351 env
->fpr
[n
] = ldfq_p(mem_buf
);
9355 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9356 helper_store_fpscr(env
, ldl_p(mem_buf
), 0xffffffff);
9362 static int gdb_get_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9365 if (!avr_need_swap(env
)) {
9366 stq_p(mem_buf
, env
->avr
[n
].u64
[0]);
9367 stq_p(mem_buf
+8, env
->avr
[n
].u64
[1]);
9369 stq_p(mem_buf
, env
->avr
[n
].u64
[1]);
9370 stq_p(mem_buf
+8, env
->avr
[n
].u64
[0]);
9372 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9373 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
9377 stl_p(mem_buf
, env
->vscr
);
9378 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9382 stl_p(mem_buf
, (uint32_t)env
->spr
[SPR_VRSAVE
]);
9383 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9389 static int gdb_set_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9392 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9393 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
9394 if (!avr_need_swap(env
)) {
9395 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
);
9396 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
+8);
9398 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
);
9399 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
+8);
9404 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9405 env
->vscr
= ldl_p(mem_buf
);
9409 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9410 env
->spr
[SPR_VRSAVE
] = (target_ulong
)ldl_p(mem_buf
);
9416 static int gdb_get_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9419 #if defined(TARGET_PPC64)
9420 stl_p(mem_buf
, env
->gpr
[n
] >> 32);
9421 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9423 stl_p(mem_buf
, env
->gprh
[n
]);
9428 stq_p(mem_buf
, env
->spe_acc
);
9429 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9433 stl_p(mem_buf
, env
->spe_fscr
);
9434 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9440 static int gdb_set_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9443 #if defined(TARGET_PPC64)
9444 target_ulong lo
= (uint32_t)env
->gpr
[n
];
9447 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9449 hi
= (target_ulong
)ldl_p(mem_buf
) << 32;
9450 env
->gpr
[n
] = lo
| hi
;
9452 env
->gprh
[n
] = ldl_p(mem_buf
);
9457 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9458 env
->spe_acc
= ldq_p(mem_buf
);
9462 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9463 env
->spe_fscr
= ldl_p(mem_buf
);
9469 static int gdb_get_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9472 stq_p(mem_buf
, env
->vsr
[n
]);
9473 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9479 static int gdb_set_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9482 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9483 env
->vsr
[n
] = ldq_p(mem_buf
);
9489 static int ppc_fixup_cpu(PowerPCCPU
*cpu
)
9491 CPUPPCState
*env
= &cpu
->env
;
9493 /* TCG doesn't (yet) emulate some groups of instructions that
9494 * are implemented on some otherwise supported CPUs (e.g. VSX
9495 * and decimal floating point instructions on POWER7). We
9496 * remove unsupported instruction groups from the cpu state's
9497 * instruction masks and hope the guest can cope. For at
9498 * least the pseries machine, the unavailability of these
9499 * instructions can be advertised to the guest via the device
9501 if ((env
->insns_flags
& ~PPC_TCG_INSNS
)
9502 || (env
->insns_flags2
& ~PPC_TCG_INSNS2
)) {
9503 fprintf(stderr
, "Warning: Disabling some instructions which are not "
9504 "emulated by TCG (0x%" PRIx64
", 0x%" PRIx64
")\n",
9505 env
->insns_flags
& ~PPC_TCG_INSNS
,
9506 env
->insns_flags2
& ~PPC_TCG_INSNS2
);
9508 env
->insns_flags
&= PPC_TCG_INSNS
;
9509 env
->insns_flags2
&= PPC_TCG_INSNS2
;
9513 static inline bool ppc_cpu_is_valid(PowerPCCPUClass
*pcc
)
9515 #ifdef TARGET_PPCEMB
9516 return pcc
->mmu_model
== POWERPC_MMU_BOOKE
||
9517 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx
||
9518 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx_Z
;
9524 static void ppc_cpu_realizefn(DeviceState
*dev
, Error
**errp
)
9526 CPUState
*cs
= CPU(dev
);
9527 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
9528 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9529 Error
*local_err
= NULL
;
9530 #if !defined(CONFIG_USER_ONLY)
9531 int max_smt
= kvmppc_smt_threads();
9534 #if !defined(CONFIG_USER_ONLY)
9535 if (smp_threads
> max_smt
) {
9536 error_setg(errp
, "Cannot support more than %d threads on PPC with %s",
9537 max_smt
, kvm_enabled() ? "KVM" : "TCG");
9540 if (!is_power_of_2(smp_threads
)) {
9541 error_setg(errp
, "Cannot support %d threads on PPC with %s, "
9542 "threads count must be a power of 2.",
9543 smp_threads
, kvm_enabled() ? "KVM" : "TCG");
9548 cpu_exec_init(cs
, &local_err
);
9549 if (local_err
!= NULL
) {
9550 error_propagate(errp
, local_err
);
9554 #if !defined(CONFIG_USER_ONLY)
9555 cpu
->cpu_dt_id
= (cs
->cpu_index
/ smp_threads
) * max_smt
9556 + (cs
->cpu_index
% smp_threads
);
9558 if (kvm_enabled() && !kvm_vcpu_id_is_valid(cpu
->cpu_dt_id
)) {
9559 error_setg(errp
, "Can't create CPU with id %d in KVM", cpu
->cpu_dt_id
);
9560 error_append_hint(errp
, "Adjust the number of cpus to %d "
9561 "or try to raise the number of threads per core\n",
9562 cpu
->cpu_dt_id
* smp_threads
/ max_smt
);
9567 if (tcg_enabled()) {
9568 if (ppc_fixup_cpu(cpu
) != 0) {
9569 error_setg(errp
, "Unable to emulate selected CPU with TCG");
9574 #if defined(TARGET_PPCEMB)
9575 if (!ppc_cpu_is_valid(pcc
)) {
9576 error_setg(errp
, "CPU does not possess a BookE or 4xx MMU. "
9577 "Please use qemu-system-ppc or qemu-system-ppc64 instead "
9578 "or choose another CPU model.");
9583 create_ppc_opcodes(cpu
, &local_err
);
9584 if (local_err
!= NULL
) {
9585 error_propagate(errp
, local_err
);
9590 if (pcc
->insns_flags
& PPC_FLOAT
) {
9591 gdb_register_coprocessor(cs
, gdb_get_float_reg
, gdb_set_float_reg
,
9592 33, "power-fpu.xml", 0);
9594 if (pcc
->insns_flags
& PPC_ALTIVEC
) {
9595 gdb_register_coprocessor(cs
, gdb_get_avr_reg
, gdb_set_avr_reg
,
9596 34, "power-altivec.xml", 0);
9598 if (pcc
->insns_flags
& PPC_SPE
) {
9599 gdb_register_coprocessor(cs
, gdb_get_spe_reg
, gdb_set_spe_reg
,
9600 34, "power-spe.xml", 0);
9602 if (pcc
->insns_flags2
& PPC2_VSX
) {
9603 gdb_register_coprocessor(cs
, gdb_get_vsx_reg
, gdb_set_vsx_reg
,
9604 32, "power-vsx.xml", 0);
9609 pcc
->parent_realize(dev
, errp
);
9611 #if defined(PPC_DUMP_CPU)
9613 CPUPPCState
*env
= &cpu
->env
;
9614 const char *mmu_model
, *excp_model
, *bus_model
;
9615 switch (env
->mmu_model
) {
9616 case POWERPC_MMU_32B
:
9617 mmu_model
= "PowerPC 32";
9619 case POWERPC_MMU_SOFT_6xx
:
9620 mmu_model
= "PowerPC 6xx/7xx with software driven TLBs";
9622 case POWERPC_MMU_SOFT_74xx
:
9623 mmu_model
= "PowerPC 74xx with software driven TLBs";
9625 case POWERPC_MMU_SOFT_4xx
:
9626 mmu_model
= "PowerPC 4xx with software driven TLBs";
9628 case POWERPC_MMU_SOFT_4xx_Z
:
9629 mmu_model
= "PowerPC 4xx with software driven TLBs "
9630 "and zones protections";
9632 case POWERPC_MMU_REAL
:
9633 mmu_model
= "PowerPC real mode only";
9635 case POWERPC_MMU_MPC8xx
:
9636 mmu_model
= "PowerPC MPC8xx";
9638 case POWERPC_MMU_BOOKE
:
9639 mmu_model
= "PowerPC BookE";
9641 case POWERPC_MMU_BOOKE206
:
9642 mmu_model
= "PowerPC BookE 2.06";
9644 case POWERPC_MMU_601
:
9645 mmu_model
= "PowerPC 601";
9647 #if defined (TARGET_PPC64)
9648 case POWERPC_MMU_64B
:
9649 mmu_model
= "PowerPC 64";
9653 mmu_model
= "Unknown or invalid";
9656 switch (env
->excp_model
) {
9657 case POWERPC_EXCP_STD
:
9658 excp_model
= "PowerPC";
9660 case POWERPC_EXCP_40x
:
9661 excp_model
= "PowerPC 40x";
9663 case POWERPC_EXCP_601
:
9664 excp_model
= "PowerPC 601";
9666 case POWERPC_EXCP_602
:
9667 excp_model
= "PowerPC 602";
9669 case POWERPC_EXCP_603
:
9670 excp_model
= "PowerPC 603";
9672 case POWERPC_EXCP_603E
:
9673 excp_model
= "PowerPC 603e";
9675 case POWERPC_EXCP_604
:
9676 excp_model
= "PowerPC 604";
9678 case POWERPC_EXCP_7x0
:
9679 excp_model
= "PowerPC 740/750";
9681 case POWERPC_EXCP_7x5
:
9682 excp_model
= "PowerPC 745/755";
9684 case POWERPC_EXCP_74xx
:
9685 excp_model
= "PowerPC 74xx";
9687 case POWERPC_EXCP_BOOKE
:
9688 excp_model
= "PowerPC BookE";
9690 #if defined (TARGET_PPC64)
9691 case POWERPC_EXCP_970
:
9692 excp_model
= "PowerPC 970";
9696 excp_model
= "Unknown or invalid";
9699 switch (env
->bus_model
) {
9700 case PPC_FLAGS_INPUT_6xx
:
9701 bus_model
= "PowerPC 6xx";
9703 case PPC_FLAGS_INPUT_BookE
:
9704 bus_model
= "PowerPC BookE";
9706 case PPC_FLAGS_INPUT_405
:
9707 bus_model
= "PowerPC 405";
9709 case PPC_FLAGS_INPUT_401
:
9710 bus_model
= "PowerPC 401/403";
9712 case PPC_FLAGS_INPUT_RCPU
:
9713 bus_model
= "RCPU / MPC8xx";
9715 #if defined (TARGET_PPC64)
9716 case PPC_FLAGS_INPUT_970
:
9717 bus_model
= "PowerPC 970";
9721 bus_model
= "Unknown or invalid";
9724 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64
"\n"
9725 " MMU model : %s\n",
9726 object_class_get_name(OBJECT_CLASS(pcc
)),
9727 pcc
->pvr
, pcc
->msr_mask
, mmu_model
);
9728 #if !defined(CONFIG_USER_ONLY)
9729 if (env
->tlb
.tlb6
) {
9730 printf(" %d %s TLB in %d ways\n",
9731 env
->nb_tlb
, env
->id_tlbs
? "splitted" : "merged",
9735 printf(" Exceptions model : %s\n"
9736 " Bus model : %s\n",
9737 excp_model
, bus_model
);
9738 printf(" MSR features :\n");
9739 if (env
->flags
& POWERPC_FLAG_SPE
)
9740 printf(" signal processing engine enable"
9742 else if (env
->flags
& POWERPC_FLAG_VRE
)
9743 printf(" vector processor enable\n");
9744 if (env
->flags
& POWERPC_FLAG_TGPR
)
9745 printf(" temporary GPRs\n");
9746 else if (env
->flags
& POWERPC_FLAG_CE
)
9747 printf(" critical input enable\n");
9748 if (env
->flags
& POWERPC_FLAG_SE
)
9749 printf(" single-step trace mode\n");
9750 else if (env
->flags
& POWERPC_FLAG_DWE
)
9751 printf(" debug wait enable\n");
9752 else if (env
->flags
& POWERPC_FLAG_UBLE
)
9753 printf(" user BTB lock enable\n");
9754 if (env
->flags
& POWERPC_FLAG_BE
)
9755 printf(" branch-step trace mode\n");
9756 else if (env
->flags
& POWERPC_FLAG_DE
)
9757 printf(" debug interrupt enable\n");
9758 if (env
->flags
& POWERPC_FLAG_PX
)
9759 printf(" inclusive protection\n");
9760 else if (env
->flags
& POWERPC_FLAG_PMM
)
9761 printf(" performance monitor mark\n");
9762 if (env
->flags
== POWERPC_FLAG_NONE
)
9764 printf(" Time-base/decrementer clock source: %s\n",
9765 env
->flags
& POWERPC_FLAG_RTC_CLK
? "RTC clock" : "bus clock");
9766 dump_ppc_insns(env
);
9773 static void ppc_cpu_unrealizefn(DeviceState
*dev
, Error
**errp
)
9775 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
9776 CPUPPCState
*env
= &cpu
->env
;
9777 opc_handler_t
**table
;
9780 cpu_exec_exit(CPU(dev
));
9782 for (i
= 0; i
< PPC_CPU_OPCODES_LEN
; i
++) {
9783 if (env
->opcodes
[i
] == &invalid_handler
) {
9786 if (is_indirect_opcode(env
->opcodes
[i
])) {
9787 table
= ind_table(env
->opcodes
[i
]);
9788 for (j
= 0; j
< PPC_CPU_INDIRECT_OPCODES_LEN
; j
++) {
9789 if (table
[j
] != &invalid_handler
&&
9790 is_indirect_opcode(table
[j
])) {
9791 g_free((opc_handler_t
*)((uintptr_t)table
[j
] &
9795 g_free((opc_handler_t
*)((uintptr_t)env
->opcodes
[i
] &
9801 int ppc_get_compat_smt_threads(PowerPCCPU
*cpu
)
9803 int ret
= MIN(smp_threads
, kvmppc_smt_threads());
9805 switch (cpu
->cpu_version
) {
9806 case CPU_POWERPC_LOGICAL_2_05
:
9809 case CPU_POWERPC_LOGICAL_2_06
:
9812 case CPU_POWERPC_LOGICAL_2_07
:
9821 void ppc_set_compat(PowerPCCPU
*cpu
, uint32_t cpu_version
, Error
**errp
)
9824 CPUPPCState
*env
= &cpu
->env
;
9825 PowerPCCPUClass
*host_pcc
;
9827 cpu
->cpu_version
= cpu_version
;
9829 switch (cpu_version
) {
9830 case CPU_POWERPC_LOGICAL_2_05
:
9831 env
->spr
[SPR_PCR
] = PCR_TM_DIS
| PCR_VSX_DIS
| PCR_COMPAT_2_07
|
9832 PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
9834 case CPU_POWERPC_LOGICAL_2_06
:
9835 case CPU_POWERPC_LOGICAL_2_06_PLUS
:
9836 env
->spr
[SPR_PCR
] = PCR_TM_DIS
| PCR_COMPAT_2_07
| PCR_COMPAT_2_06
;
9838 case CPU_POWERPC_LOGICAL_2_07
:
9839 env
->spr
[SPR_PCR
] = PCR_COMPAT_2_07
;
9842 env
->spr
[SPR_PCR
] = 0;
9846 host_pcc
= kvm_ppc_get_host_cpu_class();
9848 env
->spr
[SPR_PCR
] &= host_pcc
->pcr_mask
;
9851 if (kvm_enabled()) {
9852 ret
= kvmppc_set_compat(cpu
, cpu
->cpu_version
);
9854 error_setg_errno(errp
, -ret
,
9855 "Unable to set CPU compatibility mode in KVM");
9861 static gint
ppc_cpu_compare_class_pvr(gconstpointer a
, gconstpointer b
)
9863 ObjectClass
*oc
= (ObjectClass
*)a
;
9864 uint32_t pvr
= *(uint32_t *)b
;
9865 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
9867 /* -cpu host does a PVR lookup during construction */
9868 if (unlikely(strcmp(object_class_get_name(oc
),
9869 TYPE_HOST_POWERPC_CPU
) == 0)) {
9873 if (!ppc_cpu_is_valid(pcc
)) {
9877 return pcc
->pvr
== pvr
? 0 : -1;
9880 PowerPCCPUClass
*ppc_cpu_class_by_pvr(uint32_t pvr
)
9882 GSList
*list
, *item
;
9883 PowerPCCPUClass
*pcc
= NULL
;
9885 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9886 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr
);
9888 pcc
= POWERPC_CPU_CLASS(item
->data
);
9895 static gint
ppc_cpu_compare_class_pvr_mask(gconstpointer a
, gconstpointer b
)
9897 ObjectClass
*oc
= (ObjectClass
*)a
;
9898 uint32_t pvr
= *(uint32_t *)b
;
9899 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
9901 /* -cpu host does a PVR lookup during construction */
9902 if (unlikely(strcmp(object_class_get_name(oc
),
9903 TYPE_HOST_POWERPC_CPU
) == 0)) {
9907 if (!ppc_cpu_is_valid(pcc
)) {
9911 if (pcc
->pvr_match(pcc
, pvr
)) {
9918 PowerPCCPUClass
*ppc_cpu_class_by_pvr_mask(uint32_t pvr
)
9920 GSList
*list
, *item
;
9921 PowerPCCPUClass
*pcc
= NULL
;
9923 list
= object_class_get_list(TYPE_POWERPC_CPU
, true);
9924 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr_mask
);
9926 pcc
= POWERPC_CPU_CLASS(item
->data
);
9933 static gint
ppc_cpu_compare_class_name(gconstpointer a
, gconstpointer b
)
9935 ObjectClass
*oc
= (ObjectClass
*)a
;
9936 const char *name
= b
;
9937 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9939 if (strncasecmp(name
, object_class_get_name(oc
), strlen(name
)) == 0 &&
9940 ppc_cpu_is_valid(pcc
) &&
9941 strcmp(object_class_get_name(oc
) + strlen(name
),
9942 "-" TYPE_POWERPC_CPU
) == 0) {
9949 static ObjectClass
*ppc_cpu_class_by_name(const char *name
);
9951 static ObjectClass
*ppc_cpu_class_by_alias(PowerPCCPUAlias
*alias
)
9953 ObjectClass
*invalid_class
= (void*)ppc_cpu_class_by_alias
;
9955 /* Cache target class lookups in the alias table */
9957 alias
->oc
= ppc_cpu_class_by_name(alias
->model
);
9959 /* Fast check for non-existing aliases */
9960 alias
->oc
= invalid_class
;
9964 if (alias
->oc
== invalid_class
) {
9971 static ObjectClass
*ppc_cpu_class_by_name(const char *name
)
9973 GSList
*list
, *item
;
9974 ObjectClass
*ret
= NULL
;
9978 /* Check if the given name is a PVR */
9980 if (len
== 10 && name
[0] == '0' && name
[1] == 'x') {
9983 } else if (len
== 8) {
9986 for (i
= 0; i
< 8; i
++) {
9987 if (!qemu_isxdigit(*p
++))
9991 return OBJECT_CLASS(ppc_cpu_class_by_pvr(strtoul(name
, NULL
, 16)));
9995 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9996 item
= g_slist_find_custom(list
, name
, ppc_cpu_compare_class_name
);
9998 ret
= OBJECT_CLASS(item
->data
);
10000 g_slist_free(list
);
10006 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
10007 if (strcmp(ppc_cpu_aliases
[i
].alias
, name
) == 0) {
10008 return ppc_cpu_class_by_alias(&ppc_cpu_aliases
[i
]);
10015 PowerPCCPU
*cpu_ppc_init(const char *cpu_model
)
10017 return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU
, cpu_model
));
10020 /* Sort by PVR, ordering special case "host" last. */
10021 static gint
ppc_cpu_list_compare(gconstpointer a
, gconstpointer b
)
10023 ObjectClass
*oc_a
= (ObjectClass
*)a
;
10024 ObjectClass
*oc_b
= (ObjectClass
*)b
;
10025 PowerPCCPUClass
*pcc_a
= POWERPC_CPU_CLASS(oc_a
);
10026 PowerPCCPUClass
*pcc_b
= POWERPC_CPU_CLASS(oc_b
);
10027 const char *name_a
= object_class_get_name(oc_a
);
10028 const char *name_b
= object_class_get_name(oc_b
);
10030 if (strcmp(name_a
, TYPE_HOST_POWERPC_CPU
) == 0) {
10032 } else if (strcmp(name_b
, TYPE_HOST_POWERPC_CPU
) == 0) {
10035 /* Avoid an integer overflow during subtraction */
10036 if (pcc_a
->pvr
< pcc_b
->pvr
) {
10038 } else if (pcc_a
->pvr
> pcc_b
->pvr
) {
10046 static void ppc_cpu_list_entry(gpointer data
, gpointer user_data
)
10048 ObjectClass
*oc
= data
;
10049 CPUListState
*s
= user_data
;
10050 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10051 const char *typename
= object_class_get_name(oc
);
10055 if (!ppc_cpu_is_valid(pcc
)) {
10058 if (unlikely(strcmp(typename
, TYPE_HOST_POWERPC_CPU
) == 0)) {
10062 name
= g_strndup(typename
,
10063 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
10064 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s PVR %08x\n",
10066 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
10067 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
10068 ObjectClass
*alias_oc
= ppc_cpu_class_by_alias(alias
);
10070 if (alias_oc
!= oc
) {
10073 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s (alias for %s)\n",
10074 alias
->alias
, name
);
10079 void ppc_cpu_list(FILE *f
, fprintf_function cpu_fprintf
)
10083 .cpu_fprintf
= cpu_fprintf
,
10087 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10088 list
= g_slist_sort(list
, ppc_cpu_list_compare
);
10089 g_slist_foreach(list
, ppc_cpu_list_entry
, &s
);
10090 g_slist_free(list
);
10093 cpu_fprintf(f
, "\n");
10094 cpu_fprintf(f
, "PowerPC %-16s\n", "host");
10098 static void ppc_cpu_defs_entry(gpointer data
, gpointer user_data
)
10100 ObjectClass
*oc
= data
;
10101 CpuDefinitionInfoList
**first
= user_data
;
10102 const char *typename
;
10103 CpuDefinitionInfoList
*entry
;
10104 CpuDefinitionInfo
*info
;
10105 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10107 if (!ppc_cpu_is_valid(pcc
)) {
10111 typename
= object_class_get_name(oc
);
10112 info
= g_malloc0(sizeof(*info
));
10113 info
->name
= g_strndup(typename
,
10114 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
10116 entry
= g_malloc0(sizeof(*entry
));
10117 entry
->value
= info
;
10118 entry
->next
= *first
;
10122 CpuDefinitionInfoList
*arch_query_cpu_definitions(Error
**errp
)
10124 CpuDefinitionInfoList
*cpu_list
= NULL
;
10128 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10129 g_slist_foreach(list
, ppc_cpu_defs_entry
, &cpu_list
);
10130 g_slist_free(list
);
10132 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
10133 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
10135 CpuDefinitionInfoList
*entry
;
10136 CpuDefinitionInfo
*info
;
10138 oc
= ppc_cpu_class_by_alias(alias
);
10143 info
= g_malloc0(sizeof(*info
));
10144 info
->name
= g_strdup(alias
->alias
);
10146 entry
= g_malloc0(sizeof(*entry
));
10147 entry
->value
= info
;
10148 entry
->next
= cpu_list
;
10155 static void ppc_cpu_set_pc(CPUState
*cs
, vaddr value
)
10157 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10159 cpu
->env
.nip
= value
;
10162 static bool ppc_cpu_has_work(CPUState
*cs
)
10164 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10165 CPUPPCState
*env
= &cpu
->env
;
10167 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
10170 static void ppc_cpu_exec_enter(CPUState
*cs
)
10172 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10173 CPUPPCState
*env
= &cpu
->env
;
10175 env
->reserve_addr
= -1;
10178 /* CPUClass::reset() */
10179 static void ppc_cpu_reset(CPUState
*s
)
10181 PowerPCCPU
*cpu
= POWERPC_CPU(s
);
10182 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10183 CPUPPCState
*env
= &cpu
->env
;
10187 pcc
->parent_reset(s
);
10189 msr
= (target_ulong
)0;
10190 msr
|= (target_ulong
)MSR_HVB
;
10191 msr
|= (target_ulong
)0 << MSR_AP
; /* TO BE CHECKED */
10192 msr
|= (target_ulong
)0 << MSR_SA
; /* TO BE CHECKED */
10193 msr
|= (target_ulong
)1 << MSR_EP
;
10194 #if defined(DO_SINGLE_STEP) && 0
10195 /* Single step trace mode */
10196 msr
|= (target_ulong
)1 << MSR_SE
;
10197 msr
|= (target_ulong
)1 << MSR_BE
;
10199 #if defined(CONFIG_USER_ONLY)
10200 msr
|= (target_ulong
)1 << MSR_FP
; /* Allow floating point usage */
10201 msr
|= (target_ulong
)1 << MSR_VR
; /* Allow altivec usage */
10202 msr
|= (target_ulong
)1 << MSR_VSX
; /* Allow VSX usage */
10203 msr
|= (target_ulong
)1 << MSR_SPE
; /* Allow SPE usage */
10204 msr
|= (target_ulong
)1 << MSR_PR
;
10205 #if defined(TARGET_PPC64)
10206 msr
|= (target_ulong
)1 << MSR_TM
; /* Transactional memory */
10208 #if !defined(TARGET_WORDS_BIGENDIAN)
10209 msr
|= (target_ulong
)1 << MSR_LE
; /* Little-endian user mode */
10210 if (!((env
->msr_mask
>> MSR_LE
) & 1)) {
10211 fprintf(stderr
, "Selected CPU does not support little-endian.\n");
10217 #if defined(TARGET_PPC64)
10218 if (env
->mmu_model
& POWERPC_MMU_64
) {
10219 msr
|= (1ULL << MSR_SF
);
10223 hreg_store_msr(env
, msr
, 1);
10225 #if !defined(CONFIG_USER_ONLY)
10226 env
->nip
= env
->hreset_vector
| env
->excp_prefix
;
10227 if (env
->mmu_model
!= POWERPC_MMU_REAL
) {
10228 ppc_tlb_invalidate_all(env
);
10232 hreg_compute_hflags(env
);
10233 env
->reserve_addr
= (target_ulong
)-1ULL;
10234 /* Be sure no exception or interrupt is pending */
10235 env
->pending_interrupts
= 0;
10236 s
->exception_index
= POWERPC_EXCP_NONE
;
10237 env
->error_code
= 0;
10239 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
10241 env
->slb_shadow_addr
= 0;
10242 env
->slb_shadow_size
= 0;
10245 #endif /* TARGET_PPC64 */
10247 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
10248 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
10253 env
->spr
[i
] = spr
->default_value
;
10256 /* Flush all TLBs */
10260 #ifndef CONFIG_USER_ONLY
10261 static bool ppc_cpu_is_big_endian(CPUState
*cs
)
10263 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10264 CPUPPCState
*env
= &cpu
->env
;
10266 cpu_synchronize_state(cs
);
10272 static void ppc_cpu_initfn(Object
*obj
)
10274 CPUState
*cs
= CPU(obj
);
10275 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
10276 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10277 CPUPPCState
*env
= &cpu
->env
;
10281 env
->msr_mask
= pcc
->msr_mask
;
10282 env
->mmu_model
= pcc
->mmu_model
;
10283 env
->excp_model
= pcc
->excp_model
;
10284 env
->bus_model
= pcc
->bus_model
;
10285 env
->insns_flags
= pcc
->insns_flags
;
10286 env
->insns_flags2
= pcc
->insns_flags2
;
10287 env
->flags
= pcc
->flags
;
10288 env
->bfd_mach
= pcc
->bfd_mach
;
10289 env
->check_pow
= pcc
->check_pow
;
10291 /* Mark HV mode as supported if the CPU has an MSR_HV bit
10292 * in the msr_mask. The mask can later be cleared by PAPR
10293 * mode but the hv mode support will remain, thus enforcing
10294 * that we cannot use priv. instructions in guest in PAPR
10295 * mode. For 970 we currently simply don't set HV in msr_mask
10296 * thus simulating an "Apple mode" 970. If we ever want to
10297 * support 970 HV mode, we'll have to add a processor attribute
10300 #if !defined(CONFIG_USER_ONLY)
10301 env
->has_hv_mode
= !!(env
->msr_mask
& MSR_HVB
);
10304 #if defined(TARGET_PPC64)
10306 env
->sps
= *pcc
->sps
;
10307 } else if (env
->mmu_model
& POWERPC_MMU_64
) {
10308 /* Use default sets of page sizes. We don't support MPSS */
10309 static const struct ppc_segment_page_sizes defsps_4k
= {
10311 { .page_shift
= 12, /* 4K */
10313 .enc
= { { .page_shift
= 12, .pte_enc
= 0 } }
10315 { .page_shift
= 24, /* 16M */
10317 .enc
= { { .page_shift
= 24, .pte_enc
= 0 } }
10321 static const struct ppc_segment_page_sizes defsps_64k
= {
10323 { .page_shift
= 12, /* 4K */
10325 .enc
= { { .page_shift
= 12, .pte_enc
= 0 } }
10327 { .page_shift
= 16, /* 64K */
10329 .enc
= { { .page_shift
= 16, .pte_enc
= 1 } }
10331 { .page_shift
= 24, /* 16M */
10333 .enc
= { { .page_shift
= 24, .pte_enc
= 0 } }
10337 env
->sps
= (env
->mmu_model
& POWERPC_MMU_64K
) ? defsps_64k
: defsps_4k
;
10339 #endif /* defined(TARGET_PPC64) */
10341 if (tcg_enabled()) {
10342 ppc_translate_init();
10346 static bool ppc_pvr_match_default(PowerPCCPUClass
*pcc
, uint32_t pvr
)
10348 return pcc
->pvr
== pvr
;
10351 static gchar
*ppc_gdb_arch_name(CPUState
*cs
)
10353 #if defined(TARGET_PPC64)
10354 return g_strdup("powerpc:common64");
10356 return g_strdup("powerpc:common");
10360 static void ppc_cpu_class_init(ObjectClass
*oc
, void *data
)
10362 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10363 CPUClass
*cc
= CPU_CLASS(oc
);
10364 DeviceClass
*dc
= DEVICE_CLASS(oc
);
10366 pcc
->parent_realize
= dc
->realize
;
10367 pcc
->pvr_match
= ppc_pvr_match_default
;
10368 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_always
;
10369 dc
->realize
= ppc_cpu_realizefn
;
10370 dc
->unrealize
= ppc_cpu_unrealizefn
;
10372 pcc
->parent_reset
= cc
->reset
;
10373 cc
->reset
= ppc_cpu_reset
;
10375 cc
->class_by_name
= ppc_cpu_class_by_name
;
10376 cc
->has_work
= ppc_cpu_has_work
;
10377 cc
->do_interrupt
= ppc_cpu_do_interrupt
;
10378 cc
->cpu_exec_interrupt
= ppc_cpu_exec_interrupt
;
10379 cc
->dump_state
= ppc_cpu_dump_state
;
10380 cc
->dump_statistics
= ppc_cpu_dump_statistics
;
10381 cc
->set_pc
= ppc_cpu_set_pc
;
10382 cc
->gdb_read_register
= ppc_cpu_gdb_read_register
;
10383 cc
->gdb_write_register
= ppc_cpu_gdb_write_register
;
10384 #ifdef CONFIG_USER_ONLY
10385 cc
->handle_mmu_fault
= ppc_cpu_handle_mmu_fault
;
10387 cc
->get_phys_page_debug
= ppc_cpu_get_phys_page_debug
;
10388 cc
->vmsd
= &vmstate_ppc_cpu
;
10389 #if defined(TARGET_PPC64)
10390 cc
->write_elf64_note
= ppc64_cpu_write_elf64_note
;
10393 cc
->cpu_exec_enter
= ppc_cpu_exec_enter
;
10395 cc
->gdb_num_core_regs
= 71;
10397 #ifdef USE_APPLE_GDB
10398 cc
->gdb_read_register
= ppc_cpu_gdb_read_register_apple
;
10399 cc
->gdb_write_register
= ppc_cpu_gdb_write_register_apple
;
10400 cc
->gdb_num_core_regs
= 71 + 32;
10403 cc
->gdb_arch_name
= ppc_gdb_arch_name
;
10404 #if defined(TARGET_PPC64)
10405 cc
->gdb_core_xml_file
= "power64-core.xml";
10407 cc
->gdb_core_xml_file
= "power-core.xml";
10409 #ifndef CONFIG_USER_ONLY
10410 cc
->virtio_is_big_endian
= ppc_cpu_is_big_endian
;
10413 dc
->fw_name
= "PowerPC,UNKNOWN";
10416 static const TypeInfo ppc_cpu_type_info
= {
10417 .name
= TYPE_POWERPC_CPU
,
10418 .parent
= TYPE_CPU
,
10419 .instance_size
= sizeof(PowerPCCPU
),
10420 .instance_init
= ppc_cpu_initfn
,
10422 .class_size
= sizeof(PowerPCCPUClass
),
10423 .class_init
= ppc_cpu_class_init
,
10426 static void ppc_cpu_register_types(void)
10428 type_register_static(&ppc_cpu_type_info
);
10431 type_init(ppc_cpu_register_types
)