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 "disas/dis-asm.h"
22 #include "exec/gdbstub.h"
24 #include "sysemu/arch_init.h"
25 #include "sysemu/cpus.h"
26 #include "sysemu/hw_accel.h"
27 #include "cpu-models.h"
28 #include "mmu-hash32.h"
29 #include "mmu-hash64.h"
30 #include "qemu/error-report.h"
31 #include "qemu/qemu-print.h"
32 #include "qapi/error.h"
33 #include "qapi/qmp/qnull.h"
34 #include "qapi/visitor.h"
35 #include "hw/qdev-properties.h"
36 #include "hw/ppc/ppc.h"
37 #include "mmu-book3s-v3.h"
38 #include "sysemu/qtest.h"
39 #include "qemu/cutils.h"
40 #include "disas/capstone.h"
41 #include "fpu/softfloat.h"
42 #include "qapi/qapi-commands-target.h"
44 /* #define PPC_DUMP_CPU */
45 /* #define PPC_DEBUG_SPR */
46 /* #define PPC_DUMP_SPR_ACCESSES */
47 /* #define USE_APPLE_GDB */
51 * do nothing but store/retrieve spr value
53 static void spr_load_dump_spr(int sprn
)
55 #ifdef PPC_DUMP_SPR_ACCESSES
56 TCGv_i32 t0
= tcg_const_i32(sprn
);
57 gen_helper_load_dump_spr(cpu_env
, t0
);
58 tcg_temp_free_i32(t0
);
62 static void spr_read_generic(DisasContext
*ctx
, int gprn
, int sprn
)
64 gen_load_spr(cpu_gpr
[gprn
], sprn
);
65 spr_load_dump_spr(sprn
);
68 static void spr_store_dump_spr(int sprn
)
70 #ifdef PPC_DUMP_SPR_ACCESSES
71 TCGv_i32 t0
= tcg_const_i32(sprn
);
72 gen_helper_store_dump_spr(cpu_env
, t0
);
73 tcg_temp_free_i32(t0
);
77 static void spr_write_generic(DisasContext
*ctx
, int sprn
, int gprn
)
79 gen_store_spr(sprn
, cpu_gpr
[gprn
]);
80 spr_store_dump_spr(sprn
);
83 #if !defined(CONFIG_USER_ONLY)
84 static void spr_write_generic32(DisasContext
*ctx
, int sprn
, int gprn
)
87 TCGv t0
= tcg_temp_new();
88 tcg_gen_ext32u_tl(t0
, cpu_gpr
[gprn
]);
89 gen_store_spr(sprn
, t0
);
91 spr_store_dump_spr(sprn
);
93 spr_write_generic(ctx
, sprn
, gprn
);
97 static void spr_write_clear(DisasContext
*ctx
, int sprn
, int gprn
)
99 TCGv t0
= tcg_temp_new();
100 TCGv t1
= tcg_temp_new();
101 gen_load_spr(t0
, sprn
);
102 tcg_gen_neg_tl(t1
, cpu_gpr
[gprn
]);
103 tcg_gen_and_tl(t0
, t0
, t1
);
104 gen_store_spr(sprn
, t0
);
109 static void spr_access_nop(DisasContext
*ctx
, int sprn
, int gprn
)
115 /* SPR common to all PowerPC */
117 static void spr_read_xer(DisasContext
*ctx
, int gprn
, int sprn
)
119 gen_read_xer(ctx
, cpu_gpr
[gprn
]);
122 static void spr_write_xer(DisasContext
*ctx
, int sprn
, int gprn
)
124 gen_write_xer(cpu_gpr
[gprn
]);
128 static void spr_read_lr(DisasContext
*ctx
, int gprn
, int sprn
)
130 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_lr
);
133 static void spr_write_lr(DisasContext
*ctx
, int sprn
, int gprn
)
135 tcg_gen_mov_tl(cpu_lr
, cpu_gpr
[gprn
]);
139 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
140 static void spr_read_cfar(DisasContext
*ctx
, int gprn
, int sprn
)
142 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_cfar
);
145 static void spr_write_cfar(DisasContext
*ctx
, int sprn
, int gprn
)
147 tcg_gen_mov_tl(cpu_cfar
, cpu_gpr
[gprn
]);
149 #endif /* defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) */
152 static void spr_read_ctr(DisasContext
*ctx
, int gprn
, int sprn
)
154 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_ctr
);
157 static void spr_write_ctr(DisasContext
*ctx
, int sprn
, int gprn
)
159 tcg_gen_mov_tl(cpu_ctr
, cpu_gpr
[gprn
]);
162 /* User read access to SPR */
168 static void spr_read_ureg(DisasContext
*ctx
, int gprn
, int sprn
)
170 gen_load_spr(cpu_gpr
[gprn
], sprn
+ 0x10);
173 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
174 static void spr_write_ureg(DisasContext
*ctx
, int sprn
, int gprn
)
176 gen_store_spr(sprn
+ 0x10, cpu_gpr
[gprn
]);
180 /* SPR common to all non-embedded PowerPC */
182 #if !defined(CONFIG_USER_ONLY)
183 static void spr_read_decr(DisasContext
*ctx
, int gprn
, int sprn
)
185 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
188 gen_helper_load_decr(cpu_gpr
[gprn
], cpu_env
);
189 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
191 gen_stop_exception(ctx
);
195 static void spr_write_decr(DisasContext
*ctx
, int sprn
, int gprn
)
197 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
200 gen_helper_store_decr(cpu_env
, cpu_gpr
[gprn
]);
201 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
203 gen_stop_exception(ctx
);
208 /* SPR common to all non-embedded PowerPC, except 601 */
210 static void spr_read_tbl(DisasContext
*ctx
, int gprn
, int sprn
)
212 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
215 gen_helper_load_tbl(cpu_gpr
[gprn
], cpu_env
);
216 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
218 gen_stop_exception(ctx
);
222 static void spr_read_tbu(DisasContext
*ctx
, int gprn
, int sprn
)
224 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
227 gen_helper_load_tbu(cpu_gpr
[gprn
], cpu_env
);
228 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
230 gen_stop_exception(ctx
);
235 static void spr_read_atbl(DisasContext
*ctx
, int gprn
, int sprn
)
237 gen_helper_load_atbl(cpu_gpr
[gprn
], cpu_env
);
241 static void spr_read_atbu(DisasContext
*ctx
, int gprn
, int sprn
)
243 gen_helper_load_atbu(cpu_gpr
[gprn
], cpu_env
);
246 #if !defined(CONFIG_USER_ONLY)
247 static void spr_write_tbl(DisasContext
*ctx
, int sprn
, int gprn
)
249 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
252 gen_helper_store_tbl(cpu_env
, cpu_gpr
[gprn
]);
253 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
255 gen_stop_exception(ctx
);
259 static void spr_write_tbu(DisasContext
*ctx
, int sprn
, int gprn
)
261 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
264 gen_helper_store_tbu(cpu_env
, cpu_gpr
[gprn
]);
265 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
267 gen_stop_exception(ctx
);
272 static void spr_write_atbl(DisasContext
*ctx
, int sprn
, int gprn
)
274 gen_helper_store_atbl(cpu_env
, cpu_gpr
[gprn
]);
278 static void spr_write_atbu(DisasContext
*ctx
, int sprn
, int gprn
)
280 gen_helper_store_atbu(cpu_env
, cpu_gpr
[gprn
]);
283 #if defined(TARGET_PPC64)
285 static void spr_read_purr(DisasContext
*ctx
, int gprn
, int sprn
)
287 gen_helper_load_purr(cpu_gpr
[gprn
], cpu_env
);
291 static void spr_read_hdecr(DisasContext
*ctx
, int gprn
, int sprn
)
293 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
296 gen_helper_load_hdecr(cpu_gpr
[gprn
], cpu_env
);
297 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
299 gen_stop_exception(ctx
);
303 static void spr_write_hdecr(DisasContext
*ctx
, int sprn
, int gprn
)
305 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
308 gen_helper_store_hdecr(cpu_env
, cpu_gpr
[gprn
]);
309 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
311 gen_stop_exception(ctx
);
318 #if !defined(CONFIG_USER_ONLY)
319 /* IBAT0U...IBAT0U */
320 /* IBAT0L...IBAT7L */
321 static void spr_read_ibat(DisasContext
*ctx
, int gprn
, int sprn
)
323 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
,
324 offsetof(CPUPPCState
,
325 IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
328 static void spr_read_ibat_h(DisasContext
*ctx
, int gprn
, int sprn
)
330 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
,
331 offsetof(CPUPPCState
,
332 IBAT
[sprn
& 1][((sprn
- SPR_IBAT4U
) / 2) + 4]));
335 static void spr_write_ibatu(DisasContext
*ctx
, int sprn
, int gprn
)
337 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
338 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
339 tcg_temp_free_i32(t0
);
342 static void spr_write_ibatu_h(DisasContext
*ctx
, int sprn
, int gprn
)
344 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4U
) / 2) + 4);
345 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
346 tcg_temp_free_i32(t0
);
349 static void spr_write_ibatl(DisasContext
*ctx
, int sprn
, int gprn
)
351 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0L
) / 2);
352 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
353 tcg_temp_free_i32(t0
);
356 static void spr_write_ibatl_h(DisasContext
*ctx
, int sprn
, int gprn
)
358 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4L
) / 2) + 4);
359 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
360 tcg_temp_free_i32(t0
);
363 /* DBAT0U...DBAT7U */
364 /* DBAT0L...DBAT7L */
365 static void spr_read_dbat(DisasContext
*ctx
, int gprn
, int sprn
)
367 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
,
368 offsetof(CPUPPCState
,
369 DBAT
[sprn
& 1][(sprn
- SPR_DBAT0U
) / 2]));
372 static void spr_read_dbat_h(DisasContext
*ctx
, int gprn
, int sprn
)
374 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
,
375 offsetof(CPUPPCState
,
376 DBAT
[sprn
& 1][((sprn
- SPR_DBAT4U
) / 2) + 4]));
379 static void spr_write_dbatu(DisasContext
*ctx
, int sprn
, int gprn
)
381 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0U
) / 2);
382 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
383 tcg_temp_free_i32(t0
);
386 static void spr_write_dbatu_h(DisasContext
*ctx
, int sprn
, int gprn
)
388 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4U
) / 2) + 4);
389 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
390 tcg_temp_free_i32(t0
);
393 static void spr_write_dbatl(DisasContext
*ctx
, int sprn
, int gprn
)
395 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0L
) / 2);
396 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
397 tcg_temp_free_i32(t0
);
400 static void spr_write_dbatl_h(DisasContext
*ctx
, int sprn
, int gprn
)
402 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4L
) / 2) + 4);
403 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
404 tcg_temp_free_i32(t0
);
408 static void spr_write_sdr1(DisasContext
*ctx
, int sprn
, int gprn
)
410 gen_helper_store_sdr1(cpu_env
, cpu_gpr
[gprn
]);
413 #if defined(TARGET_PPC64)
414 /* 64 bits PowerPC specific SPRs */
416 static void spr_write_pidr(DisasContext
*ctx
, int sprn
, int gprn
)
418 gen_helper_store_pidr(cpu_env
, cpu_gpr
[gprn
]);
421 static void spr_write_lpidr(DisasContext
*ctx
, int sprn
, int gprn
)
423 gen_helper_store_lpidr(cpu_env
, cpu_gpr
[gprn
]);
426 static void spr_read_hior(DisasContext
*ctx
, int gprn
, int sprn
)
428 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
431 static void spr_write_hior(DisasContext
*ctx
, int sprn
, int gprn
)
433 TCGv t0
= tcg_temp_new();
434 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0x3FFFFF00000ULL
);
435 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
438 static void spr_write_ptcr(DisasContext
*ctx
, int sprn
, int gprn
)
440 gen_helper_store_ptcr(cpu_env
, cpu_gpr
[gprn
]);
443 static void spr_write_pcr(DisasContext
*ctx
, int sprn
, int gprn
)
445 gen_helper_store_pcr(cpu_env
, cpu_gpr
[gprn
]);
450 /* PowerPC 601 specific registers */
452 static void spr_read_601_rtcl(DisasContext
*ctx
, int gprn
, int sprn
)
454 gen_helper_load_601_rtcl(cpu_gpr
[gprn
], cpu_env
);
457 static void spr_read_601_rtcu(DisasContext
*ctx
, int gprn
, int sprn
)
459 gen_helper_load_601_rtcu(cpu_gpr
[gprn
], cpu_env
);
462 #if !defined(CONFIG_USER_ONLY)
463 static void spr_write_601_rtcu(DisasContext
*ctx
, int sprn
, int gprn
)
465 gen_helper_store_601_rtcu(cpu_env
, cpu_gpr
[gprn
]);
468 static void spr_write_601_rtcl(DisasContext
*ctx
, int sprn
, int gprn
)
470 gen_helper_store_601_rtcl(cpu_env
, cpu_gpr
[gprn
]);
473 static void spr_write_hid0_601(DisasContext
*ctx
, int sprn
, int gprn
)
475 gen_helper_store_hid0_601(cpu_env
, cpu_gpr
[gprn
]);
476 /* Must stop the translation as endianness may have changed */
477 gen_stop_exception(ctx
);
482 #if !defined(CONFIG_USER_ONLY)
483 static void spr_read_601_ubat(DisasContext
*ctx
, int gprn
, int sprn
)
485 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
,
486 offsetof(CPUPPCState
,
487 IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
490 static void spr_write_601_ubatu(DisasContext
*ctx
, int sprn
, int gprn
)
492 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
493 gen_helper_store_601_batl(cpu_env
, t0
, cpu_gpr
[gprn
]);
494 tcg_temp_free_i32(t0
);
497 static void spr_write_601_ubatl(DisasContext
*ctx
, int sprn
, int gprn
)
499 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
500 gen_helper_store_601_batu(cpu_env
, t0
, cpu_gpr
[gprn
]);
501 tcg_temp_free_i32(t0
);
505 /* PowerPC 40x specific registers */
506 #if !defined(CONFIG_USER_ONLY)
507 static void spr_read_40x_pit(DisasContext
*ctx
, int gprn
, int sprn
)
509 gen_helper_load_40x_pit(cpu_gpr
[gprn
], cpu_env
);
512 static void spr_write_40x_pit(DisasContext
*ctx
, int sprn
, int gprn
)
514 gen_helper_store_40x_pit(cpu_env
, cpu_gpr
[gprn
]);
517 static void spr_write_40x_dbcr0(DisasContext
*ctx
, int sprn
, int gprn
)
519 gen_store_spr(sprn
, cpu_gpr
[gprn
]);
520 gen_helper_store_40x_dbcr0(cpu_env
, cpu_gpr
[gprn
]);
521 /* We must stop translation as we may have rebooted */
522 gen_stop_exception(ctx
);
525 static void spr_write_40x_sler(DisasContext
*ctx
, int sprn
, int gprn
)
527 gen_helper_store_40x_sler(cpu_env
, cpu_gpr
[gprn
]);
530 static void spr_write_booke_tcr(DisasContext
*ctx
, int sprn
, int gprn
)
532 gen_helper_store_booke_tcr(cpu_env
, cpu_gpr
[gprn
]);
535 static void spr_write_booke_tsr(DisasContext
*ctx
, int sprn
, int gprn
)
537 gen_helper_store_booke_tsr(cpu_env
, cpu_gpr
[gprn
]);
541 /* PowerPC 403 specific registers */
542 /* PBL1 / PBU1 / PBL2 / PBU2 */
543 #if !defined(CONFIG_USER_ONLY)
544 static void spr_read_403_pbr(DisasContext
*ctx
, int gprn
, int sprn
)
546 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
,
547 offsetof(CPUPPCState
, pb
[sprn
- SPR_403_PBL1
]));
550 static void spr_write_403_pbr(DisasContext
*ctx
, int sprn
, int gprn
)
552 TCGv_i32 t0
= tcg_const_i32(sprn
- SPR_403_PBL1
);
553 gen_helper_store_403_pbr(cpu_env
, t0
, cpu_gpr
[gprn
]);
554 tcg_temp_free_i32(t0
);
557 static void spr_write_pir(DisasContext
*ctx
, int sprn
, int gprn
)
559 TCGv t0
= tcg_temp_new();
560 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0xF);
561 gen_store_spr(SPR_PIR
, t0
);
566 /* SPE specific registers */
567 static void spr_read_spefscr(DisasContext
*ctx
, int gprn
, int sprn
)
569 TCGv_i32 t0
= tcg_temp_new_i32();
570 tcg_gen_ld_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
571 tcg_gen_extu_i32_tl(cpu_gpr
[gprn
], t0
);
572 tcg_temp_free_i32(t0
);
575 static void spr_write_spefscr(DisasContext
*ctx
, int sprn
, int gprn
)
577 TCGv_i32 t0
= tcg_temp_new_i32();
578 tcg_gen_trunc_tl_i32(t0
, cpu_gpr
[gprn
]);
579 tcg_gen_st_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
580 tcg_temp_free_i32(t0
);
583 #if !defined(CONFIG_USER_ONLY)
584 /* Callback used to write the exception vector base */
585 static void spr_write_excp_prefix(DisasContext
*ctx
, int sprn
, int gprn
)
587 TCGv t0
= tcg_temp_new();
588 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivpr_mask
));
589 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
590 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
591 gen_store_spr(sprn
, t0
);
595 static void spr_write_excp_vector(DisasContext
*ctx
, int sprn
, int gprn
)
599 if (sprn
>= SPR_BOOKE_IVOR0
&& sprn
<= SPR_BOOKE_IVOR15
) {
600 sprn_offs
= sprn
- SPR_BOOKE_IVOR0
;
601 } else if (sprn
>= SPR_BOOKE_IVOR32
&& sprn
<= SPR_BOOKE_IVOR37
) {
602 sprn_offs
= sprn
- SPR_BOOKE_IVOR32
+ 32;
603 } else if (sprn
>= SPR_BOOKE_IVOR38
&& sprn
<= SPR_BOOKE_IVOR42
) {
604 sprn_offs
= sprn
- SPR_BOOKE_IVOR38
+ 38;
606 printf("Trying to write an unknown exception vector %d %03x\n",
608 gen_inval_exception(ctx
, POWERPC_EXCP_PRIV_REG
);
612 TCGv t0
= tcg_temp_new();
613 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivor_mask
));
614 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
615 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_vectors
[sprn_offs
]));
616 gen_store_spr(sprn
, t0
);
621 static inline void vscr_init(CPUPPCState
*env
, uint32_t val
)
623 /* Altivec always uses round-to-nearest */
624 set_float_rounding_mode(float_round_nearest_even
, &env
->vec_status
);
625 helper_mtvscr(env
, val
);
628 #ifdef CONFIG_USER_ONLY
629 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
630 oea_read, oea_write, one_reg_id, initial_value) \
631 _spr_register(env, num, name, uea_read, uea_write, initial_value)
632 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
633 oea_read, oea_write, hea_read, hea_write, \
634 one_reg_id, initial_value) \
635 _spr_register(env, num, name, uea_read, uea_write, initial_value)
637 #if !defined(CONFIG_KVM)
638 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
639 oea_read, oea_write, one_reg_id, initial_value) \
640 _spr_register(env, num, name, uea_read, uea_write, \
641 oea_read, oea_write, oea_read, oea_write, initial_value)
642 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
643 oea_read, oea_write, hea_read, hea_write, \
644 one_reg_id, initial_value) \
645 _spr_register(env, num, name, uea_read, uea_write, \
646 oea_read, oea_write, hea_read, hea_write, initial_value)
648 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
649 oea_read, oea_write, one_reg_id, initial_value) \
650 _spr_register(env, num, name, uea_read, uea_write, \
651 oea_read, oea_write, oea_read, oea_write, \
652 one_reg_id, initial_value)
653 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
654 oea_read, oea_write, hea_read, hea_write, \
655 one_reg_id, initial_value) \
656 _spr_register(env, num, name, uea_read, uea_write, \
657 oea_read, oea_write, hea_read, hea_write, \
658 one_reg_id, initial_value)
662 #define spr_register(env, num, name, uea_read, uea_write, \
663 oea_read, oea_write, initial_value) \
664 spr_register_kvm(env, num, name, uea_read, uea_write, \
665 oea_read, oea_write, 0, initial_value)
667 #define spr_register_hv(env, num, name, uea_read, uea_write, \
668 oea_read, oea_write, hea_read, hea_write, \
670 spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
671 oea_read, oea_write, hea_read, hea_write, \
674 static inline void _spr_register(CPUPPCState
*env
, int num
,
676 void (*uea_read
)(DisasContext
*ctx
,
678 void (*uea_write
)(DisasContext
*ctx
,
680 #if !defined(CONFIG_USER_ONLY)
682 void (*oea_read
)(DisasContext
*ctx
,
684 void (*oea_write
)(DisasContext
*ctx
,
686 void (*hea_read
)(DisasContext
*opaque
,
688 void (*hea_write
)(DisasContext
*opaque
,
691 #if defined(CONFIG_KVM)
694 target_ulong initial_value
)
698 spr
= &env
->spr_cb
[num
];
699 if (spr
->name
!= NULL
|| env
->spr
[num
] != 0x00000000 ||
700 #if !defined(CONFIG_USER_ONLY)
701 spr
->oea_read
!= NULL
|| spr
->oea_write
!= NULL
||
703 spr
->uea_read
!= NULL
|| spr
->uea_write
!= NULL
) {
704 printf("Error: Trying to register SPR %d (%03x) twice !\n", num
, num
);
707 #if defined(PPC_DEBUG_SPR)
708 printf("*** register spr %d (%03x) %s val " TARGET_FMT_lx
"\n", num
, num
,
709 name
, initial_value
);
712 spr
->uea_read
= uea_read
;
713 spr
->uea_write
= uea_write
;
714 #if !defined(CONFIG_USER_ONLY)
715 spr
->oea_read
= oea_read
;
716 spr
->oea_write
= oea_write
;
717 spr
->hea_read
= hea_read
;
718 spr
->hea_write
= hea_write
;
720 #if defined(CONFIG_KVM)
721 spr
->one_reg_id
= one_reg_id
,
723 env
->spr
[num
] = spr
->default_value
= initial_value
;
726 /* Generic PowerPC SPRs */
727 static void gen_spr_generic(CPUPPCState
*env
)
729 /* Integer processing */
730 spr_register(env
, SPR_XER
, "XER",
731 &spr_read_xer
, &spr_write_xer
,
732 &spr_read_xer
, &spr_write_xer
,
735 spr_register(env
, SPR_LR
, "LR",
736 &spr_read_lr
, &spr_write_lr
,
737 &spr_read_lr
, &spr_write_lr
,
739 spr_register(env
, SPR_CTR
, "CTR",
740 &spr_read_ctr
, &spr_write_ctr
,
741 &spr_read_ctr
, &spr_write_ctr
,
743 /* Interrupt processing */
744 spr_register(env
, SPR_SRR0
, "SRR0",
745 SPR_NOACCESS
, SPR_NOACCESS
,
746 &spr_read_generic
, &spr_write_generic
,
748 spr_register(env
, SPR_SRR1
, "SRR1",
749 SPR_NOACCESS
, SPR_NOACCESS
,
750 &spr_read_generic
, &spr_write_generic
,
752 /* Processor control */
753 spr_register(env
, SPR_SPRG0
, "SPRG0",
754 SPR_NOACCESS
, SPR_NOACCESS
,
755 &spr_read_generic
, &spr_write_generic
,
757 spr_register(env
, SPR_SPRG1
, "SPRG1",
758 SPR_NOACCESS
, SPR_NOACCESS
,
759 &spr_read_generic
, &spr_write_generic
,
761 spr_register(env
, SPR_SPRG2
, "SPRG2",
762 SPR_NOACCESS
, SPR_NOACCESS
,
763 &spr_read_generic
, &spr_write_generic
,
765 spr_register(env
, SPR_SPRG3
, "SPRG3",
766 SPR_NOACCESS
, SPR_NOACCESS
,
767 &spr_read_generic
, &spr_write_generic
,
771 /* SPR common to all non-embedded PowerPC, including 601 */
772 static void gen_spr_ne_601(CPUPPCState
*env
)
774 /* Exception processing */
775 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
776 SPR_NOACCESS
, SPR_NOACCESS
,
777 &spr_read_generic
, &spr_write_generic
,
778 KVM_REG_PPC_DSISR
, 0x00000000);
779 spr_register_kvm(env
, SPR_DAR
, "DAR",
780 SPR_NOACCESS
, SPR_NOACCESS
,
781 &spr_read_generic
, &spr_write_generic
,
782 KVM_REG_PPC_DAR
, 0x00000000);
784 spr_register(env
, SPR_DECR
, "DECR",
785 SPR_NOACCESS
, SPR_NOACCESS
,
786 &spr_read_decr
, &spr_write_decr
,
790 /* Storage Description Register 1 */
791 static void gen_spr_sdr1(CPUPPCState
*env
)
793 #ifndef CONFIG_USER_ONLY
794 if (env
->has_hv_mode
) {
796 * SDR1 is a hypervisor resource on CPUs which have a
799 spr_register_hv(env
, SPR_SDR1
, "SDR1",
800 SPR_NOACCESS
, SPR_NOACCESS
,
801 SPR_NOACCESS
, SPR_NOACCESS
,
802 &spr_read_generic
, &spr_write_sdr1
,
805 spr_register(env
, SPR_SDR1
, "SDR1",
806 SPR_NOACCESS
, SPR_NOACCESS
,
807 &spr_read_generic
, &spr_write_sdr1
,
814 static void gen_low_BATs(CPUPPCState
*env
)
816 #if !defined(CONFIG_USER_ONLY)
817 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
818 SPR_NOACCESS
, SPR_NOACCESS
,
819 &spr_read_ibat
, &spr_write_ibatu
,
821 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
822 SPR_NOACCESS
, SPR_NOACCESS
,
823 &spr_read_ibat
, &spr_write_ibatl
,
825 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
826 SPR_NOACCESS
, SPR_NOACCESS
,
827 &spr_read_ibat
, &spr_write_ibatu
,
829 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
830 SPR_NOACCESS
, SPR_NOACCESS
,
831 &spr_read_ibat
, &spr_write_ibatl
,
833 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
834 SPR_NOACCESS
, SPR_NOACCESS
,
835 &spr_read_ibat
, &spr_write_ibatu
,
837 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
838 SPR_NOACCESS
, SPR_NOACCESS
,
839 &spr_read_ibat
, &spr_write_ibatl
,
841 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
842 SPR_NOACCESS
, SPR_NOACCESS
,
843 &spr_read_ibat
, &spr_write_ibatu
,
845 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
846 SPR_NOACCESS
, SPR_NOACCESS
,
847 &spr_read_ibat
, &spr_write_ibatl
,
849 spr_register(env
, SPR_DBAT0U
, "DBAT0U",
850 SPR_NOACCESS
, SPR_NOACCESS
,
851 &spr_read_dbat
, &spr_write_dbatu
,
853 spr_register(env
, SPR_DBAT0L
, "DBAT0L",
854 SPR_NOACCESS
, SPR_NOACCESS
,
855 &spr_read_dbat
, &spr_write_dbatl
,
857 spr_register(env
, SPR_DBAT1U
, "DBAT1U",
858 SPR_NOACCESS
, SPR_NOACCESS
,
859 &spr_read_dbat
, &spr_write_dbatu
,
861 spr_register(env
, SPR_DBAT1L
, "DBAT1L",
862 SPR_NOACCESS
, SPR_NOACCESS
,
863 &spr_read_dbat
, &spr_write_dbatl
,
865 spr_register(env
, SPR_DBAT2U
, "DBAT2U",
866 SPR_NOACCESS
, SPR_NOACCESS
,
867 &spr_read_dbat
, &spr_write_dbatu
,
869 spr_register(env
, SPR_DBAT2L
, "DBAT2L",
870 SPR_NOACCESS
, SPR_NOACCESS
,
871 &spr_read_dbat
, &spr_write_dbatl
,
873 spr_register(env
, SPR_DBAT3U
, "DBAT3U",
874 SPR_NOACCESS
, SPR_NOACCESS
,
875 &spr_read_dbat
, &spr_write_dbatu
,
877 spr_register(env
, SPR_DBAT3L
, "DBAT3L",
878 SPR_NOACCESS
, SPR_NOACCESS
,
879 &spr_read_dbat
, &spr_write_dbatl
,
886 static void gen_high_BATs(CPUPPCState
*env
)
888 #if !defined(CONFIG_USER_ONLY)
889 spr_register(env
, SPR_IBAT4U
, "IBAT4U",
890 SPR_NOACCESS
, SPR_NOACCESS
,
891 &spr_read_ibat_h
, &spr_write_ibatu_h
,
893 spr_register(env
, SPR_IBAT4L
, "IBAT4L",
894 SPR_NOACCESS
, SPR_NOACCESS
,
895 &spr_read_ibat_h
, &spr_write_ibatl_h
,
897 spr_register(env
, SPR_IBAT5U
, "IBAT5U",
898 SPR_NOACCESS
, SPR_NOACCESS
,
899 &spr_read_ibat_h
, &spr_write_ibatu_h
,
901 spr_register(env
, SPR_IBAT5L
, "IBAT5L",
902 SPR_NOACCESS
, SPR_NOACCESS
,
903 &spr_read_ibat_h
, &spr_write_ibatl_h
,
905 spr_register(env
, SPR_IBAT6U
, "IBAT6U",
906 SPR_NOACCESS
, SPR_NOACCESS
,
907 &spr_read_ibat_h
, &spr_write_ibatu_h
,
909 spr_register(env
, SPR_IBAT6L
, "IBAT6L",
910 SPR_NOACCESS
, SPR_NOACCESS
,
911 &spr_read_ibat_h
, &spr_write_ibatl_h
,
913 spr_register(env
, SPR_IBAT7U
, "IBAT7U",
914 SPR_NOACCESS
, SPR_NOACCESS
,
915 &spr_read_ibat_h
, &spr_write_ibatu_h
,
917 spr_register(env
, SPR_IBAT7L
, "IBAT7L",
918 SPR_NOACCESS
, SPR_NOACCESS
,
919 &spr_read_ibat_h
, &spr_write_ibatl_h
,
921 spr_register(env
, SPR_DBAT4U
, "DBAT4U",
922 SPR_NOACCESS
, SPR_NOACCESS
,
923 &spr_read_dbat_h
, &spr_write_dbatu_h
,
925 spr_register(env
, SPR_DBAT4L
, "DBAT4L",
926 SPR_NOACCESS
, SPR_NOACCESS
,
927 &spr_read_dbat_h
, &spr_write_dbatl_h
,
929 spr_register(env
, SPR_DBAT5U
, "DBAT5U",
930 SPR_NOACCESS
, SPR_NOACCESS
,
931 &spr_read_dbat_h
, &spr_write_dbatu_h
,
933 spr_register(env
, SPR_DBAT5L
, "DBAT5L",
934 SPR_NOACCESS
, SPR_NOACCESS
,
935 &spr_read_dbat_h
, &spr_write_dbatl_h
,
937 spr_register(env
, SPR_DBAT6U
, "DBAT6U",
938 SPR_NOACCESS
, SPR_NOACCESS
,
939 &spr_read_dbat_h
, &spr_write_dbatu_h
,
941 spr_register(env
, SPR_DBAT6L
, "DBAT6L",
942 SPR_NOACCESS
, SPR_NOACCESS
,
943 &spr_read_dbat_h
, &spr_write_dbatl_h
,
945 spr_register(env
, SPR_DBAT7U
, "DBAT7U",
946 SPR_NOACCESS
, SPR_NOACCESS
,
947 &spr_read_dbat_h
, &spr_write_dbatu_h
,
949 spr_register(env
, SPR_DBAT7L
, "DBAT7L",
950 SPR_NOACCESS
, SPR_NOACCESS
,
951 &spr_read_dbat_h
, &spr_write_dbatl_h
,
957 /* Generic PowerPC time base */
958 static void gen_tbl(CPUPPCState
*env
)
960 spr_register(env
, SPR_VTBL
, "TBL",
961 &spr_read_tbl
, SPR_NOACCESS
,
962 &spr_read_tbl
, SPR_NOACCESS
,
964 spr_register(env
, SPR_TBL
, "TBL",
965 &spr_read_tbl
, SPR_NOACCESS
,
966 &spr_read_tbl
, &spr_write_tbl
,
968 spr_register(env
, SPR_VTBU
, "TBU",
969 &spr_read_tbu
, SPR_NOACCESS
,
970 &spr_read_tbu
, SPR_NOACCESS
,
972 spr_register(env
, SPR_TBU
, "TBU",
973 &spr_read_tbu
, SPR_NOACCESS
,
974 &spr_read_tbu
, &spr_write_tbu
,
978 /* Softare table search registers */
979 static void gen_6xx_7xx_soft_tlb(CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
981 #if !defined(CONFIG_USER_ONLY)
982 env
->nb_tlb
= nb_tlbs
;
983 env
->nb_ways
= nb_ways
;
985 env
->tlb_type
= TLB_6XX
;
986 spr_register(env
, SPR_DMISS
, "DMISS",
987 SPR_NOACCESS
, SPR_NOACCESS
,
988 &spr_read_generic
, SPR_NOACCESS
,
990 spr_register(env
, SPR_DCMP
, "DCMP",
991 SPR_NOACCESS
, SPR_NOACCESS
,
992 &spr_read_generic
, SPR_NOACCESS
,
994 spr_register(env
, SPR_HASH1
, "HASH1",
995 SPR_NOACCESS
, SPR_NOACCESS
,
996 &spr_read_generic
, SPR_NOACCESS
,
998 spr_register(env
, SPR_HASH2
, "HASH2",
999 SPR_NOACCESS
, SPR_NOACCESS
,
1000 &spr_read_generic
, SPR_NOACCESS
,
1002 spr_register(env
, SPR_IMISS
, "IMISS",
1003 SPR_NOACCESS
, SPR_NOACCESS
,
1004 &spr_read_generic
, SPR_NOACCESS
,
1006 spr_register(env
, SPR_ICMP
, "ICMP",
1007 SPR_NOACCESS
, SPR_NOACCESS
,
1008 &spr_read_generic
, SPR_NOACCESS
,
1010 spr_register(env
, SPR_RPA
, "RPA",
1011 SPR_NOACCESS
, SPR_NOACCESS
,
1012 &spr_read_generic
, &spr_write_generic
,
1017 /* SPR common to MPC755 and G2 */
1018 static void gen_spr_G2_755(CPUPPCState
*env
)
1021 spr_register(env
, SPR_SPRG4
, "SPRG4",
1022 SPR_NOACCESS
, SPR_NOACCESS
,
1023 &spr_read_generic
, &spr_write_generic
,
1025 spr_register(env
, SPR_SPRG5
, "SPRG5",
1026 SPR_NOACCESS
, SPR_NOACCESS
,
1027 &spr_read_generic
, &spr_write_generic
,
1029 spr_register(env
, SPR_SPRG6
, "SPRG6",
1030 SPR_NOACCESS
, SPR_NOACCESS
,
1031 &spr_read_generic
, &spr_write_generic
,
1033 spr_register(env
, SPR_SPRG7
, "SPRG7",
1034 SPR_NOACCESS
, SPR_NOACCESS
,
1035 &spr_read_generic
, &spr_write_generic
,
1039 /* SPR common to all 7xx PowerPC implementations */
1040 static void gen_spr_7xx(CPUPPCState
*env
)
1043 /* XXX : not implemented */
1044 spr_register_kvm(env
, SPR_DABR
, "DABR",
1045 SPR_NOACCESS
, SPR_NOACCESS
,
1046 &spr_read_generic
, &spr_write_generic
,
1047 KVM_REG_PPC_DABR
, 0x00000000);
1048 /* XXX : not implemented */
1049 spr_register(env
, SPR_IABR
, "IABR",
1050 SPR_NOACCESS
, SPR_NOACCESS
,
1051 &spr_read_generic
, &spr_write_generic
,
1053 /* Cache management */
1054 /* XXX : not implemented */
1055 spr_register(env
, SPR_ICTC
, "ICTC",
1056 SPR_NOACCESS
, SPR_NOACCESS
,
1057 &spr_read_generic
, &spr_write_generic
,
1059 /* Performance monitors */
1060 /* XXX : not implemented */
1061 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
1062 SPR_NOACCESS
, SPR_NOACCESS
,
1063 &spr_read_generic
, &spr_write_generic
,
1065 /* XXX : not implemented */
1066 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
1067 SPR_NOACCESS
, SPR_NOACCESS
,
1068 &spr_read_generic
, &spr_write_generic
,
1070 /* XXX : not implemented */
1071 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
1072 SPR_NOACCESS
, SPR_NOACCESS
,
1073 &spr_read_generic
, &spr_write_generic
,
1075 /* XXX : not implemented */
1076 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
1077 SPR_NOACCESS
, SPR_NOACCESS
,
1078 &spr_read_generic
, &spr_write_generic
,
1080 /* XXX : not implemented */
1081 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
1082 SPR_NOACCESS
, SPR_NOACCESS
,
1083 &spr_read_generic
, &spr_write_generic
,
1085 /* XXX : not implemented */
1086 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
1087 SPR_NOACCESS
, SPR_NOACCESS
,
1088 &spr_read_generic
, &spr_write_generic
,
1090 /* XXX : not implemented */
1091 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
1092 SPR_NOACCESS
, SPR_NOACCESS
,
1093 &spr_read_generic
, SPR_NOACCESS
,
1095 /* XXX : not implemented */
1096 spr_register(env
, SPR_7XX_UMMCR0
, "UMMCR0",
1097 &spr_read_ureg
, SPR_NOACCESS
,
1098 &spr_read_ureg
, SPR_NOACCESS
,
1100 /* XXX : not implemented */
1101 spr_register(env
, SPR_7XX_UMMCR1
, "UMMCR1",
1102 &spr_read_ureg
, SPR_NOACCESS
,
1103 &spr_read_ureg
, SPR_NOACCESS
,
1105 /* XXX : not implemented */
1106 spr_register(env
, SPR_7XX_UPMC1
, "UPMC1",
1107 &spr_read_ureg
, SPR_NOACCESS
,
1108 &spr_read_ureg
, SPR_NOACCESS
,
1110 /* XXX : not implemented */
1111 spr_register(env
, SPR_7XX_UPMC2
, "UPMC2",
1112 &spr_read_ureg
, SPR_NOACCESS
,
1113 &spr_read_ureg
, SPR_NOACCESS
,
1115 /* XXX : not implemented */
1116 spr_register(env
, SPR_7XX_UPMC3
, "UPMC3",
1117 &spr_read_ureg
, SPR_NOACCESS
,
1118 &spr_read_ureg
, SPR_NOACCESS
,
1120 /* XXX : not implemented */
1121 spr_register(env
, SPR_7XX_UPMC4
, "UPMC4",
1122 &spr_read_ureg
, SPR_NOACCESS
,
1123 &spr_read_ureg
, SPR_NOACCESS
,
1125 /* XXX : not implemented */
1126 spr_register(env
, SPR_7XX_USIAR
, "USIAR",
1127 &spr_read_ureg
, SPR_NOACCESS
,
1128 &spr_read_ureg
, SPR_NOACCESS
,
1130 /* External access control */
1131 /* XXX : not implemented */
1132 spr_register(env
, SPR_EAR
, "EAR",
1133 SPR_NOACCESS
, SPR_NOACCESS
,
1134 &spr_read_generic
, &spr_write_generic
,
1139 #ifndef CONFIG_USER_ONLY
1140 static void spr_write_amr(DisasContext
*ctx
, int sprn
, int gprn
)
1142 TCGv t0
= tcg_temp_new();
1143 TCGv t1
= tcg_temp_new();
1144 TCGv t2
= tcg_temp_new();
1147 * Note, the HV=1 PR=0 case is handled earlier by simply using
1148 * spr_write_generic for HV mode in the SPR table
1151 /* Build insertion mask into t1 based on context */
1153 gen_load_spr(t1
, SPR_UAMOR
);
1155 gen_load_spr(t1
, SPR_AMOR
);
1158 /* Mask new bits into t2 */
1159 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1161 /* Load AMR and clear new bits in t0 */
1162 gen_load_spr(t0
, SPR_AMR
);
1163 tcg_gen_andc_tl(t0
, t0
, t1
);
1165 /* Or'in new bits and write it out */
1166 tcg_gen_or_tl(t0
, t0
, t2
);
1167 gen_store_spr(SPR_AMR
, t0
);
1168 spr_store_dump_spr(SPR_AMR
);
1175 static void spr_write_uamor(DisasContext
*ctx
, int sprn
, int gprn
)
1177 TCGv t0
= tcg_temp_new();
1178 TCGv t1
= tcg_temp_new();
1179 TCGv t2
= tcg_temp_new();
1182 * Note, the HV=1 case is handled earlier by simply using
1183 * spr_write_generic for HV mode in the SPR table
1186 /* Build insertion mask into t1 based on context */
1187 gen_load_spr(t1
, SPR_AMOR
);
1189 /* Mask new bits into t2 */
1190 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1192 /* Load AMR and clear new bits in t0 */
1193 gen_load_spr(t0
, SPR_UAMOR
);
1194 tcg_gen_andc_tl(t0
, t0
, t1
);
1196 /* Or'in new bits and write it out */
1197 tcg_gen_or_tl(t0
, t0
, t2
);
1198 gen_store_spr(SPR_UAMOR
, t0
);
1199 spr_store_dump_spr(SPR_UAMOR
);
1206 static void spr_write_iamr(DisasContext
*ctx
, int sprn
, int gprn
)
1208 TCGv t0
= tcg_temp_new();
1209 TCGv t1
= tcg_temp_new();
1210 TCGv t2
= tcg_temp_new();
1213 * Note, the HV=1 case is handled earlier by simply using
1214 * spr_write_generic for HV mode in the SPR table
1217 /* Build insertion mask into t1 based on context */
1218 gen_load_spr(t1
, SPR_AMOR
);
1220 /* Mask new bits into t2 */
1221 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1223 /* Load AMR and clear new bits in t0 */
1224 gen_load_spr(t0
, SPR_IAMR
);
1225 tcg_gen_andc_tl(t0
, t0
, t1
);
1227 /* Or'in new bits and write it out */
1228 tcg_gen_or_tl(t0
, t0
, t2
);
1229 gen_store_spr(SPR_IAMR
, t0
);
1230 spr_store_dump_spr(SPR_IAMR
);
1236 #endif /* CONFIG_USER_ONLY */
1238 static void gen_spr_amr(CPUPPCState
*env
)
1240 #ifndef CONFIG_USER_ONLY
1242 * Virtual Page Class Key protection
1244 * The AMR is accessible either via SPR 13 or SPR 29. 13 is
1245 * userspace accessible, 29 is privileged. So we only need to set
1246 * the kvm ONE_REG id on one of them, we use 29
1248 spr_register(env
, SPR_UAMR
, "UAMR",
1249 &spr_read_generic
, &spr_write_amr
,
1250 &spr_read_generic
, &spr_write_amr
,
1252 spr_register_kvm_hv(env
, SPR_AMR
, "AMR",
1253 SPR_NOACCESS
, SPR_NOACCESS
,
1254 &spr_read_generic
, &spr_write_amr
,
1255 &spr_read_generic
, &spr_write_generic
,
1256 KVM_REG_PPC_AMR
, 0);
1257 spr_register_kvm_hv(env
, SPR_UAMOR
, "UAMOR",
1258 SPR_NOACCESS
, SPR_NOACCESS
,
1259 &spr_read_generic
, &spr_write_uamor
,
1260 &spr_read_generic
, &spr_write_generic
,
1261 KVM_REG_PPC_UAMOR
, 0);
1262 spr_register_hv(env
, SPR_AMOR
, "AMOR",
1263 SPR_NOACCESS
, SPR_NOACCESS
,
1264 SPR_NOACCESS
, SPR_NOACCESS
,
1265 &spr_read_generic
, &spr_write_generic
,
1267 #endif /* !CONFIG_USER_ONLY */
1270 static void gen_spr_iamr(CPUPPCState
*env
)
1272 #ifndef CONFIG_USER_ONLY
1273 spr_register_kvm_hv(env
, SPR_IAMR
, "IAMR",
1274 SPR_NOACCESS
, SPR_NOACCESS
,
1275 &spr_read_generic
, &spr_write_iamr
,
1276 &spr_read_generic
, &spr_write_generic
,
1277 KVM_REG_PPC_IAMR
, 0);
1278 #endif /* !CONFIG_USER_ONLY */
1280 #endif /* TARGET_PPC64 */
1282 #ifndef CONFIG_USER_ONLY
1283 static void spr_read_thrm(DisasContext
*ctx
, int gprn
, int sprn
)
1285 gen_helper_fixup_thrm(cpu_env
);
1286 gen_load_spr(cpu_gpr
[gprn
], sprn
);
1287 spr_load_dump_spr(sprn
);
1289 #endif /* !CONFIG_USER_ONLY */
1291 static void gen_spr_thrm(CPUPPCState
*env
)
1293 /* Thermal management */
1294 /* XXX : not implemented */
1295 spr_register(env
, SPR_THRM1
, "THRM1",
1296 SPR_NOACCESS
, SPR_NOACCESS
,
1297 &spr_read_thrm
, &spr_write_generic
,
1299 /* XXX : not implemented */
1300 spr_register(env
, SPR_THRM2
, "THRM2",
1301 SPR_NOACCESS
, SPR_NOACCESS
,
1302 &spr_read_thrm
, &spr_write_generic
,
1304 /* XXX : not implemented */
1305 spr_register(env
, SPR_THRM3
, "THRM3",
1306 SPR_NOACCESS
, SPR_NOACCESS
,
1307 &spr_read_thrm
, &spr_write_generic
,
1311 /* SPR specific to PowerPC 604 implementation */
1312 static void gen_spr_604(CPUPPCState
*env
)
1314 /* Processor identification */
1315 spr_register(env
, SPR_PIR
, "PIR",
1316 SPR_NOACCESS
, SPR_NOACCESS
,
1317 &spr_read_generic
, &spr_write_pir
,
1320 /* XXX : not implemented */
1321 spr_register(env
, SPR_IABR
, "IABR",
1322 SPR_NOACCESS
, SPR_NOACCESS
,
1323 &spr_read_generic
, &spr_write_generic
,
1325 /* XXX : not implemented */
1326 spr_register_kvm(env
, SPR_DABR
, "DABR",
1327 SPR_NOACCESS
, SPR_NOACCESS
,
1328 &spr_read_generic
, &spr_write_generic
,
1329 KVM_REG_PPC_DABR
, 0x00000000);
1330 /* Performance counters */
1331 /* XXX : not implemented */
1332 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
1333 SPR_NOACCESS
, SPR_NOACCESS
,
1334 &spr_read_generic
, &spr_write_generic
,
1336 /* XXX : not implemented */
1337 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
1338 SPR_NOACCESS
, SPR_NOACCESS
,
1339 &spr_read_generic
, &spr_write_generic
,
1341 /* XXX : not implemented */
1342 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
1343 SPR_NOACCESS
, SPR_NOACCESS
,
1344 &spr_read_generic
, &spr_write_generic
,
1346 /* XXX : not implemented */
1347 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
1348 SPR_NOACCESS
, SPR_NOACCESS
,
1349 &spr_read_generic
, SPR_NOACCESS
,
1351 /* XXX : not implemented */
1352 spr_register(env
, SPR_SDA
, "SDA",
1353 SPR_NOACCESS
, SPR_NOACCESS
,
1354 &spr_read_generic
, SPR_NOACCESS
,
1356 /* External access control */
1357 /* XXX : not implemented */
1358 spr_register(env
, SPR_EAR
, "EAR",
1359 SPR_NOACCESS
, SPR_NOACCESS
,
1360 &spr_read_generic
, &spr_write_generic
,
1364 /* SPR specific to PowerPC 603 implementation */
1365 static void gen_spr_603(CPUPPCState
*env
)
1367 /* External access control */
1368 /* XXX : not implemented */
1369 spr_register(env
, SPR_EAR
, "EAR",
1370 SPR_NOACCESS
, SPR_NOACCESS
,
1371 &spr_read_generic
, &spr_write_generic
,
1374 /* XXX : not implemented */
1375 spr_register(env
, SPR_IABR
, "IABR",
1376 SPR_NOACCESS
, SPR_NOACCESS
,
1377 &spr_read_generic
, &spr_write_generic
,
1382 /* SPR specific to PowerPC G2 implementation */
1383 static void gen_spr_G2(CPUPPCState
*env
)
1385 /* Memory base address */
1387 /* XXX : not implemented */
1388 spr_register(env
, SPR_MBAR
, "MBAR",
1389 SPR_NOACCESS
, SPR_NOACCESS
,
1390 &spr_read_generic
, &spr_write_generic
,
1392 /* Exception processing */
1393 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1394 SPR_NOACCESS
, SPR_NOACCESS
,
1395 &spr_read_generic
, &spr_write_generic
,
1397 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1398 SPR_NOACCESS
, SPR_NOACCESS
,
1399 &spr_read_generic
, &spr_write_generic
,
1402 /* XXX : not implemented */
1403 spr_register(env
, SPR_DABR
, "DABR",
1404 SPR_NOACCESS
, SPR_NOACCESS
,
1405 &spr_read_generic
, &spr_write_generic
,
1407 /* XXX : not implemented */
1408 spr_register(env
, SPR_DABR2
, "DABR2",
1409 SPR_NOACCESS
, SPR_NOACCESS
,
1410 &spr_read_generic
, &spr_write_generic
,
1412 /* XXX : not implemented */
1413 spr_register(env
, SPR_IABR
, "IABR",
1414 SPR_NOACCESS
, SPR_NOACCESS
,
1415 &spr_read_generic
, &spr_write_generic
,
1417 /* XXX : not implemented */
1418 spr_register(env
, SPR_IABR2
, "IABR2",
1419 SPR_NOACCESS
, SPR_NOACCESS
,
1420 &spr_read_generic
, &spr_write_generic
,
1422 /* XXX : not implemented */
1423 spr_register(env
, SPR_IBCR
, "IBCR",
1424 SPR_NOACCESS
, SPR_NOACCESS
,
1425 &spr_read_generic
, &spr_write_generic
,
1427 /* XXX : not implemented */
1428 spr_register(env
, SPR_DBCR
, "DBCR",
1429 SPR_NOACCESS
, SPR_NOACCESS
,
1430 &spr_read_generic
, &spr_write_generic
,
1434 /* SPR specific to PowerPC 602 implementation */
1435 static void gen_spr_602(CPUPPCState
*env
)
1438 /* XXX : not implemented */
1439 spr_register(env
, SPR_SER
, "SER",
1440 SPR_NOACCESS
, SPR_NOACCESS
,
1441 &spr_read_generic
, &spr_write_generic
,
1443 /* XXX : not implemented */
1444 spr_register(env
, SPR_SEBR
, "SEBR",
1445 SPR_NOACCESS
, SPR_NOACCESS
,
1446 &spr_read_generic
, &spr_write_generic
,
1448 /* XXX : not implemented */
1449 spr_register(env
, SPR_ESASRR
, "ESASRR",
1450 SPR_NOACCESS
, SPR_NOACCESS
,
1451 &spr_read_generic
, &spr_write_generic
,
1453 /* Floating point status */
1454 /* XXX : not implemented */
1455 spr_register(env
, SPR_SP
, "SP",
1456 SPR_NOACCESS
, SPR_NOACCESS
,
1457 &spr_read_generic
, &spr_write_generic
,
1459 /* XXX : not implemented */
1460 spr_register(env
, SPR_LT
, "LT",
1461 SPR_NOACCESS
, SPR_NOACCESS
,
1462 &spr_read_generic
, &spr_write_generic
,
1464 /* Watchdog timer */
1465 /* XXX : not implemented */
1466 spr_register(env
, SPR_TCR
, "TCR",
1467 SPR_NOACCESS
, SPR_NOACCESS
,
1468 &spr_read_generic
, &spr_write_generic
,
1470 /* Interrupt base */
1471 spr_register(env
, SPR_IBR
, "IBR",
1472 SPR_NOACCESS
, SPR_NOACCESS
,
1473 &spr_read_generic
, &spr_write_generic
,
1475 /* XXX : not implemented */
1476 spr_register(env
, SPR_IABR
, "IABR",
1477 SPR_NOACCESS
, SPR_NOACCESS
,
1478 &spr_read_generic
, &spr_write_generic
,
1482 /* SPR specific to PowerPC 601 implementation */
1483 static void gen_spr_601(CPUPPCState
*env
)
1485 /* Multiplication/division register */
1487 spr_register(env
, SPR_MQ
, "MQ",
1488 &spr_read_generic
, &spr_write_generic
,
1489 &spr_read_generic
, &spr_write_generic
,
1492 spr_register(env
, SPR_601_RTCU
, "RTCU",
1493 SPR_NOACCESS
, SPR_NOACCESS
,
1494 SPR_NOACCESS
, &spr_write_601_rtcu
,
1496 spr_register(env
, SPR_601_VRTCU
, "RTCU",
1497 &spr_read_601_rtcu
, SPR_NOACCESS
,
1498 &spr_read_601_rtcu
, SPR_NOACCESS
,
1500 spr_register(env
, SPR_601_RTCL
, "RTCL",
1501 SPR_NOACCESS
, SPR_NOACCESS
,
1502 SPR_NOACCESS
, &spr_write_601_rtcl
,
1504 spr_register(env
, SPR_601_VRTCL
, "RTCL",
1505 &spr_read_601_rtcl
, SPR_NOACCESS
,
1506 &spr_read_601_rtcl
, SPR_NOACCESS
,
1510 spr_register(env
, SPR_601_UDECR
, "UDECR",
1511 &spr_read_decr
, SPR_NOACCESS
,
1512 &spr_read_decr
, SPR_NOACCESS
,
1515 /* External access control */
1516 /* XXX : not implemented */
1517 spr_register(env
, SPR_EAR
, "EAR",
1518 SPR_NOACCESS
, SPR_NOACCESS
,
1519 &spr_read_generic
, &spr_write_generic
,
1521 /* Memory management */
1522 #if !defined(CONFIG_USER_ONLY)
1523 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
1524 SPR_NOACCESS
, SPR_NOACCESS
,
1525 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1527 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
1528 SPR_NOACCESS
, SPR_NOACCESS
,
1529 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1531 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
1532 SPR_NOACCESS
, SPR_NOACCESS
,
1533 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1535 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
1536 SPR_NOACCESS
, SPR_NOACCESS
,
1537 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1539 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
1540 SPR_NOACCESS
, SPR_NOACCESS
,
1541 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1543 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
1544 SPR_NOACCESS
, SPR_NOACCESS
,
1545 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1547 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
1548 SPR_NOACCESS
, SPR_NOACCESS
,
1549 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1551 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
1552 SPR_NOACCESS
, SPR_NOACCESS
,
1553 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1559 static void gen_spr_74xx(CPUPPCState
*env
)
1561 /* Processor identification */
1562 spr_register(env
, SPR_PIR
, "PIR",
1563 SPR_NOACCESS
, SPR_NOACCESS
,
1564 &spr_read_generic
, &spr_write_pir
,
1566 /* XXX : not implemented */
1567 spr_register(env
, SPR_74XX_MMCR2
, "MMCR2",
1568 SPR_NOACCESS
, SPR_NOACCESS
,
1569 &spr_read_generic
, &spr_write_generic
,
1571 /* XXX : not implemented */
1572 spr_register(env
, SPR_74XX_UMMCR2
, "UMMCR2",
1573 &spr_read_ureg
, SPR_NOACCESS
,
1574 &spr_read_ureg
, SPR_NOACCESS
,
1576 /* XXX: not implemented */
1577 spr_register(env
, SPR_BAMR
, "BAMR",
1578 SPR_NOACCESS
, SPR_NOACCESS
,
1579 &spr_read_generic
, &spr_write_generic
,
1581 /* XXX : not implemented */
1582 spr_register(env
, SPR_MSSCR0
, "MSSCR0",
1583 SPR_NOACCESS
, SPR_NOACCESS
,
1584 &spr_read_generic
, &spr_write_generic
,
1586 /* Hardware implementation registers */
1587 /* XXX : not implemented */
1588 spr_register(env
, SPR_HID0
, "HID0",
1589 SPR_NOACCESS
, SPR_NOACCESS
,
1590 &spr_read_generic
, &spr_write_generic
,
1592 /* XXX : not implemented */
1593 spr_register(env
, SPR_HID1
, "HID1",
1594 SPR_NOACCESS
, SPR_NOACCESS
,
1595 &spr_read_generic
, &spr_write_generic
,
1598 spr_register(env
, SPR_VRSAVE
, "VRSAVE",
1599 &spr_read_generic
, &spr_write_generic
,
1600 &spr_read_generic
, &spr_write_generic
,
1602 /* XXX : not implemented */
1603 spr_register(env
, SPR_L2CR
, "L2CR",
1604 SPR_NOACCESS
, SPR_NOACCESS
,
1605 &spr_read_generic
, spr_access_nop
,
1607 /* Not strictly an SPR */
1608 vscr_init(env
, 0x00010000);
1611 static void gen_l3_ctrl(CPUPPCState
*env
)
1614 /* XXX : not implemented */
1615 spr_register(env
, SPR_L3CR
, "L3CR",
1616 SPR_NOACCESS
, SPR_NOACCESS
,
1617 &spr_read_generic
, &spr_write_generic
,
1620 /* XXX : not implemented */
1621 spr_register(env
, SPR_L3ITCR0
, "L3ITCR0",
1622 SPR_NOACCESS
, SPR_NOACCESS
,
1623 &spr_read_generic
, &spr_write_generic
,
1626 /* XXX : not implemented */
1627 spr_register(env
, SPR_L3PM
, "L3PM",
1628 SPR_NOACCESS
, SPR_NOACCESS
,
1629 &spr_read_generic
, &spr_write_generic
,
1633 static void gen_74xx_soft_tlb(CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
1635 #if !defined(CONFIG_USER_ONLY)
1636 env
->nb_tlb
= nb_tlbs
;
1637 env
->nb_ways
= nb_ways
;
1639 env
->tlb_type
= TLB_6XX
;
1640 /* XXX : not implemented */
1641 spr_register(env
, SPR_PTEHI
, "PTEHI",
1642 SPR_NOACCESS
, SPR_NOACCESS
,
1643 &spr_read_generic
, &spr_write_generic
,
1645 /* XXX : not implemented */
1646 spr_register(env
, SPR_PTELO
, "PTELO",
1647 SPR_NOACCESS
, SPR_NOACCESS
,
1648 &spr_read_generic
, &spr_write_generic
,
1650 /* XXX : not implemented */
1651 spr_register(env
, SPR_TLBMISS
, "TLBMISS",
1652 SPR_NOACCESS
, SPR_NOACCESS
,
1653 &spr_read_generic
, &spr_write_generic
,
1658 #if !defined(CONFIG_USER_ONLY)
1659 static void spr_write_e500_l1csr0(DisasContext
*ctx
, int sprn
, int gprn
)
1661 TCGv t0
= tcg_temp_new();
1663 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR0_DCE
| L1CSR0_CPE
);
1664 gen_store_spr(sprn
, t0
);
1668 static void spr_write_e500_l1csr1(DisasContext
*ctx
, int sprn
, int gprn
)
1670 TCGv t0
= tcg_temp_new();
1672 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR1_ICE
| L1CSR1_CPE
);
1673 gen_store_spr(sprn
, t0
);
1677 static void spr_write_booke206_mmucsr0(DisasContext
*ctx
, int sprn
, int gprn
)
1679 gen_helper_booke206_tlbflush(cpu_env
, cpu_gpr
[gprn
]);
1682 static void spr_write_booke_pid(DisasContext
*ctx
, int sprn
, int gprn
)
1684 TCGv_i32 t0
= tcg_const_i32(sprn
);
1685 gen_helper_booke_setpid(cpu_env
, t0
, cpu_gpr
[gprn
]);
1686 tcg_temp_free_i32(t0
);
1688 static void spr_write_eplc(DisasContext
*ctx
, int sprn
, int gprn
)
1690 gen_helper_booke_set_eplc(cpu_env
, cpu_gpr
[gprn
]);
1692 static void spr_write_epsc(DisasContext
*ctx
, int sprn
, int gprn
)
1694 gen_helper_booke_set_epsc(cpu_env
, cpu_gpr
[gprn
]);
1699 static void gen_spr_usprg3(CPUPPCState
*env
)
1701 spr_register(env
, SPR_USPRG3
, "USPRG3",
1702 &spr_read_ureg
, SPR_NOACCESS
,
1703 &spr_read_ureg
, SPR_NOACCESS
,
1707 static void gen_spr_usprgh(CPUPPCState
*env
)
1709 spr_register(env
, SPR_USPRG4
, "USPRG4",
1710 &spr_read_ureg
, SPR_NOACCESS
,
1711 &spr_read_ureg
, SPR_NOACCESS
,
1713 spr_register(env
, SPR_USPRG5
, "USPRG5",
1714 &spr_read_ureg
, SPR_NOACCESS
,
1715 &spr_read_ureg
, SPR_NOACCESS
,
1717 spr_register(env
, SPR_USPRG6
, "USPRG6",
1718 &spr_read_ureg
, SPR_NOACCESS
,
1719 &spr_read_ureg
, SPR_NOACCESS
,
1721 spr_register(env
, SPR_USPRG7
, "USPRG7",
1722 &spr_read_ureg
, SPR_NOACCESS
,
1723 &spr_read_ureg
, SPR_NOACCESS
,
1727 /* PowerPC BookE SPR */
1728 static void gen_spr_BookE(CPUPPCState
*env
, uint64_t ivor_mask
)
1730 const char *ivor_names
[64] = {
1731 "IVOR0", "IVOR1", "IVOR2", "IVOR3",
1732 "IVOR4", "IVOR5", "IVOR6", "IVOR7",
1733 "IVOR8", "IVOR9", "IVOR10", "IVOR11",
1734 "IVOR12", "IVOR13", "IVOR14", "IVOR15",
1735 "IVOR16", "IVOR17", "IVOR18", "IVOR19",
1736 "IVOR20", "IVOR21", "IVOR22", "IVOR23",
1737 "IVOR24", "IVOR25", "IVOR26", "IVOR27",
1738 "IVOR28", "IVOR29", "IVOR30", "IVOR31",
1739 "IVOR32", "IVOR33", "IVOR34", "IVOR35",
1740 "IVOR36", "IVOR37", "IVOR38", "IVOR39",
1741 "IVOR40", "IVOR41", "IVOR42", "IVOR43",
1742 "IVOR44", "IVOR45", "IVOR46", "IVOR47",
1743 "IVOR48", "IVOR49", "IVOR50", "IVOR51",
1744 "IVOR52", "IVOR53", "IVOR54", "IVOR55",
1745 "IVOR56", "IVOR57", "IVOR58", "IVOR59",
1746 "IVOR60", "IVOR61", "IVOR62", "IVOR63",
1748 #define SPR_BOOKE_IVORxx (-1)
1749 int ivor_sprn
[64] = {
1750 SPR_BOOKE_IVOR0
, SPR_BOOKE_IVOR1
, SPR_BOOKE_IVOR2
, SPR_BOOKE_IVOR3
,
1751 SPR_BOOKE_IVOR4
, SPR_BOOKE_IVOR5
, SPR_BOOKE_IVOR6
, SPR_BOOKE_IVOR7
,
1752 SPR_BOOKE_IVOR8
, SPR_BOOKE_IVOR9
, SPR_BOOKE_IVOR10
, SPR_BOOKE_IVOR11
,
1753 SPR_BOOKE_IVOR12
, SPR_BOOKE_IVOR13
, SPR_BOOKE_IVOR14
, SPR_BOOKE_IVOR15
,
1754 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1755 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1756 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1757 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1758 SPR_BOOKE_IVOR32
, SPR_BOOKE_IVOR33
, SPR_BOOKE_IVOR34
, SPR_BOOKE_IVOR35
,
1759 SPR_BOOKE_IVOR36
, SPR_BOOKE_IVOR37
, SPR_BOOKE_IVOR38
, SPR_BOOKE_IVOR39
,
1760 SPR_BOOKE_IVOR40
, SPR_BOOKE_IVOR41
, SPR_BOOKE_IVOR42
, SPR_BOOKE_IVORxx
,
1761 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1762 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1763 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1764 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1765 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1769 /* Interrupt processing */
1770 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1771 SPR_NOACCESS
, SPR_NOACCESS
,
1772 &spr_read_generic
, &spr_write_generic
,
1774 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1775 SPR_NOACCESS
, SPR_NOACCESS
,
1776 &spr_read_generic
, &spr_write_generic
,
1779 /* XXX : not implemented */
1780 spr_register(env
, SPR_BOOKE_IAC1
, "IAC1",
1781 SPR_NOACCESS
, SPR_NOACCESS
,
1782 &spr_read_generic
, &spr_write_generic
,
1784 /* XXX : not implemented */
1785 spr_register(env
, SPR_BOOKE_IAC2
, "IAC2",
1786 SPR_NOACCESS
, SPR_NOACCESS
,
1787 &spr_read_generic
, &spr_write_generic
,
1789 /* XXX : not implemented */
1790 spr_register(env
, SPR_BOOKE_DAC1
, "DAC1",
1791 SPR_NOACCESS
, SPR_NOACCESS
,
1792 &spr_read_generic
, &spr_write_generic
,
1794 /* XXX : not implemented */
1795 spr_register(env
, SPR_BOOKE_DAC2
, "DAC2",
1796 SPR_NOACCESS
, SPR_NOACCESS
,
1797 &spr_read_generic
, &spr_write_generic
,
1799 /* XXX : not implemented */
1800 spr_register(env
, SPR_BOOKE_DBCR0
, "DBCR0",
1801 SPR_NOACCESS
, SPR_NOACCESS
,
1802 &spr_read_generic
, &spr_write_40x_dbcr0
,
1804 /* XXX : not implemented */
1805 spr_register(env
, SPR_BOOKE_DBCR1
, "DBCR1",
1806 SPR_NOACCESS
, SPR_NOACCESS
,
1807 &spr_read_generic
, &spr_write_generic
,
1809 /* XXX : not implemented */
1810 spr_register(env
, SPR_BOOKE_DBCR2
, "DBCR2",
1811 SPR_NOACCESS
, SPR_NOACCESS
,
1812 &spr_read_generic
, &spr_write_generic
,
1814 spr_register(env
, SPR_BOOKE_DSRR0
, "DSRR0",
1815 SPR_NOACCESS
, SPR_NOACCESS
,
1816 &spr_read_generic
, &spr_write_generic
,
1818 spr_register(env
, SPR_BOOKE_DSRR1
, "DSRR1",
1819 SPR_NOACCESS
, SPR_NOACCESS
,
1820 &spr_read_generic
, &spr_write_generic
,
1822 /* XXX : not implemented */
1823 spr_register(env
, SPR_BOOKE_DBSR
, "DBSR",
1824 SPR_NOACCESS
, SPR_NOACCESS
,
1825 &spr_read_generic
, &spr_write_clear
,
1827 spr_register(env
, SPR_BOOKE_DEAR
, "DEAR",
1828 SPR_NOACCESS
, SPR_NOACCESS
,
1829 &spr_read_generic
, &spr_write_generic
,
1831 spr_register(env
, SPR_BOOKE_ESR
, "ESR",
1832 SPR_NOACCESS
, SPR_NOACCESS
,
1833 &spr_read_generic
, &spr_write_generic
,
1835 spr_register(env
, SPR_BOOKE_IVPR
, "IVPR",
1836 SPR_NOACCESS
, SPR_NOACCESS
,
1837 &spr_read_generic
, &spr_write_excp_prefix
,
1839 /* Exception vectors */
1840 for (i
= 0; i
< 64; i
++) {
1841 if (ivor_mask
& (1ULL << i
)) {
1842 if (ivor_sprn
[i
] == SPR_BOOKE_IVORxx
) {
1843 fprintf(stderr
, "ERROR: IVOR %d SPR is not defined\n", i
);
1846 spr_register(env
, ivor_sprn
[i
], ivor_names
[i
],
1847 SPR_NOACCESS
, SPR_NOACCESS
,
1848 &spr_read_generic
, &spr_write_excp_vector
,
1852 spr_register(env
, SPR_BOOKE_PID
, "PID",
1853 SPR_NOACCESS
, SPR_NOACCESS
,
1854 &spr_read_generic
, &spr_write_booke_pid
,
1856 spr_register(env
, SPR_BOOKE_TCR
, "TCR",
1857 SPR_NOACCESS
, SPR_NOACCESS
,
1858 &spr_read_generic
, &spr_write_booke_tcr
,
1860 spr_register(env
, SPR_BOOKE_TSR
, "TSR",
1861 SPR_NOACCESS
, SPR_NOACCESS
,
1862 &spr_read_generic
, &spr_write_booke_tsr
,
1865 spr_register(env
, SPR_DECR
, "DECR",
1866 SPR_NOACCESS
, SPR_NOACCESS
,
1867 &spr_read_decr
, &spr_write_decr
,
1869 spr_register(env
, SPR_BOOKE_DECAR
, "DECAR",
1870 SPR_NOACCESS
, SPR_NOACCESS
,
1871 SPR_NOACCESS
, &spr_write_generic
,
1874 spr_register(env
, SPR_USPRG0
, "USPRG0",
1875 &spr_read_generic
, &spr_write_generic
,
1876 &spr_read_generic
, &spr_write_generic
,
1878 spr_register(env
, SPR_SPRG4
, "SPRG4",
1879 SPR_NOACCESS
, SPR_NOACCESS
,
1880 &spr_read_generic
, &spr_write_generic
,
1882 spr_register(env
, SPR_SPRG5
, "SPRG5",
1883 SPR_NOACCESS
, SPR_NOACCESS
,
1884 &spr_read_generic
, &spr_write_generic
,
1886 spr_register(env
, SPR_SPRG6
, "SPRG6",
1887 SPR_NOACCESS
, SPR_NOACCESS
,
1888 &spr_read_generic
, &spr_write_generic
,
1890 spr_register(env
, SPR_SPRG7
, "SPRG7",
1891 SPR_NOACCESS
, SPR_NOACCESS
,
1892 &spr_read_generic
, &spr_write_generic
,
1894 spr_register(env
, SPR_BOOKE_SPRG8
, "SPRG8",
1895 SPR_NOACCESS
, SPR_NOACCESS
,
1896 &spr_read_generic
, &spr_write_generic
,
1898 spr_register(env
, SPR_BOOKE_SPRG9
, "SPRG9",
1899 SPR_NOACCESS
, SPR_NOACCESS
,
1900 &spr_read_generic
, &spr_write_generic
,
1904 static inline uint32_t gen_tlbncfg(uint32_t assoc
, uint32_t minsize
,
1905 uint32_t maxsize
, uint32_t flags
,
1908 return (assoc
<< TLBnCFG_ASSOC_SHIFT
) |
1909 (minsize
<< TLBnCFG_MINSIZE_SHIFT
) |
1910 (maxsize
<< TLBnCFG_MAXSIZE_SHIFT
) |
1914 /* BookE 2.06 storage control registers */
1915 static void gen_spr_BookE206(CPUPPCState
*env
, uint32_t mas_mask
,
1916 uint32_t *tlbncfg
, uint32_t mmucfg
)
1918 #if !defined(CONFIG_USER_ONLY)
1919 const char *mas_names
[8] = {
1920 "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
1923 SPR_BOOKE_MAS0
, SPR_BOOKE_MAS1
, SPR_BOOKE_MAS2
, SPR_BOOKE_MAS3
,
1924 SPR_BOOKE_MAS4
, SPR_BOOKE_MAS5
, SPR_BOOKE_MAS6
, SPR_BOOKE_MAS7
,
1928 /* TLB assist registers */
1929 /* XXX : not implemented */
1930 for (i
= 0; i
< 8; i
++) {
1931 void (*uea_write
)(DisasContext
*ctx
, int sprn
, int gprn
) =
1932 &spr_write_generic32
;
1933 if (i
== 2 && (mas_mask
& (1 << i
)) && (env
->insns_flags
& PPC_64B
)) {
1934 uea_write
= &spr_write_generic
;
1936 if (mas_mask
& (1 << i
)) {
1937 spr_register(env
, mas_sprn
[i
], mas_names
[i
],
1938 SPR_NOACCESS
, SPR_NOACCESS
,
1939 &spr_read_generic
, uea_write
,
1943 if (env
->nb_pids
> 1) {
1944 /* XXX : not implemented */
1945 spr_register(env
, SPR_BOOKE_PID1
, "PID1",
1946 SPR_NOACCESS
, SPR_NOACCESS
,
1947 &spr_read_generic
, &spr_write_booke_pid
,
1950 if (env
->nb_pids
> 2) {
1951 /* XXX : not implemented */
1952 spr_register(env
, SPR_BOOKE_PID2
, "PID2",
1953 SPR_NOACCESS
, SPR_NOACCESS
,
1954 &spr_read_generic
, &spr_write_booke_pid
,
1958 spr_register(env
, SPR_BOOKE_EPLC
, "EPLC",
1959 SPR_NOACCESS
, SPR_NOACCESS
,
1960 &spr_read_generic
, &spr_write_eplc
,
1962 spr_register(env
, SPR_BOOKE_EPSC
, "EPSC",
1963 SPR_NOACCESS
, SPR_NOACCESS
,
1964 &spr_read_generic
, &spr_write_epsc
,
1967 /* XXX : not implemented */
1968 spr_register(env
, SPR_MMUCFG
, "MMUCFG",
1969 SPR_NOACCESS
, SPR_NOACCESS
,
1970 &spr_read_generic
, SPR_NOACCESS
,
1972 switch (env
->nb_ways
) {
1974 spr_register(env
, SPR_BOOKE_TLB3CFG
, "TLB3CFG",
1975 SPR_NOACCESS
, SPR_NOACCESS
,
1976 &spr_read_generic
, SPR_NOACCESS
,
1980 spr_register(env
, SPR_BOOKE_TLB2CFG
, "TLB2CFG",
1981 SPR_NOACCESS
, SPR_NOACCESS
,
1982 &spr_read_generic
, SPR_NOACCESS
,
1986 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
1987 SPR_NOACCESS
, SPR_NOACCESS
,
1988 &spr_read_generic
, SPR_NOACCESS
,
1992 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
1993 SPR_NOACCESS
, SPR_NOACCESS
,
1994 &spr_read_generic
, SPR_NOACCESS
,
2003 gen_spr_usprgh(env
);
2006 /* SPR specific to PowerPC 440 implementation */
2007 static void gen_spr_440(CPUPPCState
*env
)
2010 /* XXX : not implemented */
2011 spr_register(env
, SPR_440_DNV0
, "DNV0",
2012 SPR_NOACCESS
, SPR_NOACCESS
,
2013 &spr_read_generic
, &spr_write_generic
,
2015 /* XXX : not implemented */
2016 spr_register(env
, SPR_440_DNV1
, "DNV1",
2017 SPR_NOACCESS
, SPR_NOACCESS
,
2018 &spr_read_generic
, &spr_write_generic
,
2020 /* XXX : not implemented */
2021 spr_register(env
, SPR_440_DNV2
, "DNV2",
2022 SPR_NOACCESS
, SPR_NOACCESS
,
2023 &spr_read_generic
, &spr_write_generic
,
2025 /* XXX : not implemented */
2026 spr_register(env
, SPR_440_DNV3
, "DNV3",
2027 SPR_NOACCESS
, SPR_NOACCESS
,
2028 &spr_read_generic
, &spr_write_generic
,
2030 /* XXX : not implemented */
2031 spr_register(env
, SPR_440_DTV0
, "DTV0",
2032 SPR_NOACCESS
, SPR_NOACCESS
,
2033 &spr_read_generic
, &spr_write_generic
,
2035 /* XXX : not implemented */
2036 spr_register(env
, SPR_440_DTV1
, "DTV1",
2037 SPR_NOACCESS
, SPR_NOACCESS
,
2038 &spr_read_generic
, &spr_write_generic
,
2040 /* XXX : not implemented */
2041 spr_register(env
, SPR_440_DTV2
, "DTV2",
2042 SPR_NOACCESS
, SPR_NOACCESS
,
2043 &spr_read_generic
, &spr_write_generic
,
2045 /* XXX : not implemented */
2046 spr_register(env
, SPR_440_DTV3
, "DTV3",
2047 SPR_NOACCESS
, SPR_NOACCESS
,
2048 &spr_read_generic
, &spr_write_generic
,
2050 /* XXX : not implemented */
2051 spr_register(env
, SPR_440_DVLIM
, "DVLIM",
2052 SPR_NOACCESS
, SPR_NOACCESS
,
2053 &spr_read_generic
, &spr_write_generic
,
2055 /* XXX : not implemented */
2056 spr_register(env
, SPR_440_INV0
, "INV0",
2057 SPR_NOACCESS
, SPR_NOACCESS
,
2058 &spr_read_generic
, &spr_write_generic
,
2060 /* XXX : not implemented */
2061 spr_register(env
, SPR_440_INV1
, "INV1",
2062 SPR_NOACCESS
, SPR_NOACCESS
,
2063 &spr_read_generic
, &spr_write_generic
,
2065 /* XXX : not implemented */
2066 spr_register(env
, SPR_440_INV2
, "INV2",
2067 SPR_NOACCESS
, SPR_NOACCESS
,
2068 &spr_read_generic
, &spr_write_generic
,
2070 /* XXX : not implemented */
2071 spr_register(env
, SPR_440_INV3
, "INV3",
2072 SPR_NOACCESS
, SPR_NOACCESS
,
2073 &spr_read_generic
, &spr_write_generic
,
2075 /* XXX : not implemented */
2076 spr_register(env
, SPR_440_ITV0
, "ITV0",
2077 SPR_NOACCESS
, SPR_NOACCESS
,
2078 &spr_read_generic
, &spr_write_generic
,
2080 /* XXX : not implemented */
2081 spr_register(env
, SPR_440_ITV1
, "ITV1",
2082 SPR_NOACCESS
, SPR_NOACCESS
,
2083 &spr_read_generic
, &spr_write_generic
,
2085 /* XXX : not implemented */
2086 spr_register(env
, SPR_440_ITV2
, "ITV2",
2087 SPR_NOACCESS
, SPR_NOACCESS
,
2088 &spr_read_generic
, &spr_write_generic
,
2090 /* XXX : not implemented */
2091 spr_register(env
, SPR_440_ITV3
, "ITV3",
2092 SPR_NOACCESS
, SPR_NOACCESS
,
2093 &spr_read_generic
, &spr_write_generic
,
2095 /* XXX : not implemented */
2096 spr_register(env
, SPR_440_IVLIM
, "IVLIM",
2097 SPR_NOACCESS
, SPR_NOACCESS
,
2098 &spr_read_generic
, &spr_write_generic
,
2101 /* XXX : not implemented */
2102 spr_register(env
, SPR_BOOKE_DCDBTRH
, "DCDBTRH",
2103 SPR_NOACCESS
, SPR_NOACCESS
,
2104 &spr_read_generic
, SPR_NOACCESS
,
2106 /* XXX : not implemented */
2107 spr_register(env
, SPR_BOOKE_DCDBTRL
, "DCDBTRL",
2108 SPR_NOACCESS
, SPR_NOACCESS
,
2109 &spr_read_generic
, SPR_NOACCESS
,
2111 /* XXX : not implemented */
2112 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
2113 SPR_NOACCESS
, SPR_NOACCESS
,
2114 &spr_read_generic
, SPR_NOACCESS
,
2116 /* XXX : not implemented */
2117 spr_register(env
, SPR_BOOKE_ICDBTRH
, "ICDBTRH",
2118 SPR_NOACCESS
, SPR_NOACCESS
,
2119 &spr_read_generic
, SPR_NOACCESS
,
2121 /* XXX : not implemented */
2122 spr_register(env
, SPR_BOOKE_ICDBTRL
, "ICDBTRL",
2123 SPR_NOACCESS
, SPR_NOACCESS
,
2124 &spr_read_generic
, SPR_NOACCESS
,
2126 /* XXX : not implemented */
2127 spr_register(env
, SPR_440_DBDR
, "DBDR",
2128 SPR_NOACCESS
, SPR_NOACCESS
,
2129 &spr_read_generic
, &spr_write_generic
,
2131 /* Processor control */
2132 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
2133 SPR_NOACCESS
, SPR_NOACCESS
,
2134 &spr_read_generic
, &spr_write_generic
,
2136 spr_register(env
, SPR_440_RSTCFG
, "RSTCFG",
2137 SPR_NOACCESS
, SPR_NOACCESS
,
2138 &spr_read_generic
, SPR_NOACCESS
,
2140 /* Storage control */
2141 spr_register(env
, SPR_440_MMUCR
, "MMUCR",
2142 SPR_NOACCESS
, SPR_NOACCESS
,
2143 &spr_read_generic
, &spr_write_generic
,
2147 /* SPR shared between PowerPC 40x implementations */
2148 static void gen_spr_40x(CPUPPCState
*env
)
2151 /* not emulated, as QEMU do not emulate caches */
2152 spr_register(env
, SPR_40x_DCCR
, "DCCR",
2153 SPR_NOACCESS
, SPR_NOACCESS
,
2154 &spr_read_generic
, &spr_write_generic
,
2156 /* not emulated, as QEMU do not emulate caches */
2157 spr_register(env
, SPR_40x_ICCR
, "ICCR",
2158 SPR_NOACCESS
, SPR_NOACCESS
,
2159 &spr_read_generic
, &spr_write_generic
,
2161 /* not emulated, as QEMU do not emulate caches */
2162 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
2163 SPR_NOACCESS
, SPR_NOACCESS
,
2164 &spr_read_generic
, SPR_NOACCESS
,
2167 spr_register(env
, SPR_40x_DEAR
, "DEAR",
2168 SPR_NOACCESS
, SPR_NOACCESS
,
2169 &spr_read_generic
, &spr_write_generic
,
2171 spr_register(env
, SPR_40x_ESR
, "ESR",
2172 SPR_NOACCESS
, SPR_NOACCESS
,
2173 &spr_read_generic
, &spr_write_generic
,
2175 spr_register(env
, SPR_40x_EVPR
, "EVPR",
2176 SPR_NOACCESS
, SPR_NOACCESS
,
2177 &spr_read_generic
, &spr_write_excp_prefix
,
2179 spr_register(env
, SPR_40x_SRR2
, "SRR2",
2180 &spr_read_generic
, &spr_write_generic
,
2181 &spr_read_generic
, &spr_write_generic
,
2183 spr_register(env
, SPR_40x_SRR3
, "SRR3",
2184 &spr_read_generic
, &spr_write_generic
,
2185 &spr_read_generic
, &spr_write_generic
,
2188 spr_register(env
, SPR_40x_PIT
, "PIT",
2189 SPR_NOACCESS
, SPR_NOACCESS
,
2190 &spr_read_40x_pit
, &spr_write_40x_pit
,
2192 spr_register(env
, SPR_40x_TCR
, "TCR",
2193 SPR_NOACCESS
, SPR_NOACCESS
,
2194 &spr_read_generic
, &spr_write_booke_tcr
,
2196 spr_register(env
, SPR_40x_TSR
, "TSR",
2197 SPR_NOACCESS
, SPR_NOACCESS
,
2198 &spr_read_generic
, &spr_write_booke_tsr
,
2202 /* SPR specific to PowerPC 405 implementation */
2203 static void gen_spr_405(CPUPPCState
*env
)
2206 spr_register(env
, SPR_40x_PID
, "PID",
2207 SPR_NOACCESS
, SPR_NOACCESS
,
2208 &spr_read_generic
, &spr_write_generic
,
2210 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
2211 SPR_NOACCESS
, SPR_NOACCESS
,
2212 &spr_read_generic
, &spr_write_generic
,
2214 /* Debug interface */
2215 /* XXX : not implemented */
2216 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2217 SPR_NOACCESS
, SPR_NOACCESS
,
2218 &spr_read_generic
, &spr_write_40x_dbcr0
,
2220 /* XXX : not implemented */
2221 spr_register(env
, SPR_405_DBCR1
, "DBCR1",
2222 SPR_NOACCESS
, SPR_NOACCESS
,
2223 &spr_read_generic
, &spr_write_generic
,
2225 /* XXX : not implemented */
2226 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2227 SPR_NOACCESS
, SPR_NOACCESS
,
2228 &spr_read_generic
, &spr_write_clear
,
2229 /* Last reset was system reset */
2231 /* XXX : not implemented */
2232 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2233 SPR_NOACCESS
, SPR_NOACCESS
,
2234 &spr_read_generic
, &spr_write_generic
,
2236 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2237 SPR_NOACCESS
, SPR_NOACCESS
,
2238 &spr_read_generic
, &spr_write_generic
,
2240 /* XXX : not implemented */
2241 spr_register(env
, SPR_405_DVC1
, "DVC1",
2242 SPR_NOACCESS
, SPR_NOACCESS
,
2243 &spr_read_generic
, &spr_write_generic
,
2245 /* XXX : not implemented */
2246 spr_register(env
, SPR_405_DVC2
, "DVC2",
2247 SPR_NOACCESS
, SPR_NOACCESS
,
2248 &spr_read_generic
, &spr_write_generic
,
2250 /* XXX : not implemented */
2251 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2252 SPR_NOACCESS
, SPR_NOACCESS
,
2253 &spr_read_generic
, &spr_write_generic
,
2255 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2256 SPR_NOACCESS
, SPR_NOACCESS
,
2257 &spr_read_generic
, &spr_write_generic
,
2259 /* XXX : not implemented */
2260 spr_register(env
, SPR_405_IAC3
, "IAC3",
2261 SPR_NOACCESS
, SPR_NOACCESS
,
2262 &spr_read_generic
, &spr_write_generic
,
2264 /* XXX : not implemented */
2265 spr_register(env
, SPR_405_IAC4
, "IAC4",
2266 SPR_NOACCESS
, SPR_NOACCESS
,
2267 &spr_read_generic
, &spr_write_generic
,
2269 /* Storage control */
2270 /* XXX: TODO: not implemented */
2271 spr_register(env
, SPR_405_SLER
, "SLER",
2272 SPR_NOACCESS
, SPR_NOACCESS
,
2273 &spr_read_generic
, &spr_write_40x_sler
,
2275 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2276 SPR_NOACCESS
, SPR_NOACCESS
,
2277 &spr_read_generic
, &spr_write_generic
,
2279 /* XXX : not implemented */
2280 spr_register(env
, SPR_405_SU0R
, "SU0R",
2281 SPR_NOACCESS
, SPR_NOACCESS
,
2282 &spr_read_generic
, &spr_write_generic
,
2285 spr_register(env
, SPR_USPRG0
, "USPRG0",
2286 &spr_read_ureg
, SPR_NOACCESS
,
2287 &spr_read_ureg
, SPR_NOACCESS
,
2289 spr_register(env
, SPR_SPRG4
, "SPRG4",
2290 SPR_NOACCESS
, SPR_NOACCESS
,
2291 &spr_read_generic
, &spr_write_generic
,
2293 spr_register(env
, SPR_SPRG5
, "SPRG5",
2294 SPR_NOACCESS
, SPR_NOACCESS
,
2295 spr_read_generic
, &spr_write_generic
,
2297 spr_register(env
, SPR_SPRG6
, "SPRG6",
2298 SPR_NOACCESS
, SPR_NOACCESS
,
2299 spr_read_generic
, &spr_write_generic
,
2301 spr_register(env
, SPR_SPRG7
, "SPRG7",
2302 SPR_NOACCESS
, SPR_NOACCESS
,
2303 spr_read_generic
, &spr_write_generic
,
2305 gen_spr_usprgh(env
);
2308 /* SPR shared between PowerPC 401 & 403 implementations */
2309 static void gen_spr_401_403(CPUPPCState
*env
)
2312 spr_register(env
, SPR_403_VTBL
, "TBL",
2313 &spr_read_tbl
, SPR_NOACCESS
,
2314 &spr_read_tbl
, SPR_NOACCESS
,
2316 spr_register(env
, SPR_403_TBL
, "TBL",
2317 SPR_NOACCESS
, SPR_NOACCESS
,
2318 SPR_NOACCESS
, &spr_write_tbl
,
2320 spr_register(env
, SPR_403_VTBU
, "TBU",
2321 &spr_read_tbu
, SPR_NOACCESS
,
2322 &spr_read_tbu
, SPR_NOACCESS
,
2324 spr_register(env
, SPR_403_TBU
, "TBU",
2325 SPR_NOACCESS
, SPR_NOACCESS
,
2326 SPR_NOACCESS
, &spr_write_tbu
,
2329 /* not emulated, as QEMU do not emulate caches */
2330 spr_register(env
, SPR_403_CDBCR
, "CDBCR",
2331 SPR_NOACCESS
, SPR_NOACCESS
,
2332 &spr_read_generic
, &spr_write_generic
,
2336 /* SPR specific to PowerPC 401 implementation */
2337 static void gen_spr_401(CPUPPCState
*env
)
2339 /* Debug interface */
2340 /* XXX : not implemented */
2341 spr_register(env
, SPR_40x_DBCR0
, "DBCR",
2342 SPR_NOACCESS
, SPR_NOACCESS
,
2343 &spr_read_generic
, &spr_write_40x_dbcr0
,
2345 /* XXX : not implemented */
2346 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2347 SPR_NOACCESS
, SPR_NOACCESS
,
2348 &spr_read_generic
, &spr_write_clear
,
2349 /* Last reset was system reset */
2351 /* XXX : not implemented */
2352 spr_register(env
, SPR_40x_DAC1
, "DAC",
2353 SPR_NOACCESS
, SPR_NOACCESS
,
2354 &spr_read_generic
, &spr_write_generic
,
2356 /* XXX : not implemented */
2357 spr_register(env
, SPR_40x_IAC1
, "IAC",
2358 SPR_NOACCESS
, SPR_NOACCESS
,
2359 &spr_read_generic
, &spr_write_generic
,
2361 /* Storage control */
2362 /* XXX: TODO: not implemented */
2363 spr_register(env
, SPR_405_SLER
, "SLER",
2364 SPR_NOACCESS
, SPR_NOACCESS
,
2365 &spr_read_generic
, &spr_write_40x_sler
,
2367 /* not emulated, as QEMU never does speculative access */
2368 spr_register(env
, SPR_40x_SGR
, "SGR",
2369 SPR_NOACCESS
, SPR_NOACCESS
,
2370 &spr_read_generic
, &spr_write_generic
,
2372 /* not emulated, as QEMU do not emulate caches */
2373 spr_register(env
, SPR_40x_DCWR
, "DCWR",
2374 SPR_NOACCESS
, SPR_NOACCESS
,
2375 &spr_read_generic
, &spr_write_generic
,
2379 static void gen_spr_401x2(CPUPPCState
*env
)
2382 spr_register(env
, SPR_40x_PID
, "PID",
2383 SPR_NOACCESS
, SPR_NOACCESS
,
2384 &spr_read_generic
, &spr_write_generic
,
2386 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2387 SPR_NOACCESS
, SPR_NOACCESS
,
2388 &spr_read_generic
, &spr_write_generic
,
2392 /* SPR specific to PowerPC 403 implementation */
2393 static void gen_spr_403(CPUPPCState
*env
)
2395 /* Debug interface */
2396 /* XXX : not implemented */
2397 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2398 SPR_NOACCESS
, SPR_NOACCESS
,
2399 &spr_read_generic
, &spr_write_40x_dbcr0
,
2401 /* XXX : not implemented */
2402 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2403 SPR_NOACCESS
, SPR_NOACCESS
,
2404 &spr_read_generic
, &spr_write_clear
,
2405 /* Last reset was system reset */
2407 /* XXX : not implemented */
2408 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2409 SPR_NOACCESS
, SPR_NOACCESS
,
2410 &spr_read_generic
, &spr_write_generic
,
2412 /* XXX : not implemented */
2413 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2414 SPR_NOACCESS
, SPR_NOACCESS
,
2415 &spr_read_generic
, &spr_write_generic
,
2417 /* XXX : not implemented */
2418 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2419 SPR_NOACCESS
, SPR_NOACCESS
,
2420 &spr_read_generic
, &spr_write_generic
,
2422 /* XXX : not implemented */
2423 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2424 SPR_NOACCESS
, SPR_NOACCESS
,
2425 &spr_read_generic
, &spr_write_generic
,
2429 static void gen_spr_403_real(CPUPPCState
*env
)
2431 spr_register(env
, SPR_403_PBL1
, "PBL1",
2432 SPR_NOACCESS
, SPR_NOACCESS
,
2433 &spr_read_403_pbr
, &spr_write_403_pbr
,
2435 spr_register(env
, SPR_403_PBU1
, "PBU1",
2436 SPR_NOACCESS
, SPR_NOACCESS
,
2437 &spr_read_403_pbr
, &spr_write_403_pbr
,
2439 spr_register(env
, SPR_403_PBL2
, "PBL2",
2440 SPR_NOACCESS
, SPR_NOACCESS
,
2441 &spr_read_403_pbr
, &spr_write_403_pbr
,
2443 spr_register(env
, SPR_403_PBU2
, "PBU2",
2444 SPR_NOACCESS
, SPR_NOACCESS
,
2445 &spr_read_403_pbr
, &spr_write_403_pbr
,
2449 static void gen_spr_403_mmu(CPUPPCState
*env
)
2452 spr_register(env
, SPR_40x_PID
, "PID",
2453 SPR_NOACCESS
, SPR_NOACCESS
,
2454 &spr_read_generic
, &spr_write_generic
,
2456 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2457 SPR_NOACCESS
, SPR_NOACCESS
,
2458 &spr_read_generic
, &spr_write_generic
,
2462 /* SPR specific to PowerPC compression coprocessor extension */
2463 static void gen_spr_compress(CPUPPCState
*env
)
2465 /* XXX : not implemented */
2466 spr_register(env
, SPR_401_SKR
, "SKR",
2467 SPR_NOACCESS
, SPR_NOACCESS
,
2468 &spr_read_generic
, &spr_write_generic
,
2472 static void gen_spr_5xx_8xx(CPUPPCState
*env
)
2474 /* Exception processing */
2475 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
2476 SPR_NOACCESS
, SPR_NOACCESS
,
2477 &spr_read_generic
, &spr_write_generic
,
2478 KVM_REG_PPC_DSISR
, 0x00000000);
2479 spr_register_kvm(env
, SPR_DAR
, "DAR",
2480 SPR_NOACCESS
, SPR_NOACCESS
,
2481 &spr_read_generic
, &spr_write_generic
,
2482 KVM_REG_PPC_DAR
, 0x00000000);
2484 spr_register(env
, SPR_DECR
, "DECR",
2485 SPR_NOACCESS
, SPR_NOACCESS
,
2486 &spr_read_decr
, &spr_write_decr
,
2488 /* XXX : not implemented */
2489 spr_register(env
, SPR_MPC_EIE
, "EIE",
2490 SPR_NOACCESS
, SPR_NOACCESS
,
2491 &spr_read_generic
, &spr_write_generic
,
2493 /* XXX : not implemented */
2494 spr_register(env
, SPR_MPC_EID
, "EID",
2495 SPR_NOACCESS
, SPR_NOACCESS
,
2496 &spr_read_generic
, &spr_write_generic
,
2498 /* XXX : not implemented */
2499 spr_register(env
, SPR_MPC_NRI
, "NRI",
2500 SPR_NOACCESS
, SPR_NOACCESS
,
2501 &spr_read_generic
, &spr_write_generic
,
2503 /* XXX : not implemented */
2504 spr_register(env
, SPR_MPC_CMPA
, "CMPA",
2505 SPR_NOACCESS
, SPR_NOACCESS
,
2506 &spr_read_generic
, &spr_write_generic
,
2508 /* XXX : not implemented */
2509 spr_register(env
, SPR_MPC_CMPB
, "CMPB",
2510 SPR_NOACCESS
, SPR_NOACCESS
,
2511 &spr_read_generic
, &spr_write_generic
,
2513 /* XXX : not implemented */
2514 spr_register(env
, SPR_MPC_CMPC
, "CMPC",
2515 SPR_NOACCESS
, SPR_NOACCESS
,
2516 &spr_read_generic
, &spr_write_generic
,
2518 /* XXX : not implemented */
2519 spr_register(env
, SPR_MPC_CMPD
, "CMPD",
2520 SPR_NOACCESS
, SPR_NOACCESS
,
2521 &spr_read_generic
, &spr_write_generic
,
2523 /* XXX : not implemented */
2524 spr_register(env
, SPR_MPC_ECR
, "ECR",
2525 SPR_NOACCESS
, SPR_NOACCESS
,
2526 &spr_read_generic
, &spr_write_generic
,
2528 /* XXX : not implemented */
2529 spr_register(env
, SPR_MPC_DER
, "DER",
2530 SPR_NOACCESS
, SPR_NOACCESS
,
2531 &spr_read_generic
, &spr_write_generic
,
2533 /* XXX : not implemented */
2534 spr_register(env
, SPR_MPC_COUNTA
, "COUNTA",
2535 SPR_NOACCESS
, SPR_NOACCESS
,
2536 &spr_read_generic
, &spr_write_generic
,
2538 /* XXX : not implemented */
2539 spr_register(env
, SPR_MPC_COUNTB
, "COUNTB",
2540 SPR_NOACCESS
, SPR_NOACCESS
,
2541 &spr_read_generic
, &spr_write_generic
,
2543 /* XXX : not implemented */
2544 spr_register(env
, SPR_MPC_CMPE
, "CMPE",
2545 SPR_NOACCESS
, SPR_NOACCESS
,
2546 &spr_read_generic
, &spr_write_generic
,
2548 /* XXX : not implemented */
2549 spr_register(env
, SPR_MPC_CMPF
, "CMPF",
2550 SPR_NOACCESS
, SPR_NOACCESS
,
2551 &spr_read_generic
, &spr_write_generic
,
2553 /* XXX : not implemented */
2554 spr_register(env
, SPR_MPC_CMPG
, "CMPG",
2555 SPR_NOACCESS
, SPR_NOACCESS
,
2556 &spr_read_generic
, &spr_write_generic
,
2558 /* XXX : not implemented */
2559 spr_register(env
, SPR_MPC_CMPH
, "CMPH",
2560 SPR_NOACCESS
, SPR_NOACCESS
,
2561 &spr_read_generic
, &spr_write_generic
,
2563 /* XXX : not implemented */
2564 spr_register(env
, SPR_MPC_LCTRL1
, "LCTRL1",
2565 SPR_NOACCESS
, SPR_NOACCESS
,
2566 &spr_read_generic
, &spr_write_generic
,
2568 /* XXX : not implemented */
2569 spr_register(env
, SPR_MPC_LCTRL2
, "LCTRL2",
2570 SPR_NOACCESS
, SPR_NOACCESS
,
2571 &spr_read_generic
, &spr_write_generic
,
2573 /* XXX : not implemented */
2574 spr_register(env
, SPR_MPC_BAR
, "BAR",
2575 SPR_NOACCESS
, SPR_NOACCESS
,
2576 &spr_read_generic
, &spr_write_generic
,
2578 /* XXX : not implemented */
2579 spr_register(env
, SPR_MPC_DPDR
, "DPDR",
2580 SPR_NOACCESS
, SPR_NOACCESS
,
2581 &spr_read_generic
, &spr_write_generic
,
2583 /* XXX : not implemented */
2584 spr_register(env
, SPR_MPC_IMMR
, "IMMR",
2585 SPR_NOACCESS
, SPR_NOACCESS
,
2586 &spr_read_generic
, &spr_write_generic
,
2590 static void gen_spr_5xx(CPUPPCState
*env
)
2592 /* XXX : not implemented */
2593 spr_register(env
, SPR_RCPU_MI_GRA
, "MI_GRA",
2594 SPR_NOACCESS
, SPR_NOACCESS
,
2595 &spr_read_generic
, &spr_write_generic
,
2597 /* XXX : not implemented */
2598 spr_register(env
, SPR_RCPU_L2U_GRA
, "L2U_GRA",
2599 SPR_NOACCESS
, SPR_NOACCESS
,
2600 &spr_read_generic
, &spr_write_generic
,
2602 /* XXX : not implemented */
2603 spr_register(env
, SPR_RPCU_BBCMCR
, "L2U_BBCMCR",
2604 SPR_NOACCESS
, SPR_NOACCESS
,
2605 &spr_read_generic
, &spr_write_generic
,
2607 /* XXX : not implemented */
2608 spr_register(env
, SPR_RCPU_L2U_MCR
, "L2U_MCR",
2609 SPR_NOACCESS
, SPR_NOACCESS
,
2610 &spr_read_generic
, &spr_write_generic
,
2612 /* XXX : not implemented */
2613 spr_register(env
, SPR_RCPU_MI_RBA0
, "MI_RBA0",
2614 SPR_NOACCESS
, SPR_NOACCESS
,
2615 &spr_read_generic
, &spr_write_generic
,
2617 /* XXX : not implemented */
2618 spr_register(env
, SPR_RCPU_MI_RBA1
, "MI_RBA1",
2619 SPR_NOACCESS
, SPR_NOACCESS
,
2620 &spr_read_generic
, &spr_write_generic
,
2622 /* XXX : not implemented */
2623 spr_register(env
, SPR_RCPU_MI_RBA2
, "MI_RBA2",
2624 SPR_NOACCESS
, SPR_NOACCESS
,
2625 &spr_read_generic
, &spr_write_generic
,
2627 /* XXX : not implemented */
2628 spr_register(env
, SPR_RCPU_MI_RBA3
, "MI_RBA3",
2629 SPR_NOACCESS
, SPR_NOACCESS
,
2630 &spr_read_generic
, &spr_write_generic
,
2632 /* XXX : not implemented */
2633 spr_register(env
, SPR_RCPU_L2U_RBA0
, "L2U_RBA0",
2634 SPR_NOACCESS
, SPR_NOACCESS
,
2635 &spr_read_generic
, &spr_write_generic
,
2637 /* XXX : not implemented */
2638 spr_register(env
, SPR_RCPU_L2U_RBA1
, "L2U_RBA1",
2639 SPR_NOACCESS
, SPR_NOACCESS
,
2640 &spr_read_generic
, &spr_write_generic
,
2642 /* XXX : not implemented */
2643 spr_register(env
, SPR_RCPU_L2U_RBA2
, "L2U_RBA2",
2644 SPR_NOACCESS
, SPR_NOACCESS
,
2645 &spr_read_generic
, &spr_write_generic
,
2647 /* XXX : not implemented */
2648 spr_register(env
, SPR_RCPU_L2U_RBA3
, "L2U_RBA3",
2649 SPR_NOACCESS
, SPR_NOACCESS
,
2650 &spr_read_generic
, &spr_write_generic
,
2652 /* XXX : not implemented */
2653 spr_register(env
, SPR_RCPU_MI_RA0
, "MI_RA0",
2654 SPR_NOACCESS
, SPR_NOACCESS
,
2655 &spr_read_generic
, &spr_write_generic
,
2657 /* XXX : not implemented */
2658 spr_register(env
, SPR_RCPU_MI_RA1
, "MI_RA1",
2659 SPR_NOACCESS
, SPR_NOACCESS
,
2660 &spr_read_generic
, &spr_write_generic
,
2662 /* XXX : not implemented */
2663 spr_register(env
, SPR_RCPU_MI_RA2
, "MI_RA2",
2664 SPR_NOACCESS
, SPR_NOACCESS
,
2665 &spr_read_generic
, &spr_write_generic
,
2667 /* XXX : not implemented */
2668 spr_register(env
, SPR_RCPU_MI_RA3
, "MI_RA3",
2669 SPR_NOACCESS
, SPR_NOACCESS
,
2670 &spr_read_generic
, &spr_write_generic
,
2672 /* XXX : not implemented */
2673 spr_register(env
, SPR_RCPU_L2U_RA0
, "L2U_RA0",
2674 SPR_NOACCESS
, SPR_NOACCESS
,
2675 &spr_read_generic
, &spr_write_generic
,
2677 /* XXX : not implemented */
2678 spr_register(env
, SPR_RCPU_L2U_RA1
, "L2U_RA1",
2679 SPR_NOACCESS
, SPR_NOACCESS
,
2680 &spr_read_generic
, &spr_write_generic
,
2682 /* XXX : not implemented */
2683 spr_register(env
, SPR_RCPU_L2U_RA2
, "L2U_RA2",
2684 SPR_NOACCESS
, SPR_NOACCESS
,
2685 &spr_read_generic
, &spr_write_generic
,
2687 /* XXX : not implemented */
2688 spr_register(env
, SPR_RCPU_L2U_RA3
, "L2U_RA3",
2689 SPR_NOACCESS
, SPR_NOACCESS
,
2690 &spr_read_generic
, &spr_write_generic
,
2692 /* XXX : not implemented */
2693 spr_register(env
, SPR_RCPU_FPECR
, "FPECR",
2694 SPR_NOACCESS
, SPR_NOACCESS
,
2695 &spr_read_generic
, &spr_write_generic
,
2699 static void gen_spr_8xx(CPUPPCState
*env
)
2701 /* XXX : not implemented */
2702 spr_register(env
, SPR_MPC_IC_CST
, "IC_CST",
2703 SPR_NOACCESS
, SPR_NOACCESS
,
2704 &spr_read_generic
, &spr_write_generic
,
2706 /* XXX : not implemented */
2707 spr_register(env
, SPR_MPC_IC_ADR
, "IC_ADR",
2708 SPR_NOACCESS
, SPR_NOACCESS
,
2709 &spr_read_generic
, &spr_write_generic
,
2711 /* XXX : not implemented */
2712 spr_register(env
, SPR_MPC_IC_DAT
, "IC_DAT",
2713 SPR_NOACCESS
, SPR_NOACCESS
,
2714 &spr_read_generic
, &spr_write_generic
,
2716 /* XXX : not implemented */
2717 spr_register(env
, SPR_MPC_DC_CST
, "DC_CST",
2718 SPR_NOACCESS
, SPR_NOACCESS
,
2719 &spr_read_generic
, &spr_write_generic
,
2721 /* XXX : not implemented */
2722 spr_register(env
, SPR_MPC_DC_ADR
, "DC_ADR",
2723 SPR_NOACCESS
, SPR_NOACCESS
,
2724 &spr_read_generic
, &spr_write_generic
,
2726 /* XXX : not implemented */
2727 spr_register(env
, SPR_MPC_DC_DAT
, "DC_DAT",
2728 SPR_NOACCESS
, SPR_NOACCESS
,
2729 &spr_read_generic
, &spr_write_generic
,
2731 /* XXX : not implemented */
2732 spr_register(env
, SPR_MPC_MI_CTR
, "MI_CTR",
2733 SPR_NOACCESS
, SPR_NOACCESS
,
2734 &spr_read_generic
, &spr_write_generic
,
2736 /* XXX : not implemented */
2737 spr_register(env
, SPR_MPC_MI_AP
, "MI_AP",
2738 SPR_NOACCESS
, SPR_NOACCESS
,
2739 &spr_read_generic
, &spr_write_generic
,
2741 /* XXX : not implemented */
2742 spr_register(env
, SPR_MPC_MI_EPN
, "MI_EPN",
2743 SPR_NOACCESS
, SPR_NOACCESS
,
2744 &spr_read_generic
, &spr_write_generic
,
2746 /* XXX : not implemented */
2747 spr_register(env
, SPR_MPC_MI_TWC
, "MI_TWC",
2748 SPR_NOACCESS
, SPR_NOACCESS
,
2749 &spr_read_generic
, &spr_write_generic
,
2751 /* XXX : not implemented */
2752 spr_register(env
, SPR_MPC_MI_RPN
, "MI_RPN",
2753 SPR_NOACCESS
, SPR_NOACCESS
,
2754 &spr_read_generic
, &spr_write_generic
,
2756 /* XXX : not implemented */
2757 spr_register(env
, SPR_MPC_MI_DBCAM
, "MI_DBCAM",
2758 SPR_NOACCESS
, SPR_NOACCESS
,
2759 &spr_read_generic
, &spr_write_generic
,
2761 /* XXX : not implemented */
2762 spr_register(env
, SPR_MPC_MI_DBRAM0
, "MI_DBRAM0",
2763 SPR_NOACCESS
, SPR_NOACCESS
,
2764 &spr_read_generic
, &spr_write_generic
,
2766 /* XXX : not implemented */
2767 spr_register(env
, SPR_MPC_MI_DBRAM1
, "MI_DBRAM1",
2768 SPR_NOACCESS
, SPR_NOACCESS
,
2769 &spr_read_generic
, &spr_write_generic
,
2771 /* XXX : not implemented */
2772 spr_register(env
, SPR_MPC_MD_CTR
, "MD_CTR",
2773 SPR_NOACCESS
, SPR_NOACCESS
,
2774 &spr_read_generic
, &spr_write_generic
,
2776 /* XXX : not implemented */
2777 spr_register(env
, SPR_MPC_MD_CASID
, "MD_CASID",
2778 SPR_NOACCESS
, SPR_NOACCESS
,
2779 &spr_read_generic
, &spr_write_generic
,
2781 /* XXX : not implemented */
2782 spr_register(env
, SPR_MPC_MD_AP
, "MD_AP",
2783 SPR_NOACCESS
, SPR_NOACCESS
,
2784 &spr_read_generic
, &spr_write_generic
,
2786 /* XXX : not implemented */
2787 spr_register(env
, SPR_MPC_MD_EPN
, "MD_EPN",
2788 SPR_NOACCESS
, SPR_NOACCESS
,
2789 &spr_read_generic
, &spr_write_generic
,
2791 /* XXX : not implemented */
2792 spr_register(env
, SPR_MPC_MD_TWB
, "MD_TWB",
2793 SPR_NOACCESS
, SPR_NOACCESS
,
2794 &spr_read_generic
, &spr_write_generic
,
2796 /* XXX : not implemented */
2797 spr_register(env
, SPR_MPC_MD_TWC
, "MD_TWC",
2798 SPR_NOACCESS
, SPR_NOACCESS
,
2799 &spr_read_generic
, &spr_write_generic
,
2801 /* XXX : not implemented */
2802 spr_register(env
, SPR_MPC_MD_RPN
, "MD_RPN",
2803 SPR_NOACCESS
, SPR_NOACCESS
,
2804 &spr_read_generic
, &spr_write_generic
,
2806 /* XXX : not implemented */
2807 spr_register(env
, SPR_MPC_MD_TW
, "MD_TW",
2808 SPR_NOACCESS
, SPR_NOACCESS
,
2809 &spr_read_generic
, &spr_write_generic
,
2811 /* XXX : not implemented */
2812 spr_register(env
, SPR_MPC_MD_DBCAM
, "MD_DBCAM",
2813 SPR_NOACCESS
, SPR_NOACCESS
,
2814 &spr_read_generic
, &spr_write_generic
,
2816 /* XXX : not implemented */
2817 spr_register(env
, SPR_MPC_MD_DBRAM0
, "MD_DBRAM0",
2818 SPR_NOACCESS
, SPR_NOACCESS
,
2819 &spr_read_generic
, &spr_write_generic
,
2821 /* XXX : not implemented */
2822 spr_register(env
, SPR_MPC_MD_DBRAM1
, "MD_DBRAM1",
2823 SPR_NOACCESS
, SPR_NOACCESS
,
2824 &spr_read_generic
, &spr_write_generic
,
2829 * AMR => SPR 29 (Power 2.04)
2830 * CTRL => SPR 136 (Power 2.04)
2831 * CTRL => SPR 152 (Power 2.04)
2832 * SCOMC => SPR 276 (64 bits ?)
2833 * SCOMD => SPR 277 (64 bits ?)
2834 * TBU40 => SPR 286 (Power 2.04 hypv)
2835 * HSPRG0 => SPR 304 (Power 2.04 hypv)
2836 * HSPRG1 => SPR 305 (Power 2.04 hypv)
2837 * HDSISR => SPR 306 (Power 2.04 hypv)
2838 * HDAR => SPR 307 (Power 2.04 hypv)
2839 * PURR => SPR 309 (Power 2.04 hypv)
2840 * HDEC => SPR 310 (Power 2.04 hypv)
2841 * HIOR => SPR 311 (hypv)
2842 * RMOR => SPR 312 (970)
2843 * HRMOR => SPR 313 (Power 2.04 hypv)
2844 * HSRR0 => SPR 314 (Power 2.04 hypv)
2845 * HSRR1 => SPR 315 (Power 2.04 hypv)
2846 * LPIDR => SPR 317 (970)
2847 * EPR => SPR 702 (Power 2.04 emb)
2848 * perf => 768-783 (Power 2.04)
2849 * perf => 784-799 (Power 2.04)
2850 * PPR => SPR 896 (Power 2.04)
2851 * DABRX => 1015 (Power 2.04 hypv)
2852 * FPECR => SPR 1022 (?)
2853 * ... and more (thermal management, performance counters, ...)
2856 /*****************************************************************************/
2857 /* Exception vectors models */
2858 static void init_excp_4xx_real(CPUPPCState
*env
)
2860 #if !defined(CONFIG_USER_ONLY)
2861 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2862 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2863 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2864 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2865 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2866 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2867 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2868 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2869 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2870 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2871 env
->ivor_mask
= 0x0000FFF0UL
;
2872 env
->ivpr_mask
= 0xFFFF0000UL
;
2873 /* Hardware reset vector */
2874 env
->hreset_vector
= 0xFFFFFFFCUL
;
2878 static void init_excp_4xx_softmmu(CPUPPCState
*env
)
2880 #if !defined(CONFIG_USER_ONLY)
2881 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2882 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2883 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2884 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2885 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2886 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2887 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2888 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2889 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2890 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2891 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2892 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001100;
2893 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001200;
2894 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2895 env
->ivor_mask
= 0x0000FFF0UL
;
2896 env
->ivpr_mask
= 0xFFFF0000UL
;
2897 /* Hardware reset vector */
2898 env
->hreset_vector
= 0xFFFFFFFCUL
;
2902 static void init_excp_MPC5xx(CPUPPCState
*env
)
2904 #if !defined(CONFIG_USER_ONLY)
2905 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2906 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2907 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2908 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2909 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2910 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2911 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2912 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2913 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2914 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2915 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2916 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2917 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2918 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2919 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2920 env
->ivor_mask
= 0x0000FFF0UL
;
2921 env
->ivpr_mask
= 0xFFFF0000UL
;
2922 /* Hardware reset vector */
2923 env
->hreset_vector
= 0x00000100UL
;
2927 static void init_excp_MPC8xx(CPUPPCState
*env
)
2929 #if !defined(CONFIG_USER_ONLY)
2930 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2931 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2932 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2933 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2934 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2935 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2936 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2937 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2938 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2939 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2940 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2941 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2942 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2943 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001100;
2944 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001200;
2945 env
->excp_vectors
[POWERPC_EXCP_ITLBE
] = 0x00001300;
2946 env
->excp_vectors
[POWERPC_EXCP_DTLBE
] = 0x00001400;
2947 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2948 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2949 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2950 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2951 env
->ivor_mask
= 0x0000FFF0UL
;
2952 env
->ivpr_mask
= 0xFFFF0000UL
;
2953 /* Hardware reset vector */
2954 env
->hreset_vector
= 0x00000100UL
;
2958 static void init_excp_G2(CPUPPCState
*env
)
2960 #if !defined(CONFIG_USER_ONLY)
2961 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2962 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2963 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2964 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2965 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2966 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2967 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2968 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2969 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2970 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000A00;
2971 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2972 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2973 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2974 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2975 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2976 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2977 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2978 /* Hardware reset vector */
2979 env
->hreset_vector
= 0x00000100UL
;
2983 static void init_excp_e200(CPUPPCState
*env
, target_ulong ivpr_mask
)
2985 #if !defined(CONFIG_USER_ONLY)
2986 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000FFC;
2987 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2988 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2989 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2990 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2991 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2992 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2993 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2994 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2995 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2996 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2997 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2998 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2999 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
3000 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
3001 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
3002 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
3003 env
->excp_vectors
[POWERPC_EXCP_SPEU
] = 0x00000000;
3004 env
->excp_vectors
[POWERPC_EXCP_EFPDI
] = 0x00000000;
3005 env
->excp_vectors
[POWERPC_EXCP_EFPRI
] = 0x00000000;
3006 env
->ivor_mask
= 0x0000FFF7UL
;
3007 env
->ivpr_mask
= ivpr_mask
;
3008 /* Hardware reset vector */
3009 env
->hreset_vector
= 0xFFFFFFFCUL
;
3013 static void init_excp_BookE(CPUPPCState
*env
)
3015 #if !defined(CONFIG_USER_ONLY)
3016 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
3017 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
3018 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
3019 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
3020 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
3021 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
3022 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
3023 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
3024 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
3025 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
3026 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
3027 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
3028 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
3029 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
3030 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
3031 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
3032 env
->ivor_mask
= 0x0000FFF0UL
;
3033 env
->ivpr_mask
= 0xFFFF0000UL
;
3034 /* Hardware reset vector */
3035 env
->hreset_vector
= 0xFFFFFFFCUL
;
3039 static void init_excp_601(CPUPPCState
*env
)
3041 #if !defined(CONFIG_USER_ONLY)
3042 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3043 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3044 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3045 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3046 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3047 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3048 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3049 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3050 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3051 env
->excp_vectors
[POWERPC_EXCP_IO
] = 0x00000A00;
3052 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3053 env
->excp_vectors
[POWERPC_EXCP_RUNM
] = 0x00002000;
3054 /* Hardware reset vector */
3055 env
->hreset_vector
= 0x00000100UL
;
3059 static void init_excp_602(CPUPPCState
*env
)
3061 #if !defined(CONFIG_USER_ONLY)
3062 /* XXX: exception prefix has a special behavior on 602 */
3063 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3064 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3065 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3066 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3067 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3068 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3069 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3070 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3071 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3072 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3073 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
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_WDT
] = 0x00001500;
3080 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001600;
3081 /* Hardware reset vector */
3082 env
->hreset_vector
= 0x00000100UL
;
3086 static void init_excp_603(CPUPPCState
*env
)
3088 #if !defined(CONFIG_USER_ONLY)
3089 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3090 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3091 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3092 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3093 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3094 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3095 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3096 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3097 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3098 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3099 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3100 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3101 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3102 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3103 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3104 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3105 /* Hardware reset vector */
3106 env
->hreset_vector
= 0x00000100UL
;
3110 static void init_excp_604(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_IABR
] = 0x00001300;
3126 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3127 /* Hardware reset vector */
3128 env
->hreset_vector
= 0x00000100UL
;
3132 static void init_excp_7x0(CPUPPCState
*env
)
3134 #if !defined(CONFIG_USER_ONLY)
3135 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3136 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3137 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3138 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3139 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3140 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3141 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3142 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3143 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3144 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3145 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3146 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3147 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3148 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3149 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3150 /* Hardware reset vector */
3151 env
->hreset_vector
= 0x00000100UL
;
3155 static void init_excp_750cl(CPUPPCState
*env
)
3157 #if !defined(CONFIG_USER_ONLY)
3158 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3159 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3160 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3161 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3162 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3163 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3164 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3165 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3166 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3167 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3168 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3169 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3170 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3171 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3172 /* Hardware reset vector */
3173 env
->hreset_vector
= 0x00000100UL
;
3177 static void init_excp_750cx(CPUPPCState
*env
)
3179 #if !defined(CONFIG_USER_ONLY)
3180 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3181 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3182 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3183 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3184 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3185 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3186 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3187 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3188 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3189 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3190 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3191 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3192 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3193 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3194 /* Hardware reset vector */
3195 env
->hreset_vector
= 0x00000100UL
;
3199 /* XXX: Check if this is correct */
3200 static void init_excp_7x5(CPUPPCState
*env
)
3202 #if !defined(CONFIG_USER_ONLY)
3203 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3204 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3205 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3206 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3207 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3208 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3209 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3210 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3211 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3212 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3213 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3214 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3215 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3216 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3217 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3218 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3219 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3220 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3221 /* Hardware reset vector */
3222 env
->hreset_vector
= 0x00000100UL
;
3226 static void init_excp_7400(CPUPPCState
*env
)
3228 #if !defined(CONFIG_USER_ONLY)
3229 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3230 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3231 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3232 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3233 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3234 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3235 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3236 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3237 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3238 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3239 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3240 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3241 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3242 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3243 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3244 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3245 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3246 /* Hardware reset vector */
3247 env
->hreset_vector
= 0x00000100UL
;
3251 static void init_excp_7450(CPUPPCState
*env
)
3253 #if !defined(CONFIG_USER_ONLY)
3254 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3255 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3256 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3257 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3258 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3259 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3260 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3261 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3262 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3263 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3264 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3265 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3266 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3267 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3268 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3269 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3270 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3271 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3272 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3273 /* Hardware reset vector */
3274 env
->hreset_vector
= 0x00000100UL
;
3278 #if defined(TARGET_PPC64)
3279 static void init_excp_970(CPUPPCState
*env
)
3281 #if !defined(CONFIG_USER_ONLY)
3282 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3283 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3284 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3285 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3286 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3287 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3288 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3289 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3290 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3291 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3292 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3293 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3294 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3295 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3296 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3297 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3298 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3299 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
3300 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
3301 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
3302 /* Hardware reset vector */
3303 env
->hreset_vector
= 0x0000000000000100ULL
;
3307 static void init_excp_POWER7(CPUPPCState
*env
)
3309 #if !defined(CONFIG_USER_ONLY)
3310 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3311 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3312 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3313 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3314 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3315 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3316 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3317 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3318 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3319 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3320 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3321 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3322 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3323 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3324 env
->excp_vectors
[POWERPC_EXCP_HDSI
] = 0x00000E00;
3325 env
->excp_vectors
[POWERPC_EXCP_HISI
] = 0x00000E20;
3326 env
->excp_vectors
[POWERPC_EXCP_HV_EMU
] = 0x00000E40;
3327 env
->excp_vectors
[POWERPC_EXCP_HV_MAINT
] = 0x00000E60;
3328 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3329 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3330 env
->excp_vectors
[POWERPC_EXCP_VSXU
] = 0x00000F40;
3331 /* Hardware reset vector */
3332 env
->hreset_vector
= 0x0000000000000100ULL
;
3336 static void init_excp_POWER8(CPUPPCState
*env
)
3338 init_excp_POWER7(env
);
3340 #if !defined(CONFIG_USER_ONLY)
3341 env
->excp_vectors
[POWERPC_EXCP_SDOOR
] = 0x00000A00;
3342 env
->excp_vectors
[POWERPC_EXCP_FU
] = 0x00000F60;
3343 env
->excp_vectors
[POWERPC_EXCP_HV_FU
] = 0x00000F80;
3344 env
->excp_vectors
[POWERPC_EXCP_SDOOR_HV
] = 0x00000E80;
3348 static void init_excp_POWER9(CPUPPCState
*env
)
3350 init_excp_POWER8(env
);
3352 #if !defined(CONFIG_USER_ONLY)
3353 env
->excp_vectors
[POWERPC_EXCP_HVIRT
] = 0x00000EA0;
3359 /*****************************************************************************/
3360 /* Power management enable checks */
3361 static int check_pow_none(CPUPPCState
*env
)
3366 static int check_pow_nocheck(CPUPPCState
*env
)
3371 static int check_pow_hid0(CPUPPCState
*env
)
3373 if (env
->spr
[SPR_HID0
] & 0x00E00000) {
3380 static int check_pow_hid0_74xx(CPUPPCState
*env
)
3382 if (env
->spr
[SPR_HID0
] & 0x00600000) {
3389 static bool ppc_cpu_interrupts_big_endian_always(PowerPCCPU
*cpu
)
3395 static bool ppc_cpu_interrupts_big_endian_lpcr(PowerPCCPU
*cpu
)
3397 return !(cpu
->env
.spr
[SPR_LPCR
] & LPCR_ILE
);
3401 /*****************************************************************************/
3402 /* PowerPC implementations definitions */
3404 #define POWERPC_FAMILY(_name) \
3406 glue(glue(ppc_, _name), _cpu_family_class_init)(ObjectClass *, void *); \
3408 static const TypeInfo \
3409 glue(glue(ppc_, _name), _cpu_family_type_info) = { \
3410 .name = stringify(_name) "-family-" TYPE_POWERPC_CPU, \
3411 .parent = TYPE_POWERPC_CPU, \
3413 .class_init = glue(glue(ppc_, _name), _cpu_family_class_init), \
3416 static void glue(glue(ppc_, _name), _cpu_family_register_types)(void) \
3418 type_register_static( \
3419 &glue(glue(ppc_, _name), _cpu_family_type_info)); \
3422 type_init(glue(glue(ppc_, _name), _cpu_family_register_types)) \
3424 static void glue(glue(ppc_, _name), _cpu_family_class_init)
3426 static void init_proc_401(CPUPPCState
*env
)
3429 gen_spr_401_403(env
);
3431 init_excp_4xx_real(env
);
3432 env
->dcache_line_size
= 32;
3433 env
->icache_line_size
= 32;
3434 /* Allocate hardware IRQ controller */
3435 ppc40x_irq_init(ppc_env_get_cpu(env
));
3437 SET_FIT_PERIOD(12, 16, 20, 24);
3438 SET_WDT_PERIOD(16, 20, 24, 28);
3441 POWERPC_FAMILY(401)(ObjectClass
*oc
, void *data
)
3443 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3444 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3446 dc
->desc
= "PowerPC 401";
3447 pcc
->init_proc
= init_proc_401
;
3448 pcc
->check_pow
= check_pow_nocheck
;
3449 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3450 PPC_WRTEE
| PPC_DCR
|
3451 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3453 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3454 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3455 pcc
->msr_mask
= (1ull << MSR_KEY
) |
3464 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3465 pcc
->excp_model
= POWERPC_EXCP_40x
;
3466 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3467 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3468 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3469 POWERPC_FLAG_BUS_CLK
;
3472 static void init_proc_401x2(CPUPPCState
*env
)
3475 gen_spr_401_403(env
);
3477 gen_spr_compress(env
);
3478 /* Memory management */
3479 #if !defined(CONFIG_USER_ONLY)
3483 env
->tlb_type
= TLB_EMB
;
3485 init_excp_4xx_softmmu(env
);
3486 env
->dcache_line_size
= 32;
3487 env
->icache_line_size
= 32;
3488 /* Allocate hardware IRQ controller */
3489 ppc40x_irq_init(ppc_env_get_cpu(env
));
3491 SET_FIT_PERIOD(12, 16, 20, 24);
3492 SET_WDT_PERIOD(16, 20, 24, 28);
3495 POWERPC_FAMILY(401x2
)(ObjectClass
*oc
, void *data
)
3497 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3498 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3500 dc
->desc
= "PowerPC 401x2";
3501 pcc
->init_proc
= init_proc_401x2
;
3502 pcc
->check_pow
= check_pow_nocheck
;
3503 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3504 PPC_DCR
| PPC_WRTEE
|
3505 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3506 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3507 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3508 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3509 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3510 pcc
->msr_mask
= (1ull << 20) |
3522 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3523 pcc
->excp_model
= POWERPC_EXCP_40x
;
3524 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3525 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3526 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3527 POWERPC_FLAG_BUS_CLK
;
3530 static void init_proc_401x3(CPUPPCState
*env
)
3533 gen_spr_401_403(env
);
3536 gen_spr_compress(env
);
3537 init_excp_4xx_softmmu(env
);
3538 env
->dcache_line_size
= 32;
3539 env
->icache_line_size
= 32;
3540 /* Allocate hardware IRQ controller */
3541 ppc40x_irq_init(ppc_env_get_cpu(env
));
3543 SET_FIT_PERIOD(12, 16, 20, 24);
3544 SET_WDT_PERIOD(16, 20, 24, 28);
3547 POWERPC_FAMILY(401x3
)(ObjectClass
*oc
, void *data
)
3549 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3550 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3552 dc
->desc
= "PowerPC 401x3";
3553 pcc
->init_proc
= init_proc_401x3
;
3554 pcc
->check_pow
= check_pow_nocheck
;
3555 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3556 PPC_DCR
| PPC_WRTEE
|
3557 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3558 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3559 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3560 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3561 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3562 pcc
->msr_mask
= (1ull << 20) |
3575 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3576 pcc
->excp_model
= POWERPC_EXCP_40x
;
3577 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3578 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3579 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3580 POWERPC_FLAG_BUS_CLK
;
3583 static void init_proc_IOP480(CPUPPCState
*env
)
3586 gen_spr_401_403(env
);
3588 gen_spr_compress(env
);
3589 /* Memory management */
3590 #if !defined(CONFIG_USER_ONLY)
3594 env
->tlb_type
= TLB_EMB
;
3596 init_excp_4xx_softmmu(env
);
3597 env
->dcache_line_size
= 32;
3598 env
->icache_line_size
= 32;
3599 /* Allocate hardware IRQ controller */
3600 ppc40x_irq_init(ppc_env_get_cpu(env
));
3602 SET_FIT_PERIOD(8, 12, 16, 20);
3603 SET_WDT_PERIOD(16, 20, 24, 28);
3606 POWERPC_FAMILY(IOP480
)(ObjectClass
*oc
, void *data
)
3608 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3609 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3611 dc
->desc
= "IOP480";
3612 pcc
->init_proc
= init_proc_IOP480
;
3613 pcc
->check_pow
= check_pow_nocheck
;
3614 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3615 PPC_DCR
| PPC_WRTEE
|
3616 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3617 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3618 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3619 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3620 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3621 pcc
->msr_mask
= (1ull << 20) |
3633 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3634 pcc
->excp_model
= POWERPC_EXCP_40x
;
3635 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3636 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3637 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3638 POWERPC_FLAG_BUS_CLK
;
3641 static void init_proc_403(CPUPPCState
*env
)
3644 gen_spr_401_403(env
);
3646 gen_spr_403_real(env
);
3647 init_excp_4xx_real(env
);
3648 env
->dcache_line_size
= 32;
3649 env
->icache_line_size
= 32;
3650 /* Allocate hardware IRQ controller */
3651 ppc40x_irq_init(ppc_env_get_cpu(env
));
3653 SET_FIT_PERIOD(8, 12, 16, 20);
3654 SET_WDT_PERIOD(16, 20, 24, 28);
3657 POWERPC_FAMILY(403)(ObjectClass
*oc
, void *data
)
3659 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3660 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3662 dc
->desc
= "PowerPC 403";
3663 pcc
->init_proc
= init_proc_403
;
3664 pcc
->check_pow
= check_pow_nocheck
;
3665 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3666 PPC_DCR
| PPC_WRTEE
|
3667 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3669 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3670 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3671 pcc
->msr_mask
= (1ull << MSR_POW
) |
3680 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3681 pcc
->excp_model
= POWERPC_EXCP_40x
;
3682 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3683 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3684 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3685 POWERPC_FLAG_BUS_CLK
;
3688 static void init_proc_403GCX(CPUPPCState
*env
)
3691 gen_spr_401_403(env
);
3693 gen_spr_403_real(env
);
3694 gen_spr_403_mmu(env
);
3695 /* Bus access control */
3696 /* not emulated, as QEMU never does speculative access */
3697 spr_register(env
, SPR_40x_SGR
, "SGR",
3698 SPR_NOACCESS
, SPR_NOACCESS
,
3699 &spr_read_generic
, &spr_write_generic
,
3701 /* not emulated, as QEMU do not emulate caches */
3702 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3703 SPR_NOACCESS
, SPR_NOACCESS
,
3704 &spr_read_generic
, &spr_write_generic
,
3706 /* Memory management */
3707 #if !defined(CONFIG_USER_ONLY)
3711 env
->tlb_type
= TLB_EMB
;
3713 init_excp_4xx_softmmu(env
);
3714 env
->dcache_line_size
= 32;
3715 env
->icache_line_size
= 32;
3716 /* Allocate hardware IRQ controller */
3717 ppc40x_irq_init(ppc_env_get_cpu(env
));
3719 SET_FIT_PERIOD(8, 12, 16, 20);
3720 SET_WDT_PERIOD(16, 20, 24, 28);
3723 POWERPC_FAMILY(403GCX
)(ObjectClass
*oc
, void *data
)
3725 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3726 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3728 dc
->desc
= "PowerPC 403 GCX";
3729 pcc
->init_proc
= init_proc_403GCX
;
3730 pcc
->check_pow
= check_pow_nocheck
;
3731 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3732 PPC_DCR
| PPC_WRTEE
|
3733 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3735 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3736 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3737 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3738 pcc
->msr_mask
= (1ull << MSR_POW
) |
3747 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3748 pcc
->excp_model
= POWERPC_EXCP_40x
;
3749 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3750 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3751 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3752 POWERPC_FLAG_BUS_CLK
;
3755 static void init_proc_405(CPUPPCState
*env
)
3761 /* Bus access control */
3762 /* not emulated, as QEMU never does speculative access */
3763 spr_register(env
, SPR_40x_SGR
, "SGR",
3764 SPR_NOACCESS
, SPR_NOACCESS
,
3765 &spr_read_generic
, &spr_write_generic
,
3767 /* not emulated, as QEMU do not emulate caches */
3768 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3769 SPR_NOACCESS
, SPR_NOACCESS
,
3770 &spr_read_generic
, &spr_write_generic
,
3772 /* Memory management */
3773 #if !defined(CONFIG_USER_ONLY)
3777 env
->tlb_type
= TLB_EMB
;
3779 init_excp_4xx_softmmu(env
);
3780 env
->dcache_line_size
= 32;
3781 env
->icache_line_size
= 32;
3782 /* Allocate hardware IRQ controller */
3783 ppc40x_irq_init(ppc_env_get_cpu(env
));
3785 SET_FIT_PERIOD(8, 12, 16, 20);
3786 SET_WDT_PERIOD(16, 20, 24, 28);
3789 POWERPC_FAMILY(405)(ObjectClass
*oc
, void *data
)
3791 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3792 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3794 dc
->desc
= "PowerPC 405";
3795 pcc
->init_proc
= init_proc_405
;
3796 pcc
->check_pow
= check_pow_nocheck
;
3797 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3798 PPC_DCR
| PPC_WRTEE
|
3799 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3800 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3801 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3802 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3803 PPC_4xx_COMMON
| PPC_405_MAC
| PPC_40x_EXCP
;
3804 pcc
->msr_mask
= (1ull << MSR_POW
) |
3813 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx
;
3814 pcc
->excp_model
= POWERPC_EXCP_40x
;
3815 pcc
->bus_model
= PPC_FLAGS_INPUT_405
;
3816 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3817 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3818 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3821 static void init_proc_440EP(CPUPPCState
*env
)
3825 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3827 gen_spr_usprgh(env
);
3828 /* Processor identification */
3829 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3830 SPR_NOACCESS
, SPR_NOACCESS
,
3831 &spr_read_generic
, &spr_write_pir
,
3833 /* XXX : not implemented */
3834 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3835 SPR_NOACCESS
, SPR_NOACCESS
,
3836 &spr_read_generic
, &spr_write_generic
,
3838 /* XXX : not implemented */
3839 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3840 SPR_NOACCESS
, SPR_NOACCESS
,
3841 &spr_read_generic
, &spr_write_generic
,
3843 /* XXX : not implemented */
3844 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3845 SPR_NOACCESS
, SPR_NOACCESS
,
3846 &spr_read_generic
, &spr_write_generic
,
3848 /* XXX : not implemented */
3849 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3850 SPR_NOACCESS
, SPR_NOACCESS
,
3851 &spr_read_generic
, &spr_write_generic
,
3853 /* XXX : not implemented */
3854 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3855 SPR_NOACCESS
, SPR_NOACCESS
,
3856 &spr_read_generic
, &spr_write_generic
,
3858 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3859 SPR_NOACCESS
, SPR_NOACCESS
,
3860 &spr_read_generic
, &spr_write_generic
,
3862 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3863 SPR_NOACCESS
, SPR_NOACCESS
,
3864 &spr_read_generic
, &spr_write_generic
,
3866 /* XXX : not implemented */
3867 spr_register(env
, SPR_440_CCR1
, "CCR1",
3868 SPR_NOACCESS
, SPR_NOACCESS
,
3869 &spr_read_generic
, &spr_write_generic
,
3871 /* Memory management */
3872 #if !defined(CONFIG_USER_ONLY)
3876 env
->tlb_type
= TLB_EMB
;
3878 init_excp_BookE(env
);
3879 env
->dcache_line_size
= 32;
3880 env
->icache_line_size
= 32;
3881 ppc40x_irq_init(ppc_env_get_cpu(env
));
3883 SET_FIT_PERIOD(12, 16, 20, 24);
3884 SET_WDT_PERIOD(20, 24, 28, 32);
3887 POWERPC_FAMILY(440EP
)(ObjectClass
*oc
, void *data
)
3889 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3890 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3892 dc
->desc
= "PowerPC 440 EP";
3893 pcc
->init_proc
= init_proc_440EP
;
3894 pcc
->check_pow
= check_pow_nocheck
;
3895 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3896 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
3897 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
3899 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
3900 PPC_CACHE
| PPC_CACHE_ICBI
|
3901 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3902 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3903 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3905 pcc
->msr_mask
= (1ull << MSR_POW
) |
3917 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3918 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3919 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3920 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3921 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3922 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3925 POWERPC_FAMILY(460EX
)(ObjectClass
*oc
, void *data
)
3927 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3928 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3930 dc
->desc
= "PowerPC 460 EX";
3931 pcc
->init_proc
= init_proc_440EP
;
3932 pcc
->check_pow
= check_pow_nocheck
;
3933 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3934 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
3935 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
3937 PPC_DCR
| PPC_DCRX
| PPC_WRTEE
| PPC_RFMCI
|
3938 PPC_CACHE
| PPC_CACHE_ICBI
|
3939 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3940 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3941 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3943 pcc
->msr_mask
= (1ull << MSR_POW
) |
3955 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3956 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3957 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3958 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3959 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3960 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3963 static void init_proc_440GP(CPUPPCState
*env
)
3967 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3969 gen_spr_usprgh(env
);
3970 /* Processor identification */
3971 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3972 SPR_NOACCESS
, SPR_NOACCESS
,
3973 &spr_read_generic
, &spr_write_pir
,
3975 /* XXX : not implemented */
3976 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3977 SPR_NOACCESS
, SPR_NOACCESS
,
3978 &spr_read_generic
, &spr_write_generic
,
3980 /* XXX : not implemented */
3981 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3982 SPR_NOACCESS
, SPR_NOACCESS
,
3983 &spr_read_generic
, &spr_write_generic
,
3985 /* XXX : not implemented */
3986 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3987 SPR_NOACCESS
, SPR_NOACCESS
,
3988 &spr_read_generic
, &spr_write_generic
,
3990 /* XXX : not implemented */
3991 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3992 SPR_NOACCESS
, SPR_NOACCESS
,
3993 &spr_read_generic
, &spr_write_generic
,
3995 /* Memory management */
3996 #if !defined(CONFIG_USER_ONLY)
4000 env
->tlb_type
= TLB_EMB
;
4002 init_excp_BookE(env
);
4003 env
->dcache_line_size
= 32;
4004 env
->icache_line_size
= 32;
4005 /* XXX: TODO: allocate internal IRQ controller */
4007 SET_FIT_PERIOD(12, 16, 20, 24);
4008 SET_WDT_PERIOD(20, 24, 28, 32);
4011 POWERPC_FAMILY(440GP
)(ObjectClass
*oc
, void *data
)
4013 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4014 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4016 dc
->desc
= "PowerPC 440 GP";
4017 pcc
->init_proc
= init_proc_440GP
;
4018 pcc
->check_pow
= check_pow_nocheck
;
4019 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4020 PPC_DCR
| PPC_DCRX
| PPC_WRTEE
| PPC_MFAPIDI
|
4021 PPC_CACHE
| PPC_CACHE_ICBI
|
4022 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4023 PPC_MEM_TLBSYNC
| PPC_TLBIVA
| PPC_MFTB
|
4024 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4026 pcc
->msr_mask
= (1ull << MSR_POW
) |
4038 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4039 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4040 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4041 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4042 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4043 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4046 static void init_proc_440x4(CPUPPCState
*env
)
4050 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4052 gen_spr_usprgh(env
);
4053 /* Processor identification */
4054 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4055 SPR_NOACCESS
, SPR_NOACCESS
,
4056 &spr_read_generic
, &spr_write_pir
,
4058 /* XXX : not implemented */
4059 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4060 SPR_NOACCESS
, SPR_NOACCESS
,
4061 &spr_read_generic
, &spr_write_generic
,
4063 /* XXX : not implemented */
4064 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4065 SPR_NOACCESS
, SPR_NOACCESS
,
4066 &spr_read_generic
, &spr_write_generic
,
4068 /* XXX : not implemented */
4069 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4070 SPR_NOACCESS
, SPR_NOACCESS
,
4071 &spr_read_generic
, &spr_write_generic
,
4073 /* XXX : not implemented */
4074 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4075 SPR_NOACCESS
, SPR_NOACCESS
,
4076 &spr_read_generic
, &spr_write_generic
,
4078 /* Memory management */
4079 #if !defined(CONFIG_USER_ONLY)
4083 env
->tlb_type
= TLB_EMB
;
4085 init_excp_BookE(env
);
4086 env
->dcache_line_size
= 32;
4087 env
->icache_line_size
= 32;
4088 /* XXX: TODO: allocate internal IRQ controller */
4090 SET_FIT_PERIOD(12, 16, 20, 24);
4091 SET_WDT_PERIOD(20, 24, 28, 32);
4094 POWERPC_FAMILY(440x4
)(ObjectClass
*oc
, void *data
)
4096 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4097 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4099 dc
->desc
= "PowerPC 440x4";
4100 pcc
->init_proc
= init_proc_440x4
;
4101 pcc
->check_pow
= check_pow_nocheck
;
4102 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4103 PPC_DCR
| PPC_WRTEE
|
4104 PPC_CACHE
| PPC_CACHE_ICBI
|
4105 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4106 PPC_MEM_TLBSYNC
| PPC_MFTB
|
4107 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4109 pcc
->msr_mask
= (1ull << MSR_POW
) |
4121 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4122 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4123 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4124 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4125 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4126 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4129 static void init_proc_440x5(CPUPPCState
*env
)
4133 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4135 gen_spr_usprgh(env
);
4136 /* Processor identification */
4137 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4138 SPR_NOACCESS
, SPR_NOACCESS
,
4139 &spr_read_generic
, &spr_write_pir
,
4141 /* XXX : not implemented */
4142 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4143 SPR_NOACCESS
, SPR_NOACCESS
,
4144 &spr_read_generic
, &spr_write_generic
,
4146 /* XXX : not implemented */
4147 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4148 SPR_NOACCESS
, SPR_NOACCESS
,
4149 &spr_read_generic
, &spr_write_generic
,
4151 /* XXX : not implemented */
4152 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4153 SPR_NOACCESS
, SPR_NOACCESS
,
4154 &spr_read_generic
, &spr_write_generic
,
4156 /* XXX : not implemented */
4157 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4158 SPR_NOACCESS
, SPR_NOACCESS
,
4159 &spr_read_generic
, &spr_write_generic
,
4161 /* XXX : not implemented */
4162 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4163 SPR_NOACCESS
, SPR_NOACCESS
,
4164 &spr_read_generic
, &spr_write_generic
,
4166 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4167 SPR_NOACCESS
, SPR_NOACCESS
,
4168 &spr_read_generic
, &spr_write_generic
,
4170 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4171 SPR_NOACCESS
, SPR_NOACCESS
,
4172 &spr_read_generic
, &spr_write_generic
,
4174 /* XXX : not implemented */
4175 spr_register(env
, SPR_440_CCR1
, "CCR1",
4176 SPR_NOACCESS
, SPR_NOACCESS
,
4177 &spr_read_generic
, &spr_write_generic
,
4179 /* Memory management */
4180 #if !defined(CONFIG_USER_ONLY)
4184 env
->tlb_type
= TLB_EMB
;
4186 init_excp_BookE(env
);
4187 env
->dcache_line_size
= 32;
4188 env
->icache_line_size
= 32;
4189 ppc40x_irq_init(ppc_env_get_cpu(env
));
4191 SET_FIT_PERIOD(12, 16, 20, 24);
4192 SET_WDT_PERIOD(20, 24, 28, 32);
4195 POWERPC_FAMILY(440x5
)(ObjectClass
*oc
, void *data
)
4197 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4198 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4200 dc
->desc
= "PowerPC 440x5";
4201 pcc
->init_proc
= init_proc_440x5
;
4202 pcc
->check_pow
= check_pow_nocheck
;
4203 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4204 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
4205 PPC_CACHE
| PPC_CACHE_ICBI
|
4206 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4207 PPC_MEM_TLBSYNC
| PPC_MFTB
|
4208 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4210 pcc
->msr_mask
= (1ull << MSR_POW
) |
4222 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4223 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4224 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4225 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4226 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4227 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4230 POWERPC_FAMILY(440x5wDFPU
)(ObjectClass
*oc
, void *data
)
4232 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4233 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4235 dc
->desc
= "PowerPC 440x5 with double precision FPU";
4236 pcc
->init_proc
= init_proc_440x5
;
4237 pcc
->check_pow
= check_pow_nocheck
;
4238 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4239 PPC_FLOAT
| PPC_FLOAT_FSQRT
|
4241 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
4242 PPC_CACHE
| PPC_CACHE_ICBI
|
4243 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4244 PPC_MEM_TLBSYNC
| PPC_MFTB
|
4245 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4247 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
4248 pcc
->msr_mask
= (1ull << MSR_POW
) |
4260 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4261 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4262 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4263 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4264 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4265 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4268 static void init_proc_MPC5xx(CPUPPCState
*env
)
4272 gen_spr_5xx_8xx(env
);
4274 init_excp_MPC5xx(env
);
4275 env
->dcache_line_size
= 32;
4276 env
->icache_line_size
= 32;
4277 /* XXX: TODO: allocate internal IRQ controller */
4280 POWERPC_FAMILY(MPC5xx
)(ObjectClass
*oc
, void *data
)
4282 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4283 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4285 dc
->desc
= "Freescale 5xx cores (aka RCPU)";
4286 pcc
->init_proc
= init_proc_MPC5xx
;
4287 pcc
->check_pow
= check_pow_none
;
4288 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4289 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4290 PPC_CACHE_ICBI
| PPC_FLOAT
| PPC_FLOAT_STFIWX
|
4292 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4304 pcc
->mmu_model
= POWERPC_MMU_REAL
;
4305 pcc
->excp_model
= POWERPC_EXCP_603
;
4306 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4307 pcc
->bfd_mach
= bfd_mach_ppc_505
;
4308 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4309 POWERPC_FLAG_BUS_CLK
;
4312 static void init_proc_MPC8xx(CPUPPCState
*env
)
4316 gen_spr_5xx_8xx(env
);
4318 init_excp_MPC8xx(env
);
4319 env
->dcache_line_size
= 32;
4320 env
->icache_line_size
= 32;
4321 /* XXX: TODO: allocate internal IRQ controller */
4324 POWERPC_FAMILY(MPC8xx
)(ObjectClass
*oc
, void *data
)
4326 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4327 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4329 dc
->desc
= "Freescale 8xx cores (aka PowerQUICC)";
4330 pcc
->init_proc
= init_proc_MPC8xx
;
4331 pcc
->check_pow
= check_pow_none
;
4332 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4333 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4334 PPC_CACHE_ICBI
| PPC_MFTB
;
4335 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4347 pcc
->mmu_model
= POWERPC_MMU_MPC8xx
;
4348 pcc
->excp_model
= POWERPC_EXCP_603
;
4349 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4350 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4351 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4352 POWERPC_FLAG_BUS_CLK
;
4355 /* Freescale 82xx cores (aka PowerQUICC-II) */
4357 static void init_proc_G2(CPUPPCState
*env
)
4359 gen_spr_ne_601(env
);
4361 gen_spr_G2_755(env
);
4365 /* External access control */
4366 /* XXX : not implemented */
4367 spr_register(env
, SPR_EAR
, "EAR",
4368 SPR_NOACCESS
, SPR_NOACCESS
,
4369 &spr_read_generic
, &spr_write_generic
,
4371 /* Hardware implementation register */
4372 /* XXX : not implemented */
4373 spr_register(env
, SPR_HID0
, "HID0",
4374 SPR_NOACCESS
, SPR_NOACCESS
,
4375 &spr_read_generic
, &spr_write_generic
,
4377 /* XXX : not implemented */
4378 spr_register(env
, SPR_HID1
, "HID1",
4379 SPR_NOACCESS
, SPR_NOACCESS
,
4380 &spr_read_generic
, &spr_write_generic
,
4382 /* XXX : not implemented */
4383 spr_register(env
, SPR_HID2
, "HID2",
4384 SPR_NOACCESS
, SPR_NOACCESS
,
4385 &spr_read_generic
, &spr_write_generic
,
4387 /* Memory management */
4390 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4392 env
->dcache_line_size
= 32;
4393 env
->icache_line_size
= 32;
4394 /* Allocate hardware IRQ controller */
4395 ppc6xx_irq_init(ppc_env_get_cpu(env
));
4398 POWERPC_FAMILY(G2
)(ObjectClass
*oc
, void *data
)
4400 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4401 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4403 dc
->desc
= "PowerPC G2";
4404 pcc
->init_proc
= init_proc_G2
;
4405 pcc
->check_pow
= check_pow_hid0
;
4406 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4407 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4409 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4410 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4411 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4412 PPC_SEGMENT
| PPC_EXTERN
;
4413 pcc
->msr_mask
= (1ull << MSR_POW
) |
4414 (1ull << MSR_TGPR
) |
4428 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4429 pcc
->excp_model
= POWERPC_EXCP_G2
;
4430 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4431 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4432 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4433 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4436 static void init_proc_G2LE(CPUPPCState
*env
)
4438 gen_spr_ne_601(env
);
4440 gen_spr_G2_755(env
);
4444 /* External access control */
4445 /* XXX : not implemented */
4446 spr_register(env
, SPR_EAR
, "EAR",
4447 SPR_NOACCESS
, SPR_NOACCESS
,
4448 &spr_read_generic
, &spr_write_generic
,
4450 /* Hardware implementation register */
4451 /* XXX : not implemented */
4452 spr_register(env
, SPR_HID0
, "HID0",
4453 SPR_NOACCESS
, SPR_NOACCESS
,
4454 &spr_read_generic
, &spr_write_generic
,
4456 /* XXX : not implemented */
4457 spr_register(env
, SPR_HID1
, "HID1",
4458 SPR_NOACCESS
, SPR_NOACCESS
,
4459 &spr_read_generic
, &spr_write_generic
,
4461 /* XXX : not implemented */
4462 spr_register(env
, SPR_HID2
, "HID2",
4463 SPR_NOACCESS
, SPR_NOACCESS
,
4464 &spr_read_generic
, &spr_write_generic
,
4467 /* Memory management */
4470 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4472 env
->dcache_line_size
= 32;
4473 env
->icache_line_size
= 32;
4474 /* Allocate hardware IRQ controller */
4475 ppc6xx_irq_init(ppc_env_get_cpu(env
));
4478 POWERPC_FAMILY(G2LE
)(ObjectClass
*oc
, void *data
)
4480 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4481 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4483 dc
->desc
= "PowerPC G2LE";
4484 pcc
->init_proc
= init_proc_G2LE
;
4485 pcc
->check_pow
= check_pow_hid0
;
4486 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4487 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4489 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4490 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4491 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4492 PPC_SEGMENT
| PPC_EXTERN
;
4493 pcc
->msr_mask
= (1ull << MSR_POW
) |
4494 (1ull << MSR_TGPR
) |
4510 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4511 pcc
->excp_model
= POWERPC_EXCP_G2
;
4512 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4513 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4514 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4515 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4518 static void init_proc_e200(CPUPPCState
*env
)
4522 gen_spr_BookE(env
, 0x000000070000FFFFULL
);
4523 /* XXX : not implemented */
4524 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4525 &spr_read_spefscr
, &spr_write_spefscr
,
4526 &spr_read_spefscr
, &spr_write_spefscr
,
4528 /* Memory management */
4529 gen_spr_BookE206(env
, 0x0000005D, NULL
, 0);
4530 /* XXX : not implemented */
4531 spr_register(env
, SPR_HID0
, "HID0",
4532 SPR_NOACCESS
, SPR_NOACCESS
,
4533 &spr_read_generic
, &spr_write_generic
,
4535 /* XXX : not implemented */
4536 spr_register(env
, SPR_HID1
, "HID1",
4537 SPR_NOACCESS
, SPR_NOACCESS
,
4538 &spr_read_generic
, &spr_write_generic
,
4540 /* XXX : not implemented */
4541 spr_register(env
, SPR_Exxx_ALTCTXCR
, "ALTCTXCR",
4542 SPR_NOACCESS
, SPR_NOACCESS
,
4543 &spr_read_generic
, &spr_write_generic
,
4545 /* XXX : not implemented */
4546 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4547 SPR_NOACCESS
, SPR_NOACCESS
,
4548 &spr_read_generic
, &spr_write_generic
,
4550 /* XXX : not implemented */
4551 spr_register(env
, SPR_Exxx_CTXCR
, "CTXCR",
4552 SPR_NOACCESS
, SPR_NOACCESS
,
4553 &spr_read_generic
, &spr_write_generic
,
4555 /* XXX : not implemented */
4556 spr_register(env
, SPR_Exxx_DBCNT
, "DBCNT",
4557 SPR_NOACCESS
, SPR_NOACCESS
,
4558 &spr_read_generic
, &spr_write_generic
,
4560 /* XXX : not implemented */
4561 spr_register(env
, SPR_Exxx_DBCR3
, "DBCR3",
4562 SPR_NOACCESS
, SPR_NOACCESS
,
4563 &spr_read_generic
, &spr_write_generic
,
4565 /* XXX : not implemented */
4566 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4567 &spr_read_generic
, SPR_NOACCESS
,
4568 &spr_read_generic
, SPR_NOACCESS
,
4570 /* XXX : not implemented */
4571 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4572 SPR_NOACCESS
, SPR_NOACCESS
,
4573 &spr_read_generic
, &spr_write_generic
,
4575 /* XXX : not implemented */
4576 spr_register(env
, SPR_Exxx_L1FINV0
, "L1FINV0",
4577 SPR_NOACCESS
, SPR_NOACCESS
,
4578 &spr_read_generic
, &spr_write_generic
,
4580 /* XXX : not implemented */
4581 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
4582 SPR_NOACCESS
, SPR_NOACCESS
,
4583 &spr_read_generic
, &spr_write_generic
,
4585 /* XXX : not implemented */
4586 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
4587 SPR_NOACCESS
, SPR_NOACCESS
,
4588 &spr_read_generic
, &spr_write_generic
,
4590 /* XXX : not implemented */
4591 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4592 SPR_NOACCESS
, SPR_NOACCESS
,
4593 &spr_read_generic
, &spr_write_generic
,
4595 /* XXX : not implemented */
4596 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4597 SPR_NOACCESS
, SPR_NOACCESS
,
4598 &spr_read_generic
, &spr_write_generic
,
4600 /* XXX : not implemented */
4601 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4602 SPR_NOACCESS
, SPR_NOACCESS
,
4603 &spr_read_generic
, &spr_write_generic
,
4604 0x00000000); /* TOFIX */
4605 spr_register(env
, SPR_BOOKE_DSRR0
, "DSRR0",
4606 SPR_NOACCESS
, SPR_NOACCESS
,
4607 &spr_read_generic
, &spr_write_generic
,
4609 spr_register(env
, SPR_BOOKE_DSRR1
, "DSRR1",
4610 SPR_NOACCESS
, SPR_NOACCESS
,
4611 &spr_read_generic
, &spr_write_generic
,
4613 #if !defined(CONFIG_USER_ONLY)
4617 env
->tlb_type
= TLB_EMB
;
4619 init_excp_e200(env
, 0xFFFF0000UL
);
4620 env
->dcache_line_size
= 32;
4621 env
->icache_line_size
= 32;
4622 /* XXX: TODO: allocate internal IRQ controller */
4625 POWERPC_FAMILY(e200
)(ObjectClass
*oc
, void *data
)
4627 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4628 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4630 dc
->desc
= "e200 core";
4631 pcc
->init_proc
= init_proc_e200
;
4632 pcc
->check_pow
= check_pow_hid0
;
4634 * XXX: unimplemented instructions:
4641 * all SPE multiply-accumulate instructions
4643 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4644 PPC_SPE
| PPC_SPE_SINGLE
|
4645 PPC_WRTEE
| PPC_RFDI
|
4646 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4647 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4648 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
|
4650 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4664 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4665 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4666 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4667 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4668 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4669 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4670 POWERPC_FLAG_BUS_CLK
;
4673 static void init_proc_e300(CPUPPCState
*env
)
4675 gen_spr_ne_601(env
);
4680 /* hardware implementation registers */
4681 /* XXX : not implemented */
4682 spr_register(env
, SPR_HID0
, "HID0",
4683 SPR_NOACCESS
, SPR_NOACCESS
,
4684 &spr_read_generic
, &spr_write_generic
,
4686 /* XXX : not implemented */
4687 spr_register(env
, SPR_HID1
, "HID1",
4688 SPR_NOACCESS
, SPR_NOACCESS
,
4689 &spr_read_generic
, &spr_write_generic
,
4691 /* XXX : not implemented */
4692 spr_register(env
, SPR_HID2
, "HID2",
4693 SPR_NOACCESS
, SPR_NOACCESS
,
4694 &spr_read_generic
, &spr_write_generic
,
4697 /* XXX : not implemented */
4698 spr_register(env
, SPR_DABR
, "DABR",
4699 SPR_NOACCESS
, SPR_NOACCESS
,
4700 &spr_read_generic
, &spr_write_generic
,
4702 /* XXX : not implemented */
4703 spr_register(env
, SPR_DABR2
, "DABR2",
4704 SPR_NOACCESS
, SPR_NOACCESS
,
4705 &spr_read_generic
, &spr_write_generic
,
4707 /* XXX : not implemented */
4708 spr_register(env
, SPR_IABR2
, "IABR2",
4709 SPR_NOACCESS
, SPR_NOACCESS
,
4710 &spr_read_generic
, &spr_write_generic
,
4712 /* XXX : not implemented */
4713 spr_register(env
, SPR_IBCR
, "IBCR",
4714 SPR_NOACCESS
, SPR_NOACCESS
,
4715 &spr_read_generic
, &spr_write_generic
,
4717 /* XXX : not implemented */
4718 spr_register(env
, SPR_DBCR
, "DBCR",
4719 SPR_NOACCESS
, SPR_NOACCESS
,
4720 &spr_read_generic
, &spr_write_generic
,
4722 /* Memory management */
4725 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4727 env
->dcache_line_size
= 32;
4728 env
->icache_line_size
= 32;
4729 /* Allocate hardware IRQ controller */
4730 ppc6xx_irq_init(ppc_env_get_cpu(env
));
4733 POWERPC_FAMILY(e300
)(ObjectClass
*oc
, void *data
)
4735 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4736 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4738 dc
->desc
= "e300 core";
4739 pcc
->init_proc
= init_proc_e300
;
4740 pcc
->check_pow
= check_pow_hid0
;
4741 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4742 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4744 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4745 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4746 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4747 PPC_SEGMENT
| PPC_EXTERN
;
4748 pcc
->msr_mask
= (1ull << MSR_POW
) |
4749 (1ull << MSR_TGPR
) |
4765 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4766 pcc
->excp_model
= POWERPC_EXCP_603
;
4767 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4768 pcc
->bfd_mach
= bfd_mach_ppc_603
;
4769 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4770 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4773 #if !defined(CONFIG_USER_ONLY)
4774 static void spr_write_mas73(DisasContext
*ctx
, int sprn
, int gprn
)
4776 TCGv val
= tcg_temp_new();
4777 tcg_gen_ext32u_tl(val
, cpu_gpr
[gprn
]);
4778 gen_store_spr(SPR_BOOKE_MAS3
, val
);
4779 tcg_gen_shri_tl(val
, cpu_gpr
[gprn
], 32);
4780 gen_store_spr(SPR_BOOKE_MAS7
, val
);
4784 static void spr_read_mas73(DisasContext
*ctx
, int gprn
, int sprn
)
4786 TCGv mas7
= tcg_temp_new();
4787 TCGv mas3
= tcg_temp_new();
4788 gen_load_spr(mas7
, SPR_BOOKE_MAS7
);
4789 tcg_gen_shli_tl(mas7
, mas7
, 32);
4790 gen_load_spr(mas3
, SPR_BOOKE_MAS3
);
4791 tcg_gen_or_tl(cpu_gpr
[gprn
], mas3
, mas7
);
4792 tcg_temp_free(mas3
);
4793 tcg_temp_free(mas7
);
4798 enum fsl_e500_version
{
4806 static void init_proc_e500(CPUPPCState
*env
, int version
)
4808 PowerPCCPU
*cpu
= ppc_env_get_cpu(env
);
4809 uint32_t tlbncfg
[2];
4811 uint64_t ivpr_mask
= 0xFFFF0000ULL
;
4812 uint32_t l1cfg0
= 0x3800 /* 8 ways */
4813 | 0x0020; /* 32 kb */
4814 uint32_t l1cfg1
= 0x3800 /* 8 ways */
4815 | 0x0020; /* 32 kb */
4816 uint32_t mmucfg
= 0;
4817 #if !defined(CONFIG_USER_ONLY)
4824 * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't
4825 * complain when accessing them.
4826 * gen_spr_BookE(env, 0x0000000F0000FD7FULL);
4832 ivor_mask
= 0x0000000F0000FFFFULL
;
4836 ivor_mask
= 0x000003FE0000FFFFULL
;
4839 ivor_mask
= 0x000003FF0000FFFFULL
;
4842 gen_spr_BookE(env
, ivor_mask
);
4843 gen_spr_usprg3(env
);
4844 /* Processor identification */
4845 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4846 SPR_NOACCESS
, SPR_NOACCESS
,
4847 &spr_read_generic
, &spr_write_pir
,
4849 /* XXX : not implemented */
4850 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4851 &spr_read_spefscr
, &spr_write_spefscr
,
4852 &spr_read_spefscr
, &spr_write_spefscr
,
4854 #if !defined(CONFIG_USER_ONLY)
4855 /* Memory management */
4861 tlbncfg
[0] = gen_tlbncfg(2, 1, 1, 0, 256);
4862 tlbncfg
[1] = gen_tlbncfg(16, 1, 9, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4865 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4866 tlbncfg
[1] = gen_tlbncfg(16, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4870 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4871 tlbncfg
[1] = gen_tlbncfg(64, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 64);
4876 tlbncfg
[0] = 0x08052400;
4877 tlbncfg
[1] = 0x40028040;
4880 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n",
4888 env
->dcache_line_size
= 32;
4889 env
->icache_line_size
= 32;
4893 env
->dcache_line_size
= 64;
4894 env
->icache_line_size
= 64;
4895 l1cfg0
|= 0x1000000; /* 64 byte cache block size */
4896 l1cfg1
|= 0x1000000; /* 64 byte cache block size */
4899 env
->dcache_line_size
= 32;
4900 env
->icache_line_size
= 32;
4901 l1cfg0
|= 0x0F83820;
4902 l1cfg1
|= 0x0B83820;
4905 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n",
4908 gen_spr_BookE206(env
, 0x000000DF, tlbncfg
, mmucfg
);
4909 /* XXX : not implemented */
4910 spr_register(env
, SPR_HID0
, "HID0",
4911 SPR_NOACCESS
, SPR_NOACCESS
,
4912 &spr_read_generic
, &spr_write_generic
,
4914 /* XXX : not implemented */
4915 spr_register(env
, SPR_HID1
, "HID1",
4916 SPR_NOACCESS
, SPR_NOACCESS
,
4917 &spr_read_generic
, &spr_write_generic
,
4919 /* XXX : not implemented */
4920 spr_register(env
, SPR_Exxx_BBEAR
, "BBEAR",
4921 SPR_NOACCESS
, SPR_NOACCESS
,
4922 &spr_read_generic
, &spr_write_generic
,
4924 /* XXX : not implemented */
4925 spr_register(env
, SPR_Exxx_BBTAR
, "BBTAR",
4926 SPR_NOACCESS
, SPR_NOACCESS
,
4927 &spr_read_generic
, &spr_write_generic
,
4929 /* XXX : not implemented */
4930 spr_register(env
, SPR_Exxx_MCAR
, "MCAR",
4931 SPR_NOACCESS
, SPR_NOACCESS
,
4932 &spr_read_generic
, &spr_write_generic
,
4934 /* XXX : not implemented */
4935 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4936 SPR_NOACCESS
, SPR_NOACCESS
,
4937 &spr_read_generic
, &spr_write_generic
,
4939 /* XXX : not implemented */
4940 spr_register(env
, SPR_Exxx_NPIDR
, "NPIDR",
4941 SPR_NOACCESS
, SPR_NOACCESS
,
4942 &spr_read_generic
, &spr_write_generic
,
4944 /* XXX : not implemented */
4945 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4946 SPR_NOACCESS
, SPR_NOACCESS
,
4947 &spr_read_generic
, &spr_write_generic
,
4949 /* XXX : not implemented */
4950 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4951 &spr_read_generic
, SPR_NOACCESS
,
4952 &spr_read_generic
, SPR_NOACCESS
,
4954 spr_register(env
, SPR_Exxx_L1CFG1
, "L1CFG1",
4955 &spr_read_generic
, SPR_NOACCESS
,
4956 &spr_read_generic
, SPR_NOACCESS
,
4958 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4959 SPR_NOACCESS
, SPR_NOACCESS
,
4960 &spr_read_generic
, &spr_write_e500_l1csr0
,
4962 spr_register(env
, SPR_Exxx_L1CSR1
, "L1CSR1",
4963 SPR_NOACCESS
, SPR_NOACCESS
,
4964 &spr_read_generic
, &spr_write_e500_l1csr1
,
4966 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4967 SPR_NOACCESS
, SPR_NOACCESS
,
4968 &spr_read_generic
, &spr_write_generic
,
4970 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4971 SPR_NOACCESS
, SPR_NOACCESS
,
4972 &spr_read_generic
, &spr_write_generic
,
4974 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4975 SPR_NOACCESS
, SPR_NOACCESS
,
4976 &spr_read_generic
, &spr_write_booke206_mmucsr0
,
4978 spr_register(env
, SPR_BOOKE_EPR
, "EPR",
4979 SPR_NOACCESS
, SPR_NOACCESS
,
4980 &spr_read_generic
, SPR_NOACCESS
,
4982 /* XXX better abstract into Emb.xxx features */
4983 if ((version
== fsl_e5500
) || (version
== fsl_e6500
)) {
4984 spr_register(env
, SPR_BOOKE_EPCR
, "EPCR",
4985 SPR_NOACCESS
, SPR_NOACCESS
,
4986 &spr_read_generic
, &spr_write_generic
,
4988 spr_register(env
, SPR_BOOKE_MAS7_MAS3
, "MAS7_MAS3",
4989 SPR_NOACCESS
, SPR_NOACCESS
,
4990 &spr_read_mas73
, &spr_write_mas73
,
4992 ivpr_mask
= (target_ulong
)~0xFFFFULL
;
4995 if (version
== fsl_e6500
) {
4996 /* Thread identification */
4997 spr_register(env
, SPR_TIR
, "TIR",
4998 SPR_NOACCESS
, SPR_NOACCESS
,
4999 &spr_read_generic
, SPR_NOACCESS
,
5001 spr_register(env
, SPR_BOOKE_TLB0PS
, "TLB0PS",
5002 SPR_NOACCESS
, SPR_NOACCESS
,
5003 &spr_read_generic
, SPR_NOACCESS
,
5005 spr_register(env
, SPR_BOOKE_TLB1PS
, "TLB1PS",
5006 SPR_NOACCESS
, SPR_NOACCESS
,
5007 &spr_read_generic
, SPR_NOACCESS
,
5011 #if !defined(CONFIG_USER_ONLY)
5013 env
->tlb_type
= TLB_MAS
;
5014 for (i
= 0; i
< BOOKE206_MAX_TLBN
; i
++) {
5015 env
->nb_tlb
+= booke206_tlb_size(env
, i
);
5019 init_excp_e200(env
, ivpr_mask
);
5020 /* Allocate hardware IRQ controller */
5021 ppce500_irq_init(ppc_env_get_cpu(env
));
5024 static void init_proc_e500v1(CPUPPCState
*env
)
5026 init_proc_e500(env
, fsl_e500v1
);
5029 POWERPC_FAMILY(e500v1
)(ObjectClass
*oc
, void *data
)
5031 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5032 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5034 dc
->desc
= "e500v1 core";
5035 pcc
->init_proc
= init_proc_e500v1
;
5036 pcc
->check_pow
= check_pow_hid0
;
5037 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5038 PPC_SPE
| PPC_SPE_SINGLE
|
5039 PPC_WRTEE
| PPC_RFDI
|
5040 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5041 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5042 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5043 pcc
->insns_flags2
= PPC2_BOOKE206
;
5044 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
5058 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5059 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5060 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5061 pcc
->bfd_mach
= bfd_mach_ppc_860
;
5062 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
5063 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
5064 POWERPC_FLAG_BUS_CLK
;
5067 static void init_proc_e500v2(CPUPPCState
*env
)
5069 init_proc_e500(env
, fsl_e500v2
);
5072 POWERPC_FAMILY(e500v2
)(ObjectClass
*oc
, void *data
)
5074 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5075 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5077 dc
->desc
= "e500v2 core";
5078 pcc
->init_proc
= init_proc_e500v2
;
5079 pcc
->check_pow
= check_pow_hid0
;
5080 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5081 PPC_SPE
| PPC_SPE_SINGLE
| PPC_SPE_DOUBLE
|
5082 PPC_WRTEE
| PPC_RFDI
|
5083 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5084 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5085 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5086 pcc
->insns_flags2
= PPC2_BOOKE206
;
5087 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
5101 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5102 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5103 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5104 pcc
->bfd_mach
= bfd_mach_ppc_860
;
5105 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
5106 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
5107 POWERPC_FLAG_BUS_CLK
;
5110 static void init_proc_e500mc(CPUPPCState
*env
)
5112 init_proc_e500(env
, fsl_e500mc
);
5115 POWERPC_FAMILY(e500mc
)(ObjectClass
*oc
, void *data
)
5117 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5118 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5120 dc
->desc
= "e500mc core";
5121 pcc
->init_proc
= init_proc_e500mc
;
5122 pcc
->check_pow
= check_pow_none
;
5123 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_MFTB
|
5124 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5125 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5126 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5127 PPC_FLOAT
| PPC_FLOAT_FRES
|
5128 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5129 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5130 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5131 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
;
5132 pcc
->msr_mask
= (1ull << MSR_GS
) |
5133 (1ull << MSR_UCLE
) |
5146 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5147 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5148 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5149 /* FIXME: figure out the correct flag for e500mc */
5150 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5151 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5152 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5156 static void init_proc_e5500(CPUPPCState
*env
)
5158 init_proc_e500(env
, fsl_e5500
);
5161 POWERPC_FAMILY(e5500
)(ObjectClass
*oc
, void *data
)
5163 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5164 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5166 dc
->desc
= "e5500 core";
5167 pcc
->init_proc
= init_proc_e5500
;
5168 pcc
->check_pow
= check_pow_none
;
5169 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_MFTB
|
5170 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5171 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5172 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5173 PPC_FLOAT
| PPC_FLOAT_FRES
|
5174 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5175 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5176 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
5177 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
;
5178 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
| \
5180 pcc
->msr_mask
= (1ull << MSR_CM
) |
5182 (1ull << MSR_UCLE
) |
5195 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5196 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5197 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5198 /* FIXME: figure out the correct flag for e5500 */
5199 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5200 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5201 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5204 static void init_proc_e6500(CPUPPCState
*env
)
5206 init_proc_e500(env
, fsl_e6500
);
5209 POWERPC_FAMILY(e6500
)(ObjectClass
*oc
, void *data
)
5211 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5212 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5214 dc
->desc
= "e6500 core";
5215 pcc
->init_proc
= init_proc_e6500
;
5216 pcc
->check_pow
= check_pow_none
;
5217 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_MFTB
|
5218 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5219 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5220 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5221 PPC_FLOAT
| PPC_FLOAT_FRES
|
5222 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5223 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5224 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
5225 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
| PPC_ALTIVEC
;
5226 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
| \
5227 PPC2_FP_CVT_S64
| PPC2_ATOMIC_ISA206
;
5228 pcc
->msr_mask
= (1ull << MSR_CM
) |
5230 (1ull << MSR_UCLE
) |
5244 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5245 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5246 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5247 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5248 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5249 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_VRE
;
5254 /* Non-embedded PowerPC */
5256 #define POWERPC_MSRR_601 (0x0000000000001040ULL)
5258 static void init_proc_601(CPUPPCState
*env
)
5260 gen_spr_ne_601(env
);
5263 /* Hardware implementation registers */
5264 /* XXX : not implemented */
5265 spr_register(env
, SPR_HID0
, "HID0",
5266 SPR_NOACCESS
, SPR_NOACCESS
,
5267 &spr_read_generic
, &spr_write_hid0_601
,
5269 /* XXX : not implemented */
5270 spr_register(env
, SPR_HID1
, "HID1",
5271 SPR_NOACCESS
, SPR_NOACCESS
,
5272 &spr_read_generic
, &spr_write_generic
,
5274 /* XXX : not implemented */
5275 spr_register(env
, SPR_601_HID2
, "HID2",
5276 SPR_NOACCESS
, SPR_NOACCESS
,
5277 &spr_read_generic
, &spr_write_generic
,
5279 /* XXX : not implemented */
5280 spr_register(env
, SPR_601_HID5
, "HID5",
5281 SPR_NOACCESS
, SPR_NOACCESS
,
5282 &spr_read_generic
, &spr_write_generic
,
5284 /* Memory management */
5287 * XXX: beware that dcache line size is 64
5288 * but dcbz uses 32 bytes "sectors"
5289 * XXX: this breaks clcs instruction !
5291 env
->dcache_line_size
= 32;
5292 env
->icache_line_size
= 64;
5293 /* Allocate hardware IRQ controller */
5294 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5297 POWERPC_FAMILY(601)(ObjectClass
*oc
, void *data
)
5299 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5300 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5302 dc
->desc
= "PowerPC 601";
5303 pcc
->init_proc
= init_proc_601
;
5304 pcc
->check_pow
= check_pow_none
;
5305 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5307 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5308 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5309 PPC_SEGMENT
| PPC_EXTERN
;
5310 pcc
->msr_mask
= (1ull << MSR_EE
) |
5320 pcc
->mmu_model
= POWERPC_MMU_601
;
5321 #if defined(CONFIG_SOFTMMU)
5322 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5324 pcc
->excp_model
= POWERPC_EXCP_601
;
5325 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5326 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5327 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5330 #define POWERPC_MSRR_601v (0x0000000000001040ULL)
5332 static void init_proc_601v(CPUPPCState
*env
)
5335 /* XXX : not implemented */
5336 spr_register(env
, SPR_601_HID15
, "HID15",
5337 SPR_NOACCESS
, SPR_NOACCESS
,
5338 &spr_read_generic
, &spr_write_generic
,
5342 POWERPC_FAMILY(601v
)(ObjectClass
*oc
, void *data
)
5344 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5345 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5347 dc
->desc
= "PowerPC 601v";
5348 pcc
->init_proc
= init_proc_601v
;
5349 pcc
->check_pow
= check_pow_none
;
5350 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5352 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5353 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5354 PPC_SEGMENT
| PPC_EXTERN
;
5355 pcc
->msr_mask
= (1ull << MSR_EE
) |
5365 pcc
->mmu_model
= POWERPC_MMU_601
;
5366 #if defined(CONFIG_SOFTMMU)
5367 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5369 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5370 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5371 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5374 static void init_proc_602(CPUPPCState
*env
)
5376 gen_spr_ne_601(env
);
5381 /* hardware implementation registers */
5382 /* XXX : not implemented */
5383 spr_register(env
, SPR_HID0
, "HID0",
5384 SPR_NOACCESS
, SPR_NOACCESS
,
5385 &spr_read_generic
, &spr_write_generic
,
5387 /* XXX : not implemented */
5388 spr_register(env
, SPR_HID1
, "HID1",
5389 SPR_NOACCESS
, SPR_NOACCESS
,
5390 &spr_read_generic
, &spr_write_generic
,
5392 /* Memory management */
5394 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5396 env
->dcache_line_size
= 32;
5397 env
->icache_line_size
= 32;
5398 /* Allocate hardware IRQ controller */
5399 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5402 POWERPC_FAMILY(602)(ObjectClass
*oc
, void *data
)
5404 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5405 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5407 dc
->desc
= "PowerPC 602";
5408 pcc
->init_proc
= init_proc_602
;
5409 pcc
->check_pow
= check_pow_hid0
;
5410 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5411 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5412 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5413 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5414 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5415 PPC_MEM_TLBIE
| PPC_6xx_TLB
| PPC_MEM_TLBSYNC
|
5416 PPC_SEGMENT
| PPC_602_SPEC
;
5417 pcc
->msr_mask
= (1ull << MSR_VSX
) |
5420 (1ull << MSR_TGPR
) |
5435 /* XXX: 602 MMU is quite specific. Should add a special case */
5436 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5437 pcc
->excp_model
= POWERPC_EXCP_602
;
5438 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5439 pcc
->bfd_mach
= bfd_mach_ppc_602
;
5440 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5441 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5444 static void init_proc_603(CPUPPCState
*env
)
5446 gen_spr_ne_601(env
);
5451 /* hardware implementation registers */
5452 /* XXX : not implemented */
5453 spr_register(env
, SPR_HID0
, "HID0",
5454 SPR_NOACCESS
, SPR_NOACCESS
,
5455 &spr_read_generic
, &spr_write_generic
,
5457 /* XXX : not implemented */
5458 spr_register(env
, SPR_HID1
, "HID1",
5459 SPR_NOACCESS
, SPR_NOACCESS
,
5460 &spr_read_generic
, &spr_write_generic
,
5462 /* Memory management */
5464 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5466 env
->dcache_line_size
= 32;
5467 env
->icache_line_size
= 32;
5468 /* Allocate hardware IRQ controller */
5469 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5472 POWERPC_FAMILY(603)(ObjectClass
*oc
, void *data
)
5474 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5475 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5477 dc
->desc
= "PowerPC 603";
5478 pcc
->init_proc
= init_proc_603
;
5479 pcc
->check_pow
= check_pow_hid0
;
5480 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5481 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5482 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5483 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5484 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5485 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5486 PPC_SEGMENT
| PPC_EXTERN
;
5487 pcc
->msr_mask
= (1ull << MSR_POW
) |
5488 (1ull << MSR_TGPR
) |
5503 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5504 pcc
->excp_model
= POWERPC_EXCP_603
;
5505 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5506 pcc
->bfd_mach
= bfd_mach_ppc_603
;
5507 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5508 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5511 static void init_proc_603E(CPUPPCState
*env
)
5513 gen_spr_ne_601(env
);
5518 /* hardware implementation registers */
5519 /* XXX : not implemented */
5520 spr_register(env
, SPR_HID0
, "HID0",
5521 SPR_NOACCESS
, SPR_NOACCESS
,
5522 &spr_read_generic
, &spr_write_generic
,
5524 /* XXX : not implemented */
5525 spr_register(env
, SPR_HID1
, "HID1",
5526 SPR_NOACCESS
, SPR_NOACCESS
,
5527 &spr_read_generic
, &spr_write_generic
,
5529 /* Memory management */
5531 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5533 env
->dcache_line_size
= 32;
5534 env
->icache_line_size
= 32;
5535 /* Allocate hardware IRQ controller */
5536 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5539 POWERPC_FAMILY(603E
)(ObjectClass
*oc
, void *data
)
5541 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5542 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5544 dc
->desc
= "PowerPC 603e";
5545 pcc
->init_proc
= init_proc_603E
;
5546 pcc
->check_pow
= check_pow_hid0
;
5547 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5548 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5549 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5550 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5551 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5552 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5553 PPC_SEGMENT
| PPC_EXTERN
;
5554 pcc
->msr_mask
= (1ull << MSR_POW
) |
5555 (1ull << MSR_TGPR
) |
5570 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5571 pcc
->excp_model
= POWERPC_EXCP_603E
;
5572 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5573 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
5574 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5575 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5578 static void init_proc_604(CPUPPCState
*env
)
5580 gen_spr_ne_601(env
);
5585 /* Hardware implementation registers */
5586 /* XXX : not implemented */
5587 spr_register(env
, SPR_HID0
, "HID0",
5588 SPR_NOACCESS
, SPR_NOACCESS
,
5589 &spr_read_generic
, &spr_write_generic
,
5591 /* Memory management */
5594 env
->dcache_line_size
= 32;
5595 env
->icache_line_size
= 32;
5596 /* Allocate hardware IRQ controller */
5597 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5600 POWERPC_FAMILY(604)(ObjectClass
*oc
, void *data
)
5602 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5603 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5605 dc
->desc
= "PowerPC 604";
5606 pcc
->init_proc
= init_proc_604
;
5607 pcc
->check_pow
= check_pow_nocheck
;
5608 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5609 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5610 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5611 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5612 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5613 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5614 PPC_SEGMENT
| PPC_EXTERN
;
5615 pcc
->msr_mask
= (1ull << MSR_POW
) |
5631 pcc
->mmu_model
= POWERPC_MMU_32B
;
5632 #if defined(CONFIG_SOFTMMU)
5633 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5635 pcc
->excp_model
= POWERPC_EXCP_604
;
5636 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5637 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5638 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5639 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5642 static void init_proc_604E(CPUPPCState
*env
)
5644 gen_spr_ne_601(env
);
5647 /* XXX : not implemented */
5648 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
5649 SPR_NOACCESS
, SPR_NOACCESS
,
5650 &spr_read_generic
, &spr_write_generic
,
5652 /* XXX : not implemented */
5653 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
5654 SPR_NOACCESS
, SPR_NOACCESS
,
5655 &spr_read_generic
, &spr_write_generic
,
5657 /* XXX : not implemented */
5658 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
5659 SPR_NOACCESS
, SPR_NOACCESS
,
5660 &spr_read_generic
, &spr_write_generic
,
5664 /* Hardware implementation registers */
5665 /* XXX : not implemented */
5666 spr_register(env
, SPR_HID0
, "HID0",
5667 SPR_NOACCESS
, SPR_NOACCESS
,
5668 &spr_read_generic
, &spr_write_generic
,
5670 /* XXX : not implemented */
5671 spr_register(env
, SPR_HID1
, "HID1",
5672 SPR_NOACCESS
, SPR_NOACCESS
,
5673 &spr_read_generic
, &spr_write_generic
,
5675 /* Memory management */
5678 env
->dcache_line_size
= 32;
5679 env
->icache_line_size
= 32;
5680 /* Allocate hardware IRQ controller */
5681 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5684 POWERPC_FAMILY(604E
)(ObjectClass
*oc
, void *data
)
5686 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5687 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5689 dc
->desc
= "PowerPC 604E";
5690 pcc
->init_proc
= init_proc_604E
;
5691 pcc
->check_pow
= check_pow_nocheck
;
5692 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5693 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5694 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5695 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5696 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5697 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5698 PPC_SEGMENT
| PPC_EXTERN
;
5699 pcc
->msr_mask
= (1ull << MSR_POW
) |
5715 pcc
->mmu_model
= POWERPC_MMU_32B
;
5716 #if defined(CONFIG_SOFTMMU)
5717 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5719 pcc
->excp_model
= POWERPC_EXCP_604
;
5720 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5721 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5722 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5723 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5726 static void init_proc_740(CPUPPCState
*env
)
5728 gen_spr_ne_601(env
);
5733 /* Thermal management */
5735 /* Hardware implementation registers */
5736 /* XXX : not implemented */
5737 spr_register(env
, SPR_HID0
, "HID0",
5738 SPR_NOACCESS
, SPR_NOACCESS
,
5739 &spr_read_generic
, &spr_write_generic
,
5741 /* XXX : not implemented */
5742 spr_register(env
, SPR_HID1
, "HID1",
5743 SPR_NOACCESS
, SPR_NOACCESS
,
5744 &spr_read_generic
, &spr_write_generic
,
5746 /* Memory management */
5749 env
->dcache_line_size
= 32;
5750 env
->icache_line_size
= 32;
5751 /* Allocate hardware IRQ controller */
5752 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5755 POWERPC_FAMILY(740)(ObjectClass
*oc
, void *data
)
5757 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5758 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5760 dc
->desc
= "PowerPC 740";
5761 pcc
->init_proc
= init_proc_740
;
5762 pcc
->check_pow
= check_pow_hid0
;
5763 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5764 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5765 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5766 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5767 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5768 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5769 PPC_SEGMENT
| PPC_EXTERN
;
5770 pcc
->msr_mask
= (1ull << MSR_POW
) |
5786 pcc
->mmu_model
= POWERPC_MMU_32B
;
5787 #if defined(CONFIG_SOFTMMU)
5788 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5790 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5791 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5792 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5793 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5794 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5797 static void init_proc_750(CPUPPCState
*env
)
5799 gen_spr_ne_601(env
);
5802 /* XXX : not implemented */
5803 spr_register(env
, SPR_L2CR
, "L2CR",
5804 SPR_NOACCESS
, SPR_NOACCESS
,
5805 &spr_read_generic
, spr_access_nop
,
5809 /* Thermal management */
5811 /* Hardware implementation registers */
5812 /* XXX : not implemented */
5813 spr_register(env
, SPR_HID0
, "HID0",
5814 SPR_NOACCESS
, SPR_NOACCESS
,
5815 &spr_read_generic
, &spr_write_generic
,
5817 /* XXX : not implemented */
5818 spr_register(env
, SPR_HID1
, "HID1",
5819 SPR_NOACCESS
, SPR_NOACCESS
,
5820 &spr_read_generic
, &spr_write_generic
,
5822 /* Memory management */
5825 * XXX: high BATs are also present but are known to be bugged on
5829 env
->dcache_line_size
= 32;
5830 env
->icache_line_size
= 32;
5831 /* Allocate hardware IRQ controller */
5832 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5835 POWERPC_FAMILY(750)(ObjectClass
*oc
, void *data
)
5837 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5838 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5840 dc
->desc
= "PowerPC 750";
5841 pcc
->init_proc
= init_proc_750
;
5842 pcc
->check_pow
= check_pow_hid0
;
5843 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5844 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5845 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5846 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5847 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5848 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5849 PPC_SEGMENT
| PPC_EXTERN
;
5850 pcc
->msr_mask
= (1ull << MSR_POW
) |
5866 pcc
->mmu_model
= POWERPC_MMU_32B
;
5867 #if defined(CONFIG_SOFTMMU)
5868 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5870 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5871 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5872 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5873 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5874 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5877 static void init_proc_750cl(CPUPPCState
*env
)
5879 gen_spr_ne_601(env
);
5882 /* XXX : not implemented */
5883 spr_register(env
, SPR_L2CR
, "L2CR",
5884 SPR_NOACCESS
, SPR_NOACCESS
,
5885 &spr_read_generic
, spr_access_nop
,
5889 /* Thermal management */
5890 /* Those registers are fake on 750CL */
5891 spr_register(env
, SPR_THRM1
, "THRM1",
5892 SPR_NOACCESS
, SPR_NOACCESS
,
5893 &spr_read_generic
, &spr_write_generic
,
5895 spr_register(env
, SPR_THRM2
, "THRM2",
5896 SPR_NOACCESS
, SPR_NOACCESS
,
5897 &spr_read_generic
, &spr_write_generic
,
5899 spr_register(env
, SPR_THRM3
, "THRM3",
5900 SPR_NOACCESS
, SPR_NOACCESS
,
5901 &spr_read_generic
, &spr_write_generic
,
5903 /* XXX: not implemented */
5904 spr_register(env
, SPR_750_TDCL
, "TDCL",
5905 SPR_NOACCESS
, SPR_NOACCESS
,
5906 &spr_read_generic
, &spr_write_generic
,
5908 spr_register(env
, SPR_750_TDCH
, "TDCH",
5909 SPR_NOACCESS
, SPR_NOACCESS
,
5910 &spr_read_generic
, &spr_write_generic
,
5913 /* XXX : not implemented */
5914 spr_register(env
, SPR_750_WPAR
, "WPAR",
5915 SPR_NOACCESS
, SPR_NOACCESS
,
5916 &spr_read_generic
, &spr_write_generic
,
5918 spr_register(env
, SPR_750_DMAL
, "DMAL",
5919 SPR_NOACCESS
, SPR_NOACCESS
,
5920 &spr_read_generic
, &spr_write_generic
,
5922 spr_register(env
, SPR_750_DMAU
, "DMAU",
5923 SPR_NOACCESS
, SPR_NOACCESS
,
5924 &spr_read_generic
, &spr_write_generic
,
5926 /* Hardware implementation registers */
5927 /* XXX : not implemented */
5928 spr_register(env
, SPR_HID0
, "HID0",
5929 SPR_NOACCESS
, SPR_NOACCESS
,
5930 &spr_read_generic
, &spr_write_generic
,
5932 /* XXX : not implemented */
5933 spr_register(env
, SPR_HID1
, "HID1",
5934 SPR_NOACCESS
, SPR_NOACCESS
,
5935 &spr_read_generic
, &spr_write_generic
,
5937 /* XXX : not implemented */
5938 spr_register(env
, SPR_750CL_HID2
, "HID2",
5939 SPR_NOACCESS
, SPR_NOACCESS
,
5940 &spr_read_generic
, &spr_write_generic
,
5942 /* XXX : not implemented */
5943 spr_register(env
, SPR_750CL_HID4
, "HID4",
5944 SPR_NOACCESS
, SPR_NOACCESS
,
5945 &spr_read_generic
, &spr_write_generic
,
5947 /* Quantization registers */
5948 /* XXX : not implemented */
5949 spr_register(env
, SPR_750_GQR0
, "GQR0",
5950 SPR_NOACCESS
, SPR_NOACCESS
,
5951 &spr_read_generic
, &spr_write_generic
,
5953 /* XXX : not implemented */
5954 spr_register(env
, SPR_750_GQR1
, "GQR1",
5955 SPR_NOACCESS
, SPR_NOACCESS
,
5956 &spr_read_generic
, &spr_write_generic
,
5958 /* XXX : not implemented */
5959 spr_register(env
, SPR_750_GQR2
, "GQR2",
5960 SPR_NOACCESS
, SPR_NOACCESS
,
5961 &spr_read_generic
, &spr_write_generic
,
5963 /* XXX : not implemented */
5964 spr_register(env
, SPR_750_GQR3
, "GQR3",
5965 SPR_NOACCESS
, SPR_NOACCESS
,
5966 &spr_read_generic
, &spr_write_generic
,
5968 /* XXX : not implemented */
5969 spr_register(env
, SPR_750_GQR4
, "GQR4",
5970 SPR_NOACCESS
, SPR_NOACCESS
,
5971 &spr_read_generic
, &spr_write_generic
,
5973 /* XXX : not implemented */
5974 spr_register(env
, SPR_750_GQR5
, "GQR5",
5975 SPR_NOACCESS
, SPR_NOACCESS
,
5976 &spr_read_generic
, &spr_write_generic
,
5978 /* XXX : not implemented */
5979 spr_register(env
, SPR_750_GQR6
, "GQR6",
5980 SPR_NOACCESS
, SPR_NOACCESS
,
5981 &spr_read_generic
, &spr_write_generic
,
5983 /* XXX : not implemented */
5984 spr_register(env
, SPR_750_GQR7
, "GQR7",
5985 SPR_NOACCESS
, SPR_NOACCESS
,
5986 &spr_read_generic
, &spr_write_generic
,
5988 /* Memory management */
5990 /* PowerPC 750cl has 8 DBATs and 8 IBATs */
5992 init_excp_750cl(env
);
5993 env
->dcache_line_size
= 32;
5994 env
->icache_line_size
= 32;
5995 /* Allocate hardware IRQ controller */
5996 ppc6xx_irq_init(ppc_env_get_cpu(env
));
5999 POWERPC_FAMILY(750cl
)(ObjectClass
*oc
, void *data
)
6001 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6002 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6004 dc
->desc
= "PowerPC 750 CL";
6005 pcc
->init_proc
= init_proc_750cl
;
6006 pcc
->check_pow
= check_pow_hid0
;
6008 * XXX: not implemented:
6009 * cache lock instructions:
6011 * floating point paired instructions
6046 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6047 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6048 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6049 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6050 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6051 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6052 PPC_SEGMENT
| PPC_EXTERN
;
6053 pcc
->msr_mask
= (1ull << MSR_POW
) |
6069 pcc
->mmu_model
= POWERPC_MMU_32B
;
6070 #if defined(CONFIG_SOFTMMU)
6071 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6073 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6074 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6075 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6076 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6077 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6080 static void init_proc_750cx(CPUPPCState
*env
)
6082 gen_spr_ne_601(env
);
6085 /* XXX : not implemented */
6086 spr_register(env
, SPR_L2CR
, "L2CR",
6087 SPR_NOACCESS
, SPR_NOACCESS
,
6088 &spr_read_generic
, spr_access_nop
,
6092 /* Thermal management */
6094 /* This register is not implemented but is present for compatibility */
6095 spr_register(env
, SPR_SDA
, "SDA",
6096 SPR_NOACCESS
, SPR_NOACCESS
,
6097 &spr_read_generic
, &spr_write_generic
,
6099 /* Hardware implementation registers */
6100 /* XXX : not implemented */
6101 spr_register(env
, SPR_HID0
, "HID0",
6102 SPR_NOACCESS
, SPR_NOACCESS
,
6103 &spr_read_generic
, &spr_write_generic
,
6105 /* XXX : not implemented */
6106 spr_register(env
, SPR_HID1
, "HID1",
6107 SPR_NOACCESS
, SPR_NOACCESS
,
6108 &spr_read_generic
, &spr_write_generic
,
6110 /* Memory management */
6112 /* PowerPC 750cx has 8 DBATs and 8 IBATs */
6114 init_excp_750cx(env
);
6115 env
->dcache_line_size
= 32;
6116 env
->icache_line_size
= 32;
6117 /* Allocate hardware IRQ controller */
6118 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6121 POWERPC_FAMILY(750cx
)(ObjectClass
*oc
, void *data
)
6123 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6124 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6126 dc
->desc
= "PowerPC 750CX";
6127 pcc
->init_proc
= init_proc_750cx
;
6128 pcc
->check_pow
= check_pow_hid0
;
6129 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6130 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6131 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6132 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6133 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6134 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6135 PPC_SEGMENT
| PPC_EXTERN
;
6136 pcc
->msr_mask
= (1ull << MSR_POW
) |
6152 pcc
->mmu_model
= POWERPC_MMU_32B
;
6153 #if defined(CONFIG_SOFTMMU)
6154 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6156 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6157 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6158 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6159 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6160 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6163 static void init_proc_750fx(CPUPPCState
*env
)
6165 gen_spr_ne_601(env
);
6168 /* XXX : not implemented */
6169 spr_register(env
, SPR_L2CR
, "L2CR",
6170 SPR_NOACCESS
, SPR_NOACCESS
,
6171 &spr_read_generic
, spr_access_nop
,
6175 /* Thermal management */
6177 /* XXX : not implemented */
6178 spr_register(env
, SPR_750_THRM4
, "THRM4",
6179 SPR_NOACCESS
, SPR_NOACCESS
,
6180 &spr_read_generic
, &spr_write_generic
,
6182 /* Hardware implementation registers */
6183 /* XXX : not implemented */
6184 spr_register(env
, SPR_HID0
, "HID0",
6185 SPR_NOACCESS
, SPR_NOACCESS
,
6186 &spr_read_generic
, &spr_write_generic
,
6188 /* XXX : not implemented */
6189 spr_register(env
, SPR_HID1
, "HID1",
6190 SPR_NOACCESS
, SPR_NOACCESS
,
6191 &spr_read_generic
, &spr_write_generic
,
6193 /* XXX : not implemented */
6194 spr_register(env
, SPR_750FX_HID2
, "HID2",
6195 SPR_NOACCESS
, SPR_NOACCESS
,
6196 &spr_read_generic
, &spr_write_generic
,
6198 /* Memory management */
6200 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6203 env
->dcache_line_size
= 32;
6204 env
->icache_line_size
= 32;
6205 /* Allocate hardware IRQ controller */
6206 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6209 POWERPC_FAMILY(750fx
)(ObjectClass
*oc
, void *data
)
6211 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6212 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6214 dc
->desc
= "PowerPC 750FX";
6215 pcc
->init_proc
= init_proc_750fx
;
6216 pcc
->check_pow
= check_pow_hid0
;
6217 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6218 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6219 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6220 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6221 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6222 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6223 PPC_SEGMENT
| PPC_EXTERN
;
6224 pcc
->msr_mask
= (1ull << MSR_POW
) |
6240 pcc
->mmu_model
= POWERPC_MMU_32B
;
6241 #if defined(CONFIG_SOFTMMU)
6242 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6244 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6245 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6246 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6247 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6248 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6251 static void init_proc_750gx(CPUPPCState
*env
)
6253 gen_spr_ne_601(env
);
6256 /* XXX : not implemented (XXX: different from 750fx) */
6257 spr_register(env
, SPR_L2CR
, "L2CR",
6258 SPR_NOACCESS
, SPR_NOACCESS
,
6259 &spr_read_generic
, spr_access_nop
,
6263 /* Thermal management */
6265 /* XXX : not implemented */
6266 spr_register(env
, SPR_750_THRM4
, "THRM4",
6267 SPR_NOACCESS
, SPR_NOACCESS
,
6268 &spr_read_generic
, &spr_write_generic
,
6270 /* Hardware implementation registers */
6271 /* XXX : not implemented (XXX: different from 750fx) */
6272 spr_register(env
, SPR_HID0
, "HID0",
6273 SPR_NOACCESS
, SPR_NOACCESS
,
6274 &spr_read_generic
, &spr_write_generic
,
6276 /* XXX : not implemented */
6277 spr_register(env
, SPR_HID1
, "HID1",
6278 SPR_NOACCESS
, SPR_NOACCESS
,
6279 &spr_read_generic
, &spr_write_generic
,
6281 /* XXX : not implemented (XXX: different from 750fx) */
6282 spr_register(env
, SPR_750FX_HID2
, "HID2",
6283 SPR_NOACCESS
, SPR_NOACCESS
,
6284 &spr_read_generic
, &spr_write_generic
,
6286 /* Memory management */
6288 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6291 env
->dcache_line_size
= 32;
6292 env
->icache_line_size
= 32;
6293 /* Allocate hardware IRQ controller */
6294 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6297 POWERPC_FAMILY(750gx
)(ObjectClass
*oc
, void *data
)
6299 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6300 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6302 dc
->desc
= "PowerPC 750GX";
6303 pcc
->init_proc
= init_proc_750gx
;
6304 pcc
->check_pow
= check_pow_hid0
;
6305 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6306 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6307 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6308 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6309 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6310 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6311 PPC_SEGMENT
| PPC_EXTERN
;
6312 pcc
->msr_mask
= (1ull << MSR_POW
) |
6328 pcc
->mmu_model
= POWERPC_MMU_32B
;
6329 #if defined(CONFIG_SOFTMMU)
6330 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6332 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6333 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6334 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6335 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6336 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6339 static void init_proc_745(CPUPPCState
*env
)
6341 gen_spr_ne_601(env
);
6344 gen_spr_G2_755(env
);
6347 /* Thermal management */
6349 /* Hardware implementation registers */
6350 /* XXX : not implemented */
6351 spr_register(env
, SPR_HID0
, "HID0",
6352 SPR_NOACCESS
, SPR_NOACCESS
,
6353 &spr_read_generic
, &spr_write_generic
,
6355 /* XXX : not implemented */
6356 spr_register(env
, SPR_HID1
, "HID1",
6357 SPR_NOACCESS
, SPR_NOACCESS
,
6358 &spr_read_generic
, &spr_write_generic
,
6360 /* XXX : not implemented */
6361 spr_register(env
, SPR_HID2
, "HID2",
6362 SPR_NOACCESS
, SPR_NOACCESS
,
6363 &spr_read_generic
, &spr_write_generic
,
6365 /* Memory management */
6368 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6370 env
->dcache_line_size
= 32;
6371 env
->icache_line_size
= 32;
6372 /* Allocate hardware IRQ controller */
6373 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6376 POWERPC_FAMILY(745)(ObjectClass
*oc
, void *data
)
6378 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6379 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6381 dc
->desc
= "PowerPC 745";
6382 pcc
->init_proc
= init_proc_745
;
6383 pcc
->check_pow
= check_pow_hid0
;
6384 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6385 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6386 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6387 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6388 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6389 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6390 PPC_SEGMENT
| PPC_EXTERN
;
6391 pcc
->msr_mask
= (1ull << MSR_POW
) |
6407 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6408 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6409 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6410 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6411 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6412 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6415 static void init_proc_755(CPUPPCState
*env
)
6417 gen_spr_ne_601(env
);
6420 gen_spr_G2_755(env
);
6423 /* L2 cache control */
6424 /* XXX : not implemented */
6425 spr_register(env
, SPR_L2CR
, "L2CR",
6426 SPR_NOACCESS
, SPR_NOACCESS
,
6427 &spr_read_generic
, spr_access_nop
,
6429 /* XXX : not implemented */
6430 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6431 SPR_NOACCESS
, SPR_NOACCESS
,
6432 &spr_read_generic
, &spr_write_generic
,
6434 /* Thermal management */
6436 /* Hardware implementation registers */
6437 /* XXX : not implemented */
6438 spr_register(env
, SPR_HID0
, "HID0",
6439 SPR_NOACCESS
, SPR_NOACCESS
,
6440 &spr_read_generic
, &spr_write_generic
,
6442 /* XXX : not implemented */
6443 spr_register(env
, SPR_HID1
, "HID1",
6444 SPR_NOACCESS
, SPR_NOACCESS
,
6445 &spr_read_generic
, &spr_write_generic
,
6447 /* XXX : not implemented */
6448 spr_register(env
, SPR_HID2
, "HID2",
6449 SPR_NOACCESS
, SPR_NOACCESS
,
6450 &spr_read_generic
, &spr_write_generic
,
6452 /* Memory management */
6455 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6457 env
->dcache_line_size
= 32;
6458 env
->icache_line_size
= 32;
6459 /* Allocate hardware IRQ controller */
6460 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6463 POWERPC_FAMILY(755)(ObjectClass
*oc
, void *data
)
6465 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6466 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6468 dc
->desc
= "PowerPC 755";
6469 pcc
->init_proc
= init_proc_755
;
6470 pcc
->check_pow
= check_pow_hid0
;
6471 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6472 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6473 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6474 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6475 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6476 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6477 PPC_SEGMENT
| PPC_EXTERN
;
6478 pcc
->msr_mask
= (1ull << MSR_POW
) |
6494 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6495 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6496 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6497 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6498 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6499 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6502 static void init_proc_7400(CPUPPCState
*env
)
6504 gen_spr_ne_601(env
);
6509 /* 74xx specific SPR */
6511 /* XXX : not implemented */
6512 spr_register(env
, SPR_UBAMR
, "UBAMR",
6513 &spr_read_ureg
, SPR_NOACCESS
,
6514 &spr_read_ureg
, SPR_NOACCESS
,
6516 /* XXX: this seems not implemented on all revisions. */
6517 /* XXX : not implemented */
6518 spr_register(env
, SPR_MSSCR1
, "MSSCR1",
6519 SPR_NOACCESS
, SPR_NOACCESS
,
6520 &spr_read_generic
, &spr_write_generic
,
6522 /* Thermal management */
6524 /* Memory management */
6526 init_excp_7400(env
);
6527 env
->dcache_line_size
= 32;
6528 env
->icache_line_size
= 32;
6529 /* Allocate hardware IRQ controller */
6530 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6533 POWERPC_FAMILY(7400)(ObjectClass
*oc
, void *data
)
6535 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6536 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6538 dc
->desc
= "PowerPC 7400 (aka G4)";
6539 pcc
->init_proc
= init_proc_7400
;
6540 pcc
->check_pow
= check_pow_hid0
;
6541 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6542 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6543 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6545 PPC_CACHE
| PPC_CACHE_ICBI
|
6546 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6547 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6548 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6550 PPC_SEGMENT
| PPC_EXTERN
|
6552 pcc
->msr_mask
= (1ull << MSR_VR
) |
6569 pcc
->mmu_model
= POWERPC_MMU_32B
;
6570 #if defined(CONFIG_SOFTMMU)
6571 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6573 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6574 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6575 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6576 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6577 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6578 POWERPC_FLAG_BUS_CLK
;
6581 static void init_proc_7410(CPUPPCState
*env
)
6583 gen_spr_ne_601(env
);
6588 /* 74xx specific SPR */
6590 /* XXX : not implemented */
6591 spr_register(env
, SPR_UBAMR
, "UBAMR",
6592 &spr_read_ureg
, SPR_NOACCESS
,
6593 &spr_read_ureg
, SPR_NOACCESS
,
6595 /* Thermal management */
6598 /* XXX : not implemented */
6599 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6600 SPR_NOACCESS
, SPR_NOACCESS
,
6601 &spr_read_generic
, &spr_write_generic
,
6604 /* XXX : not implemented */
6605 spr_register(env
, SPR_LDSTDB
, "LDSTDB",
6606 SPR_NOACCESS
, SPR_NOACCESS
,
6607 &spr_read_generic
, &spr_write_generic
,
6609 /* Memory management */
6611 init_excp_7400(env
);
6612 env
->dcache_line_size
= 32;
6613 env
->icache_line_size
= 32;
6614 /* Allocate hardware IRQ controller */
6615 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6618 POWERPC_FAMILY(7410)(ObjectClass
*oc
, void *data
)
6620 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6621 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6623 dc
->desc
= "PowerPC 7410 (aka G4)";
6624 pcc
->init_proc
= init_proc_7410
;
6625 pcc
->check_pow
= check_pow_hid0
;
6626 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6627 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6628 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6630 PPC_CACHE
| PPC_CACHE_ICBI
|
6631 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6632 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6633 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6635 PPC_SEGMENT
| PPC_EXTERN
|
6637 pcc
->msr_mask
= (1ull << MSR_VR
) |
6654 pcc
->mmu_model
= POWERPC_MMU_32B
;
6655 #if defined(CONFIG_SOFTMMU)
6656 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6658 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6659 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6660 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6661 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6662 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6663 POWERPC_FLAG_BUS_CLK
;
6666 static void init_proc_7440(CPUPPCState
*env
)
6668 gen_spr_ne_601(env
);
6673 /* 74xx specific SPR */
6675 /* XXX : not implemented */
6676 spr_register(env
, SPR_UBAMR
, "UBAMR",
6677 &spr_read_ureg
, SPR_NOACCESS
,
6678 &spr_read_ureg
, SPR_NOACCESS
,
6681 /* XXX : not implemented */
6682 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6683 SPR_NOACCESS
, SPR_NOACCESS
,
6684 &spr_read_generic
, &spr_write_generic
,
6687 /* XXX : not implemented */
6688 spr_register(env
, SPR_ICTRL
, "ICTRL",
6689 SPR_NOACCESS
, SPR_NOACCESS
,
6690 &spr_read_generic
, &spr_write_generic
,
6693 /* XXX : not implemented */
6694 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6695 SPR_NOACCESS
, SPR_NOACCESS
,
6696 &spr_read_generic
, &spr_write_generic
,
6699 /* XXX : not implemented */
6700 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6701 SPR_NOACCESS
, SPR_NOACCESS
,
6702 &spr_read_generic
, &spr_write_generic
,
6704 /* XXX : not implemented */
6705 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6706 &spr_read_ureg
, SPR_NOACCESS
,
6707 &spr_read_ureg
, SPR_NOACCESS
,
6709 /* XXX : not implemented */
6710 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6711 SPR_NOACCESS
, SPR_NOACCESS
,
6712 &spr_read_generic
, &spr_write_generic
,
6714 /* XXX : not implemented */
6715 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6716 &spr_read_ureg
, SPR_NOACCESS
,
6717 &spr_read_ureg
, SPR_NOACCESS
,
6719 /* Memory management */
6721 gen_74xx_soft_tlb(env
, 128, 2);
6722 init_excp_7450(env
);
6723 env
->dcache_line_size
= 32;
6724 env
->icache_line_size
= 32;
6725 /* Allocate hardware IRQ controller */
6726 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6729 POWERPC_FAMILY(7440)(ObjectClass
*oc
, void *data
)
6731 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6732 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6734 dc
->desc
= "PowerPC 7440 (aka G4)";
6735 pcc
->init_proc
= init_proc_7440
;
6736 pcc
->check_pow
= check_pow_hid0_74xx
;
6737 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6738 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6739 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6741 PPC_CACHE
| PPC_CACHE_ICBI
|
6742 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6743 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6744 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6745 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6746 PPC_SEGMENT
| PPC_EXTERN
|
6748 pcc
->msr_mask
= (1ull << MSR_VR
) |
6765 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6766 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6767 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6768 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6769 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6770 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6771 POWERPC_FLAG_BUS_CLK
;
6774 static void init_proc_7450(CPUPPCState
*env
)
6776 gen_spr_ne_601(env
);
6781 /* 74xx specific SPR */
6783 /* Level 3 cache control */
6786 /* XXX : not implemented */
6787 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
6788 SPR_NOACCESS
, SPR_NOACCESS
,
6789 &spr_read_generic
, &spr_write_generic
,
6792 /* XXX : not implemented */
6793 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
6794 SPR_NOACCESS
, SPR_NOACCESS
,
6795 &spr_read_generic
, &spr_write_generic
,
6798 /* XXX : not implemented */
6799 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
6800 SPR_NOACCESS
, SPR_NOACCESS
,
6801 &spr_read_generic
, &spr_write_generic
,
6804 /* XXX : not implemented */
6805 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
6806 SPR_NOACCESS
, SPR_NOACCESS
,
6807 &spr_read_generic
, &spr_write_generic
,
6809 /* XXX : not implemented */
6810 spr_register(env
, SPR_UBAMR
, "UBAMR",
6811 &spr_read_ureg
, SPR_NOACCESS
,
6812 &spr_read_ureg
, SPR_NOACCESS
,
6815 /* XXX : not implemented */
6816 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6817 SPR_NOACCESS
, SPR_NOACCESS
,
6818 &spr_read_generic
, &spr_write_generic
,
6821 /* XXX : not implemented */
6822 spr_register(env
, SPR_ICTRL
, "ICTRL",
6823 SPR_NOACCESS
, SPR_NOACCESS
,
6824 &spr_read_generic
, &spr_write_generic
,
6827 /* XXX : not implemented */
6828 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6829 SPR_NOACCESS
, SPR_NOACCESS
,
6830 &spr_read_generic
, &spr_write_generic
,
6833 /* XXX : not implemented */
6834 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6835 SPR_NOACCESS
, SPR_NOACCESS
,
6836 &spr_read_generic
, &spr_write_generic
,
6838 /* XXX : not implemented */
6839 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6840 &spr_read_ureg
, SPR_NOACCESS
,
6841 &spr_read_ureg
, SPR_NOACCESS
,
6843 /* XXX : not implemented */
6844 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6845 SPR_NOACCESS
, SPR_NOACCESS
,
6846 &spr_read_generic
, &spr_write_generic
,
6848 /* XXX : not implemented */
6849 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6850 &spr_read_ureg
, SPR_NOACCESS
,
6851 &spr_read_ureg
, SPR_NOACCESS
,
6853 /* Memory management */
6855 gen_74xx_soft_tlb(env
, 128, 2);
6856 init_excp_7450(env
);
6857 env
->dcache_line_size
= 32;
6858 env
->icache_line_size
= 32;
6859 /* Allocate hardware IRQ controller */
6860 ppc6xx_irq_init(ppc_env_get_cpu(env
));
6863 POWERPC_FAMILY(7450)(ObjectClass
*oc
, void *data
)
6865 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6866 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6868 dc
->desc
= "PowerPC 7450 (aka G4)";
6869 pcc
->init_proc
= init_proc_7450
;
6870 pcc
->check_pow
= check_pow_hid0_74xx
;
6871 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6872 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6873 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6875 PPC_CACHE
| PPC_CACHE_ICBI
|
6876 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6877 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6878 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6879 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6880 PPC_SEGMENT
| PPC_EXTERN
|
6882 pcc
->msr_mask
= (1ull << MSR_VR
) |
6899 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6900 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6901 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6902 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6903 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6904 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6905 POWERPC_FLAG_BUS_CLK
;
6908 static void init_proc_7445(CPUPPCState
*env
)
6910 gen_spr_ne_601(env
);
6915 /* 74xx specific SPR */
6918 /* XXX : not implemented */
6919 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6920 SPR_NOACCESS
, SPR_NOACCESS
,
6921 &spr_read_generic
, &spr_write_generic
,
6924 /* XXX : not implemented */
6925 spr_register(env
, SPR_ICTRL
, "ICTRL",
6926 SPR_NOACCESS
, SPR_NOACCESS
,
6927 &spr_read_generic
, &spr_write_generic
,
6930 /* XXX : not implemented */
6931 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6932 SPR_NOACCESS
, SPR_NOACCESS
,
6933 &spr_read_generic
, &spr_write_generic
,
6936 /* XXX : not implemented */
6937 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6938 SPR_NOACCESS
, SPR_NOACCESS
,
6939 &spr_read_generic
, &spr_write_generic
,
6941 /* XXX : not implemented */
6942 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6943 &spr_read_ureg
, SPR_NOACCESS
,
6944 &spr_read_ureg
, SPR_NOACCESS
,
6946 /* XXX : not implemented */
6947 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6948 SPR_NOACCESS
, SPR_NOACCESS
,
6949 &spr_read_generic
, &spr_write_generic
,
6951 /* XXX : not implemented */
6952 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6953 &spr_read_ureg
, SPR_NOACCESS
,
6954 &spr_read_ureg
, SPR_NOACCESS
,
6957 spr_register(env
, SPR_SPRG4
, "SPRG4",
6958 SPR_NOACCESS
, SPR_NOACCESS
,
6959 &spr_read_generic
, &spr_write_generic
,
6961 spr_register(env
, SPR_USPRG4
, "USPRG4",
6962 &spr_read_ureg
, SPR_NOACCESS
,
6963 &spr_read_ureg
, SPR_NOACCESS
,
6965 spr_register(env
, SPR_SPRG5
, "SPRG5",
6966 SPR_NOACCESS
, SPR_NOACCESS
,
6967 &spr_read_generic
, &spr_write_generic
,
6969 spr_register(env
, SPR_USPRG5
, "USPRG5",
6970 &spr_read_ureg
, SPR_NOACCESS
,
6971 &spr_read_ureg
, SPR_NOACCESS
,
6973 spr_register(env
, SPR_SPRG6
, "SPRG6",
6974 SPR_NOACCESS
, SPR_NOACCESS
,
6975 &spr_read_generic
, &spr_write_generic
,
6977 spr_register(env
, SPR_USPRG6
, "USPRG6",
6978 &spr_read_ureg
, SPR_NOACCESS
,
6979 &spr_read_ureg
, SPR_NOACCESS
,
6981 spr_register(env
, SPR_SPRG7
, "SPRG7",
6982 SPR_NOACCESS
, SPR_NOACCESS
,
6983 &spr_read_generic
, &spr_write_generic
,
6985 spr_register(env
, SPR_USPRG7
, "USPRG7",
6986 &spr_read_ureg
, SPR_NOACCESS
,
6987 &spr_read_ureg
, SPR_NOACCESS
,
6989 /* Memory management */
6992 gen_74xx_soft_tlb(env
, 128, 2);
6993 init_excp_7450(env
);
6994 env
->dcache_line_size
= 32;
6995 env
->icache_line_size
= 32;
6996 /* Allocate hardware IRQ controller */
6997 ppc6xx_irq_init(ppc_env_get_cpu(env
));
7000 POWERPC_FAMILY(7445)(ObjectClass
*oc
, void *data
)
7002 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7003 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7005 dc
->desc
= "PowerPC 7445 (aka G4)";
7006 pcc
->init_proc
= init_proc_7445
;
7007 pcc
->check_pow
= check_pow_hid0_74xx
;
7008 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7009 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7010 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7012 PPC_CACHE
| PPC_CACHE_ICBI
|
7013 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7014 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7015 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7016 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7017 PPC_SEGMENT
| PPC_EXTERN
|
7019 pcc
->msr_mask
= (1ull << MSR_VR
) |
7036 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7037 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7038 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7039 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7040 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7041 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7042 POWERPC_FLAG_BUS_CLK
;
7045 static void init_proc_7455(CPUPPCState
*env
)
7047 gen_spr_ne_601(env
);
7052 /* 74xx specific SPR */
7054 /* Level 3 cache control */
7057 /* XXX : not implemented */
7058 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7059 SPR_NOACCESS
, SPR_NOACCESS
,
7060 &spr_read_generic
, &spr_write_generic
,
7063 /* XXX : not implemented */
7064 spr_register(env
, SPR_ICTRL
, "ICTRL",
7065 SPR_NOACCESS
, SPR_NOACCESS
,
7066 &spr_read_generic
, &spr_write_generic
,
7069 /* XXX : not implemented */
7070 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7071 SPR_NOACCESS
, SPR_NOACCESS
,
7072 &spr_read_generic
, &spr_write_generic
,
7075 /* XXX : not implemented */
7076 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7077 SPR_NOACCESS
, SPR_NOACCESS
,
7078 &spr_read_generic
, &spr_write_generic
,
7080 /* XXX : not implemented */
7081 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7082 &spr_read_ureg
, SPR_NOACCESS
,
7083 &spr_read_ureg
, SPR_NOACCESS
,
7085 /* XXX : not implemented */
7086 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7087 SPR_NOACCESS
, SPR_NOACCESS
,
7088 &spr_read_generic
, &spr_write_generic
,
7090 /* XXX : not implemented */
7091 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7092 &spr_read_ureg
, SPR_NOACCESS
,
7093 &spr_read_ureg
, SPR_NOACCESS
,
7096 spr_register(env
, SPR_SPRG4
, "SPRG4",
7097 SPR_NOACCESS
, SPR_NOACCESS
,
7098 &spr_read_generic
, &spr_write_generic
,
7100 spr_register(env
, SPR_USPRG4
, "USPRG4",
7101 &spr_read_ureg
, SPR_NOACCESS
,
7102 &spr_read_ureg
, SPR_NOACCESS
,
7104 spr_register(env
, SPR_SPRG5
, "SPRG5",
7105 SPR_NOACCESS
, SPR_NOACCESS
,
7106 &spr_read_generic
, &spr_write_generic
,
7108 spr_register(env
, SPR_USPRG5
, "USPRG5",
7109 &spr_read_ureg
, SPR_NOACCESS
,
7110 &spr_read_ureg
, SPR_NOACCESS
,
7112 spr_register(env
, SPR_SPRG6
, "SPRG6",
7113 SPR_NOACCESS
, SPR_NOACCESS
,
7114 &spr_read_generic
, &spr_write_generic
,
7116 spr_register(env
, SPR_USPRG6
, "USPRG6",
7117 &spr_read_ureg
, SPR_NOACCESS
,
7118 &spr_read_ureg
, SPR_NOACCESS
,
7120 spr_register(env
, SPR_SPRG7
, "SPRG7",
7121 SPR_NOACCESS
, SPR_NOACCESS
,
7122 &spr_read_generic
, &spr_write_generic
,
7124 spr_register(env
, SPR_USPRG7
, "USPRG7",
7125 &spr_read_ureg
, SPR_NOACCESS
,
7126 &spr_read_ureg
, SPR_NOACCESS
,
7128 /* Memory management */
7131 gen_74xx_soft_tlb(env
, 128, 2);
7132 init_excp_7450(env
);
7133 env
->dcache_line_size
= 32;
7134 env
->icache_line_size
= 32;
7135 /* Allocate hardware IRQ controller */
7136 ppc6xx_irq_init(ppc_env_get_cpu(env
));
7139 POWERPC_FAMILY(7455)(ObjectClass
*oc
, void *data
)
7141 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7142 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7144 dc
->desc
= "PowerPC 7455 (aka G4)";
7145 pcc
->init_proc
= init_proc_7455
;
7146 pcc
->check_pow
= check_pow_hid0_74xx
;
7147 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7148 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7149 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7151 PPC_CACHE
| PPC_CACHE_ICBI
|
7152 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7153 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7154 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7155 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7156 PPC_SEGMENT
| PPC_EXTERN
|
7158 pcc
->msr_mask
= (1ull << MSR_VR
) |
7175 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7176 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7177 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7178 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7179 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7180 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7181 POWERPC_FLAG_BUS_CLK
;
7184 static void init_proc_7457(CPUPPCState
*env
)
7186 gen_spr_ne_601(env
);
7191 /* 74xx specific SPR */
7193 /* Level 3 cache control */
7196 /* XXX : not implemented */
7197 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
7198 SPR_NOACCESS
, SPR_NOACCESS
,
7199 &spr_read_generic
, &spr_write_generic
,
7202 /* XXX : not implemented */
7203 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
7204 SPR_NOACCESS
, SPR_NOACCESS
,
7205 &spr_read_generic
, &spr_write_generic
,
7208 /* XXX : not implemented */
7209 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
7210 SPR_NOACCESS
, SPR_NOACCESS
,
7211 &spr_read_generic
, &spr_write_generic
,
7214 /* XXX : not implemented */
7215 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
7216 SPR_NOACCESS
, SPR_NOACCESS
,
7217 &spr_read_generic
, &spr_write_generic
,
7220 /* XXX : not implemented */
7221 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7222 SPR_NOACCESS
, SPR_NOACCESS
,
7223 &spr_read_generic
, &spr_write_generic
,
7226 /* XXX : not implemented */
7227 spr_register(env
, SPR_ICTRL
, "ICTRL",
7228 SPR_NOACCESS
, SPR_NOACCESS
,
7229 &spr_read_generic
, &spr_write_generic
,
7232 /* XXX : not implemented */
7233 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7234 SPR_NOACCESS
, SPR_NOACCESS
,
7235 &spr_read_generic
, &spr_write_generic
,
7238 /* XXX : not implemented */
7239 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7240 SPR_NOACCESS
, SPR_NOACCESS
,
7241 &spr_read_generic
, &spr_write_generic
,
7243 /* XXX : not implemented */
7244 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7245 &spr_read_ureg
, SPR_NOACCESS
,
7246 &spr_read_ureg
, SPR_NOACCESS
,
7248 /* XXX : not implemented */
7249 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7250 SPR_NOACCESS
, SPR_NOACCESS
,
7251 &spr_read_generic
, &spr_write_generic
,
7253 /* XXX : not implemented */
7254 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7255 &spr_read_ureg
, SPR_NOACCESS
,
7256 &spr_read_ureg
, SPR_NOACCESS
,
7259 spr_register(env
, SPR_SPRG4
, "SPRG4",
7260 SPR_NOACCESS
, SPR_NOACCESS
,
7261 &spr_read_generic
, &spr_write_generic
,
7263 spr_register(env
, SPR_USPRG4
, "USPRG4",
7264 &spr_read_ureg
, SPR_NOACCESS
,
7265 &spr_read_ureg
, SPR_NOACCESS
,
7267 spr_register(env
, SPR_SPRG5
, "SPRG5",
7268 SPR_NOACCESS
, SPR_NOACCESS
,
7269 &spr_read_generic
, &spr_write_generic
,
7271 spr_register(env
, SPR_USPRG5
, "USPRG5",
7272 &spr_read_ureg
, SPR_NOACCESS
,
7273 &spr_read_ureg
, SPR_NOACCESS
,
7275 spr_register(env
, SPR_SPRG6
, "SPRG6",
7276 SPR_NOACCESS
, SPR_NOACCESS
,
7277 &spr_read_generic
, &spr_write_generic
,
7279 spr_register(env
, SPR_USPRG6
, "USPRG6",
7280 &spr_read_ureg
, SPR_NOACCESS
,
7281 &spr_read_ureg
, SPR_NOACCESS
,
7283 spr_register(env
, SPR_SPRG7
, "SPRG7",
7284 SPR_NOACCESS
, SPR_NOACCESS
,
7285 &spr_read_generic
, &spr_write_generic
,
7287 spr_register(env
, SPR_USPRG7
, "USPRG7",
7288 &spr_read_ureg
, SPR_NOACCESS
,
7289 &spr_read_ureg
, SPR_NOACCESS
,
7291 /* Memory management */
7294 gen_74xx_soft_tlb(env
, 128, 2);
7295 init_excp_7450(env
);
7296 env
->dcache_line_size
= 32;
7297 env
->icache_line_size
= 32;
7298 /* Allocate hardware IRQ controller */
7299 ppc6xx_irq_init(ppc_env_get_cpu(env
));
7302 POWERPC_FAMILY(7457)(ObjectClass
*oc
, void *data
)
7304 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7305 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7307 dc
->desc
= "PowerPC 7457 (aka G4)";
7308 pcc
->init_proc
= init_proc_7457
;
7309 pcc
->check_pow
= check_pow_hid0_74xx
;
7310 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7311 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7312 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7314 PPC_CACHE
| PPC_CACHE_ICBI
|
7315 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7316 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7317 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7318 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7319 PPC_SEGMENT
| PPC_EXTERN
|
7321 pcc
->msr_mask
= (1ull << MSR_VR
) |
7338 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7339 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7340 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7341 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7342 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7343 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7344 POWERPC_FLAG_BUS_CLK
;
7347 static void init_proc_e600(CPUPPCState
*env
)
7349 gen_spr_ne_601(env
);
7354 /* 74xx specific SPR */
7356 /* XXX : not implemented */
7357 spr_register(env
, SPR_UBAMR
, "UBAMR",
7358 &spr_read_ureg
, SPR_NOACCESS
,
7359 &spr_read_ureg
, SPR_NOACCESS
,
7361 /* XXX : not implemented */
7362 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7363 SPR_NOACCESS
, SPR_NOACCESS
,
7364 &spr_read_generic
, &spr_write_generic
,
7366 /* XXX : not implemented */
7367 spr_register(env
, SPR_ICTRL
, "ICTRL",
7368 SPR_NOACCESS
, SPR_NOACCESS
,
7369 &spr_read_generic
, &spr_write_generic
,
7371 /* XXX : not implemented */
7372 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7373 SPR_NOACCESS
, SPR_NOACCESS
,
7374 &spr_read_generic
, &spr_write_generic
,
7376 /* XXX : not implemented */
7377 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7378 SPR_NOACCESS
, SPR_NOACCESS
,
7379 &spr_read_generic
, &spr_write_generic
,
7381 /* XXX : not implemented */
7382 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7383 &spr_read_ureg
, SPR_NOACCESS
,
7384 &spr_read_ureg
, SPR_NOACCESS
,
7386 /* XXX : not implemented */
7387 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7388 SPR_NOACCESS
, SPR_NOACCESS
,
7389 &spr_read_generic
, &spr_write_generic
,
7391 /* XXX : not implemented */
7392 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7393 &spr_read_ureg
, SPR_NOACCESS
,
7394 &spr_read_ureg
, SPR_NOACCESS
,
7397 spr_register(env
, SPR_SPRG4
, "SPRG4",
7398 SPR_NOACCESS
, SPR_NOACCESS
,
7399 &spr_read_generic
, &spr_write_generic
,
7401 spr_register(env
, SPR_USPRG4
, "USPRG4",
7402 &spr_read_ureg
, SPR_NOACCESS
,
7403 &spr_read_ureg
, SPR_NOACCESS
,
7405 spr_register(env
, SPR_SPRG5
, "SPRG5",
7406 SPR_NOACCESS
, SPR_NOACCESS
,
7407 &spr_read_generic
, &spr_write_generic
,
7409 spr_register(env
, SPR_USPRG5
, "USPRG5",
7410 &spr_read_ureg
, SPR_NOACCESS
,
7411 &spr_read_ureg
, SPR_NOACCESS
,
7413 spr_register(env
, SPR_SPRG6
, "SPRG6",
7414 SPR_NOACCESS
, SPR_NOACCESS
,
7415 &spr_read_generic
, &spr_write_generic
,
7417 spr_register(env
, SPR_USPRG6
, "USPRG6",
7418 &spr_read_ureg
, SPR_NOACCESS
,
7419 &spr_read_ureg
, SPR_NOACCESS
,
7421 spr_register(env
, SPR_SPRG7
, "SPRG7",
7422 SPR_NOACCESS
, SPR_NOACCESS
,
7423 &spr_read_generic
, &spr_write_generic
,
7425 spr_register(env
, SPR_USPRG7
, "USPRG7",
7426 &spr_read_ureg
, SPR_NOACCESS
,
7427 &spr_read_ureg
, SPR_NOACCESS
,
7429 /* Memory management */
7432 gen_74xx_soft_tlb(env
, 128, 2);
7433 init_excp_7450(env
);
7434 env
->dcache_line_size
= 32;
7435 env
->icache_line_size
= 32;
7436 /* Allocate hardware IRQ controller */
7437 ppc6xx_irq_init(ppc_env_get_cpu(env
));
7440 POWERPC_FAMILY(e600
)(ObjectClass
*oc
, void *data
)
7442 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7443 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7445 dc
->desc
= "PowerPC e600";
7446 pcc
->init_proc
= init_proc_e600
;
7447 pcc
->check_pow
= check_pow_hid0_74xx
;
7448 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7449 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7450 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7452 PPC_CACHE
| PPC_CACHE_ICBI
|
7453 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7454 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7455 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7456 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7457 PPC_SEGMENT
| PPC_EXTERN
|
7459 pcc
->insns_flags2
= PPC_NONE
;
7460 pcc
->msr_mask
= (1ull << MSR_VR
) |
7477 pcc
->mmu_model
= POWERPC_MMU_32B
;
7478 #if defined(CONFIG_SOFTMMU)
7479 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
7481 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7482 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7483 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7484 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7485 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7486 POWERPC_FLAG_BUS_CLK
;
7489 #if defined(TARGET_PPC64)
7490 #if defined(CONFIG_USER_ONLY)
7491 #define POWERPC970_HID5_INIT 0x00000080
7493 #define POWERPC970_HID5_INIT 0x00000000
7496 static void gen_fscr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7497 int bit
, int sprn
, int cause
)
7499 TCGv_i32 t1
= tcg_const_i32(bit
);
7500 TCGv_i32 t2
= tcg_const_i32(sprn
);
7501 TCGv_i32 t3
= tcg_const_i32(cause
);
7503 gen_helper_fscr_facility_check(cpu_env
, t1
, t2
, t3
);
7505 tcg_temp_free_i32(t3
);
7506 tcg_temp_free_i32(t2
);
7507 tcg_temp_free_i32(t1
);
7510 static void gen_msr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7511 int bit
, int sprn
, int cause
)
7513 TCGv_i32 t1
= tcg_const_i32(bit
);
7514 TCGv_i32 t2
= tcg_const_i32(sprn
);
7515 TCGv_i32 t3
= tcg_const_i32(cause
);
7517 gen_helper_msr_facility_check(cpu_env
, t1
, t2
, t3
);
7519 tcg_temp_free_i32(t3
);
7520 tcg_temp_free_i32(t2
);
7521 tcg_temp_free_i32(t1
);
7524 static void spr_read_prev_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
7526 TCGv spr_up
= tcg_temp_new();
7527 TCGv spr
= tcg_temp_new();
7529 gen_load_spr(spr
, sprn
- 1);
7530 tcg_gen_shri_tl(spr_up
, spr
, 32);
7531 tcg_gen_ext32u_tl(cpu_gpr
[gprn
], spr_up
);
7534 tcg_temp_free(spr_up
);
7537 static void spr_write_prev_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
7539 TCGv spr
= tcg_temp_new();
7541 gen_load_spr(spr
, sprn
- 1);
7542 tcg_gen_deposit_tl(spr
, spr
, cpu_gpr
[gprn
], 32, 32);
7543 gen_store_spr(sprn
- 1, spr
);
7548 static int check_pow_970(CPUPPCState
*env
)
7550 if (env
->spr
[SPR_HID0
] & (HID0_DEEPNAP
| HID0_DOZE
| HID0_NAP
)) {
7557 static void gen_spr_970_hid(CPUPPCState
*env
)
7559 /* Hardware implementation registers */
7560 /* XXX : not implemented */
7561 spr_register(env
, SPR_HID0
, "HID0",
7562 SPR_NOACCESS
, SPR_NOACCESS
,
7563 &spr_read_generic
, &spr_write_clear
,
7565 spr_register(env
, SPR_HID1
, "HID1",
7566 SPR_NOACCESS
, SPR_NOACCESS
,
7567 &spr_read_generic
, &spr_write_generic
,
7569 spr_register(env
, SPR_970_HID5
, "HID5",
7570 SPR_NOACCESS
, SPR_NOACCESS
,
7571 &spr_read_generic
, &spr_write_generic
,
7572 POWERPC970_HID5_INIT
);
7575 static void gen_spr_970_hior(CPUPPCState
*env
)
7577 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7578 SPR_NOACCESS
, SPR_NOACCESS
,
7579 &spr_read_hior
, &spr_write_hior
,
7583 static void gen_spr_book3s_ctrl(CPUPPCState
*env
)
7585 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
7586 SPR_NOACCESS
, SPR_NOACCESS
,
7587 SPR_NOACCESS
, &spr_write_generic
,
7589 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
7590 &spr_read_ureg
, SPR_NOACCESS
,
7591 &spr_read_ureg
, SPR_NOACCESS
,
7595 static void gen_spr_book3s_altivec(CPUPPCState
*env
)
7597 if (!(env
->insns_flags
& PPC_ALTIVEC
)) {
7601 spr_register_kvm(env
, SPR_VRSAVE
, "VRSAVE",
7602 &spr_read_generic
, &spr_write_generic
,
7603 &spr_read_generic
, &spr_write_generic
,
7604 KVM_REG_PPC_VRSAVE
, 0x00000000);
7607 * Can't find information on what this should be on reset. This
7608 * value is the one used by 74xx processors.
7610 vscr_init(env
, 0x00010000);
7613 static void gen_spr_book3s_dbg(CPUPPCState
*env
)
7616 * TODO: different specs define different scopes for these,
7617 * will have to address this:
7618 * 970: super/write and super/read
7619 * powerisa 2.03..2.04: hypv/write and super/read.
7620 * powerisa 2.05 and newer: hypv/write and hypv/read.
7622 spr_register_kvm(env
, SPR_DABR
, "DABR",
7623 SPR_NOACCESS
, SPR_NOACCESS
,
7624 &spr_read_generic
, &spr_write_generic
,
7625 KVM_REG_PPC_DABR
, 0x00000000);
7626 spr_register_kvm(env
, SPR_DABRX
, "DABRX",
7627 SPR_NOACCESS
, SPR_NOACCESS
,
7628 &spr_read_generic
, &spr_write_generic
,
7629 KVM_REG_PPC_DABRX
, 0x00000000);
7632 static void gen_spr_book3s_207_dbg(CPUPPCState
*env
)
7634 spr_register_kvm_hv(env
, SPR_DAWR
, "DAWR",
7635 SPR_NOACCESS
, SPR_NOACCESS
,
7636 SPR_NOACCESS
, SPR_NOACCESS
,
7637 &spr_read_generic
, &spr_write_generic
,
7638 KVM_REG_PPC_DAWR
, 0x00000000);
7639 spr_register_kvm_hv(env
, SPR_DAWRX
, "DAWRX",
7640 SPR_NOACCESS
, SPR_NOACCESS
,
7641 SPR_NOACCESS
, SPR_NOACCESS
,
7642 &spr_read_generic
, &spr_write_generic
,
7643 KVM_REG_PPC_DAWRX
, 0x00000000);
7644 spr_register_kvm_hv(env
, SPR_CIABR
, "CIABR",
7645 SPR_NOACCESS
, SPR_NOACCESS
,
7646 SPR_NOACCESS
, SPR_NOACCESS
,
7647 &spr_read_generic
, &spr_write_generic
,
7648 KVM_REG_PPC_CIABR
, 0x00000000);
7651 static void gen_spr_970_dbg(CPUPPCState
*env
)
7654 spr_register(env
, SPR_IABR
, "IABR",
7655 SPR_NOACCESS
, SPR_NOACCESS
,
7656 &spr_read_generic
, &spr_write_generic
,
7660 static void gen_spr_book3s_pmu_sup(CPUPPCState
*env
)
7662 spr_register_kvm(env
, SPR_POWER_MMCR0
, "MMCR0",
7663 SPR_NOACCESS
, SPR_NOACCESS
,
7664 &spr_read_generic
, &spr_write_generic
,
7665 KVM_REG_PPC_MMCR0
, 0x00000000);
7666 spr_register_kvm(env
, SPR_POWER_MMCR1
, "MMCR1",
7667 SPR_NOACCESS
, SPR_NOACCESS
,
7668 &spr_read_generic
, &spr_write_generic
,
7669 KVM_REG_PPC_MMCR1
, 0x00000000);
7670 spr_register_kvm(env
, SPR_POWER_MMCRA
, "MMCRA",
7671 SPR_NOACCESS
, SPR_NOACCESS
,
7672 &spr_read_generic
, &spr_write_generic
,
7673 KVM_REG_PPC_MMCRA
, 0x00000000);
7674 spr_register_kvm(env
, SPR_POWER_PMC1
, "PMC1",
7675 SPR_NOACCESS
, SPR_NOACCESS
,
7676 &spr_read_generic
, &spr_write_generic
,
7677 KVM_REG_PPC_PMC1
, 0x00000000);
7678 spr_register_kvm(env
, SPR_POWER_PMC2
, "PMC2",
7679 SPR_NOACCESS
, SPR_NOACCESS
,
7680 &spr_read_generic
, &spr_write_generic
,
7681 KVM_REG_PPC_PMC2
, 0x00000000);
7682 spr_register_kvm(env
, SPR_POWER_PMC3
, "PMC3",
7683 SPR_NOACCESS
, SPR_NOACCESS
,
7684 &spr_read_generic
, &spr_write_generic
,
7685 KVM_REG_PPC_PMC3
, 0x00000000);
7686 spr_register_kvm(env
, SPR_POWER_PMC4
, "PMC4",
7687 SPR_NOACCESS
, SPR_NOACCESS
,
7688 &spr_read_generic
, &spr_write_generic
,
7689 KVM_REG_PPC_PMC4
, 0x00000000);
7690 spr_register_kvm(env
, SPR_POWER_PMC5
, "PMC5",
7691 SPR_NOACCESS
, SPR_NOACCESS
,
7692 &spr_read_generic
, &spr_write_generic
,
7693 KVM_REG_PPC_PMC5
, 0x00000000);
7694 spr_register_kvm(env
, SPR_POWER_PMC6
, "PMC6",
7695 SPR_NOACCESS
, SPR_NOACCESS
,
7696 &spr_read_generic
, &spr_write_generic
,
7697 KVM_REG_PPC_PMC6
, 0x00000000);
7698 spr_register_kvm(env
, SPR_POWER_SIAR
, "SIAR",
7699 SPR_NOACCESS
, SPR_NOACCESS
,
7700 &spr_read_generic
, &spr_write_generic
,
7701 KVM_REG_PPC_SIAR
, 0x00000000);
7702 spr_register_kvm(env
, SPR_POWER_SDAR
, "SDAR",
7703 SPR_NOACCESS
, SPR_NOACCESS
,
7704 &spr_read_generic
, &spr_write_generic
,
7705 KVM_REG_PPC_SDAR
, 0x00000000);
7708 static void gen_spr_book3s_pmu_user(CPUPPCState
*env
)
7710 spr_register(env
, SPR_POWER_UMMCR0
, "UMMCR0",
7711 &spr_read_ureg
, SPR_NOACCESS
,
7712 &spr_read_ureg
, &spr_write_ureg
,
7714 spr_register(env
, SPR_POWER_UMMCR1
, "UMMCR1",
7715 &spr_read_ureg
, SPR_NOACCESS
,
7716 &spr_read_ureg
, &spr_write_ureg
,
7718 spr_register(env
, SPR_POWER_UMMCRA
, "UMMCRA",
7719 &spr_read_ureg
, SPR_NOACCESS
,
7720 &spr_read_ureg
, &spr_write_ureg
,
7722 spr_register(env
, SPR_POWER_UPMC1
, "UPMC1",
7723 &spr_read_ureg
, SPR_NOACCESS
,
7724 &spr_read_ureg
, &spr_write_ureg
,
7726 spr_register(env
, SPR_POWER_UPMC2
, "UPMC2",
7727 &spr_read_ureg
, SPR_NOACCESS
,
7728 &spr_read_ureg
, &spr_write_ureg
,
7730 spr_register(env
, SPR_POWER_UPMC3
, "UPMC3",
7731 &spr_read_ureg
, SPR_NOACCESS
,
7732 &spr_read_ureg
, &spr_write_ureg
,
7734 spr_register(env
, SPR_POWER_UPMC4
, "UPMC4",
7735 &spr_read_ureg
, SPR_NOACCESS
,
7736 &spr_read_ureg
, &spr_write_ureg
,
7738 spr_register(env
, SPR_POWER_UPMC5
, "UPMC5",
7739 &spr_read_ureg
, SPR_NOACCESS
,
7740 &spr_read_ureg
, &spr_write_ureg
,
7742 spr_register(env
, SPR_POWER_UPMC6
, "UPMC6",
7743 &spr_read_ureg
, SPR_NOACCESS
,
7744 &spr_read_ureg
, &spr_write_ureg
,
7746 spr_register(env
, SPR_POWER_USIAR
, "USIAR",
7747 &spr_read_ureg
, SPR_NOACCESS
,
7748 &spr_read_ureg
, &spr_write_ureg
,
7750 spr_register(env
, SPR_POWER_USDAR
, "USDAR",
7751 &spr_read_ureg
, SPR_NOACCESS
,
7752 &spr_read_ureg
, &spr_write_ureg
,
7756 static void gen_spr_970_pmu_sup(CPUPPCState
*env
)
7758 spr_register_kvm(env
, SPR_970_PMC7
, "PMC7",
7759 SPR_NOACCESS
, SPR_NOACCESS
,
7760 &spr_read_generic
, &spr_write_generic
,
7761 KVM_REG_PPC_PMC7
, 0x00000000);
7762 spr_register_kvm(env
, SPR_970_PMC8
, "PMC8",
7763 SPR_NOACCESS
, SPR_NOACCESS
,
7764 &spr_read_generic
, &spr_write_generic
,
7765 KVM_REG_PPC_PMC8
, 0x00000000);
7768 static void gen_spr_970_pmu_user(CPUPPCState
*env
)
7770 spr_register(env
, SPR_970_UPMC7
, "UPMC7",
7771 &spr_read_ureg
, SPR_NOACCESS
,
7772 &spr_read_ureg
, &spr_write_ureg
,
7774 spr_register(env
, SPR_970_UPMC8
, "UPMC8",
7775 &spr_read_ureg
, SPR_NOACCESS
,
7776 &spr_read_ureg
, &spr_write_ureg
,
7780 static void gen_spr_power8_pmu_sup(CPUPPCState
*env
)
7782 spr_register_kvm(env
, SPR_POWER_MMCR2
, "MMCR2",
7783 SPR_NOACCESS
, SPR_NOACCESS
,
7784 &spr_read_generic
, &spr_write_generic
,
7785 KVM_REG_PPC_MMCR2
, 0x00000000);
7786 spr_register_kvm(env
, SPR_POWER_MMCRS
, "MMCRS",
7787 SPR_NOACCESS
, SPR_NOACCESS
,
7788 &spr_read_generic
, &spr_write_generic
,
7789 KVM_REG_PPC_MMCRS
, 0x00000000);
7790 spr_register_kvm(env
, SPR_POWER_SIER
, "SIER",
7791 SPR_NOACCESS
, SPR_NOACCESS
,
7792 &spr_read_generic
, &spr_write_generic
,
7793 KVM_REG_PPC_SIER
, 0x00000000);
7794 spr_register_kvm(env
, SPR_POWER_SPMC1
, "SPMC1",
7795 SPR_NOACCESS
, SPR_NOACCESS
,
7796 &spr_read_generic
, &spr_write_generic
,
7797 KVM_REG_PPC_SPMC1
, 0x00000000);
7798 spr_register_kvm(env
, SPR_POWER_SPMC2
, "SPMC2",
7799 SPR_NOACCESS
, SPR_NOACCESS
,
7800 &spr_read_generic
, &spr_write_generic
,
7801 KVM_REG_PPC_SPMC2
, 0x00000000);
7802 spr_register_kvm(env
, SPR_TACR
, "TACR",
7803 SPR_NOACCESS
, SPR_NOACCESS
,
7804 &spr_read_generic
, &spr_write_generic
,
7805 KVM_REG_PPC_TACR
, 0x00000000);
7806 spr_register_kvm(env
, SPR_TCSCR
, "TCSCR",
7807 SPR_NOACCESS
, SPR_NOACCESS
,
7808 &spr_read_generic
, &spr_write_generic
,
7809 KVM_REG_PPC_TCSCR
, 0x00000000);
7810 spr_register_kvm(env
, SPR_CSIGR
, "CSIGR",
7811 SPR_NOACCESS
, SPR_NOACCESS
,
7812 &spr_read_generic
, &spr_write_generic
,
7813 KVM_REG_PPC_CSIGR
, 0x00000000);
7816 static void gen_spr_power8_pmu_user(CPUPPCState
*env
)
7818 spr_register(env
, SPR_POWER_UMMCR2
, "UMMCR2",
7819 &spr_read_ureg
, SPR_NOACCESS
,
7820 &spr_read_ureg
, &spr_write_ureg
,
7822 spr_register(env
, SPR_POWER_USIER
, "USIER",
7823 &spr_read_generic
, SPR_NOACCESS
,
7824 &spr_read_generic
, &spr_write_generic
,
7828 static void gen_spr_power5p_ear(CPUPPCState
*env
)
7830 /* External access control */
7831 spr_register(env
, SPR_EAR
, "EAR",
7832 SPR_NOACCESS
, SPR_NOACCESS
,
7833 &spr_read_generic
, &spr_write_generic
,
7837 #if !defined(CONFIG_USER_ONLY)
7838 static void spr_write_hmer(DisasContext
*ctx
, int sprn
, int gprn
)
7840 TCGv hmer
= tcg_temp_new();
7842 gen_load_spr(hmer
, sprn
);
7843 tcg_gen_and_tl(hmer
, cpu_gpr
[gprn
], hmer
);
7844 gen_store_spr(sprn
, hmer
);
7845 spr_store_dump_spr(sprn
);
7846 tcg_temp_free(hmer
);
7849 static void spr_write_lpcr(DisasContext
*ctx
, int sprn
, int gprn
)
7851 gen_helper_store_lpcr(cpu_env
, cpu_gpr
[gprn
]);
7854 static void spr_write_970_hid4(DisasContext
*ctx
, int sprn
, int gprn
)
7856 #if defined(TARGET_PPC64)
7857 spr_write_generic(ctx
, sprn
, gprn
);
7858 gen_helper_store_lpcr(cpu_env
, cpu_gpr
[gprn
]);
7862 #endif /* !defined(CONFIG_USER_ONLY) */
7864 static void gen_spr_970_lpar(CPUPPCState
*env
)
7866 #if !defined(CONFIG_USER_ONLY)
7867 /* Logical partitionning */
7868 /* PPC970: HID4 is effectively the LPCR */
7869 spr_register(env
, SPR_970_HID4
, "HID4",
7870 SPR_NOACCESS
, SPR_NOACCESS
,
7871 &spr_read_generic
, &spr_write_970_hid4
,
7876 static void gen_spr_power5p_lpar(CPUPPCState
*env
)
7878 #if !defined(CONFIG_USER_ONLY)
7879 /* Logical partitionning */
7880 spr_register_kvm_hv(env
, SPR_LPCR
, "LPCR",
7881 SPR_NOACCESS
, SPR_NOACCESS
,
7882 SPR_NOACCESS
, SPR_NOACCESS
,
7883 &spr_read_generic
, &spr_write_lpcr
,
7884 KVM_REG_PPC_LPCR
, LPCR_LPES0
| LPCR_LPES1
);
7885 spr_register_hv(env
, SPR_HDEC
, "HDEC",
7886 SPR_NOACCESS
, SPR_NOACCESS
,
7887 SPR_NOACCESS
, SPR_NOACCESS
,
7888 &spr_read_hdecr
, &spr_write_hdecr
, 0);
7892 static void gen_spr_book3s_ids(CPUPPCState
*env
)
7894 /* FIXME: Will need to deal with thread vs core only SPRs */
7896 /* Processor identification */
7897 spr_register_hv(env
, SPR_PIR
, "PIR",
7898 SPR_NOACCESS
, SPR_NOACCESS
,
7899 &spr_read_generic
, SPR_NOACCESS
,
7900 &spr_read_generic
, NULL
,
7902 spr_register_hv(env
, SPR_HID0
, "HID0",
7903 SPR_NOACCESS
, SPR_NOACCESS
,
7904 SPR_NOACCESS
, SPR_NOACCESS
,
7905 &spr_read_generic
, &spr_write_generic
,
7907 spr_register_hv(env
, SPR_TSCR
, "TSCR",
7908 SPR_NOACCESS
, SPR_NOACCESS
,
7909 SPR_NOACCESS
, SPR_NOACCESS
,
7910 &spr_read_generic
, &spr_write_generic
,
7912 spr_register_hv(env
, SPR_HMER
, "HMER",
7913 SPR_NOACCESS
, SPR_NOACCESS
,
7914 SPR_NOACCESS
, SPR_NOACCESS
,
7915 &spr_read_generic
, &spr_write_hmer
,
7917 spr_register_hv(env
, SPR_HMEER
, "HMEER",
7918 SPR_NOACCESS
, SPR_NOACCESS
,
7919 SPR_NOACCESS
, SPR_NOACCESS
,
7920 &spr_read_generic
, &spr_write_generic
,
7922 spr_register_hv(env
, SPR_TFMR
, "TFMR",
7923 SPR_NOACCESS
, SPR_NOACCESS
,
7924 SPR_NOACCESS
, SPR_NOACCESS
,
7925 &spr_read_generic
, &spr_write_generic
,
7927 spr_register_hv(env
, SPR_LPIDR
, "LPIDR",
7928 SPR_NOACCESS
, SPR_NOACCESS
,
7929 SPR_NOACCESS
, SPR_NOACCESS
,
7930 &spr_read_generic
, &spr_write_lpidr
,
7932 spr_register_hv(env
, SPR_HFSCR
, "HFSCR",
7933 SPR_NOACCESS
, SPR_NOACCESS
,
7934 SPR_NOACCESS
, SPR_NOACCESS
,
7935 &spr_read_generic
, &spr_write_generic
,
7937 spr_register_hv(env
, SPR_MMCRC
, "MMCRC",
7938 SPR_NOACCESS
, SPR_NOACCESS
,
7939 SPR_NOACCESS
, SPR_NOACCESS
,
7940 &spr_read_generic
, &spr_write_generic
,
7942 spr_register_hv(env
, SPR_MMCRH
, "MMCRH",
7943 SPR_NOACCESS
, SPR_NOACCESS
,
7944 SPR_NOACCESS
, SPR_NOACCESS
,
7945 &spr_read_generic
, &spr_write_generic
,
7947 spr_register_hv(env
, SPR_HSPRG0
, "HSPRG0",
7948 SPR_NOACCESS
, SPR_NOACCESS
,
7949 SPR_NOACCESS
, SPR_NOACCESS
,
7950 &spr_read_generic
, &spr_write_generic
,
7952 spr_register_hv(env
, SPR_HSPRG1
, "HSPRG1",
7953 SPR_NOACCESS
, SPR_NOACCESS
,
7954 SPR_NOACCESS
, SPR_NOACCESS
,
7955 &spr_read_generic
, &spr_write_generic
,
7957 spr_register_hv(env
, SPR_HSRR0
, "HSRR0",
7958 SPR_NOACCESS
, SPR_NOACCESS
,
7959 SPR_NOACCESS
, SPR_NOACCESS
,
7960 &spr_read_generic
, &spr_write_generic
,
7962 spr_register_hv(env
, SPR_HSRR1
, "HSRR1",
7963 SPR_NOACCESS
, SPR_NOACCESS
,
7964 SPR_NOACCESS
, SPR_NOACCESS
,
7965 &spr_read_generic
, &spr_write_generic
,
7967 spr_register_hv(env
, SPR_HDAR
, "HDAR",
7968 SPR_NOACCESS
, SPR_NOACCESS
,
7969 SPR_NOACCESS
, SPR_NOACCESS
,
7970 &spr_read_generic
, &spr_write_generic
,
7972 spr_register_hv(env
, SPR_HDSISR
, "HDSISR",
7973 SPR_NOACCESS
, SPR_NOACCESS
,
7974 SPR_NOACCESS
, SPR_NOACCESS
,
7975 &spr_read_generic
, &spr_write_generic
,
7977 spr_register_hv(env
, SPR_RMOR
, "RMOR",
7978 SPR_NOACCESS
, SPR_NOACCESS
,
7979 SPR_NOACCESS
, SPR_NOACCESS
,
7980 &spr_read_generic
, &spr_write_generic
,
7982 spr_register_hv(env
, SPR_HRMOR
, "HRMOR",
7983 SPR_NOACCESS
, SPR_NOACCESS
,
7984 SPR_NOACCESS
, SPR_NOACCESS
,
7985 &spr_read_generic
, &spr_write_generic
,
7989 static void gen_spr_power8_ids(CPUPPCState
*env
)
7991 /* Thread identification */
7992 spr_register(env
, SPR_TIR
, "TIR",
7993 SPR_NOACCESS
, SPR_NOACCESS
,
7994 &spr_read_generic
, SPR_NOACCESS
,
7998 static void gen_spr_book3s_purr(CPUPPCState
*env
)
8000 #if !defined(CONFIG_USER_ONLY)
8001 /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
8002 spr_register_kvm(env
, SPR_PURR
, "PURR",
8003 &spr_read_purr
, SPR_NOACCESS
,
8004 &spr_read_purr
, SPR_NOACCESS
,
8005 KVM_REG_PPC_PURR
, 0x00000000);
8006 spr_register_kvm(env
, SPR_SPURR
, "SPURR",
8007 &spr_read_purr
, SPR_NOACCESS
,
8008 &spr_read_purr
, SPR_NOACCESS
,
8009 KVM_REG_PPC_SPURR
, 0x00000000);
8013 static void gen_spr_power6_dbg(CPUPPCState
*env
)
8015 #if !defined(CONFIG_USER_ONLY)
8016 spr_register(env
, SPR_CFAR
, "SPR_CFAR",
8017 SPR_NOACCESS
, SPR_NOACCESS
,
8018 &spr_read_cfar
, &spr_write_cfar
,
8023 static void gen_spr_power5p_common(CPUPPCState
*env
)
8025 spr_register_kvm(env
, SPR_PPR
, "PPR",
8026 &spr_read_generic
, &spr_write_generic
,
8027 &spr_read_generic
, &spr_write_generic
,
8028 KVM_REG_PPC_PPR
, 0x00000000);
8031 static void gen_spr_power6_common(CPUPPCState
*env
)
8033 #if !defined(CONFIG_USER_ONLY)
8034 spr_register_kvm(env
, SPR_DSCR
, "SPR_DSCR",
8035 SPR_NOACCESS
, SPR_NOACCESS
,
8036 &spr_read_generic
, &spr_write_generic
,
8037 KVM_REG_PPC_DSCR
, 0x00000000);
8040 * Register PCR to report POWERPC_EXCP_PRIV_REG instead of
8041 * POWERPC_EXCP_INVAL_SPR in userspace. Permit hypervisor access.
8043 spr_register_hv(env
, SPR_PCR
, "PCR",
8044 SPR_NOACCESS
, SPR_NOACCESS
,
8045 SPR_NOACCESS
, SPR_NOACCESS
,
8046 &spr_read_generic
, &spr_write_pcr
,
8050 static void spr_read_tar(DisasContext
*ctx
, int gprn
, int sprn
)
8052 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
8053 spr_read_generic(ctx
, gprn
, sprn
);
8056 static void spr_write_tar(DisasContext
*ctx
, int sprn
, int gprn
)
8058 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
8059 spr_write_generic(ctx
, sprn
, gprn
);
8062 static void gen_spr_power8_tce_address_control(CPUPPCState
*env
)
8064 spr_register_kvm(env
, SPR_TAR
, "TAR",
8065 &spr_read_tar
, &spr_write_tar
,
8066 &spr_read_generic
, &spr_write_generic
,
8067 KVM_REG_PPC_TAR
, 0x00000000);
8070 static void spr_read_tm(DisasContext
*ctx
, int gprn
, int sprn
)
8072 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8073 spr_read_generic(ctx
, gprn
, sprn
);
8076 static void spr_write_tm(DisasContext
*ctx
, int sprn
, int gprn
)
8078 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8079 spr_write_generic(ctx
, sprn
, gprn
);
8082 static void spr_read_tm_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
8084 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8085 spr_read_prev_upper32(ctx
, gprn
, sprn
);
8088 static void spr_write_tm_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
8090 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8091 spr_write_prev_upper32(ctx
, sprn
, gprn
);
8094 static void gen_spr_power8_tm(CPUPPCState
*env
)
8096 spr_register_kvm(env
, SPR_TFHAR
, "TFHAR",
8097 &spr_read_tm
, &spr_write_tm
,
8098 &spr_read_tm
, &spr_write_tm
,
8099 KVM_REG_PPC_TFHAR
, 0x00000000);
8100 spr_register_kvm(env
, SPR_TFIAR
, "TFIAR",
8101 &spr_read_tm
, &spr_write_tm
,
8102 &spr_read_tm
, &spr_write_tm
,
8103 KVM_REG_PPC_TFIAR
, 0x00000000);
8104 spr_register_kvm(env
, SPR_TEXASR
, "TEXASR",
8105 &spr_read_tm
, &spr_write_tm
,
8106 &spr_read_tm
, &spr_write_tm
,
8107 KVM_REG_PPC_TEXASR
, 0x00000000);
8108 spr_register(env
, SPR_TEXASRU
, "TEXASRU",
8109 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
8110 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
8114 static void spr_read_ebb(DisasContext
*ctx
, int gprn
, int sprn
)
8116 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8117 spr_read_generic(ctx
, gprn
, sprn
);
8120 static void spr_write_ebb(DisasContext
*ctx
, int sprn
, int gprn
)
8122 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8123 spr_write_generic(ctx
, sprn
, gprn
);
8126 static void spr_read_ebb_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
8128 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8129 spr_read_prev_upper32(ctx
, gprn
, sprn
);
8132 static void spr_write_ebb_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
8134 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8135 spr_write_prev_upper32(ctx
, sprn
, gprn
);
8138 static void gen_spr_power8_ebb(CPUPPCState
*env
)
8140 spr_register(env
, SPR_BESCRS
, "BESCRS",
8141 &spr_read_ebb
, &spr_write_ebb
,
8142 &spr_read_generic
, &spr_write_generic
,
8144 spr_register(env
, SPR_BESCRSU
, "BESCRSU",
8145 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
8146 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
8148 spr_register(env
, SPR_BESCRR
, "BESCRR",
8149 &spr_read_ebb
, &spr_write_ebb
,
8150 &spr_read_generic
, &spr_write_generic
,
8152 spr_register(env
, SPR_BESCRRU
, "BESCRRU",
8153 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
8154 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
8156 spr_register_kvm(env
, SPR_EBBHR
, "EBBHR",
8157 &spr_read_ebb
, &spr_write_ebb
,
8158 &spr_read_generic
, &spr_write_generic
,
8159 KVM_REG_PPC_EBBHR
, 0x00000000);
8160 spr_register_kvm(env
, SPR_EBBRR
, "EBBRR",
8161 &spr_read_ebb
, &spr_write_ebb
,
8162 &spr_read_generic
, &spr_write_generic
,
8163 KVM_REG_PPC_EBBRR
, 0x00000000);
8164 spr_register_kvm(env
, SPR_BESCR
, "BESCR",
8165 &spr_read_ebb
, &spr_write_ebb
,
8166 &spr_read_generic
, &spr_write_generic
,
8167 KVM_REG_PPC_BESCR
, 0x00000000);
8170 /* Virtual Time Base */
8171 static void gen_spr_vtb(CPUPPCState
*env
)
8173 spr_register_kvm(env
, SPR_VTB
, "VTB",
8174 SPR_NOACCESS
, SPR_NOACCESS
,
8175 &spr_read_tbl
, SPR_NOACCESS
,
8176 KVM_REG_PPC_VTB
, 0x00000000);
8179 static void gen_spr_power8_fscr(CPUPPCState
*env
)
8181 #if defined(CONFIG_USER_ONLY)
8182 target_ulong initval
= 1ULL << FSCR_TAR
;
8184 target_ulong initval
= 0;
8186 spr_register_kvm(env
, SPR_FSCR
, "FSCR",
8187 SPR_NOACCESS
, SPR_NOACCESS
,
8188 &spr_read_generic
, &spr_write_generic
,
8189 KVM_REG_PPC_FSCR
, initval
);
8192 static void gen_spr_power8_pspb(CPUPPCState
*env
)
8194 spr_register_kvm(env
, SPR_PSPB
, "PSPB",
8195 SPR_NOACCESS
, SPR_NOACCESS
,
8196 &spr_read_generic
, &spr_write_generic32
,
8197 KVM_REG_PPC_PSPB
, 0);
8200 static void gen_spr_power8_ic(CPUPPCState
*env
)
8202 #if !defined(CONFIG_USER_ONLY)
8203 spr_register_hv(env
, SPR_IC
, "IC",
8204 SPR_NOACCESS
, SPR_NOACCESS
,
8205 &spr_read_generic
, SPR_NOACCESS
,
8206 &spr_read_generic
, &spr_write_generic
,
8211 static void gen_spr_power8_book4(CPUPPCState
*env
)
8213 /* Add a number of P8 book4 registers */
8214 #if !defined(CONFIG_USER_ONLY)
8215 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
8216 SPR_NOACCESS
, SPR_NOACCESS
,
8217 &spr_read_generic
, &spr_write_generic
,
8218 KVM_REG_PPC_ACOP
, 0);
8219 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
8220 SPR_NOACCESS
, SPR_NOACCESS
,
8221 &spr_read_generic
, &spr_write_pidr
,
8222 KVM_REG_PPC_PID
, 0);
8223 spr_register_kvm(env
, SPR_WORT
, "WORT",
8224 SPR_NOACCESS
, SPR_NOACCESS
,
8225 &spr_read_generic
, &spr_write_generic
,
8226 KVM_REG_PPC_WORT
, 0);
8230 static void gen_spr_power7_book4(CPUPPCState
*env
)
8232 /* Add a number of P7 book4 registers */
8233 #if !defined(CONFIG_USER_ONLY)
8234 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
8235 SPR_NOACCESS
, SPR_NOACCESS
,
8236 &spr_read_generic
, &spr_write_generic
,
8237 KVM_REG_PPC_ACOP
, 0);
8238 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
8239 SPR_NOACCESS
, SPR_NOACCESS
,
8240 &spr_read_generic
, &spr_write_generic
,
8241 KVM_REG_PPC_PID
, 0);
8245 static void gen_spr_power8_rpr(CPUPPCState
*env
)
8247 #if !defined(CONFIG_USER_ONLY)
8248 spr_register_hv(env
, SPR_RPR
, "RPR",
8249 SPR_NOACCESS
, SPR_NOACCESS
,
8250 SPR_NOACCESS
, SPR_NOACCESS
,
8251 &spr_read_generic
, &spr_write_generic
,
8252 0x00000103070F1F3F);
8256 static void gen_spr_power9_mmu(CPUPPCState
*env
)
8258 #if !defined(CONFIG_USER_ONLY)
8259 /* Partition Table Control */
8260 spr_register_kvm_hv(env
, SPR_PTCR
, "PTCR",
8261 SPR_NOACCESS
, SPR_NOACCESS
,
8262 SPR_NOACCESS
, SPR_NOACCESS
,
8263 &spr_read_generic
, &spr_write_ptcr
,
8264 KVM_REG_PPC_PTCR
, 0x00000000);
8268 static void init_proc_book3s_common(CPUPPCState
*env
)
8270 gen_spr_ne_601(env
);
8272 gen_spr_usprg3(env
);
8273 gen_spr_book3s_altivec(env
);
8274 gen_spr_book3s_pmu_sup(env
);
8275 gen_spr_book3s_pmu_user(env
);
8276 gen_spr_book3s_ctrl(env
);
8279 static void init_proc_970(CPUPPCState
*env
)
8281 /* Common Registers */
8282 init_proc_book3s_common(env
);
8284 gen_spr_book3s_dbg(env
);
8286 /* 970 Specific Registers */
8287 gen_spr_970_hid(env
);
8288 gen_spr_970_hior(env
);
8290 gen_spr_970_pmu_sup(env
);
8291 gen_spr_970_pmu_user(env
);
8292 gen_spr_970_lpar(env
);
8293 gen_spr_970_dbg(env
);
8296 env
->dcache_line_size
= 128;
8297 env
->icache_line_size
= 128;
8299 /* Allocate hardware IRQ controller */
8301 ppc970_irq_init(ppc_env_get_cpu(env
));
8304 POWERPC_FAMILY(970)(ObjectClass
*oc
, void *data
)
8306 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8307 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8309 dc
->desc
= "PowerPC 970";
8310 pcc
->init_proc
= init_proc_970
;
8311 pcc
->check_pow
= check_pow_970
;
8312 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8313 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8314 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8316 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8317 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8318 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8319 PPC_64B
| PPC_ALTIVEC
|
8320 PPC_SEGMENT_64B
| PPC_SLBI
;
8321 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8322 pcc
->msr_mask
= (1ull << MSR_SF
) |
8337 pcc
->mmu_model
= POWERPC_MMU_64B
;
8338 #if defined(CONFIG_SOFTMMU)
8339 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8340 pcc
->hash64_opts
= &ppc_hash64_opts_basic
;
8342 pcc
->excp_model
= POWERPC_EXCP_970
;
8343 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8344 pcc
->bfd_mach
= bfd_mach_ppc64
;
8345 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8346 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8347 POWERPC_FLAG_BUS_CLK
;
8348 pcc
->l1_dcache_size
= 0x8000;
8349 pcc
->l1_icache_size
= 0x10000;
8352 static void init_proc_power5plus(CPUPPCState
*env
)
8354 /* Common Registers */
8355 init_proc_book3s_common(env
);
8357 gen_spr_book3s_dbg(env
);
8359 /* POWER5+ Specific Registers */
8360 gen_spr_970_hid(env
);
8361 gen_spr_970_hior(env
);
8363 gen_spr_970_pmu_sup(env
);
8364 gen_spr_970_pmu_user(env
);
8365 gen_spr_power5p_common(env
);
8366 gen_spr_power5p_lpar(env
);
8367 gen_spr_power5p_ear(env
);
8370 env
->dcache_line_size
= 128;
8371 env
->icache_line_size
= 128;
8373 /* Allocate hardware IRQ controller */
8375 ppc970_irq_init(ppc_env_get_cpu(env
));
8378 POWERPC_FAMILY(POWER5P
)(ObjectClass
*oc
, void *data
)
8380 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8381 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8383 dc
->fw_name
= "PowerPC,POWER5";
8384 dc
->desc
= "POWER5+";
8385 pcc
->init_proc
= init_proc_power5plus
;
8386 pcc
->check_pow
= check_pow_970
;
8387 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8388 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8389 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8391 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8392 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8393 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8395 PPC_SEGMENT_64B
| PPC_SLBI
;
8396 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8397 pcc
->msr_mask
= (1ull << MSR_SF
) |
8412 pcc
->mmu_model
= POWERPC_MMU_2_03
;
8413 #if defined(CONFIG_SOFTMMU)
8414 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8415 pcc
->hash64_opts
= &ppc_hash64_opts_basic
;
8416 pcc
->lrg_decr_bits
= 32;
8418 pcc
->excp_model
= POWERPC_EXCP_970
;
8419 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8420 pcc
->bfd_mach
= bfd_mach_ppc64
;
8421 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8422 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8423 POWERPC_FLAG_BUS_CLK
;
8424 pcc
->l1_dcache_size
= 0x8000;
8425 pcc
->l1_icache_size
= 0x10000;
8429 * The CPU used to have a "compat" property which set the
8430 * compatibility mode PVR. However, this was conceptually broken - it
8431 * only makes sense on the pseries machine type (otherwise the guest
8432 * owns the PCR and can control the compatibility mode itself). It's
8433 * been replaced with the 'max-cpu-compat' property on the pseries
8434 * machine type. For backwards compatibility, pseries specially
8435 * parses the -cpu parameter and converts old compat= parameters into
8436 * the appropriate machine parameters. This stub implementation of
8437 * the parameter catches any uses on explicitly created CPUs.
8439 static void getset_compat_deprecated(Object
*obj
, Visitor
*v
, const char *name
,
8440 void *opaque
, Error
**errp
)
8444 if (!qtest_enabled()) {
8445 warn_report("CPU 'compat' property is deprecated and has no effect; "
8446 "use max-cpu-compat machine property instead");
8448 visit_type_null(v
, name
, &null
, NULL
);
8449 qobject_unref(null
);
8452 static const PropertyInfo ppc_compat_deprecated_propinfo
= {
8454 .description
= "compatibility mode (deprecated)",
8455 .get
= getset_compat_deprecated
,
8456 .set
= getset_compat_deprecated
,
8458 static Property powerpc_servercpu_properties
[] = {
8461 .info
= &ppc_compat_deprecated_propinfo
,
8463 DEFINE_PROP_END_OF_LIST(),
8466 static void init_proc_POWER7(CPUPPCState
*env
)
8468 /* Common Registers */
8469 init_proc_book3s_common(env
);
8471 gen_spr_book3s_dbg(env
);
8473 /* POWER7 Specific Registers */
8474 gen_spr_book3s_ids(env
);
8476 gen_spr_book3s_purr(env
);
8477 gen_spr_power5p_common(env
);
8478 gen_spr_power5p_lpar(env
);
8479 gen_spr_power5p_ear(env
);
8480 gen_spr_power6_common(env
);
8481 gen_spr_power6_dbg(env
);
8482 gen_spr_power7_book4(env
);
8485 env
->dcache_line_size
= 128;
8486 env
->icache_line_size
= 128;
8488 /* Allocate hardware IRQ controller */
8489 init_excp_POWER7(env
);
8490 ppcPOWER7_irq_init(ppc_env_get_cpu(env
));
8493 static bool ppc_pvr_match_power7(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8495 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7P_BASE
) {
8498 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7_BASE
) {
8504 static bool cpu_has_work_POWER7(CPUState
*cs
)
8506 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
8507 CPUPPCState
*env
= &cpu
->env
;
8510 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
8513 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
8514 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE0
)) {
8517 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
8518 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE1
)) {
8521 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
)) &&
8522 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE2
)) {
8525 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HMI
)) &&
8526 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE2
)) {
8529 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
8534 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
8538 POWERPC_FAMILY(POWER7
)(ObjectClass
*oc
, void *data
)
8540 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8541 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8542 CPUClass
*cc
= CPU_CLASS(oc
);
8544 dc
->fw_name
= "PowerPC,POWER7";
8545 dc
->desc
= "POWER7";
8546 dc
->props
= powerpc_servercpu_properties
;
8547 pcc
->pvr_match
= ppc_pvr_match_power7
;
8548 pcc
->pcr_mask
= PCR_VEC_DIS
| PCR_VSX_DIS
| PCR_COMPAT_2_05
;
8549 pcc
->pcr_supported
= PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8550 pcc
->init_proc
= init_proc_POWER7
;
8551 pcc
->check_pow
= check_pow_nocheck
;
8552 cc
->has_work
= cpu_has_work_POWER7
;
8553 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8554 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8555 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8556 PPC_FLOAT_FRSQRTES
|
8559 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8560 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8561 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8562 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
8563 PPC_SEGMENT_64B
| PPC_SLBI
|
8564 PPC_POPCNTB
| PPC_POPCNTWD
|
8566 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
8567 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8568 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8569 PPC2_FP_TST_ISA206
| PPC2_FP_CVT_S64
|
8571 pcc
->msr_mask
= (1ull << MSR_SF
) |
8587 pcc
->mmu_model
= POWERPC_MMU_2_06
;
8588 #if defined(CONFIG_SOFTMMU)
8589 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8590 pcc
->hash64_opts
= &ppc_hash64_opts_POWER7
;
8591 pcc
->lrg_decr_bits
= 32;
8593 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
8594 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8595 pcc
->bfd_mach
= bfd_mach_ppc64
;
8596 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8597 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8598 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8600 pcc
->l1_dcache_size
= 0x8000;
8601 pcc
->l1_icache_size
= 0x8000;
8602 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8603 pcc
->lpcr_pm
= LPCR_P7_PECE0
| LPCR_P7_PECE1
| LPCR_P7_PECE2
;
8606 static void init_proc_POWER8(CPUPPCState
*env
)
8608 /* Common Registers */
8609 init_proc_book3s_common(env
);
8611 gen_spr_book3s_207_dbg(env
);
8613 /* POWER8 Specific Registers */
8614 gen_spr_book3s_ids(env
);
8617 gen_spr_book3s_purr(env
);
8618 gen_spr_power5p_common(env
);
8619 gen_spr_power5p_lpar(env
);
8620 gen_spr_power5p_ear(env
);
8621 gen_spr_power6_common(env
);
8622 gen_spr_power6_dbg(env
);
8623 gen_spr_power8_tce_address_control(env
);
8624 gen_spr_power8_ids(env
);
8625 gen_spr_power8_ebb(env
);
8626 gen_spr_power8_fscr(env
);
8627 gen_spr_power8_pmu_sup(env
);
8628 gen_spr_power8_pmu_user(env
);
8629 gen_spr_power8_tm(env
);
8630 gen_spr_power8_pspb(env
);
8632 gen_spr_power8_ic(env
);
8633 gen_spr_power8_book4(env
);
8634 gen_spr_power8_rpr(env
);
8637 env
->dcache_line_size
= 128;
8638 env
->icache_line_size
= 128;
8640 /* Allocate hardware IRQ controller */
8641 init_excp_POWER8(env
);
8642 ppcPOWER7_irq_init(ppc_env_get_cpu(env
));
8645 static bool ppc_pvr_match_power8(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8647 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8NVL_BASE
) {
8650 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8E_BASE
) {
8653 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8_BASE
) {
8659 static bool cpu_has_work_POWER8(CPUState
*cs
)
8661 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
8662 CPUPPCState
*env
= &cpu
->env
;
8665 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
8668 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
8669 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE2
)) {
8672 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
8673 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE3
)) {
8676 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
)) &&
8677 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE4
)) {
8680 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HMI
)) &&
8681 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE4
)) {
8684 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DOORBELL
)) &&
8685 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE0
)) {
8688 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HDOORBELL
)) &&
8689 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE1
)) {
8692 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
8697 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
8701 POWERPC_FAMILY(POWER8
)(ObjectClass
*oc
, void *data
)
8703 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8704 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8705 CPUClass
*cc
= CPU_CLASS(oc
);
8707 dc
->fw_name
= "PowerPC,POWER8";
8708 dc
->desc
= "POWER8";
8709 dc
->props
= powerpc_servercpu_properties
;
8710 pcc
->pvr_match
= ppc_pvr_match_power8
;
8711 pcc
->pcr_mask
= PCR_TM_DIS
| PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8712 pcc
->pcr_supported
= PCR_COMPAT_2_07
| PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8713 pcc
->init_proc
= init_proc_POWER8
;
8714 pcc
->check_pow
= check_pow_nocheck
;
8715 cc
->has_work
= cpu_has_work_POWER8
;
8716 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8717 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8718 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8719 PPC_FLOAT_FRSQRTES
|
8722 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8723 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8724 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8725 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
8726 PPC_SEGMENT_64B
| PPC_SLBI
|
8727 PPC_POPCNTB
| PPC_POPCNTWD
|
8729 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
8730 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8731 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8732 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
8733 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
8734 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
8735 PPC2_TM
| PPC2_PM_ISA206
;
8736 pcc
->msr_mask
= (1ull << MSR_SF
) |
8756 pcc
->mmu_model
= POWERPC_MMU_2_07
;
8757 #if defined(CONFIG_SOFTMMU)
8758 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8759 pcc
->hash64_opts
= &ppc_hash64_opts_POWER7
;
8760 pcc
->lrg_decr_bits
= 32;
8762 pcc
->excp_model
= POWERPC_EXCP_POWER8
;
8763 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8764 pcc
->bfd_mach
= bfd_mach_ppc64
;
8765 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8766 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8767 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8768 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
;
8769 pcc
->l1_dcache_size
= 0x8000;
8770 pcc
->l1_icache_size
= 0x8000;
8771 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8772 pcc
->lpcr_pm
= LPCR_P8_PECE0
| LPCR_P8_PECE1
| LPCR_P8_PECE2
|
8773 LPCR_P8_PECE3
| LPCR_P8_PECE4
;
8776 #ifdef CONFIG_SOFTMMU
8778 * Radix pg sizes and AP encodings for dt node ibm,processor-radix-AP-encodings
8779 * Encoded as array of int_32s in the form:
8780 * 0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
8782 * y -> radix mode supported page size (encoded as a shift)
8784 static struct ppc_radix_page_info POWER9_radix_page_info
= {
8787 0x0000000c, /* 4K - enc: 0x0 */
8788 0xa0000010, /* 64K - enc: 0x5 */
8789 0x20000015, /* 2M - enc: 0x1 */
8790 0x4000001e /* 1G - enc: 0x2 */
8793 #endif /* CONFIG_SOFTMMU */
8795 static void init_proc_POWER9(CPUPPCState
*env
)
8797 /* Common Registers */
8798 init_proc_book3s_common(env
);
8799 gen_spr_book3s_207_dbg(env
);
8801 /* POWER8 Specific Registers */
8802 gen_spr_book3s_ids(env
);
8805 gen_spr_book3s_purr(env
);
8806 gen_spr_power5p_common(env
);
8807 gen_spr_power5p_lpar(env
);
8808 gen_spr_power5p_ear(env
);
8809 gen_spr_power6_common(env
);
8810 gen_spr_power6_dbg(env
);
8811 gen_spr_power8_tce_address_control(env
);
8812 gen_spr_power8_ids(env
);
8813 gen_spr_power8_ebb(env
);
8814 gen_spr_power8_fscr(env
);
8815 gen_spr_power8_pmu_sup(env
);
8816 gen_spr_power8_pmu_user(env
);
8817 gen_spr_power8_tm(env
);
8818 gen_spr_power8_pspb(env
);
8820 gen_spr_power8_ic(env
);
8821 gen_spr_power8_book4(env
);
8822 gen_spr_power8_rpr(env
);
8823 gen_spr_power9_mmu(env
);
8825 /* POWER9 Specific registers */
8826 spr_register_kvm(env
, SPR_TIDR
, "TIDR", NULL
, NULL
,
8827 spr_read_generic
, spr_write_generic
,
8828 KVM_REG_PPC_TIDR
, 0);
8830 /* FIXME: Filter fields properly based on privilege level */
8831 spr_register_kvm_hv(env
, SPR_PSSCR
, "PSSCR", NULL
, NULL
, NULL
, NULL
,
8832 spr_read_generic
, spr_write_generic
,
8833 KVM_REG_PPC_PSSCR
, 0);
8836 env
->dcache_line_size
= 128;
8837 env
->icache_line_size
= 128;
8839 /* Allocate hardware IRQ controller */
8840 init_excp_POWER9(env
);
8841 ppcPOWER9_irq_init(ppc_env_get_cpu(env
));
8844 static bool ppc_pvr_match_power9(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8846 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER9_BASE
) {
8852 static bool cpu_has_work_POWER9(CPUState
*cs
)
8854 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
8855 CPUPPCState
*env
= &cpu
->env
;
8858 uint64_t psscr
= env
->spr
[SPR_PSSCR
];
8860 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
8864 /* If EC is clear, just return true on any pending interrupt */
8865 if (!(psscr
& PSSCR_EC
)) {
8868 /* External Exception */
8869 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
8870 (env
->spr
[SPR_LPCR
] & LPCR_EEE
)) {
8871 bool heic
= !!(env
->spr
[SPR_LPCR
] & LPCR_HEIC
);
8872 if (heic
== 0 || !msr_hv
|| msr_pr
) {
8876 /* Decrementer Exception */
8877 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
8878 (env
->spr
[SPR_LPCR
] & LPCR_DEE
)) {
8881 /* Machine Check or Hypervisor Maintenance Exception */
8882 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
|
8883 1u << PPC_INTERRUPT_HMI
)) && (env
->spr
[SPR_LPCR
] & LPCR_OEE
)) {
8886 /* Privileged Doorbell Exception */
8887 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DOORBELL
)) &&
8888 (env
->spr
[SPR_LPCR
] & LPCR_PDEE
)) {
8891 /* Hypervisor Doorbell Exception */
8892 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HDOORBELL
)) &&
8893 (env
->spr
[SPR_LPCR
] & LPCR_HDEE
)) {
8896 /* Hypervisor virtualization exception */
8897 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HVIRT
)) &&
8898 (env
->spr
[SPR_LPCR
] & LPCR_HVEE
)) {
8901 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
8906 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
8910 POWERPC_FAMILY(POWER9
)(ObjectClass
*oc
, void *data
)
8912 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8913 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8914 CPUClass
*cc
= CPU_CLASS(oc
);
8916 dc
->fw_name
= "PowerPC,POWER9";
8917 dc
->desc
= "POWER9";
8918 dc
->props
= powerpc_servercpu_properties
;
8919 pcc
->pvr_match
= ppc_pvr_match_power9
;
8920 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
| PCR_COMPAT_2_07
;
8921 pcc
->pcr_supported
= PCR_COMPAT_3_00
| PCR_COMPAT_2_07
| PCR_COMPAT_2_06
|
8923 pcc
->init_proc
= init_proc_POWER9
;
8924 pcc
->check_pow
= check_pow_nocheck
;
8925 cc
->has_work
= cpu_has_work_POWER9
;
8926 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8927 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8928 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8929 PPC_FLOAT_FRSQRTES
|
8932 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8933 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8935 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
8936 PPC_SEGMENT_64B
| PPC_SLBI
|
8937 PPC_POPCNTB
| PPC_POPCNTWD
|
8939 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
8940 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8941 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8942 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
8943 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
8944 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
8945 PPC2_TM
| PPC2_ISA300
| PPC2_PRCNTL
;
8946 pcc
->msr_mask
= (1ull << MSR_SF
) |
8964 pcc
->mmu_model
= POWERPC_MMU_3_00
;
8965 #if defined(CONFIG_SOFTMMU)
8966 pcc
->handle_mmu_fault
= ppc64_v3_handle_mmu_fault
;
8967 /* segment page size remain the same */
8968 pcc
->hash64_opts
= &ppc_hash64_opts_POWER7
;
8969 pcc
->radix_page_info
= &POWER9_radix_page_info
;
8970 pcc
->lrg_decr_bits
= 56;
8972 pcc
->excp_model
= POWERPC_EXCP_POWER9
;
8973 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER9
;
8974 pcc
->bfd_mach
= bfd_mach_ppc64
;
8975 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8976 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8977 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8978 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
;
8979 pcc
->l1_dcache_size
= 0x8000;
8980 pcc
->l1_icache_size
= 0x8000;
8981 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8982 pcc
->lpcr_pm
= LPCR_PDEE
| LPCR_HDEE
| LPCR_EEE
| LPCR_DEE
| LPCR_OEE
;
8985 #if !defined(CONFIG_USER_ONLY)
8986 void cpu_ppc_set_vhyp(PowerPCCPU
*cpu
, PPCVirtualHypervisor
*vhyp
)
8988 CPUPPCState
*env
= &cpu
->env
;
8993 * With a virtual hypervisor mode we never allow the CPU to go
8994 * hypervisor mode itself
8996 env
->msr_mask
&= ~MSR_HVB
;
8999 #endif /* !defined(CONFIG_USER_ONLY) */
9001 #endif /* defined(TARGET_PPC64) */
9003 /*****************************************************************************/
9004 /* Generic CPU instantiation routine */
9005 static void init_ppc_proc(PowerPCCPU
*cpu
)
9007 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9008 CPUPPCState
*env
= &cpu
->env
;
9009 #if !defined(CONFIG_USER_ONLY)
9012 env
->irq_inputs
= NULL
;
9013 /* Set all exception vectors to an invalid address */
9014 for (i
= 0; i
< POWERPC_EXCP_NB
; i
++) {
9015 env
->excp_vectors
[i
] = (target_ulong
)(-1ULL);
9017 env
->ivor_mask
= 0x00000000;
9018 env
->ivpr_mask
= 0x00000000;
9019 /* Default MMU definitions */
9023 env
->tlb_type
= TLB_NONE
;
9025 /* Register SPR common to all PowerPC implementations */
9026 gen_spr_generic(env
);
9027 spr_register(env
, SPR_PVR
, "PVR",
9028 /* Linux permits userspace to read PVR */
9029 #if defined(CONFIG_LINUX_USER)
9035 &spr_read_generic
, SPR_NOACCESS
,
9037 /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
9038 if (pcc
->svr
!= POWERPC_SVR_NONE
) {
9039 if (pcc
->svr
& POWERPC_SVR_E500
) {
9040 spr_register(env
, SPR_E500_SVR
, "SVR",
9041 SPR_NOACCESS
, SPR_NOACCESS
,
9042 &spr_read_generic
, SPR_NOACCESS
,
9043 pcc
->svr
& ~POWERPC_SVR_E500
);
9045 spr_register(env
, SPR_SVR
, "SVR",
9046 SPR_NOACCESS
, SPR_NOACCESS
,
9047 &spr_read_generic
, SPR_NOACCESS
,
9051 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
9052 (*pcc
->init_proc
)(env
);
9054 #if !defined(CONFIG_USER_ONLY)
9055 ppc_gdb_gen_spr_xml(cpu
);
9058 /* MSR bits & flags consistency checks */
9059 if (env
->msr_mask
& (1 << 25)) {
9060 switch (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
9061 case POWERPC_FLAG_SPE
:
9062 case POWERPC_FLAG_VRE
:
9065 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9066 "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
9069 } else if (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
9070 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9071 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
9074 if (env
->msr_mask
& (1 << 17)) {
9075 switch (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
9076 case POWERPC_FLAG_TGPR
:
9077 case POWERPC_FLAG_CE
:
9080 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9081 "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
9084 } else if (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
9085 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9086 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
9089 if (env
->msr_mask
& (1 << 10)) {
9090 switch (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
9091 POWERPC_FLAG_UBLE
)) {
9092 case POWERPC_FLAG_SE
:
9093 case POWERPC_FLAG_DWE
:
9094 case POWERPC_FLAG_UBLE
:
9097 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9098 "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
9099 "POWERPC_FLAG_UBLE\n");
9102 } else if (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
9103 POWERPC_FLAG_UBLE
)) {
9104 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9105 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
9106 "POWERPC_FLAG_UBLE\n");
9109 if (env
->msr_mask
& (1 << 9)) {
9110 switch (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
9111 case POWERPC_FLAG_BE
:
9112 case POWERPC_FLAG_DE
:
9115 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9116 "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
9119 } else if (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
9120 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9121 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
9124 if (env
->msr_mask
& (1 << 2)) {
9125 switch (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
9126 case POWERPC_FLAG_PX
:
9127 case POWERPC_FLAG_PMM
:
9130 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9131 "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
9134 } else if (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
9135 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9136 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
9139 if ((env
->flags
& (POWERPC_FLAG_RTC_CLK
| POWERPC_FLAG_BUS_CLK
)) == 0) {
9140 fprintf(stderr
, "PowerPC flags inconsistency\n"
9141 "Should define the time-base and decrementer clock source\n");
9144 /* Allocate TLBs buffer when needed */
9145 #if !defined(CONFIG_USER_ONLY)
9146 if (env
->nb_tlb
!= 0) {
9147 int nb_tlb
= env
->nb_tlb
;
9148 if (env
->id_tlbs
!= 0) {
9151 switch (env
->tlb_type
) {
9153 env
->tlb
.tlb6
= g_new0(ppc6xx_tlb_t
, nb_tlb
);
9156 env
->tlb
.tlbe
= g_new0(ppcemb_tlb_t
, nb_tlb
);
9159 env
->tlb
.tlbm
= g_new0(ppcmas_tlb_t
, nb_tlb
);
9162 /* Pre-compute some useful values */
9163 env
->tlb_per_way
= env
->nb_tlb
/ env
->nb_ways
;
9165 if (env
->irq_inputs
== NULL
) {
9166 warn_report("no internal IRQ controller registered."
9167 " Attempt QEMU to crash very soon !");
9170 if (env
->check_pow
== NULL
) {
9171 warn_report("no power management check handler registered."
9172 " Attempt QEMU to crash very soon !");
9176 #if defined(PPC_DUMP_CPU)
9177 static void dump_ppc_sprs(CPUPPCState
*env
)
9180 #if !defined(CONFIG_USER_ONLY)
9186 printf("Special purpose registers:\n");
9187 for (i
= 0; i
< 32; i
++) {
9188 for (j
= 0; j
< 32; j
++) {
9190 spr
= &env
->spr_cb
[n
];
9191 uw
= spr
->uea_write
!= NULL
&& spr
->uea_write
!= SPR_NOACCESS
;
9192 ur
= spr
->uea_read
!= NULL
&& spr
->uea_read
!= SPR_NOACCESS
;
9193 #if !defined(CONFIG_USER_ONLY)
9194 sw
= spr
->oea_write
!= NULL
&& spr
->oea_write
!= SPR_NOACCESS
;
9195 sr
= spr
->oea_read
!= NULL
&& spr
->oea_read
!= SPR_NOACCESS
;
9196 if (sw
|| sr
|| uw
|| ur
) {
9197 printf("SPR: %4d (%03x) %-8s s%c%c u%c%c\n",
9198 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
9199 sw
? 'w' : '-', sr
? 'r' : '-',
9200 uw
? 'w' : '-', ur
? 'r' : '-');
9204 printf("SPR: %4d (%03x) %-8s u%c%c\n",
9205 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
9206 uw
? 'w' : '-', ur
? 'r' : '-');
9216 /*****************************************************************************/
9220 PPC_DIRECT
= 0, /* Opcode routine */
9221 PPC_INDIRECT
= 1, /* Indirect opcode table */
9224 #define PPC_OPCODE_MASK 0x3
9226 static inline int is_indirect_opcode(void *handler
)
9228 return ((uintptr_t)handler
& PPC_OPCODE_MASK
) == PPC_INDIRECT
;
9231 static inline opc_handler_t
**ind_table(void *handler
)
9233 return (opc_handler_t
**)((uintptr_t)handler
& ~PPC_OPCODE_MASK
);
9236 /* Instruction table creation */
9237 /* Opcodes tables creation */
9238 static void fill_new_table(opc_handler_t
**table
, int len
)
9242 for (i
= 0; i
< len
; i
++) {
9243 table
[i
] = &invalid_handler
;
9247 static int create_new_table(opc_handler_t
**table
, unsigned char idx
)
9249 opc_handler_t
**tmp
;
9251 tmp
= g_new(opc_handler_t
*, PPC_CPU_INDIRECT_OPCODES_LEN
);
9252 fill_new_table(tmp
, PPC_CPU_INDIRECT_OPCODES_LEN
);
9253 table
[idx
] = (opc_handler_t
*)((uintptr_t)tmp
| PPC_INDIRECT
);
9258 static int insert_in_table(opc_handler_t
**table
, unsigned char idx
,
9259 opc_handler_t
*handler
)
9261 if (table
[idx
] != &invalid_handler
) {
9264 table
[idx
] = handler
;
9269 static int register_direct_insn(opc_handler_t
**ppc_opcodes
,
9270 unsigned char idx
, opc_handler_t
*handler
)
9272 if (insert_in_table(ppc_opcodes
, idx
, handler
) < 0) {
9273 printf("*** ERROR: opcode %02x already assigned in main "
9274 "opcode table\n", idx
);
9275 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9276 printf(" Registered handler '%s' - new handler '%s'\n",
9277 ppc_opcodes
[idx
]->oname
, handler
->oname
);
9285 static int register_ind_in_table(opc_handler_t
**table
,
9286 unsigned char idx1
, unsigned char idx2
,
9287 opc_handler_t
*handler
)
9289 if (table
[idx1
] == &invalid_handler
) {
9290 if (create_new_table(table
, idx1
) < 0) {
9291 printf("*** ERROR: unable to create indirect table "
9292 "idx=%02x\n", idx1
);
9296 if (!is_indirect_opcode(table
[idx1
])) {
9297 printf("*** ERROR: idx %02x already assigned to a direct "
9299 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9300 printf(" Registered handler '%s' - new handler '%s'\n",
9301 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
9306 if (handler
!= NULL
&&
9307 insert_in_table(ind_table(table
[idx1
]), idx2
, handler
) < 0) {
9308 printf("*** ERROR: opcode %02x already assigned in "
9309 "opcode table %02x\n", idx2
, idx1
);
9310 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9311 printf(" Registered handler '%s' - new handler '%s'\n",
9312 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
9320 static int register_ind_insn(opc_handler_t
**ppc_opcodes
,
9321 unsigned char idx1
, unsigned char idx2
,
9322 opc_handler_t
*handler
)
9324 return register_ind_in_table(ppc_opcodes
, idx1
, idx2
, handler
);
9327 static int register_dblind_insn(opc_handler_t
**ppc_opcodes
,
9328 unsigned char idx1
, unsigned char idx2
,
9329 unsigned char idx3
, opc_handler_t
*handler
)
9331 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
9332 printf("*** ERROR: unable to join indirect table idx "
9333 "[%02x-%02x]\n", idx1
, idx2
);
9336 if (register_ind_in_table(ind_table(ppc_opcodes
[idx1
]), idx2
, idx3
,
9338 printf("*** ERROR: unable to insert opcode "
9339 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
9346 static int register_trplind_insn(opc_handler_t
**ppc_opcodes
,
9347 unsigned char idx1
, unsigned char idx2
,
9348 unsigned char idx3
, unsigned char idx4
,
9349 opc_handler_t
*handler
)
9351 opc_handler_t
**table
;
9353 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
9354 printf("*** ERROR: unable to join indirect table idx "
9355 "[%02x-%02x]\n", idx1
, idx2
);
9358 table
= ind_table(ppc_opcodes
[idx1
]);
9359 if (register_ind_in_table(table
, idx2
, idx3
, NULL
) < 0) {
9360 printf("*** ERROR: unable to join 2nd-level indirect table idx "
9361 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
9364 table
= ind_table(table
[idx2
]);
9365 if (register_ind_in_table(table
, idx3
, idx4
, handler
) < 0) {
9366 printf("*** ERROR: unable to insert opcode "
9367 "[%02x-%02x-%02x-%02x]\n", idx1
, idx2
, idx3
, idx4
);
9372 static int register_insn(opc_handler_t
**ppc_opcodes
, opcode_t
*insn
)
9374 if (insn
->opc2
!= 0xFF) {
9375 if (insn
->opc3
!= 0xFF) {
9376 if (insn
->opc4
!= 0xFF) {
9377 if (register_trplind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
9378 insn
->opc3
, insn
->opc4
,
9379 &insn
->handler
) < 0) {
9383 if (register_dblind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
9384 insn
->opc3
, &insn
->handler
) < 0) {
9389 if (register_ind_insn(ppc_opcodes
, insn
->opc1
,
9390 insn
->opc2
, &insn
->handler
) < 0) {
9395 if (register_direct_insn(ppc_opcodes
, insn
->opc1
, &insn
->handler
) < 0) {
9403 static int test_opcode_table(opc_handler_t
**table
, int len
)
9407 for (i
= 0, count
= 0; i
< len
; i
++) {
9408 /* Consistency fixup */
9409 if (table
[i
] == NULL
) {
9410 table
[i
] = &invalid_handler
;
9412 if (table
[i
] != &invalid_handler
) {
9413 if (is_indirect_opcode(table
[i
])) {
9414 tmp
= test_opcode_table(ind_table(table
[i
]),
9415 PPC_CPU_INDIRECT_OPCODES_LEN
);
9418 table
[i
] = &invalid_handler
;
9431 static void fix_opcode_tables(opc_handler_t
**ppc_opcodes
)
9433 if (test_opcode_table(ppc_opcodes
, PPC_CPU_OPCODES_LEN
) == 0) {
9434 printf("*** WARNING: no opcode defined !\n");
9438 /*****************************************************************************/
9439 static void create_ppc_opcodes(PowerPCCPU
*cpu
, Error
**errp
)
9441 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9442 CPUPPCState
*env
= &cpu
->env
;
9445 fill_new_table(env
->opcodes
, PPC_CPU_OPCODES_LEN
);
9446 for (opc
= opcodes
; opc
< &opcodes
[ARRAY_SIZE(opcodes
)]; opc
++) {
9447 if (((opc
->handler
.type
& pcc
->insns_flags
) != 0) ||
9448 ((opc
->handler
.type2
& pcc
->insns_flags2
) != 0)) {
9449 if (register_insn(env
->opcodes
, opc
) < 0) {
9450 error_setg(errp
, "ERROR initializing PowerPC instruction "
9451 "0x%02x 0x%02x 0x%02x", opc
->opc1
, opc
->opc2
,
9457 fix_opcode_tables(env
->opcodes
);
9462 #if defined(PPC_DUMP_CPU)
9463 static void dump_ppc_insns(CPUPPCState
*env
)
9465 opc_handler_t
**table
, *handler
;
9467 uint8_t opc1
, opc2
, opc3
, opc4
;
9469 printf("Instructions set:\n");
9470 /* opc1 is 6 bits long */
9471 for (opc1
= 0x00; opc1
< PPC_CPU_OPCODES_LEN
; opc1
++) {
9472 table
= env
->opcodes
;
9473 handler
= table
[opc1
];
9474 if (is_indirect_opcode(handler
)) {
9475 /* opc2 is 5 bits long */
9476 for (opc2
= 0; opc2
< PPC_CPU_INDIRECT_OPCODES_LEN
; opc2
++) {
9477 table
= env
->opcodes
;
9478 handler
= env
->opcodes
[opc1
];
9479 table
= ind_table(handler
);
9480 handler
= table
[opc2
];
9481 if (is_indirect_opcode(handler
)) {
9482 table
= ind_table(handler
);
9483 /* opc3 is 5 bits long */
9484 for (opc3
= 0; opc3
< PPC_CPU_INDIRECT_OPCODES_LEN
;
9486 handler
= table
[opc3
];
9487 if (is_indirect_opcode(handler
)) {
9488 table
= ind_table(handler
);
9489 /* opc4 is 5 bits long */
9490 for (opc4
= 0; opc4
< PPC_CPU_INDIRECT_OPCODES_LEN
;
9492 handler
= table
[opc4
];
9493 if (handler
->handler
!= &gen_invalid
) {
9494 printf("INSN: %02x %02x %02x %02x -- "
9495 "(%02d %04d %02d) : %s\n",
9496 opc1
, opc2
, opc3
, opc4
,
9497 opc1
, (opc3
<< 5) | opc2
, opc4
,
9502 if (handler
->handler
!= &gen_invalid
) {
9503 /* Special hack to properly dump SPE insns */
9504 p
= strchr(handler
->oname
, '_');
9506 printf("INSN: %02x %02x %02x (%02d %04d) : "
9508 opc1
, opc2
, opc3
, opc1
,
9513 if ((p
- handler
->oname
) != strlen(q
)
9514 || (memcmp(handler
->oname
, q
, strlen(q
))
9516 /* First instruction */
9517 printf("INSN: %02x %02x %02x"
9518 "(%02d %04d) : %.*s\n",
9519 opc1
, opc2
<< 1, opc3
, opc1
,
9520 (opc3
<< 6) | (opc2
<< 1),
9521 (int)(p
- handler
->oname
),
9524 if (strcmp(p
+ 1, q
) != 0) {
9525 /* Second instruction */
9526 printf("INSN: %02x %02x %02x "
9527 "(%02d %04d) : %s\n", opc1
,
9528 (opc2
<< 1) | 1, opc3
, opc1
,
9529 (opc3
<< 6) | (opc2
<< 1) | 1,
9537 if (handler
->handler
!= &gen_invalid
) {
9538 printf("INSN: %02x %02x -- (%02d %04d) : %s\n",
9539 opc1
, opc2
, opc1
, opc2
, handler
->oname
);
9544 if (handler
->handler
!= &gen_invalid
) {
9545 printf("INSN: %02x -- -- (%02d ----) : %s\n",
9546 opc1
, opc1
, handler
->oname
);
9553 static bool avr_need_swap(CPUPPCState
*env
)
9555 #ifdef HOST_WORDS_BIGENDIAN
9562 #if !defined(CONFIG_USER_ONLY)
9563 static int gdb_find_spr_idx(CPUPPCState
*env
, int n
)
9567 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
9568 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
9570 if (spr
->name
&& spr
->gdb_id
== n
) {
9577 static int gdb_get_spr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9582 reg
= gdb_find_spr_idx(env
, n
);
9587 len
= TARGET_LONG_SIZE
;
9588 stn_p(mem_buf
, len
, env
->spr
[reg
]);
9589 ppc_maybe_bswap_register(env
, mem_buf
, len
);
9593 static int gdb_set_spr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9598 reg
= gdb_find_spr_idx(env
, n
);
9603 len
= TARGET_LONG_SIZE
;
9604 ppc_maybe_bswap_register(env
, mem_buf
, len
);
9605 env
->spr
[reg
] = ldn_p(mem_buf
, len
);
9611 static int gdb_get_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9614 stfq_p(mem_buf
, *cpu_fpr_ptr(env
, n
));
9615 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9619 stl_p(mem_buf
, env
->fpscr
);
9620 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9626 static int gdb_set_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9629 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9630 *cpu_fpr_ptr(env
, n
) = ldfq_p(mem_buf
);
9634 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9635 helper_store_fpscr(env
, ldl_p(mem_buf
), 0xffffffff);
9641 static int gdb_get_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9644 ppc_avr_t
*avr
= cpu_avr_ptr(env
, n
);
9645 if (!avr_need_swap(env
)) {
9646 stq_p(mem_buf
, avr
->u64
[0]);
9647 stq_p(mem_buf
+ 8, avr
->u64
[1]);
9649 stq_p(mem_buf
, avr
->u64
[1]);
9650 stq_p(mem_buf
+ 8, avr
->u64
[0]);
9652 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9653 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
9657 stl_p(mem_buf
, helper_mfvscr(env
));
9658 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9662 stl_p(mem_buf
, (uint32_t)env
->spr
[SPR_VRSAVE
]);
9663 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9669 static int gdb_set_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9672 ppc_avr_t
*avr
= cpu_avr_ptr(env
, n
);
9673 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9674 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
9675 if (!avr_need_swap(env
)) {
9676 avr
->u64
[0] = ldq_p(mem_buf
);
9677 avr
->u64
[1] = ldq_p(mem_buf
+ 8);
9679 avr
->u64
[1] = ldq_p(mem_buf
);
9680 avr
->u64
[0] = ldq_p(mem_buf
+ 8);
9685 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9686 helper_mtvscr(env
, ldl_p(mem_buf
));
9690 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9691 env
->spr
[SPR_VRSAVE
] = (target_ulong
)ldl_p(mem_buf
);
9697 static int gdb_get_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9700 #if defined(TARGET_PPC64)
9701 stl_p(mem_buf
, env
->gpr
[n
] >> 32);
9702 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9704 stl_p(mem_buf
, env
->gprh
[n
]);
9709 stq_p(mem_buf
, env
->spe_acc
);
9710 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9714 stl_p(mem_buf
, env
->spe_fscr
);
9715 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9721 static int gdb_set_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9724 #if defined(TARGET_PPC64)
9725 target_ulong lo
= (uint32_t)env
->gpr
[n
];
9728 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9730 hi
= (target_ulong
)ldl_p(mem_buf
) << 32;
9731 env
->gpr
[n
] = lo
| hi
;
9733 env
->gprh
[n
] = ldl_p(mem_buf
);
9738 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9739 env
->spe_acc
= ldq_p(mem_buf
);
9743 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9744 env
->spe_fscr
= ldl_p(mem_buf
);
9750 static int gdb_get_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9753 stq_p(mem_buf
, *cpu_vsrl_ptr(env
, n
));
9754 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9760 static int gdb_set_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9763 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9764 *cpu_vsrl_ptr(env
, n
) = ldq_p(mem_buf
);
9770 static int ppc_fixup_cpu(PowerPCCPU
*cpu
)
9772 CPUPPCState
*env
= &cpu
->env
;
9775 * TCG doesn't (yet) emulate some groups of instructions that are
9776 * implemented on some otherwise supported CPUs (e.g. VSX and
9777 * decimal floating point instructions on POWER7). We remove
9778 * unsupported instruction groups from the cpu state's instruction
9779 * masks and hope the guest can cope. For at least the pseries
9780 * machine, the unavailability of these instructions can be
9781 * advertised to the guest via the device tree.
9783 if ((env
->insns_flags
& ~PPC_TCG_INSNS
)
9784 || (env
->insns_flags2
& ~PPC_TCG_INSNS2
)) {
9785 warn_report("Disabling some instructions which are not "
9786 "emulated by TCG (0x%" PRIx64
", 0x%" PRIx64
")",
9787 env
->insns_flags
& ~PPC_TCG_INSNS
,
9788 env
->insns_flags2
& ~PPC_TCG_INSNS2
);
9790 env
->insns_flags
&= PPC_TCG_INSNS
;
9791 env
->insns_flags2
&= PPC_TCG_INSNS2
;
9795 static void ppc_cpu_realize(DeviceState
*dev
, Error
**errp
)
9797 CPUState
*cs
= CPU(dev
);
9798 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
9799 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9800 Error
*local_err
= NULL
;
9802 cpu_exec_realizefn(cs
, &local_err
);
9803 if (local_err
!= NULL
) {
9804 error_propagate(errp
, local_err
);
9807 if (cpu
->vcpu_id
== UNASSIGNED_CPU_INDEX
) {
9808 cpu
->vcpu_id
= cs
->cpu_index
;
9811 if (tcg_enabled()) {
9812 if (ppc_fixup_cpu(cpu
) != 0) {
9813 error_setg(errp
, "Unable to emulate selected CPU with TCG");
9818 create_ppc_opcodes(cpu
, &local_err
);
9819 if (local_err
!= NULL
) {
9820 error_propagate(errp
, local_err
);
9825 if (pcc
->insns_flags
& PPC_FLOAT
) {
9826 gdb_register_coprocessor(cs
, gdb_get_float_reg
, gdb_set_float_reg
,
9827 33, "power-fpu.xml", 0);
9829 if (pcc
->insns_flags
& PPC_ALTIVEC
) {
9830 gdb_register_coprocessor(cs
, gdb_get_avr_reg
, gdb_set_avr_reg
,
9831 34, "power-altivec.xml", 0);
9833 if (pcc
->insns_flags
& PPC_SPE
) {
9834 gdb_register_coprocessor(cs
, gdb_get_spe_reg
, gdb_set_spe_reg
,
9835 34, "power-spe.xml", 0);
9837 if (pcc
->insns_flags2
& PPC2_VSX
) {
9838 gdb_register_coprocessor(cs
, gdb_get_vsx_reg
, gdb_set_vsx_reg
,
9839 32, "power-vsx.xml", 0);
9841 #ifndef CONFIG_USER_ONLY
9842 gdb_register_coprocessor(cs
, gdb_get_spr_reg
, gdb_set_spr_reg
,
9843 pcc
->gdb_num_sprs
, "power-spr.xml", 0);
9847 pcc
->parent_realize(dev
, errp
);
9849 #if defined(PPC_DUMP_CPU)
9851 CPUPPCState
*env
= &cpu
->env
;
9852 const char *mmu_model
, *excp_model
, *bus_model
;
9853 switch (env
->mmu_model
) {
9854 case POWERPC_MMU_32B
:
9855 mmu_model
= "PowerPC 32";
9857 case POWERPC_MMU_SOFT_6xx
:
9858 mmu_model
= "PowerPC 6xx/7xx with software driven TLBs";
9860 case POWERPC_MMU_SOFT_74xx
:
9861 mmu_model
= "PowerPC 74xx with software driven TLBs";
9863 case POWERPC_MMU_SOFT_4xx
:
9864 mmu_model
= "PowerPC 4xx with software driven TLBs";
9866 case POWERPC_MMU_SOFT_4xx_Z
:
9867 mmu_model
= "PowerPC 4xx with software driven TLBs "
9868 "and zones protections";
9870 case POWERPC_MMU_REAL
:
9871 mmu_model
= "PowerPC real mode only";
9873 case POWERPC_MMU_MPC8xx
:
9874 mmu_model
= "PowerPC MPC8xx";
9876 case POWERPC_MMU_BOOKE
:
9877 mmu_model
= "PowerPC BookE";
9879 case POWERPC_MMU_BOOKE206
:
9880 mmu_model
= "PowerPC BookE 2.06";
9882 case POWERPC_MMU_601
:
9883 mmu_model
= "PowerPC 601";
9885 #if defined(TARGET_PPC64)
9886 case POWERPC_MMU_64B
:
9887 mmu_model
= "PowerPC 64";
9891 mmu_model
= "Unknown or invalid";
9894 switch (env
->excp_model
) {
9895 case POWERPC_EXCP_STD
:
9896 excp_model
= "PowerPC";
9898 case POWERPC_EXCP_40x
:
9899 excp_model
= "PowerPC 40x";
9901 case POWERPC_EXCP_601
:
9902 excp_model
= "PowerPC 601";
9904 case POWERPC_EXCP_602
:
9905 excp_model
= "PowerPC 602";
9907 case POWERPC_EXCP_603
:
9908 excp_model
= "PowerPC 603";
9910 case POWERPC_EXCP_603E
:
9911 excp_model
= "PowerPC 603e";
9913 case POWERPC_EXCP_604
:
9914 excp_model
= "PowerPC 604";
9916 case POWERPC_EXCP_7x0
:
9917 excp_model
= "PowerPC 740/750";
9919 case POWERPC_EXCP_7x5
:
9920 excp_model
= "PowerPC 745/755";
9922 case POWERPC_EXCP_74xx
:
9923 excp_model
= "PowerPC 74xx";
9925 case POWERPC_EXCP_BOOKE
:
9926 excp_model
= "PowerPC BookE";
9928 #if defined(TARGET_PPC64)
9929 case POWERPC_EXCP_970
:
9930 excp_model
= "PowerPC 970";
9934 excp_model
= "Unknown or invalid";
9937 switch (env
->bus_model
) {
9938 case PPC_FLAGS_INPUT_6xx
:
9939 bus_model
= "PowerPC 6xx";
9941 case PPC_FLAGS_INPUT_BookE
:
9942 bus_model
= "PowerPC BookE";
9944 case PPC_FLAGS_INPUT_405
:
9945 bus_model
= "PowerPC 405";
9947 case PPC_FLAGS_INPUT_401
:
9948 bus_model
= "PowerPC 401/403";
9950 case PPC_FLAGS_INPUT_RCPU
:
9951 bus_model
= "RCPU / MPC8xx";
9953 #if defined(TARGET_PPC64)
9954 case PPC_FLAGS_INPUT_970
:
9955 bus_model
= "PowerPC 970";
9959 bus_model
= "Unknown or invalid";
9962 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64
"\n"
9963 " MMU model : %s\n",
9964 object_class_get_name(OBJECT_CLASS(pcc
)),
9965 pcc
->pvr
, pcc
->msr_mask
, mmu_model
);
9966 #if !defined(CONFIG_USER_ONLY)
9967 if (env
->tlb
.tlb6
) {
9968 printf(" %d %s TLB in %d ways\n",
9969 env
->nb_tlb
, env
->id_tlbs
? "splitted" : "merged",
9973 printf(" Exceptions model : %s\n"
9974 " Bus model : %s\n",
9975 excp_model
, bus_model
);
9976 printf(" MSR features :\n");
9977 if (env
->flags
& POWERPC_FLAG_SPE
) {
9978 printf(" signal processing engine enable"
9980 } else if (env
->flags
& POWERPC_FLAG_VRE
) {
9981 printf(" vector processor enable\n");
9983 if (env
->flags
& POWERPC_FLAG_TGPR
) {
9984 printf(" temporary GPRs\n");
9985 } else if (env
->flags
& POWERPC_FLAG_CE
) {
9986 printf(" critical input enable\n");
9988 if (env
->flags
& POWERPC_FLAG_SE
) {
9989 printf(" single-step trace mode\n");
9990 } else if (env
->flags
& POWERPC_FLAG_DWE
) {
9991 printf(" debug wait enable\n");
9992 } else if (env
->flags
& POWERPC_FLAG_UBLE
) {
9993 printf(" user BTB lock enable\n");
9995 if (env
->flags
& POWERPC_FLAG_BE
) {
9996 printf(" branch-step trace mode\n");
9997 } else if (env
->flags
& POWERPC_FLAG_DE
) {
9998 printf(" debug interrupt enable\n");
10000 if (env
->flags
& POWERPC_FLAG_PX
) {
10001 printf(" inclusive protection\n");
10002 } else if (env
->flags
& POWERPC_FLAG_PMM
) {
10003 printf(" performance monitor mark\n");
10005 if (env
->flags
== POWERPC_FLAG_NONE
) {
10008 printf(" Time-base/decrementer clock source: %s\n",
10009 env
->flags
& POWERPC_FLAG_RTC_CLK
? "RTC clock" : "bus clock");
10010 dump_ppc_insns(env
);
10011 dump_ppc_sprs(env
);
10018 cpu_exec_unrealizefn(cs
);
10021 static void ppc_cpu_unrealize(DeviceState
*dev
, Error
**errp
)
10023 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
10024 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10025 CPUPPCState
*env
= &cpu
->env
;
10026 Error
*local_err
= NULL
;
10027 opc_handler_t
**table
, **table_2
;
10030 pcc
->parent_unrealize(dev
, &local_err
);
10031 if (local_err
!= NULL
) {
10032 error_propagate(errp
, local_err
);
10036 for (i
= 0; i
< PPC_CPU_OPCODES_LEN
; i
++) {
10037 if (env
->opcodes
[i
] == &invalid_handler
) {
10040 if (is_indirect_opcode(env
->opcodes
[i
])) {
10041 table
= ind_table(env
->opcodes
[i
]);
10042 for (j
= 0; j
< PPC_CPU_INDIRECT_OPCODES_LEN
; j
++) {
10043 if (table
[j
] == &invalid_handler
) {
10046 if (is_indirect_opcode(table
[j
])) {
10047 table_2
= ind_table(table
[j
]);
10048 for (k
= 0; k
< PPC_CPU_INDIRECT_OPCODES_LEN
; k
++) {
10049 if (table_2
[k
] != &invalid_handler
&&
10050 is_indirect_opcode(table_2
[k
])) {
10051 g_free((opc_handler_t
*)((uintptr_t)table_2
[k
] &
10055 g_free((opc_handler_t
*)((uintptr_t)table
[j
] &
10059 g_free((opc_handler_t
*)((uintptr_t)env
->opcodes
[i
] &
10065 static gint
ppc_cpu_compare_class_pvr(gconstpointer a
, gconstpointer b
)
10067 ObjectClass
*oc
= (ObjectClass
*)a
;
10068 uint32_t pvr
= *(uint32_t *)b
;
10069 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
10071 /* -cpu host does a PVR lookup during construction */
10072 if (unlikely(strcmp(object_class_get_name(oc
),
10073 TYPE_HOST_POWERPC_CPU
) == 0)) {
10077 return pcc
->pvr
== pvr
? 0 : -1;
10080 PowerPCCPUClass
*ppc_cpu_class_by_pvr(uint32_t pvr
)
10082 GSList
*list
, *item
;
10083 PowerPCCPUClass
*pcc
= NULL
;
10085 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10086 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr
);
10087 if (item
!= NULL
) {
10088 pcc
= POWERPC_CPU_CLASS(item
->data
);
10090 g_slist_free(list
);
10095 static gint
ppc_cpu_compare_class_pvr_mask(gconstpointer a
, gconstpointer b
)
10097 ObjectClass
*oc
= (ObjectClass
*)a
;
10098 uint32_t pvr
= *(uint32_t *)b
;
10099 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
10101 /* -cpu host does a PVR lookup during construction */
10102 if (unlikely(strcmp(object_class_get_name(oc
),
10103 TYPE_HOST_POWERPC_CPU
) == 0)) {
10107 if (pcc
->pvr_match(pcc
, pvr
)) {
10114 PowerPCCPUClass
*ppc_cpu_class_by_pvr_mask(uint32_t pvr
)
10116 GSList
*list
, *item
;
10117 PowerPCCPUClass
*pcc
= NULL
;
10119 list
= object_class_get_list(TYPE_POWERPC_CPU
, true);
10120 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr_mask
);
10121 if (item
!= NULL
) {
10122 pcc
= POWERPC_CPU_CLASS(item
->data
);
10124 g_slist_free(list
);
10129 static const char *ppc_cpu_lookup_alias(const char *alias
)
10133 for (ai
= 0; ppc_cpu_aliases
[ai
].alias
!= NULL
; ai
++) {
10134 if (strcmp(ppc_cpu_aliases
[ai
].alias
, alias
) == 0) {
10135 return ppc_cpu_aliases
[ai
].model
;
10142 static ObjectClass
*ppc_cpu_class_by_name(const char *name
)
10144 char *cpu_model
, *typename
;
10150 * Lookup by PVR if cpu_model is valid 8 digit hex number (excl:
10151 * 0x prefix if present)
10153 if (!qemu_strtoul(name
, &p
, 16, &pvr
)) {
10154 int len
= p
- name
;
10155 len
= (len
== 10) && (name
[1] == 'x') ? len
- 2 : len
;
10156 if ((len
== 8) && (*p
== '\0')) {
10157 return OBJECT_CLASS(ppc_cpu_class_by_pvr(pvr
));
10161 cpu_model
= g_ascii_strdown(name
, -1);
10162 p
= ppc_cpu_lookup_alias(cpu_model
);
10165 cpu_model
= g_strdup(p
);
10168 typename
= g_strdup_printf("%s" POWERPC_CPU_TYPE_SUFFIX
, cpu_model
);
10169 oc
= object_class_by_name(typename
);
10176 static void ppc_cpu_parse_featurestr(const char *type
, char *features
,
10179 Object
*machine
= qdev_get_machine();
10180 const PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(object_class_by_name(type
));
10186 if (object_property_find(machine
, "max-cpu-compat", NULL
)) {
10189 char *s
= features
;
10190 Error
*local_err
= NULL
;
10191 char *compat_str
= NULL
;
10194 * Backwards compatibility hack:
10196 * CPUs had a "compat=" property which didn't make sense for
10197 * anything except pseries. It was replaced by "max-cpu-compat"
10198 * machine option. This supports old command lines like
10199 * -cpu POWER8,compat=power7
10200 * By stripping the compat option and applying it to the machine
10201 * before passing it on to the cpu level parser.
10203 inpieces
= g_strsplit(features
, ",", 0);
10205 for (i
= 0; inpieces
[i
]; i
++) {
10206 if (g_str_has_prefix(inpieces
[i
], "compat=")) {
10207 compat_str
= inpieces
[i
];
10210 if ((i
!= 0) && (s
!= features
)) {
10211 s
= g_stpcpy(s
, ",");
10213 s
= g_stpcpy(s
, inpieces
[i
]);
10217 char *v
= compat_str
+ strlen("compat=");
10218 object_property_set_str(machine
, v
, "max-cpu-compat", &local_err
);
10220 g_strfreev(inpieces
);
10222 error_propagate(errp
, local_err
);
10227 /* do property processing with generic handler */
10228 pcc
->parent_parse_features(type
, features
, errp
);
10231 PowerPCCPUClass
*ppc_cpu_get_family_class(PowerPCCPUClass
*pcc
)
10233 ObjectClass
*oc
= OBJECT_CLASS(pcc
);
10235 while (oc
&& !object_class_is_abstract(oc
)) {
10236 oc
= object_class_get_parent(oc
);
10240 return POWERPC_CPU_CLASS(oc
);
10243 /* Sort by PVR, ordering special case "host" last. */
10244 static gint
ppc_cpu_list_compare(gconstpointer a
, gconstpointer b
)
10246 ObjectClass
*oc_a
= (ObjectClass
*)a
;
10247 ObjectClass
*oc_b
= (ObjectClass
*)b
;
10248 PowerPCCPUClass
*pcc_a
= POWERPC_CPU_CLASS(oc_a
);
10249 PowerPCCPUClass
*pcc_b
= POWERPC_CPU_CLASS(oc_b
);
10250 const char *name_a
= object_class_get_name(oc_a
);
10251 const char *name_b
= object_class_get_name(oc_b
);
10253 if (strcmp(name_a
, TYPE_HOST_POWERPC_CPU
) == 0) {
10255 } else if (strcmp(name_b
, TYPE_HOST_POWERPC_CPU
) == 0) {
10258 /* Avoid an integer overflow during subtraction */
10259 if (pcc_a
->pvr
< pcc_b
->pvr
) {
10261 } else if (pcc_a
->pvr
> pcc_b
->pvr
) {
10269 static void ppc_cpu_list_entry(gpointer data
, gpointer user_data
)
10271 ObjectClass
*oc
= data
;
10272 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10273 DeviceClass
*family
= DEVICE_CLASS(ppc_cpu_get_family_class(pcc
));
10274 const char *typename
= object_class_get_name(oc
);
10278 if (unlikely(strcmp(typename
, TYPE_HOST_POWERPC_CPU
) == 0)) {
10282 name
= g_strndup(typename
,
10283 strlen(typename
) - strlen(POWERPC_CPU_TYPE_SUFFIX
));
10284 qemu_printf("PowerPC %-16s PVR %08x\n", name
, pcc
->pvr
);
10285 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
10286 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
10287 ObjectClass
*alias_oc
= ppc_cpu_class_by_name(alias
->model
);
10289 if (alias_oc
!= oc
) {
10293 * If running with KVM, we might update the family alias later, so
10294 * avoid printing the wrong alias here and use "preferred" instead
10296 if (strcmp(alias
->alias
, family
->desc
) == 0) {
10297 qemu_printf("PowerPC %-16s (alias for preferred %s CPU)\n",
10298 alias
->alias
, family
->desc
);
10300 qemu_printf("PowerPC %-16s (alias for %s)\n",
10301 alias
->alias
, name
);
10307 void ppc_cpu_list(void)
10311 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10312 list
= g_slist_sort(list
, ppc_cpu_list_compare
);
10313 g_slist_foreach(list
, ppc_cpu_list_entry
, NULL
);
10314 g_slist_free(list
);
10318 qemu_printf("PowerPC %-16s\n", "host");
10322 static void ppc_cpu_defs_entry(gpointer data
, gpointer user_data
)
10324 ObjectClass
*oc
= data
;
10325 CpuDefinitionInfoList
**first
= user_data
;
10326 const char *typename
;
10327 CpuDefinitionInfoList
*entry
;
10328 CpuDefinitionInfo
*info
;
10330 typename
= object_class_get_name(oc
);
10331 info
= g_malloc0(sizeof(*info
));
10332 info
->name
= g_strndup(typename
,
10333 strlen(typename
) - strlen(POWERPC_CPU_TYPE_SUFFIX
));
10335 entry
= g_malloc0(sizeof(*entry
));
10336 entry
->value
= info
;
10337 entry
->next
= *first
;
10341 CpuDefinitionInfoList
*qmp_query_cpu_definitions(Error
**errp
)
10343 CpuDefinitionInfoList
*cpu_list
= NULL
;
10347 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10348 g_slist_foreach(list
, ppc_cpu_defs_entry
, &cpu_list
);
10349 g_slist_free(list
);
10351 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
10352 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
10354 CpuDefinitionInfoList
*entry
;
10355 CpuDefinitionInfo
*info
;
10357 oc
= ppc_cpu_class_by_name(alias
->model
);
10362 info
= g_malloc0(sizeof(*info
));
10363 info
->name
= g_strdup(alias
->alias
);
10364 info
->q_typename
= g_strdup(object_class_get_name(oc
));
10366 entry
= g_malloc0(sizeof(*entry
));
10367 entry
->value
= info
;
10368 entry
->next
= cpu_list
;
10375 static void ppc_cpu_set_pc(CPUState
*cs
, vaddr value
)
10377 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10379 cpu
->env
.nip
= value
;
10382 static bool ppc_cpu_has_work(CPUState
*cs
)
10384 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10385 CPUPPCState
*env
= &cpu
->env
;
10387 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
10390 /* CPUClass::reset() */
10391 static void ppc_cpu_reset(CPUState
*s
)
10393 PowerPCCPU
*cpu
= POWERPC_CPU(s
);
10394 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10395 CPUPPCState
*env
= &cpu
->env
;
10399 pcc
->parent_reset(s
);
10401 msr
= (target_ulong
)0;
10402 msr
|= (target_ulong
)MSR_HVB
;
10403 msr
|= (target_ulong
)0 << MSR_AP
; /* TO BE CHECKED */
10404 msr
|= (target_ulong
)0 << MSR_SA
; /* TO BE CHECKED */
10405 msr
|= (target_ulong
)1 << MSR_EP
;
10406 #if defined(DO_SINGLE_STEP) && 0
10407 /* Single step trace mode */
10408 msr
|= (target_ulong
)1 << MSR_SE
;
10409 msr
|= (target_ulong
)1 << MSR_BE
;
10411 #if defined(CONFIG_USER_ONLY)
10412 msr
|= (target_ulong
)1 << MSR_FP
; /* Allow floating point usage */
10413 msr
|= (target_ulong
)1 << MSR_FE0
; /* Allow floating point exceptions */
10414 msr
|= (target_ulong
)1 << MSR_FE1
;
10415 msr
|= (target_ulong
)1 << MSR_VR
; /* Allow altivec usage */
10416 msr
|= (target_ulong
)1 << MSR_VSX
; /* Allow VSX usage */
10417 msr
|= (target_ulong
)1 << MSR_SPE
; /* Allow SPE usage */
10418 msr
|= (target_ulong
)1 << MSR_PR
;
10419 #if defined(TARGET_PPC64)
10420 msr
|= (target_ulong
)1 << MSR_TM
; /* Transactional memory */
10422 #if !defined(TARGET_WORDS_BIGENDIAN)
10423 msr
|= (target_ulong
)1 << MSR_LE
; /* Little-endian user mode */
10424 if (!((env
->msr_mask
>> MSR_LE
) & 1)) {
10425 fprintf(stderr
, "Selected CPU does not support little-endian.\n");
10431 #if defined(TARGET_PPC64)
10432 if (env
->mmu_model
& POWERPC_MMU_64
) {
10433 msr
|= (1ULL << MSR_SF
);
10437 hreg_store_msr(env
, msr
, 1);
10439 #if !defined(CONFIG_USER_ONLY)
10440 env
->nip
= env
->hreset_vector
| env
->excp_prefix
;
10441 if (env
->mmu_model
!= POWERPC_MMU_REAL
) {
10442 ppc_tlb_invalidate_all(env
);
10446 hreg_compute_hflags(env
);
10447 env
->reserve_addr
= (target_ulong
)-1ULL;
10448 /* Be sure no exception or interrupt is pending */
10449 env
->pending_interrupts
= 0;
10450 s
->exception_index
= POWERPC_EXCP_NONE
;
10451 env
->error_code
= 0;
10453 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
10454 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
10459 env
->spr
[i
] = spr
->default_value
;
10463 #ifndef CONFIG_USER_ONLY
10464 static bool ppc_cpu_is_big_endian(CPUState
*cs
)
10466 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10467 CPUPPCState
*env
= &cpu
->env
;
10469 cpu_synchronize_state(cs
);
10475 static void ppc_cpu_instance_init(Object
*obj
)
10477 CPUState
*cs
= CPU(obj
);
10478 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
10479 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10480 CPUPPCState
*env
= &cpu
->env
;
10483 cpu
->vcpu_id
= UNASSIGNED_CPU_INDEX
;
10485 env
->msr_mask
= pcc
->msr_mask
;
10486 env
->mmu_model
= pcc
->mmu_model
;
10487 env
->excp_model
= pcc
->excp_model
;
10488 env
->bus_model
= pcc
->bus_model
;
10489 env
->insns_flags
= pcc
->insns_flags
;
10490 env
->insns_flags2
= pcc
->insns_flags2
;
10491 env
->flags
= pcc
->flags
;
10492 env
->bfd_mach
= pcc
->bfd_mach
;
10493 env
->check_pow
= pcc
->check_pow
;
10496 * Mark HV mode as supported if the CPU has an MSR_HV bit in the
10497 * msr_mask. The mask can later be cleared by PAPR mode but the hv
10498 * mode support will remain, thus enforcing that we cannot use
10499 * priv. instructions in guest in PAPR mode. For 970 we currently
10500 * simply don't set HV in msr_mask thus simulating an "Apple mode"
10501 * 970. If we ever want to support 970 HV mode, we'll have to add
10502 * a processor attribute of some sort.
10504 #if !defined(CONFIG_USER_ONLY)
10505 env
->has_hv_mode
= !!(env
->msr_mask
& MSR_HVB
);
10508 ppc_hash64_init(cpu
);
10511 static void ppc_cpu_instance_finalize(Object
*obj
)
10513 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
10515 ppc_hash64_finalize(cpu
);
10518 static bool ppc_pvr_match_default(PowerPCCPUClass
*pcc
, uint32_t pvr
)
10520 return pcc
->pvr
== pvr
;
10523 static gchar
*ppc_gdb_arch_name(CPUState
*cs
)
10525 #if defined(TARGET_PPC64)
10526 return g_strdup("powerpc:common64");
10528 return g_strdup("powerpc:common");
10532 static void ppc_disas_set_info(CPUState
*cs
, disassemble_info
*info
)
10534 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10535 CPUPPCState
*env
= &cpu
->env
;
10537 if ((env
->hflags
>> MSR_LE
) & 1) {
10538 info
->endian
= BFD_ENDIAN_LITTLE
;
10540 info
->mach
= env
->bfd_mach
;
10541 if (!env
->bfd_mach
) {
10542 #ifdef TARGET_PPC64
10543 info
->mach
= bfd_mach_ppc64
;
10545 info
->mach
= bfd_mach_ppc
;
10548 info
->disassembler_options
= (char *)"any";
10549 info
->print_insn
= print_insn_ppc
;
10551 info
->cap_arch
= CS_ARCH_PPC
;
10552 #ifdef TARGET_PPC64
10553 info
->cap_mode
= CS_MODE_64
;
10557 static Property ppc_cpu_properties
[] = {
10558 DEFINE_PROP_BOOL("pre-2.8-migration", PowerPCCPU
, pre_2_8_migration
, false),
10559 DEFINE_PROP_BOOL("pre-2.10-migration", PowerPCCPU
, pre_2_10_migration
,
10561 DEFINE_PROP_BOOL("pre-3.0-migration", PowerPCCPU
, pre_3_0_migration
,
10563 DEFINE_PROP_END_OF_LIST(),
10566 static void ppc_cpu_class_init(ObjectClass
*oc
, void *data
)
10568 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10569 CPUClass
*cc
= CPU_CLASS(oc
);
10570 DeviceClass
*dc
= DEVICE_CLASS(oc
);
10572 device_class_set_parent_realize(dc
, ppc_cpu_realize
,
10573 &pcc
->parent_realize
);
10574 device_class_set_parent_unrealize(dc
, ppc_cpu_unrealize
,
10575 &pcc
->parent_unrealize
);
10576 pcc
->pvr_match
= ppc_pvr_match_default
;
10577 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_always
;
10578 dc
->props
= ppc_cpu_properties
;
10580 pcc
->parent_reset
= cc
->reset
;
10581 cc
->reset
= ppc_cpu_reset
;
10583 cc
->class_by_name
= ppc_cpu_class_by_name
;
10584 pcc
->parent_parse_features
= cc
->parse_features
;
10585 cc
->parse_features
= ppc_cpu_parse_featurestr
;
10586 cc
->has_work
= ppc_cpu_has_work
;
10587 cc
->do_interrupt
= ppc_cpu_do_interrupt
;
10588 cc
->cpu_exec_interrupt
= ppc_cpu_exec_interrupt
;
10589 cc
->dump_state
= ppc_cpu_dump_state
;
10590 cc
->dump_statistics
= ppc_cpu_dump_statistics
;
10591 cc
->set_pc
= ppc_cpu_set_pc
;
10592 cc
->gdb_read_register
= ppc_cpu_gdb_read_register
;
10593 cc
->gdb_write_register
= ppc_cpu_gdb_write_register
;
10594 cc
->do_unaligned_access
= ppc_cpu_do_unaligned_access
;
10595 #ifndef CONFIG_USER_ONLY
10596 cc
->get_phys_page_debug
= ppc_cpu_get_phys_page_debug
;
10597 cc
->vmsd
= &vmstate_ppc_cpu
;
10599 #if defined(CONFIG_SOFTMMU)
10600 cc
->write_elf64_note
= ppc64_cpu_write_elf64_note
;
10601 cc
->write_elf32_note
= ppc32_cpu_write_elf32_note
;
10604 cc
->gdb_num_core_regs
= 71;
10605 #ifndef CONFIG_USER_ONLY
10606 cc
->gdb_get_dynamic_xml
= ppc_gdb_get_dynamic_xml
;
10608 #ifdef USE_APPLE_GDB
10609 cc
->gdb_read_register
= ppc_cpu_gdb_read_register_apple
;
10610 cc
->gdb_write_register
= ppc_cpu_gdb_write_register_apple
;
10611 cc
->gdb_num_core_regs
= 71 + 32;
10614 cc
->gdb_arch_name
= ppc_gdb_arch_name
;
10615 #if defined(TARGET_PPC64)
10616 cc
->gdb_core_xml_file
= "power64-core.xml";
10618 cc
->gdb_core_xml_file
= "power-core.xml";
10620 #ifndef CONFIG_USER_ONLY
10621 cc
->virtio_is_big_endian
= ppc_cpu_is_big_endian
;
10624 cc
->tcg_initialize
= ppc_translate_init
;
10625 cc
->tlb_fill
= ppc_cpu_tlb_fill
;
10627 cc
->disas_set_info
= ppc_disas_set_info
;
10629 dc
->fw_name
= "PowerPC,UNKNOWN";
10632 static const TypeInfo ppc_cpu_type_info
= {
10633 .name
= TYPE_POWERPC_CPU
,
10634 .parent
= TYPE_CPU
,
10635 .instance_size
= sizeof(PowerPCCPU
),
10636 .instance_init
= ppc_cpu_instance_init
,
10637 .instance_finalize
= ppc_cpu_instance_finalize
,
10639 .class_size
= sizeof(PowerPCCPUClass
),
10640 .class_init
= ppc_cpu_class_init
,
10643 static const TypeInfo ppc_vhyp_type_info
= {
10644 .name
= TYPE_PPC_VIRTUAL_HYPERVISOR
,
10645 .parent
= TYPE_INTERFACE
,
10646 .class_size
= sizeof(PPCVirtualHypervisorClass
),
10649 static void ppc_cpu_register_types(void)
10651 type_register_static(&ppc_cpu_type_info
);
10652 type_register_static(&ppc_vhyp_type_info
);
10655 type_init(ppc_cpu_register_types
)