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
);
283 #if !defined(CONFIG_USER_ONLY)
284 /* IBAT0U...IBAT0U */
285 /* IBAT0L...IBAT7L */
286 static void spr_read_ibat (DisasContext
*ctx
, int gprn
, int sprn
)
288 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
291 static void spr_read_ibat_h (DisasContext
*ctx
, int gprn
, int sprn
)
293 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][((sprn
- SPR_IBAT4U
) / 2) + 4]));
296 static void spr_write_ibatu (DisasContext
*ctx
, int sprn
, int gprn
)
298 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
299 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
300 tcg_temp_free_i32(t0
);
303 static void spr_write_ibatu_h (DisasContext
*ctx
, int sprn
, int gprn
)
305 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4U
) / 2) + 4);
306 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
307 tcg_temp_free_i32(t0
);
310 static void spr_write_ibatl (DisasContext
*ctx
, int sprn
, int gprn
)
312 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0L
) / 2);
313 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
314 tcg_temp_free_i32(t0
);
317 static void spr_write_ibatl_h (DisasContext
*ctx
, int sprn
, int gprn
)
319 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4L
) / 2) + 4);
320 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
321 tcg_temp_free_i32(t0
);
324 /* DBAT0U...DBAT7U */
325 /* DBAT0L...DBAT7L */
326 static void spr_read_dbat (DisasContext
*ctx
, int gprn
, int sprn
)
328 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, DBAT
[sprn
& 1][(sprn
- SPR_DBAT0U
) / 2]));
331 static void spr_read_dbat_h (DisasContext
*ctx
, int gprn
, int sprn
)
333 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, DBAT
[sprn
& 1][((sprn
- SPR_DBAT4U
) / 2) + 4]));
336 static void spr_write_dbatu (DisasContext
*ctx
, int sprn
, int gprn
)
338 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0U
) / 2);
339 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
340 tcg_temp_free_i32(t0
);
343 static void spr_write_dbatu_h (DisasContext
*ctx
, int sprn
, int gprn
)
345 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4U
) / 2) + 4);
346 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
347 tcg_temp_free_i32(t0
);
350 static void spr_write_dbatl (DisasContext
*ctx
, int sprn
, int gprn
)
352 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0L
) / 2);
353 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
354 tcg_temp_free_i32(t0
);
357 static void spr_write_dbatl_h (DisasContext
*ctx
, int sprn
, int gprn
)
359 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4L
) / 2) + 4);
360 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
361 tcg_temp_free_i32(t0
);
365 static void spr_write_sdr1 (DisasContext
*ctx
, int sprn
, int gprn
)
367 gen_helper_store_sdr1(cpu_env
, cpu_gpr
[gprn
]);
370 /* 64 bits PowerPC specific SPRs */
371 #if defined(TARGET_PPC64)
372 static void spr_read_hior (DisasContext
*ctx
, int gprn
, int sprn
)
374 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
377 static void spr_write_hior (DisasContext
*ctx
, int sprn
, int gprn
)
379 TCGv t0
= tcg_temp_new();
380 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0x3FFFFF00000ULL
);
381 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
387 /* PowerPC 601 specific registers */
389 static void spr_read_601_rtcl (DisasContext
*ctx
, int gprn
, int sprn
)
391 gen_helper_load_601_rtcl(cpu_gpr
[gprn
], cpu_env
);
394 static void spr_read_601_rtcu (DisasContext
*ctx
, int gprn
, int sprn
)
396 gen_helper_load_601_rtcu(cpu_gpr
[gprn
], cpu_env
);
399 #if !defined(CONFIG_USER_ONLY)
400 static void spr_write_601_rtcu (DisasContext
*ctx
, int sprn
, int gprn
)
402 gen_helper_store_601_rtcu(cpu_env
, cpu_gpr
[gprn
]);
405 static void spr_write_601_rtcl (DisasContext
*ctx
, int sprn
, int gprn
)
407 gen_helper_store_601_rtcl(cpu_env
, cpu_gpr
[gprn
]);
410 static void spr_write_hid0_601 (DisasContext
*ctx
, int sprn
, int gprn
)
412 gen_helper_store_hid0_601(cpu_env
, cpu_gpr
[gprn
]);
413 /* Must stop the translation as endianness may have changed */
414 gen_stop_exception(ctx
);
419 #if !defined(CONFIG_USER_ONLY)
420 static void spr_read_601_ubat (DisasContext
*ctx
, int gprn
, int sprn
)
422 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
425 static void spr_write_601_ubatu (DisasContext
*ctx
, int sprn
, int gprn
)
427 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
428 gen_helper_store_601_batl(cpu_env
, t0
, cpu_gpr
[gprn
]);
429 tcg_temp_free_i32(t0
);
432 static void spr_write_601_ubatl (DisasContext
*ctx
, int sprn
, int gprn
)
434 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
435 gen_helper_store_601_batu(cpu_env
, t0
, cpu_gpr
[gprn
]);
436 tcg_temp_free_i32(t0
);
440 /* PowerPC 40x specific registers */
441 #if !defined(CONFIG_USER_ONLY)
442 static void spr_read_40x_pit (DisasContext
*ctx
, int gprn
, int sprn
)
444 gen_helper_load_40x_pit(cpu_gpr
[gprn
], cpu_env
);
447 static void spr_write_40x_pit (DisasContext
*ctx
, int sprn
, int gprn
)
449 gen_helper_store_40x_pit(cpu_env
, cpu_gpr
[gprn
]);
452 static void spr_write_40x_dbcr0 (DisasContext
*ctx
, int sprn
, int gprn
)
454 gen_helper_store_40x_dbcr0(cpu_env
, cpu_gpr
[gprn
]);
455 /* We must stop translation as we may have rebooted */
456 gen_stop_exception(ctx
);
459 static void spr_write_40x_sler (DisasContext
*ctx
, int sprn
, int gprn
)
461 gen_helper_store_40x_sler(cpu_env
, cpu_gpr
[gprn
]);
464 static void spr_write_booke_tcr (DisasContext
*ctx
, int sprn
, int gprn
)
466 gen_helper_store_booke_tcr(cpu_env
, cpu_gpr
[gprn
]);
469 static void spr_write_booke_tsr (DisasContext
*ctx
, int sprn
, int gprn
)
471 gen_helper_store_booke_tsr(cpu_env
, cpu_gpr
[gprn
]);
475 /* PowerPC 403 specific registers */
476 /* PBL1 / PBU1 / PBL2 / PBU2 */
477 #if !defined(CONFIG_USER_ONLY)
478 static void spr_read_403_pbr (DisasContext
*ctx
, int gprn
, int sprn
)
480 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, pb
[sprn
- SPR_403_PBL1
]));
483 static void spr_write_403_pbr (DisasContext
*ctx
, int sprn
, int gprn
)
485 TCGv_i32 t0
= tcg_const_i32(sprn
- SPR_403_PBL1
);
486 gen_helper_store_403_pbr(cpu_env
, t0
, cpu_gpr
[gprn
]);
487 tcg_temp_free_i32(t0
);
490 static void spr_write_pir (DisasContext
*ctx
, int sprn
, int gprn
)
492 TCGv t0
= tcg_temp_new();
493 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0xF);
494 gen_store_spr(SPR_PIR
, t0
);
499 /* SPE specific registers */
500 static void spr_read_spefscr (DisasContext
*ctx
, int gprn
, int sprn
)
502 TCGv_i32 t0
= tcg_temp_new_i32();
503 tcg_gen_ld_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
504 tcg_gen_extu_i32_tl(cpu_gpr
[gprn
], t0
);
505 tcg_temp_free_i32(t0
);
508 static void spr_write_spefscr (DisasContext
*ctx
, int sprn
, int gprn
)
510 TCGv_i32 t0
= tcg_temp_new_i32();
511 tcg_gen_trunc_tl_i32(t0
, cpu_gpr
[gprn
]);
512 tcg_gen_st_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
513 tcg_temp_free_i32(t0
);
516 #if !defined(CONFIG_USER_ONLY)
517 /* Callback used to write the exception vector base */
518 static void spr_write_excp_prefix (DisasContext
*ctx
, int sprn
, int gprn
)
520 TCGv t0
= tcg_temp_new();
521 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivpr_mask
));
522 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
523 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
524 gen_store_spr(sprn
, t0
);
528 static void spr_write_excp_vector (DisasContext
*ctx
, int sprn
, int gprn
)
532 if (sprn
>= SPR_BOOKE_IVOR0
&& sprn
<= SPR_BOOKE_IVOR15
) {
533 sprn_offs
= sprn
- SPR_BOOKE_IVOR0
;
534 } else if (sprn
>= SPR_BOOKE_IVOR32
&& sprn
<= SPR_BOOKE_IVOR37
) {
535 sprn_offs
= sprn
- SPR_BOOKE_IVOR32
+ 32;
536 } else if (sprn
>= SPR_BOOKE_IVOR38
&& sprn
<= SPR_BOOKE_IVOR42
) {
537 sprn_offs
= sprn
- SPR_BOOKE_IVOR38
+ 38;
539 printf("Trying to write an unknown exception vector %d %03x\n",
541 gen_inval_exception(ctx
, POWERPC_EXCP_PRIV_REG
);
545 TCGv t0
= tcg_temp_new();
546 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivor_mask
));
547 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
548 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_vectors
[sprn_offs
]));
549 gen_store_spr(sprn
, t0
);
554 static inline void vscr_init (CPUPPCState
*env
, uint32_t val
)
557 /* Altivec always uses round-to-nearest */
558 set_float_rounding_mode(float_round_nearest_even
, &env
->vec_status
);
559 set_flush_to_zero(vscr_nj
, &env
->vec_status
);
562 #ifdef CONFIG_USER_ONLY
563 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
564 oea_read, oea_write, one_reg_id, initial_value) \
565 _spr_register(env, num, name, uea_read, uea_write, initial_value)
566 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
567 oea_read, oea_write, hea_read, hea_write, \
568 one_reg_id, initial_value) \
569 _spr_register(env, num, name, uea_read, uea_write, initial_value)
571 #if !defined(CONFIG_KVM)
572 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
573 oea_read, oea_write, one_reg_id, initial_value) \
574 _spr_register(env, num, name, uea_read, uea_write, \
575 oea_read, oea_write, oea_read, oea_write, initial_value)
576 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
577 oea_read, oea_write, hea_read, hea_write, \
578 one_reg_id, initial_value) \
579 _spr_register(env, num, name, uea_read, uea_write, \
580 oea_read, oea_write, hea_read, hea_write, initial_value)
582 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
583 oea_read, oea_write, one_reg_id, initial_value) \
584 _spr_register(env, num, name, uea_read, uea_write, \
585 oea_read, oea_write, oea_read, oea_write, \
586 one_reg_id, initial_value)
587 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
588 oea_read, oea_write, hea_read, hea_write, \
589 one_reg_id, initial_value) \
590 _spr_register(env, num, name, uea_read, uea_write, \
591 oea_read, oea_write, hea_read, hea_write, \
592 one_reg_id, initial_value)
596 #define spr_register(env, num, name, uea_read, uea_write, \
597 oea_read, oea_write, initial_value) \
598 spr_register_kvm(env, num, name, uea_read, uea_write, \
599 oea_read, oea_write, 0, initial_value)
601 #define spr_register_hv(env, num, name, uea_read, uea_write, \
602 oea_read, oea_write, hea_read, hea_write, \
604 spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
605 oea_read, oea_write, hea_read, hea_write, \
608 static inline void _spr_register(CPUPPCState
*env
, int num
,
610 void (*uea_read
)(DisasContext
*ctx
, int gprn
, int sprn
),
611 void (*uea_write
)(DisasContext
*ctx
, int sprn
, int gprn
),
612 #if !defined(CONFIG_USER_ONLY)
614 void (*oea_read
)(DisasContext
*ctx
, int gprn
, int sprn
),
615 void (*oea_write
)(DisasContext
*ctx
, int sprn
, int gprn
),
616 void (*hea_read
)(DisasContext
*opaque
, int gprn
, int sprn
),
617 void (*hea_write
)(DisasContext
*opaque
, int sprn
, int gprn
),
619 #if defined(CONFIG_KVM)
622 target_ulong initial_value
)
626 spr
= &env
->spr_cb
[num
];
627 if (spr
->name
!= NULL
||env
-> spr
[num
] != 0x00000000 ||
628 #if !defined(CONFIG_USER_ONLY)
629 spr
->oea_read
!= NULL
|| spr
->oea_write
!= NULL
||
631 spr
->uea_read
!= NULL
|| spr
->uea_write
!= NULL
) {
632 printf("Error: Trying to register SPR %d (%03x) twice !\n", num
, num
);
635 #if defined(PPC_DEBUG_SPR)
636 printf("*** register spr %d (%03x) %s val " TARGET_FMT_lx
"\n", num
, num
,
637 name
, initial_value
);
640 spr
->uea_read
= uea_read
;
641 spr
->uea_write
= uea_write
;
642 #if !defined(CONFIG_USER_ONLY)
643 spr
->oea_read
= oea_read
;
644 spr
->oea_write
= oea_write
;
645 spr
->hea_read
= hea_read
;
646 spr
->hea_write
= hea_write
;
648 #if defined(CONFIG_KVM)
649 spr
->one_reg_id
= one_reg_id
,
651 env
->spr
[num
] = spr
->default_value
= initial_value
;
654 /* Generic PowerPC SPRs */
655 static void gen_spr_generic (CPUPPCState
*env
)
657 /* Integer processing */
658 spr_register(env
, SPR_XER
, "XER",
659 &spr_read_xer
, &spr_write_xer
,
660 &spr_read_xer
, &spr_write_xer
,
663 spr_register(env
, SPR_LR
, "LR",
664 &spr_read_lr
, &spr_write_lr
,
665 &spr_read_lr
, &spr_write_lr
,
667 spr_register(env
, SPR_CTR
, "CTR",
668 &spr_read_ctr
, &spr_write_ctr
,
669 &spr_read_ctr
, &spr_write_ctr
,
671 /* Interrupt processing */
672 spr_register(env
, SPR_SRR0
, "SRR0",
673 SPR_NOACCESS
, SPR_NOACCESS
,
674 &spr_read_generic
, &spr_write_generic
,
676 spr_register(env
, SPR_SRR1
, "SRR1",
677 SPR_NOACCESS
, SPR_NOACCESS
,
678 &spr_read_generic
, &spr_write_generic
,
680 /* Processor control */
681 spr_register(env
, SPR_SPRG0
, "SPRG0",
682 SPR_NOACCESS
, SPR_NOACCESS
,
683 &spr_read_generic
, &spr_write_generic
,
685 spr_register(env
, SPR_SPRG1
, "SPRG1",
686 SPR_NOACCESS
, SPR_NOACCESS
,
687 &spr_read_generic
, &spr_write_generic
,
689 spr_register(env
, SPR_SPRG2
, "SPRG2",
690 SPR_NOACCESS
, SPR_NOACCESS
,
691 &spr_read_generic
, &spr_write_generic
,
693 spr_register(env
, SPR_SPRG3
, "SPRG3",
694 SPR_NOACCESS
, SPR_NOACCESS
,
695 &spr_read_generic
, &spr_write_generic
,
699 /* SPR common to all non-embedded PowerPC, including 601 */
700 static void gen_spr_ne_601 (CPUPPCState
*env
)
702 /* Exception processing */
703 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
704 SPR_NOACCESS
, SPR_NOACCESS
,
705 &spr_read_generic
, &spr_write_generic
,
706 KVM_REG_PPC_DSISR
, 0x00000000);
707 spr_register_kvm(env
, SPR_DAR
, "DAR",
708 SPR_NOACCESS
, SPR_NOACCESS
,
709 &spr_read_generic
, &spr_write_generic
,
710 KVM_REG_PPC_DAR
, 0x00000000);
712 spr_register(env
, SPR_DECR
, "DECR",
713 SPR_NOACCESS
, SPR_NOACCESS
,
714 &spr_read_decr
, &spr_write_decr
,
716 /* Memory management */
717 spr_register(env
, SPR_SDR1
, "SDR1",
718 SPR_NOACCESS
, SPR_NOACCESS
,
719 &spr_read_generic
, &spr_write_sdr1
,
724 static void gen_low_BATs (CPUPPCState
*env
)
726 #if !defined(CONFIG_USER_ONLY)
727 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
728 SPR_NOACCESS
, SPR_NOACCESS
,
729 &spr_read_ibat
, &spr_write_ibatu
,
731 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
732 SPR_NOACCESS
, SPR_NOACCESS
,
733 &spr_read_ibat
, &spr_write_ibatl
,
735 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
736 SPR_NOACCESS
, SPR_NOACCESS
,
737 &spr_read_ibat
, &spr_write_ibatu
,
739 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
740 SPR_NOACCESS
, SPR_NOACCESS
,
741 &spr_read_ibat
, &spr_write_ibatl
,
743 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
744 SPR_NOACCESS
, SPR_NOACCESS
,
745 &spr_read_ibat
, &spr_write_ibatu
,
747 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
748 SPR_NOACCESS
, SPR_NOACCESS
,
749 &spr_read_ibat
, &spr_write_ibatl
,
751 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
752 SPR_NOACCESS
, SPR_NOACCESS
,
753 &spr_read_ibat
, &spr_write_ibatu
,
755 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
756 SPR_NOACCESS
, SPR_NOACCESS
,
757 &spr_read_ibat
, &spr_write_ibatl
,
759 spr_register(env
, SPR_DBAT0U
, "DBAT0U",
760 SPR_NOACCESS
, SPR_NOACCESS
,
761 &spr_read_dbat
, &spr_write_dbatu
,
763 spr_register(env
, SPR_DBAT0L
, "DBAT0L",
764 SPR_NOACCESS
, SPR_NOACCESS
,
765 &spr_read_dbat
, &spr_write_dbatl
,
767 spr_register(env
, SPR_DBAT1U
, "DBAT1U",
768 SPR_NOACCESS
, SPR_NOACCESS
,
769 &spr_read_dbat
, &spr_write_dbatu
,
771 spr_register(env
, SPR_DBAT1L
, "DBAT1L",
772 SPR_NOACCESS
, SPR_NOACCESS
,
773 &spr_read_dbat
, &spr_write_dbatl
,
775 spr_register(env
, SPR_DBAT2U
, "DBAT2U",
776 SPR_NOACCESS
, SPR_NOACCESS
,
777 &spr_read_dbat
, &spr_write_dbatu
,
779 spr_register(env
, SPR_DBAT2L
, "DBAT2L",
780 SPR_NOACCESS
, SPR_NOACCESS
,
781 &spr_read_dbat
, &spr_write_dbatl
,
783 spr_register(env
, SPR_DBAT3U
, "DBAT3U",
784 SPR_NOACCESS
, SPR_NOACCESS
,
785 &spr_read_dbat
, &spr_write_dbatu
,
787 spr_register(env
, SPR_DBAT3L
, "DBAT3L",
788 SPR_NOACCESS
, SPR_NOACCESS
,
789 &spr_read_dbat
, &spr_write_dbatl
,
796 static void gen_high_BATs (CPUPPCState
*env
)
798 #if !defined(CONFIG_USER_ONLY)
799 spr_register(env
, SPR_IBAT4U
, "IBAT4U",
800 SPR_NOACCESS
, SPR_NOACCESS
,
801 &spr_read_ibat_h
, &spr_write_ibatu_h
,
803 spr_register(env
, SPR_IBAT4L
, "IBAT4L",
804 SPR_NOACCESS
, SPR_NOACCESS
,
805 &spr_read_ibat_h
, &spr_write_ibatl_h
,
807 spr_register(env
, SPR_IBAT5U
, "IBAT5U",
808 SPR_NOACCESS
, SPR_NOACCESS
,
809 &spr_read_ibat_h
, &spr_write_ibatu_h
,
811 spr_register(env
, SPR_IBAT5L
, "IBAT5L",
812 SPR_NOACCESS
, SPR_NOACCESS
,
813 &spr_read_ibat_h
, &spr_write_ibatl_h
,
815 spr_register(env
, SPR_IBAT6U
, "IBAT6U",
816 SPR_NOACCESS
, SPR_NOACCESS
,
817 &spr_read_ibat_h
, &spr_write_ibatu_h
,
819 spr_register(env
, SPR_IBAT6L
, "IBAT6L",
820 SPR_NOACCESS
, SPR_NOACCESS
,
821 &spr_read_ibat_h
, &spr_write_ibatl_h
,
823 spr_register(env
, SPR_IBAT7U
, "IBAT7U",
824 SPR_NOACCESS
, SPR_NOACCESS
,
825 &spr_read_ibat_h
, &spr_write_ibatu_h
,
827 spr_register(env
, SPR_IBAT7L
, "IBAT7L",
828 SPR_NOACCESS
, SPR_NOACCESS
,
829 &spr_read_ibat_h
, &spr_write_ibatl_h
,
831 spr_register(env
, SPR_DBAT4U
, "DBAT4U",
832 SPR_NOACCESS
, SPR_NOACCESS
,
833 &spr_read_dbat_h
, &spr_write_dbatu_h
,
835 spr_register(env
, SPR_DBAT4L
, "DBAT4L",
836 SPR_NOACCESS
, SPR_NOACCESS
,
837 &spr_read_dbat_h
, &spr_write_dbatl_h
,
839 spr_register(env
, SPR_DBAT5U
, "DBAT5U",
840 SPR_NOACCESS
, SPR_NOACCESS
,
841 &spr_read_dbat_h
, &spr_write_dbatu_h
,
843 spr_register(env
, SPR_DBAT5L
, "DBAT5L",
844 SPR_NOACCESS
, SPR_NOACCESS
,
845 &spr_read_dbat_h
, &spr_write_dbatl_h
,
847 spr_register(env
, SPR_DBAT6U
, "DBAT6U",
848 SPR_NOACCESS
, SPR_NOACCESS
,
849 &spr_read_dbat_h
, &spr_write_dbatu_h
,
851 spr_register(env
, SPR_DBAT6L
, "DBAT6L",
852 SPR_NOACCESS
, SPR_NOACCESS
,
853 &spr_read_dbat_h
, &spr_write_dbatl_h
,
855 spr_register(env
, SPR_DBAT7U
, "DBAT7U",
856 SPR_NOACCESS
, SPR_NOACCESS
,
857 &spr_read_dbat_h
, &spr_write_dbatu_h
,
859 spr_register(env
, SPR_DBAT7L
, "DBAT7L",
860 SPR_NOACCESS
, SPR_NOACCESS
,
861 &spr_read_dbat_h
, &spr_write_dbatl_h
,
867 /* Generic PowerPC time base */
868 static void gen_tbl (CPUPPCState
*env
)
870 spr_register(env
, SPR_VTBL
, "TBL",
871 &spr_read_tbl
, SPR_NOACCESS
,
872 &spr_read_tbl
, SPR_NOACCESS
,
874 spr_register(env
, SPR_TBL
, "TBL",
875 &spr_read_tbl
, SPR_NOACCESS
,
876 &spr_read_tbl
, &spr_write_tbl
,
878 spr_register(env
, SPR_VTBU
, "TBU",
879 &spr_read_tbu
, SPR_NOACCESS
,
880 &spr_read_tbu
, SPR_NOACCESS
,
882 spr_register(env
, SPR_TBU
, "TBU",
883 &spr_read_tbu
, SPR_NOACCESS
,
884 &spr_read_tbu
, &spr_write_tbu
,
888 /* Softare table search registers */
889 static void gen_6xx_7xx_soft_tlb (CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
891 #if !defined(CONFIG_USER_ONLY)
892 env
->nb_tlb
= nb_tlbs
;
893 env
->nb_ways
= nb_ways
;
895 env
->tlb_type
= TLB_6XX
;
896 spr_register(env
, SPR_DMISS
, "DMISS",
897 SPR_NOACCESS
, SPR_NOACCESS
,
898 &spr_read_generic
, SPR_NOACCESS
,
900 spr_register(env
, SPR_DCMP
, "DCMP",
901 SPR_NOACCESS
, SPR_NOACCESS
,
902 &spr_read_generic
, SPR_NOACCESS
,
904 spr_register(env
, SPR_HASH1
, "HASH1",
905 SPR_NOACCESS
, SPR_NOACCESS
,
906 &spr_read_generic
, SPR_NOACCESS
,
908 spr_register(env
, SPR_HASH2
, "HASH2",
909 SPR_NOACCESS
, SPR_NOACCESS
,
910 &spr_read_generic
, SPR_NOACCESS
,
912 spr_register(env
, SPR_IMISS
, "IMISS",
913 SPR_NOACCESS
, SPR_NOACCESS
,
914 &spr_read_generic
, SPR_NOACCESS
,
916 spr_register(env
, SPR_ICMP
, "ICMP",
917 SPR_NOACCESS
, SPR_NOACCESS
,
918 &spr_read_generic
, SPR_NOACCESS
,
920 spr_register(env
, SPR_RPA
, "RPA",
921 SPR_NOACCESS
, SPR_NOACCESS
,
922 &spr_read_generic
, &spr_write_generic
,
927 /* SPR common to MPC755 and G2 */
928 static void gen_spr_G2_755 (CPUPPCState
*env
)
931 spr_register(env
, SPR_SPRG4
, "SPRG4",
932 SPR_NOACCESS
, SPR_NOACCESS
,
933 &spr_read_generic
, &spr_write_generic
,
935 spr_register(env
, SPR_SPRG5
, "SPRG5",
936 SPR_NOACCESS
, SPR_NOACCESS
,
937 &spr_read_generic
, &spr_write_generic
,
939 spr_register(env
, SPR_SPRG6
, "SPRG6",
940 SPR_NOACCESS
, SPR_NOACCESS
,
941 &spr_read_generic
, &spr_write_generic
,
943 spr_register(env
, SPR_SPRG7
, "SPRG7",
944 SPR_NOACCESS
, SPR_NOACCESS
,
945 &spr_read_generic
, &spr_write_generic
,
949 /* SPR common to all 7xx PowerPC implementations */
950 static void gen_spr_7xx (CPUPPCState
*env
)
953 /* XXX : not implemented */
954 spr_register_kvm(env
, SPR_DABR
, "DABR",
955 SPR_NOACCESS
, SPR_NOACCESS
,
956 &spr_read_generic
, &spr_write_generic
,
957 KVM_REG_PPC_DABR
, 0x00000000);
958 /* XXX : not implemented */
959 spr_register(env
, SPR_IABR
, "IABR",
960 SPR_NOACCESS
, SPR_NOACCESS
,
961 &spr_read_generic
, &spr_write_generic
,
963 /* Cache management */
964 /* XXX : not implemented */
965 spr_register(env
, SPR_ICTC
, "ICTC",
966 SPR_NOACCESS
, SPR_NOACCESS
,
967 &spr_read_generic
, &spr_write_generic
,
969 /* Performance monitors */
970 /* XXX : not implemented */
971 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
972 SPR_NOACCESS
, SPR_NOACCESS
,
973 &spr_read_generic
, &spr_write_generic
,
975 /* XXX : not implemented */
976 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
977 SPR_NOACCESS
, SPR_NOACCESS
,
978 &spr_read_generic
, &spr_write_generic
,
980 /* XXX : not implemented */
981 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
982 SPR_NOACCESS
, SPR_NOACCESS
,
983 &spr_read_generic
, &spr_write_generic
,
985 /* XXX : not implemented */
986 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
987 SPR_NOACCESS
, SPR_NOACCESS
,
988 &spr_read_generic
, &spr_write_generic
,
990 /* XXX : not implemented */
991 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
992 SPR_NOACCESS
, SPR_NOACCESS
,
993 &spr_read_generic
, &spr_write_generic
,
995 /* XXX : not implemented */
996 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
997 SPR_NOACCESS
, SPR_NOACCESS
,
998 &spr_read_generic
, &spr_write_generic
,
1000 /* XXX : not implemented */
1001 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
1002 SPR_NOACCESS
, SPR_NOACCESS
,
1003 &spr_read_generic
, SPR_NOACCESS
,
1005 /* XXX : not implemented */
1006 spr_register(env
, SPR_7XX_UMMCR0
, "UMMCR0",
1007 &spr_read_ureg
, SPR_NOACCESS
,
1008 &spr_read_ureg
, SPR_NOACCESS
,
1010 /* XXX : not implemented */
1011 spr_register(env
, SPR_7XX_UMMCR1
, "UMMCR1",
1012 &spr_read_ureg
, SPR_NOACCESS
,
1013 &spr_read_ureg
, SPR_NOACCESS
,
1015 /* XXX : not implemented */
1016 spr_register(env
, SPR_7XX_UPMC1
, "UPMC1",
1017 &spr_read_ureg
, SPR_NOACCESS
,
1018 &spr_read_ureg
, SPR_NOACCESS
,
1020 /* XXX : not implemented */
1021 spr_register(env
, SPR_7XX_UPMC2
, "UPMC2",
1022 &spr_read_ureg
, SPR_NOACCESS
,
1023 &spr_read_ureg
, SPR_NOACCESS
,
1025 /* XXX : not implemented */
1026 spr_register(env
, SPR_7XX_UPMC3
, "UPMC3",
1027 &spr_read_ureg
, SPR_NOACCESS
,
1028 &spr_read_ureg
, SPR_NOACCESS
,
1030 /* XXX : not implemented */
1031 spr_register(env
, SPR_7XX_UPMC4
, "UPMC4",
1032 &spr_read_ureg
, SPR_NOACCESS
,
1033 &spr_read_ureg
, SPR_NOACCESS
,
1035 /* XXX : not implemented */
1036 spr_register(env
, SPR_7XX_USIAR
, "USIAR",
1037 &spr_read_ureg
, SPR_NOACCESS
,
1038 &spr_read_ureg
, SPR_NOACCESS
,
1040 /* External access control */
1041 /* XXX : not implemented */
1042 spr_register(env
, SPR_EAR
, "EAR",
1043 SPR_NOACCESS
, SPR_NOACCESS
,
1044 &spr_read_generic
, &spr_write_generic
,
1049 #ifndef CONFIG_USER_ONLY
1050 static void spr_write_amr(DisasContext
*ctx
, int sprn
, int gprn
)
1052 TCGv t0
= tcg_temp_new();
1053 TCGv t1
= tcg_temp_new();
1054 TCGv t2
= tcg_temp_new();
1056 /* Note, the HV=1 PR=0 case is handled earlier by simply using
1057 * spr_write_generic for HV mode in the SPR table
1060 /* Build insertion mask into t1 based on context */
1062 gen_load_spr(t1
, SPR_UAMOR
);
1064 gen_load_spr(t1
, SPR_AMOR
);
1067 /* Mask new bits into t2 */
1068 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1070 /* Load AMR and clear new bits in t0 */
1071 gen_load_spr(t0
, SPR_AMR
);
1072 tcg_gen_andc_tl(t0
, t0
, t1
);
1074 /* Or'in new bits and write it out */
1075 tcg_gen_or_tl(t0
, t0
, t2
);
1076 gen_store_spr(SPR_AMR
, t0
);
1077 spr_store_dump_spr(SPR_AMR
);
1084 static void spr_write_uamor(DisasContext
*ctx
, int sprn
, int gprn
)
1086 TCGv t0
= tcg_temp_new();
1087 TCGv t1
= tcg_temp_new();
1088 TCGv t2
= tcg_temp_new();
1090 /* Note, the HV=1 case is handled earlier by simply using
1091 * spr_write_generic for HV mode in the SPR table
1094 /* Build insertion mask into t1 based on context */
1095 gen_load_spr(t1
, SPR_AMOR
);
1097 /* Mask new bits into t2 */
1098 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1100 /* Load AMR and clear new bits in t0 */
1101 gen_load_spr(t0
, SPR_UAMOR
);
1102 tcg_gen_andc_tl(t0
, t0
, t1
);
1104 /* Or'in new bits and write it out */
1105 tcg_gen_or_tl(t0
, t0
, t2
);
1106 gen_store_spr(SPR_UAMOR
, t0
);
1107 spr_store_dump_spr(SPR_UAMOR
);
1114 static void spr_write_iamr(DisasContext
*ctx
, int sprn
, int gprn
)
1116 TCGv t0
= tcg_temp_new();
1117 TCGv t1
= tcg_temp_new();
1118 TCGv t2
= tcg_temp_new();
1120 /* Note, the HV=1 case is handled earlier by simply using
1121 * spr_write_generic for HV mode in the SPR table
1124 /* Build insertion mask into t1 based on context */
1125 gen_load_spr(t1
, SPR_AMOR
);
1127 /* Mask new bits into t2 */
1128 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1130 /* Load AMR and clear new bits in t0 */
1131 gen_load_spr(t0
, SPR_IAMR
);
1132 tcg_gen_andc_tl(t0
, t0
, t1
);
1134 /* Or'in new bits and write it out */
1135 tcg_gen_or_tl(t0
, t0
, t2
);
1136 gen_store_spr(SPR_IAMR
, t0
);
1137 spr_store_dump_spr(SPR_IAMR
);
1143 #endif /* CONFIG_USER_ONLY */
1145 static void gen_spr_amr(CPUPPCState
*env
, bool has_iamr
)
1147 #ifndef CONFIG_USER_ONLY
1148 /* Virtual Page Class Key protection */
1149 /* The AMR is accessible either via SPR 13 or SPR 29. 13 is
1150 * userspace accessible, 29 is privileged. So we only need to set
1151 * the kvm ONE_REG id on one of them, we use 29 */
1152 spr_register(env
, SPR_UAMR
, "UAMR",
1153 &spr_read_generic
, &spr_write_amr
,
1154 &spr_read_generic
, &spr_write_amr
,
1156 spr_register_kvm_hv(env
, SPR_AMR
, "AMR",
1157 SPR_NOACCESS
, SPR_NOACCESS
,
1158 &spr_read_generic
, &spr_write_amr
,
1159 &spr_read_generic
, &spr_write_generic
,
1160 KVM_REG_PPC_AMR
, 0);
1161 spr_register_kvm_hv(env
, SPR_UAMOR
, "UAMOR",
1162 SPR_NOACCESS
, SPR_NOACCESS
,
1163 &spr_read_generic
, &spr_write_uamor
,
1164 &spr_read_generic
, &spr_write_generic
,
1165 KVM_REG_PPC_UAMOR
, 0);
1166 spr_register_hv(env
, SPR_AMOR
, "AMOR",
1167 SPR_NOACCESS
, SPR_NOACCESS
,
1168 SPR_NOACCESS
, SPR_NOACCESS
,
1169 &spr_read_generic
, &spr_write_generic
,
1172 spr_register_kvm_hv(env
, SPR_IAMR
, "IAMR",
1173 SPR_NOACCESS
, SPR_NOACCESS
,
1174 &spr_read_generic
, &spr_write_iamr
,
1175 &spr_read_generic
, &spr_write_generic
,
1176 KVM_REG_PPC_IAMR
, 0);
1178 #endif /* !CONFIG_USER_ONLY */
1180 #endif /* TARGET_PPC64 */
1182 #ifndef CONFIG_USER_ONLY
1183 static void spr_read_thrm(DisasContext
*ctx
, int gprn
, int sprn
)
1185 gen_helper_fixup_thrm(cpu_env
);
1186 gen_load_spr(cpu_gpr
[gprn
], sprn
);
1187 spr_load_dump_spr(sprn
);
1189 #endif /* !CONFIG_USER_ONLY */
1191 static void gen_spr_thrm (CPUPPCState
*env
)
1193 /* Thermal management */
1194 /* XXX : not implemented */
1195 spr_register(env
, SPR_THRM1
, "THRM1",
1196 SPR_NOACCESS
, SPR_NOACCESS
,
1197 &spr_read_thrm
, &spr_write_generic
,
1199 /* XXX : not implemented */
1200 spr_register(env
, SPR_THRM2
, "THRM2",
1201 SPR_NOACCESS
, SPR_NOACCESS
,
1202 &spr_read_thrm
, &spr_write_generic
,
1204 /* XXX : not implemented */
1205 spr_register(env
, SPR_THRM3
, "THRM3",
1206 SPR_NOACCESS
, SPR_NOACCESS
,
1207 &spr_read_thrm
, &spr_write_generic
,
1211 /* SPR specific to PowerPC 604 implementation */
1212 static void gen_spr_604 (CPUPPCState
*env
)
1214 /* Processor identification */
1215 spr_register(env
, SPR_PIR
, "PIR",
1216 SPR_NOACCESS
, SPR_NOACCESS
,
1217 &spr_read_generic
, &spr_write_pir
,
1220 /* XXX : not implemented */
1221 spr_register(env
, SPR_IABR
, "IABR",
1222 SPR_NOACCESS
, SPR_NOACCESS
,
1223 &spr_read_generic
, &spr_write_generic
,
1225 /* XXX : not implemented */
1226 spr_register_kvm(env
, SPR_DABR
, "DABR",
1227 SPR_NOACCESS
, SPR_NOACCESS
,
1228 &spr_read_generic
, &spr_write_generic
,
1229 KVM_REG_PPC_DABR
, 0x00000000);
1230 /* Performance counters */
1231 /* XXX : not implemented */
1232 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
1233 SPR_NOACCESS
, SPR_NOACCESS
,
1234 &spr_read_generic
, &spr_write_generic
,
1236 /* XXX : not implemented */
1237 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
1238 SPR_NOACCESS
, SPR_NOACCESS
,
1239 &spr_read_generic
, &spr_write_generic
,
1241 /* XXX : not implemented */
1242 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
1243 SPR_NOACCESS
, SPR_NOACCESS
,
1244 &spr_read_generic
, &spr_write_generic
,
1246 /* XXX : not implemented */
1247 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
1248 SPR_NOACCESS
, SPR_NOACCESS
,
1249 &spr_read_generic
, SPR_NOACCESS
,
1251 /* XXX : not implemented */
1252 spr_register(env
, SPR_SDA
, "SDA",
1253 SPR_NOACCESS
, SPR_NOACCESS
,
1254 &spr_read_generic
, SPR_NOACCESS
,
1256 /* External access control */
1257 /* XXX : not implemented */
1258 spr_register(env
, SPR_EAR
, "EAR",
1259 SPR_NOACCESS
, SPR_NOACCESS
,
1260 &spr_read_generic
, &spr_write_generic
,
1264 /* SPR specific to PowerPC 603 implementation */
1265 static void gen_spr_603 (CPUPPCState
*env
)
1267 /* External access control */
1268 /* XXX : not implemented */
1269 spr_register(env
, SPR_EAR
, "EAR",
1270 SPR_NOACCESS
, SPR_NOACCESS
,
1271 &spr_read_generic
, &spr_write_generic
,
1274 /* XXX : not implemented */
1275 spr_register(env
, SPR_IABR
, "IABR",
1276 SPR_NOACCESS
, SPR_NOACCESS
,
1277 &spr_read_generic
, &spr_write_generic
,
1282 /* SPR specific to PowerPC G2 implementation */
1283 static void gen_spr_G2 (CPUPPCState
*env
)
1285 /* Memory base address */
1287 /* XXX : not implemented */
1288 spr_register(env
, SPR_MBAR
, "MBAR",
1289 SPR_NOACCESS
, SPR_NOACCESS
,
1290 &spr_read_generic
, &spr_write_generic
,
1292 /* Exception processing */
1293 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1294 SPR_NOACCESS
, SPR_NOACCESS
,
1295 &spr_read_generic
, &spr_write_generic
,
1297 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1298 SPR_NOACCESS
, SPR_NOACCESS
,
1299 &spr_read_generic
, &spr_write_generic
,
1302 /* XXX : not implemented */
1303 spr_register(env
, SPR_DABR
, "DABR",
1304 SPR_NOACCESS
, SPR_NOACCESS
,
1305 &spr_read_generic
, &spr_write_generic
,
1307 /* XXX : not implemented */
1308 spr_register(env
, SPR_DABR2
, "DABR2",
1309 SPR_NOACCESS
, SPR_NOACCESS
,
1310 &spr_read_generic
, &spr_write_generic
,
1312 /* XXX : not implemented */
1313 spr_register(env
, SPR_IABR
, "IABR",
1314 SPR_NOACCESS
, SPR_NOACCESS
,
1315 &spr_read_generic
, &spr_write_generic
,
1317 /* XXX : not implemented */
1318 spr_register(env
, SPR_IABR2
, "IABR2",
1319 SPR_NOACCESS
, SPR_NOACCESS
,
1320 &spr_read_generic
, &spr_write_generic
,
1322 /* XXX : not implemented */
1323 spr_register(env
, SPR_IBCR
, "IBCR",
1324 SPR_NOACCESS
, SPR_NOACCESS
,
1325 &spr_read_generic
, &spr_write_generic
,
1327 /* XXX : not implemented */
1328 spr_register(env
, SPR_DBCR
, "DBCR",
1329 SPR_NOACCESS
, SPR_NOACCESS
,
1330 &spr_read_generic
, &spr_write_generic
,
1334 /* SPR specific to PowerPC 602 implementation */
1335 static void gen_spr_602 (CPUPPCState
*env
)
1338 /* XXX : not implemented */
1339 spr_register(env
, SPR_SER
, "SER",
1340 SPR_NOACCESS
, SPR_NOACCESS
,
1341 &spr_read_generic
, &spr_write_generic
,
1343 /* XXX : not implemented */
1344 spr_register(env
, SPR_SEBR
, "SEBR",
1345 SPR_NOACCESS
, SPR_NOACCESS
,
1346 &spr_read_generic
, &spr_write_generic
,
1348 /* XXX : not implemented */
1349 spr_register(env
, SPR_ESASRR
, "ESASRR",
1350 SPR_NOACCESS
, SPR_NOACCESS
,
1351 &spr_read_generic
, &spr_write_generic
,
1353 /* Floating point status */
1354 /* XXX : not implemented */
1355 spr_register(env
, SPR_SP
, "SP",
1356 SPR_NOACCESS
, SPR_NOACCESS
,
1357 &spr_read_generic
, &spr_write_generic
,
1359 /* XXX : not implemented */
1360 spr_register(env
, SPR_LT
, "LT",
1361 SPR_NOACCESS
, SPR_NOACCESS
,
1362 &spr_read_generic
, &spr_write_generic
,
1364 /* Watchdog timer */
1365 /* XXX : not implemented */
1366 spr_register(env
, SPR_TCR
, "TCR",
1367 SPR_NOACCESS
, SPR_NOACCESS
,
1368 &spr_read_generic
, &spr_write_generic
,
1370 /* Interrupt base */
1371 spr_register(env
, SPR_IBR
, "IBR",
1372 SPR_NOACCESS
, SPR_NOACCESS
,
1373 &spr_read_generic
, &spr_write_generic
,
1375 /* XXX : not implemented */
1376 spr_register(env
, SPR_IABR
, "IABR",
1377 SPR_NOACCESS
, SPR_NOACCESS
,
1378 &spr_read_generic
, &spr_write_generic
,
1382 /* SPR specific to PowerPC 601 implementation */
1383 static void gen_spr_601 (CPUPPCState
*env
)
1385 /* Multiplication/division register */
1387 spr_register(env
, SPR_MQ
, "MQ",
1388 &spr_read_generic
, &spr_write_generic
,
1389 &spr_read_generic
, &spr_write_generic
,
1392 spr_register(env
, SPR_601_RTCU
, "RTCU",
1393 SPR_NOACCESS
, SPR_NOACCESS
,
1394 SPR_NOACCESS
, &spr_write_601_rtcu
,
1396 spr_register(env
, SPR_601_VRTCU
, "RTCU",
1397 &spr_read_601_rtcu
, SPR_NOACCESS
,
1398 &spr_read_601_rtcu
, SPR_NOACCESS
,
1400 spr_register(env
, SPR_601_RTCL
, "RTCL",
1401 SPR_NOACCESS
, SPR_NOACCESS
,
1402 SPR_NOACCESS
, &spr_write_601_rtcl
,
1404 spr_register(env
, SPR_601_VRTCL
, "RTCL",
1405 &spr_read_601_rtcl
, SPR_NOACCESS
,
1406 &spr_read_601_rtcl
, SPR_NOACCESS
,
1410 spr_register(env
, SPR_601_UDECR
, "UDECR",
1411 &spr_read_decr
, SPR_NOACCESS
,
1412 &spr_read_decr
, SPR_NOACCESS
,
1415 /* External access control */
1416 /* XXX : not implemented */
1417 spr_register(env
, SPR_EAR
, "EAR",
1418 SPR_NOACCESS
, SPR_NOACCESS
,
1419 &spr_read_generic
, &spr_write_generic
,
1421 /* Memory management */
1422 #if !defined(CONFIG_USER_ONLY)
1423 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
1424 SPR_NOACCESS
, SPR_NOACCESS
,
1425 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1427 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
1428 SPR_NOACCESS
, SPR_NOACCESS
,
1429 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1431 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
1432 SPR_NOACCESS
, SPR_NOACCESS
,
1433 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1435 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
1436 SPR_NOACCESS
, SPR_NOACCESS
,
1437 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1439 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
1440 SPR_NOACCESS
, SPR_NOACCESS
,
1441 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1443 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
1444 SPR_NOACCESS
, SPR_NOACCESS
,
1445 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1447 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
1448 SPR_NOACCESS
, SPR_NOACCESS
,
1449 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1451 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
1452 SPR_NOACCESS
, SPR_NOACCESS
,
1453 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1459 static void gen_spr_74xx (CPUPPCState
*env
)
1461 /* Processor identification */
1462 spr_register(env
, SPR_PIR
, "PIR",
1463 SPR_NOACCESS
, SPR_NOACCESS
,
1464 &spr_read_generic
, &spr_write_pir
,
1466 /* XXX : not implemented */
1467 spr_register(env
, SPR_74XX_MMCR2
, "MMCR2",
1468 SPR_NOACCESS
, SPR_NOACCESS
,
1469 &spr_read_generic
, &spr_write_generic
,
1471 /* XXX : not implemented */
1472 spr_register(env
, SPR_74XX_UMMCR2
, "UMMCR2",
1473 &spr_read_ureg
, SPR_NOACCESS
,
1474 &spr_read_ureg
, SPR_NOACCESS
,
1476 /* XXX: not implemented */
1477 spr_register(env
, SPR_BAMR
, "BAMR",
1478 SPR_NOACCESS
, SPR_NOACCESS
,
1479 &spr_read_generic
, &spr_write_generic
,
1481 /* XXX : not implemented */
1482 spr_register(env
, SPR_MSSCR0
, "MSSCR0",
1483 SPR_NOACCESS
, SPR_NOACCESS
,
1484 &spr_read_generic
, &spr_write_generic
,
1486 /* Hardware implementation registers */
1487 /* XXX : not implemented */
1488 spr_register(env
, SPR_HID0
, "HID0",
1489 SPR_NOACCESS
, SPR_NOACCESS
,
1490 &spr_read_generic
, &spr_write_generic
,
1492 /* XXX : not implemented */
1493 spr_register(env
, SPR_HID1
, "HID1",
1494 SPR_NOACCESS
, SPR_NOACCESS
,
1495 &spr_read_generic
, &spr_write_generic
,
1498 spr_register(env
, SPR_VRSAVE
, "VRSAVE",
1499 &spr_read_generic
, &spr_write_generic
,
1500 &spr_read_generic
, &spr_write_generic
,
1502 /* XXX : not implemented */
1503 spr_register(env
, SPR_L2CR
, "L2CR",
1504 SPR_NOACCESS
, SPR_NOACCESS
,
1505 &spr_read_generic
, spr_access_nop
,
1507 /* Not strictly an SPR */
1508 vscr_init(env
, 0x00010000);
1511 static void gen_l3_ctrl (CPUPPCState
*env
)
1514 /* XXX : not implemented */
1515 spr_register(env
, SPR_L3CR
, "L3CR",
1516 SPR_NOACCESS
, SPR_NOACCESS
,
1517 &spr_read_generic
, &spr_write_generic
,
1520 /* XXX : not implemented */
1521 spr_register(env
, SPR_L3ITCR0
, "L3ITCR0",
1522 SPR_NOACCESS
, SPR_NOACCESS
,
1523 &spr_read_generic
, &spr_write_generic
,
1526 /* XXX : not implemented */
1527 spr_register(env
, SPR_L3PM
, "L3PM",
1528 SPR_NOACCESS
, SPR_NOACCESS
,
1529 &spr_read_generic
, &spr_write_generic
,
1533 static void gen_74xx_soft_tlb (CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
1535 #if !defined(CONFIG_USER_ONLY)
1536 env
->nb_tlb
= nb_tlbs
;
1537 env
->nb_ways
= nb_ways
;
1539 env
->tlb_type
= TLB_6XX
;
1540 /* XXX : not implemented */
1541 spr_register(env
, SPR_PTEHI
, "PTEHI",
1542 SPR_NOACCESS
, SPR_NOACCESS
,
1543 &spr_read_generic
, &spr_write_generic
,
1545 /* XXX : not implemented */
1546 spr_register(env
, SPR_PTELO
, "PTELO",
1547 SPR_NOACCESS
, SPR_NOACCESS
,
1548 &spr_read_generic
, &spr_write_generic
,
1550 /* XXX : not implemented */
1551 spr_register(env
, SPR_TLBMISS
, "TLBMISS",
1552 SPR_NOACCESS
, SPR_NOACCESS
,
1553 &spr_read_generic
, &spr_write_generic
,
1558 #if !defined(CONFIG_USER_ONLY)
1559 static void spr_write_e500_l1csr0 (DisasContext
*ctx
, int sprn
, int gprn
)
1561 TCGv t0
= tcg_temp_new();
1563 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR0_DCE
| L1CSR0_CPE
);
1564 gen_store_spr(sprn
, t0
);
1568 static void spr_write_e500_l1csr1(DisasContext
*ctx
, int sprn
, int gprn
)
1570 TCGv t0
= tcg_temp_new();
1572 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR1_ICE
| L1CSR1_CPE
);
1573 gen_store_spr(sprn
, t0
);
1577 static void spr_write_booke206_mmucsr0 (DisasContext
*ctx
, int sprn
, int gprn
)
1579 gen_helper_booke206_tlbflush(cpu_env
, cpu_gpr
[gprn
]);
1582 static void spr_write_booke_pid (DisasContext
*ctx
, int sprn
, int gprn
)
1584 TCGv_i32 t0
= tcg_const_i32(sprn
);
1585 gen_helper_booke_setpid(cpu_env
, t0
, cpu_gpr
[gprn
]);
1586 tcg_temp_free_i32(t0
);
1590 static void gen_spr_usprgh (CPUPPCState
*env
)
1592 spr_register(env
, SPR_USPRG4
, "USPRG4",
1593 &spr_read_ureg
, SPR_NOACCESS
,
1594 &spr_read_ureg
, SPR_NOACCESS
,
1596 spr_register(env
, SPR_USPRG5
, "USPRG5",
1597 &spr_read_ureg
, SPR_NOACCESS
,
1598 &spr_read_ureg
, SPR_NOACCESS
,
1600 spr_register(env
, SPR_USPRG6
, "USPRG6",
1601 &spr_read_ureg
, SPR_NOACCESS
,
1602 &spr_read_ureg
, SPR_NOACCESS
,
1604 spr_register(env
, SPR_USPRG7
, "USPRG7",
1605 &spr_read_ureg
, SPR_NOACCESS
,
1606 &spr_read_ureg
, SPR_NOACCESS
,
1610 /* PowerPC BookE SPR */
1611 static void gen_spr_BookE (CPUPPCState
*env
, uint64_t ivor_mask
)
1613 const char *ivor_names
[64] = {
1614 "IVOR0", "IVOR1", "IVOR2", "IVOR3",
1615 "IVOR4", "IVOR5", "IVOR6", "IVOR7",
1616 "IVOR8", "IVOR9", "IVOR10", "IVOR11",
1617 "IVOR12", "IVOR13", "IVOR14", "IVOR15",
1618 "IVOR16", "IVOR17", "IVOR18", "IVOR19",
1619 "IVOR20", "IVOR21", "IVOR22", "IVOR23",
1620 "IVOR24", "IVOR25", "IVOR26", "IVOR27",
1621 "IVOR28", "IVOR29", "IVOR30", "IVOR31",
1622 "IVOR32", "IVOR33", "IVOR34", "IVOR35",
1623 "IVOR36", "IVOR37", "IVOR38", "IVOR39",
1624 "IVOR40", "IVOR41", "IVOR42", "IVOR43",
1625 "IVOR44", "IVOR45", "IVOR46", "IVOR47",
1626 "IVOR48", "IVOR49", "IVOR50", "IVOR51",
1627 "IVOR52", "IVOR53", "IVOR54", "IVOR55",
1628 "IVOR56", "IVOR57", "IVOR58", "IVOR59",
1629 "IVOR60", "IVOR61", "IVOR62", "IVOR63",
1631 #define SPR_BOOKE_IVORxx (-1)
1632 int ivor_sprn
[64] = {
1633 SPR_BOOKE_IVOR0
, SPR_BOOKE_IVOR1
, SPR_BOOKE_IVOR2
, SPR_BOOKE_IVOR3
,
1634 SPR_BOOKE_IVOR4
, SPR_BOOKE_IVOR5
, SPR_BOOKE_IVOR6
, SPR_BOOKE_IVOR7
,
1635 SPR_BOOKE_IVOR8
, SPR_BOOKE_IVOR9
, SPR_BOOKE_IVOR10
, SPR_BOOKE_IVOR11
,
1636 SPR_BOOKE_IVOR12
, SPR_BOOKE_IVOR13
, SPR_BOOKE_IVOR14
, SPR_BOOKE_IVOR15
,
1637 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1638 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1639 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1640 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1641 SPR_BOOKE_IVOR32
, SPR_BOOKE_IVOR33
, SPR_BOOKE_IVOR34
, SPR_BOOKE_IVOR35
,
1642 SPR_BOOKE_IVOR36
, SPR_BOOKE_IVOR37
, SPR_BOOKE_IVOR38
, SPR_BOOKE_IVOR39
,
1643 SPR_BOOKE_IVOR40
, SPR_BOOKE_IVOR41
, SPR_BOOKE_IVOR42
, SPR_BOOKE_IVORxx
,
1644 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1645 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1646 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1647 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1648 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1652 /* Interrupt processing */
1653 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1654 SPR_NOACCESS
, SPR_NOACCESS
,
1655 &spr_read_generic
, &spr_write_generic
,
1657 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1658 SPR_NOACCESS
, SPR_NOACCESS
,
1659 &spr_read_generic
, &spr_write_generic
,
1662 /* XXX : not implemented */
1663 spr_register(env
, SPR_BOOKE_IAC1
, "IAC1",
1664 SPR_NOACCESS
, SPR_NOACCESS
,
1665 &spr_read_generic
, &spr_write_generic
,
1667 /* XXX : not implemented */
1668 spr_register(env
, SPR_BOOKE_IAC2
, "IAC2",
1669 SPR_NOACCESS
, SPR_NOACCESS
,
1670 &spr_read_generic
, &spr_write_generic
,
1672 /* XXX : not implemented */
1673 spr_register(env
, SPR_BOOKE_DAC1
, "DAC1",
1674 SPR_NOACCESS
, SPR_NOACCESS
,
1675 &spr_read_generic
, &spr_write_generic
,
1677 /* XXX : not implemented */
1678 spr_register(env
, SPR_BOOKE_DAC2
, "DAC2",
1679 SPR_NOACCESS
, SPR_NOACCESS
,
1680 &spr_read_generic
, &spr_write_generic
,
1682 /* XXX : not implemented */
1683 spr_register(env
, SPR_BOOKE_DBCR0
, "DBCR0",
1684 SPR_NOACCESS
, SPR_NOACCESS
,
1685 &spr_read_generic
, &spr_write_40x_dbcr0
,
1687 /* XXX : not implemented */
1688 spr_register(env
, SPR_BOOKE_DBCR1
, "DBCR1",
1689 SPR_NOACCESS
, SPR_NOACCESS
,
1690 &spr_read_generic
, &spr_write_generic
,
1692 /* XXX : not implemented */
1693 spr_register(env
, SPR_BOOKE_DBCR2
, "DBCR2",
1694 SPR_NOACCESS
, SPR_NOACCESS
,
1695 &spr_read_generic
, &spr_write_generic
,
1697 /* XXX : not implemented */
1698 spr_register(env
, SPR_BOOKE_DBSR
, "DBSR",
1699 SPR_NOACCESS
, SPR_NOACCESS
,
1700 &spr_read_generic
, &spr_write_clear
,
1702 spr_register(env
, SPR_BOOKE_DEAR
, "DEAR",
1703 SPR_NOACCESS
, SPR_NOACCESS
,
1704 &spr_read_generic
, &spr_write_generic
,
1706 spr_register(env
, SPR_BOOKE_ESR
, "ESR",
1707 SPR_NOACCESS
, SPR_NOACCESS
,
1708 &spr_read_generic
, &spr_write_generic
,
1710 spr_register(env
, SPR_BOOKE_IVPR
, "IVPR",
1711 SPR_NOACCESS
, SPR_NOACCESS
,
1712 &spr_read_generic
, &spr_write_excp_prefix
,
1714 /* Exception vectors */
1715 for (i
= 0; i
< 64; i
++) {
1716 if (ivor_mask
& (1ULL << i
)) {
1717 if (ivor_sprn
[i
] == SPR_BOOKE_IVORxx
) {
1718 fprintf(stderr
, "ERROR: IVOR %d SPR is not defined\n", i
);
1721 spr_register(env
, ivor_sprn
[i
], ivor_names
[i
],
1722 SPR_NOACCESS
, SPR_NOACCESS
,
1723 &spr_read_generic
, &spr_write_excp_vector
,
1727 spr_register(env
, SPR_BOOKE_PID
, "PID",
1728 SPR_NOACCESS
, SPR_NOACCESS
,
1729 &spr_read_generic
, &spr_write_booke_pid
,
1731 spr_register(env
, SPR_BOOKE_TCR
, "TCR",
1732 SPR_NOACCESS
, SPR_NOACCESS
,
1733 &spr_read_generic
, &spr_write_booke_tcr
,
1735 spr_register(env
, SPR_BOOKE_TSR
, "TSR",
1736 SPR_NOACCESS
, SPR_NOACCESS
,
1737 &spr_read_generic
, &spr_write_booke_tsr
,
1740 spr_register(env
, SPR_DECR
, "DECR",
1741 SPR_NOACCESS
, SPR_NOACCESS
,
1742 &spr_read_decr
, &spr_write_decr
,
1744 spr_register(env
, SPR_BOOKE_DECAR
, "DECAR",
1745 SPR_NOACCESS
, SPR_NOACCESS
,
1746 SPR_NOACCESS
, &spr_write_generic
,
1749 spr_register(env
, SPR_USPRG0
, "USPRG0",
1750 &spr_read_generic
, &spr_write_generic
,
1751 &spr_read_generic
, &spr_write_generic
,
1753 spr_register(env
, SPR_SPRG4
, "SPRG4",
1754 SPR_NOACCESS
, SPR_NOACCESS
,
1755 &spr_read_generic
, &spr_write_generic
,
1757 spr_register(env
, SPR_SPRG5
, "SPRG5",
1758 SPR_NOACCESS
, SPR_NOACCESS
,
1759 &spr_read_generic
, &spr_write_generic
,
1761 spr_register(env
, SPR_SPRG6
, "SPRG6",
1762 SPR_NOACCESS
, SPR_NOACCESS
,
1763 &spr_read_generic
, &spr_write_generic
,
1765 spr_register(env
, SPR_SPRG7
, "SPRG7",
1766 SPR_NOACCESS
, SPR_NOACCESS
,
1767 &spr_read_generic
, &spr_write_generic
,
1771 static inline uint32_t gen_tlbncfg(uint32_t assoc
, uint32_t minsize
,
1772 uint32_t maxsize
, uint32_t flags
,
1775 return (assoc
<< TLBnCFG_ASSOC_SHIFT
) |
1776 (minsize
<< TLBnCFG_MINSIZE_SHIFT
) |
1777 (maxsize
<< TLBnCFG_MAXSIZE_SHIFT
) |
1781 /* BookE 2.06 storage control registers */
1782 static void gen_spr_BookE206(CPUPPCState
*env
, uint32_t mas_mask
,
1785 #if !defined(CONFIG_USER_ONLY)
1786 const char *mas_names
[8] = {
1787 "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
1790 SPR_BOOKE_MAS0
, SPR_BOOKE_MAS1
, SPR_BOOKE_MAS2
, SPR_BOOKE_MAS3
,
1791 SPR_BOOKE_MAS4
, SPR_BOOKE_MAS5
, SPR_BOOKE_MAS6
, SPR_BOOKE_MAS7
,
1795 /* TLB assist registers */
1796 /* XXX : not implemented */
1797 for (i
= 0; i
< 8; i
++) {
1798 void (*uea_write
)(DisasContext
*ctx
, int sprn
, int gprn
) = &spr_write_generic32
;
1799 if (i
== 2 && (mas_mask
& (1 << i
)) && (env
->insns_flags
& PPC_64B
)) {
1800 uea_write
= &spr_write_generic
;
1802 if (mas_mask
& (1 << i
)) {
1803 spr_register(env
, mas_sprn
[i
], mas_names
[i
],
1804 SPR_NOACCESS
, SPR_NOACCESS
,
1805 &spr_read_generic
, uea_write
,
1809 if (env
->nb_pids
> 1) {
1810 /* XXX : not implemented */
1811 spr_register(env
, SPR_BOOKE_PID1
, "PID1",
1812 SPR_NOACCESS
, SPR_NOACCESS
,
1813 &spr_read_generic
, &spr_write_booke_pid
,
1816 if (env
->nb_pids
> 2) {
1817 /* XXX : not implemented */
1818 spr_register(env
, SPR_BOOKE_PID2
, "PID2",
1819 SPR_NOACCESS
, SPR_NOACCESS
,
1820 &spr_read_generic
, &spr_write_booke_pid
,
1823 /* XXX : not implemented */
1824 spr_register(env
, SPR_MMUCFG
, "MMUCFG",
1825 SPR_NOACCESS
, SPR_NOACCESS
,
1826 &spr_read_generic
, SPR_NOACCESS
,
1827 0x00000000); /* TOFIX */
1828 switch (env
->nb_ways
) {
1830 spr_register(env
, SPR_BOOKE_TLB3CFG
, "TLB3CFG",
1831 SPR_NOACCESS
, SPR_NOACCESS
,
1832 &spr_read_generic
, SPR_NOACCESS
,
1836 spr_register(env
, SPR_BOOKE_TLB2CFG
, "TLB2CFG",
1837 SPR_NOACCESS
, SPR_NOACCESS
,
1838 &spr_read_generic
, SPR_NOACCESS
,
1842 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
1843 SPR_NOACCESS
, SPR_NOACCESS
,
1844 &spr_read_generic
, SPR_NOACCESS
,
1848 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
1849 SPR_NOACCESS
, SPR_NOACCESS
,
1850 &spr_read_generic
, SPR_NOACCESS
,
1859 gen_spr_usprgh(env
);
1862 /* SPR specific to PowerPC 440 implementation */
1863 static void gen_spr_440 (CPUPPCState
*env
)
1866 /* XXX : not implemented */
1867 spr_register(env
, SPR_440_DNV0
, "DNV0",
1868 SPR_NOACCESS
, SPR_NOACCESS
,
1869 &spr_read_generic
, &spr_write_generic
,
1871 /* XXX : not implemented */
1872 spr_register(env
, SPR_440_DNV1
, "DNV1",
1873 SPR_NOACCESS
, SPR_NOACCESS
,
1874 &spr_read_generic
, &spr_write_generic
,
1876 /* XXX : not implemented */
1877 spr_register(env
, SPR_440_DNV2
, "DNV2",
1878 SPR_NOACCESS
, SPR_NOACCESS
,
1879 &spr_read_generic
, &spr_write_generic
,
1881 /* XXX : not implemented */
1882 spr_register(env
, SPR_440_DNV3
, "DNV3",
1883 SPR_NOACCESS
, SPR_NOACCESS
,
1884 &spr_read_generic
, &spr_write_generic
,
1886 /* XXX : not implemented */
1887 spr_register(env
, SPR_440_DTV0
, "DTV0",
1888 SPR_NOACCESS
, SPR_NOACCESS
,
1889 &spr_read_generic
, &spr_write_generic
,
1891 /* XXX : not implemented */
1892 spr_register(env
, SPR_440_DTV1
, "DTV1",
1893 SPR_NOACCESS
, SPR_NOACCESS
,
1894 &spr_read_generic
, &spr_write_generic
,
1896 /* XXX : not implemented */
1897 spr_register(env
, SPR_440_DTV2
, "DTV2",
1898 SPR_NOACCESS
, SPR_NOACCESS
,
1899 &spr_read_generic
, &spr_write_generic
,
1901 /* XXX : not implemented */
1902 spr_register(env
, SPR_440_DTV3
, "DTV3",
1903 SPR_NOACCESS
, SPR_NOACCESS
,
1904 &spr_read_generic
, &spr_write_generic
,
1906 /* XXX : not implemented */
1907 spr_register(env
, SPR_440_DVLIM
, "DVLIM",
1908 SPR_NOACCESS
, SPR_NOACCESS
,
1909 &spr_read_generic
, &spr_write_generic
,
1911 /* XXX : not implemented */
1912 spr_register(env
, SPR_440_INV0
, "INV0",
1913 SPR_NOACCESS
, SPR_NOACCESS
,
1914 &spr_read_generic
, &spr_write_generic
,
1916 /* XXX : not implemented */
1917 spr_register(env
, SPR_440_INV1
, "INV1",
1918 SPR_NOACCESS
, SPR_NOACCESS
,
1919 &spr_read_generic
, &spr_write_generic
,
1921 /* XXX : not implemented */
1922 spr_register(env
, SPR_440_INV2
, "INV2",
1923 SPR_NOACCESS
, SPR_NOACCESS
,
1924 &spr_read_generic
, &spr_write_generic
,
1926 /* XXX : not implemented */
1927 spr_register(env
, SPR_440_INV3
, "INV3",
1928 SPR_NOACCESS
, SPR_NOACCESS
,
1929 &spr_read_generic
, &spr_write_generic
,
1931 /* XXX : not implemented */
1932 spr_register(env
, SPR_440_ITV0
, "ITV0",
1933 SPR_NOACCESS
, SPR_NOACCESS
,
1934 &spr_read_generic
, &spr_write_generic
,
1936 /* XXX : not implemented */
1937 spr_register(env
, SPR_440_ITV1
, "ITV1",
1938 SPR_NOACCESS
, SPR_NOACCESS
,
1939 &spr_read_generic
, &spr_write_generic
,
1941 /* XXX : not implemented */
1942 spr_register(env
, SPR_440_ITV2
, "ITV2",
1943 SPR_NOACCESS
, SPR_NOACCESS
,
1944 &spr_read_generic
, &spr_write_generic
,
1946 /* XXX : not implemented */
1947 spr_register(env
, SPR_440_ITV3
, "ITV3",
1948 SPR_NOACCESS
, SPR_NOACCESS
,
1949 &spr_read_generic
, &spr_write_generic
,
1951 /* XXX : not implemented */
1952 spr_register(env
, SPR_440_IVLIM
, "IVLIM",
1953 SPR_NOACCESS
, SPR_NOACCESS
,
1954 &spr_read_generic
, &spr_write_generic
,
1957 /* XXX : not implemented */
1958 spr_register(env
, SPR_BOOKE_DCDBTRH
, "DCDBTRH",
1959 SPR_NOACCESS
, SPR_NOACCESS
,
1960 &spr_read_generic
, SPR_NOACCESS
,
1962 /* XXX : not implemented */
1963 spr_register(env
, SPR_BOOKE_DCDBTRL
, "DCDBTRL",
1964 SPR_NOACCESS
, SPR_NOACCESS
,
1965 &spr_read_generic
, SPR_NOACCESS
,
1967 /* XXX : not implemented */
1968 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
1969 SPR_NOACCESS
, SPR_NOACCESS
,
1970 &spr_read_generic
, SPR_NOACCESS
,
1972 /* XXX : not implemented */
1973 spr_register(env
, SPR_BOOKE_ICDBTRH
, "ICDBTRH",
1974 SPR_NOACCESS
, SPR_NOACCESS
,
1975 &spr_read_generic
, SPR_NOACCESS
,
1977 /* XXX : not implemented */
1978 spr_register(env
, SPR_BOOKE_ICDBTRL
, "ICDBTRL",
1979 SPR_NOACCESS
, SPR_NOACCESS
,
1980 &spr_read_generic
, SPR_NOACCESS
,
1982 /* XXX : not implemented */
1983 spr_register(env
, SPR_440_DBDR
, "DBDR",
1984 SPR_NOACCESS
, SPR_NOACCESS
,
1985 &spr_read_generic
, &spr_write_generic
,
1987 /* Processor control */
1988 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
1989 SPR_NOACCESS
, SPR_NOACCESS
,
1990 &spr_read_generic
, &spr_write_generic
,
1992 spr_register(env
, SPR_440_RSTCFG
, "RSTCFG",
1993 SPR_NOACCESS
, SPR_NOACCESS
,
1994 &spr_read_generic
, SPR_NOACCESS
,
1996 /* Storage control */
1997 spr_register(env
, SPR_440_MMUCR
, "MMUCR",
1998 SPR_NOACCESS
, SPR_NOACCESS
,
1999 &spr_read_generic
, &spr_write_generic
,
2003 /* SPR shared between PowerPC 40x implementations */
2004 static void gen_spr_40x (CPUPPCState
*env
)
2007 /* not emulated, as QEMU do not emulate caches */
2008 spr_register(env
, SPR_40x_DCCR
, "DCCR",
2009 SPR_NOACCESS
, SPR_NOACCESS
,
2010 &spr_read_generic
, &spr_write_generic
,
2012 /* not emulated, as QEMU do not emulate caches */
2013 spr_register(env
, SPR_40x_ICCR
, "ICCR",
2014 SPR_NOACCESS
, SPR_NOACCESS
,
2015 &spr_read_generic
, &spr_write_generic
,
2017 /* not emulated, as QEMU do not emulate caches */
2018 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
2019 SPR_NOACCESS
, SPR_NOACCESS
,
2020 &spr_read_generic
, SPR_NOACCESS
,
2023 spr_register(env
, SPR_40x_DEAR
, "DEAR",
2024 SPR_NOACCESS
, SPR_NOACCESS
,
2025 &spr_read_generic
, &spr_write_generic
,
2027 spr_register(env
, SPR_40x_ESR
, "ESR",
2028 SPR_NOACCESS
, SPR_NOACCESS
,
2029 &spr_read_generic
, &spr_write_generic
,
2031 spr_register(env
, SPR_40x_EVPR
, "EVPR",
2032 SPR_NOACCESS
, SPR_NOACCESS
,
2033 &spr_read_generic
, &spr_write_excp_prefix
,
2035 spr_register(env
, SPR_40x_SRR2
, "SRR2",
2036 &spr_read_generic
, &spr_write_generic
,
2037 &spr_read_generic
, &spr_write_generic
,
2039 spr_register(env
, SPR_40x_SRR3
, "SRR3",
2040 &spr_read_generic
, &spr_write_generic
,
2041 &spr_read_generic
, &spr_write_generic
,
2044 spr_register(env
, SPR_40x_PIT
, "PIT",
2045 SPR_NOACCESS
, SPR_NOACCESS
,
2046 &spr_read_40x_pit
, &spr_write_40x_pit
,
2048 spr_register(env
, SPR_40x_TCR
, "TCR",
2049 SPR_NOACCESS
, SPR_NOACCESS
,
2050 &spr_read_generic
, &spr_write_booke_tcr
,
2052 spr_register(env
, SPR_40x_TSR
, "TSR",
2053 SPR_NOACCESS
, SPR_NOACCESS
,
2054 &spr_read_generic
, &spr_write_booke_tsr
,
2058 /* SPR specific to PowerPC 405 implementation */
2059 static void gen_spr_405 (CPUPPCState
*env
)
2062 spr_register(env
, SPR_40x_PID
, "PID",
2063 SPR_NOACCESS
, SPR_NOACCESS
,
2064 &spr_read_generic
, &spr_write_generic
,
2066 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
2067 SPR_NOACCESS
, SPR_NOACCESS
,
2068 &spr_read_generic
, &spr_write_generic
,
2070 /* Debug interface */
2071 /* XXX : not implemented */
2072 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2073 SPR_NOACCESS
, SPR_NOACCESS
,
2074 &spr_read_generic
, &spr_write_40x_dbcr0
,
2076 /* XXX : not implemented */
2077 spr_register(env
, SPR_405_DBCR1
, "DBCR1",
2078 SPR_NOACCESS
, SPR_NOACCESS
,
2079 &spr_read_generic
, &spr_write_generic
,
2081 /* XXX : not implemented */
2082 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2083 SPR_NOACCESS
, SPR_NOACCESS
,
2084 &spr_read_generic
, &spr_write_clear
,
2085 /* Last reset was system reset */
2087 /* XXX : not implemented */
2088 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2089 SPR_NOACCESS
, SPR_NOACCESS
,
2090 &spr_read_generic
, &spr_write_generic
,
2092 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2093 SPR_NOACCESS
, SPR_NOACCESS
,
2094 &spr_read_generic
, &spr_write_generic
,
2096 /* XXX : not implemented */
2097 spr_register(env
, SPR_405_DVC1
, "DVC1",
2098 SPR_NOACCESS
, SPR_NOACCESS
,
2099 &spr_read_generic
, &spr_write_generic
,
2101 /* XXX : not implemented */
2102 spr_register(env
, SPR_405_DVC2
, "DVC2",
2103 SPR_NOACCESS
, SPR_NOACCESS
,
2104 &spr_read_generic
, &spr_write_generic
,
2106 /* XXX : not implemented */
2107 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2108 SPR_NOACCESS
, SPR_NOACCESS
,
2109 &spr_read_generic
, &spr_write_generic
,
2111 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2112 SPR_NOACCESS
, SPR_NOACCESS
,
2113 &spr_read_generic
, &spr_write_generic
,
2115 /* XXX : not implemented */
2116 spr_register(env
, SPR_405_IAC3
, "IAC3",
2117 SPR_NOACCESS
, SPR_NOACCESS
,
2118 &spr_read_generic
, &spr_write_generic
,
2120 /* XXX : not implemented */
2121 spr_register(env
, SPR_405_IAC4
, "IAC4",
2122 SPR_NOACCESS
, SPR_NOACCESS
,
2123 &spr_read_generic
, &spr_write_generic
,
2125 /* Storage control */
2126 /* XXX: TODO: not implemented */
2127 spr_register(env
, SPR_405_SLER
, "SLER",
2128 SPR_NOACCESS
, SPR_NOACCESS
,
2129 &spr_read_generic
, &spr_write_40x_sler
,
2131 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2132 SPR_NOACCESS
, SPR_NOACCESS
,
2133 &spr_read_generic
, &spr_write_generic
,
2135 /* XXX : not implemented */
2136 spr_register(env
, SPR_405_SU0R
, "SU0R",
2137 SPR_NOACCESS
, SPR_NOACCESS
,
2138 &spr_read_generic
, &spr_write_generic
,
2141 spr_register(env
, SPR_USPRG0
, "USPRG0",
2142 &spr_read_ureg
, SPR_NOACCESS
,
2143 &spr_read_ureg
, SPR_NOACCESS
,
2145 spr_register(env
, SPR_SPRG4
, "SPRG4",
2146 SPR_NOACCESS
, SPR_NOACCESS
,
2147 &spr_read_generic
, &spr_write_generic
,
2149 spr_register(env
, SPR_SPRG5
, "SPRG5",
2150 SPR_NOACCESS
, SPR_NOACCESS
,
2151 spr_read_generic
, &spr_write_generic
,
2153 spr_register(env
, SPR_SPRG6
, "SPRG6",
2154 SPR_NOACCESS
, SPR_NOACCESS
,
2155 spr_read_generic
, &spr_write_generic
,
2157 spr_register(env
, SPR_SPRG7
, "SPRG7",
2158 SPR_NOACCESS
, SPR_NOACCESS
,
2159 spr_read_generic
, &spr_write_generic
,
2161 gen_spr_usprgh(env
);
2164 /* SPR shared between PowerPC 401 & 403 implementations */
2165 static void gen_spr_401_403 (CPUPPCState
*env
)
2168 spr_register(env
, SPR_403_VTBL
, "TBL",
2169 &spr_read_tbl
, SPR_NOACCESS
,
2170 &spr_read_tbl
, SPR_NOACCESS
,
2172 spr_register(env
, SPR_403_TBL
, "TBL",
2173 SPR_NOACCESS
, SPR_NOACCESS
,
2174 SPR_NOACCESS
, &spr_write_tbl
,
2176 spr_register(env
, SPR_403_VTBU
, "TBU",
2177 &spr_read_tbu
, SPR_NOACCESS
,
2178 &spr_read_tbu
, SPR_NOACCESS
,
2180 spr_register(env
, SPR_403_TBU
, "TBU",
2181 SPR_NOACCESS
, SPR_NOACCESS
,
2182 SPR_NOACCESS
, &spr_write_tbu
,
2185 /* not emulated, as QEMU do not emulate caches */
2186 spr_register(env
, SPR_403_CDBCR
, "CDBCR",
2187 SPR_NOACCESS
, SPR_NOACCESS
,
2188 &spr_read_generic
, &spr_write_generic
,
2192 /* SPR specific to PowerPC 401 implementation */
2193 static void gen_spr_401 (CPUPPCState
*env
)
2195 /* Debug interface */
2196 /* XXX : not implemented */
2197 spr_register(env
, SPR_40x_DBCR0
, "DBCR",
2198 SPR_NOACCESS
, SPR_NOACCESS
,
2199 &spr_read_generic
, &spr_write_40x_dbcr0
,
2201 /* XXX : not implemented */
2202 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2203 SPR_NOACCESS
, SPR_NOACCESS
,
2204 &spr_read_generic
, &spr_write_clear
,
2205 /* Last reset was system reset */
2207 /* XXX : not implemented */
2208 spr_register(env
, SPR_40x_DAC1
, "DAC",
2209 SPR_NOACCESS
, SPR_NOACCESS
,
2210 &spr_read_generic
, &spr_write_generic
,
2212 /* XXX : not implemented */
2213 spr_register(env
, SPR_40x_IAC1
, "IAC",
2214 SPR_NOACCESS
, SPR_NOACCESS
,
2215 &spr_read_generic
, &spr_write_generic
,
2217 /* Storage control */
2218 /* XXX: TODO: not implemented */
2219 spr_register(env
, SPR_405_SLER
, "SLER",
2220 SPR_NOACCESS
, SPR_NOACCESS
,
2221 &spr_read_generic
, &spr_write_40x_sler
,
2223 /* not emulated, as QEMU never does speculative access */
2224 spr_register(env
, SPR_40x_SGR
, "SGR",
2225 SPR_NOACCESS
, SPR_NOACCESS
,
2226 &spr_read_generic
, &spr_write_generic
,
2228 /* not emulated, as QEMU do not emulate caches */
2229 spr_register(env
, SPR_40x_DCWR
, "DCWR",
2230 SPR_NOACCESS
, SPR_NOACCESS
,
2231 &spr_read_generic
, &spr_write_generic
,
2235 static void gen_spr_401x2 (CPUPPCState
*env
)
2238 spr_register(env
, SPR_40x_PID
, "PID",
2239 SPR_NOACCESS
, SPR_NOACCESS
,
2240 &spr_read_generic
, &spr_write_generic
,
2242 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2243 SPR_NOACCESS
, SPR_NOACCESS
,
2244 &spr_read_generic
, &spr_write_generic
,
2248 /* SPR specific to PowerPC 403 implementation */
2249 static void gen_spr_403 (CPUPPCState
*env
)
2251 /* Debug interface */
2252 /* XXX : not implemented */
2253 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2254 SPR_NOACCESS
, SPR_NOACCESS
,
2255 &spr_read_generic
, &spr_write_40x_dbcr0
,
2257 /* XXX : not implemented */
2258 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2259 SPR_NOACCESS
, SPR_NOACCESS
,
2260 &spr_read_generic
, &spr_write_clear
,
2261 /* Last reset was system reset */
2263 /* XXX : not implemented */
2264 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2265 SPR_NOACCESS
, SPR_NOACCESS
,
2266 &spr_read_generic
, &spr_write_generic
,
2268 /* XXX : not implemented */
2269 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2270 SPR_NOACCESS
, SPR_NOACCESS
,
2271 &spr_read_generic
, &spr_write_generic
,
2273 /* XXX : not implemented */
2274 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2275 SPR_NOACCESS
, SPR_NOACCESS
,
2276 &spr_read_generic
, &spr_write_generic
,
2278 /* XXX : not implemented */
2279 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2280 SPR_NOACCESS
, SPR_NOACCESS
,
2281 &spr_read_generic
, &spr_write_generic
,
2285 static void gen_spr_403_real (CPUPPCState
*env
)
2287 spr_register(env
, SPR_403_PBL1
, "PBL1",
2288 SPR_NOACCESS
, SPR_NOACCESS
,
2289 &spr_read_403_pbr
, &spr_write_403_pbr
,
2291 spr_register(env
, SPR_403_PBU1
, "PBU1",
2292 SPR_NOACCESS
, SPR_NOACCESS
,
2293 &spr_read_403_pbr
, &spr_write_403_pbr
,
2295 spr_register(env
, SPR_403_PBL2
, "PBL2",
2296 SPR_NOACCESS
, SPR_NOACCESS
,
2297 &spr_read_403_pbr
, &spr_write_403_pbr
,
2299 spr_register(env
, SPR_403_PBU2
, "PBU2",
2300 SPR_NOACCESS
, SPR_NOACCESS
,
2301 &spr_read_403_pbr
, &spr_write_403_pbr
,
2305 static void gen_spr_403_mmu (CPUPPCState
*env
)
2308 spr_register(env
, SPR_40x_PID
, "PID",
2309 SPR_NOACCESS
, SPR_NOACCESS
,
2310 &spr_read_generic
, &spr_write_generic
,
2312 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2313 SPR_NOACCESS
, SPR_NOACCESS
,
2314 &spr_read_generic
, &spr_write_generic
,
2318 /* SPR specific to PowerPC compression coprocessor extension */
2319 static void gen_spr_compress (CPUPPCState
*env
)
2321 /* XXX : not implemented */
2322 spr_register(env
, SPR_401_SKR
, "SKR",
2323 SPR_NOACCESS
, SPR_NOACCESS
,
2324 &spr_read_generic
, &spr_write_generic
,
2328 static void gen_spr_5xx_8xx (CPUPPCState
*env
)
2330 /* Exception processing */
2331 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
2332 SPR_NOACCESS
, SPR_NOACCESS
,
2333 &spr_read_generic
, &spr_write_generic
,
2334 KVM_REG_PPC_DSISR
, 0x00000000);
2335 spr_register_kvm(env
, SPR_DAR
, "DAR",
2336 SPR_NOACCESS
, SPR_NOACCESS
,
2337 &spr_read_generic
, &spr_write_generic
,
2338 KVM_REG_PPC_DAR
, 0x00000000);
2340 spr_register(env
, SPR_DECR
, "DECR",
2341 SPR_NOACCESS
, SPR_NOACCESS
,
2342 &spr_read_decr
, &spr_write_decr
,
2344 /* XXX : not implemented */
2345 spr_register(env
, SPR_MPC_EIE
, "EIE",
2346 SPR_NOACCESS
, SPR_NOACCESS
,
2347 &spr_read_generic
, &spr_write_generic
,
2349 /* XXX : not implemented */
2350 spr_register(env
, SPR_MPC_EID
, "EID",
2351 SPR_NOACCESS
, SPR_NOACCESS
,
2352 &spr_read_generic
, &spr_write_generic
,
2354 /* XXX : not implemented */
2355 spr_register(env
, SPR_MPC_NRI
, "NRI",
2356 SPR_NOACCESS
, SPR_NOACCESS
,
2357 &spr_read_generic
, &spr_write_generic
,
2359 /* XXX : not implemented */
2360 spr_register(env
, SPR_MPC_CMPA
, "CMPA",
2361 SPR_NOACCESS
, SPR_NOACCESS
,
2362 &spr_read_generic
, &spr_write_generic
,
2364 /* XXX : not implemented */
2365 spr_register(env
, SPR_MPC_CMPB
, "CMPB",
2366 SPR_NOACCESS
, SPR_NOACCESS
,
2367 &spr_read_generic
, &spr_write_generic
,
2369 /* XXX : not implemented */
2370 spr_register(env
, SPR_MPC_CMPC
, "CMPC",
2371 SPR_NOACCESS
, SPR_NOACCESS
,
2372 &spr_read_generic
, &spr_write_generic
,
2374 /* XXX : not implemented */
2375 spr_register(env
, SPR_MPC_CMPD
, "CMPD",
2376 SPR_NOACCESS
, SPR_NOACCESS
,
2377 &spr_read_generic
, &spr_write_generic
,
2379 /* XXX : not implemented */
2380 spr_register(env
, SPR_MPC_ECR
, "ECR",
2381 SPR_NOACCESS
, SPR_NOACCESS
,
2382 &spr_read_generic
, &spr_write_generic
,
2384 /* XXX : not implemented */
2385 spr_register(env
, SPR_MPC_DER
, "DER",
2386 SPR_NOACCESS
, SPR_NOACCESS
,
2387 &spr_read_generic
, &spr_write_generic
,
2389 /* XXX : not implemented */
2390 spr_register(env
, SPR_MPC_COUNTA
, "COUNTA",
2391 SPR_NOACCESS
, SPR_NOACCESS
,
2392 &spr_read_generic
, &spr_write_generic
,
2394 /* XXX : not implemented */
2395 spr_register(env
, SPR_MPC_COUNTB
, "COUNTB",
2396 SPR_NOACCESS
, SPR_NOACCESS
,
2397 &spr_read_generic
, &spr_write_generic
,
2399 /* XXX : not implemented */
2400 spr_register(env
, SPR_MPC_CMPE
, "CMPE",
2401 SPR_NOACCESS
, SPR_NOACCESS
,
2402 &spr_read_generic
, &spr_write_generic
,
2404 /* XXX : not implemented */
2405 spr_register(env
, SPR_MPC_CMPF
, "CMPF",
2406 SPR_NOACCESS
, SPR_NOACCESS
,
2407 &spr_read_generic
, &spr_write_generic
,
2409 /* XXX : not implemented */
2410 spr_register(env
, SPR_MPC_CMPG
, "CMPG",
2411 SPR_NOACCESS
, SPR_NOACCESS
,
2412 &spr_read_generic
, &spr_write_generic
,
2414 /* XXX : not implemented */
2415 spr_register(env
, SPR_MPC_CMPH
, "CMPH",
2416 SPR_NOACCESS
, SPR_NOACCESS
,
2417 &spr_read_generic
, &spr_write_generic
,
2419 /* XXX : not implemented */
2420 spr_register(env
, SPR_MPC_LCTRL1
, "LCTRL1",
2421 SPR_NOACCESS
, SPR_NOACCESS
,
2422 &spr_read_generic
, &spr_write_generic
,
2424 /* XXX : not implemented */
2425 spr_register(env
, SPR_MPC_LCTRL2
, "LCTRL2",
2426 SPR_NOACCESS
, SPR_NOACCESS
,
2427 &spr_read_generic
, &spr_write_generic
,
2429 /* XXX : not implemented */
2430 spr_register(env
, SPR_MPC_BAR
, "BAR",
2431 SPR_NOACCESS
, SPR_NOACCESS
,
2432 &spr_read_generic
, &spr_write_generic
,
2434 /* XXX : not implemented */
2435 spr_register(env
, SPR_MPC_DPDR
, "DPDR",
2436 SPR_NOACCESS
, SPR_NOACCESS
,
2437 &spr_read_generic
, &spr_write_generic
,
2439 /* XXX : not implemented */
2440 spr_register(env
, SPR_MPC_IMMR
, "IMMR",
2441 SPR_NOACCESS
, SPR_NOACCESS
,
2442 &spr_read_generic
, &spr_write_generic
,
2446 static void gen_spr_5xx (CPUPPCState
*env
)
2448 /* XXX : not implemented */
2449 spr_register(env
, SPR_RCPU_MI_GRA
, "MI_GRA",
2450 SPR_NOACCESS
, SPR_NOACCESS
,
2451 &spr_read_generic
, &spr_write_generic
,
2453 /* XXX : not implemented */
2454 spr_register(env
, SPR_RCPU_L2U_GRA
, "L2U_GRA",
2455 SPR_NOACCESS
, SPR_NOACCESS
,
2456 &spr_read_generic
, &spr_write_generic
,
2458 /* XXX : not implemented */
2459 spr_register(env
, SPR_RPCU_BBCMCR
, "L2U_BBCMCR",
2460 SPR_NOACCESS
, SPR_NOACCESS
,
2461 &spr_read_generic
, &spr_write_generic
,
2463 /* XXX : not implemented */
2464 spr_register(env
, SPR_RCPU_L2U_MCR
, "L2U_MCR",
2465 SPR_NOACCESS
, SPR_NOACCESS
,
2466 &spr_read_generic
, &spr_write_generic
,
2468 /* XXX : not implemented */
2469 spr_register(env
, SPR_RCPU_MI_RBA0
, "MI_RBA0",
2470 SPR_NOACCESS
, SPR_NOACCESS
,
2471 &spr_read_generic
, &spr_write_generic
,
2473 /* XXX : not implemented */
2474 spr_register(env
, SPR_RCPU_MI_RBA1
, "MI_RBA1",
2475 SPR_NOACCESS
, SPR_NOACCESS
,
2476 &spr_read_generic
, &spr_write_generic
,
2478 /* XXX : not implemented */
2479 spr_register(env
, SPR_RCPU_MI_RBA2
, "MI_RBA2",
2480 SPR_NOACCESS
, SPR_NOACCESS
,
2481 &spr_read_generic
, &spr_write_generic
,
2483 /* XXX : not implemented */
2484 spr_register(env
, SPR_RCPU_MI_RBA3
, "MI_RBA3",
2485 SPR_NOACCESS
, SPR_NOACCESS
,
2486 &spr_read_generic
, &spr_write_generic
,
2488 /* XXX : not implemented */
2489 spr_register(env
, SPR_RCPU_L2U_RBA0
, "L2U_RBA0",
2490 SPR_NOACCESS
, SPR_NOACCESS
,
2491 &spr_read_generic
, &spr_write_generic
,
2493 /* XXX : not implemented */
2494 spr_register(env
, SPR_RCPU_L2U_RBA1
, "L2U_RBA1",
2495 SPR_NOACCESS
, SPR_NOACCESS
,
2496 &spr_read_generic
, &spr_write_generic
,
2498 /* XXX : not implemented */
2499 spr_register(env
, SPR_RCPU_L2U_RBA2
, "L2U_RBA2",
2500 SPR_NOACCESS
, SPR_NOACCESS
,
2501 &spr_read_generic
, &spr_write_generic
,
2503 /* XXX : not implemented */
2504 spr_register(env
, SPR_RCPU_L2U_RBA3
, "L2U_RBA3",
2505 SPR_NOACCESS
, SPR_NOACCESS
,
2506 &spr_read_generic
, &spr_write_generic
,
2508 /* XXX : not implemented */
2509 spr_register(env
, SPR_RCPU_MI_RA0
, "MI_RA0",
2510 SPR_NOACCESS
, SPR_NOACCESS
,
2511 &spr_read_generic
, &spr_write_generic
,
2513 /* XXX : not implemented */
2514 spr_register(env
, SPR_RCPU_MI_RA1
, "MI_RA1",
2515 SPR_NOACCESS
, SPR_NOACCESS
,
2516 &spr_read_generic
, &spr_write_generic
,
2518 /* XXX : not implemented */
2519 spr_register(env
, SPR_RCPU_MI_RA2
, "MI_RA2",
2520 SPR_NOACCESS
, SPR_NOACCESS
,
2521 &spr_read_generic
, &spr_write_generic
,
2523 /* XXX : not implemented */
2524 spr_register(env
, SPR_RCPU_MI_RA3
, "MI_RA3",
2525 SPR_NOACCESS
, SPR_NOACCESS
,
2526 &spr_read_generic
, &spr_write_generic
,
2528 /* XXX : not implemented */
2529 spr_register(env
, SPR_RCPU_L2U_RA0
, "L2U_RA0",
2530 SPR_NOACCESS
, SPR_NOACCESS
,
2531 &spr_read_generic
, &spr_write_generic
,
2533 /* XXX : not implemented */
2534 spr_register(env
, SPR_RCPU_L2U_RA1
, "L2U_RA1",
2535 SPR_NOACCESS
, SPR_NOACCESS
,
2536 &spr_read_generic
, &spr_write_generic
,
2538 /* XXX : not implemented */
2539 spr_register(env
, SPR_RCPU_L2U_RA2
, "L2U_RA2",
2540 SPR_NOACCESS
, SPR_NOACCESS
,
2541 &spr_read_generic
, &spr_write_generic
,
2543 /* XXX : not implemented */
2544 spr_register(env
, SPR_RCPU_L2U_RA3
, "L2U_RA3",
2545 SPR_NOACCESS
, SPR_NOACCESS
,
2546 &spr_read_generic
, &spr_write_generic
,
2548 /* XXX : not implemented */
2549 spr_register(env
, SPR_RCPU_FPECR
, "FPECR",
2550 SPR_NOACCESS
, SPR_NOACCESS
,
2551 &spr_read_generic
, &spr_write_generic
,
2555 static void gen_spr_8xx (CPUPPCState
*env
)
2557 /* XXX : not implemented */
2558 spr_register(env
, SPR_MPC_IC_CST
, "IC_CST",
2559 SPR_NOACCESS
, SPR_NOACCESS
,
2560 &spr_read_generic
, &spr_write_generic
,
2562 /* XXX : not implemented */
2563 spr_register(env
, SPR_MPC_IC_ADR
, "IC_ADR",
2564 SPR_NOACCESS
, SPR_NOACCESS
,
2565 &spr_read_generic
, &spr_write_generic
,
2567 /* XXX : not implemented */
2568 spr_register(env
, SPR_MPC_IC_DAT
, "IC_DAT",
2569 SPR_NOACCESS
, SPR_NOACCESS
,
2570 &spr_read_generic
, &spr_write_generic
,
2572 /* XXX : not implemented */
2573 spr_register(env
, SPR_MPC_DC_CST
, "DC_CST",
2574 SPR_NOACCESS
, SPR_NOACCESS
,
2575 &spr_read_generic
, &spr_write_generic
,
2577 /* XXX : not implemented */
2578 spr_register(env
, SPR_MPC_DC_ADR
, "DC_ADR",
2579 SPR_NOACCESS
, SPR_NOACCESS
,
2580 &spr_read_generic
, &spr_write_generic
,
2582 /* XXX : not implemented */
2583 spr_register(env
, SPR_MPC_DC_DAT
, "DC_DAT",
2584 SPR_NOACCESS
, SPR_NOACCESS
,
2585 &spr_read_generic
, &spr_write_generic
,
2587 /* XXX : not implemented */
2588 spr_register(env
, SPR_MPC_MI_CTR
, "MI_CTR",
2589 SPR_NOACCESS
, SPR_NOACCESS
,
2590 &spr_read_generic
, &spr_write_generic
,
2592 /* XXX : not implemented */
2593 spr_register(env
, SPR_MPC_MI_AP
, "MI_AP",
2594 SPR_NOACCESS
, SPR_NOACCESS
,
2595 &spr_read_generic
, &spr_write_generic
,
2597 /* XXX : not implemented */
2598 spr_register(env
, SPR_MPC_MI_EPN
, "MI_EPN",
2599 SPR_NOACCESS
, SPR_NOACCESS
,
2600 &spr_read_generic
, &spr_write_generic
,
2602 /* XXX : not implemented */
2603 spr_register(env
, SPR_MPC_MI_TWC
, "MI_TWC",
2604 SPR_NOACCESS
, SPR_NOACCESS
,
2605 &spr_read_generic
, &spr_write_generic
,
2607 /* XXX : not implemented */
2608 spr_register(env
, SPR_MPC_MI_RPN
, "MI_RPN",
2609 SPR_NOACCESS
, SPR_NOACCESS
,
2610 &spr_read_generic
, &spr_write_generic
,
2612 /* XXX : not implemented */
2613 spr_register(env
, SPR_MPC_MI_DBCAM
, "MI_DBCAM",
2614 SPR_NOACCESS
, SPR_NOACCESS
,
2615 &spr_read_generic
, &spr_write_generic
,
2617 /* XXX : not implemented */
2618 spr_register(env
, SPR_MPC_MI_DBRAM0
, "MI_DBRAM0",
2619 SPR_NOACCESS
, SPR_NOACCESS
,
2620 &spr_read_generic
, &spr_write_generic
,
2622 /* XXX : not implemented */
2623 spr_register(env
, SPR_MPC_MI_DBRAM1
, "MI_DBRAM1",
2624 SPR_NOACCESS
, SPR_NOACCESS
,
2625 &spr_read_generic
, &spr_write_generic
,
2627 /* XXX : not implemented */
2628 spr_register(env
, SPR_MPC_MD_CTR
, "MD_CTR",
2629 SPR_NOACCESS
, SPR_NOACCESS
,
2630 &spr_read_generic
, &spr_write_generic
,
2632 /* XXX : not implemented */
2633 spr_register(env
, SPR_MPC_MD_CASID
, "MD_CASID",
2634 SPR_NOACCESS
, SPR_NOACCESS
,
2635 &spr_read_generic
, &spr_write_generic
,
2637 /* XXX : not implemented */
2638 spr_register(env
, SPR_MPC_MD_AP
, "MD_AP",
2639 SPR_NOACCESS
, SPR_NOACCESS
,
2640 &spr_read_generic
, &spr_write_generic
,
2642 /* XXX : not implemented */
2643 spr_register(env
, SPR_MPC_MD_EPN
, "MD_EPN",
2644 SPR_NOACCESS
, SPR_NOACCESS
,
2645 &spr_read_generic
, &spr_write_generic
,
2647 /* XXX : not implemented */
2648 spr_register(env
, SPR_MPC_MD_TWB
, "MD_TWB",
2649 SPR_NOACCESS
, SPR_NOACCESS
,
2650 &spr_read_generic
, &spr_write_generic
,
2652 /* XXX : not implemented */
2653 spr_register(env
, SPR_MPC_MD_TWC
, "MD_TWC",
2654 SPR_NOACCESS
, SPR_NOACCESS
,
2655 &spr_read_generic
, &spr_write_generic
,
2657 /* XXX : not implemented */
2658 spr_register(env
, SPR_MPC_MD_RPN
, "MD_RPN",
2659 SPR_NOACCESS
, SPR_NOACCESS
,
2660 &spr_read_generic
, &spr_write_generic
,
2662 /* XXX : not implemented */
2663 spr_register(env
, SPR_MPC_MD_TW
, "MD_TW",
2664 SPR_NOACCESS
, SPR_NOACCESS
,
2665 &spr_read_generic
, &spr_write_generic
,
2667 /* XXX : not implemented */
2668 spr_register(env
, SPR_MPC_MD_DBCAM
, "MD_DBCAM",
2669 SPR_NOACCESS
, SPR_NOACCESS
,
2670 &spr_read_generic
, &spr_write_generic
,
2672 /* XXX : not implemented */
2673 spr_register(env
, SPR_MPC_MD_DBRAM0
, "MD_DBRAM0",
2674 SPR_NOACCESS
, SPR_NOACCESS
,
2675 &spr_read_generic
, &spr_write_generic
,
2677 /* XXX : not implemented */
2678 spr_register(env
, SPR_MPC_MD_DBRAM1
, "MD_DBRAM1",
2679 SPR_NOACCESS
, SPR_NOACCESS
,
2680 &spr_read_generic
, &spr_write_generic
,
2686 * AMR => SPR 29 (Power 2.04)
2687 * CTRL => SPR 136 (Power 2.04)
2688 * CTRL => SPR 152 (Power 2.04)
2689 * SCOMC => SPR 276 (64 bits ?)
2690 * SCOMD => SPR 277 (64 bits ?)
2691 * TBU40 => SPR 286 (Power 2.04 hypv)
2692 * HSPRG0 => SPR 304 (Power 2.04 hypv)
2693 * HSPRG1 => SPR 305 (Power 2.04 hypv)
2694 * HDSISR => SPR 306 (Power 2.04 hypv)
2695 * HDAR => SPR 307 (Power 2.04 hypv)
2696 * PURR => SPR 309 (Power 2.04 hypv)
2697 * HDEC => SPR 310 (Power 2.04 hypv)
2698 * HIOR => SPR 311 (hypv)
2699 * RMOR => SPR 312 (970)
2700 * HRMOR => SPR 313 (Power 2.04 hypv)
2701 * HSRR0 => SPR 314 (Power 2.04 hypv)
2702 * HSRR1 => SPR 315 (Power 2.04 hypv)
2703 * LPIDR => SPR 317 (970)
2704 * EPR => SPR 702 (Power 2.04 emb)
2705 * perf => 768-783 (Power 2.04)
2706 * perf => 784-799 (Power 2.04)
2707 * PPR => SPR 896 (Power 2.04)
2708 * EPLC => SPR 947 (Power 2.04 emb)
2709 * EPSC => SPR 948 (Power 2.04 emb)
2710 * DABRX => 1015 (Power 2.04 hypv)
2711 * FPECR => SPR 1022 (?)
2712 * ... and more (thermal management, performance counters, ...)
2715 /*****************************************************************************/
2716 /* Exception vectors models */
2717 static void init_excp_4xx_real (CPUPPCState
*env
)
2719 #if !defined(CONFIG_USER_ONLY)
2720 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2721 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2722 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2723 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2724 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2725 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2726 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2727 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2728 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2729 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2730 env
->ivor_mask
= 0x0000FFF0UL
;
2731 env
->ivpr_mask
= 0xFFFF0000UL
;
2732 /* Hardware reset vector */
2733 env
->hreset_vector
= 0xFFFFFFFCUL
;
2737 static void init_excp_4xx_softmmu (CPUPPCState
*env
)
2739 #if !defined(CONFIG_USER_ONLY)
2740 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2741 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2742 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2743 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2744 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2745 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2746 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2747 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2748 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2749 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2750 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2751 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001100;
2752 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001200;
2753 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2754 env
->ivor_mask
= 0x0000FFF0UL
;
2755 env
->ivpr_mask
= 0xFFFF0000UL
;
2756 /* Hardware reset vector */
2757 env
->hreset_vector
= 0xFFFFFFFCUL
;
2761 static void init_excp_MPC5xx (CPUPPCState
*env
)
2763 #if !defined(CONFIG_USER_ONLY)
2764 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2765 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2766 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2767 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2768 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2769 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2770 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2771 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2772 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2773 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2774 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2775 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2776 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2777 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2778 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2779 env
->ivor_mask
= 0x0000FFF0UL
;
2780 env
->ivpr_mask
= 0xFFFF0000UL
;
2781 /* Hardware reset vector */
2782 env
->hreset_vector
= 0x00000100UL
;
2786 static void init_excp_MPC8xx (CPUPPCState
*env
)
2788 #if !defined(CONFIG_USER_ONLY)
2789 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2790 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2791 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2792 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2793 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2794 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2795 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2796 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2797 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2798 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2799 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2800 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2801 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2802 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001100;
2803 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001200;
2804 env
->excp_vectors
[POWERPC_EXCP_ITLBE
] = 0x00001300;
2805 env
->excp_vectors
[POWERPC_EXCP_DTLBE
] = 0x00001400;
2806 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2807 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2808 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2809 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2810 env
->ivor_mask
= 0x0000FFF0UL
;
2811 env
->ivpr_mask
= 0xFFFF0000UL
;
2812 /* Hardware reset vector */
2813 env
->hreset_vector
= 0x00000100UL
;
2817 static void init_excp_G2 (CPUPPCState
*env
)
2819 #if !defined(CONFIG_USER_ONLY)
2820 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2821 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2822 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2823 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2824 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2825 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2826 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2827 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2828 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2829 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000A00;
2830 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2831 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2832 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2833 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2834 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2835 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2836 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2837 /* Hardware reset vector */
2838 env
->hreset_vector
= 0x00000100UL
;
2842 static void init_excp_e200(CPUPPCState
*env
, target_ulong ivpr_mask
)
2844 #if !defined(CONFIG_USER_ONLY)
2845 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000FFC;
2846 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2847 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2848 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2849 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2850 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2851 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2852 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2853 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2854 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2855 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2856 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2857 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2858 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2859 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2860 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2861 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2862 env
->excp_vectors
[POWERPC_EXCP_SPEU
] = 0x00000000;
2863 env
->excp_vectors
[POWERPC_EXCP_EFPDI
] = 0x00000000;
2864 env
->excp_vectors
[POWERPC_EXCP_EFPRI
] = 0x00000000;
2865 env
->ivor_mask
= 0x0000FFF7UL
;
2866 env
->ivpr_mask
= ivpr_mask
;
2867 /* Hardware reset vector */
2868 env
->hreset_vector
= 0xFFFFFFFCUL
;
2872 static void init_excp_BookE (CPUPPCState
*env
)
2874 #if !defined(CONFIG_USER_ONLY)
2875 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2876 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2877 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2878 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2879 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2880 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2881 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2882 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2883 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2884 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2885 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2886 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2887 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2888 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2889 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2890 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2891 env
->ivor_mask
= 0x0000FFF0UL
;
2892 env
->ivpr_mask
= 0xFFFF0000UL
;
2893 /* Hardware reset vector */
2894 env
->hreset_vector
= 0xFFFFFFFCUL
;
2898 static void init_excp_601 (CPUPPCState
*env
)
2900 #if !defined(CONFIG_USER_ONLY)
2901 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2902 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2903 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2904 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2905 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2906 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2907 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2908 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2909 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2910 env
->excp_vectors
[POWERPC_EXCP_IO
] = 0x00000A00;
2911 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2912 env
->excp_vectors
[POWERPC_EXCP_RUNM
] = 0x00002000;
2913 /* Hardware reset vector */
2914 env
->hreset_vector
= 0x00000100UL
;
2918 static void init_excp_602 (CPUPPCState
*env
)
2920 #if !defined(CONFIG_USER_ONLY)
2921 /* XXX: exception prefix has a special behavior on 602 */
2922 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2923 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2924 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2925 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2926 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2927 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2928 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2929 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2930 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2931 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2932 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2933 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2934 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2935 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2936 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2937 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2938 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001500;
2939 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001600;
2940 /* Hardware reset vector */
2941 env
->hreset_vector
= 0x00000100UL
;
2945 static void init_excp_603 (CPUPPCState
*env
)
2947 #if !defined(CONFIG_USER_ONLY)
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 /* Hardware reset vector */
2965 env
->hreset_vector
= 0x00000100UL
;
2969 static void init_excp_604 (CPUPPCState
*env
)
2971 #if !defined(CONFIG_USER_ONLY)
2972 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2973 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2974 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2975 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2976 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2977 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2978 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2979 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2980 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2981 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2982 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2983 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2984 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2985 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2986 /* Hardware reset vector */
2987 env
->hreset_vector
= 0x00000100UL
;
2991 static void init_excp_7x0 (CPUPPCState
*env
)
2993 #if !defined(CONFIG_USER_ONLY)
2994 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2995 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2996 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2997 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2998 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2999 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3000 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3001 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3002 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3003 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3004 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3005 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3006 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3007 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3008 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3009 /* Hardware reset vector */
3010 env
->hreset_vector
= 0x00000100UL
;
3014 static void init_excp_750cl (CPUPPCState
*env
)
3016 #if !defined(CONFIG_USER_ONLY)
3017 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3018 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3019 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3020 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3021 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3022 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3023 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3024 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3025 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3026 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3027 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3028 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3029 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3030 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3031 /* Hardware reset vector */
3032 env
->hreset_vector
= 0x00000100UL
;
3036 static void init_excp_750cx (CPUPPCState
*env
)
3038 #if !defined(CONFIG_USER_ONLY)
3039 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3040 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3041 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3042 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3043 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3044 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3045 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3046 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3047 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3048 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3049 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3050 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3051 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3052 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3053 /* Hardware reset vector */
3054 env
->hreset_vector
= 0x00000100UL
;
3058 /* XXX: Check if this is correct */
3059 static void init_excp_7x5 (CPUPPCState
*env
)
3061 #if !defined(CONFIG_USER_ONLY)
3062 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3063 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3064 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3065 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3066 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3067 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3068 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3069 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3070 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3071 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3072 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3073 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3074 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3075 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3076 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3077 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3078 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3079 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3080 /* Hardware reset vector */
3081 env
->hreset_vector
= 0x00000100UL
;
3085 static void init_excp_7400 (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_VPU
] = 0x00000F20;
3101 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3102 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3103 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3104 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3105 /* Hardware reset vector */
3106 env
->hreset_vector
= 0x00000100UL
;
3110 static void init_excp_7450 (CPUPPCState
*env
)
3112 #if !defined(CONFIG_USER_ONLY)
3113 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3114 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3115 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3116 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3117 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3118 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3119 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3120 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3121 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3122 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3123 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3124 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3125 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3126 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3127 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3128 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3129 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3130 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3131 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3132 /* Hardware reset vector */
3133 env
->hreset_vector
= 0x00000100UL
;
3137 #if defined (TARGET_PPC64)
3138 static void init_excp_970 (CPUPPCState
*env
)
3140 #if !defined(CONFIG_USER_ONLY)
3141 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3142 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3143 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3144 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3145 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3146 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3147 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3148 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3149 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3150 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3151 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3152 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3153 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3154 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3155 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3156 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3157 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3158 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
3159 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
3160 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
3161 /* Hardware reset vector */
3162 env
->hreset_vector
= 0x0000000000000100ULL
;
3166 static void init_excp_POWER7 (CPUPPCState
*env
)
3168 #if !defined(CONFIG_USER_ONLY)
3169 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3170 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3171 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3172 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3173 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3174 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3175 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3176 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3177 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3178 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3179 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3180 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3181 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3182 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3183 env
->excp_vectors
[POWERPC_EXCP_HDSI
] = 0x00000E00;
3184 env
->excp_vectors
[POWERPC_EXCP_HISI
] = 0x00000E20;
3185 env
->excp_vectors
[POWERPC_EXCP_HV_EMU
] = 0x00000E40;
3186 env
->excp_vectors
[POWERPC_EXCP_HV_MAINT
] = 0x00000E60;
3187 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3188 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3189 env
->excp_vectors
[POWERPC_EXCP_VSXU
] = 0x00000F40;
3190 /* Hardware reset vector */
3191 env
->hreset_vector
= 0x0000000000000100ULL
;
3195 static void init_excp_POWER8(CPUPPCState
*env
)
3197 init_excp_POWER7(env
);
3199 #if !defined(CONFIG_USER_ONLY)
3200 env
->excp_vectors
[POWERPC_EXCP_SDOOR
] = 0x00000A00;
3201 env
->excp_vectors
[POWERPC_EXCP_FU
] = 0x00000F60;
3202 env
->excp_vectors
[POWERPC_EXCP_HV_FU
] = 0x00000F80;
3203 env
->excp_vectors
[POWERPC_EXCP_SDOOR_HV
] = 0x00000E80;
3209 /*****************************************************************************/
3210 /* Power management enable checks */
3211 static int check_pow_none (CPUPPCState
*env
)
3216 static int check_pow_nocheck (CPUPPCState
*env
)
3221 static int check_pow_hid0 (CPUPPCState
*env
)
3223 if (env
->spr
[SPR_HID0
] & 0x00E00000)
3229 static int check_pow_hid0_74xx (CPUPPCState
*env
)
3231 if (env
->spr
[SPR_HID0
] & 0x00600000)
3237 static bool ppc_cpu_interrupts_big_endian_always(PowerPCCPU
*cpu
)
3243 static bool ppc_cpu_interrupts_big_endian_lpcr(PowerPCCPU
*cpu
)
3245 return !(cpu
->env
.spr
[SPR_LPCR
] & LPCR_ILE
);
3249 /*****************************************************************************/
3250 /* PowerPC implementations definitions */
3252 #define POWERPC_FAMILY(_name) \
3254 glue(glue(ppc_, _name), _cpu_family_class_init)(ObjectClass *, void *); \
3256 static const TypeInfo \
3257 glue(glue(ppc_, _name), _cpu_family_type_info) = { \
3258 .name = stringify(_name) "-family-" TYPE_POWERPC_CPU, \
3259 .parent = TYPE_POWERPC_CPU, \
3261 .class_init = glue(glue(ppc_, _name), _cpu_family_class_init), \
3264 static void glue(glue(ppc_, _name), _cpu_family_register_types)(void) \
3266 type_register_static( \
3267 &glue(glue(ppc_, _name), _cpu_family_type_info)); \
3270 type_init(glue(glue(ppc_, _name), _cpu_family_register_types)) \
3272 static void glue(glue(ppc_, _name), _cpu_family_class_init)
3274 static void init_proc_401 (CPUPPCState
*env
)
3277 gen_spr_401_403(env
);
3279 init_excp_4xx_real(env
);
3280 env
->dcache_line_size
= 32;
3281 env
->icache_line_size
= 32;
3282 /* Allocate hardware IRQ controller */
3283 ppc40x_irq_init(ppc_env_get_cpu(env
));
3285 SET_FIT_PERIOD(12, 16, 20, 24);
3286 SET_WDT_PERIOD(16, 20, 24, 28);
3289 POWERPC_FAMILY(401)(ObjectClass
*oc
, void *data
)
3291 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3292 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3294 dc
->desc
= "PowerPC 401";
3295 pcc
->init_proc
= init_proc_401
;
3296 pcc
->check_pow
= check_pow_nocheck
;
3297 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3298 PPC_WRTEE
| PPC_DCR
|
3299 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3301 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3302 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3303 pcc
->msr_mask
= (1ull << MSR_KEY
) |
3312 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3313 pcc
->excp_model
= POWERPC_EXCP_40x
;
3314 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3315 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3316 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3317 POWERPC_FLAG_BUS_CLK
;
3320 static void init_proc_401x2 (CPUPPCState
*env
)
3323 gen_spr_401_403(env
);
3325 gen_spr_compress(env
);
3326 /* Memory management */
3327 #if !defined(CONFIG_USER_ONLY)
3331 env
->tlb_type
= TLB_EMB
;
3333 init_excp_4xx_softmmu(env
);
3334 env
->dcache_line_size
= 32;
3335 env
->icache_line_size
= 32;
3336 /* Allocate hardware IRQ controller */
3337 ppc40x_irq_init(ppc_env_get_cpu(env
));
3339 SET_FIT_PERIOD(12, 16, 20, 24);
3340 SET_WDT_PERIOD(16, 20, 24, 28);
3343 POWERPC_FAMILY(401x2
)(ObjectClass
*oc
, void *data
)
3345 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3346 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3348 dc
->desc
= "PowerPC 401x2";
3349 pcc
->init_proc
= init_proc_401x2
;
3350 pcc
->check_pow
= check_pow_nocheck
;
3351 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3352 PPC_DCR
| PPC_WRTEE
|
3353 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3354 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3355 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3356 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3357 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3358 pcc
->msr_mask
= (1ull << 20) |
3370 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3371 pcc
->excp_model
= POWERPC_EXCP_40x
;
3372 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3373 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3374 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3375 POWERPC_FLAG_BUS_CLK
;
3378 static void init_proc_401x3 (CPUPPCState
*env
)
3381 gen_spr_401_403(env
);
3384 gen_spr_compress(env
);
3385 init_excp_4xx_softmmu(env
);
3386 env
->dcache_line_size
= 32;
3387 env
->icache_line_size
= 32;
3388 /* Allocate hardware IRQ controller */
3389 ppc40x_irq_init(ppc_env_get_cpu(env
));
3391 SET_FIT_PERIOD(12, 16, 20, 24);
3392 SET_WDT_PERIOD(16, 20, 24, 28);
3395 POWERPC_FAMILY(401x3
)(ObjectClass
*oc
, void *data
)
3397 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3398 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3400 dc
->desc
= "PowerPC 401x3";
3401 pcc
->init_proc
= init_proc_401x3
;
3402 pcc
->check_pow
= check_pow_nocheck
;
3403 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3404 PPC_DCR
| PPC_WRTEE
|
3405 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3406 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3407 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3408 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3409 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3410 pcc
->msr_mask
= (1ull << 20) |
3423 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3424 pcc
->excp_model
= POWERPC_EXCP_40x
;
3425 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3426 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3427 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3428 POWERPC_FLAG_BUS_CLK
;
3431 static void init_proc_IOP480 (CPUPPCState
*env
)
3434 gen_spr_401_403(env
);
3436 gen_spr_compress(env
);
3437 /* Memory management */
3438 #if !defined(CONFIG_USER_ONLY)
3442 env
->tlb_type
= TLB_EMB
;
3444 init_excp_4xx_softmmu(env
);
3445 env
->dcache_line_size
= 32;
3446 env
->icache_line_size
= 32;
3447 /* Allocate hardware IRQ controller */
3448 ppc40x_irq_init(ppc_env_get_cpu(env
));
3450 SET_FIT_PERIOD(8, 12, 16, 20);
3451 SET_WDT_PERIOD(16, 20, 24, 28);
3454 POWERPC_FAMILY(IOP480
)(ObjectClass
*oc
, void *data
)
3456 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3457 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3459 dc
->desc
= "IOP480";
3460 pcc
->init_proc
= init_proc_IOP480
;
3461 pcc
->check_pow
= check_pow_nocheck
;
3462 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3463 PPC_DCR
| PPC_WRTEE
|
3464 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3465 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3466 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3467 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3468 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3469 pcc
->msr_mask
= (1ull << 20) |
3481 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3482 pcc
->excp_model
= POWERPC_EXCP_40x
;
3483 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3484 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3485 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3486 POWERPC_FLAG_BUS_CLK
;
3489 static void init_proc_403 (CPUPPCState
*env
)
3492 gen_spr_401_403(env
);
3494 gen_spr_403_real(env
);
3495 init_excp_4xx_real(env
);
3496 env
->dcache_line_size
= 32;
3497 env
->icache_line_size
= 32;
3498 /* Allocate hardware IRQ controller */
3499 ppc40x_irq_init(ppc_env_get_cpu(env
));
3501 SET_FIT_PERIOD(8, 12, 16, 20);
3502 SET_WDT_PERIOD(16, 20, 24, 28);
3505 POWERPC_FAMILY(403)(ObjectClass
*oc
, void *data
)
3507 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3508 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3510 dc
->desc
= "PowerPC 403";
3511 pcc
->init_proc
= init_proc_403
;
3512 pcc
->check_pow
= check_pow_nocheck
;
3513 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3514 PPC_DCR
| PPC_WRTEE
|
3515 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3517 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3518 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3519 pcc
->msr_mask
= (1ull << MSR_POW
) |
3528 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3529 pcc
->excp_model
= POWERPC_EXCP_40x
;
3530 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3531 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3532 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3533 POWERPC_FLAG_BUS_CLK
;
3536 static void init_proc_403GCX (CPUPPCState
*env
)
3539 gen_spr_401_403(env
);
3541 gen_spr_403_real(env
);
3542 gen_spr_403_mmu(env
);
3543 /* Bus access control */
3544 /* not emulated, as QEMU never does speculative access */
3545 spr_register(env
, SPR_40x_SGR
, "SGR",
3546 SPR_NOACCESS
, SPR_NOACCESS
,
3547 &spr_read_generic
, &spr_write_generic
,
3549 /* not emulated, as QEMU do not emulate caches */
3550 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3551 SPR_NOACCESS
, SPR_NOACCESS
,
3552 &spr_read_generic
, &spr_write_generic
,
3554 /* Memory management */
3555 #if !defined(CONFIG_USER_ONLY)
3559 env
->tlb_type
= TLB_EMB
;
3561 init_excp_4xx_softmmu(env
);
3562 env
->dcache_line_size
= 32;
3563 env
->icache_line_size
= 32;
3564 /* Allocate hardware IRQ controller */
3565 ppc40x_irq_init(ppc_env_get_cpu(env
));
3567 SET_FIT_PERIOD(8, 12, 16, 20);
3568 SET_WDT_PERIOD(16, 20, 24, 28);
3571 POWERPC_FAMILY(403GCX
)(ObjectClass
*oc
, void *data
)
3573 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3574 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3576 dc
->desc
= "PowerPC 403 GCX";
3577 pcc
->init_proc
= init_proc_403GCX
;
3578 pcc
->check_pow
= check_pow_nocheck
;
3579 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3580 PPC_DCR
| PPC_WRTEE
|
3581 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3583 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3584 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3585 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3586 pcc
->msr_mask
= (1ull << MSR_POW
) |
3595 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3596 pcc
->excp_model
= POWERPC_EXCP_40x
;
3597 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3598 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3599 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3600 POWERPC_FLAG_BUS_CLK
;
3603 static void init_proc_405 (CPUPPCState
*env
)
3609 /* Bus access control */
3610 /* not emulated, as QEMU never does speculative access */
3611 spr_register(env
, SPR_40x_SGR
, "SGR",
3612 SPR_NOACCESS
, SPR_NOACCESS
,
3613 &spr_read_generic
, &spr_write_generic
,
3615 /* not emulated, as QEMU do not emulate caches */
3616 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3617 SPR_NOACCESS
, SPR_NOACCESS
,
3618 &spr_read_generic
, &spr_write_generic
,
3620 /* Memory management */
3621 #if !defined(CONFIG_USER_ONLY)
3625 env
->tlb_type
= TLB_EMB
;
3627 init_excp_4xx_softmmu(env
);
3628 env
->dcache_line_size
= 32;
3629 env
->icache_line_size
= 32;
3630 /* Allocate hardware IRQ controller */
3631 ppc40x_irq_init(ppc_env_get_cpu(env
));
3633 SET_FIT_PERIOD(8, 12, 16, 20);
3634 SET_WDT_PERIOD(16, 20, 24, 28);
3637 POWERPC_FAMILY(405)(ObjectClass
*oc
, void *data
)
3639 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3640 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3642 dc
->desc
= "PowerPC 405";
3643 pcc
->init_proc
= init_proc_405
;
3644 pcc
->check_pow
= check_pow_nocheck
;
3645 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3646 PPC_DCR
| PPC_WRTEE
|
3647 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3648 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3649 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3650 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3651 PPC_4xx_COMMON
| PPC_405_MAC
| PPC_40x_EXCP
;
3652 pcc
->msr_mask
= (1ull << MSR_POW
) |
3661 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx
;
3662 pcc
->excp_model
= POWERPC_EXCP_40x
;
3663 pcc
->bus_model
= PPC_FLAGS_INPUT_405
;
3664 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3665 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3666 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3669 static void init_proc_440EP (CPUPPCState
*env
)
3673 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3675 gen_spr_usprgh(env
);
3676 /* Processor identification */
3677 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3678 SPR_NOACCESS
, SPR_NOACCESS
,
3679 &spr_read_generic
, &spr_write_pir
,
3681 /* XXX : not implemented */
3682 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3683 SPR_NOACCESS
, SPR_NOACCESS
,
3684 &spr_read_generic
, &spr_write_generic
,
3686 /* XXX : not implemented */
3687 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3688 SPR_NOACCESS
, SPR_NOACCESS
,
3689 &spr_read_generic
, &spr_write_generic
,
3691 /* XXX : not implemented */
3692 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3693 SPR_NOACCESS
, SPR_NOACCESS
,
3694 &spr_read_generic
, &spr_write_generic
,
3696 /* XXX : not implemented */
3697 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3698 SPR_NOACCESS
, SPR_NOACCESS
,
3699 &spr_read_generic
, &spr_write_generic
,
3701 /* XXX : not implemented */
3702 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3703 SPR_NOACCESS
, SPR_NOACCESS
,
3704 &spr_read_generic
, &spr_write_generic
,
3706 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3707 SPR_NOACCESS
, SPR_NOACCESS
,
3708 &spr_read_generic
, &spr_write_generic
,
3710 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3711 SPR_NOACCESS
, SPR_NOACCESS
,
3712 &spr_read_generic
, &spr_write_generic
,
3714 /* XXX : not implemented */
3715 spr_register(env
, SPR_440_CCR1
, "CCR1",
3716 SPR_NOACCESS
, SPR_NOACCESS
,
3717 &spr_read_generic
, &spr_write_generic
,
3719 /* Memory management */
3720 #if !defined(CONFIG_USER_ONLY)
3724 env
->tlb_type
= TLB_EMB
;
3726 init_excp_BookE(env
);
3727 env
->dcache_line_size
= 32;
3728 env
->icache_line_size
= 32;
3729 ppc40x_irq_init(ppc_env_get_cpu(env
));
3731 SET_FIT_PERIOD(12, 16, 20, 24);
3732 SET_WDT_PERIOD(20, 24, 28, 32);
3735 POWERPC_FAMILY(440EP
)(ObjectClass
*oc
, void *data
)
3737 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3738 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3740 dc
->desc
= "PowerPC 440 EP";
3741 pcc
->init_proc
= init_proc_440EP
;
3742 pcc
->check_pow
= check_pow_nocheck
;
3743 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3744 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
3745 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
3747 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
3748 PPC_CACHE
| PPC_CACHE_ICBI
|
3749 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3750 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3751 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3753 pcc
->msr_mask
= (1ull << MSR_POW
) |
3765 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3766 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3767 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3768 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3769 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3770 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3773 static void init_proc_440GP (CPUPPCState
*env
)
3777 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3779 gen_spr_usprgh(env
);
3780 /* Processor identification */
3781 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3782 SPR_NOACCESS
, SPR_NOACCESS
,
3783 &spr_read_generic
, &spr_write_pir
,
3785 /* XXX : not implemented */
3786 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3787 SPR_NOACCESS
, SPR_NOACCESS
,
3788 &spr_read_generic
, &spr_write_generic
,
3790 /* XXX : not implemented */
3791 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3792 SPR_NOACCESS
, SPR_NOACCESS
,
3793 &spr_read_generic
, &spr_write_generic
,
3795 /* XXX : not implemented */
3796 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3797 SPR_NOACCESS
, SPR_NOACCESS
,
3798 &spr_read_generic
, &spr_write_generic
,
3800 /* XXX : not implemented */
3801 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3802 SPR_NOACCESS
, SPR_NOACCESS
,
3803 &spr_read_generic
, &spr_write_generic
,
3805 /* Memory management */
3806 #if !defined(CONFIG_USER_ONLY)
3810 env
->tlb_type
= TLB_EMB
;
3812 init_excp_BookE(env
);
3813 env
->dcache_line_size
= 32;
3814 env
->icache_line_size
= 32;
3815 /* XXX: TODO: allocate internal IRQ controller */
3817 SET_FIT_PERIOD(12, 16, 20, 24);
3818 SET_WDT_PERIOD(20, 24, 28, 32);
3821 POWERPC_FAMILY(440GP
)(ObjectClass
*oc
, void *data
)
3823 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3824 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3826 dc
->desc
= "PowerPC 440 GP";
3827 pcc
->init_proc
= init_proc_440GP
;
3828 pcc
->check_pow
= check_pow_nocheck
;
3829 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3830 PPC_DCR
| PPC_DCRX
| PPC_WRTEE
| PPC_MFAPIDI
|
3831 PPC_CACHE
| PPC_CACHE_ICBI
|
3832 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3833 PPC_MEM_TLBSYNC
| PPC_TLBIVA
| PPC_MFTB
|
3834 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3836 pcc
->msr_mask
= (1ull << MSR_POW
) |
3848 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3849 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3850 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3851 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3852 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3853 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3856 static void init_proc_440x4 (CPUPPCState
*env
)
3860 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3862 gen_spr_usprgh(env
);
3863 /* Processor identification */
3864 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3865 SPR_NOACCESS
, SPR_NOACCESS
,
3866 &spr_read_generic
, &spr_write_pir
,
3868 /* XXX : not implemented */
3869 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3870 SPR_NOACCESS
, SPR_NOACCESS
,
3871 &spr_read_generic
, &spr_write_generic
,
3873 /* XXX : not implemented */
3874 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3875 SPR_NOACCESS
, SPR_NOACCESS
,
3876 &spr_read_generic
, &spr_write_generic
,
3878 /* XXX : not implemented */
3879 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3880 SPR_NOACCESS
, SPR_NOACCESS
,
3881 &spr_read_generic
, &spr_write_generic
,
3883 /* XXX : not implemented */
3884 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3885 SPR_NOACCESS
, SPR_NOACCESS
,
3886 &spr_read_generic
, &spr_write_generic
,
3888 /* Memory management */
3889 #if !defined(CONFIG_USER_ONLY)
3893 env
->tlb_type
= TLB_EMB
;
3895 init_excp_BookE(env
);
3896 env
->dcache_line_size
= 32;
3897 env
->icache_line_size
= 32;
3898 /* XXX: TODO: allocate internal IRQ controller */
3900 SET_FIT_PERIOD(12, 16, 20, 24);
3901 SET_WDT_PERIOD(20, 24, 28, 32);
3904 POWERPC_FAMILY(440x4
)(ObjectClass
*oc
, void *data
)
3906 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3907 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3909 dc
->desc
= "PowerPC 440x4";
3910 pcc
->init_proc
= init_proc_440x4
;
3911 pcc
->check_pow
= check_pow_nocheck
;
3912 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3913 PPC_DCR
| PPC_WRTEE
|
3914 PPC_CACHE
| PPC_CACHE_ICBI
|
3915 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3916 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3917 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3919 pcc
->msr_mask
= (1ull << MSR_POW
) |
3931 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3932 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3933 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3934 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3935 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3936 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3939 static void init_proc_440x5 (CPUPPCState
*env
)
3943 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3945 gen_spr_usprgh(env
);
3946 /* Processor identification */
3947 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3948 SPR_NOACCESS
, SPR_NOACCESS
,
3949 &spr_read_generic
, &spr_write_pir
,
3951 /* XXX : not implemented */
3952 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3953 SPR_NOACCESS
, SPR_NOACCESS
,
3954 &spr_read_generic
, &spr_write_generic
,
3956 /* XXX : not implemented */
3957 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3958 SPR_NOACCESS
, SPR_NOACCESS
,
3959 &spr_read_generic
, &spr_write_generic
,
3961 /* XXX : not implemented */
3962 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3963 SPR_NOACCESS
, SPR_NOACCESS
,
3964 &spr_read_generic
, &spr_write_generic
,
3966 /* XXX : not implemented */
3967 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3968 SPR_NOACCESS
, SPR_NOACCESS
,
3969 &spr_read_generic
, &spr_write_generic
,
3971 /* XXX : not implemented */
3972 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3973 SPR_NOACCESS
, SPR_NOACCESS
,
3974 &spr_read_generic
, &spr_write_generic
,
3976 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3977 SPR_NOACCESS
, SPR_NOACCESS
,
3978 &spr_read_generic
, &spr_write_generic
,
3980 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3981 SPR_NOACCESS
, SPR_NOACCESS
,
3982 &spr_read_generic
, &spr_write_generic
,
3984 /* XXX : not implemented */
3985 spr_register(env
, SPR_440_CCR1
, "CCR1",
3986 SPR_NOACCESS
, SPR_NOACCESS
,
3987 &spr_read_generic
, &spr_write_generic
,
3989 /* Memory management */
3990 #if !defined(CONFIG_USER_ONLY)
3994 env
->tlb_type
= TLB_EMB
;
3996 init_excp_BookE(env
);
3997 env
->dcache_line_size
= 32;
3998 env
->icache_line_size
= 32;
3999 ppc40x_irq_init(ppc_env_get_cpu(env
));
4001 SET_FIT_PERIOD(12, 16, 20, 24);
4002 SET_WDT_PERIOD(20, 24, 28, 32);
4005 POWERPC_FAMILY(440x5
)(ObjectClass
*oc
, void *data
)
4007 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4008 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4010 dc
->desc
= "PowerPC 440x5";
4011 pcc
->init_proc
= init_proc_440x5
;
4012 pcc
->check_pow
= check_pow_nocheck
;
4013 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4014 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
4015 PPC_CACHE
| PPC_CACHE_ICBI
|
4016 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4017 PPC_MEM_TLBSYNC
| PPC_MFTB
|
4018 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4020 pcc
->msr_mask
= (1ull << MSR_POW
) |
4032 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4033 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4034 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4035 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4036 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4037 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4040 POWERPC_FAMILY(440x5wDFPU
)(ObjectClass
*oc
, void *data
)
4042 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4043 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4045 dc
->desc
= "PowerPC 440x5 with double precision FPU";
4046 pcc
->init_proc
= init_proc_440x5
;
4047 pcc
->check_pow
= check_pow_nocheck
;
4048 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4049 PPC_FLOAT
| PPC_FLOAT_FSQRT
|
4051 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
4052 PPC_CACHE
| PPC_CACHE_ICBI
|
4053 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4054 PPC_MEM_TLBSYNC
| PPC_MFTB
|
4055 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4057 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
4058 pcc
->msr_mask
= (1ull << MSR_POW
) |
4070 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4071 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4072 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4073 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4074 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4075 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4078 static void init_proc_460 (CPUPPCState
*env
)
4082 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4084 gen_spr_usprgh(env
);
4085 /* Processor identification */
4086 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4087 SPR_NOACCESS
, SPR_NOACCESS
,
4088 &spr_read_generic
, &spr_write_pir
,
4090 /* XXX : not implemented */
4091 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4092 SPR_NOACCESS
, SPR_NOACCESS
,
4093 &spr_read_generic
, &spr_write_generic
,
4095 /* XXX : not implemented */
4096 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4097 SPR_NOACCESS
, SPR_NOACCESS
,
4098 &spr_read_generic
, &spr_write_generic
,
4100 /* XXX : not implemented */
4101 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4102 SPR_NOACCESS
, SPR_NOACCESS
,
4103 &spr_read_generic
, &spr_write_generic
,
4105 /* XXX : not implemented */
4106 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4107 SPR_NOACCESS
, SPR_NOACCESS
,
4108 &spr_read_generic
, &spr_write_generic
,
4110 /* XXX : not implemented */
4111 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4112 SPR_NOACCESS
, SPR_NOACCESS
,
4113 &spr_read_generic
, &spr_write_generic
,
4115 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4116 SPR_NOACCESS
, SPR_NOACCESS
,
4117 &spr_read_generic
, &spr_write_generic
,
4119 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4120 SPR_NOACCESS
, SPR_NOACCESS
,
4121 &spr_read_generic
, &spr_write_generic
,
4123 /* XXX : not implemented */
4124 spr_register(env
, SPR_440_CCR1
, "CCR1",
4125 SPR_NOACCESS
, SPR_NOACCESS
,
4126 &spr_read_generic
, &spr_write_generic
,
4128 /* XXX : not implemented */
4129 spr_register(env
, SPR_DCRIPR
, "SPR_DCRIPR",
4130 &spr_read_generic
, &spr_write_generic
,
4131 &spr_read_generic
, &spr_write_generic
,
4133 /* Memory management */
4134 #if !defined(CONFIG_USER_ONLY)
4138 env
->tlb_type
= TLB_EMB
;
4140 init_excp_BookE(env
);
4141 env
->dcache_line_size
= 32;
4142 env
->icache_line_size
= 32;
4143 /* XXX: TODO: allocate internal IRQ controller */
4145 SET_FIT_PERIOD(12, 16, 20, 24);
4146 SET_WDT_PERIOD(20, 24, 28, 32);
4149 POWERPC_FAMILY(460)(ObjectClass
*oc
, void *data
)
4151 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4152 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4154 dc
->desc
= "PowerPC 460 (guessed)";
4155 pcc
->init_proc
= init_proc_460
;
4156 pcc
->check_pow
= check_pow_nocheck
;
4157 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4158 PPC_DCR
| PPC_DCRX
| PPC_DCRUX
|
4159 PPC_WRTEE
| PPC_MFAPIDI
| PPC_MFTB
|
4160 PPC_CACHE
| PPC_CACHE_ICBI
|
4161 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4162 PPC_MEM_TLBSYNC
| PPC_TLBIVA
|
4163 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4165 pcc
->msr_mask
= (1ull << MSR_POW
) |
4177 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4178 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4179 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4180 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4181 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4182 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4185 static void init_proc_460F (CPUPPCState
*env
)
4189 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4191 gen_spr_usprgh(env
);
4192 /* Processor identification */
4193 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4194 SPR_NOACCESS
, SPR_NOACCESS
,
4195 &spr_read_generic
, &spr_write_pir
,
4197 /* XXX : not implemented */
4198 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4199 SPR_NOACCESS
, SPR_NOACCESS
,
4200 &spr_read_generic
, &spr_write_generic
,
4202 /* XXX : not implemented */
4203 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4204 SPR_NOACCESS
, SPR_NOACCESS
,
4205 &spr_read_generic
, &spr_write_generic
,
4207 /* XXX : not implemented */
4208 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4209 SPR_NOACCESS
, SPR_NOACCESS
,
4210 &spr_read_generic
, &spr_write_generic
,
4212 /* XXX : not implemented */
4213 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4214 SPR_NOACCESS
, SPR_NOACCESS
,
4215 &spr_read_generic
, &spr_write_generic
,
4217 /* XXX : not implemented */
4218 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4219 SPR_NOACCESS
, SPR_NOACCESS
,
4220 &spr_read_generic
, &spr_write_generic
,
4222 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4223 SPR_NOACCESS
, SPR_NOACCESS
,
4224 &spr_read_generic
, &spr_write_generic
,
4226 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4227 SPR_NOACCESS
, SPR_NOACCESS
,
4228 &spr_read_generic
, &spr_write_generic
,
4230 /* XXX : not implemented */
4231 spr_register(env
, SPR_440_CCR1
, "CCR1",
4232 SPR_NOACCESS
, SPR_NOACCESS
,
4233 &spr_read_generic
, &spr_write_generic
,
4235 /* XXX : not implemented */
4236 spr_register(env
, SPR_DCRIPR
, "SPR_DCRIPR",
4237 &spr_read_generic
, &spr_write_generic
,
4238 &spr_read_generic
, &spr_write_generic
,
4240 /* Memory management */
4241 #if !defined(CONFIG_USER_ONLY)
4245 env
->tlb_type
= TLB_EMB
;
4247 init_excp_BookE(env
);
4248 env
->dcache_line_size
= 32;
4249 env
->icache_line_size
= 32;
4250 /* XXX: TODO: allocate internal IRQ controller */
4252 SET_FIT_PERIOD(12, 16, 20, 24);
4253 SET_WDT_PERIOD(20, 24, 28, 32);
4256 POWERPC_FAMILY(460F
)(ObjectClass
*oc
, void *data
)
4258 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4259 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4261 dc
->desc
= "PowerPC 460F (guessed)";
4262 pcc
->init_proc
= init_proc_460F
;
4263 pcc
->check_pow
= check_pow_nocheck
;
4264 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4265 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
4266 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
4267 PPC_FLOAT_STFIWX
| PPC_MFTB
|
4268 PPC_DCR
| PPC_DCRX
| PPC_DCRUX
|
4269 PPC_WRTEE
| PPC_MFAPIDI
|
4270 PPC_CACHE
| PPC_CACHE_ICBI
|
4271 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4272 PPC_MEM_TLBSYNC
| PPC_TLBIVA
|
4273 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4275 pcc
->msr_mask
= (1ull << MSR_POW
) |
4287 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4288 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4289 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4290 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4291 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4292 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4295 static void init_proc_MPC5xx (CPUPPCState
*env
)
4299 gen_spr_5xx_8xx(env
);
4301 init_excp_MPC5xx(env
);
4302 env
->dcache_line_size
= 32;
4303 env
->icache_line_size
= 32;
4304 /* XXX: TODO: allocate internal IRQ controller */
4307 POWERPC_FAMILY(MPC5xx
)(ObjectClass
*oc
, void *data
)
4309 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4310 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4312 dc
->desc
= "Freescale 5xx cores (aka RCPU)";
4313 pcc
->init_proc
= init_proc_MPC5xx
;
4314 pcc
->check_pow
= check_pow_none
;
4315 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4316 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4317 PPC_CACHE_ICBI
| PPC_FLOAT
| PPC_FLOAT_STFIWX
|
4319 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4331 pcc
->mmu_model
= POWERPC_MMU_REAL
;
4332 pcc
->excp_model
= POWERPC_EXCP_603
;
4333 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4334 pcc
->bfd_mach
= bfd_mach_ppc_505
;
4335 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4336 POWERPC_FLAG_BUS_CLK
;
4339 static void init_proc_MPC8xx (CPUPPCState
*env
)
4343 gen_spr_5xx_8xx(env
);
4345 init_excp_MPC8xx(env
);
4346 env
->dcache_line_size
= 32;
4347 env
->icache_line_size
= 32;
4348 /* XXX: TODO: allocate internal IRQ controller */
4351 POWERPC_FAMILY(MPC8xx
)(ObjectClass
*oc
, void *data
)
4353 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4354 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4356 dc
->desc
= "Freescale 8xx cores (aka PowerQUICC)";
4357 pcc
->init_proc
= init_proc_MPC8xx
;
4358 pcc
->check_pow
= check_pow_none
;
4359 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4360 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4361 PPC_CACHE_ICBI
| PPC_MFTB
;
4362 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4374 pcc
->mmu_model
= POWERPC_MMU_MPC8xx
;
4375 pcc
->excp_model
= POWERPC_EXCP_603
;
4376 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4377 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4378 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4379 POWERPC_FLAG_BUS_CLK
;
4382 /* Freescale 82xx cores (aka PowerQUICC-II) */
4384 static void init_proc_G2 (CPUPPCState
*env
)
4386 gen_spr_ne_601(env
);
4387 gen_spr_G2_755(env
);
4391 /* External access control */
4392 /* XXX : not implemented */
4393 spr_register(env
, SPR_EAR
, "EAR",
4394 SPR_NOACCESS
, SPR_NOACCESS
,
4395 &spr_read_generic
, &spr_write_generic
,
4397 /* Hardware implementation register */
4398 /* XXX : not implemented */
4399 spr_register(env
, SPR_HID0
, "HID0",
4400 SPR_NOACCESS
, SPR_NOACCESS
,
4401 &spr_read_generic
, &spr_write_generic
,
4403 /* XXX : not implemented */
4404 spr_register(env
, SPR_HID1
, "HID1",
4405 SPR_NOACCESS
, SPR_NOACCESS
,
4406 &spr_read_generic
, &spr_write_generic
,
4408 /* XXX : not implemented */
4409 spr_register(env
, SPR_HID2
, "HID2",
4410 SPR_NOACCESS
, SPR_NOACCESS
,
4411 &spr_read_generic
, &spr_write_generic
,
4413 /* Memory management */
4416 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4418 env
->dcache_line_size
= 32;
4419 env
->icache_line_size
= 32;
4420 /* Allocate hardware IRQ controller */
4421 ppc6xx_irq_init(ppc_env_get_cpu(env
));
4424 POWERPC_FAMILY(G2
)(ObjectClass
*oc
, void *data
)
4426 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4427 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4429 dc
->desc
= "PowerPC G2";
4430 pcc
->init_proc
= init_proc_G2
;
4431 pcc
->check_pow
= check_pow_hid0
;
4432 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4433 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4435 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4436 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4437 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4438 PPC_SEGMENT
| PPC_EXTERN
;
4439 pcc
->msr_mask
= (1ull << MSR_POW
) |
4440 (1ull << MSR_TGPR
) |
4454 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4455 pcc
->excp_model
= POWERPC_EXCP_G2
;
4456 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4457 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4458 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4459 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4462 static void init_proc_G2LE (CPUPPCState
*env
)
4464 gen_spr_ne_601(env
);
4465 gen_spr_G2_755(env
);
4469 /* External access control */
4470 /* XXX : not implemented */
4471 spr_register(env
, SPR_EAR
, "EAR",
4472 SPR_NOACCESS
, SPR_NOACCESS
,
4473 &spr_read_generic
, &spr_write_generic
,
4475 /* Hardware implementation register */
4476 /* XXX : not implemented */
4477 spr_register(env
, SPR_HID0
, "HID0",
4478 SPR_NOACCESS
, SPR_NOACCESS
,
4479 &spr_read_generic
, &spr_write_generic
,
4481 /* XXX : not implemented */
4482 spr_register(env
, SPR_HID1
, "HID1",
4483 SPR_NOACCESS
, SPR_NOACCESS
,
4484 &spr_read_generic
, &spr_write_generic
,
4486 /* XXX : not implemented */
4487 spr_register(env
, SPR_HID2
, "HID2",
4488 SPR_NOACCESS
, SPR_NOACCESS
,
4489 &spr_read_generic
, &spr_write_generic
,
4492 /* Memory management */
4495 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4497 env
->dcache_line_size
= 32;
4498 env
->icache_line_size
= 32;
4499 /* Allocate hardware IRQ controller */
4500 ppc6xx_irq_init(ppc_env_get_cpu(env
));
4503 POWERPC_FAMILY(G2LE
)(ObjectClass
*oc
, void *data
)
4505 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4506 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4508 dc
->desc
= "PowerPC G2LE";
4509 pcc
->init_proc
= init_proc_G2LE
;
4510 pcc
->check_pow
= check_pow_hid0
;
4511 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4512 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4514 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4515 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4516 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4517 PPC_SEGMENT
| PPC_EXTERN
;
4518 pcc
->msr_mask
= (1ull << MSR_POW
) |
4519 (1ull << MSR_TGPR
) |
4535 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4536 pcc
->excp_model
= POWERPC_EXCP_G2
;
4537 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4538 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4539 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4540 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4543 static void init_proc_e200 (CPUPPCState
*env
)
4547 gen_spr_BookE(env
, 0x000000070000FFFFULL
);
4548 /* XXX : not implemented */
4549 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4550 &spr_read_spefscr
, &spr_write_spefscr
,
4551 &spr_read_spefscr
, &spr_write_spefscr
,
4553 /* Memory management */
4554 gen_spr_BookE206(env
, 0x0000005D, NULL
);
4555 /* XXX : not implemented */
4556 spr_register(env
, SPR_HID0
, "HID0",
4557 SPR_NOACCESS
, SPR_NOACCESS
,
4558 &spr_read_generic
, &spr_write_generic
,
4560 /* XXX : not implemented */
4561 spr_register(env
, SPR_HID1
, "HID1",
4562 SPR_NOACCESS
, SPR_NOACCESS
,
4563 &spr_read_generic
, &spr_write_generic
,
4565 /* XXX : not implemented */
4566 spr_register(env
, SPR_Exxx_ALTCTXCR
, "ALTCTXCR",
4567 SPR_NOACCESS
, SPR_NOACCESS
,
4568 &spr_read_generic
, &spr_write_generic
,
4570 /* XXX : not implemented */
4571 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4572 SPR_NOACCESS
, SPR_NOACCESS
,
4573 &spr_read_generic
, &spr_write_generic
,
4575 /* XXX : not implemented */
4576 spr_register(env
, SPR_Exxx_CTXCR
, "CTXCR",
4577 SPR_NOACCESS
, SPR_NOACCESS
,
4578 &spr_read_generic
, &spr_write_generic
,
4580 /* XXX : not implemented */
4581 spr_register(env
, SPR_Exxx_DBCNT
, "DBCNT",
4582 SPR_NOACCESS
, SPR_NOACCESS
,
4583 &spr_read_generic
, &spr_write_generic
,
4585 /* XXX : not implemented */
4586 spr_register(env
, SPR_Exxx_DBCR3
, "DBCR3",
4587 SPR_NOACCESS
, SPR_NOACCESS
,
4588 &spr_read_generic
, &spr_write_generic
,
4590 /* XXX : not implemented */
4591 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4592 &spr_read_generic
, SPR_NOACCESS
,
4593 &spr_read_generic
, SPR_NOACCESS
,
4595 /* XXX : not implemented */
4596 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4597 SPR_NOACCESS
, SPR_NOACCESS
,
4598 &spr_read_generic
, &spr_write_generic
,
4600 /* XXX : not implemented */
4601 spr_register(env
, SPR_Exxx_L1FINV0
, "L1FINV0",
4602 SPR_NOACCESS
, SPR_NOACCESS
,
4603 &spr_read_generic
, &spr_write_generic
,
4605 /* XXX : not implemented */
4606 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
4607 SPR_NOACCESS
, SPR_NOACCESS
,
4608 &spr_read_generic
, &spr_write_generic
,
4610 /* XXX : not implemented */
4611 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
4612 SPR_NOACCESS
, SPR_NOACCESS
,
4613 &spr_read_generic
, &spr_write_generic
,
4615 /* XXX : not implemented */
4616 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4617 SPR_NOACCESS
, SPR_NOACCESS
,
4618 &spr_read_generic
, &spr_write_generic
,
4620 /* XXX : not implemented */
4621 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4622 SPR_NOACCESS
, SPR_NOACCESS
,
4623 &spr_read_generic
, &spr_write_generic
,
4625 /* XXX : not implemented */
4626 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4627 SPR_NOACCESS
, SPR_NOACCESS
,
4628 &spr_read_generic
, &spr_write_generic
,
4629 0x00000000); /* TOFIX */
4630 spr_register(env
, SPR_BOOKE_DSRR0
, "DSRR0",
4631 SPR_NOACCESS
, SPR_NOACCESS
,
4632 &spr_read_generic
, &spr_write_generic
,
4634 spr_register(env
, SPR_BOOKE_DSRR1
, "DSRR1",
4635 SPR_NOACCESS
, SPR_NOACCESS
,
4636 &spr_read_generic
, &spr_write_generic
,
4638 #if !defined(CONFIG_USER_ONLY)
4642 env
->tlb_type
= TLB_EMB
;
4644 init_excp_e200(env
, 0xFFFF0000UL
);
4645 env
->dcache_line_size
= 32;
4646 env
->icache_line_size
= 32;
4647 /* XXX: TODO: allocate internal IRQ controller */
4650 POWERPC_FAMILY(e200
)(ObjectClass
*oc
, void *data
)
4652 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4653 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4655 dc
->desc
= "e200 core";
4656 pcc
->init_proc
= init_proc_e200
;
4657 pcc
->check_pow
= check_pow_hid0
;
4658 /* XXX: unimplemented instructions:
4665 * all SPE multiply-accumulate instructions
4667 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4668 PPC_SPE
| PPC_SPE_SINGLE
|
4669 PPC_WRTEE
| PPC_RFDI
|
4670 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4671 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4672 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
|
4674 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4688 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4689 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4690 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4691 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4692 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4693 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4694 POWERPC_FLAG_BUS_CLK
;
4697 static void init_proc_e300 (CPUPPCState
*env
)
4699 gen_spr_ne_601(env
);
4703 /* hardware implementation registers */
4704 /* XXX : not implemented */
4705 spr_register(env
, SPR_HID0
, "HID0",
4706 SPR_NOACCESS
, SPR_NOACCESS
,
4707 &spr_read_generic
, &spr_write_generic
,
4709 /* XXX : not implemented */
4710 spr_register(env
, SPR_HID1
, "HID1",
4711 SPR_NOACCESS
, SPR_NOACCESS
,
4712 &spr_read_generic
, &spr_write_generic
,
4714 /* XXX : not implemented */
4715 spr_register(env
, SPR_HID2
, "HID2",
4716 SPR_NOACCESS
, SPR_NOACCESS
,
4717 &spr_read_generic
, &spr_write_generic
,
4720 /* XXX : not implemented */
4721 spr_register(env
, SPR_DABR
, "DABR",
4722 SPR_NOACCESS
, SPR_NOACCESS
,
4723 &spr_read_generic
, &spr_write_generic
,
4725 /* XXX : not implemented */
4726 spr_register(env
, SPR_DABR2
, "DABR2",
4727 SPR_NOACCESS
, SPR_NOACCESS
,
4728 &spr_read_generic
, &spr_write_generic
,
4730 /* XXX : not implemented */
4731 spr_register(env
, SPR_IABR2
, "IABR2",
4732 SPR_NOACCESS
, SPR_NOACCESS
,
4733 &spr_read_generic
, &spr_write_generic
,
4735 /* XXX : not implemented */
4736 spr_register(env
, SPR_IBCR
, "IBCR",
4737 SPR_NOACCESS
, SPR_NOACCESS
,
4738 &spr_read_generic
, &spr_write_generic
,
4740 /* XXX : not implemented */
4741 spr_register(env
, SPR_DBCR
, "DBCR",
4742 SPR_NOACCESS
, SPR_NOACCESS
,
4743 &spr_read_generic
, &spr_write_generic
,
4745 /* Memory management */
4748 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4750 env
->dcache_line_size
= 32;
4751 env
->icache_line_size
= 32;
4752 /* Allocate hardware IRQ controller */
4753 ppc6xx_irq_init(ppc_env_get_cpu(env
));
4756 POWERPC_FAMILY(e300
)(ObjectClass
*oc
, void *data
)
4758 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4759 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4761 dc
->desc
= "e300 core";
4762 pcc
->init_proc
= init_proc_e300
;
4763 pcc
->check_pow
= check_pow_hid0
;
4764 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4765 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4767 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4768 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4769 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4770 PPC_SEGMENT
| PPC_EXTERN
;
4771 pcc
->msr_mask
= (1ull << MSR_POW
) |
4772 (1ull << MSR_TGPR
) |
4788 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4789 pcc
->excp_model
= POWERPC_EXCP_603
;
4790 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4791 pcc
->bfd_mach
= bfd_mach_ppc_603
;
4792 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4793 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4796 #if !defined(CONFIG_USER_ONLY)
4797 static void spr_write_mas73(DisasContext
*ctx
, int sprn
, int gprn
)
4799 TCGv val
= tcg_temp_new();
4800 tcg_gen_ext32u_tl(val
, cpu_gpr
[gprn
]);
4801 gen_store_spr(SPR_BOOKE_MAS3
, val
);
4802 tcg_gen_shri_tl(val
, cpu_gpr
[gprn
], 32);
4803 gen_store_spr(SPR_BOOKE_MAS7
, val
);
4807 static void spr_read_mas73(DisasContext
*ctx
, int gprn
, int sprn
)
4809 TCGv mas7
= tcg_temp_new();
4810 TCGv mas3
= tcg_temp_new();
4811 gen_load_spr(mas7
, SPR_BOOKE_MAS7
);
4812 tcg_gen_shli_tl(mas7
, mas7
, 32);
4813 gen_load_spr(mas3
, SPR_BOOKE_MAS3
);
4814 tcg_gen_or_tl(cpu_gpr
[gprn
], mas3
, mas7
);
4815 tcg_temp_free(mas3
);
4816 tcg_temp_free(mas7
);
4821 enum fsl_e500_version
{
4828 static void init_proc_e500 (CPUPPCState
*env
, int version
)
4830 PowerPCCPU
*cpu
= ppc_env_get_cpu(env
);
4831 uint32_t tlbncfg
[2];
4833 uint64_t ivpr_mask
= 0xFFFF0000ULL
;
4834 uint32_t l1cfg0
= 0x3800 /* 8 ways */
4835 | 0x0020; /* 32 kb */
4836 uint32_t l1cfg1
= 0x3800 /* 8 ways */
4837 | 0x0020; /* 32 kb */
4838 #if !defined(CONFIG_USER_ONLY)
4845 * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't
4846 * complain when accessing them.
4847 * gen_spr_BookE(env, 0x0000000F0000FD7FULL);
4853 ivor_mask
= 0x0000000F0000FFFFULL
;
4857 ivor_mask
= 0x000003FE0000FFFFULL
;
4860 gen_spr_BookE(env
, ivor_mask
);
4861 /* Processor identification */
4862 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4863 SPR_NOACCESS
, SPR_NOACCESS
,
4864 &spr_read_generic
, &spr_write_pir
,
4866 /* XXX : not implemented */
4867 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4868 &spr_read_spefscr
, &spr_write_spefscr
,
4869 &spr_read_spefscr
, &spr_write_spefscr
,
4871 #if !defined(CONFIG_USER_ONLY)
4872 /* Memory management */
4878 tlbncfg
[0] = gen_tlbncfg(2, 1, 1, 0, 256);
4879 tlbncfg
[1] = gen_tlbncfg(16, 1, 9, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4882 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4883 tlbncfg
[1] = gen_tlbncfg(16, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4887 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4888 tlbncfg
[1] = gen_tlbncfg(64, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 64);
4891 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4898 env
->dcache_line_size
= 32;
4899 env
->icache_line_size
= 32;
4903 env
->dcache_line_size
= 64;
4904 env
->icache_line_size
= 64;
4905 l1cfg0
|= 0x1000000; /* 64 byte cache block size */
4906 l1cfg1
|= 0x1000000; /* 64 byte cache block size */
4909 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4911 gen_spr_BookE206(env
, 0x000000DF, tlbncfg
);
4912 /* XXX : not implemented */
4913 spr_register(env
, SPR_HID0
, "HID0",
4914 SPR_NOACCESS
, SPR_NOACCESS
,
4915 &spr_read_generic
, &spr_write_generic
,
4917 /* XXX : not implemented */
4918 spr_register(env
, SPR_HID1
, "HID1",
4919 SPR_NOACCESS
, SPR_NOACCESS
,
4920 &spr_read_generic
, &spr_write_generic
,
4922 /* XXX : not implemented */
4923 spr_register(env
, SPR_Exxx_BBEAR
, "BBEAR",
4924 SPR_NOACCESS
, SPR_NOACCESS
,
4925 &spr_read_generic
, &spr_write_generic
,
4927 /* XXX : not implemented */
4928 spr_register(env
, SPR_Exxx_BBTAR
, "BBTAR",
4929 SPR_NOACCESS
, SPR_NOACCESS
,
4930 &spr_read_generic
, &spr_write_generic
,
4932 /* XXX : not implemented */
4933 spr_register(env
, SPR_Exxx_MCAR
, "MCAR",
4934 SPR_NOACCESS
, SPR_NOACCESS
,
4935 &spr_read_generic
, &spr_write_generic
,
4937 /* XXX : not implemented */
4938 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4939 SPR_NOACCESS
, SPR_NOACCESS
,
4940 &spr_read_generic
, &spr_write_generic
,
4942 /* XXX : not implemented */
4943 spr_register(env
, SPR_Exxx_NPIDR
, "NPIDR",
4944 SPR_NOACCESS
, SPR_NOACCESS
,
4945 &spr_read_generic
, &spr_write_generic
,
4947 /* XXX : not implemented */
4948 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4949 SPR_NOACCESS
, SPR_NOACCESS
,
4950 &spr_read_generic
, &spr_write_generic
,
4952 /* XXX : not implemented */
4953 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4954 &spr_read_generic
, SPR_NOACCESS
,
4955 &spr_read_generic
, SPR_NOACCESS
,
4957 spr_register(env
, SPR_Exxx_L1CFG1
, "L1CFG1",
4958 &spr_read_generic
, SPR_NOACCESS
,
4959 &spr_read_generic
, SPR_NOACCESS
,
4961 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4962 SPR_NOACCESS
, SPR_NOACCESS
,
4963 &spr_read_generic
, &spr_write_e500_l1csr0
,
4965 spr_register(env
, SPR_Exxx_L1CSR1
, "L1CSR1",
4966 SPR_NOACCESS
, SPR_NOACCESS
,
4967 &spr_read_generic
, &spr_write_e500_l1csr1
,
4969 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4970 SPR_NOACCESS
, SPR_NOACCESS
,
4971 &spr_read_generic
, &spr_write_generic
,
4973 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4974 SPR_NOACCESS
, SPR_NOACCESS
,
4975 &spr_read_generic
, &spr_write_generic
,
4977 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4978 SPR_NOACCESS
, SPR_NOACCESS
,
4979 &spr_read_generic
, &spr_write_booke206_mmucsr0
,
4981 spr_register(env
, SPR_BOOKE_EPR
, "EPR",
4982 SPR_NOACCESS
, SPR_NOACCESS
,
4983 &spr_read_generic
, SPR_NOACCESS
,
4985 /* XXX better abstract into Emb.xxx features */
4986 if (version
== fsl_e5500
) {
4987 spr_register(env
, SPR_BOOKE_EPCR
, "EPCR",
4988 SPR_NOACCESS
, SPR_NOACCESS
,
4989 &spr_read_generic
, &spr_write_generic
,
4991 spr_register(env
, SPR_BOOKE_MAS7_MAS3
, "MAS7_MAS3",
4992 SPR_NOACCESS
, SPR_NOACCESS
,
4993 &spr_read_mas73
, &spr_write_mas73
,
4995 ivpr_mask
= (target_ulong
)~0xFFFFULL
;
4998 #if !defined(CONFIG_USER_ONLY)
5000 env
->tlb_type
= TLB_MAS
;
5001 for (i
= 0; i
< BOOKE206_MAX_TLBN
; i
++) {
5002 env
->nb_tlb
+= booke206_tlb_size(env
, i
);
5006 init_excp_e200(env
, ivpr_mask
);
5007 /* Allocate hardware IRQ controller */
5008 ppce500_irq_init(ppc_env_get_cpu(env
));
5011 static void init_proc_e500v1(CPUPPCState
*env
)
5013 init_proc_e500(env
, fsl_e500v1
);
5016 POWERPC_FAMILY(e500v1
)(ObjectClass
*oc
, void *data
)
5018 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5019 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5021 dc
->desc
= "e500v1 core";
5022 pcc
->init_proc
= init_proc_e500v1
;
5023 pcc
->check_pow
= check_pow_hid0
;
5024 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5025 PPC_SPE
| PPC_SPE_SINGLE
|
5026 PPC_WRTEE
| PPC_RFDI
|
5027 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5028 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5029 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5030 pcc
->insns_flags2
= PPC2_BOOKE206
;
5031 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
5045 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5046 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5047 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5048 pcc
->bfd_mach
= bfd_mach_ppc_860
;
5049 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
5050 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
5051 POWERPC_FLAG_BUS_CLK
;
5054 static void init_proc_e500v2(CPUPPCState
*env
)
5056 init_proc_e500(env
, fsl_e500v2
);
5059 POWERPC_FAMILY(e500v2
)(ObjectClass
*oc
, void *data
)
5061 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5062 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5064 dc
->desc
= "e500v2 core";
5065 pcc
->init_proc
= init_proc_e500v2
;
5066 pcc
->check_pow
= check_pow_hid0
;
5067 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5068 PPC_SPE
| PPC_SPE_SINGLE
| PPC_SPE_DOUBLE
|
5069 PPC_WRTEE
| PPC_RFDI
|
5070 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5071 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5072 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5073 pcc
->insns_flags2
= PPC2_BOOKE206
;
5074 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
5088 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5089 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5090 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5091 pcc
->bfd_mach
= bfd_mach_ppc_860
;
5092 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
5093 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
5094 POWERPC_FLAG_BUS_CLK
;
5097 static void init_proc_e500mc(CPUPPCState
*env
)
5099 init_proc_e500(env
, fsl_e500mc
);
5102 POWERPC_FAMILY(e500mc
)(ObjectClass
*oc
, void *data
)
5104 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5105 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5107 dc
->desc
= "e500mc core";
5108 pcc
->init_proc
= init_proc_e500mc
;
5109 pcc
->check_pow
= check_pow_none
;
5110 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5111 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5112 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5113 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5114 PPC_FLOAT
| PPC_FLOAT_FRES
|
5115 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5116 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5117 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5118 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
;
5119 pcc
->msr_mask
= (1ull << MSR_GS
) |
5120 (1ull << MSR_UCLE
) |
5133 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5134 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5135 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5136 /* FIXME: figure out the correct flag for e500mc */
5137 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5138 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5139 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5143 static void init_proc_e5500(CPUPPCState
*env
)
5145 init_proc_e500(env
, fsl_e5500
);
5148 POWERPC_FAMILY(e5500
)(ObjectClass
*oc
, void *data
)
5150 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5151 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5153 dc
->desc
= "e5500 core";
5154 pcc
->init_proc
= init_proc_e5500
;
5155 pcc
->check_pow
= check_pow_none
;
5156 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5157 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5158 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5159 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5160 PPC_FLOAT
| PPC_FLOAT_FRES
|
5161 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5162 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5163 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
5164 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
;
5165 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
| \
5167 pcc
->msr_mask
= (1ull << MSR_CM
) |
5169 (1ull << MSR_UCLE
) |
5182 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5183 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5184 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5185 /* FIXME: figure out the correct flag for e5500 */
5186 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5187 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5188 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5192 /* Non-embedded PowerPC */
5194 /* POWER : same as 601, without mfmsr, mfsr */
5195 POWERPC_FAMILY(POWER
)(ObjectClass
*oc
, void *data
)
5197 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5198 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5201 /* pcc->insns_flags = XXX_TODO; */
5202 /* POWER RSC (from RAD6000) */
5203 pcc
->msr_mask
= (1ull << MSR_EE
) |
5216 #define POWERPC_MSRR_601 (0x0000000000001040ULL)
5218 static void init_proc_601 (CPUPPCState
*env
)
5220 gen_spr_ne_601(env
);
5222 /* Hardware implementation registers */
5223 /* XXX : not implemented */
5224 spr_register(env
, SPR_HID0
, "HID0",
5225 SPR_NOACCESS
, SPR_NOACCESS
,
5226 &spr_read_generic
, &spr_write_hid0_601
,
5228 /* XXX : not implemented */
5229 spr_register(env
, SPR_HID1
, "HID1",
5230 SPR_NOACCESS
, SPR_NOACCESS
,
5231 &spr_read_generic
, &spr_write_generic
,
5233 /* XXX : not implemented */
5234 spr_register(env
, SPR_601_HID2
, "HID2",
5235 SPR_NOACCESS
, SPR_NOACCESS
,
5236 &spr_read_generic
, &spr_write_generic
,
5238 /* XXX : not implemented */
5239 spr_register(env
, SPR_601_HID5
, "HID5",
5240 SPR_NOACCESS
, SPR_NOACCESS
,
5241 &spr_read_generic
, &spr_write_generic
,
5243 /* Memory management */
5245 /* XXX: beware that dcache line size is 64
5246 * but dcbz uses 32 bytes "sectors"
5247 * XXX: this breaks clcs instruction !
5249 env
->dcache_line_size
= 32;
5250 env
->icache_line_size
= 64;
5251 /* Allocate hardware IRQ controller */
5252 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5255 POWERPC_FAMILY(601)(ObjectClass
*oc
, void *data
)
5257 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5258 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5260 dc
->desc
= "PowerPC 601";
5261 pcc
->init_proc
= init_proc_601
;
5262 pcc
->check_pow
= check_pow_none
;
5263 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5265 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5266 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5267 PPC_SEGMENT
| PPC_EXTERN
;
5268 pcc
->msr_mask
= (1ull << MSR_EE
) |
5278 pcc
->mmu_model
= POWERPC_MMU_601
;
5279 #if defined(CONFIG_SOFTMMU)
5280 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5282 pcc
->excp_model
= POWERPC_EXCP_601
;
5283 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5284 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5285 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5288 #define POWERPC_MSRR_601v (0x0000000000001040ULL)
5290 static void init_proc_601v (CPUPPCState
*env
)
5293 /* XXX : not implemented */
5294 spr_register(env
, SPR_601_HID15
, "HID15",
5295 SPR_NOACCESS
, SPR_NOACCESS
,
5296 &spr_read_generic
, &spr_write_generic
,
5300 POWERPC_FAMILY(601v
)(ObjectClass
*oc
, void *data
)
5302 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5303 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5305 dc
->desc
= "PowerPC 601v";
5306 pcc
->init_proc
= init_proc_601v
;
5307 pcc
->check_pow
= check_pow_none
;
5308 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5310 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5311 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5312 PPC_SEGMENT
| PPC_EXTERN
;
5313 pcc
->msr_mask
= (1ull << MSR_EE
) |
5323 pcc
->mmu_model
= POWERPC_MMU_601
;
5324 #if defined(CONFIG_SOFTMMU)
5325 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5327 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5328 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5329 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5332 static void init_proc_602 (CPUPPCState
*env
)
5334 gen_spr_ne_601(env
);
5338 /* hardware implementation registers */
5339 /* XXX : not implemented */
5340 spr_register(env
, SPR_HID0
, "HID0",
5341 SPR_NOACCESS
, SPR_NOACCESS
,
5342 &spr_read_generic
, &spr_write_generic
,
5344 /* XXX : not implemented */
5345 spr_register(env
, SPR_HID1
, "HID1",
5346 SPR_NOACCESS
, SPR_NOACCESS
,
5347 &spr_read_generic
, &spr_write_generic
,
5349 /* Memory management */
5351 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5353 env
->dcache_line_size
= 32;
5354 env
->icache_line_size
= 32;
5355 /* Allocate hardware IRQ controller */
5356 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5359 POWERPC_FAMILY(602)(ObjectClass
*oc
, void *data
)
5361 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5362 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5364 dc
->desc
= "PowerPC 602";
5365 pcc
->init_proc
= init_proc_602
;
5366 pcc
->check_pow
= check_pow_hid0
;
5367 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5368 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5369 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5370 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5371 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5372 PPC_MEM_TLBIE
| PPC_6xx_TLB
| PPC_MEM_TLBSYNC
|
5373 PPC_SEGMENT
| PPC_602_SPEC
;
5374 pcc
->msr_mask
= (1ull << MSR_VSX
) |
5377 (1ull << MSR_TGPR
) |
5392 /* XXX: 602 MMU is quite specific. Should add a special case */
5393 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5394 pcc
->excp_model
= POWERPC_EXCP_602
;
5395 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5396 pcc
->bfd_mach
= bfd_mach_ppc_602
;
5397 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5398 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5401 static void init_proc_603 (CPUPPCState
*env
)
5403 gen_spr_ne_601(env
);
5407 /* hardware implementation registers */
5408 /* XXX : not implemented */
5409 spr_register(env
, SPR_HID0
, "HID0",
5410 SPR_NOACCESS
, SPR_NOACCESS
,
5411 &spr_read_generic
, &spr_write_generic
,
5413 /* XXX : not implemented */
5414 spr_register(env
, SPR_HID1
, "HID1",
5415 SPR_NOACCESS
, SPR_NOACCESS
,
5416 &spr_read_generic
, &spr_write_generic
,
5418 /* Memory management */
5420 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5422 env
->dcache_line_size
= 32;
5423 env
->icache_line_size
= 32;
5424 /* Allocate hardware IRQ controller */
5425 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5428 POWERPC_FAMILY(603)(ObjectClass
*oc
, void *data
)
5430 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5431 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5433 dc
->desc
= "PowerPC 603";
5434 pcc
->init_proc
= init_proc_603
;
5435 pcc
->check_pow
= check_pow_hid0
;
5436 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5437 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5438 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5439 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5440 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5441 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5442 PPC_SEGMENT
| PPC_EXTERN
;
5443 pcc
->msr_mask
= (1ull << MSR_POW
) |
5444 (1ull << MSR_TGPR
) |
5459 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5460 pcc
->excp_model
= POWERPC_EXCP_603
;
5461 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5462 pcc
->bfd_mach
= bfd_mach_ppc_603
;
5463 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5464 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5467 static void init_proc_603E (CPUPPCState
*env
)
5469 gen_spr_ne_601(env
);
5473 /* hardware implementation registers */
5474 /* XXX : not implemented */
5475 spr_register(env
, SPR_HID0
, "HID0",
5476 SPR_NOACCESS
, SPR_NOACCESS
,
5477 &spr_read_generic
, &spr_write_generic
,
5479 /* XXX : not implemented */
5480 spr_register(env
, SPR_HID1
, "HID1",
5481 SPR_NOACCESS
, SPR_NOACCESS
,
5482 &spr_read_generic
, &spr_write_generic
,
5484 /* Memory management */
5486 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5488 env
->dcache_line_size
= 32;
5489 env
->icache_line_size
= 32;
5490 /* Allocate hardware IRQ controller */
5491 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5494 POWERPC_FAMILY(603E
)(ObjectClass
*oc
, void *data
)
5496 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5497 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5499 dc
->desc
= "PowerPC 603e";
5500 pcc
->init_proc
= init_proc_603E
;
5501 pcc
->check_pow
= check_pow_hid0
;
5502 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5503 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5504 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5505 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5506 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5507 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5508 PPC_SEGMENT
| PPC_EXTERN
;
5509 pcc
->msr_mask
= (1ull << MSR_POW
) |
5510 (1ull << MSR_TGPR
) |
5525 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5526 pcc
->excp_model
= POWERPC_EXCP_603E
;
5527 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5528 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
5529 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5530 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5533 static void init_proc_604 (CPUPPCState
*env
)
5535 gen_spr_ne_601(env
);
5539 /* Hardware implementation registers */
5540 /* XXX : not implemented */
5541 spr_register(env
, SPR_HID0
, "HID0",
5542 SPR_NOACCESS
, SPR_NOACCESS
,
5543 &spr_read_generic
, &spr_write_generic
,
5545 /* Memory management */
5548 env
->dcache_line_size
= 32;
5549 env
->icache_line_size
= 32;
5550 /* Allocate hardware IRQ controller */
5551 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5554 POWERPC_FAMILY(604)(ObjectClass
*oc
, void *data
)
5556 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5557 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5559 dc
->desc
= "PowerPC 604";
5560 pcc
->init_proc
= init_proc_604
;
5561 pcc
->check_pow
= check_pow_nocheck
;
5562 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5563 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5564 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5565 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5566 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5567 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5568 PPC_SEGMENT
| PPC_EXTERN
;
5569 pcc
->msr_mask
= (1ull << MSR_POW
) |
5585 pcc
->mmu_model
= POWERPC_MMU_32B
;
5586 #if defined(CONFIG_SOFTMMU)
5587 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5589 pcc
->excp_model
= POWERPC_EXCP_604
;
5590 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5591 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5592 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5593 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5596 static void init_proc_604E (CPUPPCState
*env
)
5598 gen_spr_ne_601(env
);
5600 /* XXX : not implemented */
5601 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
5602 SPR_NOACCESS
, SPR_NOACCESS
,
5603 &spr_read_generic
, &spr_write_generic
,
5605 /* XXX : not implemented */
5606 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
5607 SPR_NOACCESS
, SPR_NOACCESS
,
5608 &spr_read_generic
, &spr_write_generic
,
5610 /* XXX : not implemented */
5611 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
5612 SPR_NOACCESS
, SPR_NOACCESS
,
5613 &spr_read_generic
, &spr_write_generic
,
5617 /* Hardware implementation registers */
5618 /* XXX : not implemented */
5619 spr_register(env
, SPR_HID0
, "HID0",
5620 SPR_NOACCESS
, SPR_NOACCESS
,
5621 &spr_read_generic
, &spr_write_generic
,
5623 /* XXX : not implemented */
5624 spr_register(env
, SPR_HID1
, "HID1",
5625 SPR_NOACCESS
, SPR_NOACCESS
,
5626 &spr_read_generic
, &spr_write_generic
,
5628 /* Memory management */
5631 env
->dcache_line_size
= 32;
5632 env
->icache_line_size
= 32;
5633 /* Allocate hardware IRQ controller */
5634 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5637 POWERPC_FAMILY(604E
)(ObjectClass
*oc
, void *data
)
5639 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5640 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5642 dc
->desc
= "PowerPC 604E";
5643 pcc
->init_proc
= init_proc_604E
;
5644 pcc
->check_pow
= check_pow_nocheck
;
5645 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5646 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5647 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5648 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5649 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5650 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5651 PPC_SEGMENT
| PPC_EXTERN
;
5652 pcc
->msr_mask
= (1ull << MSR_POW
) |
5668 pcc
->mmu_model
= POWERPC_MMU_32B
;
5669 #if defined(CONFIG_SOFTMMU)
5670 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5672 pcc
->excp_model
= POWERPC_EXCP_604
;
5673 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5674 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5675 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5676 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5679 static void init_proc_740 (CPUPPCState
*env
)
5681 gen_spr_ne_601(env
);
5685 /* Thermal management */
5687 /* Hardware implementation registers */
5688 /* XXX : not implemented */
5689 spr_register(env
, SPR_HID0
, "HID0",
5690 SPR_NOACCESS
, SPR_NOACCESS
,
5691 &spr_read_generic
, &spr_write_generic
,
5693 /* XXX : not implemented */
5694 spr_register(env
, SPR_HID1
, "HID1",
5695 SPR_NOACCESS
, SPR_NOACCESS
,
5696 &spr_read_generic
, &spr_write_generic
,
5698 /* Memory management */
5701 env
->dcache_line_size
= 32;
5702 env
->icache_line_size
= 32;
5703 /* Allocate hardware IRQ controller */
5704 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5707 POWERPC_FAMILY(740)(ObjectClass
*oc
, void *data
)
5709 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5710 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5712 dc
->desc
= "PowerPC 740";
5713 pcc
->init_proc
= init_proc_740
;
5714 pcc
->check_pow
= check_pow_hid0
;
5715 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5716 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5717 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5718 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5719 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5720 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5721 PPC_SEGMENT
| PPC_EXTERN
;
5722 pcc
->msr_mask
= (1ull << MSR_POW
) |
5738 pcc
->mmu_model
= POWERPC_MMU_32B
;
5739 #if defined(CONFIG_SOFTMMU)
5740 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5742 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5743 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5744 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5745 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5746 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5749 static void init_proc_750 (CPUPPCState
*env
)
5751 gen_spr_ne_601(env
);
5753 /* XXX : not implemented */
5754 spr_register(env
, SPR_L2CR
, "L2CR",
5755 SPR_NOACCESS
, SPR_NOACCESS
,
5756 &spr_read_generic
, spr_access_nop
,
5760 /* Thermal management */
5762 /* Hardware implementation registers */
5763 /* XXX : not implemented */
5764 spr_register(env
, SPR_HID0
, "HID0",
5765 SPR_NOACCESS
, SPR_NOACCESS
,
5766 &spr_read_generic
, &spr_write_generic
,
5768 /* XXX : not implemented */
5769 spr_register(env
, SPR_HID1
, "HID1",
5770 SPR_NOACCESS
, SPR_NOACCESS
,
5771 &spr_read_generic
, &spr_write_generic
,
5773 /* Memory management */
5775 /* XXX: high BATs are also present but are known to be bugged on
5779 env
->dcache_line_size
= 32;
5780 env
->icache_line_size
= 32;
5781 /* Allocate hardware IRQ controller */
5782 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5785 POWERPC_FAMILY(750)(ObjectClass
*oc
, void *data
)
5787 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5788 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5790 dc
->desc
= "PowerPC 750";
5791 pcc
->init_proc
= init_proc_750
;
5792 pcc
->check_pow
= check_pow_hid0
;
5793 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5794 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5795 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5796 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5797 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5798 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5799 PPC_SEGMENT
| PPC_EXTERN
;
5800 pcc
->msr_mask
= (1ull << MSR_POW
) |
5816 pcc
->mmu_model
= POWERPC_MMU_32B
;
5817 #if defined(CONFIG_SOFTMMU)
5818 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5820 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5821 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5822 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5823 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5824 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5827 static void init_proc_750cl (CPUPPCState
*env
)
5829 gen_spr_ne_601(env
);
5831 /* XXX : not implemented */
5832 spr_register(env
, SPR_L2CR
, "L2CR",
5833 SPR_NOACCESS
, SPR_NOACCESS
,
5834 &spr_read_generic
, spr_access_nop
,
5838 /* Thermal management */
5839 /* Those registers are fake on 750CL */
5840 spr_register(env
, SPR_THRM1
, "THRM1",
5841 SPR_NOACCESS
, SPR_NOACCESS
,
5842 &spr_read_generic
, &spr_write_generic
,
5844 spr_register(env
, SPR_THRM2
, "THRM2",
5845 SPR_NOACCESS
, SPR_NOACCESS
,
5846 &spr_read_generic
, &spr_write_generic
,
5848 spr_register(env
, SPR_THRM3
, "THRM3",
5849 SPR_NOACCESS
, SPR_NOACCESS
,
5850 &spr_read_generic
, &spr_write_generic
,
5852 /* XXX: not implemented */
5853 spr_register(env
, SPR_750_TDCL
, "TDCL",
5854 SPR_NOACCESS
, SPR_NOACCESS
,
5855 &spr_read_generic
, &spr_write_generic
,
5857 spr_register(env
, SPR_750_TDCH
, "TDCH",
5858 SPR_NOACCESS
, SPR_NOACCESS
,
5859 &spr_read_generic
, &spr_write_generic
,
5862 /* XXX : not implemented */
5863 spr_register(env
, SPR_750_WPAR
, "WPAR",
5864 SPR_NOACCESS
, SPR_NOACCESS
,
5865 &spr_read_generic
, &spr_write_generic
,
5867 spr_register(env
, SPR_750_DMAL
, "DMAL",
5868 SPR_NOACCESS
, SPR_NOACCESS
,
5869 &spr_read_generic
, &spr_write_generic
,
5871 spr_register(env
, SPR_750_DMAU
, "DMAU",
5872 SPR_NOACCESS
, SPR_NOACCESS
,
5873 &spr_read_generic
, &spr_write_generic
,
5875 /* Hardware implementation registers */
5876 /* XXX : not implemented */
5877 spr_register(env
, SPR_HID0
, "HID0",
5878 SPR_NOACCESS
, SPR_NOACCESS
,
5879 &spr_read_generic
, &spr_write_generic
,
5881 /* XXX : not implemented */
5882 spr_register(env
, SPR_HID1
, "HID1",
5883 SPR_NOACCESS
, SPR_NOACCESS
,
5884 &spr_read_generic
, &spr_write_generic
,
5886 /* XXX : not implemented */
5887 spr_register(env
, SPR_750CL_HID2
, "HID2",
5888 SPR_NOACCESS
, SPR_NOACCESS
,
5889 &spr_read_generic
, &spr_write_generic
,
5891 /* XXX : not implemented */
5892 spr_register(env
, SPR_750CL_HID4
, "HID4",
5893 SPR_NOACCESS
, SPR_NOACCESS
,
5894 &spr_read_generic
, &spr_write_generic
,
5896 /* Quantization registers */
5897 /* XXX : not implemented */
5898 spr_register(env
, SPR_750_GQR0
, "GQR0",
5899 SPR_NOACCESS
, SPR_NOACCESS
,
5900 &spr_read_generic
, &spr_write_generic
,
5902 /* XXX : not implemented */
5903 spr_register(env
, SPR_750_GQR1
, "GQR1",
5904 SPR_NOACCESS
, SPR_NOACCESS
,
5905 &spr_read_generic
, &spr_write_generic
,
5907 /* XXX : not implemented */
5908 spr_register(env
, SPR_750_GQR2
, "GQR2",
5909 SPR_NOACCESS
, SPR_NOACCESS
,
5910 &spr_read_generic
, &spr_write_generic
,
5912 /* XXX : not implemented */
5913 spr_register(env
, SPR_750_GQR3
, "GQR3",
5914 SPR_NOACCESS
, SPR_NOACCESS
,
5915 &spr_read_generic
, &spr_write_generic
,
5917 /* XXX : not implemented */
5918 spr_register(env
, SPR_750_GQR4
, "GQR4",
5919 SPR_NOACCESS
, SPR_NOACCESS
,
5920 &spr_read_generic
, &spr_write_generic
,
5922 /* XXX : not implemented */
5923 spr_register(env
, SPR_750_GQR5
, "GQR5",
5924 SPR_NOACCESS
, SPR_NOACCESS
,
5925 &spr_read_generic
, &spr_write_generic
,
5927 /* XXX : not implemented */
5928 spr_register(env
, SPR_750_GQR6
, "GQR6",
5929 SPR_NOACCESS
, SPR_NOACCESS
,
5930 &spr_read_generic
, &spr_write_generic
,
5932 /* XXX : not implemented */
5933 spr_register(env
, SPR_750_GQR7
, "GQR7",
5934 SPR_NOACCESS
, SPR_NOACCESS
,
5935 &spr_read_generic
, &spr_write_generic
,
5937 /* Memory management */
5939 /* PowerPC 750cl has 8 DBATs and 8 IBATs */
5941 init_excp_750cl(env
);
5942 env
->dcache_line_size
= 32;
5943 env
->icache_line_size
= 32;
5944 /* Allocate hardware IRQ controller */
5945 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5948 POWERPC_FAMILY(750cl
)(ObjectClass
*oc
, void *data
)
5950 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5951 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5953 dc
->desc
= "PowerPC 750 CL";
5954 pcc
->init_proc
= init_proc_750cl
;
5955 pcc
->check_pow
= check_pow_hid0
;
5956 /* XXX: not implemented:
5957 * cache lock instructions:
5959 * floating point paired instructions
5994 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5995 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5996 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5997 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5998 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5999 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6000 PPC_SEGMENT
| PPC_EXTERN
;
6001 pcc
->msr_mask
= (1ull << MSR_POW
) |
6017 pcc
->mmu_model
= POWERPC_MMU_32B
;
6018 #if defined(CONFIG_SOFTMMU)
6019 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6021 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6022 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6023 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6024 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6025 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6028 static void init_proc_750cx (CPUPPCState
*env
)
6030 gen_spr_ne_601(env
);
6032 /* XXX : not implemented */
6033 spr_register(env
, SPR_L2CR
, "L2CR",
6034 SPR_NOACCESS
, SPR_NOACCESS
,
6035 &spr_read_generic
, spr_access_nop
,
6039 /* Thermal management */
6041 /* This register is not implemented but is present for compatibility */
6042 spr_register(env
, SPR_SDA
, "SDA",
6043 SPR_NOACCESS
, SPR_NOACCESS
,
6044 &spr_read_generic
, &spr_write_generic
,
6046 /* Hardware implementation registers */
6047 /* XXX : not implemented */
6048 spr_register(env
, SPR_HID0
, "HID0",
6049 SPR_NOACCESS
, SPR_NOACCESS
,
6050 &spr_read_generic
, &spr_write_generic
,
6052 /* XXX : not implemented */
6053 spr_register(env
, SPR_HID1
, "HID1",
6054 SPR_NOACCESS
, SPR_NOACCESS
,
6055 &spr_read_generic
, &spr_write_generic
,
6057 /* Memory management */
6059 /* PowerPC 750cx has 8 DBATs and 8 IBATs */
6061 init_excp_750cx(env
);
6062 env
->dcache_line_size
= 32;
6063 env
->icache_line_size
= 32;
6064 /* Allocate hardware IRQ controller */
6065 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6068 POWERPC_FAMILY(750cx
)(ObjectClass
*oc
, void *data
)
6070 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6071 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6073 dc
->desc
= "PowerPC 750CX";
6074 pcc
->init_proc
= init_proc_750cx
;
6075 pcc
->check_pow
= check_pow_hid0
;
6076 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6077 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6078 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6079 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6080 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6081 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6082 PPC_SEGMENT
| PPC_EXTERN
;
6083 pcc
->msr_mask
= (1ull << MSR_POW
) |
6099 pcc
->mmu_model
= POWERPC_MMU_32B
;
6100 #if defined(CONFIG_SOFTMMU)
6101 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6103 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6104 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6105 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6106 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6107 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6110 static void init_proc_750fx (CPUPPCState
*env
)
6112 gen_spr_ne_601(env
);
6114 /* XXX : not implemented */
6115 spr_register(env
, SPR_L2CR
, "L2CR",
6116 SPR_NOACCESS
, SPR_NOACCESS
,
6117 &spr_read_generic
, spr_access_nop
,
6121 /* Thermal management */
6123 /* XXX : not implemented */
6124 spr_register(env
, SPR_750_THRM4
, "THRM4",
6125 SPR_NOACCESS
, SPR_NOACCESS
,
6126 &spr_read_generic
, &spr_write_generic
,
6128 /* Hardware implementation registers */
6129 /* XXX : not implemented */
6130 spr_register(env
, SPR_HID0
, "HID0",
6131 SPR_NOACCESS
, SPR_NOACCESS
,
6132 &spr_read_generic
, &spr_write_generic
,
6134 /* XXX : not implemented */
6135 spr_register(env
, SPR_HID1
, "HID1",
6136 SPR_NOACCESS
, SPR_NOACCESS
,
6137 &spr_read_generic
, &spr_write_generic
,
6139 /* XXX : not implemented */
6140 spr_register(env
, SPR_750FX_HID2
, "HID2",
6141 SPR_NOACCESS
, SPR_NOACCESS
,
6142 &spr_read_generic
, &spr_write_generic
,
6144 /* Memory management */
6146 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6149 env
->dcache_line_size
= 32;
6150 env
->icache_line_size
= 32;
6151 /* Allocate hardware IRQ controller */
6152 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6155 POWERPC_FAMILY(750fx
)(ObjectClass
*oc
, void *data
)
6157 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6158 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6160 dc
->desc
= "PowerPC 750FX";
6161 pcc
->init_proc
= init_proc_750fx
;
6162 pcc
->check_pow
= check_pow_hid0
;
6163 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6164 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6165 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6166 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6167 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6168 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6169 PPC_SEGMENT
| PPC_EXTERN
;
6170 pcc
->msr_mask
= (1ull << MSR_POW
) |
6186 pcc
->mmu_model
= POWERPC_MMU_32B
;
6187 #if defined(CONFIG_SOFTMMU)
6188 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6190 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6191 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6192 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6193 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6194 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6197 static void init_proc_750gx (CPUPPCState
*env
)
6199 gen_spr_ne_601(env
);
6201 /* XXX : not implemented (XXX: different from 750fx) */
6202 spr_register(env
, SPR_L2CR
, "L2CR",
6203 SPR_NOACCESS
, SPR_NOACCESS
,
6204 &spr_read_generic
, spr_access_nop
,
6208 /* Thermal management */
6210 /* XXX : not implemented */
6211 spr_register(env
, SPR_750_THRM4
, "THRM4",
6212 SPR_NOACCESS
, SPR_NOACCESS
,
6213 &spr_read_generic
, &spr_write_generic
,
6215 /* Hardware implementation registers */
6216 /* XXX : not implemented (XXX: different from 750fx) */
6217 spr_register(env
, SPR_HID0
, "HID0",
6218 SPR_NOACCESS
, SPR_NOACCESS
,
6219 &spr_read_generic
, &spr_write_generic
,
6221 /* XXX : not implemented */
6222 spr_register(env
, SPR_HID1
, "HID1",
6223 SPR_NOACCESS
, SPR_NOACCESS
,
6224 &spr_read_generic
, &spr_write_generic
,
6226 /* XXX : not implemented (XXX: different from 750fx) */
6227 spr_register(env
, SPR_750FX_HID2
, "HID2",
6228 SPR_NOACCESS
, SPR_NOACCESS
,
6229 &spr_read_generic
, &spr_write_generic
,
6231 /* Memory management */
6233 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6236 env
->dcache_line_size
= 32;
6237 env
->icache_line_size
= 32;
6238 /* Allocate hardware IRQ controller */
6239 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6242 POWERPC_FAMILY(750gx
)(ObjectClass
*oc
, void *data
)
6244 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6245 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6247 dc
->desc
= "PowerPC 750GX";
6248 pcc
->init_proc
= init_proc_750gx
;
6249 pcc
->check_pow
= check_pow_hid0
;
6250 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6251 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6252 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6253 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6254 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6255 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6256 PPC_SEGMENT
| PPC_EXTERN
;
6257 pcc
->msr_mask
= (1ull << MSR_POW
) |
6273 pcc
->mmu_model
= POWERPC_MMU_32B
;
6274 #if defined(CONFIG_SOFTMMU)
6275 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6277 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6278 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6279 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6280 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6281 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6284 static void init_proc_745 (CPUPPCState
*env
)
6286 gen_spr_ne_601(env
);
6288 gen_spr_G2_755(env
);
6291 /* Thermal management */
6293 /* Hardware implementation registers */
6294 /* XXX : not implemented */
6295 spr_register(env
, SPR_HID0
, "HID0",
6296 SPR_NOACCESS
, SPR_NOACCESS
,
6297 &spr_read_generic
, &spr_write_generic
,
6299 /* XXX : not implemented */
6300 spr_register(env
, SPR_HID1
, "HID1",
6301 SPR_NOACCESS
, SPR_NOACCESS
,
6302 &spr_read_generic
, &spr_write_generic
,
6304 /* XXX : not implemented */
6305 spr_register(env
, SPR_HID2
, "HID2",
6306 SPR_NOACCESS
, SPR_NOACCESS
,
6307 &spr_read_generic
, &spr_write_generic
,
6309 /* Memory management */
6312 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6314 env
->dcache_line_size
= 32;
6315 env
->icache_line_size
= 32;
6316 /* Allocate hardware IRQ controller */
6317 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6320 POWERPC_FAMILY(745)(ObjectClass
*oc
, void *data
)
6322 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6323 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6325 dc
->desc
= "PowerPC 745";
6326 pcc
->init_proc
= init_proc_745
;
6327 pcc
->check_pow
= check_pow_hid0
;
6328 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6329 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6330 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6331 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6332 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6333 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6334 PPC_SEGMENT
| PPC_EXTERN
;
6335 pcc
->msr_mask
= (1ull << MSR_POW
) |
6351 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6352 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6353 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6354 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6355 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6356 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6359 static void init_proc_755 (CPUPPCState
*env
)
6361 gen_spr_ne_601(env
);
6363 gen_spr_G2_755(env
);
6366 /* L2 cache control */
6367 /* XXX : not implemented */
6368 spr_register(env
, SPR_L2CR
, "L2CR",
6369 SPR_NOACCESS
, SPR_NOACCESS
,
6370 &spr_read_generic
, spr_access_nop
,
6372 /* XXX : not implemented */
6373 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6374 SPR_NOACCESS
, SPR_NOACCESS
,
6375 &spr_read_generic
, &spr_write_generic
,
6377 /* Thermal management */
6379 /* Hardware implementation registers */
6380 /* XXX : not implemented */
6381 spr_register(env
, SPR_HID0
, "HID0",
6382 SPR_NOACCESS
, SPR_NOACCESS
,
6383 &spr_read_generic
, &spr_write_generic
,
6385 /* XXX : not implemented */
6386 spr_register(env
, SPR_HID1
, "HID1",
6387 SPR_NOACCESS
, SPR_NOACCESS
,
6388 &spr_read_generic
, &spr_write_generic
,
6390 /* XXX : not implemented */
6391 spr_register(env
, SPR_HID2
, "HID2",
6392 SPR_NOACCESS
, SPR_NOACCESS
,
6393 &spr_read_generic
, &spr_write_generic
,
6395 /* Memory management */
6398 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6400 env
->dcache_line_size
= 32;
6401 env
->icache_line_size
= 32;
6402 /* Allocate hardware IRQ controller */
6403 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6406 POWERPC_FAMILY(755)(ObjectClass
*oc
, void *data
)
6408 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6409 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6411 dc
->desc
= "PowerPC 755";
6412 pcc
->init_proc
= init_proc_755
;
6413 pcc
->check_pow
= check_pow_hid0
;
6414 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6415 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6416 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6417 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6418 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6419 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6420 PPC_SEGMENT
| PPC_EXTERN
;
6421 pcc
->msr_mask
= (1ull << MSR_POW
) |
6437 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6438 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6439 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6440 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6441 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6442 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6445 static void init_proc_7400 (CPUPPCState
*env
)
6447 gen_spr_ne_601(env
);
6451 /* 74xx specific SPR */
6453 /* XXX : not implemented */
6454 spr_register(env
, SPR_UBAMR
, "UBAMR",
6455 &spr_read_ureg
, SPR_NOACCESS
,
6456 &spr_read_ureg
, SPR_NOACCESS
,
6458 /* XXX: this seems not implemented on all revisions. */
6459 /* XXX : not implemented */
6460 spr_register(env
, SPR_MSSCR1
, "MSSCR1",
6461 SPR_NOACCESS
, SPR_NOACCESS
,
6462 &spr_read_generic
, &spr_write_generic
,
6464 /* Thermal management */
6466 /* Memory management */
6468 init_excp_7400(env
);
6469 env
->dcache_line_size
= 32;
6470 env
->icache_line_size
= 32;
6471 /* Allocate hardware IRQ controller */
6472 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6475 POWERPC_FAMILY(7400)(ObjectClass
*oc
, void *data
)
6477 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6478 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6480 dc
->desc
= "PowerPC 7400 (aka G4)";
6481 pcc
->init_proc
= init_proc_7400
;
6482 pcc
->check_pow
= check_pow_hid0
;
6483 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6484 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6485 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6487 PPC_CACHE
| PPC_CACHE_ICBI
|
6488 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6489 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6490 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6492 PPC_SEGMENT
| PPC_EXTERN
|
6494 pcc
->msr_mask
= (1ull << MSR_VR
) |
6511 pcc
->mmu_model
= POWERPC_MMU_32B
;
6512 #if defined(CONFIG_SOFTMMU)
6513 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6515 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6516 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6517 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6518 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6519 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6520 POWERPC_FLAG_BUS_CLK
;
6523 static void init_proc_7410 (CPUPPCState
*env
)
6525 gen_spr_ne_601(env
);
6529 /* 74xx specific SPR */
6531 /* XXX : not implemented */
6532 spr_register(env
, SPR_UBAMR
, "UBAMR",
6533 &spr_read_ureg
, SPR_NOACCESS
,
6534 &spr_read_ureg
, SPR_NOACCESS
,
6536 /* Thermal management */
6539 /* XXX : not implemented */
6540 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6541 SPR_NOACCESS
, SPR_NOACCESS
,
6542 &spr_read_generic
, &spr_write_generic
,
6545 /* XXX : not implemented */
6546 spr_register(env
, SPR_LDSTDB
, "LDSTDB",
6547 SPR_NOACCESS
, SPR_NOACCESS
,
6548 &spr_read_generic
, &spr_write_generic
,
6550 /* Memory management */
6552 init_excp_7400(env
);
6553 env
->dcache_line_size
= 32;
6554 env
->icache_line_size
= 32;
6555 /* Allocate hardware IRQ controller */
6556 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6559 POWERPC_FAMILY(7410)(ObjectClass
*oc
, void *data
)
6561 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6562 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6564 dc
->desc
= "PowerPC 7410 (aka G4)";
6565 pcc
->init_proc
= init_proc_7410
;
6566 pcc
->check_pow
= check_pow_hid0
;
6567 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6568 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6569 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6571 PPC_CACHE
| PPC_CACHE_ICBI
|
6572 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6573 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6574 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6576 PPC_SEGMENT
| PPC_EXTERN
|
6578 pcc
->msr_mask
= (1ull << MSR_VR
) |
6595 pcc
->mmu_model
= POWERPC_MMU_32B
;
6596 #if defined(CONFIG_SOFTMMU)
6597 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6599 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6600 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6601 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6602 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6603 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6604 POWERPC_FLAG_BUS_CLK
;
6607 static void init_proc_7440 (CPUPPCState
*env
)
6609 gen_spr_ne_601(env
);
6613 /* 74xx specific SPR */
6615 /* XXX : not implemented */
6616 spr_register(env
, SPR_UBAMR
, "UBAMR",
6617 &spr_read_ureg
, SPR_NOACCESS
,
6618 &spr_read_ureg
, SPR_NOACCESS
,
6621 /* XXX : not implemented */
6622 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6623 SPR_NOACCESS
, SPR_NOACCESS
,
6624 &spr_read_generic
, &spr_write_generic
,
6627 /* XXX : not implemented */
6628 spr_register(env
, SPR_ICTRL
, "ICTRL",
6629 SPR_NOACCESS
, SPR_NOACCESS
,
6630 &spr_read_generic
, &spr_write_generic
,
6633 /* XXX : not implemented */
6634 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6635 SPR_NOACCESS
, SPR_NOACCESS
,
6636 &spr_read_generic
, &spr_write_generic
,
6639 /* XXX : not implemented */
6640 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6641 SPR_NOACCESS
, SPR_NOACCESS
,
6642 &spr_read_generic
, &spr_write_generic
,
6644 /* XXX : not implemented */
6645 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6646 &spr_read_ureg
, SPR_NOACCESS
,
6647 &spr_read_ureg
, SPR_NOACCESS
,
6649 /* XXX : not implemented */
6650 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6651 SPR_NOACCESS
, SPR_NOACCESS
,
6652 &spr_read_generic
, &spr_write_generic
,
6654 /* XXX : not implemented */
6655 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6656 &spr_read_ureg
, SPR_NOACCESS
,
6657 &spr_read_ureg
, SPR_NOACCESS
,
6659 /* Memory management */
6661 gen_74xx_soft_tlb(env
, 128, 2);
6662 init_excp_7450(env
);
6663 env
->dcache_line_size
= 32;
6664 env
->icache_line_size
= 32;
6665 /* Allocate hardware IRQ controller */
6666 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6669 POWERPC_FAMILY(7440)(ObjectClass
*oc
, void *data
)
6671 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6672 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6674 dc
->desc
= "PowerPC 7440 (aka G4)";
6675 pcc
->init_proc
= init_proc_7440
;
6676 pcc
->check_pow
= check_pow_hid0_74xx
;
6677 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6678 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6679 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6681 PPC_CACHE
| PPC_CACHE_ICBI
|
6682 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6683 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6684 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6685 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6686 PPC_SEGMENT
| PPC_EXTERN
|
6688 pcc
->msr_mask
= (1ull << MSR_VR
) |
6705 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6706 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6707 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6708 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6709 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6710 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6711 POWERPC_FLAG_BUS_CLK
;
6714 static void init_proc_7450 (CPUPPCState
*env
)
6716 gen_spr_ne_601(env
);
6720 /* 74xx specific SPR */
6722 /* Level 3 cache control */
6725 /* XXX : not implemented */
6726 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
6727 SPR_NOACCESS
, SPR_NOACCESS
,
6728 &spr_read_generic
, &spr_write_generic
,
6731 /* XXX : not implemented */
6732 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
6733 SPR_NOACCESS
, SPR_NOACCESS
,
6734 &spr_read_generic
, &spr_write_generic
,
6737 /* XXX : not implemented */
6738 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
6739 SPR_NOACCESS
, SPR_NOACCESS
,
6740 &spr_read_generic
, &spr_write_generic
,
6743 /* XXX : not implemented */
6744 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
6745 SPR_NOACCESS
, SPR_NOACCESS
,
6746 &spr_read_generic
, &spr_write_generic
,
6748 /* XXX : not implemented */
6749 spr_register(env
, SPR_UBAMR
, "UBAMR",
6750 &spr_read_ureg
, SPR_NOACCESS
,
6751 &spr_read_ureg
, SPR_NOACCESS
,
6754 /* XXX : not implemented */
6755 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6756 SPR_NOACCESS
, SPR_NOACCESS
,
6757 &spr_read_generic
, &spr_write_generic
,
6760 /* XXX : not implemented */
6761 spr_register(env
, SPR_ICTRL
, "ICTRL",
6762 SPR_NOACCESS
, SPR_NOACCESS
,
6763 &spr_read_generic
, &spr_write_generic
,
6766 /* XXX : not implemented */
6767 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6768 SPR_NOACCESS
, SPR_NOACCESS
,
6769 &spr_read_generic
, &spr_write_generic
,
6772 /* XXX : not implemented */
6773 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6774 SPR_NOACCESS
, SPR_NOACCESS
,
6775 &spr_read_generic
, &spr_write_generic
,
6777 /* XXX : not implemented */
6778 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6779 &spr_read_ureg
, SPR_NOACCESS
,
6780 &spr_read_ureg
, SPR_NOACCESS
,
6782 /* XXX : not implemented */
6783 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6784 SPR_NOACCESS
, SPR_NOACCESS
,
6785 &spr_read_generic
, &spr_write_generic
,
6787 /* XXX : not implemented */
6788 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6789 &spr_read_ureg
, SPR_NOACCESS
,
6790 &spr_read_ureg
, SPR_NOACCESS
,
6792 /* Memory management */
6794 gen_74xx_soft_tlb(env
, 128, 2);
6795 init_excp_7450(env
);
6796 env
->dcache_line_size
= 32;
6797 env
->icache_line_size
= 32;
6798 /* Allocate hardware IRQ controller */
6799 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6802 POWERPC_FAMILY(7450)(ObjectClass
*oc
, void *data
)
6804 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6805 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6807 dc
->desc
= "PowerPC 7450 (aka G4)";
6808 pcc
->init_proc
= init_proc_7450
;
6809 pcc
->check_pow
= check_pow_hid0_74xx
;
6810 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6811 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6812 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6814 PPC_CACHE
| PPC_CACHE_ICBI
|
6815 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6816 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6817 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6818 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6819 PPC_SEGMENT
| PPC_EXTERN
|
6821 pcc
->msr_mask
= (1ull << MSR_VR
) |
6838 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6839 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6840 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6841 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6842 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6843 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6844 POWERPC_FLAG_BUS_CLK
;
6847 static void init_proc_7445 (CPUPPCState
*env
)
6849 gen_spr_ne_601(env
);
6853 /* 74xx specific SPR */
6856 /* XXX : not implemented */
6857 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6858 SPR_NOACCESS
, SPR_NOACCESS
,
6859 &spr_read_generic
, &spr_write_generic
,
6862 /* XXX : not implemented */
6863 spr_register(env
, SPR_ICTRL
, "ICTRL",
6864 SPR_NOACCESS
, SPR_NOACCESS
,
6865 &spr_read_generic
, &spr_write_generic
,
6868 /* XXX : not implemented */
6869 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6870 SPR_NOACCESS
, SPR_NOACCESS
,
6871 &spr_read_generic
, &spr_write_generic
,
6874 /* XXX : not implemented */
6875 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6876 SPR_NOACCESS
, SPR_NOACCESS
,
6877 &spr_read_generic
, &spr_write_generic
,
6879 /* XXX : not implemented */
6880 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6881 &spr_read_ureg
, SPR_NOACCESS
,
6882 &spr_read_ureg
, SPR_NOACCESS
,
6884 /* XXX : not implemented */
6885 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6886 SPR_NOACCESS
, SPR_NOACCESS
,
6887 &spr_read_generic
, &spr_write_generic
,
6889 /* XXX : not implemented */
6890 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6891 &spr_read_ureg
, SPR_NOACCESS
,
6892 &spr_read_ureg
, SPR_NOACCESS
,
6895 spr_register(env
, SPR_SPRG4
, "SPRG4",
6896 SPR_NOACCESS
, SPR_NOACCESS
,
6897 &spr_read_generic
, &spr_write_generic
,
6899 spr_register(env
, SPR_USPRG4
, "USPRG4",
6900 &spr_read_ureg
, SPR_NOACCESS
,
6901 &spr_read_ureg
, SPR_NOACCESS
,
6903 spr_register(env
, SPR_SPRG5
, "SPRG5",
6904 SPR_NOACCESS
, SPR_NOACCESS
,
6905 &spr_read_generic
, &spr_write_generic
,
6907 spr_register(env
, SPR_USPRG5
, "USPRG5",
6908 &spr_read_ureg
, SPR_NOACCESS
,
6909 &spr_read_ureg
, SPR_NOACCESS
,
6911 spr_register(env
, SPR_SPRG6
, "SPRG6",
6912 SPR_NOACCESS
, SPR_NOACCESS
,
6913 &spr_read_generic
, &spr_write_generic
,
6915 spr_register(env
, SPR_USPRG6
, "USPRG6",
6916 &spr_read_ureg
, SPR_NOACCESS
,
6917 &spr_read_ureg
, SPR_NOACCESS
,
6919 spr_register(env
, SPR_SPRG7
, "SPRG7",
6920 SPR_NOACCESS
, SPR_NOACCESS
,
6921 &spr_read_generic
, &spr_write_generic
,
6923 spr_register(env
, SPR_USPRG7
, "USPRG7",
6924 &spr_read_ureg
, SPR_NOACCESS
,
6925 &spr_read_ureg
, SPR_NOACCESS
,
6927 /* Memory management */
6930 gen_74xx_soft_tlb(env
, 128, 2);
6931 init_excp_7450(env
);
6932 env
->dcache_line_size
= 32;
6933 env
->icache_line_size
= 32;
6934 /* Allocate hardware IRQ controller */
6935 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6938 POWERPC_FAMILY(7445)(ObjectClass
*oc
, void *data
)
6940 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6941 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6943 dc
->desc
= "PowerPC 7445 (aka G4)";
6944 pcc
->init_proc
= init_proc_7445
;
6945 pcc
->check_pow
= check_pow_hid0_74xx
;
6946 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6947 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6948 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6950 PPC_CACHE
| PPC_CACHE_ICBI
|
6951 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6952 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6953 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6954 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6955 PPC_SEGMENT
| PPC_EXTERN
|
6957 pcc
->msr_mask
= (1ull << MSR_VR
) |
6974 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6975 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6976 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6977 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6978 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6979 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6980 POWERPC_FLAG_BUS_CLK
;
6983 static void init_proc_7455 (CPUPPCState
*env
)
6985 gen_spr_ne_601(env
);
6989 /* 74xx specific SPR */
6991 /* Level 3 cache control */
6994 /* XXX : not implemented */
6995 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6996 SPR_NOACCESS
, SPR_NOACCESS
,
6997 &spr_read_generic
, &spr_write_generic
,
7000 /* XXX : not implemented */
7001 spr_register(env
, SPR_ICTRL
, "ICTRL",
7002 SPR_NOACCESS
, SPR_NOACCESS
,
7003 &spr_read_generic
, &spr_write_generic
,
7006 /* XXX : not implemented */
7007 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7008 SPR_NOACCESS
, SPR_NOACCESS
,
7009 &spr_read_generic
, &spr_write_generic
,
7012 /* XXX : not implemented */
7013 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7014 SPR_NOACCESS
, SPR_NOACCESS
,
7015 &spr_read_generic
, &spr_write_generic
,
7017 /* XXX : not implemented */
7018 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7019 &spr_read_ureg
, SPR_NOACCESS
,
7020 &spr_read_ureg
, SPR_NOACCESS
,
7022 /* XXX : not implemented */
7023 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7024 SPR_NOACCESS
, SPR_NOACCESS
,
7025 &spr_read_generic
, &spr_write_generic
,
7027 /* XXX : not implemented */
7028 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7029 &spr_read_ureg
, SPR_NOACCESS
,
7030 &spr_read_ureg
, SPR_NOACCESS
,
7033 spr_register(env
, SPR_SPRG4
, "SPRG4",
7034 SPR_NOACCESS
, SPR_NOACCESS
,
7035 &spr_read_generic
, &spr_write_generic
,
7037 spr_register(env
, SPR_USPRG4
, "USPRG4",
7038 &spr_read_ureg
, SPR_NOACCESS
,
7039 &spr_read_ureg
, SPR_NOACCESS
,
7041 spr_register(env
, SPR_SPRG5
, "SPRG5",
7042 SPR_NOACCESS
, SPR_NOACCESS
,
7043 &spr_read_generic
, &spr_write_generic
,
7045 spr_register(env
, SPR_USPRG5
, "USPRG5",
7046 &spr_read_ureg
, SPR_NOACCESS
,
7047 &spr_read_ureg
, SPR_NOACCESS
,
7049 spr_register(env
, SPR_SPRG6
, "SPRG6",
7050 SPR_NOACCESS
, SPR_NOACCESS
,
7051 &spr_read_generic
, &spr_write_generic
,
7053 spr_register(env
, SPR_USPRG6
, "USPRG6",
7054 &spr_read_ureg
, SPR_NOACCESS
,
7055 &spr_read_ureg
, SPR_NOACCESS
,
7057 spr_register(env
, SPR_SPRG7
, "SPRG7",
7058 SPR_NOACCESS
, SPR_NOACCESS
,
7059 &spr_read_generic
, &spr_write_generic
,
7061 spr_register(env
, SPR_USPRG7
, "USPRG7",
7062 &spr_read_ureg
, SPR_NOACCESS
,
7063 &spr_read_ureg
, SPR_NOACCESS
,
7065 /* Memory management */
7068 gen_74xx_soft_tlb(env
, 128, 2);
7069 init_excp_7450(env
);
7070 env
->dcache_line_size
= 32;
7071 env
->icache_line_size
= 32;
7072 /* Allocate hardware IRQ controller */
7073 ppc6xx_irq_init(ppc_env_get_cpu(env
));
7076 POWERPC_FAMILY(7455)(ObjectClass
*oc
, void *data
)
7078 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7079 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7081 dc
->desc
= "PowerPC 7455 (aka G4)";
7082 pcc
->init_proc
= init_proc_7455
;
7083 pcc
->check_pow
= check_pow_hid0_74xx
;
7084 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7085 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7086 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7088 PPC_CACHE
| PPC_CACHE_ICBI
|
7089 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7090 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7091 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7092 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7093 PPC_SEGMENT
| PPC_EXTERN
|
7095 pcc
->msr_mask
= (1ull << MSR_VR
) |
7112 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7113 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7114 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7115 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7116 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7117 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7118 POWERPC_FLAG_BUS_CLK
;
7121 static void init_proc_7457 (CPUPPCState
*env
)
7123 gen_spr_ne_601(env
);
7127 /* 74xx specific SPR */
7129 /* Level 3 cache control */
7132 /* XXX : not implemented */
7133 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
7134 SPR_NOACCESS
, SPR_NOACCESS
,
7135 &spr_read_generic
, &spr_write_generic
,
7138 /* XXX : not implemented */
7139 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
7140 SPR_NOACCESS
, SPR_NOACCESS
,
7141 &spr_read_generic
, &spr_write_generic
,
7144 /* XXX : not implemented */
7145 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
7146 SPR_NOACCESS
, SPR_NOACCESS
,
7147 &spr_read_generic
, &spr_write_generic
,
7150 /* XXX : not implemented */
7151 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
7152 SPR_NOACCESS
, SPR_NOACCESS
,
7153 &spr_read_generic
, &spr_write_generic
,
7156 /* XXX : not implemented */
7157 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7158 SPR_NOACCESS
, SPR_NOACCESS
,
7159 &spr_read_generic
, &spr_write_generic
,
7162 /* XXX : not implemented */
7163 spr_register(env
, SPR_ICTRL
, "ICTRL",
7164 SPR_NOACCESS
, SPR_NOACCESS
,
7165 &spr_read_generic
, &spr_write_generic
,
7168 /* XXX : not implemented */
7169 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7170 SPR_NOACCESS
, SPR_NOACCESS
,
7171 &spr_read_generic
, &spr_write_generic
,
7174 /* XXX : not implemented */
7175 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7176 SPR_NOACCESS
, SPR_NOACCESS
,
7177 &spr_read_generic
, &spr_write_generic
,
7179 /* XXX : not implemented */
7180 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7181 &spr_read_ureg
, SPR_NOACCESS
,
7182 &spr_read_ureg
, SPR_NOACCESS
,
7184 /* XXX : not implemented */
7185 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7186 SPR_NOACCESS
, SPR_NOACCESS
,
7187 &spr_read_generic
, &spr_write_generic
,
7189 /* XXX : not implemented */
7190 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7191 &spr_read_ureg
, SPR_NOACCESS
,
7192 &spr_read_ureg
, SPR_NOACCESS
,
7195 spr_register(env
, SPR_SPRG4
, "SPRG4",
7196 SPR_NOACCESS
, SPR_NOACCESS
,
7197 &spr_read_generic
, &spr_write_generic
,
7199 spr_register(env
, SPR_USPRG4
, "USPRG4",
7200 &spr_read_ureg
, SPR_NOACCESS
,
7201 &spr_read_ureg
, SPR_NOACCESS
,
7203 spr_register(env
, SPR_SPRG5
, "SPRG5",
7204 SPR_NOACCESS
, SPR_NOACCESS
,
7205 &spr_read_generic
, &spr_write_generic
,
7207 spr_register(env
, SPR_USPRG5
, "USPRG5",
7208 &spr_read_ureg
, SPR_NOACCESS
,
7209 &spr_read_ureg
, SPR_NOACCESS
,
7211 spr_register(env
, SPR_SPRG6
, "SPRG6",
7212 SPR_NOACCESS
, SPR_NOACCESS
,
7213 &spr_read_generic
, &spr_write_generic
,
7215 spr_register(env
, SPR_USPRG6
, "USPRG6",
7216 &spr_read_ureg
, SPR_NOACCESS
,
7217 &spr_read_ureg
, SPR_NOACCESS
,
7219 spr_register(env
, SPR_SPRG7
, "SPRG7",
7220 SPR_NOACCESS
, SPR_NOACCESS
,
7221 &spr_read_generic
, &spr_write_generic
,
7223 spr_register(env
, SPR_USPRG7
, "USPRG7",
7224 &spr_read_ureg
, SPR_NOACCESS
,
7225 &spr_read_ureg
, SPR_NOACCESS
,
7227 /* Memory management */
7230 gen_74xx_soft_tlb(env
, 128, 2);
7231 init_excp_7450(env
);
7232 env
->dcache_line_size
= 32;
7233 env
->icache_line_size
= 32;
7234 /* Allocate hardware IRQ controller */
7235 ppc6xx_irq_init(ppc_env_get_cpu(env
));
7238 POWERPC_FAMILY(7457)(ObjectClass
*oc
, void *data
)
7240 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7241 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7243 dc
->desc
= "PowerPC 7457 (aka G4)";
7244 pcc
->init_proc
= init_proc_7457
;
7245 pcc
->check_pow
= check_pow_hid0_74xx
;
7246 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7247 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7248 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7250 PPC_CACHE
| PPC_CACHE_ICBI
|
7251 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7252 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7253 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7254 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7255 PPC_SEGMENT
| PPC_EXTERN
|
7257 pcc
->msr_mask
= (1ull << MSR_VR
) |
7274 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7275 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7276 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7277 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7278 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7279 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7280 POWERPC_FLAG_BUS_CLK
;
7283 static void init_proc_e600 (CPUPPCState
*env
)
7285 gen_spr_ne_601(env
);
7289 /* 74xx specific SPR */
7291 /* XXX : not implemented */
7292 spr_register(env
, SPR_UBAMR
, "UBAMR",
7293 &spr_read_ureg
, SPR_NOACCESS
,
7294 &spr_read_ureg
, SPR_NOACCESS
,
7296 /* XXX : not implemented */
7297 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7298 SPR_NOACCESS
, SPR_NOACCESS
,
7299 &spr_read_generic
, &spr_write_generic
,
7301 /* XXX : not implemented */
7302 spr_register(env
, SPR_ICTRL
, "ICTRL",
7303 SPR_NOACCESS
, SPR_NOACCESS
,
7304 &spr_read_generic
, &spr_write_generic
,
7306 /* XXX : not implemented */
7307 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7308 SPR_NOACCESS
, SPR_NOACCESS
,
7309 &spr_read_generic
, &spr_write_generic
,
7311 /* XXX : not implemented */
7312 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7313 SPR_NOACCESS
, SPR_NOACCESS
,
7314 &spr_read_generic
, &spr_write_generic
,
7316 /* XXX : not implemented */
7317 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7318 &spr_read_ureg
, SPR_NOACCESS
,
7319 &spr_read_ureg
, SPR_NOACCESS
,
7321 /* XXX : not implemented */
7322 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7323 SPR_NOACCESS
, SPR_NOACCESS
,
7324 &spr_read_generic
, &spr_write_generic
,
7326 /* XXX : not implemented */
7327 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7328 &spr_read_ureg
, SPR_NOACCESS
,
7329 &spr_read_ureg
, SPR_NOACCESS
,
7332 spr_register(env
, SPR_SPRG4
, "SPRG4",
7333 SPR_NOACCESS
, SPR_NOACCESS
,
7334 &spr_read_generic
, &spr_write_generic
,
7336 spr_register(env
, SPR_USPRG4
, "USPRG4",
7337 &spr_read_ureg
, SPR_NOACCESS
,
7338 &spr_read_ureg
, SPR_NOACCESS
,
7340 spr_register(env
, SPR_SPRG5
, "SPRG5",
7341 SPR_NOACCESS
, SPR_NOACCESS
,
7342 &spr_read_generic
, &spr_write_generic
,
7344 spr_register(env
, SPR_USPRG5
, "USPRG5",
7345 &spr_read_ureg
, SPR_NOACCESS
,
7346 &spr_read_ureg
, SPR_NOACCESS
,
7348 spr_register(env
, SPR_SPRG6
, "SPRG6",
7349 SPR_NOACCESS
, SPR_NOACCESS
,
7350 &spr_read_generic
, &spr_write_generic
,
7352 spr_register(env
, SPR_USPRG6
, "USPRG6",
7353 &spr_read_ureg
, SPR_NOACCESS
,
7354 &spr_read_ureg
, SPR_NOACCESS
,
7356 spr_register(env
, SPR_SPRG7
, "SPRG7",
7357 SPR_NOACCESS
, SPR_NOACCESS
,
7358 &spr_read_generic
, &spr_write_generic
,
7360 spr_register(env
, SPR_USPRG7
, "USPRG7",
7361 &spr_read_ureg
, SPR_NOACCESS
,
7362 &spr_read_ureg
, SPR_NOACCESS
,
7364 /* Memory management */
7367 gen_74xx_soft_tlb(env
, 128, 2);
7368 init_excp_7450(env
);
7369 env
->dcache_line_size
= 32;
7370 env
->icache_line_size
= 32;
7371 /* Allocate hardware IRQ controller */
7372 ppc6xx_irq_init(ppc_env_get_cpu(env
));
7375 POWERPC_FAMILY(e600
)(ObjectClass
*oc
, void *data
)
7377 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7378 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7380 dc
->desc
= "PowerPC e600";
7381 pcc
->init_proc
= init_proc_e600
;
7382 pcc
->check_pow
= check_pow_hid0_74xx
;
7383 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7384 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7385 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7387 PPC_CACHE
| PPC_CACHE_ICBI
|
7388 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7389 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7390 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7391 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7392 PPC_SEGMENT
| PPC_EXTERN
|
7394 pcc
->insns_flags2
= PPC_NONE
;
7395 pcc
->msr_mask
= (1ull << MSR_VR
) |
7412 pcc
->mmu_model
= POWERPC_MMU_32B
;
7413 #if defined(CONFIG_SOFTMMU)
7414 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
7416 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7417 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7418 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7419 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7420 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7421 POWERPC_FLAG_BUS_CLK
;
7424 #if defined (TARGET_PPC64)
7425 #if defined(CONFIG_USER_ONLY)
7426 #define POWERPC970_HID5_INIT 0x00000080
7428 #define POWERPC970_HID5_INIT 0x00000000
7431 enum BOOK3S_CPU_TYPE
{
7433 BOOK3S_CPU_POWER5PLUS
,
7439 static void gen_fscr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7440 int bit
, int sprn
, int cause
)
7442 TCGv_i32 t1
= tcg_const_i32(bit
);
7443 TCGv_i32 t2
= tcg_const_i32(sprn
);
7444 TCGv_i32 t3
= tcg_const_i32(cause
);
7446 gen_update_current_nip(ctx
);
7447 gen_helper_fscr_facility_check(cpu_env
, t1
, t2
, t3
);
7449 tcg_temp_free_i32(t3
);
7450 tcg_temp_free_i32(t2
);
7451 tcg_temp_free_i32(t1
);
7454 static void gen_msr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7455 int bit
, int sprn
, int cause
)
7457 TCGv_i32 t1
= tcg_const_i32(bit
);
7458 TCGv_i32 t2
= tcg_const_i32(sprn
);
7459 TCGv_i32 t3
= tcg_const_i32(cause
);
7461 gen_update_current_nip(ctx
);
7462 gen_helper_msr_facility_check(cpu_env
, t1
, t2
, t3
);
7464 tcg_temp_free_i32(t3
);
7465 tcg_temp_free_i32(t2
);
7466 tcg_temp_free_i32(t1
);
7469 static void spr_read_prev_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
7471 TCGv spr_up
= tcg_temp_new();
7472 TCGv spr
= tcg_temp_new();
7474 gen_load_spr(spr
, sprn
- 1);
7475 tcg_gen_shri_tl(spr_up
, spr
, 32);
7476 tcg_gen_ext32u_tl(cpu_gpr
[gprn
], spr_up
);
7479 tcg_temp_free(spr_up
);
7482 static void spr_write_prev_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
7484 TCGv spr
= tcg_temp_new();
7486 gen_load_spr(spr
, sprn
- 1);
7487 tcg_gen_deposit_tl(spr
, spr
, cpu_gpr
[gprn
], 32, 32);
7488 gen_store_spr(sprn
- 1, spr
);
7493 static int check_pow_970 (CPUPPCState
*env
)
7495 if (env
->spr
[SPR_HID0
] & (HID0_DEEPNAP
| HID0_DOZE
| HID0_NAP
)) {
7502 static void gen_spr_970_hid(CPUPPCState
*env
)
7504 /* Hardware implementation registers */
7505 /* XXX : not implemented */
7506 spr_register(env
, SPR_HID0
, "HID0",
7507 SPR_NOACCESS
, SPR_NOACCESS
,
7508 &spr_read_generic
, &spr_write_clear
,
7510 spr_register(env
, SPR_HID1
, "HID1",
7511 SPR_NOACCESS
, SPR_NOACCESS
,
7512 &spr_read_generic
, &spr_write_generic
,
7514 spr_register(env
, SPR_970_HID5
, "HID5",
7515 SPR_NOACCESS
, SPR_NOACCESS
,
7516 &spr_read_generic
, &spr_write_generic
,
7517 POWERPC970_HID5_INIT
);
7520 static void gen_spr_970_hior(CPUPPCState
*env
)
7522 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7523 SPR_NOACCESS
, SPR_NOACCESS
,
7524 &spr_read_hior
, &spr_write_hior
,
7528 static void gen_spr_book3s_common(CPUPPCState
*env
)
7530 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
7531 SPR_NOACCESS
, SPR_NOACCESS
,
7532 SPR_NOACCESS
, &spr_write_generic
,
7534 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
7535 &spr_read_ureg
, SPR_NOACCESS
,
7536 &spr_read_ureg
, SPR_NOACCESS
,
7540 static void gen_spr_book3s_altivec(CPUPPCState
*env
)
7542 if (!(env
->insns_flags
& PPC_ALTIVEC
)) {
7546 spr_register_kvm(env
, SPR_VRSAVE
, "VRSAVE",
7547 &spr_read_generic
, &spr_write_generic
,
7548 &spr_read_generic
, &spr_write_generic
,
7549 KVM_REG_PPC_VRSAVE
, 0x00000000);
7551 /* Can't find information on what this should be on reset. This
7552 * value is the one used by 74xx processors. */
7553 vscr_init(env
, 0x00010000);
7556 static void gen_spr_book3s_dbg(CPUPPCState
*env
)
7559 * TODO: different specs define different scopes for these,
7560 * will have to address this:
7561 * 970: super/write and super/read
7562 * powerisa 2.03..2.04: hypv/write and super/read.
7563 * powerisa 2.05 and newer: hypv/write and hypv/read.
7565 spr_register_kvm(env
, SPR_DABR
, "DABR",
7566 SPR_NOACCESS
, SPR_NOACCESS
,
7567 &spr_read_generic
, &spr_write_generic
,
7568 KVM_REG_PPC_DABR
, 0x00000000);
7569 spr_register_kvm(env
, SPR_DABRX
, "DABRX",
7570 SPR_NOACCESS
, SPR_NOACCESS
,
7571 &spr_read_generic
, &spr_write_generic
,
7572 KVM_REG_PPC_DABRX
, 0x00000000);
7575 static void gen_spr_book3s_207_dbg(CPUPPCState
*env
)
7577 spr_register_kvm_hv(env
, SPR_DAWR
, "DAWR",
7578 SPR_NOACCESS
, SPR_NOACCESS
,
7579 SPR_NOACCESS
, SPR_NOACCESS
,
7580 &spr_read_generic
, &spr_write_generic
,
7581 KVM_REG_PPC_DAWR
, 0x00000000);
7582 spr_register_kvm_hv(env
, SPR_DAWRX
, "DAWRX",
7583 SPR_NOACCESS
, SPR_NOACCESS
,
7584 SPR_NOACCESS
, SPR_NOACCESS
,
7585 &spr_read_generic
, &spr_write_generic
,
7586 KVM_REG_PPC_DAWRX
, 0x00000000);
7587 spr_register_kvm_hv(env
, SPR_CIABR
, "CIABR",
7588 SPR_NOACCESS
, SPR_NOACCESS
,
7589 SPR_NOACCESS
, SPR_NOACCESS
,
7590 &spr_read_generic
, &spr_write_generic
,
7591 KVM_REG_PPC_CIABR
, 0x00000000);
7594 static void gen_spr_970_dbg(CPUPPCState
*env
)
7597 spr_register(env
, SPR_IABR
, "IABR",
7598 SPR_NOACCESS
, SPR_NOACCESS
,
7599 &spr_read_generic
, &spr_write_generic
,
7603 static void gen_spr_book3s_pmu_sup(CPUPPCState
*env
)
7605 spr_register_kvm(env
, SPR_POWER_MMCR0
, "MMCR0",
7606 SPR_NOACCESS
, SPR_NOACCESS
,
7607 &spr_read_generic
, &spr_write_generic
,
7608 KVM_REG_PPC_MMCR0
, 0x00000000);
7609 spr_register_kvm(env
, SPR_POWER_MMCR1
, "MMCR1",
7610 SPR_NOACCESS
, SPR_NOACCESS
,
7611 &spr_read_generic
, &spr_write_generic
,
7612 KVM_REG_PPC_MMCR1
, 0x00000000);
7613 spr_register_kvm(env
, SPR_POWER_MMCRA
, "MMCRA",
7614 SPR_NOACCESS
, SPR_NOACCESS
,
7615 &spr_read_generic
, &spr_write_generic
,
7616 KVM_REG_PPC_MMCRA
, 0x00000000);
7617 spr_register_kvm(env
, SPR_POWER_PMC1
, "PMC1",
7618 SPR_NOACCESS
, SPR_NOACCESS
,
7619 &spr_read_generic
, &spr_write_generic
,
7620 KVM_REG_PPC_PMC1
, 0x00000000);
7621 spr_register_kvm(env
, SPR_POWER_PMC2
, "PMC2",
7622 SPR_NOACCESS
, SPR_NOACCESS
,
7623 &spr_read_generic
, &spr_write_generic
,
7624 KVM_REG_PPC_PMC2
, 0x00000000);
7625 spr_register_kvm(env
, SPR_POWER_PMC3
, "PMC3",
7626 SPR_NOACCESS
, SPR_NOACCESS
,
7627 &spr_read_generic
, &spr_write_generic
,
7628 KVM_REG_PPC_PMC3
, 0x00000000);
7629 spr_register_kvm(env
, SPR_POWER_PMC4
, "PMC4",
7630 SPR_NOACCESS
, SPR_NOACCESS
,
7631 &spr_read_generic
, &spr_write_generic
,
7632 KVM_REG_PPC_PMC4
, 0x00000000);
7633 spr_register_kvm(env
, SPR_POWER_PMC5
, "PMC5",
7634 SPR_NOACCESS
, SPR_NOACCESS
,
7635 &spr_read_generic
, &spr_write_generic
,
7636 KVM_REG_PPC_PMC5
, 0x00000000);
7637 spr_register_kvm(env
, SPR_POWER_PMC6
, "PMC6",
7638 SPR_NOACCESS
, SPR_NOACCESS
,
7639 &spr_read_generic
, &spr_write_generic
,
7640 KVM_REG_PPC_PMC6
, 0x00000000);
7641 spr_register_kvm(env
, SPR_POWER_SIAR
, "SIAR",
7642 SPR_NOACCESS
, SPR_NOACCESS
,
7643 &spr_read_generic
, &spr_write_generic
,
7644 KVM_REG_PPC_SIAR
, 0x00000000);
7645 spr_register_kvm(env
, SPR_POWER_SDAR
, "SDAR",
7646 SPR_NOACCESS
, SPR_NOACCESS
,
7647 &spr_read_generic
, &spr_write_generic
,
7648 KVM_REG_PPC_SDAR
, 0x00000000);
7651 static void gen_spr_book3s_pmu_user(CPUPPCState
*env
)
7653 spr_register(env
, SPR_POWER_UMMCR0
, "UMMCR0",
7654 &spr_read_ureg
, SPR_NOACCESS
,
7655 &spr_read_ureg
, &spr_write_ureg
,
7657 spr_register(env
, SPR_POWER_UMMCR1
, "UMMCR1",
7658 &spr_read_ureg
, SPR_NOACCESS
,
7659 &spr_read_ureg
, &spr_write_ureg
,
7661 spr_register(env
, SPR_POWER_UMMCRA
, "UMMCRA",
7662 &spr_read_ureg
, SPR_NOACCESS
,
7663 &spr_read_ureg
, &spr_write_ureg
,
7665 spr_register(env
, SPR_POWER_UPMC1
, "UPMC1",
7666 &spr_read_ureg
, SPR_NOACCESS
,
7667 &spr_read_ureg
, &spr_write_ureg
,
7669 spr_register(env
, SPR_POWER_UPMC2
, "UPMC2",
7670 &spr_read_ureg
, SPR_NOACCESS
,
7671 &spr_read_ureg
, &spr_write_ureg
,
7673 spr_register(env
, SPR_POWER_UPMC3
, "UPMC3",
7674 &spr_read_ureg
, SPR_NOACCESS
,
7675 &spr_read_ureg
, &spr_write_ureg
,
7677 spr_register(env
, SPR_POWER_UPMC4
, "UPMC4",
7678 &spr_read_ureg
, SPR_NOACCESS
,
7679 &spr_read_ureg
, &spr_write_ureg
,
7681 spr_register(env
, SPR_POWER_UPMC5
, "UPMC5",
7682 &spr_read_ureg
, SPR_NOACCESS
,
7683 &spr_read_ureg
, &spr_write_ureg
,
7685 spr_register(env
, SPR_POWER_UPMC6
, "UPMC6",
7686 &spr_read_ureg
, SPR_NOACCESS
,
7687 &spr_read_ureg
, &spr_write_ureg
,
7689 spr_register(env
, SPR_POWER_USIAR
, "USIAR",
7690 &spr_read_ureg
, SPR_NOACCESS
,
7691 &spr_read_ureg
, &spr_write_ureg
,
7693 spr_register(env
, SPR_POWER_USDAR
, "USDAR",
7694 &spr_read_ureg
, SPR_NOACCESS
,
7695 &spr_read_ureg
, &spr_write_ureg
,
7699 static void gen_spr_970_pmu_sup(CPUPPCState
*env
)
7701 spr_register_kvm(env
, SPR_970_PMC7
, "PMC7",
7702 SPR_NOACCESS
, SPR_NOACCESS
,
7703 &spr_read_generic
, &spr_write_generic
,
7704 KVM_REG_PPC_PMC7
, 0x00000000);
7705 spr_register_kvm(env
, SPR_970_PMC8
, "PMC8",
7706 SPR_NOACCESS
, SPR_NOACCESS
,
7707 &spr_read_generic
, &spr_write_generic
,
7708 KVM_REG_PPC_PMC8
, 0x00000000);
7711 static void gen_spr_970_pmu_user(CPUPPCState
*env
)
7713 spr_register(env
, SPR_970_UPMC7
, "UPMC7",
7714 &spr_read_ureg
, SPR_NOACCESS
,
7715 &spr_read_ureg
, &spr_write_ureg
,
7717 spr_register(env
, SPR_970_UPMC8
, "UPMC8",
7718 &spr_read_ureg
, SPR_NOACCESS
,
7719 &spr_read_ureg
, &spr_write_ureg
,
7723 static void gen_spr_power8_pmu_sup(CPUPPCState
*env
)
7725 spr_register_kvm(env
, SPR_POWER_MMCR2
, "MMCR2",
7726 SPR_NOACCESS
, SPR_NOACCESS
,
7727 &spr_read_generic
, &spr_write_generic
,
7728 KVM_REG_PPC_MMCR2
, 0x00000000);
7729 spr_register_kvm(env
, SPR_POWER_MMCRS
, "MMCRS",
7730 SPR_NOACCESS
, SPR_NOACCESS
,
7731 &spr_read_generic
, &spr_write_generic
,
7732 KVM_REG_PPC_MMCRS
, 0x00000000);
7733 spr_register_kvm(env
, SPR_POWER_SIER
, "SIER",
7734 SPR_NOACCESS
, SPR_NOACCESS
,
7735 &spr_read_generic
, &spr_write_generic
,
7736 KVM_REG_PPC_SIER
, 0x00000000);
7737 spr_register_kvm(env
, SPR_POWER_SPMC1
, "SPMC1",
7738 SPR_NOACCESS
, SPR_NOACCESS
,
7739 &spr_read_generic
, &spr_write_generic
,
7740 KVM_REG_PPC_SPMC1
, 0x00000000);
7741 spr_register_kvm(env
, SPR_POWER_SPMC2
, "SPMC2",
7742 SPR_NOACCESS
, SPR_NOACCESS
,
7743 &spr_read_generic
, &spr_write_generic
,
7744 KVM_REG_PPC_SPMC2
, 0x00000000);
7745 spr_register_kvm(env
, SPR_TACR
, "TACR",
7746 SPR_NOACCESS
, SPR_NOACCESS
,
7747 &spr_read_generic
, &spr_write_generic
,
7748 KVM_REG_PPC_TACR
, 0x00000000);
7749 spr_register_kvm(env
, SPR_TCSCR
, "TCSCR",
7750 SPR_NOACCESS
, SPR_NOACCESS
,
7751 &spr_read_generic
, &spr_write_generic
,
7752 KVM_REG_PPC_TCSCR
, 0x00000000);
7753 spr_register_kvm(env
, SPR_CSIGR
, "CSIGR",
7754 SPR_NOACCESS
, SPR_NOACCESS
,
7755 &spr_read_generic
, &spr_write_generic
,
7756 KVM_REG_PPC_CSIGR
, 0x00000000);
7759 static void gen_spr_power8_pmu_user(CPUPPCState
*env
)
7761 spr_register(env
, SPR_POWER_UMMCR2
, "UMMCR2",
7762 &spr_read_ureg
, SPR_NOACCESS
,
7763 &spr_read_ureg
, &spr_write_ureg
,
7765 spr_register(env
, SPR_POWER_USIER
, "USIER",
7766 &spr_read_generic
, SPR_NOACCESS
,
7767 &spr_read_generic
, &spr_write_generic
,
7771 static void gen_spr_power5p_ear(CPUPPCState
*env
)
7773 /* External access control */
7774 spr_register(env
, SPR_EAR
, "EAR",
7775 SPR_NOACCESS
, SPR_NOACCESS
,
7776 &spr_read_generic
, &spr_write_generic
,
7780 #if !defined(CONFIG_USER_ONLY)
7781 static void spr_write_hmer(DisasContext
*ctx
, int sprn
, int gprn
)
7783 TCGv hmer
= tcg_temp_new();
7785 gen_load_spr(hmer
, sprn
);
7786 tcg_gen_and_tl(hmer
, cpu_gpr
[gprn
], hmer
);
7787 gen_store_spr(sprn
, hmer
);
7788 spr_store_dump_spr(sprn
);
7789 tcg_temp_free(hmer
);
7792 static void spr_write_lpcr(DisasContext
*ctx
, int sprn
, int gprn
)
7794 gen_helper_store_lpcr(cpu_env
, cpu_gpr
[gprn
]);
7797 static void spr_write_970_hid4(DisasContext
*ctx
, int sprn
, int gprn
)
7799 #if defined(TARGET_PPC64)
7800 spr_write_generic(ctx
, sprn
, gprn
);
7801 gen_helper_store_lpcr(cpu_env
, cpu_gpr
[gprn
]);
7805 #endif /* !defined(CONFIG_USER_ONLY) */
7807 static void gen_spr_970_lpar(CPUPPCState
*env
)
7809 #if !defined(CONFIG_USER_ONLY)
7810 /* Logical partitionning */
7811 /* PPC970: HID4 is effectively the LPCR */
7812 spr_register(env
, SPR_970_HID4
, "HID4",
7813 SPR_NOACCESS
, SPR_NOACCESS
,
7814 &spr_read_generic
, &spr_write_970_hid4
,
7819 static void gen_spr_power5p_lpar(CPUPPCState
*env
)
7821 #if !defined(CONFIG_USER_ONLY)
7822 /* Logical partitionning */
7823 spr_register_kvm(env
, SPR_LPCR
, "LPCR",
7824 SPR_NOACCESS
, SPR_NOACCESS
,
7825 &spr_read_generic
, &spr_write_lpcr
,
7826 KVM_REG_PPC_LPCR
, LPCR_LPES0
| LPCR_LPES1
);
7830 static void gen_spr_book3s_ids(CPUPPCState
*env
)
7832 /* FIXME: Will need to deal with thread vs core only SPRs */
7834 /* Processor identification */
7835 spr_register_hv(env
, SPR_PIR
, "PIR",
7836 SPR_NOACCESS
, SPR_NOACCESS
,
7837 SPR_NOACCESS
, SPR_NOACCESS
,
7838 &spr_read_generic
, NULL
,
7840 spr_register_hv(env
, SPR_HID0
, "HID0",
7841 SPR_NOACCESS
, SPR_NOACCESS
,
7842 SPR_NOACCESS
, SPR_NOACCESS
,
7843 &spr_read_generic
, &spr_write_generic
,
7845 spr_register_hv(env
, SPR_TSCR
, "TSCR",
7846 SPR_NOACCESS
, SPR_NOACCESS
,
7847 SPR_NOACCESS
, SPR_NOACCESS
,
7848 &spr_read_generic
, &spr_write_generic
,
7850 spr_register_hv(env
, SPR_HMER
, "HMER",
7851 SPR_NOACCESS
, SPR_NOACCESS
,
7852 SPR_NOACCESS
, SPR_NOACCESS
,
7853 &spr_read_generic
, &spr_write_hmer
,
7855 spr_register_hv(env
, SPR_HMEER
, "HMEER",
7856 SPR_NOACCESS
, SPR_NOACCESS
,
7857 SPR_NOACCESS
, SPR_NOACCESS
,
7858 &spr_read_generic
, &spr_write_generic
,
7860 spr_register_hv(env
, SPR_TFMR
, "TFMR",
7861 SPR_NOACCESS
, SPR_NOACCESS
,
7862 SPR_NOACCESS
, SPR_NOACCESS
,
7863 &spr_read_generic
, &spr_write_generic
,
7865 spr_register_hv(env
, SPR_LPIDR
, "LPIDR",
7866 SPR_NOACCESS
, SPR_NOACCESS
,
7867 SPR_NOACCESS
, SPR_NOACCESS
,
7868 &spr_read_generic
, &spr_write_generic
,
7870 spr_register_hv(env
, SPR_HFSCR
, "HFSCR",
7871 SPR_NOACCESS
, SPR_NOACCESS
,
7872 SPR_NOACCESS
, SPR_NOACCESS
,
7873 &spr_read_generic
, &spr_write_generic
,
7875 spr_register_hv(env
, SPR_MMCRC
, "MMCRC",
7876 SPR_NOACCESS
, SPR_NOACCESS
,
7877 SPR_NOACCESS
, SPR_NOACCESS
,
7878 &spr_read_generic
, &spr_write_generic
,
7880 spr_register_hv(env
, SPR_MMCRH
, "MMCRH",
7881 SPR_NOACCESS
, SPR_NOACCESS
,
7882 SPR_NOACCESS
, SPR_NOACCESS
,
7883 &spr_read_generic
, &spr_write_generic
,
7885 spr_register_hv(env
, SPR_HSPRG0
, "HSPRG0",
7886 SPR_NOACCESS
, SPR_NOACCESS
,
7887 SPR_NOACCESS
, SPR_NOACCESS
,
7888 &spr_read_generic
, &spr_write_generic
,
7890 spr_register_hv(env
, SPR_HSPRG1
, "HSPRG1",
7891 SPR_NOACCESS
, SPR_NOACCESS
,
7892 SPR_NOACCESS
, SPR_NOACCESS
,
7893 &spr_read_generic
, &spr_write_generic
,
7895 spr_register_hv(env
, SPR_HSRR0
, "HSRR0",
7896 SPR_NOACCESS
, SPR_NOACCESS
,
7897 SPR_NOACCESS
, SPR_NOACCESS
,
7898 &spr_read_generic
, &spr_write_generic
,
7900 spr_register_hv(env
, SPR_HSRR1
, "HSRR1",
7901 SPR_NOACCESS
, SPR_NOACCESS
,
7902 SPR_NOACCESS
, SPR_NOACCESS
,
7903 &spr_read_generic
, &spr_write_generic
,
7905 spr_register_hv(env
, SPR_HDAR
, "HDAR",
7906 SPR_NOACCESS
, SPR_NOACCESS
,
7907 SPR_NOACCESS
, SPR_NOACCESS
,
7908 &spr_read_generic
, &spr_write_generic
,
7910 spr_register_hv(env
, SPR_HDSISR
, "HDSISR",
7911 SPR_NOACCESS
, SPR_NOACCESS
,
7912 SPR_NOACCESS
, SPR_NOACCESS
,
7913 &spr_read_generic
, &spr_write_generic
,
7915 spr_register_hv(env
, SPR_RMOR
, "RMOR",
7916 SPR_NOACCESS
, SPR_NOACCESS
,
7917 SPR_NOACCESS
, SPR_NOACCESS
,
7918 &spr_read_generic
, &spr_write_generic
,
7920 spr_register_hv(env
, SPR_HRMOR
, "HRMOR",
7921 SPR_NOACCESS
, SPR_NOACCESS
,
7922 SPR_NOACCESS
, SPR_NOACCESS
,
7923 &spr_read_generic
, &spr_write_generic
,
7927 static void gen_spr_power8_ids(CPUPPCState
*env
)
7929 /* Thread identification */
7930 spr_register(env
, SPR_TIR
, "TIR",
7931 SPR_NOACCESS
, SPR_NOACCESS
,
7932 &spr_read_generic
, SPR_NOACCESS
,
7936 static void gen_spr_book3s_purr(CPUPPCState
*env
)
7938 #if !defined(CONFIG_USER_ONLY)
7939 /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
7940 spr_register_kvm(env
, SPR_PURR
, "PURR",
7941 &spr_read_purr
, SPR_NOACCESS
,
7942 &spr_read_purr
, SPR_NOACCESS
,
7943 KVM_REG_PPC_PURR
, 0x00000000);
7944 spr_register_kvm(env
, SPR_SPURR
, "SPURR",
7945 &spr_read_purr
, SPR_NOACCESS
,
7946 &spr_read_purr
, SPR_NOACCESS
,
7947 KVM_REG_PPC_SPURR
, 0x00000000);
7951 static void gen_spr_power6_dbg(CPUPPCState
*env
)
7953 #if !defined(CONFIG_USER_ONLY)
7954 spr_register(env
, SPR_CFAR
, "SPR_CFAR",
7955 SPR_NOACCESS
, SPR_NOACCESS
,
7956 &spr_read_cfar
, &spr_write_cfar
,
7961 static void gen_spr_power5p_common(CPUPPCState
*env
)
7963 spr_register_kvm(env
, SPR_PPR
, "PPR",
7964 &spr_read_generic
, &spr_write_generic
,
7965 &spr_read_generic
, &spr_write_generic
,
7966 KVM_REG_PPC_PPR
, 0x00000000);
7969 static void gen_spr_power6_common(CPUPPCState
*env
)
7971 #if !defined(CONFIG_USER_ONLY)
7972 spr_register_kvm(env
, SPR_DSCR
, "SPR_DSCR",
7973 SPR_NOACCESS
, SPR_NOACCESS
,
7974 &spr_read_generic
, &spr_write_generic
,
7975 KVM_REG_PPC_DSCR
, 0x00000000);
7978 * Register PCR to report POWERPC_EXCP_PRIV_REG instead of
7979 * POWERPC_EXCP_INVAL_SPR.
7981 spr_register(env
, SPR_PCR
, "PCR",
7982 SPR_NOACCESS
, SPR_NOACCESS
,
7983 SPR_NOACCESS
, SPR_NOACCESS
,
7987 static void spr_read_tar(DisasContext
*ctx
, int gprn
, int sprn
)
7989 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
7990 spr_read_generic(ctx
, gprn
, sprn
);
7993 static void spr_write_tar(DisasContext
*ctx
, int sprn
, int gprn
)
7995 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
7996 spr_write_generic(ctx
, sprn
, gprn
);
7999 static void gen_spr_power8_tce_address_control(CPUPPCState
*env
)
8001 spr_register_kvm(env
, SPR_TAR
, "TAR",
8002 &spr_read_tar
, &spr_write_tar
,
8003 &spr_read_generic
, &spr_write_generic
,
8004 KVM_REG_PPC_TAR
, 0x00000000);
8007 static void spr_read_tm(DisasContext
*ctx
, int gprn
, int sprn
)
8009 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8010 spr_read_generic(ctx
, gprn
, sprn
);
8013 static void spr_write_tm(DisasContext
*ctx
, int sprn
, int gprn
)
8015 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8016 spr_write_generic(ctx
, sprn
, gprn
);
8019 static void spr_read_tm_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
8021 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8022 spr_read_prev_upper32(ctx
, gprn
, sprn
);
8025 static void spr_write_tm_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
8027 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8028 spr_write_prev_upper32(ctx
, sprn
, gprn
);
8031 static void gen_spr_power8_tm(CPUPPCState
*env
)
8033 spr_register_kvm(env
, SPR_TFHAR
, "TFHAR",
8034 &spr_read_tm
, &spr_write_tm
,
8035 &spr_read_tm
, &spr_write_tm
,
8036 KVM_REG_PPC_TFHAR
, 0x00000000);
8037 spr_register_kvm(env
, SPR_TFIAR
, "TFIAR",
8038 &spr_read_tm
, &spr_write_tm
,
8039 &spr_read_tm
, &spr_write_tm
,
8040 KVM_REG_PPC_TFIAR
, 0x00000000);
8041 spr_register_kvm(env
, SPR_TEXASR
, "TEXASR",
8042 &spr_read_tm
, &spr_write_tm
,
8043 &spr_read_tm
, &spr_write_tm
,
8044 KVM_REG_PPC_TEXASR
, 0x00000000);
8045 spr_register(env
, SPR_TEXASRU
, "TEXASRU",
8046 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
8047 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
8051 static void spr_read_ebb(DisasContext
*ctx
, int gprn
, int sprn
)
8053 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8054 spr_read_generic(ctx
, gprn
, sprn
);
8057 static void spr_write_ebb(DisasContext
*ctx
, int sprn
, int gprn
)
8059 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8060 spr_write_generic(ctx
, sprn
, gprn
);
8063 static void spr_read_ebb_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
8065 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8066 spr_read_prev_upper32(ctx
, gprn
, sprn
);
8069 static void spr_write_ebb_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
8071 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8072 spr_write_prev_upper32(ctx
, sprn
, gprn
);
8075 static void gen_spr_power8_ebb(CPUPPCState
*env
)
8077 spr_register(env
, SPR_BESCRS
, "BESCRS",
8078 &spr_read_ebb
, &spr_write_ebb
,
8079 &spr_read_generic
, &spr_write_generic
,
8081 spr_register(env
, SPR_BESCRSU
, "BESCRSU",
8082 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
8083 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
8085 spr_register(env
, SPR_BESCRR
, "BESCRR",
8086 &spr_read_ebb
, &spr_write_ebb
,
8087 &spr_read_generic
, &spr_write_generic
,
8089 spr_register(env
, SPR_BESCRRU
, "BESCRRU",
8090 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
8091 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
8093 spr_register_kvm(env
, SPR_EBBHR
, "EBBHR",
8094 &spr_read_ebb
, &spr_write_ebb
,
8095 &spr_read_generic
, &spr_write_generic
,
8096 KVM_REG_PPC_EBBHR
, 0x00000000);
8097 spr_register_kvm(env
, SPR_EBBRR
, "EBBRR",
8098 &spr_read_ebb
, &spr_write_ebb
,
8099 &spr_read_generic
, &spr_write_generic
,
8100 KVM_REG_PPC_EBBRR
, 0x00000000);
8101 spr_register_kvm(env
, SPR_BESCR
, "BESCR",
8102 &spr_read_ebb
, &spr_write_ebb
,
8103 &spr_read_generic
, &spr_write_generic
,
8104 KVM_REG_PPC_BESCR
, 0x00000000);
8107 /* Virtual Time Base */
8108 static void gen_spr_vtb(CPUPPCState
*env
)
8110 spr_register(env
, SPR_VTB
, "VTB",
8111 SPR_NOACCESS
, SPR_NOACCESS
,
8112 &spr_read_tbl
, SPR_NOACCESS
,
8116 static void gen_spr_power8_fscr(CPUPPCState
*env
)
8118 #if defined(CONFIG_USER_ONLY)
8119 target_ulong initval
= 1ULL << FSCR_TAR
;
8121 target_ulong initval
= 0;
8123 spr_register_kvm(env
, SPR_FSCR
, "FSCR",
8124 SPR_NOACCESS
, SPR_NOACCESS
,
8125 &spr_read_generic
, &spr_write_generic
,
8126 KVM_REG_PPC_FSCR
, initval
);
8129 static void gen_spr_power8_pspb(CPUPPCState
*env
)
8131 spr_register_kvm(env
, SPR_PSPB
, "PSPB",
8132 SPR_NOACCESS
, SPR_NOACCESS
,
8133 &spr_read_generic
, &spr_write_generic32
,
8134 KVM_REG_PPC_PSPB
, 0);
8137 static void gen_spr_power8_ic(CPUPPCState
*env
)
8139 #if !defined(CONFIG_USER_ONLY)
8140 spr_register_hv(env
, SPR_IC
, "IC",
8141 SPR_NOACCESS
, SPR_NOACCESS
,
8142 &spr_read_generic
, SPR_NOACCESS
,
8143 &spr_read_generic
, &spr_write_generic
,
8148 static void gen_spr_power8_book4(CPUPPCState
*env
)
8150 /* Add a number of P8 book4 registers */
8151 #if !defined(CONFIG_USER_ONLY)
8152 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
8153 SPR_NOACCESS
, SPR_NOACCESS
,
8154 &spr_read_generic
, &spr_write_generic
,
8155 KVM_REG_PPC_ACOP
, 0);
8156 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
8157 SPR_NOACCESS
, SPR_NOACCESS
,
8158 &spr_read_generic
, &spr_write_generic
,
8159 KVM_REG_PPC_PID
, 0);
8160 spr_register_kvm(env
, SPR_WORT
, "WORT",
8161 SPR_NOACCESS
, SPR_NOACCESS
,
8162 &spr_read_generic
, &spr_write_generic
,
8163 KVM_REG_PPC_WORT
, 0);
8167 static void gen_spr_power7_book4(CPUPPCState
*env
)
8169 /* Add a number of P7 book4 registers */
8170 #if !defined(CONFIG_USER_ONLY)
8171 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
8172 SPR_NOACCESS
, SPR_NOACCESS
,
8173 &spr_read_generic
, &spr_write_generic
,
8174 KVM_REG_PPC_ACOP
, 0);
8175 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
8176 SPR_NOACCESS
, SPR_NOACCESS
,
8177 &spr_read_generic
, &spr_write_generic
,
8178 KVM_REG_PPC_PID
, 0);
8182 static void gen_spr_power8_rpr(CPUPPCState
*env
)
8184 #if !defined(CONFIG_USER_ONLY)
8185 spr_register_hv(env
, SPR_RPR
, "RPR",
8186 SPR_NOACCESS
, SPR_NOACCESS
,
8187 SPR_NOACCESS
, SPR_NOACCESS
,
8188 &spr_read_generic
, &spr_write_generic
,
8189 0x00000103070F1F3F);
8193 static void init_proc_book3s_64(CPUPPCState
*env
, int version
)
8195 gen_spr_ne_601(env
);
8197 gen_spr_book3s_altivec(env
);
8198 gen_spr_book3s_pmu_sup(env
);
8199 gen_spr_book3s_pmu_user(env
);
8200 gen_spr_book3s_common(env
);
8203 case BOOK3S_CPU_970
:
8204 case BOOK3S_CPU_POWER5PLUS
:
8205 gen_spr_970_hid(env
);
8206 gen_spr_970_hior(env
);
8208 gen_spr_970_pmu_sup(env
);
8209 gen_spr_970_pmu_user(env
);
8211 case BOOK3S_CPU_POWER7
:
8212 case BOOK3S_CPU_POWER8
:
8213 gen_spr_book3s_ids(env
);
8214 gen_spr_amr(env
, version
>= BOOK3S_CPU_POWER8
);
8215 gen_spr_book3s_purr(env
);
8216 env
->ci_large_pages
= true;
8219 g_assert_not_reached();
8221 if (version
>= BOOK3S_CPU_POWER5PLUS
) {
8222 gen_spr_power5p_common(env
);
8223 gen_spr_power5p_lpar(env
);
8224 gen_spr_power5p_ear(env
);
8226 gen_spr_970_lpar(env
);
8228 if (version
== BOOK3S_CPU_970
) {
8229 gen_spr_970_dbg(env
);
8231 if (version
>= BOOK3S_CPU_POWER6
) {
8232 gen_spr_power6_common(env
);
8233 gen_spr_power6_dbg(env
);
8235 if (version
== BOOK3S_CPU_POWER7
) {
8236 gen_spr_power7_book4(env
);
8238 if (version
>= BOOK3S_CPU_POWER8
) {
8239 gen_spr_power8_tce_address_control(env
);
8240 gen_spr_power8_ids(env
);
8241 gen_spr_power8_ebb(env
);
8242 gen_spr_power8_fscr(env
);
8243 gen_spr_power8_pmu_sup(env
);
8244 gen_spr_power8_pmu_user(env
);
8245 gen_spr_power8_tm(env
);
8246 gen_spr_power8_pspb(env
);
8248 gen_spr_power8_ic(env
);
8249 gen_spr_power8_book4(env
);
8250 gen_spr_power8_rpr(env
);
8252 if (version
< BOOK3S_CPU_POWER8
) {
8253 gen_spr_book3s_dbg(env
);
8255 gen_spr_book3s_207_dbg(env
);
8257 #if !defined(CONFIG_USER_ONLY)
8259 case BOOK3S_CPU_970
:
8260 case BOOK3S_CPU_POWER5PLUS
:
8263 case BOOK3S_CPU_POWER7
:
8264 case BOOK3S_CPU_POWER8
:
8270 /* Allocate hardware IRQ controller */
8272 case BOOK3S_CPU_970
:
8273 case BOOK3S_CPU_POWER5PLUS
:
8275 ppc970_irq_init(ppc_env_get_cpu(env
));
8277 case BOOK3S_CPU_POWER7
:
8278 init_excp_POWER7(env
);
8279 ppcPOWER7_irq_init(ppc_env_get_cpu(env
));
8281 case BOOK3S_CPU_POWER8
:
8282 init_excp_POWER8(env
);
8283 ppcPOWER7_irq_init(ppc_env_get_cpu(env
));
8286 g_assert_not_reached();
8289 env
->dcache_line_size
= 128;
8290 env
->icache_line_size
= 128;
8293 static void init_proc_970(CPUPPCState
*env
)
8295 init_proc_book3s_64(env
, BOOK3S_CPU_970
);
8298 POWERPC_FAMILY(970)(ObjectClass
*oc
, void *data
)
8300 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8301 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8303 dc
->desc
= "PowerPC 970";
8304 pcc
->init_proc
= init_proc_970
;
8305 pcc
->check_pow
= check_pow_970
;
8306 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8307 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8308 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8310 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8311 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8312 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8313 PPC_64B
| PPC_ALTIVEC
|
8314 PPC_SEGMENT_64B
| PPC_SLBI
;
8315 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8316 pcc
->msr_mask
= (1ull << MSR_SF
) |
8331 pcc
->mmu_model
= POWERPC_MMU_64B
;
8332 #if defined(CONFIG_SOFTMMU)
8333 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8335 pcc
->excp_model
= POWERPC_EXCP_970
;
8336 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8337 pcc
->bfd_mach
= bfd_mach_ppc64
;
8338 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8339 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8340 POWERPC_FLAG_BUS_CLK
;
8341 pcc
->l1_dcache_size
= 0x8000;
8342 pcc
->l1_icache_size
= 0x10000;
8345 static void init_proc_power5plus(CPUPPCState
*env
)
8347 init_proc_book3s_64(env
, BOOK3S_CPU_POWER5PLUS
);
8350 POWERPC_FAMILY(POWER5P
)(ObjectClass
*oc
, void *data
)
8352 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8353 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8355 dc
->fw_name
= "PowerPC,POWER5";
8356 dc
->desc
= "POWER5+";
8357 pcc
->init_proc
= init_proc_power5plus
;
8358 pcc
->check_pow
= check_pow_970
;
8359 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8360 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8361 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8363 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8364 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8365 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8367 PPC_SEGMENT_64B
| PPC_SLBI
;
8368 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8369 pcc
->msr_mask
= (1ull << MSR_SF
) |
8384 pcc
->mmu_model
= POWERPC_MMU_2_03
;
8385 #if defined(CONFIG_SOFTMMU)
8386 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8388 pcc
->excp_model
= POWERPC_EXCP_970
;
8389 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8390 pcc
->bfd_mach
= bfd_mach_ppc64
;
8391 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8392 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8393 POWERPC_FLAG_BUS_CLK
;
8394 pcc
->l1_dcache_size
= 0x8000;
8395 pcc
->l1_icache_size
= 0x10000;
8398 static void powerpc_get_compat(Object
*obj
, Visitor
*v
, const char *name
,
8399 void *opaque
, Error
**errp
)
8401 char *value
= (char *)"";
8402 Property
*prop
= opaque
;
8403 uint32_t *max_compat
= qdev_get_prop_ptr(DEVICE(obj
), prop
);
8405 switch (*max_compat
) {
8406 case CPU_POWERPC_LOGICAL_2_05
:
8407 value
= (char *)"power6";
8409 case CPU_POWERPC_LOGICAL_2_06
:
8410 value
= (char *)"power7";
8412 case CPU_POWERPC_LOGICAL_2_07
:
8413 value
= (char *)"power8";
8418 error_setg(errp
, "Internal error: compat is set to %x",
8419 max_compat
? *max_compat
: -1);
8423 visit_type_str(v
, name
, &value
, errp
);
8426 static void powerpc_set_compat(Object
*obj
, Visitor
*v
, const char *name
,
8427 void *opaque
, Error
**errp
)
8429 Error
*error
= NULL
;
8431 Property
*prop
= opaque
;
8432 uint32_t *max_compat
= qdev_get_prop_ptr(DEVICE(obj
), prop
);
8434 visit_type_str(v
, name
, &value
, &error
);
8436 error_propagate(errp
, error
);
8440 if (strcmp(value
, "power6") == 0) {
8441 *max_compat
= CPU_POWERPC_LOGICAL_2_05
;
8442 } else if (strcmp(value
, "power7") == 0) {
8443 *max_compat
= CPU_POWERPC_LOGICAL_2_06
;
8444 } else if (strcmp(value
, "power8") == 0) {
8445 *max_compat
= CPU_POWERPC_LOGICAL_2_07
;
8447 error_setg(errp
, "Invalid compatibility mode \"%s\"", value
);
8453 static PropertyInfo powerpc_compat_propinfo
= {
8455 .description
= "compatibility mode, power6/power7/power8",
8456 .get
= powerpc_get_compat
,
8457 .set
= powerpc_set_compat
,
8460 #define DEFINE_PROP_POWERPC_COMPAT(_n, _s, _f) \
8461 DEFINE_PROP(_n, _s, _f, powerpc_compat_propinfo, uint32_t)
8463 static Property powerpc_servercpu_properties
[] = {
8464 DEFINE_PROP_POWERPC_COMPAT("compat", PowerPCCPU
, max_compat
),
8465 DEFINE_PROP_END_OF_LIST(),
8468 #ifdef CONFIG_SOFTMMU
8469 static const struct ppc_segment_page_sizes POWER7_POWER8_sps
= {
8472 .page_shift
= 12, /* 4K */
8474 .enc
= { { .page_shift
= 12, .pte_enc
= 0 },
8475 { .page_shift
= 16, .pte_enc
= 0x7 },
8476 { .page_shift
= 24, .pte_enc
= 0x38 }, },
8479 .page_shift
= 16, /* 64K */
8480 .slb_enc
= SLB_VSID_64K
,
8481 .enc
= { { .page_shift
= 16, .pte_enc
= 0x1 },
8482 { .page_shift
= 24, .pte_enc
= 0x8 }, },
8485 .page_shift
= 24, /* 16M */
8486 .slb_enc
= SLB_VSID_16M
,
8487 .enc
= { { .page_shift
= 24, .pte_enc
= 0 }, },
8490 .page_shift
= 34, /* 16G */
8491 .slb_enc
= SLB_VSID_16G
,
8492 .enc
= { { .page_shift
= 34, .pte_enc
= 0x3 }, },
8496 #endif /* CONFIG_SOFTMMU */
8498 static void init_proc_POWER7 (CPUPPCState
*env
)
8500 init_proc_book3s_64(env
, BOOK3S_CPU_POWER7
);
8503 static bool ppc_pvr_match_power7(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8505 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7P_BASE
) {
8508 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7_BASE
) {
8514 static bool cpu_has_work_POWER7(CPUState
*cs
)
8516 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
8517 CPUPPCState
*env
= &cpu
->env
;
8520 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
8523 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
8524 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE0
)) {
8527 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
8528 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE1
)) {
8531 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
)) &&
8532 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE2
)) {
8535 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HMI
)) &&
8536 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE2
)) {
8539 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
8544 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
8548 POWERPC_FAMILY(POWER7
)(ObjectClass
*oc
, void *data
)
8550 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8551 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8552 CPUClass
*cc
= CPU_CLASS(oc
);
8554 dc
->fw_name
= "PowerPC,POWER7";
8555 dc
->desc
= "POWER7";
8556 dc
->props
= powerpc_servercpu_properties
;
8557 pcc
->pvr_match
= ppc_pvr_match_power7
;
8558 pcc
->pcr_mask
= PCR_VEC_DIS
| PCR_VSX_DIS
| PCR_COMPAT_2_05
;
8559 pcc
->pcr_supported
= PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8560 pcc
->init_proc
= init_proc_POWER7
;
8561 pcc
->check_pow
= check_pow_nocheck
;
8562 cc
->has_work
= cpu_has_work_POWER7
;
8563 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8564 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8565 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8566 PPC_FLOAT_FRSQRTES
|
8569 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8570 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8571 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8572 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
8573 PPC_SEGMENT_64B
| PPC_SLBI
|
8574 PPC_POPCNTB
| PPC_POPCNTWD
|
8576 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
8577 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8578 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8579 PPC2_FP_TST_ISA206
| PPC2_FP_CVT_S64
|
8581 pcc
->msr_mask
= (1ull << MSR_SF
) |
8597 pcc
->mmu_model
= POWERPC_MMU_2_06
;
8598 #if defined(CONFIG_SOFTMMU)
8599 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8600 pcc
->sps
= &POWER7_POWER8_sps
;
8602 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
8603 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8604 pcc
->bfd_mach
= bfd_mach_ppc64
;
8605 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8606 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8607 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8609 pcc
->l1_dcache_size
= 0x8000;
8610 pcc
->l1_icache_size
= 0x8000;
8611 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8614 static void init_proc_POWER8(CPUPPCState
*env
)
8616 init_proc_book3s_64(env
, BOOK3S_CPU_POWER8
);
8619 static bool ppc_pvr_match_power8(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8621 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8NVL_BASE
) {
8624 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8E_BASE
) {
8627 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8_BASE
) {
8633 static bool cpu_has_work_POWER8(CPUState
*cs
)
8635 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
8636 CPUPPCState
*env
= &cpu
->env
;
8639 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
8642 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
8643 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE2
)) {
8646 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
8647 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE3
)) {
8650 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
)) &&
8651 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE4
)) {
8654 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HMI
)) &&
8655 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE4
)) {
8658 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DOORBELL
)) &&
8659 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE0
)) {
8662 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HDOORBELL
)) &&
8663 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE1
)) {
8666 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
8671 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
8675 POWERPC_FAMILY(POWER8
)(ObjectClass
*oc
, void *data
)
8677 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8678 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8679 CPUClass
*cc
= CPU_CLASS(oc
);
8681 dc
->fw_name
= "PowerPC,POWER8";
8682 dc
->desc
= "POWER8";
8683 dc
->props
= powerpc_servercpu_properties
;
8684 pcc
->pvr_match
= ppc_pvr_match_power8
;
8685 pcc
->pcr_mask
= PCR_TM_DIS
| PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8686 pcc
->pcr_supported
= PCR_COMPAT_2_07
| PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8687 pcc
->init_proc
= init_proc_POWER8
;
8688 pcc
->check_pow
= check_pow_nocheck
;
8689 cc
->has_work
= cpu_has_work_POWER8
;
8690 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8691 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8692 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8693 PPC_FLOAT_FRSQRTES
|
8696 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8697 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8698 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8699 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
8700 PPC_SEGMENT_64B
| PPC_SLBI
|
8701 PPC_POPCNTB
| PPC_POPCNTWD
|
8703 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
8704 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8705 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8706 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
8707 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
8708 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
8709 PPC2_TM
| PPC2_PM_ISA206
;
8710 pcc
->msr_mask
= (1ull << MSR_SF
) |
8728 pcc
->mmu_model
= POWERPC_MMU_2_07
;
8729 #if defined(CONFIG_SOFTMMU)
8730 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8731 pcc
->sps
= &POWER7_POWER8_sps
;
8733 pcc
->excp_model
= POWERPC_EXCP_POWER8
;
8734 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8735 pcc
->bfd_mach
= bfd_mach_ppc64
;
8736 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8737 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8738 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8739 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
;
8740 pcc
->l1_dcache_size
= 0x8000;
8741 pcc
->l1_icache_size
= 0x8000;
8742 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8745 #if !defined(CONFIG_USER_ONLY)
8747 void cpu_ppc_set_papr(PowerPCCPU
*cpu
)
8749 CPUPPCState
*env
= &cpu
->env
;
8750 ppc_spr_t
*lpcr
= &env
->spr_cb
[SPR_LPCR
];
8751 ppc_spr_t
*amor
= &env
->spr_cb
[SPR_AMOR
];
8753 /* PAPR always has exception vectors in RAM not ROM. To ensure this,
8754 * MSR[IP] should never be set.
8756 * We also disallow setting of MSR_HV
8758 env
->msr_mask
&= ~((1ull << MSR_EP
) | MSR_HVB
);
8760 /* Set emulated LPCR to not send interrupts to hypervisor. Note that
8761 * under KVM, the actual HW LPCR will be set differently by KVM itself,
8762 * the settings below ensure proper operations with TCG in absence of
8765 lpcr
->default_value
&= ~(LPCR_VPM0
| LPCR_VPM1
| LPCR_ISL
| LPCR_KBV
);
8766 lpcr
->default_value
|= LPCR_LPES0
| LPCR_LPES1
;
8768 /* P7 and P8 has slightly different PECE bits, mostly because P8 adds
8769 * bit 47 and 48 which are reserved on P7. Here we set them all, which
8770 * will work as expected for both implementations
8772 lpcr
->default_value
|= LPCR_P8_PECE0
| LPCR_P8_PECE1
| LPCR_P8_PECE2
|
8773 LPCR_P8_PECE3
| LPCR_P8_PECE4
;
8775 /* We should be followed by a CPU reset but update the active value
8778 env
->spr
[SPR_LPCR
] = lpcr
->default_value
;
8780 /* Set a full AMOR so guest can use the AMR as it sees fit */
8781 env
->spr
[SPR_AMOR
] = amor
->default_value
= 0xffffffffffffffffull
;
8783 /* Tell KVM that we're in PAPR mode */
8784 if (kvm_enabled()) {
8785 kvmppc_set_papr(cpu
);
8789 #endif /* !defined(CONFIG_USER_ONLY) */
8791 #endif /* defined (TARGET_PPC64) */
8793 /*****************************************************************************/
8794 /* Generic CPU instantiation routine */
8795 static void init_ppc_proc(PowerPCCPU
*cpu
)
8797 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8798 CPUPPCState
*env
= &cpu
->env
;
8799 #if !defined(CONFIG_USER_ONLY)
8802 env
->irq_inputs
= NULL
;
8803 /* Set all exception vectors to an invalid address */
8804 for (i
= 0; i
< POWERPC_EXCP_NB
; i
++)
8805 env
->excp_vectors
[i
] = (target_ulong
)(-1ULL);
8806 env
->ivor_mask
= 0x00000000;
8807 env
->ivpr_mask
= 0x00000000;
8808 /* Default MMU definitions */
8812 env
->tlb_type
= TLB_NONE
;
8814 /* Register SPR common to all PowerPC implementations */
8815 gen_spr_generic(env
);
8816 spr_register(env
, SPR_PVR
, "PVR",
8817 /* Linux permits userspace to read PVR */
8818 #if defined(CONFIG_LINUX_USER)
8824 &spr_read_generic
, SPR_NOACCESS
,
8826 /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
8827 if (pcc
->svr
!= POWERPC_SVR_NONE
) {
8828 if (pcc
->svr
& POWERPC_SVR_E500
) {
8829 spr_register(env
, SPR_E500_SVR
, "SVR",
8830 SPR_NOACCESS
, SPR_NOACCESS
,
8831 &spr_read_generic
, SPR_NOACCESS
,
8832 pcc
->svr
& ~POWERPC_SVR_E500
);
8834 spr_register(env
, SPR_SVR
, "SVR",
8835 SPR_NOACCESS
, SPR_NOACCESS
,
8836 &spr_read_generic
, SPR_NOACCESS
,
8840 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
8841 (*pcc
->init_proc
)(env
);
8843 /* MSR bits & flags consistency checks */
8844 if (env
->msr_mask
& (1 << 25)) {
8845 switch (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
8846 case POWERPC_FLAG_SPE
:
8847 case POWERPC_FLAG_VRE
:
8850 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8851 "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
8854 } else if (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
8855 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8856 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
8859 if (env
->msr_mask
& (1 << 17)) {
8860 switch (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8861 case POWERPC_FLAG_TGPR
:
8862 case POWERPC_FLAG_CE
:
8865 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8866 "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
8869 } else if (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8870 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8871 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
8874 if (env
->msr_mask
& (1 << 10)) {
8875 switch (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8876 POWERPC_FLAG_UBLE
)) {
8877 case POWERPC_FLAG_SE
:
8878 case POWERPC_FLAG_DWE
:
8879 case POWERPC_FLAG_UBLE
:
8882 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8883 "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
8884 "POWERPC_FLAG_UBLE\n");
8887 } else if (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8888 POWERPC_FLAG_UBLE
)) {
8889 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8890 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
8891 "POWERPC_FLAG_UBLE\n");
8894 if (env
->msr_mask
& (1 << 9)) {
8895 switch (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8896 case POWERPC_FLAG_BE
:
8897 case POWERPC_FLAG_DE
:
8900 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8901 "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
8904 } else if (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8905 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8906 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
8909 if (env
->msr_mask
& (1 << 2)) {
8910 switch (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8911 case POWERPC_FLAG_PX
:
8912 case POWERPC_FLAG_PMM
:
8915 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8916 "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
8919 } else if (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8920 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8921 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
8924 if ((env
->flags
& (POWERPC_FLAG_RTC_CLK
| POWERPC_FLAG_BUS_CLK
)) == 0) {
8925 fprintf(stderr
, "PowerPC flags inconsistency\n"
8926 "Should define the time-base and decrementer clock source\n");
8929 /* Allocate TLBs buffer when needed */
8930 #if !defined(CONFIG_USER_ONLY)
8931 if (env
->nb_tlb
!= 0) {
8932 int nb_tlb
= env
->nb_tlb
;
8933 if (env
->id_tlbs
!= 0)
8935 switch (env
->tlb_type
) {
8937 env
->tlb
.tlb6
= g_malloc0(nb_tlb
* sizeof(ppc6xx_tlb_t
));
8940 env
->tlb
.tlbe
= g_malloc0(nb_tlb
* sizeof(ppcemb_tlb_t
));
8943 env
->tlb
.tlbm
= g_malloc0(nb_tlb
* sizeof(ppcmas_tlb_t
));
8946 /* Pre-compute some useful values */
8947 env
->tlb_per_way
= env
->nb_tlb
/ env
->nb_ways
;
8949 if (env
->irq_inputs
== NULL
) {
8950 fprintf(stderr
, "WARNING: no internal IRQ controller registered.\n"
8951 " Attempt QEMU to crash very soon !\n");
8954 if (env
->check_pow
== NULL
) {
8955 fprintf(stderr
, "WARNING: no power management check handler "
8957 " Attempt QEMU to crash very soon !\n");
8961 #if defined(PPC_DUMP_CPU)
8962 static void dump_ppc_sprs (CPUPPCState
*env
)
8965 #if !defined(CONFIG_USER_ONLY)
8971 printf("Special purpose registers:\n");
8972 for (i
= 0; i
< 32; i
++) {
8973 for (j
= 0; j
< 32; j
++) {
8975 spr
= &env
->spr_cb
[n
];
8976 uw
= spr
->uea_write
!= NULL
&& spr
->uea_write
!= SPR_NOACCESS
;
8977 ur
= spr
->uea_read
!= NULL
&& spr
->uea_read
!= SPR_NOACCESS
;
8978 #if !defined(CONFIG_USER_ONLY)
8979 sw
= spr
->oea_write
!= NULL
&& spr
->oea_write
!= SPR_NOACCESS
;
8980 sr
= spr
->oea_read
!= NULL
&& spr
->oea_read
!= SPR_NOACCESS
;
8981 if (sw
|| sr
|| uw
|| ur
) {
8982 printf("SPR: %4d (%03x) %-8s s%c%c u%c%c\n",
8983 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
8984 sw
? 'w' : '-', sr
? 'r' : '-',
8985 uw
? 'w' : '-', ur
? 'r' : '-');
8989 printf("SPR: %4d (%03x) %-8s u%c%c\n",
8990 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
8991 uw
? 'w' : '-', ur
? 'r' : '-');
9001 /*****************************************************************************/
9005 PPC_DIRECT
= 0, /* Opcode routine */
9006 PPC_INDIRECT
= 1, /* Indirect opcode table */
9009 #define PPC_OPCODE_MASK 0x3
9011 static inline int is_indirect_opcode (void *handler
)
9013 return ((uintptr_t)handler
& PPC_OPCODE_MASK
) == PPC_INDIRECT
;
9016 static inline opc_handler_t
**ind_table(void *handler
)
9018 return (opc_handler_t
**)((uintptr_t)handler
& ~PPC_OPCODE_MASK
);
9021 /* Instruction table creation */
9022 /* Opcodes tables creation */
9023 static void fill_new_table (opc_handler_t
**table
, int len
)
9027 for (i
= 0; i
< len
; i
++)
9028 table
[i
] = &invalid_handler
;
9031 static int create_new_table (opc_handler_t
**table
, unsigned char idx
)
9033 opc_handler_t
**tmp
;
9035 tmp
= g_new(opc_handler_t
*, PPC_CPU_INDIRECT_OPCODES_LEN
);
9036 fill_new_table(tmp
, PPC_CPU_INDIRECT_OPCODES_LEN
);
9037 table
[idx
] = (opc_handler_t
*)((uintptr_t)tmp
| PPC_INDIRECT
);
9042 static int insert_in_table (opc_handler_t
**table
, unsigned char idx
,
9043 opc_handler_t
*handler
)
9045 if (table
[idx
] != &invalid_handler
)
9047 table
[idx
] = handler
;
9052 static int register_direct_insn (opc_handler_t
**ppc_opcodes
,
9053 unsigned char idx
, opc_handler_t
*handler
)
9055 if (insert_in_table(ppc_opcodes
, idx
, handler
) < 0) {
9056 printf("*** ERROR: opcode %02x already assigned in main "
9057 "opcode table\n", idx
);
9058 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9059 printf(" Registered handler '%s' - new handler '%s'\n",
9060 ppc_opcodes
[idx
]->oname
, handler
->oname
);
9068 static int register_ind_in_table (opc_handler_t
**table
,
9069 unsigned char idx1
, unsigned char idx2
,
9070 opc_handler_t
*handler
)
9072 if (table
[idx1
] == &invalid_handler
) {
9073 if (create_new_table(table
, idx1
) < 0) {
9074 printf("*** ERROR: unable to create indirect table "
9075 "idx=%02x\n", idx1
);
9079 if (!is_indirect_opcode(table
[idx1
])) {
9080 printf("*** ERROR: idx %02x already assigned to a direct "
9082 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9083 printf(" Registered handler '%s' - new handler '%s'\n",
9084 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
9089 if (handler
!= NULL
&&
9090 insert_in_table(ind_table(table
[idx1
]), idx2
, handler
) < 0) {
9091 printf("*** ERROR: opcode %02x already assigned in "
9092 "opcode table %02x\n", idx2
, idx1
);
9093 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9094 printf(" Registered handler '%s' - new handler '%s'\n",
9095 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
9103 static int register_ind_insn (opc_handler_t
**ppc_opcodes
,
9104 unsigned char idx1
, unsigned char idx2
,
9105 opc_handler_t
*handler
)
9107 return register_ind_in_table(ppc_opcodes
, idx1
, idx2
, handler
);
9110 static int register_dblind_insn (opc_handler_t
**ppc_opcodes
,
9111 unsigned char idx1
, unsigned char idx2
,
9112 unsigned char idx3
, opc_handler_t
*handler
)
9114 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
9115 printf("*** ERROR: unable to join indirect table idx "
9116 "[%02x-%02x]\n", idx1
, idx2
);
9119 if (register_ind_in_table(ind_table(ppc_opcodes
[idx1
]), idx2
, idx3
,
9121 printf("*** ERROR: unable to insert opcode "
9122 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
9129 static int register_insn (opc_handler_t
**ppc_opcodes
, opcode_t
*insn
)
9131 if (insn
->opc2
!= 0xFF) {
9132 if (insn
->opc3
!= 0xFF) {
9133 if (register_dblind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
9134 insn
->opc3
, &insn
->handler
) < 0)
9137 if (register_ind_insn(ppc_opcodes
, insn
->opc1
,
9138 insn
->opc2
, &insn
->handler
) < 0)
9142 if (register_direct_insn(ppc_opcodes
, insn
->opc1
, &insn
->handler
) < 0)
9149 static int test_opcode_table (opc_handler_t
**table
, int len
)
9153 for (i
= 0, count
= 0; i
< len
; i
++) {
9154 /* Consistency fixup */
9155 if (table
[i
] == NULL
)
9156 table
[i
] = &invalid_handler
;
9157 if (table
[i
] != &invalid_handler
) {
9158 if (is_indirect_opcode(table
[i
])) {
9159 tmp
= test_opcode_table(ind_table(table
[i
]),
9160 PPC_CPU_INDIRECT_OPCODES_LEN
);
9163 table
[i
] = &invalid_handler
;
9176 static void fix_opcode_tables (opc_handler_t
**ppc_opcodes
)
9178 if (test_opcode_table(ppc_opcodes
, PPC_CPU_OPCODES_LEN
) == 0)
9179 printf("*** WARNING: no opcode defined !\n");
9182 /*****************************************************************************/
9183 static void create_ppc_opcodes(PowerPCCPU
*cpu
, Error
**errp
)
9185 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9186 CPUPPCState
*env
= &cpu
->env
;
9189 fill_new_table(env
->opcodes
, PPC_CPU_OPCODES_LEN
);
9190 for (opc
= opcodes
; opc
< &opcodes
[ARRAY_SIZE(opcodes
)]; opc
++) {
9191 if (((opc
->handler
.type
& pcc
->insns_flags
) != 0) ||
9192 ((opc
->handler
.type2
& pcc
->insns_flags2
) != 0)) {
9193 if (register_insn(env
->opcodes
, opc
) < 0) {
9194 error_setg(errp
, "ERROR initializing PowerPC instruction "
9195 "0x%02x 0x%02x 0x%02x", opc
->opc1
, opc
->opc2
,
9201 fix_opcode_tables(env
->opcodes
);
9206 #if defined(PPC_DUMP_CPU)
9207 static void dump_ppc_insns (CPUPPCState
*env
)
9209 opc_handler_t
**table
, *handler
;
9211 uint8_t opc1
, opc2
, opc3
;
9213 printf("Instructions set:\n");
9214 /* opc1 is 6 bits long */
9215 for (opc1
= 0x00; opc1
< PPC_CPU_OPCODES_LEN
; opc1
++) {
9216 table
= env
->opcodes
;
9217 handler
= table
[opc1
];
9218 if (is_indirect_opcode(handler
)) {
9219 /* opc2 is 5 bits long */
9220 for (opc2
= 0; opc2
< PPC_CPU_INDIRECT_OPCODES_LEN
; opc2
++) {
9221 table
= env
->opcodes
;
9222 handler
= env
->opcodes
[opc1
];
9223 table
= ind_table(handler
);
9224 handler
= table
[opc2
];
9225 if (is_indirect_opcode(handler
)) {
9226 table
= ind_table(handler
);
9227 /* opc3 is 5 bits long */
9228 for (opc3
= 0; opc3
< PPC_CPU_INDIRECT_OPCODES_LEN
;
9230 handler
= table
[opc3
];
9231 if (handler
->handler
!= &gen_invalid
) {
9232 /* Special hack to properly dump SPE insns */
9233 p
= strchr(handler
->oname
, '_');
9235 printf("INSN: %02x %02x %02x (%02d %04d) : "
9237 opc1
, opc2
, opc3
, opc1
,
9242 if ((p
- handler
->oname
) != strlen(q
) ||
9243 memcmp(handler
->oname
, q
, strlen(q
)) != 0) {
9244 /* First instruction */
9245 printf("INSN: %02x %02x %02x (%02d %04d) : "
9247 opc1
, opc2
<< 1, opc3
, opc1
,
9248 (opc3
<< 6) | (opc2
<< 1),
9249 (int)(p
- handler
->oname
),
9252 if (strcmp(p
+ 1, q
) != 0) {
9253 /* Second instruction */
9254 printf("INSN: %02x %02x %02x (%02d %04d) : "
9256 opc1
, (opc2
<< 1) | 1, opc3
, opc1
,
9257 (opc3
<< 6) | (opc2
<< 1) | 1,
9264 if (handler
->handler
!= &gen_invalid
) {
9265 printf("INSN: %02x %02x -- (%02d %04d) : %s\n",
9266 opc1
, opc2
, opc1
, opc2
, handler
->oname
);
9271 if (handler
->handler
!= &gen_invalid
) {
9272 printf("INSN: %02x -- -- (%02d ----) : %s\n",
9273 opc1
, opc1
, handler
->oname
);
9280 static bool avr_need_swap(CPUPPCState
*env
)
9282 #ifdef HOST_WORDS_BIGENDIAN
9289 static int gdb_get_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9292 stfq_p(mem_buf
, env
->fpr
[n
]);
9293 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9297 stl_p(mem_buf
, env
->fpscr
);
9298 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9304 static int gdb_set_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9307 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9308 env
->fpr
[n
] = ldfq_p(mem_buf
);
9312 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9313 helper_store_fpscr(env
, ldl_p(mem_buf
), 0xffffffff);
9319 static int gdb_get_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9322 if (!avr_need_swap(env
)) {
9323 stq_p(mem_buf
, env
->avr
[n
].u64
[0]);
9324 stq_p(mem_buf
+8, env
->avr
[n
].u64
[1]);
9326 stq_p(mem_buf
, env
->avr
[n
].u64
[1]);
9327 stq_p(mem_buf
+8, env
->avr
[n
].u64
[0]);
9329 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9330 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
9334 stl_p(mem_buf
, env
->vscr
);
9335 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9339 stl_p(mem_buf
, (uint32_t)env
->spr
[SPR_VRSAVE
]);
9340 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9346 static int gdb_set_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9349 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9350 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
9351 if (!avr_need_swap(env
)) {
9352 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
);
9353 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
+8);
9355 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
);
9356 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
+8);
9361 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9362 env
->vscr
= ldl_p(mem_buf
);
9366 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9367 env
->spr
[SPR_VRSAVE
] = (target_ulong
)ldl_p(mem_buf
);
9373 static int gdb_get_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9376 #if defined(TARGET_PPC64)
9377 stl_p(mem_buf
, env
->gpr
[n
] >> 32);
9378 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9380 stl_p(mem_buf
, env
->gprh
[n
]);
9385 stq_p(mem_buf
, env
->spe_acc
);
9386 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9390 stl_p(mem_buf
, env
->spe_fscr
);
9391 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9397 static int gdb_set_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9400 #if defined(TARGET_PPC64)
9401 target_ulong lo
= (uint32_t)env
->gpr
[n
];
9404 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9406 hi
= (target_ulong
)ldl_p(mem_buf
) << 32;
9407 env
->gpr
[n
] = lo
| hi
;
9409 env
->gprh
[n
] = ldl_p(mem_buf
);
9414 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9415 env
->spe_acc
= ldq_p(mem_buf
);
9419 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9420 env
->spe_fscr
= ldl_p(mem_buf
);
9426 static int gdb_get_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9429 stq_p(mem_buf
, env
->vsr
[n
]);
9430 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9436 static int gdb_set_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9439 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9440 env
->vsr
[n
] = ldq_p(mem_buf
);
9446 static int ppc_fixup_cpu(PowerPCCPU
*cpu
)
9448 CPUPPCState
*env
= &cpu
->env
;
9450 /* TCG doesn't (yet) emulate some groups of instructions that
9451 * are implemented on some otherwise supported CPUs (e.g. VSX
9452 * and decimal floating point instructions on POWER7). We
9453 * remove unsupported instruction groups from the cpu state's
9454 * instruction masks and hope the guest can cope. For at
9455 * least the pseries machine, the unavailability of these
9456 * instructions can be advertised to the guest via the device
9458 if ((env
->insns_flags
& ~PPC_TCG_INSNS
)
9459 || (env
->insns_flags2
& ~PPC_TCG_INSNS2
)) {
9460 fprintf(stderr
, "Warning: Disabling some instructions which are not "
9461 "emulated by TCG (0x%" PRIx64
", 0x%" PRIx64
")\n",
9462 env
->insns_flags
& ~PPC_TCG_INSNS
,
9463 env
->insns_flags2
& ~PPC_TCG_INSNS2
);
9465 env
->insns_flags
&= PPC_TCG_INSNS
;
9466 env
->insns_flags2
&= PPC_TCG_INSNS2
;
9470 static inline bool ppc_cpu_is_valid(PowerPCCPUClass
*pcc
)
9472 #ifdef TARGET_PPCEMB
9473 return pcc
->mmu_model
== POWERPC_MMU_BOOKE
||
9474 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx
||
9475 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx_Z
;
9481 static void ppc_cpu_realizefn(DeviceState
*dev
, Error
**errp
)
9483 CPUState
*cs
= CPU(dev
);
9484 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
9485 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9486 Error
*local_err
= NULL
;
9487 #if !defined(CONFIG_USER_ONLY)
9488 int max_smt
= kvm_enabled() ? kvmppc_smt_threads() : 1;
9491 #if !defined(CONFIG_USER_ONLY)
9492 if (smp_threads
> max_smt
) {
9493 error_setg(errp
, "Cannot support more than %d threads on PPC with %s",
9494 max_smt
, kvm_enabled() ? "KVM" : "TCG");
9497 if (!is_power_of_2(smp_threads
)) {
9498 error_setg(errp
, "Cannot support %d threads on PPC with %s, "
9499 "threads count must be a power of 2.",
9500 smp_threads
, kvm_enabled() ? "KVM" : "TCG");
9505 cpu_exec_init(cs
, &local_err
);
9506 if (local_err
!= NULL
) {
9507 error_propagate(errp
, local_err
);
9511 #if !defined(CONFIG_USER_ONLY)
9512 cpu
->cpu_dt_id
= (cs
->cpu_index
/ smp_threads
) * max_smt
9513 + (cs
->cpu_index
% smp_threads
);
9515 if (kvm_enabled() && !kvm_vcpu_id_is_valid(cpu
->cpu_dt_id
)) {
9516 error_setg(errp
, "Can't create CPU with id %d in KVM", cpu
->cpu_dt_id
);
9517 error_append_hint(errp
, "Adjust the number of cpus to %d "
9518 "or try to raise the number of threads per core\n",
9519 cpu
->cpu_dt_id
* smp_threads
/ max_smt
);
9524 if (tcg_enabled()) {
9525 if (ppc_fixup_cpu(cpu
) != 0) {
9526 error_setg(errp
, "Unable to emulate selected CPU with TCG");
9531 #if defined(TARGET_PPCEMB)
9532 if (!ppc_cpu_is_valid(pcc
)) {
9533 error_setg(errp
, "CPU does not possess a BookE or 4xx MMU. "
9534 "Please use qemu-system-ppc or qemu-system-ppc64 instead "
9535 "or choose another CPU model.");
9540 create_ppc_opcodes(cpu
, &local_err
);
9541 if (local_err
!= NULL
) {
9542 error_propagate(errp
, local_err
);
9547 if (pcc
->insns_flags
& PPC_FLOAT
) {
9548 gdb_register_coprocessor(cs
, gdb_get_float_reg
, gdb_set_float_reg
,
9549 33, "power-fpu.xml", 0);
9551 if (pcc
->insns_flags
& PPC_ALTIVEC
) {
9552 gdb_register_coprocessor(cs
, gdb_get_avr_reg
, gdb_set_avr_reg
,
9553 34, "power-altivec.xml", 0);
9555 if (pcc
->insns_flags
& PPC_SPE
) {
9556 gdb_register_coprocessor(cs
, gdb_get_spe_reg
, gdb_set_spe_reg
,
9557 34, "power-spe.xml", 0);
9559 if (pcc
->insns_flags2
& PPC2_VSX
) {
9560 gdb_register_coprocessor(cs
, gdb_get_vsx_reg
, gdb_set_vsx_reg
,
9561 32, "power-vsx.xml", 0);
9566 pcc
->parent_realize(dev
, errp
);
9568 #if defined(PPC_DUMP_CPU)
9570 CPUPPCState
*env
= &cpu
->env
;
9571 const char *mmu_model
, *excp_model
, *bus_model
;
9572 switch (env
->mmu_model
) {
9573 case POWERPC_MMU_32B
:
9574 mmu_model
= "PowerPC 32";
9576 case POWERPC_MMU_SOFT_6xx
:
9577 mmu_model
= "PowerPC 6xx/7xx with software driven TLBs";
9579 case POWERPC_MMU_SOFT_74xx
:
9580 mmu_model
= "PowerPC 74xx with software driven TLBs";
9582 case POWERPC_MMU_SOFT_4xx
:
9583 mmu_model
= "PowerPC 4xx with software driven TLBs";
9585 case POWERPC_MMU_SOFT_4xx_Z
:
9586 mmu_model
= "PowerPC 4xx with software driven TLBs "
9587 "and zones protections";
9589 case POWERPC_MMU_REAL
:
9590 mmu_model
= "PowerPC real mode only";
9592 case POWERPC_MMU_MPC8xx
:
9593 mmu_model
= "PowerPC MPC8xx";
9595 case POWERPC_MMU_BOOKE
:
9596 mmu_model
= "PowerPC BookE";
9598 case POWERPC_MMU_BOOKE206
:
9599 mmu_model
= "PowerPC BookE 2.06";
9601 case POWERPC_MMU_601
:
9602 mmu_model
= "PowerPC 601";
9604 #if defined (TARGET_PPC64)
9605 case POWERPC_MMU_64B
:
9606 mmu_model
= "PowerPC 64";
9610 mmu_model
= "Unknown or invalid";
9613 switch (env
->excp_model
) {
9614 case POWERPC_EXCP_STD
:
9615 excp_model
= "PowerPC";
9617 case POWERPC_EXCP_40x
:
9618 excp_model
= "PowerPC 40x";
9620 case POWERPC_EXCP_601
:
9621 excp_model
= "PowerPC 601";
9623 case POWERPC_EXCP_602
:
9624 excp_model
= "PowerPC 602";
9626 case POWERPC_EXCP_603
:
9627 excp_model
= "PowerPC 603";
9629 case POWERPC_EXCP_603E
:
9630 excp_model
= "PowerPC 603e";
9632 case POWERPC_EXCP_604
:
9633 excp_model
= "PowerPC 604";
9635 case POWERPC_EXCP_7x0
:
9636 excp_model
= "PowerPC 740/750";
9638 case POWERPC_EXCP_7x5
:
9639 excp_model
= "PowerPC 745/755";
9641 case POWERPC_EXCP_74xx
:
9642 excp_model
= "PowerPC 74xx";
9644 case POWERPC_EXCP_BOOKE
:
9645 excp_model
= "PowerPC BookE";
9647 #if defined (TARGET_PPC64)
9648 case POWERPC_EXCP_970
:
9649 excp_model
= "PowerPC 970";
9653 excp_model
= "Unknown or invalid";
9656 switch (env
->bus_model
) {
9657 case PPC_FLAGS_INPUT_6xx
:
9658 bus_model
= "PowerPC 6xx";
9660 case PPC_FLAGS_INPUT_BookE
:
9661 bus_model
= "PowerPC BookE";
9663 case PPC_FLAGS_INPUT_405
:
9664 bus_model
= "PowerPC 405";
9666 case PPC_FLAGS_INPUT_401
:
9667 bus_model
= "PowerPC 401/403";
9669 case PPC_FLAGS_INPUT_RCPU
:
9670 bus_model
= "RCPU / MPC8xx";
9672 #if defined (TARGET_PPC64)
9673 case PPC_FLAGS_INPUT_970
:
9674 bus_model
= "PowerPC 970";
9678 bus_model
= "Unknown or invalid";
9681 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64
"\n"
9682 " MMU model : %s\n",
9683 object_class_get_name(OBJECT_CLASS(pcc
)),
9684 pcc
->pvr
, pcc
->msr_mask
, mmu_model
);
9685 #if !defined(CONFIG_USER_ONLY)
9686 if (env
->tlb
.tlb6
) {
9687 printf(" %d %s TLB in %d ways\n",
9688 env
->nb_tlb
, env
->id_tlbs
? "splitted" : "merged",
9692 printf(" Exceptions model : %s\n"
9693 " Bus model : %s\n",
9694 excp_model
, bus_model
);
9695 printf(" MSR features :\n");
9696 if (env
->flags
& POWERPC_FLAG_SPE
)
9697 printf(" signal processing engine enable"
9699 else if (env
->flags
& POWERPC_FLAG_VRE
)
9700 printf(" vector processor enable\n");
9701 if (env
->flags
& POWERPC_FLAG_TGPR
)
9702 printf(" temporary GPRs\n");
9703 else if (env
->flags
& POWERPC_FLAG_CE
)
9704 printf(" critical input enable\n");
9705 if (env
->flags
& POWERPC_FLAG_SE
)
9706 printf(" single-step trace mode\n");
9707 else if (env
->flags
& POWERPC_FLAG_DWE
)
9708 printf(" debug wait enable\n");
9709 else if (env
->flags
& POWERPC_FLAG_UBLE
)
9710 printf(" user BTB lock enable\n");
9711 if (env
->flags
& POWERPC_FLAG_BE
)
9712 printf(" branch-step trace mode\n");
9713 else if (env
->flags
& POWERPC_FLAG_DE
)
9714 printf(" debug interrupt enable\n");
9715 if (env
->flags
& POWERPC_FLAG_PX
)
9716 printf(" inclusive protection\n");
9717 else if (env
->flags
& POWERPC_FLAG_PMM
)
9718 printf(" performance monitor mark\n");
9719 if (env
->flags
== POWERPC_FLAG_NONE
)
9721 printf(" Time-base/decrementer clock source: %s\n",
9722 env
->flags
& POWERPC_FLAG_RTC_CLK
? "RTC clock" : "bus clock");
9723 dump_ppc_insns(env
);
9730 static void ppc_cpu_unrealizefn(DeviceState
*dev
, Error
**errp
)
9732 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
9733 CPUPPCState
*env
= &cpu
->env
;
9734 opc_handler_t
**table
;
9737 cpu_exec_exit(CPU(dev
));
9739 for (i
= 0; i
< PPC_CPU_OPCODES_LEN
; i
++) {
9740 if (env
->opcodes
[i
] == &invalid_handler
) {
9743 if (is_indirect_opcode(env
->opcodes
[i
])) {
9744 table
= ind_table(env
->opcodes
[i
]);
9745 for (j
= 0; j
< PPC_CPU_INDIRECT_OPCODES_LEN
; j
++) {
9746 if (table
[j
] != &invalid_handler
&&
9747 is_indirect_opcode(table
[j
])) {
9748 g_free((opc_handler_t
*)((uintptr_t)table
[j
] &
9752 g_free((opc_handler_t
*)((uintptr_t)env
->opcodes
[i
] &
9758 int ppc_get_compat_smt_threads(PowerPCCPU
*cpu
)
9760 int ret
= MIN(smp_threads
, kvmppc_smt_threads());
9762 switch (cpu
->cpu_version
) {
9763 case CPU_POWERPC_LOGICAL_2_05
:
9766 case CPU_POWERPC_LOGICAL_2_06
:
9769 case CPU_POWERPC_LOGICAL_2_07
:
9778 void ppc_set_compat(PowerPCCPU
*cpu
, uint32_t cpu_version
, Error
**errp
)
9781 CPUPPCState
*env
= &cpu
->env
;
9782 PowerPCCPUClass
*host_pcc
;
9784 cpu
->cpu_version
= cpu_version
;
9786 switch (cpu_version
) {
9787 case CPU_POWERPC_LOGICAL_2_05
:
9788 env
->spr
[SPR_PCR
] = PCR_TM_DIS
| PCR_VSX_DIS
| PCR_COMPAT_2_07
|
9789 PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
9791 case CPU_POWERPC_LOGICAL_2_06
:
9792 case CPU_POWERPC_LOGICAL_2_06_PLUS
:
9793 env
->spr
[SPR_PCR
] = PCR_TM_DIS
| PCR_COMPAT_2_07
| PCR_COMPAT_2_06
;
9795 case CPU_POWERPC_LOGICAL_2_07
:
9796 env
->spr
[SPR_PCR
] = PCR_COMPAT_2_07
;
9799 env
->spr
[SPR_PCR
] = 0;
9803 host_pcc
= kvm_ppc_get_host_cpu_class();
9805 env
->spr
[SPR_PCR
] &= host_pcc
->pcr_mask
;
9808 if (kvm_enabled()) {
9809 ret
= kvmppc_set_compat(cpu
, cpu
->cpu_version
);
9811 error_setg_errno(errp
, -ret
,
9812 "Unable to set CPU compatibility mode in KVM");
9818 static gint
ppc_cpu_compare_class_pvr(gconstpointer a
, gconstpointer b
)
9820 ObjectClass
*oc
= (ObjectClass
*)a
;
9821 uint32_t pvr
= *(uint32_t *)b
;
9822 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
9824 /* -cpu host does a PVR lookup during construction */
9825 if (unlikely(strcmp(object_class_get_name(oc
),
9826 TYPE_HOST_POWERPC_CPU
) == 0)) {
9830 if (!ppc_cpu_is_valid(pcc
)) {
9834 return pcc
->pvr
== pvr
? 0 : -1;
9837 PowerPCCPUClass
*ppc_cpu_class_by_pvr(uint32_t pvr
)
9839 GSList
*list
, *item
;
9840 PowerPCCPUClass
*pcc
= NULL
;
9842 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9843 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr
);
9845 pcc
= POWERPC_CPU_CLASS(item
->data
);
9852 static gint
ppc_cpu_compare_class_pvr_mask(gconstpointer a
, gconstpointer b
)
9854 ObjectClass
*oc
= (ObjectClass
*)a
;
9855 uint32_t pvr
= *(uint32_t *)b
;
9856 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
9858 /* -cpu host does a PVR lookup during construction */
9859 if (unlikely(strcmp(object_class_get_name(oc
),
9860 TYPE_HOST_POWERPC_CPU
) == 0)) {
9864 if (!ppc_cpu_is_valid(pcc
)) {
9868 if (pcc
->pvr_match(pcc
, pvr
)) {
9875 PowerPCCPUClass
*ppc_cpu_class_by_pvr_mask(uint32_t pvr
)
9877 GSList
*list
, *item
;
9878 PowerPCCPUClass
*pcc
= NULL
;
9880 list
= object_class_get_list(TYPE_POWERPC_CPU
, true);
9881 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr_mask
);
9883 pcc
= POWERPC_CPU_CLASS(item
->data
);
9890 static gint
ppc_cpu_compare_class_name(gconstpointer a
, gconstpointer b
)
9892 ObjectClass
*oc
= (ObjectClass
*)a
;
9893 const char *name
= b
;
9894 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9896 if (strncasecmp(name
, object_class_get_name(oc
), strlen(name
)) == 0 &&
9897 ppc_cpu_is_valid(pcc
) &&
9898 strcmp(object_class_get_name(oc
) + strlen(name
),
9899 "-" TYPE_POWERPC_CPU
) == 0) {
9906 static ObjectClass
*ppc_cpu_class_by_name(const char *name
);
9908 static ObjectClass
*ppc_cpu_class_by_alias(PowerPCCPUAlias
*alias
)
9910 ObjectClass
*invalid_class
= (void*)ppc_cpu_class_by_alias
;
9912 /* Cache target class lookups in the alias table */
9914 alias
->oc
= ppc_cpu_class_by_name(alias
->model
);
9916 /* Fast check for non-existing aliases */
9917 alias
->oc
= invalid_class
;
9921 if (alias
->oc
== invalid_class
) {
9928 static ObjectClass
*ppc_cpu_class_by_name(const char *name
)
9930 GSList
*list
, *item
;
9931 ObjectClass
*ret
= NULL
;
9935 /* Check if the given name is a PVR */
9937 if (len
== 10 && name
[0] == '0' && name
[1] == 'x') {
9940 } else if (len
== 8) {
9943 for (i
= 0; i
< 8; i
++) {
9944 if (!qemu_isxdigit(*p
++))
9948 return OBJECT_CLASS(ppc_cpu_class_by_pvr(strtoul(name
, NULL
, 16)));
9952 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9953 item
= g_slist_find_custom(list
, name
, ppc_cpu_compare_class_name
);
9955 ret
= OBJECT_CLASS(item
->data
);
9963 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9964 if (strcmp(ppc_cpu_aliases
[i
].alias
, name
) == 0) {
9965 return ppc_cpu_class_by_alias(&ppc_cpu_aliases
[i
]);
9972 PowerPCCPU
*cpu_ppc_init(const char *cpu_model
)
9974 return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU
, cpu_model
));
9977 /* Sort by PVR, ordering special case "host" last. */
9978 static gint
ppc_cpu_list_compare(gconstpointer a
, gconstpointer b
)
9980 ObjectClass
*oc_a
= (ObjectClass
*)a
;
9981 ObjectClass
*oc_b
= (ObjectClass
*)b
;
9982 PowerPCCPUClass
*pcc_a
= POWERPC_CPU_CLASS(oc_a
);
9983 PowerPCCPUClass
*pcc_b
= POWERPC_CPU_CLASS(oc_b
);
9984 const char *name_a
= object_class_get_name(oc_a
);
9985 const char *name_b
= object_class_get_name(oc_b
);
9987 if (strcmp(name_a
, TYPE_HOST_POWERPC_CPU
) == 0) {
9989 } else if (strcmp(name_b
, TYPE_HOST_POWERPC_CPU
) == 0) {
9992 /* Avoid an integer overflow during subtraction */
9993 if (pcc_a
->pvr
< pcc_b
->pvr
) {
9995 } else if (pcc_a
->pvr
> pcc_b
->pvr
) {
10003 static void ppc_cpu_list_entry(gpointer data
, gpointer user_data
)
10005 ObjectClass
*oc
= data
;
10006 CPUListState
*s
= user_data
;
10007 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10008 const char *typename
= object_class_get_name(oc
);
10012 if (!ppc_cpu_is_valid(pcc
)) {
10015 if (unlikely(strcmp(typename
, TYPE_HOST_POWERPC_CPU
) == 0)) {
10019 name
= g_strndup(typename
,
10020 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
10021 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s PVR %08x\n",
10023 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
10024 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
10025 ObjectClass
*alias_oc
= ppc_cpu_class_by_alias(alias
);
10027 if (alias_oc
!= oc
) {
10030 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s (alias for %s)\n",
10031 alias
->alias
, name
);
10036 void ppc_cpu_list(FILE *f
, fprintf_function cpu_fprintf
)
10040 .cpu_fprintf
= cpu_fprintf
,
10044 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10045 list
= g_slist_sort(list
, ppc_cpu_list_compare
);
10046 g_slist_foreach(list
, ppc_cpu_list_entry
, &s
);
10047 g_slist_free(list
);
10050 cpu_fprintf(f
, "\n");
10051 cpu_fprintf(f
, "PowerPC %-16s\n", "host");
10055 static void ppc_cpu_defs_entry(gpointer data
, gpointer user_data
)
10057 ObjectClass
*oc
= data
;
10058 CpuDefinitionInfoList
**first
= user_data
;
10059 const char *typename
;
10060 CpuDefinitionInfoList
*entry
;
10061 CpuDefinitionInfo
*info
;
10062 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10064 if (!ppc_cpu_is_valid(pcc
)) {
10068 typename
= object_class_get_name(oc
);
10069 info
= g_malloc0(sizeof(*info
));
10070 info
->name
= g_strndup(typename
,
10071 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
10073 entry
= g_malloc0(sizeof(*entry
));
10074 entry
->value
= info
;
10075 entry
->next
= *first
;
10079 CpuDefinitionInfoList
*arch_query_cpu_definitions(Error
**errp
)
10081 CpuDefinitionInfoList
*cpu_list
= NULL
;
10085 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10086 g_slist_foreach(list
, ppc_cpu_defs_entry
, &cpu_list
);
10087 g_slist_free(list
);
10089 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
10090 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
10092 CpuDefinitionInfoList
*entry
;
10093 CpuDefinitionInfo
*info
;
10095 oc
= ppc_cpu_class_by_alias(alias
);
10100 info
= g_malloc0(sizeof(*info
));
10101 info
->name
= g_strdup(alias
->alias
);
10103 entry
= g_malloc0(sizeof(*entry
));
10104 entry
->value
= info
;
10105 entry
->next
= cpu_list
;
10112 static void ppc_cpu_set_pc(CPUState
*cs
, vaddr value
)
10114 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10116 cpu
->env
.nip
= value
;
10119 static bool ppc_cpu_has_work(CPUState
*cs
)
10121 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10122 CPUPPCState
*env
= &cpu
->env
;
10124 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
10127 static void ppc_cpu_exec_enter(CPUState
*cs
)
10129 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10130 CPUPPCState
*env
= &cpu
->env
;
10132 env
->reserve_addr
= -1;
10135 /* CPUClass::reset() */
10136 static void ppc_cpu_reset(CPUState
*s
)
10138 PowerPCCPU
*cpu
= POWERPC_CPU(s
);
10139 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10140 CPUPPCState
*env
= &cpu
->env
;
10144 pcc
->parent_reset(s
);
10146 msr
= (target_ulong
)0;
10147 msr
|= (target_ulong
)MSR_HVB
;
10148 msr
|= (target_ulong
)0 << MSR_AP
; /* TO BE CHECKED */
10149 msr
|= (target_ulong
)0 << MSR_SA
; /* TO BE CHECKED */
10150 msr
|= (target_ulong
)1 << MSR_EP
;
10151 #if defined(DO_SINGLE_STEP) && 0
10152 /* Single step trace mode */
10153 msr
|= (target_ulong
)1 << MSR_SE
;
10154 msr
|= (target_ulong
)1 << MSR_BE
;
10156 #if defined(CONFIG_USER_ONLY)
10157 msr
|= (target_ulong
)1 << MSR_FP
; /* Allow floating point usage */
10158 msr
|= (target_ulong
)1 << MSR_VR
; /* Allow altivec usage */
10159 msr
|= (target_ulong
)1 << MSR_VSX
; /* Allow VSX usage */
10160 msr
|= (target_ulong
)1 << MSR_SPE
; /* Allow SPE usage */
10161 msr
|= (target_ulong
)1 << MSR_PR
;
10162 #if defined(TARGET_PPC64)
10163 msr
|= (target_ulong
)1 << MSR_TM
; /* Transactional memory */
10165 #if !defined(TARGET_WORDS_BIGENDIAN)
10166 msr
|= (target_ulong
)1 << MSR_LE
; /* Little-endian user mode */
10167 if (!((env
->msr_mask
>> MSR_LE
) & 1)) {
10168 fprintf(stderr
, "Selected CPU does not support little-endian.\n");
10174 #if defined(TARGET_PPC64)
10175 if (env
->mmu_model
& POWERPC_MMU_64
) {
10176 msr
|= (1ULL << MSR_SF
);
10180 hreg_store_msr(env
, msr
, 1);
10182 #if !defined(CONFIG_USER_ONLY)
10183 env
->nip
= env
->hreset_vector
| env
->excp_prefix
;
10184 if (env
->mmu_model
!= POWERPC_MMU_REAL
) {
10185 ppc_tlb_invalidate_all(env
);
10189 hreg_compute_hflags(env
);
10190 env
->reserve_addr
= (target_ulong
)-1ULL;
10191 /* Be sure no exception or interrupt is pending */
10192 env
->pending_interrupts
= 0;
10193 s
->exception_index
= POWERPC_EXCP_NONE
;
10194 env
->error_code
= 0;
10196 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
10198 env
->slb_shadow_addr
= 0;
10199 env
->slb_shadow_size
= 0;
10202 #endif /* TARGET_PPC64 */
10204 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
10205 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
10210 env
->spr
[i
] = spr
->default_value
;
10213 /* Flush all TLBs */
10217 #ifndef CONFIG_USER_ONLY
10218 static bool ppc_cpu_is_big_endian(CPUState
*cs
)
10220 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10221 CPUPPCState
*env
= &cpu
->env
;
10223 cpu_synchronize_state(cs
);
10229 static void ppc_cpu_initfn(Object
*obj
)
10231 CPUState
*cs
= CPU(obj
);
10232 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
10233 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10234 CPUPPCState
*env
= &cpu
->env
;
10238 env
->msr_mask
= pcc
->msr_mask
;
10239 env
->mmu_model
= pcc
->mmu_model
;
10240 env
->excp_model
= pcc
->excp_model
;
10241 env
->bus_model
= pcc
->bus_model
;
10242 env
->insns_flags
= pcc
->insns_flags
;
10243 env
->insns_flags2
= pcc
->insns_flags2
;
10244 env
->flags
= pcc
->flags
;
10245 env
->bfd_mach
= pcc
->bfd_mach
;
10246 env
->check_pow
= pcc
->check_pow
;
10248 /* Mark HV mode as supported if the CPU has an MSR_HV bit
10249 * in the msr_mask. The mask can later be cleared by PAPR
10250 * mode but the hv mode support will remain, thus enforcing
10251 * that we cannot use priv. instructions in guest in PAPR
10252 * mode. For 970 we currently simply don't set HV in msr_mask
10253 * thus simulating an "Apple mode" 970. If we ever want to
10254 * support 970 HV mode, we'll have to add a processor attribute
10257 #if !defined(CONFIG_USER_ONLY)
10258 env
->has_hv_mode
= !!(env
->msr_mask
& MSR_HVB
);
10261 #if defined(TARGET_PPC64)
10263 env
->sps
= *pcc
->sps
;
10264 } else if (env
->mmu_model
& POWERPC_MMU_64
) {
10265 /* Use default sets of page sizes */
10266 static const struct ppc_segment_page_sizes defsps
= {
10268 { .page_shift
= 12, /* 4K */
10270 .enc
= { { .page_shift
= 12, .pte_enc
= 0 } }
10272 { .page_shift
= 24, /* 16M */
10274 .enc
= { { .page_shift
= 24, .pte_enc
= 0 } }
10280 #endif /* defined(TARGET_PPC64) */
10282 if (tcg_enabled()) {
10283 ppc_translate_init();
10287 static bool ppc_pvr_match_default(PowerPCCPUClass
*pcc
, uint32_t pvr
)
10289 return pcc
->pvr
== pvr
;
10292 static gchar
*ppc_gdb_arch_name(CPUState
*cs
)
10294 #if defined(TARGET_PPC64)
10295 return g_strdup("powerpc:common64");
10297 return g_strdup("powerpc:common");
10301 static void ppc_cpu_class_init(ObjectClass
*oc
, void *data
)
10303 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10304 CPUClass
*cc
= CPU_CLASS(oc
);
10305 DeviceClass
*dc
= DEVICE_CLASS(oc
);
10307 pcc
->parent_realize
= dc
->realize
;
10308 pcc
->pvr_match
= ppc_pvr_match_default
;
10309 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_always
;
10310 dc
->realize
= ppc_cpu_realizefn
;
10311 dc
->unrealize
= ppc_cpu_unrealizefn
;
10313 pcc
->parent_reset
= cc
->reset
;
10314 cc
->reset
= ppc_cpu_reset
;
10316 cc
->class_by_name
= ppc_cpu_class_by_name
;
10317 cc
->has_work
= ppc_cpu_has_work
;
10318 cc
->do_interrupt
= ppc_cpu_do_interrupt
;
10319 cc
->cpu_exec_interrupt
= ppc_cpu_exec_interrupt
;
10320 cc
->dump_state
= ppc_cpu_dump_state
;
10321 cc
->dump_statistics
= ppc_cpu_dump_statistics
;
10322 cc
->set_pc
= ppc_cpu_set_pc
;
10323 cc
->gdb_read_register
= ppc_cpu_gdb_read_register
;
10324 cc
->gdb_write_register
= ppc_cpu_gdb_write_register
;
10325 #ifdef CONFIG_USER_ONLY
10326 cc
->handle_mmu_fault
= ppc_cpu_handle_mmu_fault
;
10328 cc
->get_phys_page_debug
= ppc_cpu_get_phys_page_debug
;
10329 cc
->vmsd
= &vmstate_ppc_cpu
;
10330 #if defined(TARGET_PPC64)
10331 cc
->write_elf64_note
= ppc64_cpu_write_elf64_note
;
10334 cc
->cpu_exec_enter
= ppc_cpu_exec_enter
;
10336 cc
->gdb_num_core_regs
= 71;
10338 #ifdef USE_APPLE_GDB
10339 cc
->gdb_read_register
= ppc_cpu_gdb_read_register_apple
;
10340 cc
->gdb_write_register
= ppc_cpu_gdb_write_register_apple
;
10341 cc
->gdb_num_core_regs
= 71 + 32;
10344 cc
->gdb_arch_name
= ppc_gdb_arch_name
;
10345 #if defined(TARGET_PPC64)
10346 cc
->gdb_core_xml_file
= "power64-core.xml";
10348 cc
->gdb_core_xml_file
= "power-core.xml";
10350 #ifndef CONFIG_USER_ONLY
10351 cc
->virtio_is_big_endian
= ppc_cpu_is_big_endian
;
10354 dc
->fw_name
= "PowerPC,UNKNOWN";
10357 static const TypeInfo ppc_cpu_type_info
= {
10358 .name
= TYPE_POWERPC_CPU
,
10359 .parent
= TYPE_CPU
,
10360 .instance_size
= sizeof(PowerPCCPU
),
10361 .instance_init
= ppc_cpu_initfn
,
10363 .class_size
= sizeof(PowerPCCPUClass
),
10364 .class_init
= ppc_cpu_class_init
,
10367 static void ppc_cpu_register_types(void)
10369 type_register_static(&ppc_cpu_type_info
);
10372 type_init(ppc_cpu_register_types
)