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
,
7466 static void gen_fscr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7467 int bit
, int sprn
, int cause
)
7469 TCGv_i32 t1
= tcg_const_i32(bit
);
7470 TCGv_i32 t2
= tcg_const_i32(sprn
);
7471 TCGv_i32 t3
= tcg_const_i32(cause
);
7473 gen_update_current_nip(ctx
);
7474 gen_helper_fscr_facility_check(cpu_env
, t1
, t2
, t3
);
7476 tcg_temp_free_i32(t3
);
7477 tcg_temp_free_i32(t2
);
7478 tcg_temp_free_i32(t1
);
7481 static void gen_msr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7482 int bit
, int sprn
, int cause
)
7484 TCGv_i32 t1
= tcg_const_i32(bit
);
7485 TCGv_i32 t2
= tcg_const_i32(sprn
);
7486 TCGv_i32 t3
= tcg_const_i32(cause
);
7488 gen_update_current_nip(ctx
);
7489 gen_helper_msr_facility_check(cpu_env
, t1
, t2
, t3
);
7491 tcg_temp_free_i32(t3
);
7492 tcg_temp_free_i32(t2
);
7493 tcg_temp_free_i32(t1
);
7496 static void spr_read_prev_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
7498 TCGv spr_up
= tcg_temp_new();
7499 TCGv spr
= tcg_temp_new();
7501 gen_load_spr(spr
, sprn
- 1);
7502 tcg_gen_shri_tl(spr_up
, spr
, 32);
7503 tcg_gen_ext32u_tl(cpu_gpr
[gprn
], spr_up
);
7506 tcg_temp_free(spr_up
);
7509 static void spr_write_prev_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
7511 TCGv spr
= tcg_temp_new();
7513 gen_load_spr(spr
, sprn
- 1);
7514 tcg_gen_deposit_tl(spr
, spr
, cpu_gpr
[gprn
], 32, 32);
7515 gen_store_spr(sprn
- 1, spr
);
7520 static int check_pow_970 (CPUPPCState
*env
)
7522 if (env
->spr
[SPR_HID0
] & (HID0_DEEPNAP
| HID0_DOZE
| HID0_NAP
)) {
7529 static void gen_spr_970_hid(CPUPPCState
*env
)
7531 /* Hardware implementation registers */
7532 /* XXX : not implemented */
7533 spr_register(env
, SPR_HID0
, "HID0",
7534 SPR_NOACCESS
, SPR_NOACCESS
,
7535 &spr_read_generic
, &spr_write_clear
,
7537 spr_register(env
, SPR_HID1
, "HID1",
7538 SPR_NOACCESS
, SPR_NOACCESS
,
7539 &spr_read_generic
, &spr_write_generic
,
7541 spr_register(env
, SPR_970_HID5
, "HID5",
7542 SPR_NOACCESS
, SPR_NOACCESS
,
7543 &spr_read_generic
, &spr_write_generic
,
7544 POWERPC970_HID5_INIT
);
7547 static void gen_spr_970_hior(CPUPPCState
*env
)
7549 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7550 SPR_NOACCESS
, SPR_NOACCESS
,
7551 &spr_read_hior
, &spr_write_hior
,
7555 static void gen_spr_book3s_common(CPUPPCState
*env
)
7557 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
7558 SPR_NOACCESS
, SPR_NOACCESS
,
7559 SPR_NOACCESS
, &spr_write_generic
,
7561 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
7562 &spr_read_ureg
, SPR_NOACCESS
,
7563 &spr_read_ureg
, SPR_NOACCESS
,
7567 static void gen_spr_book3s_altivec(CPUPPCState
*env
)
7569 if (!(env
->insns_flags
& PPC_ALTIVEC
)) {
7573 spr_register_kvm(env
, SPR_VRSAVE
, "VRSAVE",
7574 &spr_read_generic
, &spr_write_generic
,
7575 &spr_read_generic
, &spr_write_generic
,
7576 KVM_REG_PPC_VRSAVE
, 0x00000000);
7578 /* Can't find information on what this should be on reset. This
7579 * value is the one used by 74xx processors. */
7580 vscr_init(env
, 0x00010000);
7583 static void gen_spr_book3s_dbg(CPUPPCState
*env
)
7586 * TODO: different specs define different scopes for these,
7587 * will have to address this:
7588 * 970: super/write and super/read
7589 * powerisa 2.03..2.04: hypv/write and super/read.
7590 * powerisa 2.05 and newer: hypv/write and hypv/read.
7592 spr_register_kvm(env
, SPR_DABR
, "DABR",
7593 SPR_NOACCESS
, SPR_NOACCESS
,
7594 &spr_read_generic
, &spr_write_generic
,
7595 KVM_REG_PPC_DABR
, 0x00000000);
7596 spr_register_kvm(env
, SPR_DABRX
, "DABRX",
7597 SPR_NOACCESS
, SPR_NOACCESS
,
7598 &spr_read_generic
, &spr_write_generic
,
7599 KVM_REG_PPC_DABRX
, 0x00000000);
7602 static void gen_spr_book3s_207_dbg(CPUPPCState
*env
)
7604 spr_register_kvm_hv(env
, SPR_DAWR
, "DAWR",
7605 SPR_NOACCESS
, SPR_NOACCESS
,
7606 SPR_NOACCESS
, SPR_NOACCESS
,
7607 &spr_read_generic
, &spr_write_generic
,
7608 KVM_REG_PPC_DAWR
, 0x00000000);
7609 spr_register_kvm_hv(env
, SPR_DAWRX
, "DAWRX",
7610 SPR_NOACCESS
, SPR_NOACCESS
,
7611 SPR_NOACCESS
, SPR_NOACCESS
,
7612 &spr_read_generic
, &spr_write_generic
,
7613 KVM_REG_PPC_DAWRX
, 0x00000000);
7614 spr_register_kvm_hv(env
, SPR_CIABR
, "CIABR",
7615 SPR_NOACCESS
, SPR_NOACCESS
,
7616 SPR_NOACCESS
, SPR_NOACCESS
,
7617 &spr_read_generic
, &spr_write_generic
,
7618 KVM_REG_PPC_CIABR
, 0x00000000);
7621 static void gen_spr_970_dbg(CPUPPCState
*env
)
7624 spr_register(env
, SPR_IABR
, "IABR",
7625 SPR_NOACCESS
, SPR_NOACCESS
,
7626 &spr_read_generic
, &spr_write_generic
,
7630 static void gen_spr_book3s_pmu_sup(CPUPPCState
*env
)
7632 spr_register_kvm(env
, SPR_POWER_MMCR0
, "MMCR0",
7633 SPR_NOACCESS
, SPR_NOACCESS
,
7634 &spr_read_generic
, &spr_write_generic
,
7635 KVM_REG_PPC_MMCR0
, 0x00000000);
7636 spr_register_kvm(env
, SPR_POWER_MMCR1
, "MMCR1",
7637 SPR_NOACCESS
, SPR_NOACCESS
,
7638 &spr_read_generic
, &spr_write_generic
,
7639 KVM_REG_PPC_MMCR1
, 0x00000000);
7640 spr_register_kvm(env
, SPR_POWER_MMCRA
, "MMCRA",
7641 SPR_NOACCESS
, SPR_NOACCESS
,
7642 &spr_read_generic
, &spr_write_generic
,
7643 KVM_REG_PPC_MMCRA
, 0x00000000);
7644 spr_register_kvm(env
, SPR_POWER_PMC1
, "PMC1",
7645 SPR_NOACCESS
, SPR_NOACCESS
,
7646 &spr_read_generic
, &spr_write_generic
,
7647 KVM_REG_PPC_PMC1
, 0x00000000);
7648 spr_register_kvm(env
, SPR_POWER_PMC2
, "PMC2",
7649 SPR_NOACCESS
, SPR_NOACCESS
,
7650 &spr_read_generic
, &spr_write_generic
,
7651 KVM_REG_PPC_PMC2
, 0x00000000);
7652 spr_register_kvm(env
, SPR_POWER_PMC3
, "PMC3",
7653 SPR_NOACCESS
, SPR_NOACCESS
,
7654 &spr_read_generic
, &spr_write_generic
,
7655 KVM_REG_PPC_PMC3
, 0x00000000);
7656 spr_register_kvm(env
, SPR_POWER_PMC4
, "PMC4",
7657 SPR_NOACCESS
, SPR_NOACCESS
,
7658 &spr_read_generic
, &spr_write_generic
,
7659 KVM_REG_PPC_PMC4
, 0x00000000);
7660 spr_register_kvm(env
, SPR_POWER_PMC5
, "PMC5",
7661 SPR_NOACCESS
, SPR_NOACCESS
,
7662 &spr_read_generic
, &spr_write_generic
,
7663 KVM_REG_PPC_PMC5
, 0x00000000);
7664 spr_register_kvm(env
, SPR_POWER_PMC6
, "PMC6",
7665 SPR_NOACCESS
, SPR_NOACCESS
,
7666 &spr_read_generic
, &spr_write_generic
,
7667 KVM_REG_PPC_PMC6
, 0x00000000);
7668 spr_register_kvm(env
, SPR_POWER_SIAR
, "SIAR",
7669 SPR_NOACCESS
, SPR_NOACCESS
,
7670 &spr_read_generic
, &spr_write_generic
,
7671 KVM_REG_PPC_SIAR
, 0x00000000);
7672 spr_register_kvm(env
, SPR_POWER_SDAR
, "SDAR",
7673 SPR_NOACCESS
, SPR_NOACCESS
,
7674 &spr_read_generic
, &spr_write_generic
,
7675 KVM_REG_PPC_SDAR
, 0x00000000);
7678 static void gen_spr_book3s_pmu_user(CPUPPCState
*env
)
7680 spr_register(env
, SPR_POWER_UMMCR0
, "UMMCR0",
7681 &spr_read_ureg
, SPR_NOACCESS
,
7682 &spr_read_ureg
, &spr_write_ureg
,
7684 spr_register(env
, SPR_POWER_UMMCR1
, "UMMCR1",
7685 &spr_read_ureg
, SPR_NOACCESS
,
7686 &spr_read_ureg
, &spr_write_ureg
,
7688 spr_register(env
, SPR_POWER_UMMCRA
, "UMMCRA",
7689 &spr_read_ureg
, SPR_NOACCESS
,
7690 &spr_read_ureg
, &spr_write_ureg
,
7692 spr_register(env
, SPR_POWER_UPMC1
, "UPMC1",
7693 &spr_read_ureg
, SPR_NOACCESS
,
7694 &spr_read_ureg
, &spr_write_ureg
,
7696 spr_register(env
, SPR_POWER_UPMC2
, "UPMC2",
7697 &spr_read_ureg
, SPR_NOACCESS
,
7698 &spr_read_ureg
, &spr_write_ureg
,
7700 spr_register(env
, SPR_POWER_UPMC3
, "UPMC3",
7701 &spr_read_ureg
, SPR_NOACCESS
,
7702 &spr_read_ureg
, &spr_write_ureg
,
7704 spr_register(env
, SPR_POWER_UPMC4
, "UPMC4",
7705 &spr_read_ureg
, SPR_NOACCESS
,
7706 &spr_read_ureg
, &spr_write_ureg
,
7708 spr_register(env
, SPR_POWER_UPMC5
, "UPMC5",
7709 &spr_read_ureg
, SPR_NOACCESS
,
7710 &spr_read_ureg
, &spr_write_ureg
,
7712 spr_register(env
, SPR_POWER_UPMC6
, "UPMC6",
7713 &spr_read_ureg
, SPR_NOACCESS
,
7714 &spr_read_ureg
, &spr_write_ureg
,
7716 spr_register(env
, SPR_POWER_USIAR
, "USIAR",
7717 &spr_read_ureg
, SPR_NOACCESS
,
7718 &spr_read_ureg
, &spr_write_ureg
,
7720 spr_register(env
, SPR_POWER_USDAR
, "USDAR",
7721 &spr_read_ureg
, SPR_NOACCESS
,
7722 &spr_read_ureg
, &spr_write_ureg
,
7726 static void gen_spr_970_pmu_sup(CPUPPCState
*env
)
7728 spr_register_kvm(env
, SPR_970_PMC7
, "PMC7",
7729 SPR_NOACCESS
, SPR_NOACCESS
,
7730 &spr_read_generic
, &spr_write_generic
,
7731 KVM_REG_PPC_PMC7
, 0x00000000);
7732 spr_register_kvm(env
, SPR_970_PMC8
, "PMC8",
7733 SPR_NOACCESS
, SPR_NOACCESS
,
7734 &spr_read_generic
, &spr_write_generic
,
7735 KVM_REG_PPC_PMC8
, 0x00000000);
7738 static void gen_spr_970_pmu_user(CPUPPCState
*env
)
7740 spr_register(env
, SPR_970_UPMC7
, "UPMC7",
7741 &spr_read_ureg
, SPR_NOACCESS
,
7742 &spr_read_ureg
, &spr_write_ureg
,
7744 spr_register(env
, SPR_970_UPMC8
, "UPMC8",
7745 &spr_read_ureg
, SPR_NOACCESS
,
7746 &spr_read_ureg
, &spr_write_ureg
,
7750 static void gen_spr_power8_pmu_sup(CPUPPCState
*env
)
7752 spr_register_kvm(env
, SPR_POWER_MMCR2
, "MMCR2",
7753 SPR_NOACCESS
, SPR_NOACCESS
,
7754 &spr_read_generic
, &spr_write_generic
,
7755 KVM_REG_PPC_MMCR2
, 0x00000000);
7756 spr_register_kvm(env
, SPR_POWER_MMCRS
, "MMCRS",
7757 SPR_NOACCESS
, SPR_NOACCESS
,
7758 &spr_read_generic
, &spr_write_generic
,
7759 KVM_REG_PPC_MMCRS
, 0x00000000);
7760 spr_register_kvm(env
, SPR_POWER_SIER
, "SIER",
7761 SPR_NOACCESS
, SPR_NOACCESS
,
7762 &spr_read_generic
, &spr_write_generic
,
7763 KVM_REG_PPC_SIER
, 0x00000000);
7764 spr_register_kvm(env
, SPR_POWER_SPMC1
, "SPMC1",
7765 SPR_NOACCESS
, SPR_NOACCESS
,
7766 &spr_read_generic
, &spr_write_generic
,
7767 KVM_REG_PPC_SPMC1
, 0x00000000);
7768 spr_register_kvm(env
, SPR_POWER_SPMC2
, "SPMC2",
7769 SPR_NOACCESS
, SPR_NOACCESS
,
7770 &spr_read_generic
, &spr_write_generic
,
7771 KVM_REG_PPC_SPMC2
, 0x00000000);
7772 spr_register_kvm(env
, SPR_TACR
, "TACR",
7773 SPR_NOACCESS
, SPR_NOACCESS
,
7774 &spr_read_generic
, &spr_write_generic
,
7775 KVM_REG_PPC_TACR
, 0x00000000);
7776 spr_register_kvm(env
, SPR_TCSCR
, "TCSCR",
7777 SPR_NOACCESS
, SPR_NOACCESS
,
7778 &spr_read_generic
, &spr_write_generic
,
7779 KVM_REG_PPC_TCSCR
, 0x00000000);
7780 spr_register_kvm(env
, SPR_CSIGR
, "CSIGR",
7781 SPR_NOACCESS
, SPR_NOACCESS
,
7782 &spr_read_generic
, &spr_write_generic
,
7783 KVM_REG_PPC_CSIGR
, 0x00000000);
7786 static void gen_spr_power8_pmu_user(CPUPPCState
*env
)
7788 spr_register(env
, SPR_POWER_UMMCR2
, "UMMCR2",
7789 &spr_read_ureg
, SPR_NOACCESS
,
7790 &spr_read_ureg
, &spr_write_ureg
,
7792 spr_register(env
, SPR_POWER_USIER
, "USIER",
7793 &spr_read_generic
, SPR_NOACCESS
,
7794 &spr_read_generic
, &spr_write_generic
,
7798 static void gen_spr_power5p_ear(CPUPPCState
*env
)
7800 /* External access control */
7801 spr_register(env
, SPR_EAR
, "EAR",
7802 SPR_NOACCESS
, SPR_NOACCESS
,
7803 &spr_read_generic
, &spr_write_generic
,
7807 #if !defined(CONFIG_USER_ONLY)
7808 static void spr_write_hmer(DisasContext
*ctx
, int sprn
, int gprn
)
7810 TCGv hmer
= tcg_temp_new();
7812 gen_load_spr(hmer
, sprn
);
7813 tcg_gen_and_tl(hmer
, cpu_gpr
[gprn
], hmer
);
7814 gen_store_spr(sprn
, hmer
);
7815 spr_store_dump_spr(sprn
);
7816 tcg_temp_free(hmer
);
7819 static void spr_write_lpcr(DisasContext
*ctx
, int sprn
, int gprn
)
7821 gen_helper_store_lpcr(cpu_env
, cpu_gpr
[gprn
]);
7824 static void spr_write_970_hid4(DisasContext
*ctx
, int sprn
, int gprn
)
7826 #if defined(TARGET_PPC64)
7827 spr_write_generic(ctx
, sprn
, gprn
);
7828 gen_helper_store_lpcr(cpu_env
, cpu_gpr
[gprn
]);
7832 #endif /* !defined(CONFIG_USER_ONLY) */
7834 static void gen_spr_970_lpar(CPUPPCState
*env
)
7836 #if !defined(CONFIG_USER_ONLY)
7837 /* Logical partitionning */
7838 /* PPC970: HID4 is effectively the LPCR */
7839 spr_register(env
, SPR_970_HID4
, "HID4",
7840 SPR_NOACCESS
, SPR_NOACCESS
,
7841 &spr_read_generic
, &spr_write_970_hid4
,
7846 static void gen_spr_power5p_lpar(CPUPPCState
*env
)
7848 #if !defined(CONFIG_USER_ONLY)
7849 /* Logical partitionning */
7850 spr_register_kvm_hv(env
, SPR_LPCR
, "LPCR",
7851 SPR_NOACCESS
, SPR_NOACCESS
,
7852 SPR_NOACCESS
, SPR_NOACCESS
,
7853 &spr_read_generic
, &spr_write_lpcr
,
7854 KVM_REG_PPC_LPCR
, LPCR_LPES0
| LPCR_LPES1
);
7855 spr_register_hv(env
, SPR_HDEC
, "HDEC",
7856 SPR_NOACCESS
, SPR_NOACCESS
,
7857 SPR_NOACCESS
, SPR_NOACCESS
,
7858 &spr_read_hdecr
, &spr_write_hdecr
, 0);
7862 static void gen_spr_book3s_ids(CPUPPCState
*env
)
7864 /* FIXME: Will need to deal with thread vs core only SPRs */
7866 /* Processor identification */
7867 spr_register_hv(env
, SPR_PIR
, "PIR",
7868 SPR_NOACCESS
, SPR_NOACCESS
,
7869 SPR_NOACCESS
, SPR_NOACCESS
,
7870 &spr_read_generic
, NULL
,
7872 spr_register_hv(env
, SPR_HID0
, "HID0",
7873 SPR_NOACCESS
, SPR_NOACCESS
,
7874 SPR_NOACCESS
, SPR_NOACCESS
,
7875 &spr_read_generic
, &spr_write_generic
,
7877 spr_register_hv(env
, SPR_TSCR
, "TSCR",
7878 SPR_NOACCESS
, SPR_NOACCESS
,
7879 SPR_NOACCESS
, SPR_NOACCESS
,
7880 &spr_read_generic
, &spr_write_generic
,
7882 spr_register_hv(env
, SPR_HMER
, "HMER",
7883 SPR_NOACCESS
, SPR_NOACCESS
,
7884 SPR_NOACCESS
, SPR_NOACCESS
,
7885 &spr_read_generic
, &spr_write_hmer
,
7887 spr_register_hv(env
, SPR_HMEER
, "HMEER",
7888 SPR_NOACCESS
, SPR_NOACCESS
,
7889 SPR_NOACCESS
, SPR_NOACCESS
,
7890 &spr_read_generic
, &spr_write_generic
,
7892 spr_register_hv(env
, SPR_TFMR
, "TFMR",
7893 SPR_NOACCESS
, SPR_NOACCESS
,
7894 SPR_NOACCESS
, SPR_NOACCESS
,
7895 &spr_read_generic
, &spr_write_generic
,
7897 spr_register_hv(env
, SPR_LPIDR
, "LPIDR",
7898 SPR_NOACCESS
, SPR_NOACCESS
,
7899 SPR_NOACCESS
, SPR_NOACCESS
,
7900 &spr_read_generic
, &spr_write_generic
,
7902 spr_register_hv(env
, SPR_HFSCR
, "HFSCR",
7903 SPR_NOACCESS
, SPR_NOACCESS
,
7904 SPR_NOACCESS
, SPR_NOACCESS
,
7905 &spr_read_generic
, &spr_write_generic
,
7907 spr_register_hv(env
, SPR_MMCRC
, "MMCRC",
7908 SPR_NOACCESS
, SPR_NOACCESS
,
7909 SPR_NOACCESS
, SPR_NOACCESS
,
7910 &spr_read_generic
, &spr_write_generic
,
7912 spr_register_hv(env
, SPR_MMCRH
, "MMCRH",
7913 SPR_NOACCESS
, SPR_NOACCESS
,
7914 SPR_NOACCESS
, SPR_NOACCESS
,
7915 &spr_read_generic
, &spr_write_generic
,
7917 spr_register_hv(env
, SPR_HSPRG0
, "HSPRG0",
7918 SPR_NOACCESS
, SPR_NOACCESS
,
7919 SPR_NOACCESS
, SPR_NOACCESS
,
7920 &spr_read_generic
, &spr_write_generic
,
7922 spr_register_hv(env
, SPR_HSPRG1
, "HSPRG1",
7923 SPR_NOACCESS
, SPR_NOACCESS
,
7924 SPR_NOACCESS
, SPR_NOACCESS
,
7925 &spr_read_generic
, &spr_write_generic
,
7927 spr_register_hv(env
, SPR_HSRR0
, "HSRR0",
7928 SPR_NOACCESS
, SPR_NOACCESS
,
7929 SPR_NOACCESS
, SPR_NOACCESS
,
7930 &spr_read_generic
, &spr_write_generic
,
7932 spr_register_hv(env
, SPR_HSRR1
, "HSRR1",
7933 SPR_NOACCESS
, SPR_NOACCESS
,
7934 SPR_NOACCESS
, SPR_NOACCESS
,
7935 &spr_read_generic
, &spr_write_generic
,
7937 spr_register_hv(env
, SPR_HDAR
, "HDAR",
7938 SPR_NOACCESS
, SPR_NOACCESS
,
7939 SPR_NOACCESS
, SPR_NOACCESS
,
7940 &spr_read_generic
, &spr_write_generic
,
7942 spr_register_hv(env
, SPR_HDSISR
, "HDSISR",
7943 SPR_NOACCESS
, SPR_NOACCESS
,
7944 SPR_NOACCESS
, SPR_NOACCESS
,
7945 &spr_read_generic
, &spr_write_generic
,
7947 spr_register_hv(env
, SPR_RMOR
, "RMOR",
7948 SPR_NOACCESS
, SPR_NOACCESS
,
7949 SPR_NOACCESS
, SPR_NOACCESS
,
7950 &spr_read_generic
, &spr_write_generic
,
7952 spr_register_hv(env
, SPR_HRMOR
, "HRMOR",
7953 SPR_NOACCESS
, SPR_NOACCESS
,
7954 SPR_NOACCESS
, SPR_NOACCESS
,
7955 &spr_read_generic
, &spr_write_generic
,
7959 static void gen_spr_power8_ids(CPUPPCState
*env
)
7961 /* Thread identification */
7962 spr_register(env
, SPR_TIR
, "TIR",
7963 SPR_NOACCESS
, SPR_NOACCESS
,
7964 &spr_read_generic
, SPR_NOACCESS
,
7968 static void gen_spr_book3s_purr(CPUPPCState
*env
)
7970 #if !defined(CONFIG_USER_ONLY)
7971 /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
7972 spr_register_kvm(env
, SPR_PURR
, "PURR",
7973 &spr_read_purr
, SPR_NOACCESS
,
7974 &spr_read_purr
, SPR_NOACCESS
,
7975 KVM_REG_PPC_PURR
, 0x00000000);
7976 spr_register_kvm(env
, SPR_SPURR
, "SPURR",
7977 &spr_read_purr
, SPR_NOACCESS
,
7978 &spr_read_purr
, SPR_NOACCESS
,
7979 KVM_REG_PPC_SPURR
, 0x00000000);
7983 static void gen_spr_power6_dbg(CPUPPCState
*env
)
7985 #if !defined(CONFIG_USER_ONLY)
7986 spr_register(env
, SPR_CFAR
, "SPR_CFAR",
7987 SPR_NOACCESS
, SPR_NOACCESS
,
7988 &spr_read_cfar
, &spr_write_cfar
,
7993 static void gen_spr_power5p_common(CPUPPCState
*env
)
7995 spr_register_kvm(env
, SPR_PPR
, "PPR",
7996 &spr_read_generic
, &spr_write_generic
,
7997 &spr_read_generic
, &spr_write_generic
,
7998 KVM_REG_PPC_PPR
, 0x00000000);
8001 static void gen_spr_power6_common(CPUPPCState
*env
)
8003 #if !defined(CONFIG_USER_ONLY)
8004 spr_register_kvm(env
, SPR_DSCR
, "SPR_DSCR",
8005 SPR_NOACCESS
, SPR_NOACCESS
,
8006 &spr_read_generic
, &spr_write_generic
,
8007 KVM_REG_PPC_DSCR
, 0x00000000);
8010 * Register PCR to report POWERPC_EXCP_PRIV_REG instead of
8011 * POWERPC_EXCP_INVAL_SPR.
8013 spr_register(env
, SPR_PCR
, "PCR",
8014 SPR_NOACCESS
, SPR_NOACCESS
,
8015 SPR_NOACCESS
, SPR_NOACCESS
,
8019 static void spr_read_tar(DisasContext
*ctx
, int gprn
, int sprn
)
8021 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
8022 spr_read_generic(ctx
, gprn
, sprn
);
8025 static void spr_write_tar(DisasContext
*ctx
, int sprn
, int gprn
)
8027 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
8028 spr_write_generic(ctx
, sprn
, gprn
);
8031 static void gen_spr_power8_tce_address_control(CPUPPCState
*env
)
8033 spr_register_kvm(env
, SPR_TAR
, "TAR",
8034 &spr_read_tar
, &spr_write_tar
,
8035 &spr_read_generic
, &spr_write_generic
,
8036 KVM_REG_PPC_TAR
, 0x00000000);
8039 static void spr_read_tm(DisasContext
*ctx
, int gprn
, int sprn
)
8041 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8042 spr_read_generic(ctx
, gprn
, sprn
);
8045 static void spr_write_tm(DisasContext
*ctx
, int sprn
, int gprn
)
8047 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8048 spr_write_generic(ctx
, sprn
, gprn
);
8051 static void spr_read_tm_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
8053 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8054 spr_read_prev_upper32(ctx
, gprn
, sprn
);
8057 static void spr_write_tm_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
8059 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8060 spr_write_prev_upper32(ctx
, sprn
, gprn
);
8063 static void gen_spr_power8_tm(CPUPPCState
*env
)
8065 spr_register_kvm(env
, SPR_TFHAR
, "TFHAR",
8066 &spr_read_tm
, &spr_write_tm
,
8067 &spr_read_tm
, &spr_write_tm
,
8068 KVM_REG_PPC_TFHAR
, 0x00000000);
8069 spr_register_kvm(env
, SPR_TFIAR
, "TFIAR",
8070 &spr_read_tm
, &spr_write_tm
,
8071 &spr_read_tm
, &spr_write_tm
,
8072 KVM_REG_PPC_TFIAR
, 0x00000000);
8073 spr_register_kvm(env
, SPR_TEXASR
, "TEXASR",
8074 &spr_read_tm
, &spr_write_tm
,
8075 &spr_read_tm
, &spr_write_tm
,
8076 KVM_REG_PPC_TEXASR
, 0x00000000);
8077 spr_register(env
, SPR_TEXASRU
, "TEXASRU",
8078 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
8079 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
8083 static void spr_read_ebb(DisasContext
*ctx
, int gprn
, int sprn
)
8085 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8086 spr_read_generic(ctx
, gprn
, sprn
);
8089 static void spr_write_ebb(DisasContext
*ctx
, int sprn
, int gprn
)
8091 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8092 spr_write_generic(ctx
, sprn
, gprn
);
8095 static void spr_read_ebb_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
8097 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8098 spr_read_prev_upper32(ctx
, gprn
, sprn
);
8101 static void spr_write_ebb_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
8103 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8104 spr_write_prev_upper32(ctx
, sprn
, gprn
);
8107 static void gen_spr_power8_ebb(CPUPPCState
*env
)
8109 spr_register(env
, SPR_BESCRS
, "BESCRS",
8110 &spr_read_ebb
, &spr_write_ebb
,
8111 &spr_read_generic
, &spr_write_generic
,
8113 spr_register(env
, SPR_BESCRSU
, "BESCRSU",
8114 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
8115 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
8117 spr_register(env
, SPR_BESCRR
, "BESCRR",
8118 &spr_read_ebb
, &spr_write_ebb
,
8119 &spr_read_generic
, &spr_write_generic
,
8121 spr_register(env
, SPR_BESCRRU
, "BESCRRU",
8122 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
8123 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
8125 spr_register_kvm(env
, SPR_EBBHR
, "EBBHR",
8126 &spr_read_ebb
, &spr_write_ebb
,
8127 &spr_read_generic
, &spr_write_generic
,
8128 KVM_REG_PPC_EBBHR
, 0x00000000);
8129 spr_register_kvm(env
, SPR_EBBRR
, "EBBRR",
8130 &spr_read_ebb
, &spr_write_ebb
,
8131 &spr_read_generic
, &spr_write_generic
,
8132 KVM_REG_PPC_EBBRR
, 0x00000000);
8133 spr_register_kvm(env
, SPR_BESCR
, "BESCR",
8134 &spr_read_ebb
, &spr_write_ebb
,
8135 &spr_read_generic
, &spr_write_generic
,
8136 KVM_REG_PPC_BESCR
, 0x00000000);
8139 /* Virtual Time Base */
8140 static void gen_spr_vtb(CPUPPCState
*env
)
8142 spr_register(env
, SPR_VTB
, "VTB",
8143 SPR_NOACCESS
, SPR_NOACCESS
,
8144 &spr_read_tbl
, SPR_NOACCESS
,
8148 static void gen_spr_power8_fscr(CPUPPCState
*env
)
8150 #if defined(CONFIG_USER_ONLY)
8151 target_ulong initval
= 1ULL << FSCR_TAR
;
8153 target_ulong initval
= 0;
8155 spr_register_kvm(env
, SPR_FSCR
, "FSCR",
8156 SPR_NOACCESS
, SPR_NOACCESS
,
8157 &spr_read_generic
, &spr_write_generic
,
8158 KVM_REG_PPC_FSCR
, initval
);
8161 static void gen_spr_power8_pspb(CPUPPCState
*env
)
8163 spr_register_kvm(env
, SPR_PSPB
, "PSPB",
8164 SPR_NOACCESS
, SPR_NOACCESS
,
8165 &spr_read_generic
, &spr_write_generic32
,
8166 KVM_REG_PPC_PSPB
, 0);
8169 static void gen_spr_power8_ic(CPUPPCState
*env
)
8171 #if !defined(CONFIG_USER_ONLY)
8172 spr_register_hv(env
, SPR_IC
, "IC",
8173 SPR_NOACCESS
, SPR_NOACCESS
,
8174 &spr_read_generic
, SPR_NOACCESS
,
8175 &spr_read_generic
, &spr_write_generic
,
8180 static void gen_spr_power8_book4(CPUPPCState
*env
)
8182 /* Add a number of P8 book4 registers */
8183 #if !defined(CONFIG_USER_ONLY)
8184 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
8185 SPR_NOACCESS
, SPR_NOACCESS
,
8186 &spr_read_generic
, &spr_write_generic
,
8187 KVM_REG_PPC_ACOP
, 0);
8188 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
8189 SPR_NOACCESS
, SPR_NOACCESS
,
8190 &spr_read_generic
, &spr_write_generic
,
8191 KVM_REG_PPC_PID
, 0);
8192 spr_register_kvm(env
, SPR_WORT
, "WORT",
8193 SPR_NOACCESS
, SPR_NOACCESS
,
8194 &spr_read_generic
, &spr_write_generic
,
8195 KVM_REG_PPC_WORT
, 0);
8199 static void gen_spr_power7_book4(CPUPPCState
*env
)
8201 /* Add a number of P7 book4 registers */
8202 #if !defined(CONFIG_USER_ONLY)
8203 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
8204 SPR_NOACCESS
, SPR_NOACCESS
,
8205 &spr_read_generic
, &spr_write_generic
,
8206 KVM_REG_PPC_ACOP
, 0);
8207 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
8208 SPR_NOACCESS
, SPR_NOACCESS
,
8209 &spr_read_generic
, &spr_write_generic
,
8210 KVM_REG_PPC_PID
, 0);
8214 static void gen_spr_power8_rpr(CPUPPCState
*env
)
8216 #if !defined(CONFIG_USER_ONLY)
8217 spr_register_hv(env
, SPR_RPR
, "RPR",
8218 SPR_NOACCESS
, SPR_NOACCESS
,
8219 SPR_NOACCESS
, SPR_NOACCESS
,
8220 &spr_read_generic
, &spr_write_generic
,
8221 0x00000103070F1F3F);
8225 static void init_proc_book3s_64(CPUPPCState
*env
, int version
)
8227 gen_spr_ne_601(env
);
8229 gen_spr_book3s_altivec(env
);
8230 gen_spr_book3s_pmu_sup(env
);
8231 gen_spr_book3s_pmu_user(env
);
8232 gen_spr_book3s_common(env
);
8235 case BOOK3S_CPU_970
:
8236 case BOOK3S_CPU_POWER5PLUS
:
8237 gen_spr_970_hid(env
);
8238 gen_spr_970_hior(env
);
8240 gen_spr_970_pmu_sup(env
);
8241 gen_spr_970_pmu_user(env
);
8243 case BOOK3S_CPU_POWER7
:
8244 case BOOK3S_CPU_POWER8
:
8245 case BOOK3S_CPU_POWER9
:
8246 gen_spr_book3s_ids(env
);
8247 gen_spr_amr(env
, version
>= BOOK3S_CPU_POWER8
);
8248 gen_spr_book3s_purr(env
);
8249 env
->ci_large_pages
= true;
8252 g_assert_not_reached();
8254 if (version
>= BOOK3S_CPU_POWER5PLUS
) {
8255 gen_spr_power5p_common(env
);
8256 gen_spr_power5p_lpar(env
);
8257 gen_spr_power5p_ear(env
);
8259 gen_spr_970_lpar(env
);
8261 if (version
== BOOK3S_CPU_970
) {
8262 gen_spr_970_dbg(env
);
8264 if (version
>= BOOK3S_CPU_POWER6
) {
8265 gen_spr_power6_common(env
);
8266 gen_spr_power6_dbg(env
);
8268 if (version
== BOOK3S_CPU_POWER7
) {
8269 gen_spr_power7_book4(env
);
8271 if (version
>= BOOK3S_CPU_POWER8
) {
8272 gen_spr_power8_tce_address_control(env
);
8273 gen_spr_power8_ids(env
);
8274 gen_spr_power8_ebb(env
);
8275 gen_spr_power8_fscr(env
);
8276 gen_spr_power8_pmu_sup(env
);
8277 gen_spr_power8_pmu_user(env
);
8278 gen_spr_power8_tm(env
);
8279 gen_spr_power8_pspb(env
);
8281 gen_spr_power8_ic(env
);
8282 gen_spr_power8_book4(env
);
8283 gen_spr_power8_rpr(env
);
8285 if (version
< BOOK3S_CPU_POWER8
) {
8286 gen_spr_book3s_dbg(env
);
8288 gen_spr_book3s_207_dbg(env
);
8290 #if !defined(CONFIG_USER_ONLY)
8292 case BOOK3S_CPU_970
:
8293 case BOOK3S_CPU_POWER5PLUS
:
8296 case BOOK3S_CPU_POWER7
:
8297 case BOOK3S_CPU_POWER8
:
8298 case BOOK3S_CPU_POWER9
:
8304 /* Allocate hardware IRQ controller */
8306 case BOOK3S_CPU_970
:
8307 case BOOK3S_CPU_POWER5PLUS
:
8309 ppc970_irq_init(ppc_env_get_cpu(env
));
8311 case BOOK3S_CPU_POWER7
:
8312 init_excp_POWER7(env
);
8313 ppcPOWER7_irq_init(ppc_env_get_cpu(env
));
8315 case BOOK3S_CPU_POWER8
:
8316 case BOOK3S_CPU_POWER9
:
8317 init_excp_POWER8(env
);
8318 ppcPOWER7_irq_init(ppc_env_get_cpu(env
));
8321 g_assert_not_reached();
8324 env
->dcache_line_size
= 128;
8325 env
->icache_line_size
= 128;
8328 static void init_proc_970(CPUPPCState
*env
)
8330 init_proc_book3s_64(env
, BOOK3S_CPU_970
);
8333 POWERPC_FAMILY(970)(ObjectClass
*oc
, void *data
)
8335 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8336 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8338 dc
->desc
= "PowerPC 970";
8339 pcc
->init_proc
= init_proc_970
;
8340 pcc
->check_pow
= check_pow_970
;
8341 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8342 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8343 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8345 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8346 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8347 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8348 PPC_64B
| PPC_ALTIVEC
|
8349 PPC_SEGMENT_64B
| PPC_SLBI
;
8350 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8351 pcc
->msr_mask
= (1ull << MSR_SF
) |
8366 pcc
->mmu_model
= POWERPC_MMU_64B
;
8367 #if defined(CONFIG_SOFTMMU)
8368 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8370 pcc
->excp_model
= POWERPC_EXCP_970
;
8371 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8372 pcc
->bfd_mach
= bfd_mach_ppc64
;
8373 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8374 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8375 POWERPC_FLAG_BUS_CLK
;
8376 pcc
->l1_dcache_size
= 0x8000;
8377 pcc
->l1_icache_size
= 0x10000;
8380 static void init_proc_power5plus(CPUPPCState
*env
)
8382 init_proc_book3s_64(env
, BOOK3S_CPU_POWER5PLUS
);
8385 POWERPC_FAMILY(POWER5P
)(ObjectClass
*oc
, void *data
)
8387 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8388 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8390 dc
->fw_name
= "PowerPC,POWER5";
8391 dc
->desc
= "POWER5+";
8392 pcc
->init_proc
= init_proc_power5plus
;
8393 pcc
->check_pow
= check_pow_970
;
8394 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8395 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8396 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8398 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8399 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8400 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8402 PPC_SEGMENT_64B
| PPC_SLBI
;
8403 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8404 pcc
->msr_mask
= (1ull << MSR_SF
) |
8419 pcc
->mmu_model
= POWERPC_MMU_2_03
;
8420 #if defined(CONFIG_SOFTMMU)
8421 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8423 pcc
->excp_model
= POWERPC_EXCP_970
;
8424 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8425 pcc
->bfd_mach
= bfd_mach_ppc64
;
8426 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8427 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8428 POWERPC_FLAG_BUS_CLK
;
8429 pcc
->l1_dcache_size
= 0x8000;
8430 pcc
->l1_icache_size
= 0x10000;
8433 static void powerpc_get_compat(Object
*obj
, Visitor
*v
, const char *name
,
8434 void *opaque
, Error
**errp
)
8436 char *value
= (char *)"";
8437 Property
*prop
= opaque
;
8438 uint32_t *max_compat
= qdev_get_prop_ptr(DEVICE(obj
), prop
);
8440 switch (*max_compat
) {
8441 case CPU_POWERPC_LOGICAL_2_05
:
8442 value
= (char *)"power6";
8444 case CPU_POWERPC_LOGICAL_2_06
:
8445 value
= (char *)"power7";
8447 case CPU_POWERPC_LOGICAL_2_07
:
8448 value
= (char *)"power8";
8453 error_report("Internal error: compat is set to %x", *max_compat
);
8458 visit_type_str(v
, name
, &value
, errp
);
8461 static void powerpc_set_compat(Object
*obj
, Visitor
*v
, const char *name
,
8462 void *opaque
, Error
**errp
)
8464 Error
*error
= NULL
;
8466 Property
*prop
= opaque
;
8467 uint32_t *max_compat
= qdev_get_prop_ptr(DEVICE(obj
), prop
);
8469 visit_type_str(v
, name
, &value
, &error
);
8471 error_propagate(errp
, error
);
8475 if (strcmp(value
, "power6") == 0) {
8476 *max_compat
= CPU_POWERPC_LOGICAL_2_05
;
8477 } else if (strcmp(value
, "power7") == 0) {
8478 *max_compat
= CPU_POWERPC_LOGICAL_2_06
;
8479 } else if (strcmp(value
, "power8") == 0) {
8480 *max_compat
= CPU_POWERPC_LOGICAL_2_07
;
8482 error_setg(errp
, "Invalid compatibility mode \"%s\"", value
);
8488 static PropertyInfo powerpc_compat_propinfo
= {
8490 .description
= "compatibility mode, power6/power7/power8",
8491 .get
= powerpc_get_compat
,
8492 .set
= powerpc_set_compat
,
8495 #define DEFINE_PROP_POWERPC_COMPAT(_n, _s, _f) \
8496 DEFINE_PROP(_n, _s, _f, powerpc_compat_propinfo, uint32_t)
8498 static Property powerpc_servercpu_properties
[] = {
8499 DEFINE_PROP_POWERPC_COMPAT("compat", PowerPCCPU
, max_compat
),
8500 DEFINE_PROP_END_OF_LIST(),
8503 #ifdef CONFIG_SOFTMMU
8504 static const struct ppc_segment_page_sizes POWER7_POWER8_sps
= {
8507 .page_shift
= 12, /* 4K */
8509 .enc
= { { .page_shift
= 12, .pte_enc
= 0 },
8510 { .page_shift
= 16, .pte_enc
= 0x7 },
8511 { .page_shift
= 24, .pte_enc
= 0x38 }, },
8514 .page_shift
= 16, /* 64K */
8515 .slb_enc
= SLB_VSID_64K
,
8516 .enc
= { { .page_shift
= 16, .pte_enc
= 0x1 },
8517 { .page_shift
= 24, .pte_enc
= 0x8 }, },
8520 .page_shift
= 24, /* 16M */
8521 .slb_enc
= SLB_VSID_16M
,
8522 .enc
= { { .page_shift
= 24, .pte_enc
= 0 }, },
8525 .page_shift
= 34, /* 16G */
8526 .slb_enc
= SLB_VSID_16G
,
8527 .enc
= { { .page_shift
= 34, .pte_enc
= 0x3 }, },
8531 #endif /* CONFIG_SOFTMMU */
8533 static void init_proc_POWER7 (CPUPPCState
*env
)
8535 init_proc_book3s_64(env
, BOOK3S_CPU_POWER7
);
8538 static bool ppc_pvr_match_power7(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8540 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7P_BASE
) {
8543 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7_BASE
) {
8549 static bool cpu_has_work_POWER7(CPUState
*cs
)
8551 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
8552 CPUPPCState
*env
= &cpu
->env
;
8555 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
8558 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
8559 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE0
)) {
8562 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
8563 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE1
)) {
8566 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
)) &&
8567 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE2
)) {
8570 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HMI
)) &&
8571 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE2
)) {
8574 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
8579 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
8583 POWERPC_FAMILY(POWER7
)(ObjectClass
*oc
, void *data
)
8585 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8586 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8587 CPUClass
*cc
= CPU_CLASS(oc
);
8589 dc
->fw_name
= "PowerPC,POWER7";
8590 dc
->desc
= "POWER7";
8591 dc
->props
= powerpc_servercpu_properties
;
8592 pcc
->pvr_match
= ppc_pvr_match_power7
;
8593 pcc
->pcr_mask
= PCR_VEC_DIS
| PCR_VSX_DIS
| PCR_COMPAT_2_05
;
8594 pcc
->pcr_supported
= PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8595 pcc
->init_proc
= init_proc_POWER7
;
8596 pcc
->check_pow
= check_pow_nocheck
;
8597 cc
->has_work
= cpu_has_work_POWER7
;
8598 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8599 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8600 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8601 PPC_FLOAT_FRSQRTES
|
8604 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8605 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8606 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8607 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
8608 PPC_SEGMENT_64B
| PPC_SLBI
|
8609 PPC_POPCNTB
| PPC_POPCNTWD
|
8611 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
8612 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8613 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8614 PPC2_FP_TST_ISA206
| PPC2_FP_CVT_S64
|
8616 pcc
->msr_mask
= (1ull << MSR_SF
) |
8632 pcc
->mmu_model
= POWERPC_MMU_2_06
;
8633 #if defined(CONFIG_SOFTMMU)
8634 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8635 pcc
->sps
= &POWER7_POWER8_sps
;
8637 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
8638 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8639 pcc
->bfd_mach
= bfd_mach_ppc64
;
8640 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8641 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8642 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8644 pcc
->l1_dcache_size
= 0x8000;
8645 pcc
->l1_icache_size
= 0x8000;
8646 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8649 static void init_proc_POWER8(CPUPPCState
*env
)
8651 init_proc_book3s_64(env
, BOOK3S_CPU_POWER8
);
8654 static bool ppc_pvr_match_power8(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8656 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8NVL_BASE
) {
8659 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8E_BASE
) {
8662 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8_BASE
) {
8668 static bool cpu_has_work_POWER8(CPUState
*cs
)
8670 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
8671 CPUPPCState
*env
= &cpu
->env
;
8674 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
8677 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
8678 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE2
)) {
8681 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
8682 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE3
)) {
8685 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
)) &&
8686 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE4
)) {
8689 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HMI
)) &&
8690 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE4
)) {
8693 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DOORBELL
)) &&
8694 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE0
)) {
8697 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HDOORBELL
)) &&
8698 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE1
)) {
8701 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
8706 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
8710 POWERPC_FAMILY(POWER8
)(ObjectClass
*oc
, void *data
)
8712 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8713 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8714 CPUClass
*cc
= CPU_CLASS(oc
);
8716 dc
->fw_name
= "PowerPC,POWER8";
8717 dc
->desc
= "POWER8";
8718 dc
->props
= powerpc_servercpu_properties
;
8719 pcc
->pvr_match
= ppc_pvr_match_power8
;
8720 pcc
->pcr_mask
= PCR_TM_DIS
| PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8721 pcc
->pcr_supported
= PCR_COMPAT_2_07
| PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8722 pcc
->init_proc
= init_proc_POWER8
;
8723 pcc
->check_pow
= check_pow_nocheck
;
8724 cc
->has_work
= cpu_has_work_POWER8
;
8725 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8726 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8727 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8728 PPC_FLOAT_FRSQRTES
|
8731 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8732 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8733 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8734 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
8735 PPC_SEGMENT_64B
| PPC_SLBI
|
8736 PPC_POPCNTB
| PPC_POPCNTWD
|
8738 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
8739 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8740 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8741 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
8742 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
8743 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
8744 PPC2_TM
| PPC2_PM_ISA206
;
8745 pcc
->msr_mask
= (1ull << MSR_SF
) |
8763 pcc
->mmu_model
= POWERPC_MMU_2_07
;
8764 #if defined(CONFIG_SOFTMMU)
8765 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8766 pcc
->sps
= &POWER7_POWER8_sps
;
8768 pcc
->excp_model
= POWERPC_EXCP_POWER8
;
8769 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8770 pcc
->bfd_mach
= bfd_mach_ppc64
;
8771 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8772 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8773 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8774 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
;
8775 pcc
->l1_dcache_size
= 0x8000;
8776 pcc
->l1_icache_size
= 0x8000;
8777 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8779 static void init_proc_POWER9(CPUPPCState
*env
)
8781 init_proc_book3s_64(env
, BOOK3S_CPU_POWER9
);
8784 static bool ppc_pvr_match_power9(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8786 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER9_BASE
) {
8792 POWERPC_FAMILY(POWER9
)(ObjectClass
*oc
, void *data
)
8794 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8795 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8797 dc
->fw_name
= "PowerPC,POWER9";
8798 dc
->desc
= "POWER9";
8799 dc
->props
= powerpc_servercpu_properties
;
8800 pcc
->pvr_match
= ppc_pvr_match_power9
;
8801 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
| PCR_COMPAT_2_07
;
8802 pcc
->init_proc
= init_proc_POWER9
;
8803 pcc
->check_pow
= check_pow_nocheck
;
8804 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8805 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8806 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8807 PPC_FLOAT_FRSQRTES
|
8810 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8811 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8812 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8813 PPC_64B
| PPC_64BX
| PPC_ALTIVEC
|
8814 PPC_SEGMENT_64B
| PPC_SLBI
|
8815 PPC_POPCNTB
| PPC_POPCNTWD
|
8817 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
8818 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8819 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8820 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
8821 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
8822 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
8823 PPC2_TM
| PPC2_PM_ISA206
| PPC2_ISA300
;
8824 pcc
->msr_mask
= (1ull << MSR_SF
) |
8841 /* Using 2.07 defines until new radix model is added. */
8842 pcc
->mmu_model
= POWERPC_MMU_2_07
;
8843 #if defined(CONFIG_SOFTMMU)
8844 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8845 /* segment page size remain the same */
8846 pcc
->sps
= &POWER7_POWER8_sps
;
8848 pcc
->excp_model
= POWERPC_EXCP_POWER8
;
8849 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8850 pcc
->bfd_mach
= bfd_mach_ppc64
;
8851 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8852 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8853 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8854 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
;
8855 pcc
->l1_dcache_size
= 0x8000;
8856 pcc
->l1_icache_size
= 0x8000;
8857 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8860 #if !defined(CONFIG_USER_ONLY)
8862 void cpu_ppc_set_papr(PowerPCCPU
*cpu
)
8864 CPUPPCState
*env
= &cpu
->env
;
8865 ppc_spr_t
*lpcr
= &env
->spr_cb
[SPR_LPCR
];
8866 ppc_spr_t
*amor
= &env
->spr_cb
[SPR_AMOR
];
8868 /* PAPR always has exception vectors in RAM not ROM. To ensure this,
8869 * MSR[IP] should never be set.
8871 * We also disallow setting of MSR_HV
8873 env
->msr_mask
&= ~((1ull << MSR_EP
) | MSR_HVB
);
8875 /* Set emulated LPCR to not send interrupts to hypervisor. Note that
8876 * under KVM, the actual HW LPCR will be set differently by KVM itself,
8877 * the settings below ensure proper operations with TCG in absence of
8878 * a real hypervisor.
8880 * Clearing VPM0 will also cause us to use RMOR in mmu-hash64.c for
8881 * real mode accesses, which thankfully defaults to 0 and isn't
8882 * accessible in guest mode.
8884 lpcr
->default_value
&= ~(LPCR_VPM0
| LPCR_VPM1
| LPCR_ISL
| LPCR_KBV
);
8885 lpcr
->default_value
|= LPCR_LPES0
| LPCR_LPES1
;
8887 /* Set RMLS to the max (ie, 16G) */
8888 lpcr
->default_value
&= ~LPCR_RMLS
;
8889 lpcr
->default_value
|= 1ull << LPCR_RMLS_SHIFT
;
8891 /* P7 and P8 has slightly different PECE bits, mostly because P8 adds
8892 * bit 47 and 48 which are reserved on P7. Here we set them all, which
8893 * will work as expected for both implementations
8895 lpcr
->default_value
|= LPCR_P8_PECE0
| LPCR_P8_PECE1
| LPCR_P8_PECE2
|
8896 LPCR_P8_PECE3
| LPCR_P8_PECE4
;
8898 /* We should be followed by a CPU reset but update the active value
8901 env
->spr
[SPR_LPCR
] = lpcr
->default_value
;
8903 /* Set a full AMOR so guest can use the AMR as it sees fit */
8904 env
->spr
[SPR_AMOR
] = amor
->default_value
= 0xffffffffffffffffull
;
8906 /* Update some env bits based on new LPCR value */
8907 ppc_hash64_update_rmls(env
);
8908 ppc_hash64_update_vrma(env
);
8910 /* Tell KVM that we're in PAPR mode */
8911 if (kvm_enabled()) {
8912 kvmppc_set_papr(cpu
);
8916 #endif /* !defined(CONFIG_USER_ONLY) */
8918 #endif /* defined (TARGET_PPC64) */
8920 /*****************************************************************************/
8921 /* Generic CPU instantiation routine */
8922 static void init_ppc_proc(PowerPCCPU
*cpu
)
8924 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8925 CPUPPCState
*env
= &cpu
->env
;
8926 #if !defined(CONFIG_USER_ONLY)
8929 env
->irq_inputs
= NULL
;
8930 /* Set all exception vectors to an invalid address */
8931 for (i
= 0; i
< POWERPC_EXCP_NB
; i
++)
8932 env
->excp_vectors
[i
] = (target_ulong
)(-1ULL);
8933 env
->ivor_mask
= 0x00000000;
8934 env
->ivpr_mask
= 0x00000000;
8935 /* Default MMU definitions */
8939 env
->tlb_type
= TLB_NONE
;
8941 /* Register SPR common to all PowerPC implementations */
8942 gen_spr_generic(env
);
8943 spr_register(env
, SPR_PVR
, "PVR",
8944 /* Linux permits userspace to read PVR */
8945 #if defined(CONFIG_LINUX_USER)
8951 &spr_read_generic
, SPR_NOACCESS
,
8953 /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
8954 if (pcc
->svr
!= POWERPC_SVR_NONE
) {
8955 if (pcc
->svr
& POWERPC_SVR_E500
) {
8956 spr_register(env
, SPR_E500_SVR
, "SVR",
8957 SPR_NOACCESS
, SPR_NOACCESS
,
8958 &spr_read_generic
, SPR_NOACCESS
,
8959 pcc
->svr
& ~POWERPC_SVR_E500
);
8961 spr_register(env
, SPR_SVR
, "SVR",
8962 SPR_NOACCESS
, SPR_NOACCESS
,
8963 &spr_read_generic
, SPR_NOACCESS
,
8967 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
8968 (*pcc
->init_proc
)(env
);
8970 /* MSR bits & flags consistency checks */
8971 if (env
->msr_mask
& (1 << 25)) {
8972 switch (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
8973 case POWERPC_FLAG_SPE
:
8974 case POWERPC_FLAG_VRE
:
8977 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8978 "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
8981 } else if (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
8982 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8983 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
8986 if (env
->msr_mask
& (1 << 17)) {
8987 switch (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8988 case POWERPC_FLAG_TGPR
:
8989 case POWERPC_FLAG_CE
:
8992 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8993 "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
8996 } else if (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8997 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8998 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
9001 if (env
->msr_mask
& (1 << 10)) {
9002 switch (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
9003 POWERPC_FLAG_UBLE
)) {
9004 case POWERPC_FLAG_SE
:
9005 case POWERPC_FLAG_DWE
:
9006 case POWERPC_FLAG_UBLE
:
9009 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9010 "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
9011 "POWERPC_FLAG_UBLE\n");
9014 } else if (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
9015 POWERPC_FLAG_UBLE
)) {
9016 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9017 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
9018 "POWERPC_FLAG_UBLE\n");
9021 if (env
->msr_mask
& (1 << 9)) {
9022 switch (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
9023 case POWERPC_FLAG_BE
:
9024 case POWERPC_FLAG_DE
:
9027 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9028 "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
9031 } else if (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
9032 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9033 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
9036 if (env
->msr_mask
& (1 << 2)) {
9037 switch (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
9038 case POWERPC_FLAG_PX
:
9039 case POWERPC_FLAG_PMM
:
9042 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9043 "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
9046 } else if (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
9047 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9048 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
9051 if ((env
->flags
& (POWERPC_FLAG_RTC_CLK
| POWERPC_FLAG_BUS_CLK
)) == 0) {
9052 fprintf(stderr
, "PowerPC flags inconsistency\n"
9053 "Should define the time-base and decrementer clock source\n");
9056 /* Allocate TLBs buffer when needed */
9057 #if !defined(CONFIG_USER_ONLY)
9058 if (env
->nb_tlb
!= 0) {
9059 int nb_tlb
= env
->nb_tlb
;
9060 if (env
->id_tlbs
!= 0)
9062 switch (env
->tlb_type
) {
9064 env
->tlb
.tlb6
= g_malloc0(nb_tlb
* sizeof(ppc6xx_tlb_t
));
9067 env
->tlb
.tlbe
= g_malloc0(nb_tlb
* sizeof(ppcemb_tlb_t
));
9070 env
->tlb
.tlbm
= g_malloc0(nb_tlb
* sizeof(ppcmas_tlb_t
));
9073 /* Pre-compute some useful values */
9074 env
->tlb_per_way
= env
->nb_tlb
/ env
->nb_ways
;
9076 if (env
->irq_inputs
== NULL
) {
9077 fprintf(stderr
, "WARNING: no internal IRQ controller registered.\n"
9078 " Attempt QEMU to crash very soon !\n");
9081 if (env
->check_pow
== NULL
) {
9082 fprintf(stderr
, "WARNING: no power management check handler "
9084 " Attempt QEMU to crash very soon !\n");
9088 #if defined(PPC_DUMP_CPU)
9089 static void dump_ppc_sprs (CPUPPCState
*env
)
9092 #if !defined(CONFIG_USER_ONLY)
9098 printf("Special purpose registers:\n");
9099 for (i
= 0; i
< 32; i
++) {
9100 for (j
= 0; j
< 32; j
++) {
9102 spr
= &env
->spr_cb
[n
];
9103 uw
= spr
->uea_write
!= NULL
&& spr
->uea_write
!= SPR_NOACCESS
;
9104 ur
= spr
->uea_read
!= NULL
&& spr
->uea_read
!= SPR_NOACCESS
;
9105 #if !defined(CONFIG_USER_ONLY)
9106 sw
= spr
->oea_write
!= NULL
&& spr
->oea_write
!= SPR_NOACCESS
;
9107 sr
= spr
->oea_read
!= NULL
&& spr
->oea_read
!= SPR_NOACCESS
;
9108 if (sw
|| sr
|| uw
|| ur
) {
9109 printf("SPR: %4d (%03x) %-8s s%c%c u%c%c\n",
9110 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
9111 sw
? 'w' : '-', sr
? 'r' : '-',
9112 uw
? 'w' : '-', ur
? 'r' : '-');
9116 printf("SPR: %4d (%03x) %-8s u%c%c\n",
9117 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
9118 uw
? 'w' : '-', ur
? 'r' : '-');
9128 /*****************************************************************************/
9132 PPC_DIRECT
= 0, /* Opcode routine */
9133 PPC_INDIRECT
= 1, /* Indirect opcode table */
9136 #define PPC_OPCODE_MASK 0x3
9138 static inline int is_indirect_opcode (void *handler
)
9140 return ((uintptr_t)handler
& PPC_OPCODE_MASK
) == PPC_INDIRECT
;
9143 static inline opc_handler_t
**ind_table(void *handler
)
9145 return (opc_handler_t
**)((uintptr_t)handler
& ~PPC_OPCODE_MASK
);
9148 /* Instruction table creation */
9149 /* Opcodes tables creation */
9150 static void fill_new_table (opc_handler_t
**table
, int len
)
9154 for (i
= 0; i
< len
; i
++)
9155 table
[i
] = &invalid_handler
;
9158 static int create_new_table (opc_handler_t
**table
, unsigned char idx
)
9160 opc_handler_t
**tmp
;
9162 tmp
= g_new(opc_handler_t
*, PPC_CPU_INDIRECT_OPCODES_LEN
);
9163 fill_new_table(tmp
, PPC_CPU_INDIRECT_OPCODES_LEN
);
9164 table
[idx
] = (opc_handler_t
*)((uintptr_t)tmp
| PPC_INDIRECT
);
9169 static int insert_in_table (opc_handler_t
**table
, unsigned char idx
,
9170 opc_handler_t
*handler
)
9172 if (table
[idx
] != &invalid_handler
)
9174 table
[idx
] = handler
;
9179 static int register_direct_insn (opc_handler_t
**ppc_opcodes
,
9180 unsigned char idx
, opc_handler_t
*handler
)
9182 if (insert_in_table(ppc_opcodes
, idx
, handler
) < 0) {
9183 printf("*** ERROR: opcode %02x already assigned in main "
9184 "opcode table\n", idx
);
9185 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9186 printf(" Registered handler '%s' - new handler '%s'\n",
9187 ppc_opcodes
[idx
]->oname
, handler
->oname
);
9195 static int register_ind_in_table (opc_handler_t
**table
,
9196 unsigned char idx1
, unsigned char idx2
,
9197 opc_handler_t
*handler
)
9199 if (table
[idx1
] == &invalid_handler
) {
9200 if (create_new_table(table
, idx1
) < 0) {
9201 printf("*** ERROR: unable to create indirect table "
9202 "idx=%02x\n", idx1
);
9206 if (!is_indirect_opcode(table
[idx1
])) {
9207 printf("*** ERROR: idx %02x already assigned to a direct "
9209 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9210 printf(" Registered handler '%s' - new handler '%s'\n",
9211 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
9216 if (handler
!= NULL
&&
9217 insert_in_table(ind_table(table
[idx1
]), idx2
, handler
) < 0) {
9218 printf("*** ERROR: opcode %02x already assigned in "
9219 "opcode table %02x\n", idx2
, idx1
);
9220 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9221 printf(" Registered handler '%s' - new handler '%s'\n",
9222 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
9230 static int register_ind_insn (opc_handler_t
**ppc_opcodes
,
9231 unsigned char idx1
, unsigned char idx2
,
9232 opc_handler_t
*handler
)
9234 return register_ind_in_table(ppc_opcodes
, idx1
, idx2
, handler
);
9237 static int register_dblind_insn (opc_handler_t
**ppc_opcodes
,
9238 unsigned char idx1
, unsigned char idx2
,
9239 unsigned char idx3
, opc_handler_t
*handler
)
9241 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
9242 printf("*** ERROR: unable to join indirect table idx "
9243 "[%02x-%02x]\n", idx1
, idx2
);
9246 if (register_ind_in_table(ind_table(ppc_opcodes
[idx1
]), idx2
, idx3
,
9248 printf("*** ERROR: unable to insert opcode "
9249 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
9256 static int register_trplind_insn(opc_handler_t
**ppc_opcodes
,
9257 unsigned char idx1
, unsigned char idx2
,
9258 unsigned char idx3
, unsigned char idx4
,
9259 opc_handler_t
*handler
)
9261 opc_handler_t
**table
;
9263 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
9264 printf("*** ERROR: unable to join indirect table idx "
9265 "[%02x-%02x]\n", idx1
, idx2
);
9268 table
= ind_table(ppc_opcodes
[idx1
]);
9269 if (register_ind_in_table(table
, idx2
, idx3
, NULL
) < 0) {
9270 printf("*** ERROR: unable to join 2nd-level indirect table idx "
9271 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
9274 table
= ind_table(table
[idx2
]);
9275 if (register_ind_in_table(table
, idx3
, idx4
, handler
) < 0) {
9276 printf("*** ERROR: unable to insert opcode "
9277 "[%02x-%02x-%02x-%02x]\n", idx1
, idx2
, idx3
, idx4
);
9282 static int register_insn (opc_handler_t
**ppc_opcodes
, opcode_t
*insn
)
9284 if (insn
->opc2
!= 0xFF) {
9285 if (insn
->opc3
!= 0xFF) {
9286 if (insn
->opc4
!= 0xFF) {
9287 if (register_trplind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
9288 insn
->opc3
, insn
->opc4
,
9289 &insn
->handler
) < 0) {
9293 if (register_dblind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
9294 insn
->opc3
, &insn
->handler
) < 0)
9298 if (register_ind_insn(ppc_opcodes
, insn
->opc1
,
9299 insn
->opc2
, &insn
->handler
) < 0)
9303 if (register_direct_insn(ppc_opcodes
, insn
->opc1
, &insn
->handler
) < 0)
9310 static int test_opcode_table (opc_handler_t
**table
, int len
)
9314 for (i
= 0, count
= 0; i
< len
; i
++) {
9315 /* Consistency fixup */
9316 if (table
[i
] == NULL
)
9317 table
[i
] = &invalid_handler
;
9318 if (table
[i
] != &invalid_handler
) {
9319 if (is_indirect_opcode(table
[i
])) {
9320 tmp
= test_opcode_table(ind_table(table
[i
]),
9321 PPC_CPU_INDIRECT_OPCODES_LEN
);
9324 table
[i
] = &invalid_handler
;
9337 static void fix_opcode_tables (opc_handler_t
**ppc_opcodes
)
9339 if (test_opcode_table(ppc_opcodes
, PPC_CPU_OPCODES_LEN
) == 0)
9340 printf("*** WARNING: no opcode defined !\n");
9343 /*****************************************************************************/
9344 static void create_ppc_opcodes(PowerPCCPU
*cpu
, Error
**errp
)
9346 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9347 CPUPPCState
*env
= &cpu
->env
;
9350 fill_new_table(env
->opcodes
, PPC_CPU_OPCODES_LEN
);
9351 for (opc
= opcodes
; opc
< &opcodes
[ARRAY_SIZE(opcodes
)]; opc
++) {
9352 if (((opc
->handler
.type
& pcc
->insns_flags
) != 0) ||
9353 ((opc
->handler
.type2
& pcc
->insns_flags2
) != 0)) {
9354 if (register_insn(env
->opcodes
, opc
) < 0) {
9355 error_setg(errp
, "ERROR initializing PowerPC instruction "
9356 "0x%02x 0x%02x 0x%02x", opc
->opc1
, opc
->opc2
,
9362 fix_opcode_tables(env
->opcodes
);
9367 #if defined(PPC_DUMP_CPU)
9368 static void dump_ppc_insns (CPUPPCState
*env
)
9370 opc_handler_t
**table
, *handler
;
9372 uint8_t opc1
, opc2
, opc3
, opc4
;
9374 printf("Instructions set:\n");
9375 /* opc1 is 6 bits long */
9376 for (opc1
= 0x00; opc1
< PPC_CPU_OPCODES_LEN
; opc1
++) {
9377 table
= env
->opcodes
;
9378 handler
= table
[opc1
];
9379 if (is_indirect_opcode(handler
)) {
9380 /* opc2 is 5 bits long */
9381 for (opc2
= 0; opc2
< PPC_CPU_INDIRECT_OPCODES_LEN
; opc2
++) {
9382 table
= env
->opcodes
;
9383 handler
= env
->opcodes
[opc1
];
9384 table
= ind_table(handler
);
9385 handler
= table
[opc2
];
9386 if (is_indirect_opcode(handler
)) {
9387 table
= ind_table(handler
);
9388 /* opc3 is 5 bits long */
9389 for (opc3
= 0; opc3
< PPC_CPU_INDIRECT_OPCODES_LEN
;
9391 handler
= table
[opc3
];
9392 if (is_indirect_opcode(handler
)) {
9393 table
= ind_table(handler
);
9394 /* opc4 is 5 bits long */
9395 for (opc4
= 0; opc4
< PPC_CPU_INDIRECT_OPCODES_LEN
;
9397 handler
= table
[opc4
];
9398 if (handler
->handler
!= &gen_invalid
) {
9399 printf("INSN: %02x %02x %02x %02x -- "
9400 "(%02d %04d %02d) : %s\n",
9401 opc1
, opc2
, opc3
, opc4
,
9402 opc1
, (opc3
<< 5) | opc2
, opc4
,
9407 if (handler
->handler
!= &gen_invalid
) {
9408 /* Special hack to properly dump SPE insns */
9409 p
= strchr(handler
->oname
, '_');
9411 printf("INSN: %02x %02x %02x (%02d %04d) : "
9413 opc1
, opc2
, opc3
, opc1
,
9418 if ((p
- handler
->oname
) != strlen(q
)
9419 || (memcmp(handler
->oname
, q
, strlen(q
))
9421 /* First instruction */
9422 printf("INSN: %02x %02x %02x"
9423 "(%02d %04d) : %.*s\n",
9424 opc1
, opc2
<< 1, opc3
, opc1
,
9425 (opc3
<< 6) | (opc2
<< 1),
9426 (int)(p
- handler
->oname
),
9429 if (strcmp(p
+ 1, q
) != 0) {
9430 /* Second instruction */
9431 printf("INSN: %02x %02x %02x "
9432 "(%02d %04d) : %s\n", opc1
,
9433 (opc2
<< 1) | 1, opc3
, opc1
,
9434 (opc3
<< 6) | (opc2
<< 1) | 1,
9442 if (handler
->handler
!= &gen_invalid
) {
9443 printf("INSN: %02x %02x -- (%02d %04d) : %s\n",
9444 opc1
, opc2
, opc1
, opc2
, handler
->oname
);
9449 if (handler
->handler
!= &gen_invalid
) {
9450 printf("INSN: %02x -- -- (%02d ----) : %s\n",
9451 opc1
, opc1
, handler
->oname
);
9458 static bool avr_need_swap(CPUPPCState
*env
)
9460 #ifdef HOST_WORDS_BIGENDIAN
9467 static int gdb_get_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9470 stfq_p(mem_buf
, env
->fpr
[n
]);
9471 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9475 stl_p(mem_buf
, env
->fpscr
);
9476 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9482 static int gdb_set_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9485 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9486 env
->fpr
[n
] = ldfq_p(mem_buf
);
9490 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9491 helper_store_fpscr(env
, ldl_p(mem_buf
), 0xffffffff);
9497 static int gdb_get_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9500 if (!avr_need_swap(env
)) {
9501 stq_p(mem_buf
, env
->avr
[n
].u64
[0]);
9502 stq_p(mem_buf
+8, env
->avr
[n
].u64
[1]);
9504 stq_p(mem_buf
, env
->avr
[n
].u64
[1]);
9505 stq_p(mem_buf
+8, env
->avr
[n
].u64
[0]);
9507 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9508 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
9512 stl_p(mem_buf
, env
->vscr
);
9513 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9517 stl_p(mem_buf
, (uint32_t)env
->spr
[SPR_VRSAVE
]);
9518 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9524 static int gdb_set_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9527 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9528 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
9529 if (!avr_need_swap(env
)) {
9530 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
);
9531 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
+8);
9533 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
);
9534 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
+8);
9539 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9540 env
->vscr
= ldl_p(mem_buf
);
9544 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9545 env
->spr
[SPR_VRSAVE
] = (target_ulong
)ldl_p(mem_buf
);
9551 static int gdb_get_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9554 #if defined(TARGET_PPC64)
9555 stl_p(mem_buf
, env
->gpr
[n
] >> 32);
9556 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9558 stl_p(mem_buf
, env
->gprh
[n
]);
9563 stq_p(mem_buf
, env
->spe_acc
);
9564 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9568 stl_p(mem_buf
, env
->spe_fscr
);
9569 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9575 static int gdb_set_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9578 #if defined(TARGET_PPC64)
9579 target_ulong lo
= (uint32_t)env
->gpr
[n
];
9582 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9584 hi
= (target_ulong
)ldl_p(mem_buf
) << 32;
9585 env
->gpr
[n
] = lo
| hi
;
9587 env
->gprh
[n
] = ldl_p(mem_buf
);
9592 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9593 env
->spe_acc
= ldq_p(mem_buf
);
9597 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9598 env
->spe_fscr
= ldl_p(mem_buf
);
9604 static int gdb_get_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9607 stq_p(mem_buf
, env
->vsr
[n
]);
9608 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9614 static int gdb_set_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9617 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9618 env
->vsr
[n
] = ldq_p(mem_buf
);
9624 static int ppc_fixup_cpu(PowerPCCPU
*cpu
)
9626 CPUPPCState
*env
= &cpu
->env
;
9628 /* TCG doesn't (yet) emulate some groups of instructions that
9629 * are implemented on some otherwise supported CPUs (e.g. VSX
9630 * and decimal floating point instructions on POWER7). We
9631 * remove unsupported instruction groups from the cpu state's
9632 * instruction masks and hope the guest can cope. For at
9633 * least the pseries machine, the unavailability of these
9634 * instructions can be advertised to the guest via the device
9636 if ((env
->insns_flags
& ~PPC_TCG_INSNS
)
9637 || (env
->insns_flags2
& ~PPC_TCG_INSNS2
)) {
9638 fprintf(stderr
, "Warning: Disabling some instructions which are not "
9639 "emulated by TCG (0x%" PRIx64
", 0x%" PRIx64
")\n",
9640 env
->insns_flags
& ~PPC_TCG_INSNS
,
9641 env
->insns_flags2
& ~PPC_TCG_INSNS2
);
9643 env
->insns_flags
&= PPC_TCG_INSNS
;
9644 env
->insns_flags2
&= PPC_TCG_INSNS2
;
9648 static inline bool ppc_cpu_is_valid(PowerPCCPUClass
*pcc
)
9650 #ifdef TARGET_PPCEMB
9651 return pcc
->mmu_model
== POWERPC_MMU_BOOKE
||
9652 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx
||
9653 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx_Z
;
9659 static void ppc_cpu_realizefn(DeviceState
*dev
, Error
**errp
)
9661 CPUState
*cs
= CPU(dev
);
9662 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
9663 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9664 Error
*local_err
= NULL
;
9665 #if !defined(CONFIG_USER_ONLY)
9666 int max_smt
= kvmppc_smt_threads();
9669 #if !defined(CONFIG_USER_ONLY)
9670 if (smp_threads
> max_smt
) {
9671 error_setg(errp
, "Cannot support more than %d threads on PPC with %s",
9672 max_smt
, kvm_enabled() ? "KVM" : "TCG");
9675 if (!is_power_of_2(smp_threads
)) {
9676 error_setg(errp
, "Cannot support %d threads on PPC with %s, "
9677 "threads count must be a power of 2.",
9678 smp_threads
, kvm_enabled() ? "KVM" : "TCG");
9683 cpu_exec_init(cs
, &local_err
);
9684 if (local_err
!= NULL
) {
9685 error_propagate(errp
, local_err
);
9689 #if !defined(CONFIG_USER_ONLY)
9690 cpu
->cpu_dt_id
= (cs
->cpu_index
/ smp_threads
) * max_smt
9691 + (cs
->cpu_index
% smp_threads
);
9693 if (kvm_enabled() && !kvm_vcpu_id_is_valid(cpu
->cpu_dt_id
)) {
9694 error_setg(errp
, "Can't create CPU with id %d in KVM", cpu
->cpu_dt_id
);
9695 error_append_hint(errp
, "Adjust the number of cpus to %d "
9696 "or try to raise the number of threads per core\n",
9697 cpu
->cpu_dt_id
* smp_threads
/ max_smt
);
9702 if (tcg_enabled()) {
9703 if (ppc_fixup_cpu(cpu
) != 0) {
9704 error_setg(errp
, "Unable to emulate selected CPU with TCG");
9709 #if defined(TARGET_PPCEMB)
9710 if (!ppc_cpu_is_valid(pcc
)) {
9711 error_setg(errp
, "CPU does not possess a BookE or 4xx MMU. "
9712 "Please use qemu-system-ppc or qemu-system-ppc64 instead "
9713 "or choose another CPU model.");
9718 create_ppc_opcodes(cpu
, &local_err
);
9719 if (local_err
!= NULL
) {
9720 error_propagate(errp
, local_err
);
9725 if (pcc
->insns_flags
& PPC_FLOAT
) {
9726 gdb_register_coprocessor(cs
, gdb_get_float_reg
, gdb_set_float_reg
,
9727 33, "power-fpu.xml", 0);
9729 if (pcc
->insns_flags
& PPC_ALTIVEC
) {
9730 gdb_register_coprocessor(cs
, gdb_get_avr_reg
, gdb_set_avr_reg
,
9731 34, "power-altivec.xml", 0);
9733 if (pcc
->insns_flags
& PPC_SPE
) {
9734 gdb_register_coprocessor(cs
, gdb_get_spe_reg
, gdb_set_spe_reg
,
9735 34, "power-spe.xml", 0);
9737 if (pcc
->insns_flags2
& PPC2_VSX
) {
9738 gdb_register_coprocessor(cs
, gdb_get_vsx_reg
, gdb_set_vsx_reg
,
9739 32, "power-vsx.xml", 0);
9744 pcc
->parent_realize(dev
, errp
);
9746 #if defined(PPC_DUMP_CPU)
9748 CPUPPCState
*env
= &cpu
->env
;
9749 const char *mmu_model
, *excp_model
, *bus_model
;
9750 switch (env
->mmu_model
) {
9751 case POWERPC_MMU_32B
:
9752 mmu_model
= "PowerPC 32";
9754 case POWERPC_MMU_SOFT_6xx
:
9755 mmu_model
= "PowerPC 6xx/7xx with software driven TLBs";
9757 case POWERPC_MMU_SOFT_74xx
:
9758 mmu_model
= "PowerPC 74xx with software driven TLBs";
9760 case POWERPC_MMU_SOFT_4xx
:
9761 mmu_model
= "PowerPC 4xx with software driven TLBs";
9763 case POWERPC_MMU_SOFT_4xx_Z
:
9764 mmu_model
= "PowerPC 4xx with software driven TLBs "
9765 "and zones protections";
9767 case POWERPC_MMU_REAL
:
9768 mmu_model
= "PowerPC real mode only";
9770 case POWERPC_MMU_MPC8xx
:
9771 mmu_model
= "PowerPC MPC8xx";
9773 case POWERPC_MMU_BOOKE
:
9774 mmu_model
= "PowerPC BookE";
9776 case POWERPC_MMU_BOOKE206
:
9777 mmu_model
= "PowerPC BookE 2.06";
9779 case POWERPC_MMU_601
:
9780 mmu_model
= "PowerPC 601";
9782 #if defined (TARGET_PPC64)
9783 case POWERPC_MMU_64B
:
9784 mmu_model
= "PowerPC 64";
9788 mmu_model
= "Unknown or invalid";
9791 switch (env
->excp_model
) {
9792 case POWERPC_EXCP_STD
:
9793 excp_model
= "PowerPC";
9795 case POWERPC_EXCP_40x
:
9796 excp_model
= "PowerPC 40x";
9798 case POWERPC_EXCP_601
:
9799 excp_model
= "PowerPC 601";
9801 case POWERPC_EXCP_602
:
9802 excp_model
= "PowerPC 602";
9804 case POWERPC_EXCP_603
:
9805 excp_model
= "PowerPC 603";
9807 case POWERPC_EXCP_603E
:
9808 excp_model
= "PowerPC 603e";
9810 case POWERPC_EXCP_604
:
9811 excp_model
= "PowerPC 604";
9813 case POWERPC_EXCP_7x0
:
9814 excp_model
= "PowerPC 740/750";
9816 case POWERPC_EXCP_7x5
:
9817 excp_model
= "PowerPC 745/755";
9819 case POWERPC_EXCP_74xx
:
9820 excp_model
= "PowerPC 74xx";
9822 case POWERPC_EXCP_BOOKE
:
9823 excp_model
= "PowerPC BookE";
9825 #if defined (TARGET_PPC64)
9826 case POWERPC_EXCP_970
:
9827 excp_model
= "PowerPC 970";
9831 excp_model
= "Unknown or invalid";
9834 switch (env
->bus_model
) {
9835 case PPC_FLAGS_INPUT_6xx
:
9836 bus_model
= "PowerPC 6xx";
9838 case PPC_FLAGS_INPUT_BookE
:
9839 bus_model
= "PowerPC BookE";
9841 case PPC_FLAGS_INPUT_405
:
9842 bus_model
= "PowerPC 405";
9844 case PPC_FLAGS_INPUT_401
:
9845 bus_model
= "PowerPC 401/403";
9847 case PPC_FLAGS_INPUT_RCPU
:
9848 bus_model
= "RCPU / MPC8xx";
9850 #if defined (TARGET_PPC64)
9851 case PPC_FLAGS_INPUT_970
:
9852 bus_model
= "PowerPC 970";
9856 bus_model
= "Unknown or invalid";
9859 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64
"\n"
9860 " MMU model : %s\n",
9861 object_class_get_name(OBJECT_CLASS(pcc
)),
9862 pcc
->pvr
, pcc
->msr_mask
, mmu_model
);
9863 #if !defined(CONFIG_USER_ONLY)
9864 if (env
->tlb
.tlb6
) {
9865 printf(" %d %s TLB in %d ways\n",
9866 env
->nb_tlb
, env
->id_tlbs
? "splitted" : "merged",
9870 printf(" Exceptions model : %s\n"
9871 " Bus model : %s\n",
9872 excp_model
, bus_model
);
9873 printf(" MSR features :\n");
9874 if (env
->flags
& POWERPC_FLAG_SPE
)
9875 printf(" signal processing engine enable"
9877 else if (env
->flags
& POWERPC_FLAG_VRE
)
9878 printf(" vector processor enable\n");
9879 if (env
->flags
& POWERPC_FLAG_TGPR
)
9880 printf(" temporary GPRs\n");
9881 else if (env
->flags
& POWERPC_FLAG_CE
)
9882 printf(" critical input enable\n");
9883 if (env
->flags
& POWERPC_FLAG_SE
)
9884 printf(" single-step trace mode\n");
9885 else if (env
->flags
& POWERPC_FLAG_DWE
)
9886 printf(" debug wait enable\n");
9887 else if (env
->flags
& POWERPC_FLAG_UBLE
)
9888 printf(" user BTB lock enable\n");
9889 if (env
->flags
& POWERPC_FLAG_BE
)
9890 printf(" branch-step trace mode\n");
9891 else if (env
->flags
& POWERPC_FLAG_DE
)
9892 printf(" debug interrupt enable\n");
9893 if (env
->flags
& POWERPC_FLAG_PX
)
9894 printf(" inclusive protection\n");
9895 else if (env
->flags
& POWERPC_FLAG_PMM
)
9896 printf(" performance monitor mark\n");
9897 if (env
->flags
== POWERPC_FLAG_NONE
)
9899 printf(" Time-base/decrementer clock source: %s\n",
9900 env
->flags
& POWERPC_FLAG_RTC_CLK
? "RTC clock" : "bus clock");
9901 dump_ppc_insns(env
);
9908 static void ppc_cpu_unrealizefn(DeviceState
*dev
, Error
**errp
)
9910 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
9911 CPUPPCState
*env
= &cpu
->env
;
9912 opc_handler_t
**table
, **table_2
;
9915 cpu_exec_exit(CPU(dev
));
9917 for (i
= 0; i
< PPC_CPU_OPCODES_LEN
; i
++) {
9918 if (env
->opcodes
[i
] == &invalid_handler
) {
9921 if (is_indirect_opcode(env
->opcodes
[i
])) {
9922 table
= ind_table(env
->opcodes
[i
]);
9923 for (j
= 0; j
< PPC_CPU_INDIRECT_OPCODES_LEN
; j
++) {
9924 if (table
[j
] == &invalid_handler
) {
9927 if (is_indirect_opcode(table
[j
])) {
9928 table_2
= ind_table(table
[j
]);
9929 for (k
= 0; k
< PPC_CPU_INDIRECT_OPCODES_LEN
; k
++) {
9930 if (table_2
[k
] != &invalid_handler
&&
9931 is_indirect_opcode(table_2
[k
])) {
9932 g_free((opc_handler_t
*)((uintptr_t)table_2
[k
] &
9936 g_free((opc_handler_t
*)((uintptr_t)table
[j
] &
9940 g_free((opc_handler_t
*)((uintptr_t)env
->opcodes
[i
] &
9946 int ppc_get_compat_smt_threads(PowerPCCPU
*cpu
)
9948 int ret
= MIN(smp_threads
, kvmppc_smt_threads());
9950 switch (cpu
->cpu_version
) {
9951 case CPU_POWERPC_LOGICAL_2_05
:
9954 case CPU_POWERPC_LOGICAL_2_06
:
9957 case CPU_POWERPC_LOGICAL_2_07
:
9966 void ppc_set_compat(PowerPCCPU
*cpu
, uint32_t cpu_version
, Error
**errp
)
9969 CPUPPCState
*env
= &cpu
->env
;
9970 PowerPCCPUClass
*host_pcc
;
9972 cpu
->cpu_version
= cpu_version
;
9974 switch (cpu_version
) {
9975 case CPU_POWERPC_LOGICAL_2_05
:
9976 env
->spr
[SPR_PCR
] = PCR_TM_DIS
| PCR_VSX_DIS
| PCR_COMPAT_2_07
|
9977 PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
9979 case CPU_POWERPC_LOGICAL_2_06
:
9980 case CPU_POWERPC_LOGICAL_2_06_PLUS
:
9981 env
->spr
[SPR_PCR
] = PCR_TM_DIS
| PCR_COMPAT_2_07
| PCR_COMPAT_2_06
;
9983 case CPU_POWERPC_LOGICAL_2_07
:
9984 env
->spr
[SPR_PCR
] = PCR_COMPAT_2_07
;
9987 env
->spr
[SPR_PCR
] = 0;
9991 host_pcc
= kvm_ppc_get_host_cpu_class();
9993 env
->spr
[SPR_PCR
] &= host_pcc
->pcr_mask
;
9996 if (kvm_enabled()) {
9997 ret
= kvmppc_set_compat(cpu
, cpu
->cpu_version
);
9999 error_setg_errno(errp
, -ret
,
10000 "Unable to set CPU compatibility mode in KVM");
10006 static gint
ppc_cpu_compare_class_pvr(gconstpointer a
, gconstpointer b
)
10008 ObjectClass
*oc
= (ObjectClass
*)a
;
10009 uint32_t pvr
= *(uint32_t *)b
;
10010 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
10012 /* -cpu host does a PVR lookup during construction */
10013 if (unlikely(strcmp(object_class_get_name(oc
),
10014 TYPE_HOST_POWERPC_CPU
) == 0)) {
10018 if (!ppc_cpu_is_valid(pcc
)) {
10022 return pcc
->pvr
== pvr
? 0 : -1;
10025 PowerPCCPUClass
*ppc_cpu_class_by_pvr(uint32_t pvr
)
10027 GSList
*list
, *item
;
10028 PowerPCCPUClass
*pcc
= NULL
;
10030 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10031 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr
);
10032 if (item
!= NULL
) {
10033 pcc
= POWERPC_CPU_CLASS(item
->data
);
10035 g_slist_free(list
);
10040 static gint
ppc_cpu_compare_class_pvr_mask(gconstpointer a
, gconstpointer b
)
10042 ObjectClass
*oc
= (ObjectClass
*)a
;
10043 uint32_t pvr
= *(uint32_t *)b
;
10044 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
10046 /* -cpu host does a PVR lookup during construction */
10047 if (unlikely(strcmp(object_class_get_name(oc
),
10048 TYPE_HOST_POWERPC_CPU
) == 0)) {
10052 if (!ppc_cpu_is_valid(pcc
)) {
10056 if (pcc
->pvr_match(pcc
, pvr
)) {
10063 PowerPCCPUClass
*ppc_cpu_class_by_pvr_mask(uint32_t pvr
)
10065 GSList
*list
, *item
;
10066 PowerPCCPUClass
*pcc
= NULL
;
10068 list
= object_class_get_list(TYPE_POWERPC_CPU
, true);
10069 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr_mask
);
10070 if (item
!= NULL
) {
10071 pcc
= POWERPC_CPU_CLASS(item
->data
);
10073 g_slist_free(list
);
10078 static gint
ppc_cpu_compare_class_name(gconstpointer a
, gconstpointer b
)
10080 ObjectClass
*oc
= (ObjectClass
*)a
;
10081 const char *name
= b
;
10082 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10084 if (strncasecmp(name
, object_class_get_name(oc
), strlen(name
)) == 0 &&
10085 ppc_cpu_is_valid(pcc
) &&
10086 strcmp(object_class_get_name(oc
) + strlen(name
),
10087 "-" TYPE_POWERPC_CPU
) == 0) {
10094 static ObjectClass
*ppc_cpu_class_by_name(const char *name
);
10096 static ObjectClass
*ppc_cpu_class_by_alias(PowerPCCPUAlias
*alias
)
10098 ObjectClass
*invalid_class
= (void*)ppc_cpu_class_by_alias
;
10100 /* Cache target class lookups in the alias table */
10102 alias
->oc
= ppc_cpu_class_by_name(alias
->model
);
10104 /* Fast check for non-existing aliases */
10105 alias
->oc
= invalid_class
;
10109 if (alias
->oc
== invalid_class
) {
10116 static ObjectClass
*ppc_cpu_class_by_name(const char *name
)
10118 GSList
*list
, *item
;
10119 ObjectClass
*ret
= NULL
;
10123 /* Check if the given name is a PVR */
10124 len
= strlen(name
);
10125 if (len
== 10 && name
[0] == '0' && name
[1] == 'x') {
10128 } else if (len
== 8) {
10131 for (i
= 0; i
< 8; i
++) {
10132 if (!qemu_isxdigit(*p
++))
10136 return OBJECT_CLASS(ppc_cpu_class_by_pvr(strtoul(name
, NULL
, 16)));
10140 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10141 item
= g_slist_find_custom(list
, name
, ppc_cpu_compare_class_name
);
10142 if (item
!= NULL
) {
10143 ret
= OBJECT_CLASS(item
->data
);
10145 g_slist_free(list
);
10151 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
10152 if (strcmp(ppc_cpu_aliases
[i
].alias
, name
) == 0) {
10153 return ppc_cpu_class_by_alias(&ppc_cpu_aliases
[i
]);
10160 const char *ppc_cpu_lookup_alias(const char *alias
)
10164 for (ai
= 0; ppc_cpu_aliases
[ai
].alias
!= NULL
; ai
++) {
10165 if (strcmp(ppc_cpu_aliases
[ai
].alias
, alias
) == 0) {
10166 return ppc_cpu_aliases
[ai
].model
;
10173 PowerPCCPU
*cpu_ppc_init(const char *cpu_model
)
10175 return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU
, cpu_model
));
10178 /* Sort by PVR, ordering special case "host" last. */
10179 static gint
ppc_cpu_list_compare(gconstpointer a
, gconstpointer b
)
10181 ObjectClass
*oc_a
= (ObjectClass
*)a
;
10182 ObjectClass
*oc_b
= (ObjectClass
*)b
;
10183 PowerPCCPUClass
*pcc_a
= POWERPC_CPU_CLASS(oc_a
);
10184 PowerPCCPUClass
*pcc_b
= POWERPC_CPU_CLASS(oc_b
);
10185 const char *name_a
= object_class_get_name(oc_a
);
10186 const char *name_b
= object_class_get_name(oc_b
);
10188 if (strcmp(name_a
, TYPE_HOST_POWERPC_CPU
) == 0) {
10190 } else if (strcmp(name_b
, TYPE_HOST_POWERPC_CPU
) == 0) {
10193 /* Avoid an integer overflow during subtraction */
10194 if (pcc_a
->pvr
< pcc_b
->pvr
) {
10196 } else if (pcc_a
->pvr
> pcc_b
->pvr
) {
10204 static void ppc_cpu_list_entry(gpointer data
, gpointer user_data
)
10206 ObjectClass
*oc
= data
;
10207 CPUListState
*s
= user_data
;
10208 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10209 const char *typename
= object_class_get_name(oc
);
10213 if (!ppc_cpu_is_valid(pcc
)) {
10216 if (unlikely(strcmp(typename
, TYPE_HOST_POWERPC_CPU
) == 0)) {
10220 name
= g_strndup(typename
,
10221 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
10222 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s PVR %08x\n",
10224 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
10225 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
10226 ObjectClass
*alias_oc
= ppc_cpu_class_by_alias(alias
);
10228 if (alias_oc
!= oc
) {
10231 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s (alias for %s)\n",
10232 alias
->alias
, name
);
10237 void ppc_cpu_list(FILE *f
, fprintf_function cpu_fprintf
)
10241 .cpu_fprintf
= cpu_fprintf
,
10245 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10246 list
= g_slist_sort(list
, ppc_cpu_list_compare
);
10247 g_slist_foreach(list
, ppc_cpu_list_entry
, &s
);
10248 g_slist_free(list
);
10251 cpu_fprintf(f
, "\n");
10252 cpu_fprintf(f
, "PowerPC %-16s\n", "host");
10256 static void ppc_cpu_defs_entry(gpointer data
, gpointer user_data
)
10258 ObjectClass
*oc
= data
;
10259 CpuDefinitionInfoList
**first
= user_data
;
10260 const char *typename
;
10261 CpuDefinitionInfoList
*entry
;
10262 CpuDefinitionInfo
*info
;
10263 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10265 if (!ppc_cpu_is_valid(pcc
)) {
10269 typename
= object_class_get_name(oc
);
10270 info
= g_malloc0(sizeof(*info
));
10271 info
->name
= g_strndup(typename
,
10272 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
10274 entry
= g_malloc0(sizeof(*entry
));
10275 entry
->value
= info
;
10276 entry
->next
= *first
;
10280 CpuDefinitionInfoList
*arch_query_cpu_definitions(Error
**errp
)
10282 CpuDefinitionInfoList
*cpu_list
= NULL
;
10286 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10287 g_slist_foreach(list
, ppc_cpu_defs_entry
, &cpu_list
);
10288 g_slist_free(list
);
10290 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
10291 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
10293 CpuDefinitionInfoList
*entry
;
10294 CpuDefinitionInfo
*info
;
10296 oc
= ppc_cpu_class_by_alias(alias
);
10301 info
= g_malloc0(sizeof(*info
));
10302 info
->name
= g_strdup(alias
->alias
);
10304 entry
= g_malloc0(sizeof(*entry
));
10305 entry
->value
= info
;
10306 entry
->next
= cpu_list
;
10313 static void ppc_cpu_set_pc(CPUState
*cs
, vaddr value
)
10315 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10317 cpu
->env
.nip
= value
;
10320 static bool ppc_cpu_has_work(CPUState
*cs
)
10322 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10323 CPUPPCState
*env
= &cpu
->env
;
10325 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
10328 static void ppc_cpu_exec_enter(CPUState
*cs
)
10330 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10331 CPUPPCState
*env
= &cpu
->env
;
10333 env
->reserve_addr
= -1;
10336 /* CPUClass::reset() */
10337 static void ppc_cpu_reset(CPUState
*s
)
10339 PowerPCCPU
*cpu
= POWERPC_CPU(s
);
10340 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10341 CPUPPCState
*env
= &cpu
->env
;
10345 pcc
->parent_reset(s
);
10347 msr
= (target_ulong
)0;
10348 msr
|= (target_ulong
)MSR_HVB
;
10349 msr
|= (target_ulong
)0 << MSR_AP
; /* TO BE CHECKED */
10350 msr
|= (target_ulong
)0 << MSR_SA
; /* TO BE CHECKED */
10351 msr
|= (target_ulong
)1 << MSR_EP
;
10352 #if defined(DO_SINGLE_STEP) && 0
10353 /* Single step trace mode */
10354 msr
|= (target_ulong
)1 << MSR_SE
;
10355 msr
|= (target_ulong
)1 << MSR_BE
;
10357 #if defined(CONFIG_USER_ONLY)
10358 msr
|= (target_ulong
)1 << MSR_FP
; /* Allow floating point usage */
10359 msr
|= (target_ulong
)1 << MSR_VR
; /* Allow altivec usage */
10360 msr
|= (target_ulong
)1 << MSR_VSX
; /* Allow VSX usage */
10361 msr
|= (target_ulong
)1 << MSR_SPE
; /* Allow SPE usage */
10362 msr
|= (target_ulong
)1 << MSR_PR
;
10363 #if defined(TARGET_PPC64)
10364 msr
|= (target_ulong
)1 << MSR_TM
; /* Transactional memory */
10366 #if !defined(TARGET_WORDS_BIGENDIAN)
10367 msr
|= (target_ulong
)1 << MSR_LE
; /* Little-endian user mode */
10368 if (!((env
->msr_mask
>> MSR_LE
) & 1)) {
10369 fprintf(stderr
, "Selected CPU does not support little-endian.\n");
10375 #if defined(TARGET_PPC64)
10376 if (env
->mmu_model
& POWERPC_MMU_64
) {
10377 msr
|= (1ULL << MSR_SF
);
10381 hreg_store_msr(env
, msr
, 1);
10383 #if !defined(CONFIG_USER_ONLY)
10384 env
->nip
= env
->hreset_vector
| env
->excp_prefix
;
10385 if (env
->mmu_model
!= POWERPC_MMU_REAL
) {
10386 ppc_tlb_invalidate_all(env
);
10390 hreg_compute_hflags(env
);
10391 env
->reserve_addr
= (target_ulong
)-1ULL;
10392 /* Be sure no exception or interrupt is pending */
10393 env
->pending_interrupts
= 0;
10394 s
->exception_index
= POWERPC_EXCP_NONE
;
10395 env
->error_code
= 0;
10397 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
10399 env
->slb_shadow_addr
= 0;
10400 env
->slb_shadow_size
= 0;
10403 #endif /* TARGET_PPC64 */
10405 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
10406 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
10411 env
->spr
[i
] = spr
->default_value
;
10414 /* Flush all TLBs */
10418 #ifndef CONFIG_USER_ONLY
10419 static bool ppc_cpu_is_big_endian(CPUState
*cs
)
10421 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10422 CPUPPCState
*env
= &cpu
->env
;
10424 cpu_synchronize_state(cs
);
10430 static void ppc_cpu_initfn(Object
*obj
)
10432 CPUState
*cs
= CPU(obj
);
10433 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
10434 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10435 CPUPPCState
*env
= &cpu
->env
;
10439 env
->msr_mask
= pcc
->msr_mask
;
10440 env
->mmu_model
= pcc
->mmu_model
;
10441 env
->excp_model
= pcc
->excp_model
;
10442 env
->bus_model
= pcc
->bus_model
;
10443 env
->insns_flags
= pcc
->insns_flags
;
10444 env
->insns_flags2
= pcc
->insns_flags2
;
10445 env
->flags
= pcc
->flags
;
10446 env
->bfd_mach
= pcc
->bfd_mach
;
10447 env
->check_pow
= pcc
->check_pow
;
10449 /* Mark HV mode as supported if the CPU has an MSR_HV bit
10450 * in the msr_mask. The mask can later be cleared by PAPR
10451 * mode but the hv mode support will remain, thus enforcing
10452 * that we cannot use priv. instructions in guest in PAPR
10453 * mode. For 970 we currently simply don't set HV in msr_mask
10454 * thus simulating an "Apple mode" 970. If we ever want to
10455 * support 970 HV mode, we'll have to add a processor attribute
10458 #if !defined(CONFIG_USER_ONLY)
10459 env
->has_hv_mode
= !!(env
->msr_mask
& MSR_HVB
);
10462 #if defined(TARGET_PPC64)
10464 env
->sps
= *pcc
->sps
;
10465 } else if (env
->mmu_model
& POWERPC_MMU_64
) {
10466 /* Use default sets of page sizes. We don't support MPSS */
10467 static const struct ppc_segment_page_sizes defsps_4k
= {
10469 { .page_shift
= 12, /* 4K */
10471 .enc
= { { .page_shift
= 12, .pte_enc
= 0 } }
10473 { .page_shift
= 24, /* 16M */
10475 .enc
= { { .page_shift
= 24, .pte_enc
= 0 } }
10479 static const struct ppc_segment_page_sizes defsps_64k
= {
10481 { .page_shift
= 12, /* 4K */
10483 .enc
= { { .page_shift
= 12, .pte_enc
= 0 } }
10485 { .page_shift
= 16, /* 64K */
10487 .enc
= { { .page_shift
= 16, .pte_enc
= 1 } }
10489 { .page_shift
= 24, /* 16M */
10491 .enc
= { { .page_shift
= 24, .pte_enc
= 0 } }
10495 env
->sps
= (env
->mmu_model
& POWERPC_MMU_64K
) ? defsps_64k
: defsps_4k
;
10497 #endif /* defined(TARGET_PPC64) */
10499 if (tcg_enabled()) {
10500 ppc_translate_init();
10504 static bool ppc_pvr_match_default(PowerPCCPUClass
*pcc
, uint32_t pvr
)
10506 return pcc
->pvr
== pvr
;
10509 static gchar
*ppc_gdb_arch_name(CPUState
*cs
)
10511 #if defined(TARGET_PPC64)
10512 return g_strdup("powerpc:common64");
10514 return g_strdup("powerpc:common");
10518 static void ppc_cpu_class_init(ObjectClass
*oc
, void *data
)
10520 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10521 CPUClass
*cc
= CPU_CLASS(oc
);
10522 DeviceClass
*dc
= DEVICE_CLASS(oc
);
10524 pcc
->parent_realize
= dc
->realize
;
10525 pcc
->pvr_match
= ppc_pvr_match_default
;
10526 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_always
;
10527 dc
->realize
= ppc_cpu_realizefn
;
10528 dc
->unrealize
= ppc_cpu_unrealizefn
;
10530 pcc
->parent_reset
= cc
->reset
;
10531 cc
->reset
= ppc_cpu_reset
;
10533 cc
->class_by_name
= ppc_cpu_class_by_name
;
10534 cc
->has_work
= ppc_cpu_has_work
;
10535 cc
->do_interrupt
= ppc_cpu_do_interrupt
;
10536 cc
->cpu_exec_interrupt
= ppc_cpu_exec_interrupt
;
10537 cc
->dump_state
= ppc_cpu_dump_state
;
10538 cc
->dump_statistics
= ppc_cpu_dump_statistics
;
10539 cc
->set_pc
= ppc_cpu_set_pc
;
10540 cc
->gdb_read_register
= ppc_cpu_gdb_read_register
;
10541 cc
->gdb_write_register
= ppc_cpu_gdb_write_register
;
10542 #ifdef CONFIG_USER_ONLY
10543 cc
->handle_mmu_fault
= ppc_cpu_handle_mmu_fault
;
10545 cc
->get_phys_page_debug
= ppc_cpu_get_phys_page_debug
;
10546 cc
->vmsd
= &vmstate_ppc_cpu
;
10547 #if defined(TARGET_PPC64)
10548 cc
->write_elf64_note
= ppc64_cpu_write_elf64_note
;
10551 cc
->cpu_exec_enter
= ppc_cpu_exec_enter
;
10553 cc
->gdb_num_core_regs
= 71;
10555 #ifdef USE_APPLE_GDB
10556 cc
->gdb_read_register
= ppc_cpu_gdb_read_register_apple
;
10557 cc
->gdb_write_register
= ppc_cpu_gdb_write_register_apple
;
10558 cc
->gdb_num_core_regs
= 71 + 32;
10561 cc
->gdb_arch_name
= ppc_gdb_arch_name
;
10562 #if defined(TARGET_PPC64)
10563 cc
->gdb_core_xml_file
= "power64-core.xml";
10565 cc
->gdb_core_xml_file
= "power-core.xml";
10567 #ifndef CONFIG_USER_ONLY
10568 cc
->virtio_is_big_endian
= ppc_cpu_is_big_endian
;
10571 dc
->fw_name
= "PowerPC,UNKNOWN";
10574 static const TypeInfo ppc_cpu_type_info
= {
10575 .name
= TYPE_POWERPC_CPU
,
10576 .parent
= TYPE_CPU
,
10577 .instance_size
= sizeof(PowerPCCPU
),
10578 .instance_init
= ppc_cpu_initfn
,
10580 .class_size
= sizeof(PowerPCCPUClass
),
10581 .class_init
= ppc_cpu_class_init
,
10584 static void ppc_cpu_register_types(void)
10586 type_register_static(&ppc_cpu_type_info
);
10589 type_init(ppc_cpu_register_types
)