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 "sysemu/tcg.h"
28 #include "cpu-models.h"
29 #include "mmu-hash32.h"
30 #include "mmu-hash64.h"
31 #include "qemu/error-report.h"
32 #include "qemu/module.h"
33 #include "qemu/qemu-print.h"
34 #include "qapi/error.h"
35 #include "qapi/qmp/qnull.h"
36 #include "qapi/visitor.h"
37 #include "hw/qdev-properties.h"
38 #include "hw/ppc/ppc.h"
39 #include "mmu-book3s-v3.h"
40 #include "sysemu/qtest.h"
41 #include "qemu/cutils.h"
42 #include "disas/capstone.h"
43 #include "fpu/softfloat.h"
44 #include "qapi/qapi-commands-machine-target.h"
46 /* #define PPC_DUMP_CPU */
47 /* #define PPC_DEBUG_SPR */
48 /* #define PPC_DUMP_SPR_ACCESSES */
49 /* #define USE_APPLE_GDB */
53 * do nothing but store/retrieve spr value
55 static void spr_load_dump_spr(int sprn
)
57 #ifdef PPC_DUMP_SPR_ACCESSES
58 TCGv_i32 t0
= tcg_const_i32(sprn
);
59 gen_helper_load_dump_spr(cpu_env
, t0
);
60 tcg_temp_free_i32(t0
);
64 static void spr_read_generic(DisasContext
*ctx
, int gprn
, int sprn
)
66 gen_load_spr(cpu_gpr
[gprn
], sprn
);
67 spr_load_dump_spr(sprn
);
70 static void spr_store_dump_spr(int sprn
)
72 #ifdef PPC_DUMP_SPR_ACCESSES
73 TCGv_i32 t0
= tcg_const_i32(sprn
);
74 gen_helper_store_dump_spr(cpu_env
, t0
);
75 tcg_temp_free_i32(t0
);
79 static void spr_write_generic(DisasContext
*ctx
, int sprn
, int gprn
)
81 gen_store_spr(sprn
, cpu_gpr
[gprn
]);
82 spr_store_dump_spr(sprn
);
85 #if !defined(CONFIG_USER_ONLY)
86 static void spr_write_generic32(DisasContext
*ctx
, int sprn
, int gprn
)
89 TCGv t0
= tcg_temp_new();
90 tcg_gen_ext32u_tl(t0
, cpu_gpr
[gprn
]);
91 gen_store_spr(sprn
, t0
);
93 spr_store_dump_spr(sprn
);
95 spr_write_generic(ctx
, sprn
, gprn
);
99 static void spr_write_clear(DisasContext
*ctx
, int sprn
, int gprn
)
101 TCGv t0
= tcg_temp_new();
102 TCGv t1
= tcg_temp_new();
103 gen_load_spr(t0
, sprn
);
104 tcg_gen_neg_tl(t1
, cpu_gpr
[gprn
]);
105 tcg_gen_and_tl(t0
, t0
, t1
);
106 gen_store_spr(sprn
, t0
);
111 static void spr_access_nop(DisasContext
*ctx
, int sprn
, int gprn
)
117 /* SPR common to all PowerPC */
119 static void spr_read_xer(DisasContext
*ctx
, int gprn
, int sprn
)
121 gen_read_xer(ctx
, cpu_gpr
[gprn
]);
124 static void spr_write_xer(DisasContext
*ctx
, int sprn
, int gprn
)
126 gen_write_xer(cpu_gpr
[gprn
]);
130 static void spr_read_lr(DisasContext
*ctx
, int gprn
, int sprn
)
132 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_lr
);
135 static void spr_write_lr(DisasContext
*ctx
, int sprn
, int gprn
)
137 tcg_gen_mov_tl(cpu_lr
, cpu_gpr
[gprn
]);
141 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
142 static void spr_read_cfar(DisasContext
*ctx
, int gprn
, int sprn
)
144 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_cfar
);
147 static void spr_write_cfar(DisasContext
*ctx
, int sprn
, int gprn
)
149 tcg_gen_mov_tl(cpu_cfar
, cpu_gpr
[gprn
]);
151 #endif /* defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) */
154 static void spr_read_ctr(DisasContext
*ctx
, int gprn
, int sprn
)
156 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_ctr
);
159 static void spr_write_ctr(DisasContext
*ctx
, int sprn
, int gprn
)
161 tcg_gen_mov_tl(cpu_ctr
, cpu_gpr
[gprn
]);
164 /* User read access to SPR */
170 static void spr_read_ureg(DisasContext
*ctx
, int gprn
, int sprn
)
172 gen_load_spr(cpu_gpr
[gprn
], sprn
+ 0x10);
175 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
176 static void spr_write_ureg(DisasContext
*ctx
, int sprn
, int gprn
)
178 gen_store_spr(sprn
+ 0x10, cpu_gpr
[gprn
]);
182 /* SPR common to all non-embedded PowerPC */
184 #if !defined(CONFIG_USER_ONLY)
185 static void spr_read_decr(DisasContext
*ctx
, int gprn
, int sprn
)
187 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
190 gen_helper_load_decr(cpu_gpr
[gprn
], cpu_env
);
191 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
192 gen_stop_exception(ctx
);
196 static void spr_write_decr(DisasContext
*ctx
, int sprn
, int gprn
)
198 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
201 gen_helper_store_decr(cpu_env
, cpu_gpr
[gprn
]);
202 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
);
290 static void spr_write_purr(DisasContext
*ctx
, int sprn
, int gprn
)
292 gen_helper_store_purr(cpu_env
, cpu_gpr
[gprn
]);
296 static void spr_read_hdecr(DisasContext
*ctx
, int gprn
, int sprn
)
298 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
301 gen_helper_load_hdecr(cpu_gpr
[gprn
], cpu_env
);
302 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
304 gen_stop_exception(ctx
);
308 static void spr_write_hdecr(DisasContext
*ctx
, int sprn
, int gprn
)
310 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
313 gen_helper_store_hdecr(cpu_env
, cpu_gpr
[gprn
]);
314 if (tb_cflags(ctx
->base
.tb
) & CF_USE_ICOUNT
) {
316 gen_stop_exception(ctx
);
320 static void spr_read_vtb(DisasContext
*ctx
, int gprn
, int sprn
)
322 gen_helper_load_vtb(cpu_gpr
[gprn
], cpu_env
);
325 static void spr_write_vtb(DisasContext
*ctx
, int sprn
, int gprn
)
327 gen_helper_store_vtb(cpu_env
, cpu_gpr
[gprn
]);
330 static void spr_write_tbu40(DisasContext
*ctx
, int sprn
, int gprn
)
332 gen_helper_store_tbu40(cpu_env
, cpu_gpr
[gprn
]);
338 #if !defined(CONFIG_USER_ONLY)
339 /* IBAT0U...IBAT0U */
340 /* IBAT0L...IBAT7L */
341 static void spr_read_ibat(DisasContext
*ctx
, int gprn
, int sprn
)
343 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
,
344 offsetof(CPUPPCState
,
345 IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
348 static void spr_read_ibat_h(DisasContext
*ctx
, int gprn
, int sprn
)
350 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
,
351 offsetof(CPUPPCState
,
352 IBAT
[sprn
& 1][((sprn
- SPR_IBAT4U
) / 2) + 4]));
355 static void spr_write_ibatu(DisasContext
*ctx
, int sprn
, int gprn
)
357 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
358 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
359 tcg_temp_free_i32(t0
);
362 static void spr_write_ibatu_h(DisasContext
*ctx
, int sprn
, int gprn
)
364 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4U
) / 2) + 4);
365 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
366 tcg_temp_free_i32(t0
);
369 static void spr_write_ibatl(DisasContext
*ctx
, int sprn
, int gprn
)
371 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0L
) / 2);
372 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
373 tcg_temp_free_i32(t0
);
376 static void spr_write_ibatl_h(DisasContext
*ctx
, int sprn
, int gprn
)
378 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4L
) / 2) + 4);
379 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
380 tcg_temp_free_i32(t0
);
383 /* DBAT0U...DBAT7U */
384 /* DBAT0L...DBAT7L */
385 static void spr_read_dbat(DisasContext
*ctx
, int gprn
, int sprn
)
387 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
,
388 offsetof(CPUPPCState
,
389 DBAT
[sprn
& 1][(sprn
- SPR_DBAT0U
) / 2]));
392 static void spr_read_dbat_h(DisasContext
*ctx
, int gprn
, int sprn
)
394 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
,
395 offsetof(CPUPPCState
,
396 DBAT
[sprn
& 1][((sprn
- SPR_DBAT4U
) / 2) + 4]));
399 static void spr_write_dbatu(DisasContext
*ctx
, int sprn
, int gprn
)
401 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0U
) / 2);
402 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
403 tcg_temp_free_i32(t0
);
406 static void spr_write_dbatu_h(DisasContext
*ctx
, int sprn
, int gprn
)
408 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4U
) / 2) + 4);
409 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
410 tcg_temp_free_i32(t0
);
413 static void spr_write_dbatl(DisasContext
*ctx
, int sprn
, int gprn
)
415 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0L
) / 2);
416 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
417 tcg_temp_free_i32(t0
);
420 static void spr_write_dbatl_h(DisasContext
*ctx
, int sprn
, int gprn
)
422 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4L
) / 2) + 4);
423 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
424 tcg_temp_free_i32(t0
);
428 static void spr_write_sdr1(DisasContext
*ctx
, int sprn
, int gprn
)
430 gen_helper_store_sdr1(cpu_env
, cpu_gpr
[gprn
]);
433 #if defined(TARGET_PPC64)
434 /* 64 bits PowerPC specific SPRs */
436 static void spr_write_pidr(DisasContext
*ctx
, int sprn
, int gprn
)
438 gen_helper_store_pidr(cpu_env
, cpu_gpr
[gprn
]);
441 static void spr_write_lpidr(DisasContext
*ctx
, int sprn
, int gprn
)
443 gen_helper_store_lpidr(cpu_env
, cpu_gpr
[gprn
]);
446 static void spr_read_hior(DisasContext
*ctx
, int gprn
, int sprn
)
448 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
451 static void spr_write_hior(DisasContext
*ctx
, int sprn
, int gprn
)
453 TCGv t0
= tcg_temp_new();
454 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0x3FFFFF00000ULL
);
455 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
458 static void spr_write_ptcr(DisasContext
*ctx
, int sprn
, int gprn
)
460 gen_helper_store_ptcr(cpu_env
, cpu_gpr
[gprn
]);
463 static void spr_write_pcr(DisasContext
*ctx
, int sprn
, int gprn
)
465 gen_helper_store_pcr(cpu_env
, cpu_gpr
[gprn
]);
469 static void spr_read_dpdes(DisasContext
*ctx
, int gprn
, int sprn
)
471 gen_helper_load_dpdes(cpu_gpr
[gprn
], cpu_env
);
474 static void spr_write_dpdes(DisasContext
*ctx
, int sprn
, int gprn
)
476 gen_helper_store_dpdes(cpu_env
, cpu_gpr
[gprn
]);
481 /* PowerPC 601 specific registers */
483 static void spr_read_601_rtcl(DisasContext
*ctx
, int gprn
, int sprn
)
485 gen_helper_load_601_rtcl(cpu_gpr
[gprn
], cpu_env
);
488 static void spr_read_601_rtcu(DisasContext
*ctx
, int gprn
, int sprn
)
490 gen_helper_load_601_rtcu(cpu_gpr
[gprn
], cpu_env
);
493 #if !defined(CONFIG_USER_ONLY)
494 static void spr_write_601_rtcu(DisasContext
*ctx
, int sprn
, int gprn
)
496 gen_helper_store_601_rtcu(cpu_env
, cpu_gpr
[gprn
]);
499 static void spr_write_601_rtcl(DisasContext
*ctx
, int sprn
, int gprn
)
501 gen_helper_store_601_rtcl(cpu_env
, cpu_gpr
[gprn
]);
504 static void spr_write_hid0_601(DisasContext
*ctx
, int sprn
, int gprn
)
506 gen_helper_store_hid0_601(cpu_env
, cpu_gpr
[gprn
]);
507 /* Must stop the translation as endianness may have changed */
508 gen_stop_exception(ctx
);
513 #if !defined(CONFIG_USER_ONLY)
514 static void spr_read_601_ubat(DisasContext
*ctx
, int gprn
, int sprn
)
516 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
,
517 offsetof(CPUPPCState
,
518 IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
521 static void spr_write_601_ubatu(DisasContext
*ctx
, int sprn
, int gprn
)
523 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
524 gen_helper_store_601_batl(cpu_env
, t0
, cpu_gpr
[gprn
]);
525 tcg_temp_free_i32(t0
);
528 static void spr_write_601_ubatl(DisasContext
*ctx
, int sprn
, int gprn
)
530 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
531 gen_helper_store_601_batu(cpu_env
, t0
, cpu_gpr
[gprn
]);
532 tcg_temp_free_i32(t0
);
536 /* PowerPC 40x specific registers */
537 #if !defined(CONFIG_USER_ONLY)
538 static void spr_read_40x_pit(DisasContext
*ctx
, int gprn
, int sprn
)
540 gen_helper_load_40x_pit(cpu_gpr
[gprn
], cpu_env
);
543 static void spr_write_40x_pit(DisasContext
*ctx
, int sprn
, int gprn
)
545 gen_helper_store_40x_pit(cpu_env
, cpu_gpr
[gprn
]);
548 static void spr_write_40x_dbcr0(DisasContext
*ctx
, int sprn
, int gprn
)
550 gen_store_spr(sprn
, cpu_gpr
[gprn
]);
551 gen_helper_store_40x_dbcr0(cpu_env
, cpu_gpr
[gprn
]);
552 /* We must stop translation as we may have rebooted */
553 gen_stop_exception(ctx
);
556 static void spr_write_40x_sler(DisasContext
*ctx
, int sprn
, int gprn
)
558 gen_helper_store_40x_sler(cpu_env
, cpu_gpr
[gprn
]);
561 static void spr_write_booke_tcr(DisasContext
*ctx
, int sprn
, int gprn
)
563 gen_helper_store_booke_tcr(cpu_env
, cpu_gpr
[gprn
]);
566 static void spr_write_booke_tsr(DisasContext
*ctx
, int sprn
, int gprn
)
568 gen_helper_store_booke_tsr(cpu_env
, cpu_gpr
[gprn
]);
572 /* PowerPC 403 specific registers */
573 /* PBL1 / PBU1 / PBL2 / PBU2 */
574 #if !defined(CONFIG_USER_ONLY)
575 static void spr_read_403_pbr(DisasContext
*ctx
, int gprn
, int sprn
)
577 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
,
578 offsetof(CPUPPCState
, pb
[sprn
- SPR_403_PBL1
]));
581 static void spr_write_403_pbr(DisasContext
*ctx
, int sprn
, int gprn
)
583 TCGv_i32 t0
= tcg_const_i32(sprn
- SPR_403_PBL1
);
584 gen_helper_store_403_pbr(cpu_env
, t0
, cpu_gpr
[gprn
]);
585 tcg_temp_free_i32(t0
);
588 static void spr_write_pir(DisasContext
*ctx
, int sprn
, int gprn
)
590 TCGv t0
= tcg_temp_new();
591 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0xF);
592 gen_store_spr(SPR_PIR
, t0
);
597 /* SPE specific registers */
598 static void spr_read_spefscr(DisasContext
*ctx
, int gprn
, int sprn
)
600 TCGv_i32 t0
= tcg_temp_new_i32();
601 tcg_gen_ld_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
602 tcg_gen_extu_i32_tl(cpu_gpr
[gprn
], t0
);
603 tcg_temp_free_i32(t0
);
606 static void spr_write_spefscr(DisasContext
*ctx
, int sprn
, int gprn
)
608 TCGv_i32 t0
= tcg_temp_new_i32();
609 tcg_gen_trunc_tl_i32(t0
, cpu_gpr
[gprn
]);
610 tcg_gen_st_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
611 tcg_temp_free_i32(t0
);
614 #if !defined(CONFIG_USER_ONLY)
615 /* Callback used to write the exception vector base */
616 static void spr_write_excp_prefix(DisasContext
*ctx
, int sprn
, int gprn
)
618 TCGv t0
= tcg_temp_new();
619 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivpr_mask
));
620 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
621 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
622 gen_store_spr(sprn
, t0
);
626 static void spr_write_excp_vector(DisasContext
*ctx
, int sprn
, int gprn
)
630 if (sprn
>= SPR_BOOKE_IVOR0
&& sprn
<= SPR_BOOKE_IVOR15
) {
631 sprn_offs
= sprn
- SPR_BOOKE_IVOR0
;
632 } else if (sprn
>= SPR_BOOKE_IVOR32
&& sprn
<= SPR_BOOKE_IVOR37
) {
633 sprn_offs
= sprn
- SPR_BOOKE_IVOR32
+ 32;
634 } else if (sprn
>= SPR_BOOKE_IVOR38
&& sprn
<= SPR_BOOKE_IVOR42
) {
635 sprn_offs
= sprn
- SPR_BOOKE_IVOR38
+ 38;
637 printf("Trying to write an unknown exception vector %d %03x\n",
639 gen_inval_exception(ctx
, POWERPC_EXCP_PRIV_REG
);
643 TCGv t0
= tcg_temp_new();
644 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivor_mask
));
645 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
646 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_vectors
[sprn_offs
]));
647 gen_store_spr(sprn
, t0
);
652 static inline void vscr_init(CPUPPCState
*env
, uint32_t val
)
654 /* Altivec always uses round-to-nearest */
655 set_float_rounding_mode(float_round_nearest_even
, &env
->vec_status
);
656 helper_mtvscr(env
, val
);
659 #ifdef CONFIG_USER_ONLY
660 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
661 oea_read, oea_write, one_reg_id, initial_value) \
662 _spr_register(env, num, name, uea_read, uea_write, initial_value)
663 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
664 oea_read, oea_write, hea_read, hea_write, \
665 one_reg_id, initial_value) \
666 _spr_register(env, num, name, uea_read, uea_write, initial_value)
668 #if !defined(CONFIG_KVM)
669 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
670 oea_read, oea_write, one_reg_id, initial_value) \
671 _spr_register(env, num, name, uea_read, uea_write, \
672 oea_read, oea_write, oea_read, oea_write, initial_value)
673 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
674 oea_read, oea_write, hea_read, hea_write, \
675 one_reg_id, initial_value) \
676 _spr_register(env, num, name, uea_read, uea_write, \
677 oea_read, oea_write, hea_read, hea_write, initial_value)
679 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
680 oea_read, oea_write, one_reg_id, initial_value) \
681 _spr_register(env, num, name, uea_read, uea_write, \
682 oea_read, oea_write, oea_read, oea_write, \
683 one_reg_id, initial_value)
684 #define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
685 oea_read, oea_write, hea_read, hea_write, \
686 one_reg_id, initial_value) \
687 _spr_register(env, num, name, uea_read, uea_write, \
688 oea_read, oea_write, hea_read, hea_write, \
689 one_reg_id, initial_value)
693 #define spr_register(env, num, name, uea_read, uea_write, \
694 oea_read, oea_write, initial_value) \
695 spr_register_kvm(env, num, name, uea_read, uea_write, \
696 oea_read, oea_write, 0, initial_value)
698 #define spr_register_hv(env, num, name, uea_read, uea_write, \
699 oea_read, oea_write, hea_read, hea_write, \
701 spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
702 oea_read, oea_write, hea_read, hea_write, \
705 static inline void _spr_register(CPUPPCState
*env
, int num
,
707 void (*uea_read
)(DisasContext
*ctx
,
709 void (*uea_write
)(DisasContext
*ctx
,
711 #if !defined(CONFIG_USER_ONLY)
713 void (*oea_read
)(DisasContext
*ctx
,
715 void (*oea_write
)(DisasContext
*ctx
,
717 void (*hea_read
)(DisasContext
*opaque
,
719 void (*hea_write
)(DisasContext
*opaque
,
722 #if defined(CONFIG_KVM)
725 target_ulong initial_value
)
729 spr
= &env
->spr_cb
[num
];
730 if (spr
->name
!= NULL
|| env
->spr
[num
] != 0x00000000 ||
731 #if !defined(CONFIG_USER_ONLY)
732 spr
->oea_read
!= NULL
|| spr
->oea_write
!= NULL
||
734 spr
->uea_read
!= NULL
|| spr
->uea_write
!= NULL
) {
735 printf("Error: Trying to register SPR %d (%03x) twice !\n", num
, num
);
738 #if defined(PPC_DEBUG_SPR)
739 printf("*** register spr %d (%03x) %s val " TARGET_FMT_lx
"\n", num
, num
,
740 name
, initial_value
);
743 spr
->uea_read
= uea_read
;
744 spr
->uea_write
= uea_write
;
745 #if !defined(CONFIG_USER_ONLY)
746 spr
->oea_read
= oea_read
;
747 spr
->oea_write
= oea_write
;
748 spr
->hea_read
= hea_read
;
749 spr
->hea_write
= hea_write
;
751 #if defined(CONFIG_KVM)
752 spr
->one_reg_id
= one_reg_id
,
754 env
->spr
[num
] = spr
->default_value
= initial_value
;
757 /* Generic PowerPC SPRs */
758 static void gen_spr_generic(CPUPPCState
*env
)
760 /* Integer processing */
761 spr_register(env
, SPR_XER
, "XER",
762 &spr_read_xer
, &spr_write_xer
,
763 &spr_read_xer
, &spr_write_xer
,
766 spr_register(env
, SPR_LR
, "LR",
767 &spr_read_lr
, &spr_write_lr
,
768 &spr_read_lr
, &spr_write_lr
,
770 spr_register(env
, SPR_CTR
, "CTR",
771 &spr_read_ctr
, &spr_write_ctr
,
772 &spr_read_ctr
, &spr_write_ctr
,
774 /* Interrupt processing */
775 spr_register(env
, SPR_SRR0
, "SRR0",
776 SPR_NOACCESS
, SPR_NOACCESS
,
777 &spr_read_generic
, &spr_write_generic
,
779 spr_register(env
, SPR_SRR1
, "SRR1",
780 SPR_NOACCESS
, SPR_NOACCESS
,
781 &spr_read_generic
, &spr_write_generic
,
783 /* Processor control */
784 spr_register(env
, SPR_SPRG0
, "SPRG0",
785 SPR_NOACCESS
, SPR_NOACCESS
,
786 &spr_read_generic
, &spr_write_generic
,
788 spr_register(env
, SPR_SPRG1
, "SPRG1",
789 SPR_NOACCESS
, SPR_NOACCESS
,
790 &spr_read_generic
, &spr_write_generic
,
792 spr_register(env
, SPR_SPRG2
, "SPRG2",
793 SPR_NOACCESS
, SPR_NOACCESS
,
794 &spr_read_generic
, &spr_write_generic
,
796 spr_register(env
, SPR_SPRG3
, "SPRG3",
797 SPR_NOACCESS
, SPR_NOACCESS
,
798 &spr_read_generic
, &spr_write_generic
,
802 /* SPR common to all non-embedded PowerPC, including 601 */
803 static void gen_spr_ne_601(CPUPPCState
*env
)
805 /* Exception processing */
806 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
807 SPR_NOACCESS
, SPR_NOACCESS
,
808 &spr_read_generic
, &spr_write_generic
,
809 KVM_REG_PPC_DSISR
, 0x00000000);
810 spr_register_kvm(env
, SPR_DAR
, "DAR",
811 SPR_NOACCESS
, SPR_NOACCESS
,
812 &spr_read_generic
, &spr_write_generic
,
813 KVM_REG_PPC_DAR
, 0x00000000);
815 spr_register(env
, SPR_DECR
, "DECR",
816 SPR_NOACCESS
, SPR_NOACCESS
,
817 &spr_read_decr
, &spr_write_decr
,
821 /* Storage Description Register 1 */
822 static void gen_spr_sdr1(CPUPPCState
*env
)
824 #ifndef CONFIG_USER_ONLY
825 if (env
->has_hv_mode
) {
827 * SDR1 is a hypervisor resource on CPUs which have a
830 spr_register_hv(env
, SPR_SDR1
, "SDR1",
831 SPR_NOACCESS
, SPR_NOACCESS
,
832 SPR_NOACCESS
, SPR_NOACCESS
,
833 &spr_read_generic
, &spr_write_sdr1
,
836 spr_register(env
, SPR_SDR1
, "SDR1",
837 SPR_NOACCESS
, SPR_NOACCESS
,
838 &spr_read_generic
, &spr_write_sdr1
,
845 static void gen_low_BATs(CPUPPCState
*env
)
847 #if !defined(CONFIG_USER_ONLY)
848 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
849 SPR_NOACCESS
, SPR_NOACCESS
,
850 &spr_read_ibat
, &spr_write_ibatu
,
852 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
853 SPR_NOACCESS
, SPR_NOACCESS
,
854 &spr_read_ibat
, &spr_write_ibatl
,
856 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
857 SPR_NOACCESS
, SPR_NOACCESS
,
858 &spr_read_ibat
, &spr_write_ibatu
,
860 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
861 SPR_NOACCESS
, SPR_NOACCESS
,
862 &spr_read_ibat
, &spr_write_ibatl
,
864 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
865 SPR_NOACCESS
, SPR_NOACCESS
,
866 &spr_read_ibat
, &spr_write_ibatu
,
868 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
869 SPR_NOACCESS
, SPR_NOACCESS
,
870 &spr_read_ibat
, &spr_write_ibatl
,
872 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
873 SPR_NOACCESS
, SPR_NOACCESS
,
874 &spr_read_ibat
, &spr_write_ibatu
,
876 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
877 SPR_NOACCESS
, SPR_NOACCESS
,
878 &spr_read_ibat
, &spr_write_ibatl
,
880 spr_register(env
, SPR_DBAT0U
, "DBAT0U",
881 SPR_NOACCESS
, SPR_NOACCESS
,
882 &spr_read_dbat
, &spr_write_dbatu
,
884 spr_register(env
, SPR_DBAT0L
, "DBAT0L",
885 SPR_NOACCESS
, SPR_NOACCESS
,
886 &spr_read_dbat
, &spr_write_dbatl
,
888 spr_register(env
, SPR_DBAT1U
, "DBAT1U",
889 SPR_NOACCESS
, SPR_NOACCESS
,
890 &spr_read_dbat
, &spr_write_dbatu
,
892 spr_register(env
, SPR_DBAT1L
, "DBAT1L",
893 SPR_NOACCESS
, SPR_NOACCESS
,
894 &spr_read_dbat
, &spr_write_dbatl
,
896 spr_register(env
, SPR_DBAT2U
, "DBAT2U",
897 SPR_NOACCESS
, SPR_NOACCESS
,
898 &spr_read_dbat
, &spr_write_dbatu
,
900 spr_register(env
, SPR_DBAT2L
, "DBAT2L",
901 SPR_NOACCESS
, SPR_NOACCESS
,
902 &spr_read_dbat
, &spr_write_dbatl
,
904 spr_register(env
, SPR_DBAT3U
, "DBAT3U",
905 SPR_NOACCESS
, SPR_NOACCESS
,
906 &spr_read_dbat
, &spr_write_dbatu
,
908 spr_register(env
, SPR_DBAT3L
, "DBAT3L",
909 SPR_NOACCESS
, SPR_NOACCESS
,
910 &spr_read_dbat
, &spr_write_dbatl
,
917 static void gen_high_BATs(CPUPPCState
*env
)
919 #if !defined(CONFIG_USER_ONLY)
920 spr_register(env
, SPR_IBAT4U
, "IBAT4U",
921 SPR_NOACCESS
, SPR_NOACCESS
,
922 &spr_read_ibat_h
, &spr_write_ibatu_h
,
924 spr_register(env
, SPR_IBAT4L
, "IBAT4L",
925 SPR_NOACCESS
, SPR_NOACCESS
,
926 &spr_read_ibat_h
, &spr_write_ibatl_h
,
928 spr_register(env
, SPR_IBAT5U
, "IBAT5U",
929 SPR_NOACCESS
, SPR_NOACCESS
,
930 &spr_read_ibat_h
, &spr_write_ibatu_h
,
932 spr_register(env
, SPR_IBAT5L
, "IBAT5L",
933 SPR_NOACCESS
, SPR_NOACCESS
,
934 &spr_read_ibat_h
, &spr_write_ibatl_h
,
936 spr_register(env
, SPR_IBAT6U
, "IBAT6U",
937 SPR_NOACCESS
, SPR_NOACCESS
,
938 &spr_read_ibat_h
, &spr_write_ibatu_h
,
940 spr_register(env
, SPR_IBAT6L
, "IBAT6L",
941 SPR_NOACCESS
, SPR_NOACCESS
,
942 &spr_read_ibat_h
, &spr_write_ibatl_h
,
944 spr_register(env
, SPR_IBAT7U
, "IBAT7U",
945 SPR_NOACCESS
, SPR_NOACCESS
,
946 &spr_read_ibat_h
, &spr_write_ibatu_h
,
948 spr_register(env
, SPR_IBAT7L
, "IBAT7L",
949 SPR_NOACCESS
, SPR_NOACCESS
,
950 &spr_read_ibat_h
, &spr_write_ibatl_h
,
952 spr_register(env
, SPR_DBAT4U
, "DBAT4U",
953 SPR_NOACCESS
, SPR_NOACCESS
,
954 &spr_read_dbat_h
, &spr_write_dbatu_h
,
956 spr_register(env
, SPR_DBAT4L
, "DBAT4L",
957 SPR_NOACCESS
, SPR_NOACCESS
,
958 &spr_read_dbat_h
, &spr_write_dbatl_h
,
960 spr_register(env
, SPR_DBAT5U
, "DBAT5U",
961 SPR_NOACCESS
, SPR_NOACCESS
,
962 &spr_read_dbat_h
, &spr_write_dbatu_h
,
964 spr_register(env
, SPR_DBAT5L
, "DBAT5L",
965 SPR_NOACCESS
, SPR_NOACCESS
,
966 &spr_read_dbat_h
, &spr_write_dbatl_h
,
968 spr_register(env
, SPR_DBAT6U
, "DBAT6U",
969 SPR_NOACCESS
, SPR_NOACCESS
,
970 &spr_read_dbat_h
, &spr_write_dbatu_h
,
972 spr_register(env
, SPR_DBAT6L
, "DBAT6L",
973 SPR_NOACCESS
, SPR_NOACCESS
,
974 &spr_read_dbat_h
, &spr_write_dbatl_h
,
976 spr_register(env
, SPR_DBAT7U
, "DBAT7U",
977 SPR_NOACCESS
, SPR_NOACCESS
,
978 &spr_read_dbat_h
, &spr_write_dbatu_h
,
980 spr_register(env
, SPR_DBAT7L
, "DBAT7L",
981 SPR_NOACCESS
, SPR_NOACCESS
,
982 &spr_read_dbat_h
, &spr_write_dbatl_h
,
988 /* Generic PowerPC time base */
989 static void gen_tbl(CPUPPCState
*env
)
991 spr_register(env
, SPR_VTBL
, "TBL",
992 &spr_read_tbl
, SPR_NOACCESS
,
993 &spr_read_tbl
, SPR_NOACCESS
,
995 spr_register(env
, SPR_TBL
, "TBL",
996 &spr_read_tbl
, SPR_NOACCESS
,
997 &spr_read_tbl
, &spr_write_tbl
,
999 spr_register(env
, SPR_VTBU
, "TBU",
1000 &spr_read_tbu
, SPR_NOACCESS
,
1001 &spr_read_tbu
, SPR_NOACCESS
,
1003 spr_register(env
, SPR_TBU
, "TBU",
1004 &spr_read_tbu
, SPR_NOACCESS
,
1005 &spr_read_tbu
, &spr_write_tbu
,
1009 /* Softare table search registers */
1010 static void gen_6xx_7xx_soft_tlb(CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
1012 #if !defined(CONFIG_USER_ONLY)
1013 env
->nb_tlb
= nb_tlbs
;
1014 env
->nb_ways
= nb_ways
;
1016 env
->tlb_type
= TLB_6XX
;
1017 spr_register(env
, SPR_DMISS
, "DMISS",
1018 SPR_NOACCESS
, SPR_NOACCESS
,
1019 &spr_read_generic
, SPR_NOACCESS
,
1021 spr_register(env
, SPR_DCMP
, "DCMP",
1022 SPR_NOACCESS
, SPR_NOACCESS
,
1023 &spr_read_generic
, SPR_NOACCESS
,
1025 spr_register(env
, SPR_HASH1
, "HASH1",
1026 SPR_NOACCESS
, SPR_NOACCESS
,
1027 &spr_read_generic
, SPR_NOACCESS
,
1029 spr_register(env
, SPR_HASH2
, "HASH2",
1030 SPR_NOACCESS
, SPR_NOACCESS
,
1031 &spr_read_generic
, SPR_NOACCESS
,
1033 spr_register(env
, SPR_IMISS
, "IMISS",
1034 SPR_NOACCESS
, SPR_NOACCESS
,
1035 &spr_read_generic
, SPR_NOACCESS
,
1037 spr_register(env
, SPR_ICMP
, "ICMP",
1038 SPR_NOACCESS
, SPR_NOACCESS
,
1039 &spr_read_generic
, SPR_NOACCESS
,
1041 spr_register(env
, SPR_RPA
, "RPA",
1042 SPR_NOACCESS
, SPR_NOACCESS
,
1043 &spr_read_generic
, &spr_write_generic
,
1048 /* SPR common to MPC755 and G2 */
1049 static void gen_spr_G2_755(CPUPPCState
*env
)
1052 spr_register(env
, SPR_SPRG4
, "SPRG4",
1053 SPR_NOACCESS
, SPR_NOACCESS
,
1054 &spr_read_generic
, &spr_write_generic
,
1056 spr_register(env
, SPR_SPRG5
, "SPRG5",
1057 SPR_NOACCESS
, SPR_NOACCESS
,
1058 &spr_read_generic
, &spr_write_generic
,
1060 spr_register(env
, SPR_SPRG6
, "SPRG6",
1061 SPR_NOACCESS
, SPR_NOACCESS
,
1062 &spr_read_generic
, &spr_write_generic
,
1064 spr_register(env
, SPR_SPRG7
, "SPRG7",
1065 SPR_NOACCESS
, SPR_NOACCESS
,
1066 &spr_read_generic
, &spr_write_generic
,
1070 /* SPR common to all 7xx PowerPC implementations */
1071 static void gen_spr_7xx(CPUPPCState
*env
)
1074 /* XXX : not implemented */
1075 spr_register_kvm(env
, SPR_DABR
, "DABR",
1076 SPR_NOACCESS
, SPR_NOACCESS
,
1077 &spr_read_generic
, &spr_write_generic
,
1078 KVM_REG_PPC_DABR
, 0x00000000);
1079 /* XXX : not implemented */
1080 spr_register(env
, SPR_IABR
, "IABR",
1081 SPR_NOACCESS
, SPR_NOACCESS
,
1082 &spr_read_generic
, &spr_write_generic
,
1084 /* Cache management */
1085 /* XXX : not implemented */
1086 spr_register(env
, SPR_ICTC
, "ICTC",
1087 SPR_NOACCESS
, SPR_NOACCESS
,
1088 &spr_read_generic
, &spr_write_generic
,
1090 /* Performance monitors */
1091 /* XXX : not implemented */
1092 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
1093 SPR_NOACCESS
, SPR_NOACCESS
,
1094 &spr_read_generic
, &spr_write_generic
,
1096 /* XXX : not implemented */
1097 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
1098 SPR_NOACCESS
, SPR_NOACCESS
,
1099 &spr_read_generic
, &spr_write_generic
,
1101 /* XXX : not implemented */
1102 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
1103 SPR_NOACCESS
, SPR_NOACCESS
,
1104 &spr_read_generic
, &spr_write_generic
,
1106 /* XXX : not implemented */
1107 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
1108 SPR_NOACCESS
, SPR_NOACCESS
,
1109 &spr_read_generic
, &spr_write_generic
,
1111 /* XXX : not implemented */
1112 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
1113 SPR_NOACCESS
, SPR_NOACCESS
,
1114 &spr_read_generic
, &spr_write_generic
,
1116 /* XXX : not implemented */
1117 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
1118 SPR_NOACCESS
, SPR_NOACCESS
,
1119 &spr_read_generic
, &spr_write_generic
,
1121 /* XXX : not implemented */
1122 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
1123 SPR_NOACCESS
, SPR_NOACCESS
,
1124 &spr_read_generic
, SPR_NOACCESS
,
1126 /* XXX : not implemented */
1127 spr_register(env
, SPR_7XX_UMMCR0
, "UMMCR0",
1128 &spr_read_ureg
, SPR_NOACCESS
,
1129 &spr_read_ureg
, SPR_NOACCESS
,
1131 /* XXX : not implemented */
1132 spr_register(env
, SPR_7XX_UMMCR1
, "UMMCR1",
1133 &spr_read_ureg
, SPR_NOACCESS
,
1134 &spr_read_ureg
, SPR_NOACCESS
,
1136 /* XXX : not implemented */
1137 spr_register(env
, SPR_7XX_UPMC1
, "UPMC1",
1138 &spr_read_ureg
, SPR_NOACCESS
,
1139 &spr_read_ureg
, SPR_NOACCESS
,
1141 /* XXX : not implemented */
1142 spr_register(env
, SPR_7XX_UPMC2
, "UPMC2",
1143 &spr_read_ureg
, SPR_NOACCESS
,
1144 &spr_read_ureg
, SPR_NOACCESS
,
1146 /* XXX : not implemented */
1147 spr_register(env
, SPR_7XX_UPMC3
, "UPMC3",
1148 &spr_read_ureg
, SPR_NOACCESS
,
1149 &spr_read_ureg
, SPR_NOACCESS
,
1151 /* XXX : not implemented */
1152 spr_register(env
, SPR_7XX_UPMC4
, "UPMC4",
1153 &spr_read_ureg
, SPR_NOACCESS
,
1154 &spr_read_ureg
, SPR_NOACCESS
,
1156 /* XXX : not implemented */
1157 spr_register(env
, SPR_7XX_USIAR
, "USIAR",
1158 &spr_read_ureg
, SPR_NOACCESS
,
1159 &spr_read_ureg
, SPR_NOACCESS
,
1161 /* External access control */
1162 /* XXX : not implemented */
1163 spr_register(env
, SPR_EAR
, "EAR",
1164 SPR_NOACCESS
, SPR_NOACCESS
,
1165 &spr_read_generic
, &spr_write_generic
,
1170 #ifndef CONFIG_USER_ONLY
1171 static void spr_write_amr(DisasContext
*ctx
, int sprn
, int gprn
)
1173 TCGv t0
= tcg_temp_new();
1174 TCGv t1
= tcg_temp_new();
1175 TCGv t2
= tcg_temp_new();
1178 * Note, the HV=1 PR=0 case is handled earlier by simply using
1179 * spr_write_generic for HV mode in the SPR table
1182 /* Build insertion mask into t1 based on context */
1184 gen_load_spr(t1
, SPR_UAMOR
);
1186 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_AMR
);
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_AMR
, t0
);
1199 spr_store_dump_spr(SPR_AMR
);
1206 static void spr_write_uamor(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_UAMOR
);
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_UAMOR
, t0
);
1230 spr_store_dump_spr(SPR_UAMOR
);
1237 static void spr_write_iamr(DisasContext
*ctx
, int sprn
, int gprn
)
1239 TCGv t0
= tcg_temp_new();
1240 TCGv t1
= tcg_temp_new();
1241 TCGv t2
= tcg_temp_new();
1244 * Note, the HV=1 case is handled earlier by simply using
1245 * spr_write_generic for HV mode in the SPR table
1248 /* Build insertion mask into t1 based on context */
1249 gen_load_spr(t1
, SPR_AMOR
);
1251 /* Mask new bits into t2 */
1252 tcg_gen_and_tl(t2
, t1
, cpu_gpr
[gprn
]);
1254 /* Load AMR and clear new bits in t0 */
1255 gen_load_spr(t0
, SPR_IAMR
);
1256 tcg_gen_andc_tl(t0
, t0
, t1
);
1258 /* Or'in new bits and write it out */
1259 tcg_gen_or_tl(t0
, t0
, t2
);
1260 gen_store_spr(SPR_IAMR
, t0
);
1261 spr_store_dump_spr(SPR_IAMR
);
1267 #endif /* CONFIG_USER_ONLY */
1269 static void gen_spr_amr(CPUPPCState
*env
)
1271 #ifndef CONFIG_USER_ONLY
1273 * Virtual Page Class Key protection
1275 * The AMR is accessible either via SPR 13 or SPR 29. 13 is
1276 * userspace accessible, 29 is privileged. So we only need to set
1277 * the kvm ONE_REG id on one of them, we use 29
1279 spr_register(env
, SPR_UAMR
, "UAMR",
1280 &spr_read_generic
, &spr_write_amr
,
1281 &spr_read_generic
, &spr_write_amr
,
1283 spr_register_kvm_hv(env
, SPR_AMR
, "AMR",
1284 SPR_NOACCESS
, SPR_NOACCESS
,
1285 &spr_read_generic
, &spr_write_amr
,
1286 &spr_read_generic
, &spr_write_generic
,
1287 KVM_REG_PPC_AMR
, 0);
1288 spr_register_kvm_hv(env
, SPR_UAMOR
, "UAMOR",
1289 SPR_NOACCESS
, SPR_NOACCESS
,
1290 &spr_read_generic
, &spr_write_uamor
,
1291 &spr_read_generic
, &spr_write_generic
,
1292 KVM_REG_PPC_UAMOR
, 0);
1293 spr_register_hv(env
, SPR_AMOR
, "AMOR",
1294 SPR_NOACCESS
, SPR_NOACCESS
,
1295 SPR_NOACCESS
, SPR_NOACCESS
,
1296 &spr_read_generic
, &spr_write_generic
,
1298 #endif /* !CONFIG_USER_ONLY */
1301 static void gen_spr_iamr(CPUPPCState
*env
)
1303 #ifndef CONFIG_USER_ONLY
1304 spr_register_kvm_hv(env
, SPR_IAMR
, "IAMR",
1305 SPR_NOACCESS
, SPR_NOACCESS
,
1306 &spr_read_generic
, &spr_write_iamr
,
1307 &spr_read_generic
, &spr_write_generic
,
1308 KVM_REG_PPC_IAMR
, 0);
1309 #endif /* !CONFIG_USER_ONLY */
1311 #endif /* TARGET_PPC64 */
1313 #ifndef CONFIG_USER_ONLY
1314 static void spr_read_thrm(DisasContext
*ctx
, int gprn
, int sprn
)
1316 gen_helper_fixup_thrm(cpu_env
);
1317 gen_load_spr(cpu_gpr
[gprn
], sprn
);
1318 spr_load_dump_spr(sprn
);
1320 #endif /* !CONFIG_USER_ONLY */
1322 static void gen_spr_thrm(CPUPPCState
*env
)
1324 /* Thermal management */
1325 /* XXX : not implemented */
1326 spr_register(env
, SPR_THRM1
, "THRM1",
1327 SPR_NOACCESS
, SPR_NOACCESS
,
1328 &spr_read_thrm
, &spr_write_generic
,
1330 /* XXX : not implemented */
1331 spr_register(env
, SPR_THRM2
, "THRM2",
1332 SPR_NOACCESS
, SPR_NOACCESS
,
1333 &spr_read_thrm
, &spr_write_generic
,
1335 /* XXX : not implemented */
1336 spr_register(env
, SPR_THRM3
, "THRM3",
1337 SPR_NOACCESS
, SPR_NOACCESS
,
1338 &spr_read_thrm
, &spr_write_generic
,
1342 /* SPR specific to PowerPC 604 implementation */
1343 static void gen_spr_604(CPUPPCState
*env
)
1345 /* Processor identification */
1346 spr_register(env
, SPR_PIR
, "PIR",
1347 SPR_NOACCESS
, SPR_NOACCESS
,
1348 &spr_read_generic
, &spr_write_pir
,
1351 /* XXX : not implemented */
1352 spr_register(env
, SPR_IABR
, "IABR",
1353 SPR_NOACCESS
, SPR_NOACCESS
,
1354 &spr_read_generic
, &spr_write_generic
,
1356 /* XXX : not implemented */
1357 spr_register_kvm(env
, SPR_DABR
, "DABR",
1358 SPR_NOACCESS
, SPR_NOACCESS
,
1359 &spr_read_generic
, &spr_write_generic
,
1360 KVM_REG_PPC_DABR
, 0x00000000);
1361 /* Performance counters */
1362 /* XXX : not implemented */
1363 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
1364 SPR_NOACCESS
, SPR_NOACCESS
,
1365 &spr_read_generic
, &spr_write_generic
,
1367 /* XXX : not implemented */
1368 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
1369 SPR_NOACCESS
, SPR_NOACCESS
,
1370 &spr_read_generic
, &spr_write_generic
,
1372 /* XXX : not implemented */
1373 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
1374 SPR_NOACCESS
, SPR_NOACCESS
,
1375 &spr_read_generic
, &spr_write_generic
,
1377 /* XXX : not implemented */
1378 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
1379 SPR_NOACCESS
, SPR_NOACCESS
,
1380 &spr_read_generic
, SPR_NOACCESS
,
1382 /* XXX : not implemented */
1383 spr_register(env
, SPR_SDA
, "SDA",
1384 SPR_NOACCESS
, SPR_NOACCESS
,
1385 &spr_read_generic
, SPR_NOACCESS
,
1387 /* External access control */
1388 /* XXX : not implemented */
1389 spr_register(env
, SPR_EAR
, "EAR",
1390 SPR_NOACCESS
, SPR_NOACCESS
,
1391 &spr_read_generic
, &spr_write_generic
,
1395 /* SPR specific to PowerPC 603 implementation */
1396 static void gen_spr_603(CPUPPCState
*env
)
1398 /* External access control */
1399 /* XXX : not implemented */
1400 spr_register(env
, SPR_EAR
, "EAR",
1401 SPR_NOACCESS
, SPR_NOACCESS
,
1402 &spr_read_generic
, &spr_write_generic
,
1405 /* XXX : not implemented */
1406 spr_register(env
, SPR_IABR
, "IABR",
1407 SPR_NOACCESS
, SPR_NOACCESS
,
1408 &spr_read_generic
, &spr_write_generic
,
1413 /* SPR specific to PowerPC G2 implementation */
1414 static void gen_spr_G2(CPUPPCState
*env
)
1416 /* Memory base address */
1418 /* XXX : not implemented */
1419 spr_register(env
, SPR_MBAR
, "MBAR",
1420 SPR_NOACCESS
, SPR_NOACCESS
,
1421 &spr_read_generic
, &spr_write_generic
,
1423 /* Exception processing */
1424 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1425 SPR_NOACCESS
, SPR_NOACCESS
,
1426 &spr_read_generic
, &spr_write_generic
,
1428 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1429 SPR_NOACCESS
, SPR_NOACCESS
,
1430 &spr_read_generic
, &spr_write_generic
,
1433 /* XXX : not implemented */
1434 spr_register(env
, SPR_DABR
, "DABR",
1435 SPR_NOACCESS
, SPR_NOACCESS
,
1436 &spr_read_generic
, &spr_write_generic
,
1438 /* XXX : not implemented */
1439 spr_register(env
, SPR_DABR2
, "DABR2",
1440 SPR_NOACCESS
, SPR_NOACCESS
,
1441 &spr_read_generic
, &spr_write_generic
,
1443 /* XXX : not implemented */
1444 spr_register(env
, SPR_IABR
, "IABR",
1445 SPR_NOACCESS
, SPR_NOACCESS
,
1446 &spr_read_generic
, &spr_write_generic
,
1448 /* XXX : not implemented */
1449 spr_register(env
, SPR_IABR2
, "IABR2",
1450 SPR_NOACCESS
, SPR_NOACCESS
,
1451 &spr_read_generic
, &spr_write_generic
,
1453 /* XXX : not implemented */
1454 spr_register(env
, SPR_IBCR
, "IBCR",
1455 SPR_NOACCESS
, SPR_NOACCESS
,
1456 &spr_read_generic
, &spr_write_generic
,
1458 /* XXX : not implemented */
1459 spr_register(env
, SPR_DBCR
, "DBCR",
1460 SPR_NOACCESS
, SPR_NOACCESS
,
1461 &spr_read_generic
, &spr_write_generic
,
1465 /* SPR specific to PowerPC 602 implementation */
1466 static void gen_spr_602(CPUPPCState
*env
)
1469 /* XXX : not implemented */
1470 spr_register(env
, SPR_SER
, "SER",
1471 SPR_NOACCESS
, SPR_NOACCESS
,
1472 &spr_read_generic
, &spr_write_generic
,
1474 /* XXX : not implemented */
1475 spr_register(env
, SPR_SEBR
, "SEBR",
1476 SPR_NOACCESS
, SPR_NOACCESS
,
1477 &spr_read_generic
, &spr_write_generic
,
1479 /* XXX : not implemented */
1480 spr_register(env
, SPR_ESASRR
, "ESASRR",
1481 SPR_NOACCESS
, SPR_NOACCESS
,
1482 &spr_read_generic
, &spr_write_generic
,
1484 /* Floating point status */
1485 /* XXX : not implemented */
1486 spr_register(env
, SPR_SP
, "SP",
1487 SPR_NOACCESS
, SPR_NOACCESS
,
1488 &spr_read_generic
, &spr_write_generic
,
1490 /* XXX : not implemented */
1491 spr_register(env
, SPR_LT
, "LT",
1492 SPR_NOACCESS
, SPR_NOACCESS
,
1493 &spr_read_generic
, &spr_write_generic
,
1495 /* Watchdog timer */
1496 /* XXX : not implemented */
1497 spr_register(env
, SPR_TCR
, "TCR",
1498 SPR_NOACCESS
, SPR_NOACCESS
,
1499 &spr_read_generic
, &spr_write_generic
,
1501 /* Interrupt base */
1502 spr_register(env
, SPR_IBR
, "IBR",
1503 SPR_NOACCESS
, SPR_NOACCESS
,
1504 &spr_read_generic
, &spr_write_generic
,
1506 /* XXX : not implemented */
1507 spr_register(env
, SPR_IABR
, "IABR",
1508 SPR_NOACCESS
, SPR_NOACCESS
,
1509 &spr_read_generic
, &spr_write_generic
,
1513 /* SPR specific to PowerPC 601 implementation */
1514 static void gen_spr_601(CPUPPCState
*env
)
1516 /* Multiplication/division register */
1518 spr_register(env
, SPR_MQ
, "MQ",
1519 &spr_read_generic
, &spr_write_generic
,
1520 &spr_read_generic
, &spr_write_generic
,
1523 spr_register(env
, SPR_601_RTCU
, "RTCU",
1524 SPR_NOACCESS
, SPR_NOACCESS
,
1525 SPR_NOACCESS
, &spr_write_601_rtcu
,
1527 spr_register(env
, SPR_601_VRTCU
, "RTCU",
1528 &spr_read_601_rtcu
, SPR_NOACCESS
,
1529 &spr_read_601_rtcu
, SPR_NOACCESS
,
1531 spr_register(env
, SPR_601_RTCL
, "RTCL",
1532 SPR_NOACCESS
, SPR_NOACCESS
,
1533 SPR_NOACCESS
, &spr_write_601_rtcl
,
1535 spr_register(env
, SPR_601_VRTCL
, "RTCL",
1536 &spr_read_601_rtcl
, SPR_NOACCESS
,
1537 &spr_read_601_rtcl
, SPR_NOACCESS
,
1541 spr_register(env
, SPR_601_UDECR
, "UDECR",
1542 &spr_read_decr
, SPR_NOACCESS
,
1543 &spr_read_decr
, SPR_NOACCESS
,
1546 /* External access control */
1547 /* XXX : not implemented */
1548 spr_register(env
, SPR_EAR
, "EAR",
1549 SPR_NOACCESS
, SPR_NOACCESS
,
1550 &spr_read_generic
, &spr_write_generic
,
1552 /* Memory management */
1553 #if !defined(CONFIG_USER_ONLY)
1554 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
1555 SPR_NOACCESS
, SPR_NOACCESS
,
1556 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1558 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
1559 SPR_NOACCESS
, SPR_NOACCESS
,
1560 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1562 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
1563 SPR_NOACCESS
, SPR_NOACCESS
,
1564 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1566 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
1567 SPR_NOACCESS
, SPR_NOACCESS
,
1568 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1570 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
1571 SPR_NOACCESS
, SPR_NOACCESS
,
1572 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1574 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
1575 SPR_NOACCESS
, SPR_NOACCESS
,
1576 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1578 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
1579 SPR_NOACCESS
, SPR_NOACCESS
,
1580 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1582 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
1583 SPR_NOACCESS
, SPR_NOACCESS
,
1584 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1590 static void gen_spr_74xx(CPUPPCState
*env
)
1592 /* Processor identification */
1593 spr_register(env
, SPR_PIR
, "PIR",
1594 SPR_NOACCESS
, SPR_NOACCESS
,
1595 &spr_read_generic
, &spr_write_pir
,
1597 /* XXX : not implemented */
1598 spr_register(env
, SPR_74XX_MMCR2
, "MMCR2",
1599 SPR_NOACCESS
, SPR_NOACCESS
,
1600 &spr_read_generic
, &spr_write_generic
,
1602 /* XXX : not implemented */
1603 spr_register(env
, SPR_74XX_UMMCR2
, "UMMCR2",
1604 &spr_read_ureg
, SPR_NOACCESS
,
1605 &spr_read_ureg
, SPR_NOACCESS
,
1607 /* XXX: not implemented */
1608 spr_register(env
, SPR_BAMR
, "BAMR",
1609 SPR_NOACCESS
, SPR_NOACCESS
,
1610 &spr_read_generic
, &spr_write_generic
,
1612 /* XXX : not implemented */
1613 spr_register(env
, SPR_MSSCR0
, "MSSCR0",
1614 SPR_NOACCESS
, SPR_NOACCESS
,
1615 &spr_read_generic
, &spr_write_generic
,
1617 /* Hardware implementation registers */
1618 /* XXX : not implemented */
1619 spr_register(env
, SPR_HID0
, "HID0",
1620 SPR_NOACCESS
, SPR_NOACCESS
,
1621 &spr_read_generic
, &spr_write_generic
,
1623 /* XXX : not implemented */
1624 spr_register(env
, SPR_HID1
, "HID1",
1625 SPR_NOACCESS
, SPR_NOACCESS
,
1626 &spr_read_generic
, &spr_write_generic
,
1629 spr_register(env
, SPR_VRSAVE
, "VRSAVE",
1630 &spr_read_generic
, &spr_write_generic
,
1631 &spr_read_generic
, &spr_write_generic
,
1633 /* XXX : not implemented */
1634 spr_register(env
, SPR_L2CR
, "L2CR",
1635 SPR_NOACCESS
, SPR_NOACCESS
,
1636 &spr_read_generic
, spr_access_nop
,
1638 /* Not strictly an SPR */
1639 vscr_init(env
, 0x00010000);
1642 static void gen_l3_ctrl(CPUPPCState
*env
)
1645 /* XXX : not implemented */
1646 spr_register(env
, SPR_L3CR
, "L3CR",
1647 SPR_NOACCESS
, SPR_NOACCESS
,
1648 &spr_read_generic
, &spr_write_generic
,
1651 /* XXX : not implemented */
1652 spr_register(env
, SPR_L3ITCR0
, "L3ITCR0",
1653 SPR_NOACCESS
, SPR_NOACCESS
,
1654 &spr_read_generic
, &spr_write_generic
,
1657 /* XXX : not implemented */
1658 spr_register(env
, SPR_L3PM
, "L3PM",
1659 SPR_NOACCESS
, SPR_NOACCESS
,
1660 &spr_read_generic
, &spr_write_generic
,
1664 static void gen_74xx_soft_tlb(CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
1666 #if !defined(CONFIG_USER_ONLY)
1667 env
->nb_tlb
= nb_tlbs
;
1668 env
->nb_ways
= nb_ways
;
1670 env
->tlb_type
= TLB_6XX
;
1671 /* XXX : not implemented */
1672 spr_register(env
, SPR_PTEHI
, "PTEHI",
1673 SPR_NOACCESS
, SPR_NOACCESS
,
1674 &spr_read_generic
, &spr_write_generic
,
1676 /* XXX : not implemented */
1677 spr_register(env
, SPR_PTELO
, "PTELO",
1678 SPR_NOACCESS
, SPR_NOACCESS
,
1679 &spr_read_generic
, &spr_write_generic
,
1681 /* XXX : not implemented */
1682 spr_register(env
, SPR_TLBMISS
, "TLBMISS",
1683 SPR_NOACCESS
, SPR_NOACCESS
,
1684 &spr_read_generic
, &spr_write_generic
,
1689 #if !defined(CONFIG_USER_ONLY)
1690 static void spr_write_e500_l1csr0(DisasContext
*ctx
, int sprn
, int gprn
)
1692 TCGv t0
= tcg_temp_new();
1694 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR0_DCE
| L1CSR0_CPE
);
1695 gen_store_spr(sprn
, t0
);
1699 static void spr_write_e500_l1csr1(DisasContext
*ctx
, int sprn
, int gprn
)
1701 TCGv t0
= tcg_temp_new();
1703 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR1_ICE
| L1CSR1_CPE
);
1704 gen_store_spr(sprn
, t0
);
1708 static void spr_write_booke206_mmucsr0(DisasContext
*ctx
, int sprn
, int gprn
)
1710 gen_helper_booke206_tlbflush(cpu_env
, cpu_gpr
[gprn
]);
1713 static void spr_write_booke_pid(DisasContext
*ctx
, int sprn
, int gprn
)
1715 TCGv_i32 t0
= tcg_const_i32(sprn
);
1716 gen_helper_booke_setpid(cpu_env
, t0
, cpu_gpr
[gprn
]);
1717 tcg_temp_free_i32(t0
);
1719 static void spr_write_eplc(DisasContext
*ctx
, int sprn
, int gprn
)
1721 gen_helper_booke_set_eplc(cpu_env
, cpu_gpr
[gprn
]);
1723 static void spr_write_epsc(DisasContext
*ctx
, int sprn
, int gprn
)
1725 gen_helper_booke_set_epsc(cpu_env
, cpu_gpr
[gprn
]);
1730 static void gen_spr_usprg3(CPUPPCState
*env
)
1732 spr_register(env
, SPR_USPRG3
, "USPRG3",
1733 &spr_read_ureg
, SPR_NOACCESS
,
1734 &spr_read_ureg
, SPR_NOACCESS
,
1738 static void gen_spr_usprgh(CPUPPCState
*env
)
1740 spr_register(env
, SPR_USPRG4
, "USPRG4",
1741 &spr_read_ureg
, SPR_NOACCESS
,
1742 &spr_read_ureg
, SPR_NOACCESS
,
1744 spr_register(env
, SPR_USPRG5
, "USPRG5",
1745 &spr_read_ureg
, SPR_NOACCESS
,
1746 &spr_read_ureg
, SPR_NOACCESS
,
1748 spr_register(env
, SPR_USPRG6
, "USPRG6",
1749 &spr_read_ureg
, SPR_NOACCESS
,
1750 &spr_read_ureg
, SPR_NOACCESS
,
1752 spr_register(env
, SPR_USPRG7
, "USPRG7",
1753 &spr_read_ureg
, SPR_NOACCESS
,
1754 &spr_read_ureg
, SPR_NOACCESS
,
1758 /* PowerPC BookE SPR */
1759 static void gen_spr_BookE(CPUPPCState
*env
, uint64_t ivor_mask
)
1761 const char *ivor_names
[64] = {
1762 "IVOR0", "IVOR1", "IVOR2", "IVOR3",
1763 "IVOR4", "IVOR5", "IVOR6", "IVOR7",
1764 "IVOR8", "IVOR9", "IVOR10", "IVOR11",
1765 "IVOR12", "IVOR13", "IVOR14", "IVOR15",
1766 "IVOR16", "IVOR17", "IVOR18", "IVOR19",
1767 "IVOR20", "IVOR21", "IVOR22", "IVOR23",
1768 "IVOR24", "IVOR25", "IVOR26", "IVOR27",
1769 "IVOR28", "IVOR29", "IVOR30", "IVOR31",
1770 "IVOR32", "IVOR33", "IVOR34", "IVOR35",
1771 "IVOR36", "IVOR37", "IVOR38", "IVOR39",
1772 "IVOR40", "IVOR41", "IVOR42", "IVOR43",
1773 "IVOR44", "IVOR45", "IVOR46", "IVOR47",
1774 "IVOR48", "IVOR49", "IVOR50", "IVOR51",
1775 "IVOR52", "IVOR53", "IVOR54", "IVOR55",
1776 "IVOR56", "IVOR57", "IVOR58", "IVOR59",
1777 "IVOR60", "IVOR61", "IVOR62", "IVOR63",
1779 #define SPR_BOOKE_IVORxx (-1)
1780 int ivor_sprn
[64] = {
1781 SPR_BOOKE_IVOR0
, SPR_BOOKE_IVOR1
, SPR_BOOKE_IVOR2
, SPR_BOOKE_IVOR3
,
1782 SPR_BOOKE_IVOR4
, SPR_BOOKE_IVOR5
, SPR_BOOKE_IVOR6
, SPR_BOOKE_IVOR7
,
1783 SPR_BOOKE_IVOR8
, SPR_BOOKE_IVOR9
, SPR_BOOKE_IVOR10
, SPR_BOOKE_IVOR11
,
1784 SPR_BOOKE_IVOR12
, SPR_BOOKE_IVOR13
, SPR_BOOKE_IVOR14
, SPR_BOOKE_IVOR15
,
1785 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1786 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1787 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1788 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1789 SPR_BOOKE_IVOR32
, SPR_BOOKE_IVOR33
, SPR_BOOKE_IVOR34
, SPR_BOOKE_IVOR35
,
1790 SPR_BOOKE_IVOR36
, SPR_BOOKE_IVOR37
, SPR_BOOKE_IVOR38
, SPR_BOOKE_IVOR39
,
1791 SPR_BOOKE_IVOR40
, SPR_BOOKE_IVOR41
, SPR_BOOKE_IVOR42
, SPR_BOOKE_IVORxx
,
1792 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1793 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1794 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1795 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1796 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1800 /* Interrupt processing */
1801 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1802 SPR_NOACCESS
, SPR_NOACCESS
,
1803 &spr_read_generic
, &spr_write_generic
,
1805 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1806 SPR_NOACCESS
, SPR_NOACCESS
,
1807 &spr_read_generic
, &spr_write_generic
,
1810 /* XXX : not implemented */
1811 spr_register(env
, SPR_BOOKE_IAC1
, "IAC1",
1812 SPR_NOACCESS
, SPR_NOACCESS
,
1813 &spr_read_generic
, &spr_write_generic
,
1815 /* XXX : not implemented */
1816 spr_register(env
, SPR_BOOKE_IAC2
, "IAC2",
1817 SPR_NOACCESS
, SPR_NOACCESS
,
1818 &spr_read_generic
, &spr_write_generic
,
1820 /* XXX : not implemented */
1821 spr_register(env
, SPR_BOOKE_DAC1
, "DAC1",
1822 SPR_NOACCESS
, SPR_NOACCESS
,
1823 &spr_read_generic
, &spr_write_generic
,
1825 /* XXX : not implemented */
1826 spr_register(env
, SPR_BOOKE_DAC2
, "DAC2",
1827 SPR_NOACCESS
, SPR_NOACCESS
,
1828 &spr_read_generic
, &spr_write_generic
,
1830 /* XXX : not implemented */
1831 spr_register(env
, SPR_BOOKE_DBCR0
, "DBCR0",
1832 SPR_NOACCESS
, SPR_NOACCESS
,
1833 &spr_read_generic
, &spr_write_40x_dbcr0
,
1835 /* XXX : not implemented */
1836 spr_register(env
, SPR_BOOKE_DBCR1
, "DBCR1",
1837 SPR_NOACCESS
, SPR_NOACCESS
,
1838 &spr_read_generic
, &spr_write_generic
,
1840 /* XXX : not implemented */
1841 spr_register(env
, SPR_BOOKE_DBCR2
, "DBCR2",
1842 SPR_NOACCESS
, SPR_NOACCESS
,
1843 &spr_read_generic
, &spr_write_generic
,
1845 spr_register(env
, SPR_BOOKE_DSRR0
, "DSRR0",
1846 SPR_NOACCESS
, SPR_NOACCESS
,
1847 &spr_read_generic
, &spr_write_generic
,
1849 spr_register(env
, SPR_BOOKE_DSRR1
, "DSRR1",
1850 SPR_NOACCESS
, SPR_NOACCESS
,
1851 &spr_read_generic
, &spr_write_generic
,
1853 /* XXX : not implemented */
1854 spr_register(env
, SPR_BOOKE_DBSR
, "DBSR",
1855 SPR_NOACCESS
, SPR_NOACCESS
,
1856 &spr_read_generic
, &spr_write_clear
,
1858 spr_register(env
, SPR_BOOKE_DEAR
, "DEAR",
1859 SPR_NOACCESS
, SPR_NOACCESS
,
1860 &spr_read_generic
, &spr_write_generic
,
1862 spr_register(env
, SPR_BOOKE_ESR
, "ESR",
1863 SPR_NOACCESS
, SPR_NOACCESS
,
1864 &spr_read_generic
, &spr_write_generic
,
1866 spr_register(env
, SPR_BOOKE_IVPR
, "IVPR",
1867 SPR_NOACCESS
, SPR_NOACCESS
,
1868 &spr_read_generic
, &spr_write_excp_prefix
,
1870 /* Exception vectors */
1871 for (i
= 0; i
< 64; i
++) {
1872 if (ivor_mask
& (1ULL << i
)) {
1873 if (ivor_sprn
[i
] == SPR_BOOKE_IVORxx
) {
1874 fprintf(stderr
, "ERROR: IVOR %d SPR is not defined\n", i
);
1877 spr_register(env
, ivor_sprn
[i
], ivor_names
[i
],
1878 SPR_NOACCESS
, SPR_NOACCESS
,
1879 &spr_read_generic
, &spr_write_excp_vector
,
1883 spr_register(env
, SPR_BOOKE_PID
, "PID",
1884 SPR_NOACCESS
, SPR_NOACCESS
,
1885 &spr_read_generic
, &spr_write_booke_pid
,
1887 spr_register(env
, SPR_BOOKE_TCR
, "TCR",
1888 SPR_NOACCESS
, SPR_NOACCESS
,
1889 &spr_read_generic
, &spr_write_booke_tcr
,
1891 spr_register(env
, SPR_BOOKE_TSR
, "TSR",
1892 SPR_NOACCESS
, SPR_NOACCESS
,
1893 &spr_read_generic
, &spr_write_booke_tsr
,
1896 spr_register(env
, SPR_DECR
, "DECR",
1897 SPR_NOACCESS
, SPR_NOACCESS
,
1898 &spr_read_decr
, &spr_write_decr
,
1900 spr_register(env
, SPR_BOOKE_DECAR
, "DECAR",
1901 SPR_NOACCESS
, SPR_NOACCESS
,
1902 SPR_NOACCESS
, &spr_write_generic
,
1905 spr_register(env
, SPR_USPRG0
, "USPRG0",
1906 &spr_read_generic
, &spr_write_generic
,
1907 &spr_read_generic
, &spr_write_generic
,
1909 spr_register(env
, SPR_SPRG4
, "SPRG4",
1910 SPR_NOACCESS
, SPR_NOACCESS
,
1911 &spr_read_generic
, &spr_write_generic
,
1913 spr_register(env
, SPR_SPRG5
, "SPRG5",
1914 SPR_NOACCESS
, SPR_NOACCESS
,
1915 &spr_read_generic
, &spr_write_generic
,
1917 spr_register(env
, SPR_SPRG6
, "SPRG6",
1918 SPR_NOACCESS
, SPR_NOACCESS
,
1919 &spr_read_generic
, &spr_write_generic
,
1921 spr_register(env
, SPR_SPRG7
, "SPRG7",
1922 SPR_NOACCESS
, SPR_NOACCESS
,
1923 &spr_read_generic
, &spr_write_generic
,
1925 spr_register(env
, SPR_BOOKE_SPRG8
, "SPRG8",
1926 SPR_NOACCESS
, SPR_NOACCESS
,
1927 &spr_read_generic
, &spr_write_generic
,
1929 spr_register(env
, SPR_BOOKE_SPRG9
, "SPRG9",
1930 SPR_NOACCESS
, SPR_NOACCESS
,
1931 &spr_read_generic
, &spr_write_generic
,
1935 static inline uint32_t gen_tlbncfg(uint32_t assoc
, uint32_t minsize
,
1936 uint32_t maxsize
, uint32_t flags
,
1939 return (assoc
<< TLBnCFG_ASSOC_SHIFT
) |
1940 (minsize
<< TLBnCFG_MINSIZE_SHIFT
) |
1941 (maxsize
<< TLBnCFG_MAXSIZE_SHIFT
) |
1945 /* BookE 2.06 storage control registers */
1946 static void gen_spr_BookE206(CPUPPCState
*env
, uint32_t mas_mask
,
1947 uint32_t *tlbncfg
, uint32_t mmucfg
)
1949 #if !defined(CONFIG_USER_ONLY)
1950 const char *mas_names
[8] = {
1951 "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
1954 SPR_BOOKE_MAS0
, SPR_BOOKE_MAS1
, SPR_BOOKE_MAS2
, SPR_BOOKE_MAS3
,
1955 SPR_BOOKE_MAS4
, SPR_BOOKE_MAS5
, SPR_BOOKE_MAS6
, SPR_BOOKE_MAS7
,
1959 /* TLB assist registers */
1960 /* XXX : not implemented */
1961 for (i
= 0; i
< 8; i
++) {
1962 void (*uea_write
)(DisasContext
*ctx
, int sprn
, int gprn
) =
1963 &spr_write_generic32
;
1964 if (i
== 2 && (mas_mask
& (1 << i
)) && (env
->insns_flags
& PPC_64B
)) {
1965 uea_write
= &spr_write_generic
;
1967 if (mas_mask
& (1 << i
)) {
1968 spr_register(env
, mas_sprn
[i
], mas_names
[i
],
1969 SPR_NOACCESS
, SPR_NOACCESS
,
1970 &spr_read_generic
, uea_write
,
1974 if (env
->nb_pids
> 1) {
1975 /* XXX : not implemented */
1976 spr_register(env
, SPR_BOOKE_PID1
, "PID1",
1977 SPR_NOACCESS
, SPR_NOACCESS
,
1978 &spr_read_generic
, &spr_write_booke_pid
,
1981 if (env
->nb_pids
> 2) {
1982 /* XXX : not implemented */
1983 spr_register(env
, SPR_BOOKE_PID2
, "PID2",
1984 SPR_NOACCESS
, SPR_NOACCESS
,
1985 &spr_read_generic
, &spr_write_booke_pid
,
1989 spr_register(env
, SPR_BOOKE_EPLC
, "EPLC",
1990 SPR_NOACCESS
, SPR_NOACCESS
,
1991 &spr_read_generic
, &spr_write_eplc
,
1993 spr_register(env
, SPR_BOOKE_EPSC
, "EPSC",
1994 SPR_NOACCESS
, SPR_NOACCESS
,
1995 &spr_read_generic
, &spr_write_epsc
,
1998 /* XXX : not implemented */
1999 spr_register(env
, SPR_MMUCFG
, "MMUCFG",
2000 SPR_NOACCESS
, SPR_NOACCESS
,
2001 &spr_read_generic
, SPR_NOACCESS
,
2003 switch (env
->nb_ways
) {
2005 spr_register(env
, SPR_BOOKE_TLB3CFG
, "TLB3CFG",
2006 SPR_NOACCESS
, SPR_NOACCESS
,
2007 &spr_read_generic
, SPR_NOACCESS
,
2011 spr_register(env
, SPR_BOOKE_TLB2CFG
, "TLB2CFG",
2012 SPR_NOACCESS
, SPR_NOACCESS
,
2013 &spr_read_generic
, SPR_NOACCESS
,
2017 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
2018 SPR_NOACCESS
, SPR_NOACCESS
,
2019 &spr_read_generic
, SPR_NOACCESS
,
2023 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
2024 SPR_NOACCESS
, SPR_NOACCESS
,
2025 &spr_read_generic
, SPR_NOACCESS
,
2034 gen_spr_usprgh(env
);
2037 /* SPR specific to PowerPC 440 implementation */
2038 static void gen_spr_440(CPUPPCState
*env
)
2041 /* XXX : not implemented */
2042 spr_register(env
, SPR_440_DNV0
, "DNV0",
2043 SPR_NOACCESS
, SPR_NOACCESS
,
2044 &spr_read_generic
, &spr_write_generic
,
2046 /* XXX : not implemented */
2047 spr_register(env
, SPR_440_DNV1
, "DNV1",
2048 SPR_NOACCESS
, SPR_NOACCESS
,
2049 &spr_read_generic
, &spr_write_generic
,
2051 /* XXX : not implemented */
2052 spr_register(env
, SPR_440_DNV2
, "DNV2",
2053 SPR_NOACCESS
, SPR_NOACCESS
,
2054 &spr_read_generic
, &spr_write_generic
,
2056 /* XXX : not implemented */
2057 spr_register(env
, SPR_440_DNV3
, "DNV3",
2058 SPR_NOACCESS
, SPR_NOACCESS
,
2059 &spr_read_generic
, &spr_write_generic
,
2061 /* XXX : not implemented */
2062 spr_register(env
, SPR_440_DTV0
, "DTV0",
2063 SPR_NOACCESS
, SPR_NOACCESS
,
2064 &spr_read_generic
, &spr_write_generic
,
2066 /* XXX : not implemented */
2067 spr_register(env
, SPR_440_DTV1
, "DTV1",
2068 SPR_NOACCESS
, SPR_NOACCESS
,
2069 &spr_read_generic
, &spr_write_generic
,
2071 /* XXX : not implemented */
2072 spr_register(env
, SPR_440_DTV2
, "DTV2",
2073 SPR_NOACCESS
, SPR_NOACCESS
,
2074 &spr_read_generic
, &spr_write_generic
,
2076 /* XXX : not implemented */
2077 spr_register(env
, SPR_440_DTV3
, "DTV3",
2078 SPR_NOACCESS
, SPR_NOACCESS
,
2079 &spr_read_generic
, &spr_write_generic
,
2081 /* XXX : not implemented */
2082 spr_register(env
, SPR_440_DVLIM
, "DVLIM",
2083 SPR_NOACCESS
, SPR_NOACCESS
,
2084 &spr_read_generic
, &spr_write_generic
,
2086 /* XXX : not implemented */
2087 spr_register(env
, SPR_440_INV0
, "INV0",
2088 SPR_NOACCESS
, SPR_NOACCESS
,
2089 &spr_read_generic
, &spr_write_generic
,
2091 /* XXX : not implemented */
2092 spr_register(env
, SPR_440_INV1
, "INV1",
2093 SPR_NOACCESS
, SPR_NOACCESS
,
2094 &spr_read_generic
, &spr_write_generic
,
2096 /* XXX : not implemented */
2097 spr_register(env
, SPR_440_INV2
, "INV2",
2098 SPR_NOACCESS
, SPR_NOACCESS
,
2099 &spr_read_generic
, &spr_write_generic
,
2101 /* XXX : not implemented */
2102 spr_register(env
, SPR_440_INV3
, "INV3",
2103 SPR_NOACCESS
, SPR_NOACCESS
,
2104 &spr_read_generic
, &spr_write_generic
,
2106 /* XXX : not implemented */
2107 spr_register(env
, SPR_440_ITV0
, "ITV0",
2108 SPR_NOACCESS
, SPR_NOACCESS
,
2109 &spr_read_generic
, &spr_write_generic
,
2111 /* XXX : not implemented */
2112 spr_register(env
, SPR_440_ITV1
, "ITV1",
2113 SPR_NOACCESS
, SPR_NOACCESS
,
2114 &spr_read_generic
, &spr_write_generic
,
2116 /* XXX : not implemented */
2117 spr_register(env
, SPR_440_ITV2
, "ITV2",
2118 SPR_NOACCESS
, SPR_NOACCESS
,
2119 &spr_read_generic
, &spr_write_generic
,
2121 /* XXX : not implemented */
2122 spr_register(env
, SPR_440_ITV3
, "ITV3",
2123 SPR_NOACCESS
, SPR_NOACCESS
,
2124 &spr_read_generic
, &spr_write_generic
,
2126 /* XXX : not implemented */
2127 spr_register(env
, SPR_440_IVLIM
, "IVLIM",
2128 SPR_NOACCESS
, SPR_NOACCESS
,
2129 &spr_read_generic
, &spr_write_generic
,
2132 /* XXX : not implemented */
2133 spr_register(env
, SPR_BOOKE_DCDBTRH
, "DCDBTRH",
2134 SPR_NOACCESS
, SPR_NOACCESS
,
2135 &spr_read_generic
, SPR_NOACCESS
,
2137 /* XXX : not implemented */
2138 spr_register(env
, SPR_BOOKE_DCDBTRL
, "DCDBTRL",
2139 SPR_NOACCESS
, SPR_NOACCESS
,
2140 &spr_read_generic
, SPR_NOACCESS
,
2142 /* XXX : not implemented */
2143 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
2144 SPR_NOACCESS
, SPR_NOACCESS
,
2145 &spr_read_generic
, SPR_NOACCESS
,
2147 /* XXX : not implemented */
2148 spr_register(env
, SPR_BOOKE_ICDBTRH
, "ICDBTRH",
2149 SPR_NOACCESS
, SPR_NOACCESS
,
2150 &spr_read_generic
, SPR_NOACCESS
,
2152 /* XXX : not implemented */
2153 spr_register(env
, SPR_BOOKE_ICDBTRL
, "ICDBTRL",
2154 SPR_NOACCESS
, SPR_NOACCESS
,
2155 &spr_read_generic
, SPR_NOACCESS
,
2157 /* XXX : not implemented */
2158 spr_register(env
, SPR_440_DBDR
, "DBDR",
2159 SPR_NOACCESS
, SPR_NOACCESS
,
2160 &spr_read_generic
, &spr_write_generic
,
2162 /* Processor control */
2163 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
2164 SPR_NOACCESS
, SPR_NOACCESS
,
2165 &spr_read_generic
, &spr_write_generic
,
2167 spr_register(env
, SPR_440_RSTCFG
, "RSTCFG",
2168 SPR_NOACCESS
, SPR_NOACCESS
,
2169 &spr_read_generic
, SPR_NOACCESS
,
2171 /* Storage control */
2172 spr_register(env
, SPR_440_MMUCR
, "MMUCR",
2173 SPR_NOACCESS
, SPR_NOACCESS
,
2174 &spr_read_generic
, &spr_write_generic
,
2178 /* SPR shared between PowerPC 40x implementations */
2179 static void gen_spr_40x(CPUPPCState
*env
)
2182 /* not emulated, as QEMU do not emulate caches */
2183 spr_register(env
, SPR_40x_DCCR
, "DCCR",
2184 SPR_NOACCESS
, SPR_NOACCESS
,
2185 &spr_read_generic
, &spr_write_generic
,
2187 /* not emulated, as QEMU do not emulate caches */
2188 spr_register(env
, SPR_40x_ICCR
, "ICCR",
2189 SPR_NOACCESS
, SPR_NOACCESS
,
2190 &spr_read_generic
, &spr_write_generic
,
2192 /* not emulated, as QEMU do not emulate caches */
2193 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
2194 SPR_NOACCESS
, SPR_NOACCESS
,
2195 &spr_read_generic
, SPR_NOACCESS
,
2198 spr_register(env
, SPR_40x_DEAR
, "DEAR",
2199 SPR_NOACCESS
, SPR_NOACCESS
,
2200 &spr_read_generic
, &spr_write_generic
,
2202 spr_register(env
, SPR_40x_ESR
, "ESR",
2203 SPR_NOACCESS
, SPR_NOACCESS
,
2204 &spr_read_generic
, &spr_write_generic
,
2206 spr_register(env
, SPR_40x_EVPR
, "EVPR",
2207 SPR_NOACCESS
, SPR_NOACCESS
,
2208 &spr_read_generic
, &spr_write_excp_prefix
,
2210 spr_register(env
, SPR_40x_SRR2
, "SRR2",
2211 &spr_read_generic
, &spr_write_generic
,
2212 &spr_read_generic
, &spr_write_generic
,
2214 spr_register(env
, SPR_40x_SRR3
, "SRR3",
2215 &spr_read_generic
, &spr_write_generic
,
2216 &spr_read_generic
, &spr_write_generic
,
2219 spr_register(env
, SPR_40x_PIT
, "PIT",
2220 SPR_NOACCESS
, SPR_NOACCESS
,
2221 &spr_read_40x_pit
, &spr_write_40x_pit
,
2223 spr_register(env
, SPR_40x_TCR
, "TCR",
2224 SPR_NOACCESS
, SPR_NOACCESS
,
2225 &spr_read_generic
, &spr_write_booke_tcr
,
2227 spr_register(env
, SPR_40x_TSR
, "TSR",
2228 SPR_NOACCESS
, SPR_NOACCESS
,
2229 &spr_read_generic
, &spr_write_booke_tsr
,
2233 /* SPR specific to PowerPC 405 implementation */
2234 static void gen_spr_405(CPUPPCState
*env
)
2237 spr_register(env
, SPR_40x_PID
, "PID",
2238 SPR_NOACCESS
, SPR_NOACCESS
,
2239 &spr_read_generic
, &spr_write_generic
,
2241 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
2242 SPR_NOACCESS
, SPR_NOACCESS
,
2243 &spr_read_generic
, &spr_write_generic
,
2245 /* Debug interface */
2246 /* XXX : not implemented */
2247 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2248 SPR_NOACCESS
, SPR_NOACCESS
,
2249 &spr_read_generic
, &spr_write_40x_dbcr0
,
2251 /* XXX : not implemented */
2252 spr_register(env
, SPR_405_DBCR1
, "DBCR1",
2253 SPR_NOACCESS
, SPR_NOACCESS
,
2254 &spr_read_generic
, &spr_write_generic
,
2256 /* XXX : not implemented */
2257 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2258 SPR_NOACCESS
, SPR_NOACCESS
,
2259 &spr_read_generic
, &spr_write_clear
,
2260 /* Last reset was system reset */
2262 /* XXX : not implemented */
2263 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2264 SPR_NOACCESS
, SPR_NOACCESS
,
2265 &spr_read_generic
, &spr_write_generic
,
2267 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2268 SPR_NOACCESS
, SPR_NOACCESS
,
2269 &spr_read_generic
, &spr_write_generic
,
2271 /* XXX : not implemented */
2272 spr_register(env
, SPR_405_DVC1
, "DVC1",
2273 SPR_NOACCESS
, SPR_NOACCESS
,
2274 &spr_read_generic
, &spr_write_generic
,
2276 /* XXX : not implemented */
2277 spr_register(env
, SPR_405_DVC2
, "DVC2",
2278 SPR_NOACCESS
, SPR_NOACCESS
,
2279 &spr_read_generic
, &spr_write_generic
,
2281 /* XXX : not implemented */
2282 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2283 SPR_NOACCESS
, SPR_NOACCESS
,
2284 &spr_read_generic
, &spr_write_generic
,
2286 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2287 SPR_NOACCESS
, SPR_NOACCESS
,
2288 &spr_read_generic
, &spr_write_generic
,
2290 /* XXX : not implemented */
2291 spr_register(env
, SPR_405_IAC3
, "IAC3",
2292 SPR_NOACCESS
, SPR_NOACCESS
,
2293 &spr_read_generic
, &spr_write_generic
,
2295 /* XXX : not implemented */
2296 spr_register(env
, SPR_405_IAC4
, "IAC4",
2297 SPR_NOACCESS
, SPR_NOACCESS
,
2298 &spr_read_generic
, &spr_write_generic
,
2300 /* Storage control */
2301 /* XXX: TODO: not implemented */
2302 spr_register(env
, SPR_405_SLER
, "SLER",
2303 SPR_NOACCESS
, SPR_NOACCESS
,
2304 &spr_read_generic
, &spr_write_40x_sler
,
2306 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2307 SPR_NOACCESS
, SPR_NOACCESS
,
2308 &spr_read_generic
, &spr_write_generic
,
2310 /* XXX : not implemented */
2311 spr_register(env
, SPR_405_SU0R
, "SU0R",
2312 SPR_NOACCESS
, SPR_NOACCESS
,
2313 &spr_read_generic
, &spr_write_generic
,
2316 spr_register(env
, SPR_USPRG0
, "USPRG0",
2317 &spr_read_ureg
, SPR_NOACCESS
,
2318 &spr_read_ureg
, SPR_NOACCESS
,
2320 spr_register(env
, SPR_SPRG4
, "SPRG4",
2321 SPR_NOACCESS
, SPR_NOACCESS
,
2322 &spr_read_generic
, &spr_write_generic
,
2324 spr_register(env
, SPR_SPRG5
, "SPRG5",
2325 SPR_NOACCESS
, SPR_NOACCESS
,
2326 spr_read_generic
, &spr_write_generic
,
2328 spr_register(env
, SPR_SPRG6
, "SPRG6",
2329 SPR_NOACCESS
, SPR_NOACCESS
,
2330 spr_read_generic
, &spr_write_generic
,
2332 spr_register(env
, SPR_SPRG7
, "SPRG7",
2333 SPR_NOACCESS
, SPR_NOACCESS
,
2334 spr_read_generic
, &spr_write_generic
,
2336 gen_spr_usprgh(env
);
2339 /* SPR shared between PowerPC 401 & 403 implementations */
2340 static void gen_spr_401_403(CPUPPCState
*env
)
2343 spr_register(env
, SPR_403_VTBL
, "TBL",
2344 &spr_read_tbl
, SPR_NOACCESS
,
2345 &spr_read_tbl
, SPR_NOACCESS
,
2347 spr_register(env
, SPR_403_TBL
, "TBL",
2348 SPR_NOACCESS
, SPR_NOACCESS
,
2349 SPR_NOACCESS
, &spr_write_tbl
,
2351 spr_register(env
, SPR_403_VTBU
, "TBU",
2352 &spr_read_tbu
, SPR_NOACCESS
,
2353 &spr_read_tbu
, SPR_NOACCESS
,
2355 spr_register(env
, SPR_403_TBU
, "TBU",
2356 SPR_NOACCESS
, SPR_NOACCESS
,
2357 SPR_NOACCESS
, &spr_write_tbu
,
2360 /* not emulated, as QEMU do not emulate caches */
2361 spr_register(env
, SPR_403_CDBCR
, "CDBCR",
2362 SPR_NOACCESS
, SPR_NOACCESS
,
2363 &spr_read_generic
, &spr_write_generic
,
2367 /* SPR specific to PowerPC 401 implementation */
2368 static void gen_spr_401(CPUPPCState
*env
)
2370 /* Debug interface */
2371 /* XXX : not implemented */
2372 spr_register(env
, SPR_40x_DBCR0
, "DBCR",
2373 SPR_NOACCESS
, SPR_NOACCESS
,
2374 &spr_read_generic
, &spr_write_40x_dbcr0
,
2376 /* XXX : not implemented */
2377 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2378 SPR_NOACCESS
, SPR_NOACCESS
,
2379 &spr_read_generic
, &spr_write_clear
,
2380 /* Last reset was system reset */
2382 /* XXX : not implemented */
2383 spr_register(env
, SPR_40x_DAC1
, "DAC",
2384 SPR_NOACCESS
, SPR_NOACCESS
,
2385 &spr_read_generic
, &spr_write_generic
,
2387 /* XXX : not implemented */
2388 spr_register(env
, SPR_40x_IAC1
, "IAC",
2389 SPR_NOACCESS
, SPR_NOACCESS
,
2390 &spr_read_generic
, &spr_write_generic
,
2392 /* Storage control */
2393 /* XXX: TODO: not implemented */
2394 spr_register(env
, SPR_405_SLER
, "SLER",
2395 SPR_NOACCESS
, SPR_NOACCESS
,
2396 &spr_read_generic
, &spr_write_40x_sler
,
2398 /* not emulated, as QEMU never does speculative access */
2399 spr_register(env
, SPR_40x_SGR
, "SGR",
2400 SPR_NOACCESS
, SPR_NOACCESS
,
2401 &spr_read_generic
, &spr_write_generic
,
2403 /* not emulated, as QEMU do not emulate caches */
2404 spr_register(env
, SPR_40x_DCWR
, "DCWR",
2405 SPR_NOACCESS
, SPR_NOACCESS
,
2406 &spr_read_generic
, &spr_write_generic
,
2410 static void gen_spr_401x2(CPUPPCState
*env
)
2413 spr_register(env
, SPR_40x_PID
, "PID",
2414 SPR_NOACCESS
, SPR_NOACCESS
,
2415 &spr_read_generic
, &spr_write_generic
,
2417 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2418 SPR_NOACCESS
, SPR_NOACCESS
,
2419 &spr_read_generic
, &spr_write_generic
,
2423 /* SPR specific to PowerPC 403 implementation */
2424 static void gen_spr_403(CPUPPCState
*env
)
2426 /* Debug interface */
2427 /* XXX : not implemented */
2428 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2429 SPR_NOACCESS
, SPR_NOACCESS
,
2430 &spr_read_generic
, &spr_write_40x_dbcr0
,
2432 /* XXX : not implemented */
2433 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2434 SPR_NOACCESS
, SPR_NOACCESS
,
2435 &spr_read_generic
, &spr_write_clear
,
2436 /* Last reset was system reset */
2438 /* XXX : not implemented */
2439 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2440 SPR_NOACCESS
, SPR_NOACCESS
,
2441 &spr_read_generic
, &spr_write_generic
,
2443 /* XXX : not implemented */
2444 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2445 SPR_NOACCESS
, SPR_NOACCESS
,
2446 &spr_read_generic
, &spr_write_generic
,
2448 /* XXX : not implemented */
2449 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2450 SPR_NOACCESS
, SPR_NOACCESS
,
2451 &spr_read_generic
, &spr_write_generic
,
2453 /* XXX : not implemented */
2454 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2455 SPR_NOACCESS
, SPR_NOACCESS
,
2456 &spr_read_generic
, &spr_write_generic
,
2460 static void gen_spr_403_real(CPUPPCState
*env
)
2462 spr_register(env
, SPR_403_PBL1
, "PBL1",
2463 SPR_NOACCESS
, SPR_NOACCESS
,
2464 &spr_read_403_pbr
, &spr_write_403_pbr
,
2466 spr_register(env
, SPR_403_PBU1
, "PBU1",
2467 SPR_NOACCESS
, SPR_NOACCESS
,
2468 &spr_read_403_pbr
, &spr_write_403_pbr
,
2470 spr_register(env
, SPR_403_PBL2
, "PBL2",
2471 SPR_NOACCESS
, SPR_NOACCESS
,
2472 &spr_read_403_pbr
, &spr_write_403_pbr
,
2474 spr_register(env
, SPR_403_PBU2
, "PBU2",
2475 SPR_NOACCESS
, SPR_NOACCESS
,
2476 &spr_read_403_pbr
, &spr_write_403_pbr
,
2480 static void gen_spr_403_mmu(CPUPPCState
*env
)
2483 spr_register(env
, SPR_40x_PID
, "PID",
2484 SPR_NOACCESS
, SPR_NOACCESS
,
2485 &spr_read_generic
, &spr_write_generic
,
2487 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2488 SPR_NOACCESS
, SPR_NOACCESS
,
2489 &spr_read_generic
, &spr_write_generic
,
2493 /* SPR specific to PowerPC compression coprocessor extension */
2494 static void gen_spr_compress(CPUPPCState
*env
)
2496 /* XXX : not implemented */
2497 spr_register(env
, SPR_401_SKR
, "SKR",
2498 SPR_NOACCESS
, SPR_NOACCESS
,
2499 &spr_read_generic
, &spr_write_generic
,
2503 static void gen_spr_5xx_8xx(CPUPPCState
*env
)
2505 /* Exception processing */
2506 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
2507 SPR_NOACCESS
, SPR_NOACCESS
,
2508 &spr_read_generic
, &spr_write_generic
,
2509 KVM_REG_PPC_DSISR
, 0x00000000);
2510 spr_register_kvm(env
, SPR_DAR
, "DAR",
2511 SPR_NOACCESS
, SPR_NOACCESS
,
2512 &spr_read_generic
, &spr_write_generic
,
2513 KVM_REG_PPC_DAR
, 0x00000000);
2515 spr_register(env
, SPR_DECR
, "DECR",
2516 SPR_NOACCESS
, SPR_NOACCESS
,
2517 &spr_read_decr
, &spr_write_decr
,
2519 /* XXX : not implemented */
2520 spr_register(env
, SPR_MPC_EIE
, "EIE",
2521 SPR_NOACCESS
, SPR_NOACCESS
,
2522 &spr_read_generic
, &spr_write_generic
,
2524 /* XXX : not implemented */
2525 spr_register(env
, SPR_MPC_EID
, "EID",
2526 SPR_NOACCESS
, SPR_NOACCESS
,
2527 &spr_read_generic
, &spr_write_generic
,
2529 /* XXX : not implemented */
2530 spr_register(env
, SPR_MPC_NRI
, "NRI",
2531 SPR_NOACCESS
, SPR_NOACCESS
,
2532 &spr_read_generic
, &spr_write_generic
,
2534 /* XXX : not implemented */
2535 spr_register(env
, SPR_MPC_CMPA
, "CMPA",
2536 SPR_NOACCESS
, SPR_NOACCESS
,
2537 &spr_read_generic
, &spr_write_generic
,
2539 /* XXX : not implemented */
2540 spr_register(env
, SPR_MPC_CMPB
, "CMPB",
2541 SPR_NOACCESS
, SPR_NOACCESS
,
2542 &spr_read_generic
, &spr_write_generic
,
2544 /* XXX : not implemented */
2545 spr_register(env
, SPR_MPC_CMPC
, "CMPC",
2546 SPR_NOACCESS
, SPR_NOACCESS
,
2547 &spr_read_generic
, &spr_write_generic
,
2549 /* XXX : not implemented */
2550 spr_register(env
, SPR_MPC_CMPD
, "CMPD",
2551 SPR_NOACCESS
, SPR_NOACCESS
,
2552 &spr_read_generic
, &spr_write_generic
,
2554 /* XXX : not implemented */
2555 spr_register(env
, SPR_MPC_ECR
, "ECR",
2556 SPR_NOACCESS
, SPR_NOACCESS
,
2557 &spr_read_generic
, &spr_write_generic
,
2559 /* XXX : not implemented */
2560 spr_register(env
, SPR_MPC_DER
, "DER",
2561 SPR_NOACCESS
, SPR_NOACCESS
,
2562 &spr_read_generic
, &spr_write_generic
,
2564 /* XXX : not implemented */
2565 spr_register(env
, SPR_MPC_COUNTA
, "COUNTA",
2566 SPR_NOACCESS
, SPR_NOACCESS
,
2567 &spr_read_generic
, &spr_write_generic
,
2569 /* XXX : not implemented */
2570 spr_register(env
, SPR_MPC_COUNTB
, "COUNTB",
2571 SPR_NOACCESS
, SPR_NOACCESS
,
2572 &spr_read_generic
, &spr_write_generic
,
2574 /* XXX : not implemented */
2575 spr_register(env
, SPR_MPC_CMPE
, "CMPE",
2576 SPR_NOACCESS
, SPR_NOACCESS
,
2577 &spr_read_generic
, &spr_write_generic
,
2579 /* XXX : not implemented */
2580 spr_register(env
, SPR_MPC_CMPF
, "CMPF",
2581 SPR_NOACCESS
, SPR_NOACCESS
,
2582 &spr_read_generic
, &spr_write_generic
,
2584 /* XXX : not implemented */
2585 spr_register(env
, SPR_MPC_CMPG
, "CMPG",
2586 SPR_NOACCESS
, SPR_NOACCESS
,
2587 &spr_read_generic
, &spr_write_generic
,
2589 /* XXX : not implemented */
2590 spr_register(env
, SPR_MPC_CMPH
, "CMPH",
2591 SPR_NOACCESS
, SPR_NOACCESS
,
2592 &spr_read_generic
, &spr_write_generic
,
2594 /* XXX : not implemented */
2595 spr_register(env
, SPR_MPC_LCTRL1
, "LCTRL1",
2596 SPR_NOACCESS
, SPR_NOACCESS
,
2597 &spr_read_generic
, &spr_write_generic
,
2599 /* XXX : not implemented */
2600 spr_register(env
, SPR_MPC_LCTRL2
, "LCTRL2",
2601 SPR_NOACCESS
, SPR_NOACCESS
,
2602 &spr_read_generic
, &spr_write_generic
,
2604 /* XXX : not implemented */
2605 spr_register(env
, SPR_MPC_BAR
, "BAR",
2606 SPR_NOACCESS
, SPR_NOACCESS
,
2607 &spr_read_generic
, &spr_write_generic
,
2609 /* XXX : not implemented */
2610 spr_register(env
, SPR_MPC_DPDR
, "DPDR",
2611 SPR_NOACCESS
, SPR_NOACCESS
,
2612 &spr_read_generic
, &spr_write_generic
,
2614 /* XXX : not implemented */
2615 spr_register(env
, SPR_MPC_IMMR
, "IMMR",
2616 SPR_NOACCESS
, SPR_NOACCESS
,
2617 &spr_read_generic
, &spr_write_generic
,
2621 static void gen_spr_5xx(CPUPPCState
*env
)
2623 /* XXX : not implemented */
2624 spr_register(env
, SPR_RCPU_MI_GRA
, "MI_GRA",
2625 SPR_NOACCESS
, SPR_NOACCESS
,
2626 &spr_read_generic
, &spr_write_generic
,
2628 /* XXX : not implemented */
2629 spr_register(env
, SPR_RCPU_L2U_GRA
, "L2U_GRA",
2630 SPR_NOACCESS
, SPR_NOACCESS
,
2631 &spr_read_generic
, &spr_write_generic
,
2633 /* XXX : not implemented */
2634 spr_register(env
, SPR_RPCU_BBCMCR
, "L2U_BBCMCR",
2635 SPR_NOACCESS
, SPR_NOACCESS
,
2636 &spr_read_generic
, &spr_write_generic
,
2638 /* XXX : not implemented */
2639 spr_register(env
, SPR_RCPU_L2U_MCR
, "L2U_MCR",
2640 SPR_NOACCESS
, SPR_NOACCESS
,
2641 &spr_read_generic
, &spr_write_generic
,
2643 /* XXX : not implemented */
2644 spr_register(env
, SPR_RCPU_MI_RBA0
, "MI_RBA0",
2645 SPR_NOACCESS
, SPR_NOACCESS
,
2646 &spr_read_generic
, &spr_write_generic
,
2648 /* XXX : not implemented */
2649 spr_register(env
, SPR_RCPU_MI_RBA1
, "MI_RBA1",
2650 SPR_NOACCESS
, SPR_NOACCESS
,
2651 &spr_read_generic
, &spr_write_generic
,
2653 /* XXX : not implemented */
2654 spr_register(env
, SPR_RCPU_MI_RBA2
, "MI_RBA2",
2655 SPR_NOACCESS
, SPR_NOACCESS
,
2656 &spr_read_generic
, &spr_write_generic
,
2658 /* XXX : not implemented */
2659 spr_register(env
, SPR_RCPU_MI_RBA3
, "MI_RBA3",
2660 SPR_NOACCESS
, SPR_NOACCESS
,
2661 &spr_read_generic
, &spr_write_generic
,
2663 /* XXX : not implemented */
2664 spr_register(env
, SPR_RCPU_L2U_RBA0
, "L2U_RBA0",
2665 SPR_NOACCESS
, SPR_NOACCESS
,
2666 &spr_read_generic
, &spr_write_generic
,
2668 /* XXX : not implemented */
2669 spr_register(env
, SPR_RCPU_L2U_RBA1
, "L2U_RBA1",
2670 SPR_NOACCESS
, SPR_NOACCESS
,
2671 &spr_read_generic
, &spr_write_generic
,
2673 /* XXX : not implemented */
2674 spr_register(env
, SPR_RCPU_L2U_RBA2
, "L2U_RBA2",
2675 SPR_NOACCESS
, SPR_NOACCESS
,
2676 &spr_read_generic
, &spr_write_generic
,
2678 /* XXX : not implemented */
2679 spr_register(env
, SPR_RCPU_L2U_RBA3
, "L2U_RBA3",
2680 SPR_NOACCESS
, SPR_NOACCESS
,
2681 &spr_read_generic
, &spr_write_generic
,
2683 /* XXX : not implemented */
2684 spr_register(env
, SPR_RCPU_MI_RA0
, "MI_RA0",
2685 SPR_NOACCESS
, SPR_NOACCESS
,
2686 &spr_read_generic
, &spr_write_generic
,
2688 /* XXX : not implemented */
2689 spr_register(env
, SPR_RCPU_MI_RA1
, "MI_RA1",
2690 SPR_NOACCESS
, SPR_NOACCESS
,
2691 &spr_read_generic
, &spr_write_generic
,
2693 /* XXX : not implemented */
2694 spr_register(env
, SPR_RCPU_MI_RA2
, "MI_RA2",
2695 SPR_NOACCESS
, SPR_NOACCESS
,
2696 &spr_read_generic
, &spr_write_generic
,
2698 /* XXX : not implemented */
2699 spr_register(env
, SPR_RCPU_MI_RA3
, "MI_RA3",
2700 SPR_NOACCESS
, SPR_NOACCESS
,
2701 &spr_read_generic
, &spr_write_generic
,
2703 /* XXX : not implemented */
2704 spr_register(env
, SPR_RCPU_L2U_RA0
, "L2U_RA0",
2705 SPR_NOACCESS
, SPR_NOACCESS
,
2706 &spr_read_generic
, &spr_write_generic
,
2708 /* XXX : not implemented */
2709 spr_register(env
, SPR_RCPU_L2U_RA1
, "L2U_RA1",
2710 SPR_NOACCESS
, SPR_NOACCESS
,
2711 &spr_read_generic
, &spr_write_generic
,
2713 /* XXX : not implemented */
2714 spr_register(env
, SPR_RCPU_L2U_RA2
, "L2U_RA2",
2715 SPR_NOACCESS
, SPR_NOACCESS
,
2716 &spr_read_generic
, &spr_write_generic
,
2718 /* XXX : not implemented */
2719 spr_register(env
, SPR_RCPU_L2U_RA3
, "L2U_RA3",
2720 SPR_NOACCESS
, SPR_NOACCESS
,
2721 &spr_read_generic
, &spr_write_generic
,
2723 /* XXX : not implemented */
2724 spr_register(env
, SPR_RCPU_FPECR
, "FPECR",
2725 SPR_NOACCESS
, SPR_NOACCESS
,
2726 &spr_read_generic
, &spr_write_generic
,
2730 static void gen_spr_8xx(CPUPPCState
*env
)
2732 /* XXX : not implemented */
2733 spr_register(env
, SPR_MPC_IC_CST
, "IC_CST",
2734 SPR_NOACCESS
, SPR_NOACCESS
,
2735 &spr_read_generic
, &spr_write_generic
,
2737 /* XXX : not implemented */
2738 spr_register(env
, SPR_MPC_IC_ADR
, "IC_ADR",
2739 SPR_NOACCESS
, SPR_NOACCESS
,
2740 &spr_read_generic
, &spr_write_generic
,
2742 /* XXX : not implemented */
2743 spr_register(env
, SPR_MPC_IC_DAT
, "IC_DAT",
2744 SPR_NOACCESS
, SPR_NOACCESS
,
2745 &spr_read_generic
, &spr_write_generic
,
2747 /* XXX : not implemented */
2748 spr_register(env
, SPR_MPC_DC_CST
, "DC_CST",
2749 SPR_NOACCESS
, SPR_NOACCESS
,
2750 &spr_read_generic
, &spr_write_generic
,
2752 /* XXX : not implemented */
2753 spr_register(env
, SPR_MPC_DC_ADR
, "DC_ADR",
2754 SPR_NOACCESS
, SPR_NOACCESS
,
2755 &spr_read_generic
, &spr_write_generic
,
2757 /* XXX : not implemented */
2758 spr_register(env
, SPR_MPC_DC_DAT
, "DC_DAT",
2759 SPR_NOACCESS
, SPR_NOACCESS
,
2760 &spr_read_generic
, &spr_write_generic
,
2762 /* XXX : not implemented */
2763 spr_register(env
, SPR_MPC_MI_CTR
, "MI_CTR",
2764 SPR_NOACCESS
, SPR_NOACCESS
,
2765 &spr_read_generic
, &spr_write_generic
,
2767 /* XXX : not implemented */
2768 spr_register(env
, SPR_MPC_MI_AP
, "MI_AP",
2769 SPR_NOACCESS
, SPR_NOACCESS
,
2770 &spr_read_generic
, &spr_write_generic
,
2772 /* XXX : not implemented */
2773 spr_register(env
, SPR_MPC_MI_EPN
, "MI_EPN",
2774 SPR_NOACCESS
, SPR_NOACCESS
,
2775 &spr_read_generic
, &spr_write_generic
,
2777 /* XXX : not implemented */
2778 spr_register(env
, SPR_MPC_MI_TWC
, "MI_TWC",
2779 SPR_NOACCESS
, SPR_NOACCESS
,
2780 &spr_read_generic
, &spr_write_generic
,
2782 /* XXX : not implemented */
2783 spr_register(env
, SPR_MPC_MI_RPN
, "MI_RPN",
2784 SPR_NOACCESS
, SPR_NOACCESS
,
2785 &spr_read_generic
, &spr_write_generic
,
2787 /* XXX : not implemented */
2788 spr_register(env
, SPR_MPC_MI_DBCAM
, "MI_DBCAM",
2789 SPR_NOACCESS
, SPR_NOACCESS
,
2790 &spr_read_generic
, &spr_write_generic
,
2792 /* XXX : not implemented */
2793 spr_register(env
, SPR_MPC_MI_DBRAM0
, "MI_DBRAM0",
2794 SPR_NOACCESS
, SPR_NOACCESS
,
2795 &spr_read_generic
, &spr_write_generic
,
2797 /* XXX : not implemented */
2798 spr_register(env
, SPR_MPC_MI_DBRAM1
, "MI_DBRAM1",
2799 SPR_NOACCESS
, SPR_NOACCESS
,
2800 &spr_read_generic
, &spr_write_generic
,
2802 /* XXX : not implemented */
2803 spr_register(env
, SPR_MPC_MD_CTR
, "MD_CTR",
2804 SPR_NOACCESS
, SPR_NOACCESS
,
2805 &spr_read_generic
, &spr_write_generic
,
2807 /* XXX : not implemented */
2808 spr_register(env
, SPR_MPC_MD_CASID
, "MD_CASID",
2809 SPR_NOACCESS
, SPR_NOACCESS
,
2810 &spr_read_generic
, &spr_write_generic
,
2812 /* XXX : not implemented */
2813 spr_register(env
, SPR_MPC_MD_AP
, "MD_AP",
2814 SPR_NOACCESS
, SPR_NOACCESS
,
2815 &spr_read_generic
, &spr_write_generic
,
2817 /* XXX : not implemented */
2818 spr_register(env
, SPR_MPC_MD_EPN
, "MD_EPN",
2819 SPR_NOACCESS
, SPR_NOACCESS
,
2820 &spr_read_generic
, &spr_write_generic
,
2822 /* XXX : not implemented */
2823 spr_register(env
, SPR_MPC_MD_TWB
, "MD_TWB",
2824 SPR_NOACCESS
, SPR_NOACCESS
,
2825 &spr_read_generic
, &spr_write_generic
,
2827 /* XXX : not implemented */
2828 spr_register(env
, SPR_MPC_MD_TWC
, "MD_TWC",
2829 SPR_NOACCESS
, SPR_NOACCESS
,
2830 &spr_read_generic
, &spr_write_generic
,
2832 /* XXX : not implemented */
2833 spr_register(env
, SPR_MPC_MD_RPN
, "MD_RPN",
2834 SPR_NOACCESS
, SPR_NOACCESS
,
2835 &spr_read_generic
, &spr_write_generic
,
2837 /* XXX : not implemented */
2838 spr_register(env
, SPR_MPC_MD_TW
, "MD_TW",
2839 SPR_NOACCESS
, SPR_NOACCESS
,
2840 &spr_read_generic
, &spr_write_generic
,
2842 /* XXX : not implemented */
2843 spr_register(env
, SPR_MPC_MD_DBCAM
, "MD_DBCAM",
2844 SPR_NOACCESS
, SPR_NOACCESS
,
2845 &spr_read_generic
, &spr_write_generic
,
2847 /* XXX : not implemented */
2848 spr_register(env
, SPR_MPC_MD_DBRAM0
, "MD_DBRAM0",
2849 SPR_NOACCESS
, SPR_NOACCESS
,
2850 &spr_read_generic
, &spr_write_generic
,
2852 /* XXX : not implemented */
2853 spr_register(env
, SPR_MPC_MD_DBRAM1
, "MD_DBRAM1",
2854 SPR_NOACCESS
, SPR_NOACCESS
,
2855 &spr_read_generic
, &spr_write_generic
,
2860 * AMR => SPR 29 (Power 2.04)
2861 * CTRL => SPR 136 (Power 2.04)
2862 * CTRL => SPR 152 (Power 2.04)
2863 * SCOMC => SPR 276 (64 bits ?)
2864 * SCOMD => SPR 277 (64 bits ?)
2865 * TBU40 => SPR 286 (Power 2.04 hypv)
2866 * HSPRG0 => SPR 304 (Power 2.04 hypv)
2867 * HSPRG1 => SPR 305 (Power 2.04 hypv)
2868 * HDSISR => SPR 306 (Power 2.04 hypv)
2869 * HDAR => SPR 307 (Power 2.04 hypv)
2870 * PURR => SPR 309 (Power 2.04 hypv)
2871 * HDEC => SPR 310 (Power 2.04 hypv)
2872 * HIOR => SPR 311 (hypv)
2873 * RMOR => SPR 312 (970)
2874 * HRMOR => SPR 313 (Power 2.04 hypv)
2875 * HSRR0 => SPR 314 (Power 2.04 hypv)
2876 * HSRR1 => SPR 315 (Power 2.04 hypv)
2877 * LPIDR => SPR 317 (970)
2878 * EPR => SPR 702 (Power 2.04 emb)
2879 * perf => 768-783 (Power 2.04)
2880 * perf => 784-799 (Power 2.04)
2881 * PPR => SPR 896 (Power 2.04)
2882 * DABRX => 1015 (Power 2.04 hypv)
2883 * FPECR => SPR 1022 (?)
2884 * ... and more (thermal management, performance counters, ...)
2887 /*****************************************************************************/
2888 /* Exception vectors models */
2889 static void init_excp_4xx_real(CPUPPCState
*env
)
2891 #if !defined(CONFIG_USER_ONLY)
2892 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2893 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2894 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2895 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2896 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2897 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2898 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2899 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2900 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2901 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2902 env
->ivor_mask
= 0x0000FFF0UL
;
2903 env
->ivpr_mask
= 0xFFFF0000UL
;
2904 /* Hardware reset vector */
2905 env
->hreset_vector
= 0xFFFFFFFCUL
;
2909 static void init_excp_4xx_softmmu(CPUPPCState
*env
)
2911 #if !defined(CONFIG_USER_ONLY)
2912 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2913 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2914 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2915 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2916 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2917 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2918 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2919 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2920 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2921 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2922 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2923 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001100;
2924 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001200;
2925 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2926 env
->ivor_mask
= 0x0000FFF0UL
;
2927 env
->ivpr_mask
= 0xFFFF0000UL
;
2928 /* Hardware reset vector */
2929 env
->hreset_vector
= 0xFFFFFFFCUL
;
2933 static void init_excp_MPC5xx(CPUPPCState
*env
)
2935 #if !defined(CONFIG_USER_ONLY)
2936 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2937 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2938 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2939 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2940 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2941 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2942 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2943 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2944 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2945 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2946 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
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_MPC8xx(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
] = 0x00000900;
2969 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2970 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2971 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2972 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2973 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2974 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001100;
2975 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001200;
2976 env
->excp_vectors
[POWERPC_EXCP_ITLBE
] = 0x00001300;
2977 env
->excp_vectors
[POWERPC_EXCP_DTLBE
] = 0x00001400;
2978 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2979 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2980 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2981 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2982 env
->ivor_mask
= 0x0000FFF0UL
;
2983 env
->ivpr_mask
= 0xFFFF0000UL
;
2984 /* Hardware reset vector */
2985 env
->hreset_vector
= 0x00000100UL
;
2989 static void init_excp_G2(CPUPPCState
*env
)
2991 #if !defined(CONFIG_USER_ONLY)
2992 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2993 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2994 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2995 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2996 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2997 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2998 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2999 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3000 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3001 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000A00;
3002 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3003 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3004 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3005 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3006 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3007 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3008 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3009 /* Hardware reset vector */
3010 env
->hreset_vector
= 0x00000100UL
;
3014 static void init_excp_e200(CPUPPCState
*env
, target_ulong ivpr_mask
)
3016 #if !defined(CONFIG_USER_ONLY)
3017 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000FFC;
3018 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
3019 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
3020 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
3021 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
3022 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
3023 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
3024 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
3025 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
3026 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
3027 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
3028 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
3029 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
3030 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
3031 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
3032 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
3033 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
3034 env
->excp_vectors
[POWERPC_EXCP_SPEU
] = 0x00000000;
3035 env
->excp_vectors
[POWERPC_EXCP_EFPDI
] = 0x00000000;
3036 env
->excp_vectors
[POWERPC_EXCP_EFPRI
] = 0x00000000;
3037 env
->ivor_mask
= 0x0000FFF7UL
;
3038 env
->ivpr_mask
= ivpr_mask
;
3039 /* Hardware reset vector */
3040 env
->hreset_vector
= 0xFFFFFFFCUL
;
3044 static void init_excp_BookE(CPUPPCState
*env
)
3046 #if !defined(CONFIG_USER_ONLY)
3047 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
3048 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
3049 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
3050 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
3051 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
3052 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
3053 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
3054 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
3055 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
3056 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
3057 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
3058 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
3059 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
3060 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
3061 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
3062 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
3063 env
->ivor_mask
= 0x0000FFF0UL
;
3064 env
->ivpr_mask
= 0xFFFF0000UL
;
3065 /* Hardware reset vector */
3066 env
->hreset_vector
= 0xFFFFFFFCUL
;
3070 static void init_excp_601(CPUPPCState
*env
)
3072 #if !defined(CONFIG_USER_ONLY)
3073 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3074 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3075 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3076 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3077 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3078 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3079 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3080 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3081 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3082 env
->excp_vectors
[POWERPC_EXCP_IO
] = 0x00000A00;
3083 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3084 env
->excp_vectors
[POWERPC_EXCP_RUNM
] = 0x00002000;
3085 /* Hardware reset vector */
3086 env
->hreset_vector
= 0x00000100UL
;
3090 static void init_excp_602(CPUPPCState
*env
)
3092 #if !defined(CONFIG_USER_ONLY)
3093 /* XXX: exception prefix has a special behavior on 602 */
3094 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3095 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3096 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3097 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3098 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3099 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3100 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3101 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3102 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3103 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3104 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3105 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3106 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3107 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3108 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3109 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3110 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001500;
3111 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001600;
3112 /* Hardware reset vector */
3113 env
->hreset_vector
= 0x00000100UL
;
3117 static void init_excp_603(CPUPPCState
*env
)
3119 #if !defined(CONFIG_USER_ONLY)
3120 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3121 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3122 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3123 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3124 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3125 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3126 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3127 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3128 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3129 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3130 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3131 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3132 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3133 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3134 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3135 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3136 /* Hardware reset vector */
3137 env
->hreset_vector
= 0x00000100UL
;
3141 static void init_excp_604(CPUPPCState
*env
)
3143 #if !defined(CONFIG_USER_ONLY)
3144 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3145 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3146 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3147 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3148 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3149 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3150 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3151 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3152 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3153 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3154 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3155 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3156 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3157 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3158 /* Hardware reset vector */
3159 env
->hreset_vector
= 0x00000100UL
;
3163 static void init_excp_7x0(CPUPPCState
*env
)
3165 #if !defined(CONFIG_USER_ONLY)
3166 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3167 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3168 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3169 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3170 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3171 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3172 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3173 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3174 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3175 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3176 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3177 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3178 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3179 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3180 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3181 /* Hardware reset vector */
3182 env
->hreset_vector
= 0x00000100UL
;
3186 static void init_excp_750cl(CPUPPCState
*env
)
3188 #if !defined(CONFIG_USER_ONLY)
3189 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3190 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3191 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3192 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3193 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3194 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3195 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3196 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3197 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3198 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3199 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3200 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3201 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3202 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3203 /* Hardware reset vector */
3204 env
->hreset_vector
= 0x00000100UL
;
3208 static void init_excp_750cx(CPUPPCState
*env
)
3210 #if !defined(CONFIG_USER_ONLY)
3211 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3212 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3213 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3214 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3215 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3216 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3217 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3218 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3219 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3220 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3221 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3222 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3223 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3224 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3225 /* Hardware reset vector */
3226 env
->hreset_vector
= 0x00000100UL
;
3230 /* XXX: Check if this is correct */
3231 static void init_excp_7x5(CPUPPCState
*env
)
3233 #if !defined(CONFIG_USER_ONLY)
3234 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3235 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3236 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3237 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3238 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3239 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3240 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3241 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3242 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3243 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3244 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3245 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3246 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3247 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3248 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3249 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3250 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3251 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3252 /* Hardware reset vector */
3253 env
->hreset_vector
= 0x00000100UL
;
3257 static void init_excp_7400(CPUPPCState
*env
)
3259 #if !defined(CONFIG_USER_ONLY)
3260 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3261 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3262 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3263 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3264 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3265 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3266 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3267 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3268 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3269 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3270 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3271 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3272 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3273 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3274 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3275 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3276 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3277 /* Hardware reset vector */
3278 env
->hreset_vector
= 0x00000100UL
;
3282 static void init_excp_7450(CPUPPCState
*env
)
3284 #if !defined(CONFIG_USER_ONLY)
3285 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3286 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3287 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3288 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3289 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3290 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3291 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3292 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3293 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
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_IFTLB
] = 0x00001000;
3299 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3300 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3301 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3302 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3303 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3304 /* Hardware reset vector */
3305 env
->hreset_vector
= 0x00000100UL
;
3309 #if defined(TARGET_PPC64)
3310 static void init_excp_970(CPUPPCState
*env
)
3312 #if !defined(CONFIG_USER_ONLY)
3313 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3314 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3315 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3316 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3317 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3318 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3319 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3320 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3321 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3322 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3323 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3324 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3325 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3326 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3327 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3328 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3329 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3330 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
3331 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
3332 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
3333 /* Hardware reset vector */
3334 env
->hreset_vector
= 0x0000000000000100ULL
;
3338 static void init_excp_POWER7(CPUPPCState
*env
)
3340 #if !defined(CONFIG_USER_ONLY)
3341 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3342 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3343 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3344 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3345 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3346 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3347 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3348 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3349 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3350 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3351 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3352 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3353 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3354 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3355 env
->excp_vectors
[POWERPC_EXCP_HDSI
] = 0x00000E00;
3356 env
->excp_vectors
[POWERPC_EXCP_HISI
] = 0x00000E20;
3357 env
->excp_vectors
[POWERPC_EXCP_HV_EMU
] = 0x00000E40;
3358 env
->excp_vectors
[POWERPC_EXCP_HV_MAINT
] = 0x00000E60;
3359 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3360 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3361 env
->excp_vectors
[POWERPC_EXCP_VSXU
] = 0x00000F40;
3362 /* Hardware reset vector */
3363 env
->hreset_vector
= 0x0000000000000100ULL
;
3367 static void init_excp_POWER8(CPUPPCState
*env
)
3369 init_excp_POWER7(env
);
3371 #if !defined(CONFIG_USER_ONLY)
3372 env
->excp_vectors
[POWERPC_EXCP_SDOOR
] = 0x00000A00;
3373 env
->excp_vectors
[POWERPC_EXCP_FU
] = 0x00000F60;
3374 env
->excp_vectors
[POWERPC_EXCP_HV_FU
] = 0x00000F80;
3375 env
->excp_vectors
[POWERPC_EXCP_SDOOR_HV
] = 0x00000E80;
3379 static void init_excp_POWER9(CPUPPCState
*env
)
3381 init_excp_POWER8(env
);
3383 #if !defined(CONFIG_USER_ONLY)
3384 env
->excp_vectors
[POWERPC_EXCP_HVIRT
] = 0x00000EA0;
3385 env
->excp_vectors
[POWERPC_EXCP_SYSCALL_VECTORED
] = 0x00000000;
3389 static void init_excp_POWER10(CPUPPCState
*env
)
3391 init_excp_POWER9(env
);
3396 /*****************************************************************************/
3397 /* Power management enable checks */
3398 static int check_pow_none(CPUPPCState
*env
)
3403 static int check_pow_nocheck(CPUPPCState
*env
)
3408 static int check_pow_hid0(CPUPPCState
*env
)
3410 if (env
->spr
[SPR_HID0
] & 0x00E00000) {
3417 static int check_pow_hid0_74xx(CPUPPCState
*env
)
3419 if (env
->spr
[SPR_HID0
] & 0x00600000) {
3426 static bool ppc_cpu_interrupts_big_endian_always(PowerPCCPU
*cpu
)
3432 static bool ppc_cpu_interrupts_big_endian_lpcr(PowerPCCPU
*cpu
)
3434 return !(cpu
->env
.spr
[SPR_LPCR
] & LPCR_ILE
);
3438 /*****************************************************************************/
3439 /* PowerPC implementations definitions */
3441 #define POWERPC_FAMILY(_name) \
3443 glue(glue(ppc_, _name), _cpu_family_class_init)(ObjectClass *, void *); \
3445 static const TypeInfo \
3446 glue(glue(ppc_, _name), _cpu_family_type_info) = { \
3447 .name = stringify(_name) "-family-" TYPE_POWERPC_CPU, \
3448 .parent = TYPE_POWERPC_CPU, \
3450 .class_init = glue(glue(ppc_, _name), _cpu_family_class_init), \
3453 static void glue(glue(ppc_, _name), _cpu_family_register_types)(void) \
3455 type_register_static( \
3456 &glue(glue(ppc_, _name), _cpu_family_type_info)); \
3459 type_init(glue(glue(ppc_, _name), _cpu_family_register_types)) \
3461 static void glue(glue(ppc_, _name), _cpu_family_class_init)
3463 static void init_proc_401(CPUPPCState
*env
)
3466 gen_spr_401_403(env
);
3468 init_excp_4xx_real(env
);
3469 env
->dcache_line_size
= 32;
3470 env
->icache_line_size
= 32;
3471 /* Allocate hardware IRQ controller */
3472 ppc40x_irq_init(env_archcpu(env
));
3474 SET_FIT_PERIOD(12, 16, 20, 24);
3475 SET_WDT_PERIOD(16, 20, 24, 28);
3478 POWERPC_FAMILY(401)(ObjectClass
*oc
, void *data
)
3480 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3481 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3483 dc
->desc
= "PowerPC 401";
3484 pcc
->init_proc
= init_proc_401
;
3485 pcc
->check_pow
= check_pow_nocheck
;
3486 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3487 PPC_WRTEE
| PPC_DCR
|
3488 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3490 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3491 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3492 pcc
->msr_mask
= (1ull << MSR_KEY
) |
3501 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3502 pcc
->excp_model
= POWERPC_EXCP_40x
;
3503 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3504 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3505 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3506 POWERPC_FLAG_BUS_CLK
;
3509 static void init_proc_401x2(CPUPPCState
*env
)
3512 gen_spr_401_403(env
);
3514 gen_spr_compress(env
);
3515 /* Memory management */
3516 #if !defined(CONFIG_USER_ONLY)
3520 env
->tlb_type
= TLB_EMB
;
3522 init_excp_4xx_softmmu(env
);
3523 env
->dcache_line_size
= 32;
3524 env
->icache_line_size
= 32;
3525 /* Allocate hardware IRQ controller */
3526 ppc40x_irq_init(env_archcpu(env
));
3528 SET_FIT_PERIOD(12, 16, 20, 24);
3529 SET_WDT_PERIOD(16, 20, 24, 28);
3532 POWERPC_FAMILY(401x2
)(ObjectClass
*oc
, void *data
)
3534 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3535 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3537 dc
->desc
= "PowerPC 401x2";
3538 pcc
->init_proc
= init_proc_401x2
;
3539 pcc
->check_pow
= check_pow_nocheck
;
3540 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3541 PPC_DCR
| PPC_WRTEE
|
3542 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3543 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3544 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3545 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3546 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3547 pcc
->msr_mask
= (1ull << 20) |
3559 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3560 pcc
->excp_model
= POWERPC_EXCP_40x
;
3561 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3562 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3563 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3564 POWERPC_FLAG_BUS_CLK
;
3567 static void init_proc_401x3(CPUPPCState
*env
)
3570 gen_spr_401_403(env
);
3573 gen_spr_compress(env
);
3574 init_excp_4xx_softmmu(env
);
3575 env
->dcache_line_size
= 32;
3576 env
->icache_line_size
= 32;
3577 /* Allocate hardware IRQ controller */
3578 ppc40x_irq_init(env_archcpu(env
));
3580 SET_FIT_PERIOD(12, 16, 20, 24);
3581 SET_WDT_PERIOD(16, 20, 24, 28);
3584 POWERPC_FAMILY(401x3
)(ObjectClass
*oc
, void *data
)
3586 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3587 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3589 dc
->desc
= "PowerPC 401x3";
3590 pcc
->init_proc
= init_proc_401x3
;
3591 pcc
->check_pow
= check_pow_nocheck
;
3592 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3593 PPC_DCR
| PPC_WRTEE
|
3594 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3595 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3596 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3597 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3598 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3599 pcc
->msr_mask
= (1ull << 20) |
3612 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3613 pcc
->excp_model
= POWERPC_EXCP_40x
;
3614 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3615 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3616 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3617 POWERPC_FLAG_BUS_CLK
;
3620 static void init_proc_IOP480(CPUPPCState
*env
)
3623 gen_spr_401_403(env
);
3625 gen_spr_compress(env
);
3626 /* Memory management */
3627 #if !defined(CONFIG_USER_ONLY)
3631 env
->tlb_type
= TLB_EMB
;
3633 init_excp_4xx_softmmu(env
);
3634 env
->dcache_line_size
= 32;
3635 env
->icache_line_size
= 32;
3636 /* Allocate hardware IRQ controller */
3637 ppc40x_irq_init(env_archcpu(env
));
3639 SET_FIT_PERIOD(8, 12, 16, 20);
3640 SET_WDT_PERIOD(16, 20, 24, 28);
3643 POWERPC_FAMILY(IOP480
)(ObjectClass
*oc
, void *data
)
3645 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3646 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3648 dc
->desc
= "IOP480";
3649 pcc
->init_proc
= init_proc_IOP480
;
3650 pcc
->check_pow
= check_pow_nocheck
;
3651 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3652 PPC_DCR
| PPC_WRTEE
|
3653 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3654 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3655 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3656 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3657 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3658 pcc
->msr_mask
= (1ull << 20) |
3670 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3671 pcc
->excp_model
= POWERPC_EXCP_40x
;
3672 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3673 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3674 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3675 POWERPC_FLAG_BUS_CLK
;
3678 static void init_proc_403(CPUPPCState
*env
)
3681 gen_spr_401_403(env
);
3683 gen_spr_403_real(env
);
3684 init_excp_4xx_real(env
);
3685 env
->dcache_line_size
= 32;
3686 env
->icache_line_size
= 32;
3687 /* Allocate hardware IRQ controller */
3688 ppc40x_irq_init(env_archcpu(env
));
3690 SET_FIT_PERIOD(8, 12, 16, 20);
3691 SET_WDT_PERIOD(16, 20, 24, 28);
3694 POWERPC_FAMILY(403)(ObjectClass
*oc
, void *data
)
3696 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3697 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3699 dc
->desc
= "PowerPC 403";
3700 pcc
->init_proc
= init_proc_403
;
3701 pcc
->check_pow
= check_pow_nocheck
;
3702 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3703 PPC_DCR
| PPC_WRTEE
|
3704 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3706 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3707 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3708 pcc
->msr_mask
= (1ull << MSR_POW
) |
3717 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3718 pcc
->excp_model
= POWERPC_EXCP_40x
;
3719 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3720 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3721 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3722 POWERPC_FLAG_BUS_CLK
;
3725 static void init_proc_403GCX(CPUPPCState
*env
)
3728 gen_spr_401_403(env
);
3730 gen_spr_403_real(env
);
3731 gen_spr_403_mmu(env
);
3732 /* Bus access control */
3733 /* not emulated, as QEMU never does speculative access */
3734 spr_register(env
, SPR_40x_SGR
, "SGR",
3735 SPR_NOACCESS
, SPR_NOACCESS
,
3736 &spr_read_generic
, &spr_write_generic
,
3738 /* not emulated, as QEMU do not emulate caches */
3739 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3740 SPR_NOACCESS
, SPR_NOACCESS
,
3741 &spr_read_generic
, &spr_write_generic
,
3743 /* Memory management */
3744 #if !defined(CONFIG_USER_ONLY)
3748 env
->tlb_type
= TLB_EMB
;
3750 init_excp_4xx_softmmu(env
);
3751 env
->dcache_line_size
= 32;
3752 env
->icache_line_size
= 32;
3753 /* Allocate hardware IRQ controller */
3754 ppc40x_irq_init(env_archcpu(env
));
3756 SET_FIT_PERIOD(8, 12, 16, 20);
3757 SET_WDT_PERIOD(16, 20, 24, 28);
3760 POWERPC_FAMILY(403GCX
)(ObjectClass
*oc
, void *data
)
3762 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3763 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3765 dc
->desc
= "PowerPC 403 GCX";
3766 pcc
->init_proc
= init_proc_403GCX
;
3767 pcc
->check_pow
= check_pow_nocheck
;
3768 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3769 PPC_DCR
| PPC_WRTEE
|
3770 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3772 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3773 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3774 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3775 pcc
->msr_mask
= (1ull << MSR_POW
) |
3784 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3785 pcc
->excp_model
= POWERPC_EXCP_40x
;
3786 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3787 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3788 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3789 POWERPC_FLAG_BUS_CLK
;
3792 static void init_proc_405(CPUPPCState
*env
)
3798 /* Bus access control */
3799 /* not emulated, as QEMU never does speculative access */
3800 spr_register(env
, SPR_40x_SGR
, "SGR",
3801 SPR_NOACCESS
, SPR_NOACCESS
,
3802 &spr_read_generic
, &spr_write_generic
,
3804 /* not emulated, as QEMU do not emulate caches */
3805 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3806 SPR_NOACCESS
, SPR_NOACCESS
,
3807 &spr_read_generic
, &spr_write_generic
,
3809 /* Memory management */
3810 #if !defined(CONFIG_USER_ONLY)
3814 env
->tlb_type
= TLB_EMB
;
3816 init_excp_4xx_softmmu(env
);
3817 env
->dcache_line_size
= 32;
3818 env
->icache_line_size
= 32;
3819 /* Allocate hardware IRQ controller */
3820 ppc40x_irq_init(env_archcpu(env
));
3822 SET_FIT_PERIOD(8, 12, 16, 20);
3823 SET_WDT_PERIOD(16, 20, 24, 28);
3826 POWERPC_FAMILY(405)(ObjectClass
*oc
, void *data
)
3828 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3829 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3831 dc
->desc
= "PowerPC 405";
3832 pcc
->init_proc
= init_proc_405
;
3833 pcc
->check_pow
= check_pow_nocheck
;
3834 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3835 PPC_DCR
| PPC_WRTEE
|
3836 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3837 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3838 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3839 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3840 PPC_4xx_COMMON
| PPC_405_MAC
| PPC_40x_EXCP
;
3841 pcc
->msr_mask
= (1ull << MSR_POW
) |
3850 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx
;
3851 pcc
->excp_model
= POWERPC_EXCP_40x
;
3852 pcc
->bus_model
= PPC_FLAGS_INPUT_405
;
3853 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3854 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3855 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3858 static void init_proc_440EP(CPUPPCState
*env
)
3862 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3864 gen_spr_usprgh(env
);
3865 /* Processor identification */
3866 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3867 SPR_NOACCESS
, SPR_NOACCESS
,
3868 &spr_read_generic
, &spr_write_pir
,
3870 /* XXX : not implemented */
3871 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3872 SPR_NOACCESS
, SPR_NOACCESS
,
3873 &spr_read_generic
, &spr_write_generic
,
3875 /* XXX : not implemented */
3876 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3877 SPR_NOACCESS
, SPR_NOACCESS
,
3878 &spr_read_generic
, &spr_write_generic
,
3880 /* XXX : not implemented */
3881 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3882 SPR_NOACCESS
, SPR_NOACCESS
,
3883 &spr_read_generic
, &spr_write_generic
,
3885 /* XXX : not implemented */
3886 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3887 SPR_NOACCESS
, SPR_NOACCESS
,
3888 &spr_read_generic
, &spr_write_generic
,
3890 /* XXX : not implemented */
3891 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3892 SPR_NOACCESS
, SPR_NOACCESS
,
3893 &spr_read_generic
, &spr_write_generic
,
3895 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3896 SPR_NOACCESS
, SPR_NOACCESS
,
3897 &spr_read_generic
, &spr_write_generic
,
3899 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3900 SPR_NOACCESS
, SPR_NOACCESS
,
3901 &spr_read_generic
, &spr_write_generic
,
3903 /* XXX : not implemented */
3904 spr_register(env
, SPR_440_CCR1
, "CCR1",
3905 SPR_NOACCESS
, SPR_NOACCESS
,
3906 &spr_read_generic
, &spr_write_generic
,
3908 /* Memory management */
3909 #if !defined(CONFIG_USER_ONLY)
3913 env
->tlb_type
= TLB_EMB
;
3915 init_excp_BookE(env
);
3916 env
->dcache_line_size
= 32;
3917 env
->icache_line_size
= 32;
3918 ppc40x_irq_init(env_archcpu(env
));
3920 SET_FIT_PERIOD(12, 16, 20, 24);
3921 SET_WDT_PERIOD(20, 24, 28, 32);
3924 POWERPC_FAMILY(440EP
)(ObjectClass
*oc
, void *data
)
3926 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3927 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3929 dc
->desc
= "PowerPC 440 EP";
3930 pcc
->init_proc
= init_proc_440EP
;
3931 pcc
->check_pow
= check_pow_nocheck
;
3932 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3933 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
3934 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
3936 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
3937 PPC_CACHE
| PPC_CACHE_ICBI
|
3938 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3939 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3940 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3942 pcc
->msr_mask
= (1ull << MSR_POW
) |
3954 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3955 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3956 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3957 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3958 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3959 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3962 POWERPC_FAMILY(460EX
)(ObjectClass
*oc
, void *data
)
3964 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3965 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3967 dc
->desc
= "PowerPC 460 EX";
3968 pcc
->init_proc
= init_proc_440EP
;
3969 pcc
->check_pow
= check_pow_nocheck
;
3970 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3971 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
3972 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
3974 PPC_DCR
| PPC_DCRX
| PPC_WRTEE
| PPC_RFMCI
|
3975 PPC_CACHE
| PPC_CACHE_ICBI
|
3976 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3977 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3978 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3980 pcc
->msr_mask
= (1ull << MSR_POW
) |
3992 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3993 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3994 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3995 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3996 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3997 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4000 static void init_proc_440GP(CPUPPCState
*env
)
4004 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4006 gen_spr_usprgh(env
);
4007 /* Processor identification */
4008 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4009 SPR_NOACCESS
, SPR_NOACCESS
,
4010 &spr_read_generic
, &spr_write_pir
,
4012 /* XXX : not implemented */
4013 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4014 SPR_NOACCESS
, SPR_NOACCESS
,
4015 &spr_read_generic
, &spr_write_generic
,
4017 /* XXX : not implemented */
4018 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4019 SPR_NOACCESS
, SPR_NOACCESS
,
4020 &spr_read_generic
, &spr_write_generic
,
4022 /* XXX : not implemented */
4023 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4024 SPR_NOACCESS
, SPR_NOACCESS
,
4025 &spr_read_generic
, &spr_write_generic
,
4027 /* XXX : not implemented */
4028 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4029 SPR_NOACCESS
, SPR_NOACCESS
,
4030 &spr_read_generic
, &spr_write_generic
,
4032 /* Memory management */
4033 #if !defined(CONFIG_USER_ONLY)
4037 env
->tlb_type
= TLB_EMB
;
4039 init_excp_BookE(env
);
4040 env
->dcache_line_size
= 32;
4041 env
->icache_line_size
= 32;
4042 /* XXX: TODO: allocate internal IRQ controller */
4044 SET_FIT_PERIOD(12, 16, 20, 24);
4045 SET_WDT_PERIOD(20, 24, 28, 32);
4048 POWERPC_FAMILY(440GP
)(ObjectClass
*oc
, void *data
)
4050 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4051 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4053 dc
->desc
= "PowerPC 440 GP";
4054 pcc
->init_proc
= init_proc_440GP
;
4055 pcc
->check_pow
= check_pow_nocheck
;
4056 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4057 PPC_DCR
| PPC_DCRX
| PPC_WRTEE
| PPC_MFAPIDI
|
4058 PPC_CACHE
| PPC_CACHE_ICBI
|
4059 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4060 PPC_MEM_TLBSYNC
| PPC_TLBIVA
| PPC_MFTB
|
4061 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4063 pcc
->msr_mask
= (1ull << MSR_POW
) |
4075 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4076 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4077 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4078 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4079 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4080 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4083 static void init_proc_440x4(CPUPPCState
*env
)
4087 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4089 gen_spr_usprgh(env
);
4090 /* Processor identification */
4091 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4092 SPR_NOACCESS
, SPR_NOACCESS
,
4093 &spr_read_generic
, &spr_write_pir
,
4095 /* XXX : not implemented */
4096 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4097 SPR_NOACCESS
, SPR_NOACCESS
,
4098 &spr_read_generic
, &spr_write_generic
,
4100 /* XXX : not implemented */
4101 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4102 SPR_NOACCESS
, SPR_NOACCESS
,
4103 &spr_read_generic
, &spr_write_generic
,
4105 /* XXX : not implemented */
4106 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4107 SPR_NOACCESS
, SPR_NOACCESS
,
4108 &spr_read_generic
, &spr_write_generic
,
4110 /* XXX : not implemented */
4111 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4112 SPR_NOACCESS
, SPR_NOACCESS
,
4113 &spr_read_generic
, &spr_write_generic
,
4115 /* Memory management */
4116 #if !defined(CONFIG_USER_ONLY)
4120 env
->tlb_type
= TLB_EMB
;
4122 init_excp_BookE(env
);
4123 env
->dcache_line_size
= 32;
4124 env
->icache_line_size
= 32;
4125 /* XXX: TODO: allocate internal IRQ controller */
4127 SET_FIT_PERIOD(12, 16, 20, 24);
4128 SET_WDT_PERIOD(20, 24, 28, 32);
4131 POWERPC_FAMILY(440x4
)(ObjectClass
*oc
, void *data
)
4133 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4134 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4136 dc
->desc
= "PowerPC 440x4";
4137 pcc
->init_proc
= init_proc_440x4
;
4138 pcc
->check_pow
= check_pow_nocheck
;
4139 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4140 PPC_DCR
| PPC_WRTEE
|
4141 PPC_CACHE
| PPC_CACHE_ICBI
|
4142 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4143 PPC_MEM_TLBSYNC
| PPC_MFTB
|
4144 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4146 pcc
->msr_mask
= (1ull << MSR_POW
) |
4158 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4159 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4160 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4161 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4162 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4163 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4166 static void init_proc_440x5(CPUPPCState
*env
)
4170 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4172 gen_spr_usprgh(env
);
4173 /* Processor identification */
4174 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4175 SPR_NOACCESS
, SPR_NOACCESS
,
4176 &spr_read_generic
, &spr_write_pir
,
4178 /* XXX : not implemented */
4179 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4180 SPR_NOACCESS
, SPR_NOACCESS
,
4181 &spr_read_generic
, &spr_write_generic
,
4183 /* XXX : not implemented */
4184 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4185 SPR_NOACCESS
, SPR_NOACCESS
,
4186 &spr_read_generic
, &spr_write_generic
,
4188 /* XXX : not implemented */
4189 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4190 SPR_NOACCESS
, SPR_NOACCESS
,
4191 &spr_read_generic
, &spr_write_generic
,
4193 /* XXX : not implemented */
4194 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4195 SPR_NOACCESS
, SPR_NOACCESS
,
4196 &spr_read_generic
, &spr_write_generic
,
4198 /* XXX : not implemented */
4199 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4200 SPR_NOACCESS
, SPR_NOACCESS
,
4201 &spr_read_generic
, &spr_write_generic
,
4203 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4204 SPR_NOACCESS
, SPR_NOACCESS
,
4205 &spr_read_generic
, &spr_write_generic
,
4207 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4208 SPR_NOACCESS
, SPR_NOACCESS
,
4209 &spr_read_generic
, &spr_write_generic
,
4211 /* XXX : not implemented */
4212 spr_register(env
, SPR_440_CCR1
, "CCR1",
4213 SPR_NOACCESS
, SPR_NOACCESS
,
4214 &spr_read_generic
, &spr_write_generic
,
4216 /* Memory management */
4217 #if !defined(CONFIG_USER_ONLY)
4221 env
->tlb_type
= TLB_EMB
;
4223 init_excp_BookE(env
);
4224 env
->dcache_line_size
= 32;
4225 env
->icache_line_size
= 32;
4226 ppc40x_irq_init(env_archcpu(env
));
4228 SET_FIT_PERIOD(12, 16, 20, 24);
4229 SET_WDT_PERIOD(20, 24, 28, 32);
4232 POWERPC_FAMILY(440x5
)(ObjectClass
*oc
, void *data
)
4234 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4235 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4237 dc
->desc
= "PowerPC 440x5";
4238 pcc
->init_proc
= init_proc_440x5
;
4239 pcc
->check_pow
= check_pow_nocheck
;
4240 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
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
->msr_mask
= (1ull << MSR_POW
) |
4259 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4260 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4261 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4262 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4263 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4264 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4267 POWERPC_FAMILY(440x5wDFPU
)(ObjectClass
*oc
, void *data
)
4269 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4270 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4272 dc
->desc
= "PowerPC 440x5 with double precision FPU";
4273 pcc
->init_proc
= init_proc_440x5
;
4274 pcc
->check_pow
= check_pow_nocheck
;
4275 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4276 PPC_FLOAT
| PPC_FLOAT_FSQRT
|
4278 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
4279 PPC_CACHE
| PPC_CACHE_ICBI
|
4280 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4281 PPC_MEM_TLBSYNC
| PPC_MFTB
|
4282 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4284 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
4285 pcc
->msr_mask
= (1ull << MSR_POW
) |
4297 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4298 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4299 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4300 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4301 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4302 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4305 static void init_proc_MPC5xx(CPUPPCState
*env
)
4309 gen_spr_5xx_8xx(env
);
4311 init_excp_MPC5xx(env
);
4312 env
->dcache_line_size
= 32;
4313 env
->icache_line_size
= 32;
4314 /* XXX: TODO: allocate internal IRQ controller */
4317 POWERPC_FAMILY(MPC5xx
)(ObjectClass
*oc
, void *data
)
4319 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4320 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4322 dc
->desc
= "Freescale 5xx cores (aka RCPU)";
4323 pcc
->init_proc
= init_proc_MPC5xx
;
4324 pcc
->check_pow
= check_pow_none
;
4325 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4326 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4327 PPC_CACHE_ICBI
| PPC_FLOAT
| PPC_FLOAT_STFIWX
|
4329 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4341 pcc
->mmu_model
= POWERPC_MMU_REAL
;
4342 pcc
->excp_model
= POWERPC_EXCP_603
;
4343 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4344 pcc
->bfd_mach
= bfd_mach_ppc_505
;
4345 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4346 POWERPC_FLAG_BUS_CLK
;
4349 static void init_proc_MPC8xx(CPUPPCState
*env
)
4353 gen_spr_5xx_8xx(env
);
4355 init_excp_MPC8xx(env
);
4356 env
->dcache_line_size
= 32;
4357 env
->icache_line_size
= 32;
4358 /* XXX: TODO: allocate internal IRQ controller */
4361 POWERPC_FAMILY(MPC8xx
)(ObjectClass
*oc
, void *data
)
4363 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4364 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4366 dc
->desc
= "Freescale 8xx cores (aka PowerQUICC)";
4367 pcc
->init_proc
= init_proc_MPC8xx
;
4368 pcc
->check_pow
= check_pow_none
;
4369 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4370 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4371 PPC_CACHE_ICBI
| PPC_MFTB
;
4372 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4384 pcc
->mmu_model
= POWERPC_MMU_MPC8xx
;
4385 pcc
->excp_model
= POWERPC_EXCP_603
;
4386 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4387 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4388 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4389 POWERPC_FLAG_BUS_CLK
;
4392 /* Freescale 82xx cores (aka PowerQUICC-II) */
4394 static void init_proc_G2(CPUPPCState
*env
)
4396 gen_spr_ne_601(env
);
4398 gen_spr_G2_755(env
);
4402 /* External access control */
4403 /* XXX : not implemented */
4404 spr_register(env
, SPR_EAR
, "EAR",
4405 SPR_NOACCESS
, SPR_NOACCESS
,
4406 &spr_read_generic
, &spr_write_generic
,
4408 /* Hardware implementation register */
4409 /* XXX : not implemented */
4410 spr_register(env
, SPR_HID0
, "HID0",
4411 SPR_NOACCESS
, SPR_NOACCESS
,
4412 &spr_read_generic
, &spr_write_generic
,
4414 /* XXX : not implemented */
4415 spr_register(env
, SPR_HID1
, "HID1",
4416 SPR_NOACCESS
, SPR_NOACCESS
,
4417 &spr_read_generic
, &spr_write_generic
,
4419 /* XXX : not implemented */
4420 spr_register(env
, SPR_HID2
, "HID2",
4421 SPR_NOACCESS
, SPR_NOACCESS
,
4422 &spr_read_generic
, &spr_write_generic
,
4424 /* Memory management */
4427 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4429 env
->dcache_line_size
= 32;
4430 env
->icache_line_size
= 32;
4431 /* Allocate hardware IRQ controller */
4432 ppc6xx_irq_init(env_archcpu(env
));
4435 POWERPC_FAMILY(G2
)(ObjectClass
*oc
, void *data
)
4437 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4438 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4440 dc
->desc
= "PowerPC G2";
4441 pcc
->init_proc
= init_proc_G2
;
4442 pcc
->check_pow
= check_pow_hid0
;
4443 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4444 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4446 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4447 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4448 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4449 PPC_SEGMENT
| PPC_EXTERN
;
4450 pcc
->msr_mask
= (1ull << MSR_POW
) |
4451 (1ull << MSR_TGPR
) |
4465 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4466 pcc
->excp_model
= POWERPC_EXCP_G2
;
4467 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4468 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4469 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4470 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4473 static void init_proc_G2LE(CPUPPCState
*env
)
4475 gen_spr_ne_601(env
);
4477 gen_spr_G2_755(env
);
4481 /* External access control */
4482 /* XXX : not implemented */
4483 spr_register(env
, SPR_EAR
, "EAR",
4484 SPR_NOACCESS
, SPR_NOACCESS
,
4485 &spr_read_generic
, &spr_write_generic
,
4487 /* Hardware implementation register */
4488 /* XXX : not implemented */
4489 spr_register(env
, SPR_HID0
, "HID0",
4490 SPR_NOACCESS
, SPR_NOACCESS
,
4491 &spr_read_generic
, &spr_write_generic
,
4493 /* XXX : not implemented */
4494 spr_register(env
, SPR_HID1
, "HID1",
4495 SPR_NOACCESS
, SPR_NOACCESS
,
4496 &spr_read_generic
, &spr_write_generic
,
4498 /* XXX : not implemented */
4499 spr_register(env
, SPR_HID2
, "HID2",
4500 SPR_NOACCESS
, SPR_NOACCESS
,
4501 &spr_read_generic
, &spr_write_generic
,
4504 /* Memory management */
4507 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4509 env
->dcache_line_size
= 32;
4510 env
->icache_line_size
= 32;
4511 /* Allocate hardware IRQ controller */
4512 ppc6xx_irq_init(env_archcpu(env
));
4515 POWERPC_FAMILY(G2LE
)(ObjectClass
*oc
, void *data
)
4517 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4518 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4520 dc
->desc
= "PowerPC G2LE";
4521 pcc
->init_proc
= init_proc_G2LE
;
4522 pcc
->check_pow
= check_pow_hid0
;
4523 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4524 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4526 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4527 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4528 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4529 PPC_SEGMENT
| PPC_EXTERN
;
4530 pcc
->msr_mask
= (1ull << MSR_POW
) |
4531 (1ull << MSR_TGPR
) |
4547 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4548 pcc
->excp_model
= POWERPC_EXCP_G2
;
4549 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4550 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4551 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4552 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4555 static void init_proc_e200(CPUPPCState
*env
)
4559 gen_spr_BookE(env
, 0x000000070000FFFFULL
);
4560 /* XXX : not implemented */
4561 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4562 &spr_read_spefscr
, &spr_write_spefscr
,
4563 &spr_read_spefscr
, &spr_write_spefscr
,
4565 /* Memory management */
4566 gen_spr_BookE206(env
, 0x0000005D, NULL
, 0);
4567 /* XXX : not implemented */
4568 spr_register(env
, SPR_HID0
, "HID0",
4569 SPR_NOACCESS
, SPR_NOACCESS
,
4570 &spr_read_generic
, &spr_write_generic
,
4572 /* XXX : not implemented */
4573 spr_register(env
, SPR_HID1
, "HID1",
4574 SPR_NOACCESS
, SPR_NOACCESS
,
4575 &spr_read_generic
, &spr_write_generic
,
4577 /* XXX : not implemented */
4578 spr_register(env
, SPR_Exxx_ALTCTXCR
, "ALTCTXCR",
4579 SPR_NOACCESS
, SPR_NOACCESS
,
4580 &spr_read_generic
, &spr_write_generic
,
4582 /* XXX : not implemented */
4583 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4584 SPR_NOACCESS
, SPR_NOACCESS
,
4585 &spr_read_generic
, &spr_write_generic
,
4587 /* XXX : not implemented */
4588 spr_register(env
, SPR_Exxx_CTXCR
, "CTXCR",
4589 SPR_NOACCESS
, SPR_NOACCESS
,
4590 &spr_read_generic
, &spr_write_generic
,
4592 /* XXX : not implemented */
4593 spr_register(env
, SPR_Exxx_DBCNT
, "DBCNT",
4594 SPR_NOACCESS
, SPR_NOACCESS
,
4595 &spr_read_generic
, &spr_write_generic
,
4597 /* XXX : not implemented */
4598 spr_register(env
, SPR_Exxx_DBCR3
, "DBCR3",
4599 SPR_NOACCESS
, SPR_NOACCESS
,
4600 &spr_read_generic
, &spr_write_generic
,
4602 /* XXX : not implemented */
4603 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4604 &spr_read_generic
, SPR_NOACCESS
,
4605 &spr_read_generic
, SPR_NOACCESS
,
4607 /* XXX : not implemented */
4608 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4609 SPR_NOACCESS
, SPR_NOACCESS
,
4610 &spr_read_generic
, &spr_write_generic
,
4612 /* XXX : not implemented */
4613 spr_register(env
, SPR_Exxx_L1FINV0
, "L1FINV0",
4614 SPR_NOACCESS
, SPR_NOACCESS
,
4615 &spr_read_generic
, &spr_write_generic
,
4617 /* XXX : not implemented */
4618 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
4619 SPR_NOACCESS
, SPR_NOACCESS
,
4620 &spr_read_generic
, &spr_write_generic
,
4622 /* XXX : not implemented */
4623 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
4624 SPR_NOACCESS
, SPR_NOACCESS
,
4625 &spr_read_generic
, &spr_write_generic
,
4627 /* XXX : not implemented */
4628 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4629 SPR_NOACCESS
, SPR_NOACCESS
,
4630 &spr_read_generic
, &spr_write_generic
,
4632 /* XXX : not implemented */
4633 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4634 SPR_NOACCESS
, SPR_NOACCESS
,
4635 &spr_read_generic
, &spr_write_generic
,
4637 /* XXX : not implemented */
4638 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4639 SPR_NOACCESS
, SPR_NOACCESS
,
4640 &spr_read_generic
, &spr_write_generic
,
4641 0x00000000); /* TOFIX */
4642 spr_register(env
, SPR_BOOKE_DSRR0
, "DSRR0",
4643 SPR_NOACCESS
, SPR_NOACCESS
,
4644 &spr_read_generic
, &spr_write_generic
,
4646 spr_register(env
, SPR_BOOKE_DSRR1
, "DSRR1",
4647 SPR_NOACCESS
, SPR_NOACCESS
,
4648 &spr_read_generic
, &spr_write_generic
,
4650 #if !defined(CONFIG_USER_ONLY)
4654 env
->tlb_type
= TLB_EMB
;
4656 init_excp_e200(env
, 0xFFFF0000UL
);
4657 env
->dcache_line_size
= 32;
4658 env
->icache_line_size
= 32;
4659 /* XXX: TODO: allocate internal IRQ controller */
4662 POWERPC_FAMILY(e200
)(ObjectClass
*oc
, void *data
)
4664 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4665 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4667 dc
->desc
= "e200 core";
4668 pcc
->init_proc
= init_proc_e200
;
4669 pcc
->check_pow
= check_pow_hid0
;
4671 * XXX: unimplemented instructions:
4678 * all SPE multiply-accumulate instructions
4680 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4681 PPC_SPE
| PPC_SPE_SINGLE
|
4682 PPC_WRTEE
| PPC_RFDI
|
4683 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4684 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4685 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
|
4687 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4701 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4702 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4703 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4704 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4705 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4706 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4707 POWERPC_FLAG_BUS_CLK
;
4710 static void init_proc_e300(CPUPPCState
*env
)
4712 gen_spr_ne_601(env
);
4717 /* hardware implementation registers */
4718 /* XXX : not implemented */
4719 spr_register(env
, SPR_HID0
, "HID0",
4720 SPR_NOACCESS
, SPR_NOACCESS
,
4721 &spr_read_generic
, &spr_write_generic
,
4723 /* XXX : not implemented */
4724 spr_register(env
, SPR_HID1
, "HID1",
4725 SPR_NOACCESS
, SPR_NOACCESS
,
4726 &spr_read_generic
, &spr_write_generic
,
4728 /* XXX : not implemented */
4729 spr_register(env
, SPR_HID2
, "HID2",
4730 SPR_NOACCESS
, SPR_NOACCESS
,
4731 &spr_read_generic
, &spr_write_generic
,
4734 /* XXX : not implemented */
4735 spr_register(env
, SPR_DABR
, "DABR",
4736 SPR_NOACCESS
, SPR_NOACCESS
,
4737 &spr_read_generic
, &spr_write_generic
,
4739 /* XXX : not implemented */
4740 spr_register(env
, SPR_DABR2
, "DABR2",
4741 SPR_NOACCESS
, SPR_NOACCESS
,
4742 &spr_read_generic
, &spr_write_generic
,
4744 /* XXX : not implemented */
4745 spr_register(env
, SPR_IABR2
, "IABR2",
4746 SPR_NOACCESS
, SPR_NOACCESS
,
4747 &spr_read_generic
, &spr_write_generic
,
4749 /* XXX : not implemented */
4750 spr_register(env
, SPR_IBCR
, "IBCR",
4751 SPR_NOACCESS
, SPR_NOACCESS
,
4752 &spr_read_generic
, &spr_write_generic
,
4754 /* XXX : not implemented */
4755 spr_register(env
, SPR_DBCR
, "DBCR",
4756 SPR_NOACCESS
, SPR_NOACCESS
,
4757 &spr_read_generic
, &spr_write_generic
,
4759 /* Memory management */
4762 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4764 env
->dcache_line_size
= 32;
4765 env
->icache_line_size
= 32;
4766 /* Allocate hardware IRQ controller */
4767 ppc6xx_irq_init(env_archcpu(env
));
4770 POWERPC_FAMILY(e300
)(ObjectClass
*oc
, void *data
)
4772 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4773 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4775 dc
->desc
= "e300 core";
4776 pcc
->init_proc
= init_proc_e300
;
4777 pcc
->check_pow
= check_pow_hid0
;
4778 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4779 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4781 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4782 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4783 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4784 PPC_SEGMENT
| PPC_EXTERN
;
4785 pcc
->msr_mask
= (1ull << MSR_POW
) |
4786 (1ull << MSR_TGPR
) |
4802 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4803 pcc
->excp_model
= POWERPC_EXCP_603
;
4804 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4805 pcc
->bfd_mach
= bfd_mach_ppc_603
;
4806 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4807 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4810 #if !defined(CONFIG_USER_ONLY)
4811 static void spr_write_mas73(DisasContext
*ctx
, int sprn
, int gprn
)
4813 TCGv val
= tcg_temp_new();
4814 tcg_gen_ext32u_tl(val
, cpu_gpr
[gprn
]);
4815 gen_store_spr(SPR_BOOKE_MAS3
, val
);
4816 tcg_gen_shri_tl(val
, cpu_gpr
[gprn
], 32);
4817 gen_store_spr(SPR_BOOKE_MAS7
, val
);
4821 static void spr_read_mas73(DisasContext
*ctx
, int gprn
, int sprn
)
4823 TCGv mas7
= tcg_temp_new();
4824 TCGv mas3
= tcg_temp_new();
4825 gen_load_spr(mas7
, SPR_BOOKE_MAS7
);
4826 tcg_gen_shli_tl(mas7
, mas7
, 32);
4827 gen_load_spr(mas3
, SPR_BOOKE_MAS3
);
4828 tcg_gen_or_tl(cpu_gpr
[gprn
], mas3
, mas7
);
4829 tcg_temp_free(mas3
);
4830 tcg_temp_free(mas7
);
4835 enum fsl_e500_version
{
4843 static void init_proc_e500(CPUPPCState
*env
, int version
)
4845 uint32_t tlbncfg
[2];
4847 uint64_t ivpr_mask
= 0xFFFF0000ULL
;
4848 uint32_t l1cfg0
= 0x3800 /* 8 ways */
4849 | 0x0020; /* 32 kb */
4850 uint32_t l1cfg1
= 0x3800 /* 8 ways */
4851 | 0x0020; /* 32 kb */
4852 uint32_t mmucfg
= 0;
4853 #if !defined(CONFIG_USER_ONLY)
4860 * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't
4861 * complain when accessing them.
4862 * gen_spr_BookE(env, 0x0000000F0000FD7FULL);
4868 ivor_mask
= 0x0000000F0000FFFFULL
;
4872 ivor_mask
= 0x000003FE0000FFFFULL
;
4875 ivor_mask
= 0x000003FF0000FFFFULL
;
4878 gen_spr_BookE(env
, ivor_mask
);
4879 gen_spr_usprg3(env
);
4880 /* Processor identification */
4881 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4882 SPR_NOACCESS
, SPR_NOACCESS
,
4883 &spr_read_generic
, &spr_write_pir
,
4885 /* XXX : not implemented */
4886 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4887 &spr_read_spefscr
, &spr_write_spefscr
,
4888 &spr_read_spefscr
, &spr_write_spefscr
,
4890 #if !defined(CONFIG_USER_ONLY)
4891 /* Memory management */
4897 tlbncfg
[0] = gen_tlbncfg(2, 1, 1, 0, 256);
4898 tlbncfg
[1] = gen_tlbncfg(16, 1, 9, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4901 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4902 tlbncfg
[1] = gen_tlbncfg(16, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4906 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4907 tlbncfg
[1] = gen_tlbncfg(64, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 64);
4912 tlbncfg
[0] = 0x08052400;
4913 tlbncfg
[1] = 0x40028040;
4916 cpu_abort(env_cpu(env
), "Unknown CPU: " TARGET_FMT_lx
"\n",
4924 env
->dcache_line_size
= 32;
4925 env
->icache_line_size
= 32;
4929 env
->dcache_line_size
= 64;
4930 env
->icache_line_size
= 64;
4931 l1cfg0
|= 0x1000000; /* 64 byte cache block size */
4932 l1cfg1
|= 0x1000000; /* 64 byte cache block size */
4935 env
->dcache_line_size
= 32;
4936 env
->icache_line_size
= 32;
4937 l1cfg0
|= 0x0F83820;
4938 l1cfg1
|= 0x0B83820;
4941 cpu_abort(env_cpu(env
), "Unknown CPU: " TARGET_FMT_lx
"\n",
4944 gen_spr_BookE206(env
, 0x000000DF, tlbncfg
, mmucfg
);
4945 /* XXX : not implemented */
4946 spr_register(env
, SPR_HID0
, "HID0",
4947 SPR_NOACCESS
, SPR_NOACCESS
,
4948 &spr_read_generic
, &spr_write_generic
,
4950 /* XXX : not implemented */
4951 spr_register(env
, SPR_HID1
, "HID1",
4952 SPR_NOACCESS
, SPR_NOACCESS
,
4953 &spr_read_generic
, &spr_write_generic
,
4955 /* XXX : not implemented */
4956 spr_register(env
, SPR_Exxx_BBEAR
, "BBEAR",
4957 SPR_NOACCESS
, SPR_NOACCESS
,
4958 &spr_read_generic
, &spr_write_generic
,
4960 /* XXX : not implemented */
4961 spr_register(env
, SPR_Exxx_BBTAR
, "BBTAR",
4962 SPR_NOACCESS
, SPR_NOACCESS
,
4963 &spr_read_generic
, &spr_write_generic
,
4965 /* XXX : not implemented */
4966 spr_register(env
, SPR_Exxx_MCAR
, "MCAR",
4967 SPR_NOACCESS
, SPR_NOACCESS
,
4968 &spr_read_generic
, &spr_write_generic
,
4970 /* XXX : not implemented */
4971 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4972 SPR_NOACCESS
, SPR_NOACCESS
,
4973 &spr_read_generic
, &spr_write_generic
,
4975 /* XXX : not implemented */
4976 spr_register(env
, SPR_Exxx_NPIDR
, "NPIDR",
4977 SPR_NOACCESS
, SPR_NOACCESS
,
4978 &spr_read_generic
, &spr_write_generic
,
4980 /* XXX : not implemented */
4981 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4982 SPR_NOACCESS
, SPR_NOACCESS
,
4983 &spr_read_generic
, &spr_write_generic
,
4985 /* XXX : not implemented */
4986 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4987 &spr_read_generic
, SPR_NOACCESS
,
4988 &spr_read_generic
, SPR_NOACCESS
,
4990 spr_register(env
, SPR_Exxx_L1CFG1
, "L1CFG1",
4991 &spr_read_generic
, SPR_NOACCESS
,
4992 &spr_read_generic
, SPR_NOACCESS
,
4994 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4995 SPR_NOACCESS
, SPR_NOACCESS
,
4996 &spr_read_generic
, &spr_write_e500_l1csr0
,
4998 spr_register(env
, SPR_Exxx_L1CSR1
, "L1CSR1",
4999 SPR_NOACCESS
, SPR_NOACCESS
,
5000 &spr_read_generic
, &spr_write_e500_l1csr1
,
5002 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
5003 SPR_NOACCESS
, SPR_NOACCESS
,
5004 &spr_read_generic
, &spr_write_generic
,
5006 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
5007 SPR_NOACCESS
, SPR_NOACCESS
,
5008 &spr_read_generic
, &spr_write_generic
,
5010 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
5011 SPR_NOACCESS
, SPR_NOACCESS
,
5012 &spr_read_generic
, &spr_write_booke206_mmucsr0
,
5014 spr_register(env
, SPR_BOOKE_EPR
, "EPR",
5015 SPR_NOACCESS
, SPR_NOACCESS
,
5016 &spr_read_generic
, SPR_NOACCESS
,
5018 /* XXX better abstract into Emb.xxx features */
5019 if ((version
== fsl_e5500
) || (version
== fsl_e6500
)) {
5020 spr_register(env
, SPR_BOOKE_EPCR
, "EPCR",
5021 SPR_NOACCESS
, SPR_NOACCESS
,
5022 &spr_read_generic
, &spr_write_generic
,
5024 spr_register(env
, SPR_BOOKE_MAS7_MAS3
, "MAS7_MAS3",
5025 SPR_NOACCESS
, SPR_NOACCESS
,
5026 &spr_read_mas73
, &spr_write_mas73
,
5028 ivpr_mask
= (target_ulong
)~0xFFFFULL
;
5031 if (version
== fsl_e6500
) {
5032 /* Thread identification */
5033 spr_register(env
, SPR_TIR
, "TIR",
5034 SPR_NOACCESS
, SPR_NOACCESS
,
5035 &spr_read_generic
, SPR_NOACCESS
,
5037 spr_register(env
, SPR_BOOKE_TLB0PS
, "TLB0PS",
5038 SPR_NOACCESS
, SPR_NOACCESS
,
5039 &spr_read_generic
, SPR_NOACCESS
,
5041 spr_register(env
, SPR_BOOKE_TLB1PS
, "TLB1PS",
5042 SPR_NOACCESS
, SPR_NOACCESS
,
5043 &spr_read_generic
, SPR_NOACCESS
,
5047 #if !defined(CONFIG_USER_ONLY)
5049 env
->tlb_type
= TLB_MAS
;
5050 for (i
= 0; i
< BOOKE206_MAX_TLBN
; i
++) {
5051 env
->nb_tlb
+= booke206_tlb_size(env
, i
);
5055 init_excp_e200(env
, ivpr_mask
);
5056 /* Allocate hardware IRQ controller */
5057 ppce500_irq_init(env_archcpu(env
));
5060 static void init_proc_e500v1(CPUPPCState
*env
)
5062 init_proc_e500(env
, fsl_e500v1
);
5065 POWERPC_FAMILY(e500v1
)(ObjectClass
*oc
, void *data
)
5067 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5068 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5070 dc
->desc
= "e500v1 core";
5071 pcc
->init_proc
= init_proc_e500v1
;
5072 pcc
->check_pow
= check_pow_hid0
;
5073 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5074 PPC_SPE
| PPC_SPE_SINGLE
|
5075 PPC_WRTEE
| PPC_RFDI
|
5076 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5077 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5078 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5079 pcc
->insns_flags2
= PPC2_BOOKE206
;
5080 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
5094 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5095 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5096 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5097 pcc
->bfd_mach
= bfd_mach_ppc_860
;
5098 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
5099 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
5100 POWERPC_FLAG_BUS_CLK
;
5103 static void init_proc_e500v2(CPUPPCState
*env
)
5105 init_proc_e500(env
, fsl_e500v2
);
5108 POWERPC_FAMILY(e500v2
)(ObjectClass
*oc
, void *data
)
5110 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5111 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5113 dc
->desc
= "e500v2 core";
5114 pcc
->init_proc
= init_proc_e500v2
;
5115 pcc
->check_pow
= check_pow_hid0
;
5116 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5117 PPC_SPE
| PPC_SPE_SINGLE
| PPC_SPE_DOUBLE
|
5118 PPC_WRTEE
| PPC_RFDI
|
5119 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5120 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5121 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5122 pcc
->insns_flags2
= PPC2_BOOKE206
;
5123 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
5137 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5138 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5139 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5140 pcc
->bfd_mach
= bfd_mach_ppc_860
;
5141 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
5142 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
5143 POWERPC_FLAG_BUS_CLK
;
5146 static void init_proc_e500mc(CPUPPCState
*env
)
5148 init_proc_e500(env
, fsl_e500mc
);
5151 POWERPC_FAMILY(e500mc
)(ObjectClass
*oc
, void *data
)
5153 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5154 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5156 dc
->desc
= "e500mc core";
5157 pcc
->init_proc
= init_proc_e500mc
;
5158 pcc
->check_pow
= check_pow_none
;
5159 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_MFTB
|
5160 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5161 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5162 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5163 PPC_FLOAT
| PPC_FLOAT_FRES
|
5164 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5165 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5166 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
5167 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
;
5168 pcc
->msr_mask
= (1ull << MSR_GS
) |
5169 (1ull << MSR_UCLE
) |
5182 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5183 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5184 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5185 /* FIXME: figure out the correct flag for e500mc */
5186 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5187 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5188 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5192 static void init_proc_e5500(CPUPPCState
*env
)
5194 init_proc_e500(env
, fsl_e5500
);
5197 POWERPC_FAMILY(e5500
)(ObjectClass
*oc
, void *data
)
5199 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5200 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5202 dc
->desc
= "e5500 core";
5203 pcc
->init_proc
= init_proc_e5500
;
5204 pcc
->check_pow
= check_pow_none
;
5205 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_MFTB
|
5206 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5207 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5208 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5209 PPC_FLOAT
| PPC_FLOAT_FRES
|
5210 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5211 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5212 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
5213 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
;
5214 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
|
5216 pcc
->msr_mask
= (1ull << MSR_CM
) |
5218 (1ull << MSR_UCLE
) |
5231 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5232 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5233 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5234 /* FIXME: figure out the correct flag for e5500 */
5235 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5236 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5237 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5240 static void init_proc_e6500(CPUPPCState
*env
)
5242 init_proc_e500(env
, fsl_e6500
);
5245 POWERPC_FAMILY(e6500
)(ObjectClass
*oc
, void *data
)
5247 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5248 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5250 dc
->desc
= "e6500 core";
5251 pcc
->init_proc
= init_proc_e6500
;
5252 pcc
->check_pow
= check_pow_none
;
5253 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_MFTB
|
5254 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5255 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5256 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5257 PPC_FLOAT
| PPC_FLOAT_FRES
|
5258 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5259 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5260 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
5261 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
| PPC_ALTIVEC
;
5262 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
|
5263 PPC2_FP_CVT_S64
| PPC2_ATOMIC_ISA206
;
5264 pcc
->msr_mask
= (1ull << MSR_CM
) |
5266 (1ull << MSR_UCLE
) |
5280 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5281 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5282 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5283 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5284 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5285 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_VRE
;
5290 /* Non-embedded PowerPC */
5292 #define POWERPC_MSRR_601 (0x0000000000001040ULL)
5294 static void init_proc_601(CPUPPCState
*env
)
5296 gen_spr_ne_601(env
);
5299 /* Hardware implementation registers */
5300 /* XXX : not implemented */
5301 spr_register(env
, SPR_HID0
, "HID0",
5302 SPR_NOACCESS
, SPR_NOACCESS
,
5303 &spr_read_generic
, &spr_write_hid0_601
,
5305 /* XXX : not implemented */
5306 spr_register(env
, SPR_HID1
, "HID1",
5307 SPR_NOACCESS
, SPR_NOACCESS
,
5308 &spr_read_generic
, &spr_write_generic
,
5310 /* XXX : not implemented */
5311 spr_register(env
, SPR_601_HID2
, "HID2",
5312 SPR_NOACCESS
, SPR_NOACCESS
,
5313 &spr_read_generic
, &spr_write_generic
,
5315 /* XXX : not implemented */
5316 spr_register(env
, SPR_601_HID5
, "HID5",
5317 SPR_NOACCESS
, SPR_NOACCESS
,
5318 &spr_read_generic
, &spr_write_generic
,
5320 /* Memory management */
5323 * XXX: beware that dcache line size is 64
5324 * but dcbz uses 32 bytes "sectors"
5325 * XXX: this breaks clcs instruction !
5327 env
->dcache_line_size
= 32;
5328 env
->icache_line_size
= 64;
5329 /* Allocate hardware IRQ controller */
5330 ppc6xx_irq_init(env_archcpu(env
));
5333 POWERPC_FAMILY(601)(ObjectClass
*oc
, void *data
)
5335 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5336 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5338 dc
->desc
= "PowerPC 601";
5339 pcc
->init_proc
= init_proc_601
;
5340 pcc
->check_pow
= check_pow_none
;
5341 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5343 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5344 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5345 PPC_SEGMENT
| PPC_EXTERN
;
5346 pcc
->msr_mask
= (1ull << MSR_EE
) |
5356 pcc
->mmu_model
= POWERPC_MMU_601
;
5357 #if defined(CONFIG_SOFTMMU)
5358 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5360 pcc
->excp_model
= POWERPC_EXCP_601
;
5361 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5362 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5363 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5366 #define POWERPC_MSRR_601v (0x0000000000001040ULL)
5368 static void init_proc_601v(CPUPPCState
*env
)
5371 /* XXX : not implemented */
5372 spr_register(env
, SPR_601_HID15
, "HID15",
5373 SPR_NOACCESS
, SPR_NOACCESS
,
5374 &spr_read_generic
, &spr_write_generic
,
5378 POWERPC_FAMILY(601v
)(ObjectClass
*oc
, void *data
)
5380 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5381 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5383 dc
->desc
= "PowerPC 601v";
5384 pcc
->init_proc
= init_proc_601v
;
5385 pcc
->check_pow
= check_pow_none
;
5386 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5388 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5389 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5390 PPC_SEGMENT
| PPC_EXTERN
;
5391 pcc
->msr_mask
= (1ull << MSR_EE
) |
5401 pcc
->mmu_model
= POWERPC_MMU_601
;
5402 #if defined(CONFIG_SOFTMMU)
5403 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5405 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5406 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5407 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5410 static void init_proc_602(CPUPPCState
*env
)
5412 gen_spr_ne_601(env
);
5417 /* hardware implementation registers */
5418 /* XXX : not implemented */
5419 spr_register(env
, SPR_HID0
, "HID0",
5420 SPR_NOACCESS
, SPR_NOACCESS
,
5421 &spr_read_generic
, &spr_write_generic
,
5423 /* XXX : not implemented */
5424 spr_register(env
, SPR_HID1
, "HID1",
5425 SPR_NOACCESS
, SPR_NOACCESS
,
5426 &spr_read_generic
, &spr_write_generic
,
5428 /* Memory management */
5430 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5432 env
->dcache_line_size
= 32;
5433 env
->icache_line_size
= 32;
5434 /* Allocate hardware IRQ controller */
5435 ppc6xx_irq_init(env_archcpu(env
));
5438 POWERPC_FAMILY(602)(ObjectClass
*oc
, void *data
)
5440 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5441 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5443 dc
->desc
= "PowerPC 602";
5444 pcc
->init_proc
= init_proc_602
;
5445 pcc
->check_pow
= check_pow_hid0
;
5446 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5447 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5448 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5449 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5450 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5451 PPC_MEM_TLBIE
| PPC_6xx_TLB
| PPC_MEM_TLBSYNC
|
5452 PPC_SEGMENT
| PPC_602_SPEC
;
5453 pcc
->msr_mask
= (1ull << MSR_VSX
) |
5456 (1ull << MSR_TGPR
) |
5471 /* XXX: 602 MMU is quite specific. Should add a special case */
5472 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5473 pcc
->excp_model
= POWERPC_EXCP_602
;
5474 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5475 pcc
->bfd_mach
= bfd_mach_ppc_602
;
5476 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5477 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5480 static void init_proc_603(CPUPPCState
*env
)
5482 gen_spr_ne_601(env
);
5487 /* hardware implementation registers */
5488 /* XXX : not implemented */
5489 spr_register(env
, SPR_HID0
, "HID0",
5490 SPR_NOACCESS
, SPR_NOACCESS
,
5491 &spr_read_generic
, &spr_write_generic
,
5493 /* XXX : not implemented */
5494 spr_register(env
, SPR_HID1
, "HID1",
5495 SPR_NOACCESS
, SPR_NOACCESS
,
5496 &spr_read_generic
, &spr_write_generic
,
5498 /* Memory management */
5500 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5502 env
->dcache_line_size
= 32;
5503 env
->icache_line_size
= 32;
5504 /* Allocate hardware IRQ controller */
5505 ppc6xx_irq_init(env_archcpu(env
));
5508 POWERPC_FAMILY(603)(ObjectClass
*oc
, void *data
)
5510 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5511 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5513 dc
->desc
= "PowerPC 603";
5514 pcc
->init_proc
= init_proc_603
;
5515 pcc
->check_pow
= check_pow_hid0
;
5516 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5517 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5518 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5519 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5520 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5521 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5522 PPC_SEGMENT
| PPC_EXTERN
;
5523 pcc
->msr_mask
= (1ull << MSR_POW
) |
5524 (1ull << MSR_TGPR
) |
5539 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5540 pcc
->excp_model
= POWERPC_EXCP_603
;
5541 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5542 pcc
->bfd_mach
= bfd_mach_ppc_603
;
5543 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5544 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5547 static void init_proc_603E(CPUPPCState
*env
)
5549 gen_spr_ne_601(env
);
5554 /* hardware implementation registers */
5555 /* XXX : not implemented */
5556 spr_register(env
, SPR_HID0
, "HID0",
5557 SPR_NOACCESS
, SPR_NOACCESS
,
5558 &spr_read_generic
, &spr_write_generic
,
5560 /* XXX : not implemented */
5561 spr_register(env
, SPR_HID1
, "HID1",
5562 SPR_NOACCESS
, SPR_NOACCESS
,
5563 &spr_read_generic
, &spr_write_generic
,
5565 /* Memory management */
5567 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5569 env
->dcache_line_size
= 32;
5570 env
->icache_line_size
= 32;
5571 /* Allocate hardware IRQ controller */
5572 ppc6xx_irq_init(env_archcpu(env
));
5575 POWERPC_FAMILY(603E
)(ObjectClass
*oc
, void *data
)
5577 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5578 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5580 dc
->desc
= "PowerPC 603e";
5581 pcc
->init_proc
= init_proc_603E
;
5582 pcc
->check_pow
= check_pow_hid0
;
5583 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5584 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5585 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5586 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5587 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5588 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5589 PPC_SEGMENT
| PPC_EXTERN
;
5590 pcc
->msr_mask
= (1ull << MSR_POW
) |
5591 (1ull << MSR_TGPR
) |
5606 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5607 pcc
->excp_model
= POWERPC_EXCP_603E
;
5608 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5609 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
5610 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5611 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5614 static void init_proc_604(CPUPPCState
*env
)
5616 gen_spr_ne_601(env
);
5621 /* Hardware implementation registers */
5622 /* XXX : not implemented */
5623 spr_register(env
, SPR_HID0
, "HID0",
5624 SPR_NOACCESS
, SPR_NOACCESS
,
5625 &spr_read_generic
, &spr_write_generic
,
5627 /* Memory management */
5630 env
->dcache_line_size
= 32;
5631 env
->icache_line_size
= 32;
5632 /* Allocate hardware IRQ controller */
5633 ppc6xx_irq_init(env_archcpu(env
));
5636 POWERPC_FAMILY(604)(ObjectClass
*oc
, void *data
)
5638 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5639 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5641 dc
->desc
= "PowerPC 604";
5642 pcc
->init_proc
= init_proc_604
;
5643 pcc
->check_pow
= check_pow_nocheck
;
5644 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5645 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5646 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5647 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5648 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5649 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5650 PPC_SEGMENT
| PPC_EXTERN
;
5651 pcc
->msr_mask
= (1ull << MSR_POW
) |
5667 pcc
->mmu_model
= POWERPC_MMU_32B
;
5668 #if defined(CONFIG_SOFTMMU)
5669 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5671 pcc
->excp_model
= POWERPC_EXCP_604
;
5672 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5673 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5674 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5675 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5678 static void init_proc_604E(CPUPPCState
*env
)
5680 gen_spr_ne_601(env
);
5683 /* XXX : not implemented */
5684 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
5685 SPR_NOACCESS
, SPR_NOACCESS
,
5686 &spr_read_generic
, &spr_write_generic
,
5688 /* XXX : not implemented */
5689 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
5690 SPR_NOACCESS
, SPR_NOACCESS
,
5691 &spr_read_generic
, &spr_write_generic
,
5693 /* XXX : not implemented */
5694 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
5695 SPR_NOACCESS
, SPR_NOACCESS
,
5696 &spr_read_generic
, &spr_write_generic
,
5700 /* Hardware implementation registers */
5701 /* XXX : not implemented */
5702 spr_register(env
, SPR_HID0
, "HID0",
5703 SPR_NOACCESS
, SPR_NOACCESS
,
5704 &spr_read_generic
, &spr_write_generic
,
5706 /* XXX : not implemented */
5707 spr_register(env
, SPR_HID1
, "HID1",
5708 SPR_NOACCESS
, SPR_NOACCESS
,
5709 &spr_read_generic
, &spr_write_generic
,
5711 /* Memory management */
5714 env
->dcache_line_size
= 32;
5715 env
->icache_line_size
= 32;
5716 /* Allocate hardware IRQ controller */
5717 ppc6xx_irq_init(env_archcpu(env
));
5720 POWERPC_FAMILY(604E
)(ObjectClass
*oc
, void *data
)
5722 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5723 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5725 dc
->desc
= "PowerPC 604E";
5726 pcc
->init_proc
= init_proc_604E
;
5727 pcc
->check_pow
= check_pow_nocheck
;
5728 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5729 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5730 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5731 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5732 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5733 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5734 PPC_SEGMENT
| PPC_EXTERN
;
5735 pcc
->msr_mask
= (1ull << MSR_POW
) |
5751 pcc
->mmu_model
= POWERPC_MMU_32B
;
5752 #if defined(CONFIG_SOFTMMU)
5753 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5755 pcc
->excp_model
= POWERPC_EXCP_604
;
5756 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5757 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5758 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5759 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5762 static void init_proc_740(CPUPPCState
*env
)
5764 gen_spr_ne_601(env
);
5769 /* Thermal management */
5771 /* Hardware implementation registers */
5772 /* XXX : not implemented */
5773 spr_register(env
, SPR_HID0
, "HID0",
5774 SPR_NOACCESS
, SPR_NOACCESS
,
5775 &spr_read_generic
, &spr_write_generic
,
5777 /* XXX : not implemented */
5778 spr_register(env
, SPR_HID1
, "HID1",
5779 SPR_NOACCESS
, SPR_NOACCESS
,
5780 &spr_read_generic
, &spr_write_generic
,
5782 /* Memory management */
5785 env
->dcache_line_size
= 32;
5786 env
->icache_line_size
= 32;
5787 /* Allocate hardware IRQ controller */
5788 ppc6xx_irq_init(env_archcpu(env
));
5791 POWERPC_FAMILY(740)(ObjectClass
*oc
, void *data
)
5793 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5794 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5796 dc
->desc
= "PowerPC 740";
5797 pcc
->init_proc
= init_proc_740
;
5798 pcc
->check_pow
= check_pow_hid0
;
5799 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5800 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5801 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5802 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5803 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5804 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5805 PPC_SEGMENT
| PPC_EXTERN
;
5806 pcc
->msr_mask
= (1ull << MSR_POW
) |
5822 pcc
->mmu_model
= POWERPC_MMU_32B
;
5823 #if defined(CONFIG_SOFTMMU)
5824 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5826 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5827 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5828 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5829 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5830 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5833 static void init_proc_750(CPUPPCState
*env
)
5835 gen_spr_ne_601(env
);
5838 /* XXX : not implemented */
5839 spr_register(env
, SPR_L2CR
, "L2CR",
5840 SPR_NOACCESS
, SPR_NOACCESS
,
5841 &spr_read_generic
, spr_access_nop
,
5845 /* Thermal management */
5847 /* Hardware implementation registers */
5848 /* XXX : not implemented */
5849 spr_register(env
, SPR_HID0
, "HID0",
5850 SPR_NOACCESS
, SPR_NOACCESS
,
5851 &spr_read_generic
, &spr_write_generic
,
5853 /* XXX : not implemented */
5854 spr_register(env
, SPR_HID1
, "HID1",
5855 SPR_NOACCESS
, SPR_NOACCESS
,
5856 &spr_read_generic
, &spr_write_generic
,
5858 /* Memory management */
5861 * XXX: high BATs are also present but are known to be bugged on
5865 env
->dcache_line_size
= 32;
5866 env
->icache_line_size
= 32;
5867 /* Allocate hardware IRQ controller */
5868 ppc6xx_irq_init(env_archcpu(env
));
5871 POWERPC_FAMILY(750)(ObjectClass
*oc
, void *data
)
5873 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5874 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5876 dc
->desc
= "PowerPC 750";
5877 pcc
->init_proc
= init_proc_750
;
5878 pcc
->check_pow
= check_pow_hid0
;
5879 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5880 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5881 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5882 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5883 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5884 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5885 PPC_SEGMENT
| PPC_EXTERN
;
5886 pcc
->msr_mask
= (1ull << MSR_POW
) |
5902 pcc
->mmu_model
= POWERPC_MMU_32B
;
5903 #if defined(CONFIG_SOFTMMU)
5904 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5906 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5907 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5908 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5909 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5910 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5913 static void init_proc_750cl(CPUPPCState
*env
)
5915 gen_spr_ne_601(env
);
5918 /* XXX : not implemented */
5919 spr_register(env
, SPR_L2CR
, "L2CR",
5920 SPR_NOACCESS
, SPR_NOACCESS
,
5921 &spr_read_generic
, spr_access_nop
,
5925 /* Thermal management */
5926 /* Those registers are fake on 750CL */
5927 spr_register(env
, SPR_THRM1
, "THRM1",
5928 SPR_NOACCESS
, SPR_NOACCESS
,
5929 &spr_read_generic
, &spr_write_generic
,
5931 spr_register(env
, SPR_THRM2
, "THRM2",
5932 SPR_NOACCESS
, SPR_NOACCESS
,
5933 &spr_read_generic
, &spr_write_generic
,
5935 spr_register(env
, SPR_THRM3
, "THRM3",
5936 SPR_NOACCESS
, SPR_NOACCESS
,
5937 &spr_read_generic
, &spr_write_generic
,
5939 /* XXX: not implemented */
5940 spr_register(env
, SPR_750_TDCL
, "TDCL",
5941 SPR_NOACCESS
, SPR_NOACCESS
,
5942 &spr_read_generic
, &spr_write_generic
,
5944 spr_register(env
, SPR_750_TDCH
, "TDCH",
5945 SPR_NOACCESS
, SPR_NOACCESS
,
5946 &spr_read_generic
, &spr_write_generic
,
5949 /* XXX : not implemented */
5950 spr_register(env
, SPR_750_WPAR
, "WPAR",
5951 SPR_NOACCESS
, SPR_NOACCESS
,
5952 &spr_read_generic
, &spr_write_generic
,
5954 spr_register(env
, SPR_750_DMAL
, "DMAL",
5955 SPR_NOACCESS
, SPR_NOACCESS
,
5956 &spr_read_generic
, &spr_write_generic
,
5958 spr_register(env
, SPR_750_DMAU
, "DMAU",
5959 SPR_NOACCESS
, SPR_NOACCESS
,
5960 &spr_read_generic
, &spr_write_generic
,
5962 /* Hardware implementation registers */
5963 /* XXX : not implemented */
5964 spr_register(env
, SPR_HID0
, "HID0",
5965 SPR_NOACCESS
, SPR_NOACCESS
,
5966 &spr_read_generic
, &spr_write_generic
,
5968 /* XXX : not implemented */
5969 spr_register(env
, SPR_HID1
, "HID1",
5970 SPR_NOACCESS
, SPR_NOACCESS
,
5971 &spr_read_generic
, &spr_write_generic
,
5973 /* XXX : not implemented */
5974 spr_register(env
, SPR_750CL_HID2
, "HID2",
5975 SPR_NOACCESS
, SPR_NOACCESS
,
5976 &spr_read_generic
, &spr_write_generic
,
5978 /* XXX : not implemented */
5979 spr_register(env
, SPR_750CL_HID4
, "HID4",
5980 SPR_NOACCESS
, SPR_NOACCESS
,
5981 &spr_read_generic
, &spr_write_generic
,
5983 /* Quantization registers */
5984 /* XXX : not implemented */
5985 spr_register(env
, SPR_750_GQR0
, "GQR0",
5986 SPR_NOACCESS
, SPR_NOACCESS
,
5987 &spr_read_generic
, &spr_write_generic
,
5989 /* XXX : not implemented */
5990 spr_register(env
, SPR_750_GQR1
, "GQR1",
5991 SPR_NOACCESS
, SPR_NOACCESS
,
5992 &spr_read_generic
, &spr_write_generic
,
5994 /* XXX : not implemented */
5995 spr_register(env
, SPR_750_GQR2
, "GQR2",
5996 SPR_NOACCESS
, SPR_NOACCESS
,
5997 &spr_read_generic
, &spr_write_generic
,
5999 /* XXX : not implemented */
6000 spr_register(env
, SPR_750_GQR3
, "GQR3",
6001 SPR_NOACCESS
, SPR_NOACCESS
,
6002 &spr_read_generic
, &spr_write_generic
,
6004 /* XXX : not implemented */
6005 spr_register(env
, SPR_750_GQR4
, "GQR4",
6006 SPR_NOACCESS
, SPR_NOACCESS
,
6007 &spr_read_generic
, &spr_write_generic
,
6009 /* XXX : not implemented */
6010 spr_register(env
, SPR_750_GQR5
, "GQR5",
6011 SPR_NOACCESS
, SPR_NOACCESS
,
6012 &spr_read_generic
, &spr_write_generic
,
6014 /* XXX : not implemented */
6015 spr_register(env
, SPR_750_GQR6
, "GQR6",
6016 SPR_NOACCESS
, SPR_NOACCESS
,
6017 &spr_read_generic
, &spr_write_generic
,
6019 /* XXX : not implemented */
6020 spr_register(env
, SPR_750_GQR7
, "GQR7",
6021 SPR_NOACCESS
, SPR_NOACCESS
,
6022 &spr_read_generic
, &spr_write_generic
,
6024 /* Memory management */
6026 /* PowerPC 750cl has 8 DBATs and 8 IBATs */
6028 init_excp_750cl(env
);
6029 env
->dcache_line_size
= 32;
6030 env
->icache_line_size
= 32;
6031 /* Allocate hardware IRQ controller */
6032 ppc6xx_irq_init(env_archcpu(env
));
6035 POWERPC_FAMILY(750cl
)(ObjectClass
*oc
, void *data
)
6037 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6038 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6040 dc
->desc
= "PowerPC 750 CL";
6041 pcc
->init_proc
= init_proc_750cl
;
6042 pcc
->check_pow
= check_pow_hid0
;
6044 * XXX: not implemented:
6045 * cache lock instructions:
6047 * floating point paired instructions
6082 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6083 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6084 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6085 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6086 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6087 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6088 PPC_SEGMENT
| PPC_EXTERN
;
6089 pcc
->msr_mask
= (1ull << MSR_POW
) |
6105 pcc
->mmu_model
= POWERPC_MMU_32B
;
6106 #if defined(CONFIG_SOFTMMU)
6107 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6109 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6110 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6111 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6112 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6113 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6116 static void init_proc_750cx(CPUPPCState
*env
)
6118 gen_spr_ne_601(env
);
6121 /* XXX : not implemented */
6122 spr_register(env
, SPR_L2CR
, "L2CR",
6123 SPR_NOACCESS
, SPR_NOACCESS
,
6124 &spr_read_generic
, spr_access_nop
,
6128 /* Thermal management */
6130 /* This register is not implemented but is present for compatibility */
6131 spr_register(env
, SPR_SDA
, "SDA",
6132 SPR_NOACCESS
, SPR_NOACCESS
,
6133 &spr_read_generic
, &spr_write_generic
,
6135 /* Hardware implementation registers */
6136 /* XXX : not implemented */
6137 spr_register(env
, SPR_HID0
, "HID0",
6138 SPR_NOACCESS
, SPR_NOACCESS
,
6139 &spr_read_generic
, &spr_write_generic
,
6141 /* XXX : not implemented */
6142 spr_register(env
, SPR_HID1
, "HID1",
6143 SPR_NOACCESS
, SPR_NOACCESS
,
6144 &spr_read_generic
, &spr_write_generic
,
6146 /* Memory management */
6148 /* PowerPC 750cx has 8 DBATs and 8 IBATs */
6150 init_excp_750cx(env
);
6151 env
->dcache_line_size
= 32;
6152 env
->icache_line_size
= 32;
6153 /* Allocate hardware IRQ controller */
6154 ppc6xx_irq_init(env_archcpu(env
));
6157 POWERPC_FAMILY(750cx
)(ObjectClass
*oc
, void *data
)
6159 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6160 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6162 dc
->desc
= "PowerPC 750CX";
6163 pcc
->init_proc
= init_proc_750cx
;
6164 pcc
->check_pow
= check_pow_hid0
;
6165 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6166 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6167 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6168 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6169 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6170 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6171 PPC_SEGMENT
| PPC_EXTERN
;
6172 pcc
->msr_mask
= (1ull << MSR_POW
) |
6188 pcc
->mmu_model
= POWERPC_MMU_32B
;
6189 #if defined(CONFIG_SOFTMMU)
6190 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6192 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6193 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6194 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6195 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6196 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6199 static void init_proc_750fx(CPUPPCState
*env
)
6201 gen_spr_ne_601(env
);
6204 /* XXX : not implemented */
6205 spr_register(env
, SPR_L2CR
, "L2CR",
6206 SPR_NOACCESS
, SPR_NOACCESS
,
6207 &spr_read_generic
, spr_access_nop
,
6211 /* Thermal management */
6213 /* XXX : not implemented */
6214 spr_register(env
, SPR_750_THRM4
, "THRM4",
6215 SPR_NOACCESS
, SPR_NOACCESS
,
6216 &spr_read_generic
, &spr_write_generic
,
6218 /* Hardware implementation registers */
6219 /* XXX : not implemented */
6220 spr_register(env
, SPR_HID0
, "HID0",
6221 SPR_NOACCESS
, SPR_NOACCESS
,
6222 &spr_read_generic
, &spr_write_generic
,
6224 /* XXX : not implemented */
6225 spr_register(env
, SPR_HID1
, "HID1",
6226 SPR_NOACCESS
, SPR_NOACCESS
,
6227 &spr_read_generic
, &spr_write_generic
,
6229 /* XXX : not implemented */
6230 spr_register(env
, SPR_750FX_HID2
, "HID2",
6231 SPR_NOACCESS
, SPR_NOACCESS
,
6232 &spr_read_generic
, &spr_write_generic
,
6234 /* Memory management */
6236 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6239 env
->dcache_line_size
= 32;
6240 env
->icache_line_size
= 32;
6241 /* Allocate hardware IRQ controller */
6242 ppc6xx_irq_init(env_archcpu(env
));
6245 POWERPC_FAMILY(750fx
)(ObjectClass
*oc
, void *data
)
6247 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6248 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6250 dc
->desc
= "PowerPC 750FX";
6251 pcc
->init_proc
= init_proc_750fx
;
6252 pcc
->check_pow
= check_pow_hid0
;
6253 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6254 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6255 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6256 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6257 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6258 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6259 PPC_SEGMENT
| PPC_EXTERN
;
6260 pcc
->msr_mask
= (1ull << MSR_POW
) |
6276 pcc
->mmu_model
= POWERPC_MMU_32B
;
6277 #if defined(CONFIG_SOFTMMU)
6278 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6280 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6281 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6282 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6283 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6284 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6287 static void init_proc_750gx(CPUPPCState
*env
)
6289 gen_spr_ne_601(env
);
6292 /* XXX : not implemented (XXX: different from 750fx) */
6293 spr_register(env
, SPR_L2CR
, "L2CR",
6294 SPR_NOACCESS
, SPR_NOACCESS
,
6295 &spr_read_generic
, spr_access_nop
,
6299 /* Thermal management */
6301 /* XXX : not implemented */
6302 spr_register(env
, SPR_750_THRM4
, "THRM4",
6303 SPR_NOACCESS
, SPR_NOACCESS
,
6304 &spr_read_generic
, &spr_write_generic
,
6306 /* Hardware implementation registers */
6307 /* XXX : not implemented (XXX: different from 750fx) */
6308 spr_register(env
, SPR_HID0
, "HID0",
6309 SPR_NOACCESS
, SPR_NOACCESS
,
6310 &spr_read_generic
, &spr_write_generic
,
6312 /* XXX : not implemented */
6313 spr_register(env
, SPR_HID1
, "HID1",
6314 SPR_NOACCESS
, SPR_NOACCESS
,
6315 &spr_read_generic
, &spr_write_generic
,
6317 /* XXX : not implemented (XXX: different from 750fx) */
6318 spr_register(env
, SPR_750FX_HID2
, "HID2",
6319 SPR_NOACCESS
, SPR_NOACCESS
,
6320 &spr_read_generic
, &spr_write_generic
,
6322 /* Memory management */
6324 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6327 env
->dcache_line_size
= 32;
6328 env
->icache_line_size
= 32;
6329 /* Allocate hardware IRQ controller */
6330 ppc6xx_irq_init(env_archcpu(env
));
6333 POWERPC_FAMILY(750gx
)(ObjectClass
*oc
, void *data
)
6335 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6336 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6338 dc
->desc
= "PowerPC 750GX";
6339 pcc
->init_proc
= init_proc_750gx
;
6340 pcc
->check_pow
= check_pow_hid0
;
6341 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6342 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6343 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6344 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6345 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6346 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6347 PPC_SEGMENT
| PPC_EXTERN
;
6348 pcc
->msr_mask
= (1ull << MSR_POW
) |
6364 pcc
->mmu_model
= POWERPC_MMU_32B
;
6365 #if defined(CONFIG_SOFTMMU)
6366 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6368 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6369 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6370 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6371 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6372 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6375 static void init_proc_745(CPUPPCState
*env
)
6377 gen_spr_ne_601(env
);
6380 gen_spr_G2_755(env
);
6383 /* Thermal management */
6385 /* Hardware implementation registers */
6386 /* XXX : not implemented */
6387 spr_register(env
, SPR_HID0
, "HID0",
6388 SPR_NOACCESS
, SPR_NOACCESS
,
6389 &spr_read_generic
, &spr_write_generic
,
6391 /* XXX : not implemented */
6392 spr_register(env
, SPR_HID1
, "HID1",
6393 SPR_NOACCESS
, SPR_NOACCESS
,
6394 &spr_read_generic
, &spr_write_generic
,
6396 /* XXX : not implemented */
6397 spr_register(env
, SPR_HID2
, "HID2",
6398 SPR_NOACCESS
, SPR_NOACCESS
,
6399 &spr_read_generic
, &spr_write_generic
,
6401 /* Memory management */
6404 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6406 env
->dcache_line_size
= 32;
6407 env
->icache_line_size
= 32;
6408 /* Allocate hardware IRQ controller */
6409 ppc6xx_irq_init(env_archcpu(env
));
6412 POWERPC_FAMILY(745)(ObjectClass
*oc
, void *data
)
6414 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6415 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6417 dc
->desc
= "PowerPC 745";
6418 pcc
->init_proc
= init_proc_745
;
6419 pcc
->check_pow
= check_pow_hid0
;
6420 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6421 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6422 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6423 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6424 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6425 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6426 PPC_SEGMENT
| PPC_EXTERN
;
6427 pcc
->msr_mask
= (1ull << MSR_POW
) |
6443 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6444 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6445 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6446 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6447 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6448 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6451 static void init_proc_755(CPUPPCState
*env
)
6453 gen_spr_ne_601(env
);
6456 gen_spr_G2_755(env
);
6459 /* L2 cache control */
6460 /* XXX : not implemented */
6461 spr_register(env
, SPR_L2CR
, "L2CR",
6462 SPR_NOACCESS
, SPR_NOACCESS
,
6463 &spr_read_generic
, spr_access_nop
,
6465 /* XXX : not implemented */
6466 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6467 SPR_NOACCESS
, SPR_NOACCESS
,
6468 &spr_read_generic
, &spr_write_generic
,
6470 /* Thermal management */
6472 /* Hardware implementation registers */
6473 /* XXX : not implemented */
6474 spr_register(env
, SPR_HID0
, "HID0",
6475 SPR_NOACCESS
, SPR_NOACCESS
,
6476 &spr_read_generic
, &spr_write_generic
,
6478 /* XXX : not implemented */
6479 spr_register(env
, SPR_HID1
, "HID1",
6480 SPR_NOACCESS
, SPR_NOACCESS
,
6481 &spr_read_generic
, &spr_write_generic
,
6483 /* XXX : not implemented */
6484 spr_register(env
, SPR_HID2
, "HID2",
6485 SPR_NOACCESS
, SPR_NOACCESS
,
6486 &spr_read_generic
, &spr_write_generic
,
6488 /* Memory management */
6491 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6493 env
->dcache_line_size
= 32;
6494 env
->icache_line_size
= 32;
6495 /* Allocate hardware IRQ controller */
6496 ppc6xx_irq_init(env_archcpu(env
));
6499 POWERPC_FAMILY(755)(ObjectClass
*oc
, void *data
)
6501 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6502 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6504 dc
->desc
= "PowerPC 755";
6505 pcc
->init_proc
= init_proc_755
;
6506 pcc
->check_pow
= check_pow_hid0
;
6507 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6508 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6509 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6510 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6511 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6512 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6513 PPC_SEGMENT
| PPC_EXTERN
;
6514 pcc
->msr_mask
= (1ull << MSR_POW
) |
6530 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6531 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6532 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6533 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6534 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6535 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6538 static void init_proc_7400(CPUPPCState
*env
)
6540 gen_spr_ne_601(env
);
6545 /* 74xx specific SPR */
6547 /* XXX : not implemented */
6548 spr_register(env
, SPR_UBAMR
, "UBAMR",
6549 &spr_read_ureg
, SPR_NOACCESS
,
6550 &spr_read_ureg
, SPR_NOACCESS
,
6552 /* XXX: this seems not implemented on all revisions. */
6553 /* XXX : not implemented */
6554 spr_register(env
, SPR_MSSCR1
, "MSSCR1",
6555 SPR_NOACCESS
, SPR_NOACCESS
,
6556 &spr_read_generic
, &spr_write_generic
,
6558 /* Thermal management */
6560 /* Memory management */
6562 init_excp_7400(env
);
6563 env
->dcache_line_size
= 32;
6564 env
->icache_line_size
= 32;
6565 /* Allocate hardware IRQ controller */
6566 ppc6xx_irq_init(env_archcpu(env
));
6569 POWERPC_FAMILY(7400)(ObjectClass
*oc
, void *data
)
6571 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6572 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6574 dc
->desc
= "PowerPC 7400 (aka G4)";
6575 pcc
->init_proc
= init_proc_7400
;
6576 pcc
->check_pow
= check_pow_hid0
;
6577 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6578 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6579 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6581 PPC_CACHE
| PPC_CACHE_ICBI
|
6582 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6583 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6584 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6586 PPC_SEGMENT
| PPC_EXTERN
|
6588 pcc
->msr_mask
= (1ull << MSR_VR
) |
6605 pcc
->mmu_model
= POWERPC_MMU_32B
;
6606 #if defined(CONFIG_SOFTMMU)
6607 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6609 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6610 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6611 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6612 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6613 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6614 POWERPC_FLAG_BUS_CLK
;
6617 static void init_proc_7410(CPUPPCState
*env
)
6619 gen_spr_ne_601(env
);
6624 /* 74xx specific SPR */
6626 /* XXX : not implemented */
6627 spr_register(env
, SPR_UBAMR
, "UBAMR",
6628 &spr_read_ureg
, SPR_NOACCESS
,
6629 &spr_read_ureg
, SPR_NOACCESS
,
6631 /* Thermal management */
6634 /* XXX : not implemented */
6635 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6636 SPR_NOACCESS
, SPR_NOACCESS
,
6637 &spr_read_generic
, &spr_write_generic
,
6640 /* XXX : not implemented */
6641 spr_register(env
, SPR_LDSTDB
, "LDSTDB",
6642 SPR_NOACCESS
, SPR_NOACCESS
,
6643 &spr_read_generic
, &spr_write_generic
,
6645 /* Memory management */
6647 init_excp_7400(env
);
6648 env
->dcache_line_size
= 32;
6649 env
->icache_line_size
= 32;
6650 /* Allocate hardware IRQ controller */
6651 ppc6xx_irq_init(env_archcpu(env
));
6654 POWERPC_FAMILY(7410)(ObjectClass
*oc
, void *data
)
6656 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6657 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6659 dc
->desc
= "PowerPC 7410 (aka G4)";
6660 pcc
->init_proc
= init_proc_7410
;
6661 pcc
->check_pow
= check_pow_hid0
;
6662 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6663 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6664 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6666 PPC_CACHE
| PPC_CACHE_ICBI
|
6667 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6668 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6669 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6671 PPC_SEGMENT
| PPC_EXTERN
|
6673 pcc
->msr_mask
= (1ull << MSR_VR
) |
6690 pcc
->mmu_model
= POWERPC_MMU_32B
;
6691 #if defined(CONFIG_SOFTMMU)
6692 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6694 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6695 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6696 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6697 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6698 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6699 POWERPC_FLAG_BUS_CLK
;
6702 static void init_proc_7440(CPUPPCState
*env
)
6704 gen_spr_ne_601(env
);
6709 /* 74xx specific SPR */
6711 /* XXX : not implemented */
6712 spr_register(env
, SPR_UBAMR
, "UBAMR",
6713 &spr_read_ureg
, SPR_NOACCESS
,
6714 &spr_read_ureg
, SPR_NOACCESS
,
6717 /* XXX : not implemented */
6718 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6719 SPR_NOACCESS
, SPR_NOACCESS
,
6720 &spr_read_generic
, &spr_write_generic
,
6723 /* XXX : not implemented */
6724 spr_register(env
, SPR_ICTRL
, "ICTRL",
6725 SPR_NOACCESS
, SPR_NOACCESS
,
6726 &spr_read_generic
, &spr_write_generic
,
6729 /* XXX : not implemented */
6730 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6731 SPR_NOACCESS
, SPR_NOACCESS
,
6732 &spr_read_generic
, &spr_write_generic
,
6735 /* XXX : not implemented */
6736 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6737 SPR_NOACCESS
, SPR_NOACCESS
,
6738 &spr_read_generic
, &spr_write_generic
,
6740 /* XXX : not implemented */
6741 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6742 &spr_read_ureg
, SPR_NOACCESS
,
6743 &spr_read_ureg
, SPR_NOACCESS
,
6745 /* XXX : not implemented */
6746 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6747 SPR_NOACCESS
, SPR_NOACCESS
,
6748 &spr_read_generic
, &spr_write_generic
,
6750 /* XXX : not implemented */
6751 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6752 &spr_read_ureg
, SPR_NOACCESS
,
6753 &spr_read_ureg
, SPR_NOACCESS
,
6755 /* Memory management */
6757 gen_74xx_soft_tlb(env
, 128, 2);
6758 init_excp_7450(env
);
6759 env
->dcache_line_size
= 32;
6760 env
->icache_line_size
= 32;
6761 /* Allocate hardware IRQ controller */
6762 ppc6xx_irq_init(env_archcpu(env
));
6765 POWERPC_FAMILY(7440)(ObjectClass
*oc
, void *data
)
6767 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6768 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6770 dc
->desc
= "PowerPC 7440 (aka G4)";
6771 pcc
->init_proc
= init_proc_7440
;
6772 pcc
->check_pow
= check_pow_hid0_74xx
;
6773 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6774 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6775 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6777 PPC_CACHE
| PPC_CACHE_ICBI
|
6778 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6779 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6780 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6781 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6782 PPC_SEGMENT
| PPC_EXTERN
|
6784 pcc
->msr_mask
= (1ull << MSR_VR
) |
6801 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6802 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6803 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6804 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6805 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6806 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6807 POWERPC_FLAG_BUS_CLK
;
6810 static void init_proc_7450(CPUPPCState
*env
)
6812 gen_spr_ne_601(env
);
6817 /* 74xx specific SPR */
6819 /* Level 3 cache control */
6822 /* XXX : not implemented */
6823 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
6824 SPR_NOACCESS
, SPR_NOACCESS
,
6825 &spr_read_generic
, &spr_write_generic
,
6828 /* XXX : not implemented */
6829 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
6830 SPR_NOACCESS
, SPR_NOACCESS
,
6831 &spr_read_generic
, &spr_write_generic
,
6834 /* XXX : not implemented */
6835 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
6836 SPR_NOACCESS
, SPR_NOACCESS
,
6837 &spr_read_generic
, &spr_write_generic
,
6840 /* XXX : not implemented */
6841 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
6842 SPR_NOACCESS
, SPR_NOACCESS
,
6843 &spr_read_generic
, &spr_write_generic
,
6845 /* XXX : not implemented */
6846 spr_register(env
, SPR_UBAMR
, "UBAMR",
6847 &spr_read_ureg
, SPR_NOACCESS
,
6848 &spr_read_ureg
, SPR_NOACCESS
,
6851 /* XXX : not implemented */
6852 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6853 SPR_NOACCESS
, SPR_NOACCESS
,
6854 &spr_read_generic
, &spr_write_generic
,
6857 /* XXX : not implemented */
6858 spr_register(env
, SPR_ICTRL
, "ICTRL",
6859 SPR_NOACCESS
, SPR_NOACCESS
,
6860 &spr_read_generic
, &spr_write_generic
,
6863 /* XXX : not implemented */
6864 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6865 SPR_NOACCESS
, SPR_NOACCESS
,
6866 &spr_read_generic
, &spr_write_generic
,
6869 /* XXX : not implemented */
6870 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6871 SPR_NOACCESS
, SPR_NOACCESS
,
6872 &spr_read_generic
, &spr_write_generic
,
6874 /* XXX : not implemented */
6875 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6876 &spr_read_ureg
, SPR_NOACCESS
,
6877 &spr_read_ureg
, SPR_NOACCESS
,
6879 /* XXX : not implemented */
6880 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6881 SPR_NOACCESS
, SPR_NOACCESS
,
6882 &spr_read_generic
, &spr_write_generic
,
6884 /* XXX : not implemented */
6885 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6886 &spr_read_ureg
, SPR_NOACCESS
,
6887 &spr_read_ureg
, SPR_NOACCESS
,
6889 /* Memory management */
6891 gen_74xx_soft_tlb(env
, 128, 2);
6892 init_excp_7450(env
);
6893 env
->dcache_line_size
= 32;
6894 env
->icache_line_size
= 32;
6895 /* Allocate hardware IRQ controller */
6896 ppc6xx_irq_init(env_archcpu(env
));
6899 POWERPC_FAMILY(7450)(ObjectClass
*oc
, void *data
)
6901 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6902 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6904 dc
->desc
= "PowerPC 7450 (aka G4)";
6905 pcc
->init_proc
= init_proc_7450
;
6906 pcc
->check_pow
= check_pow_hid0_74xx
;
6907 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6908 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6909 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6911 PPC_CACHE
| PPC_CACHE_ICBI
|
6912 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6913 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6914 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6915 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6916 PPC_SEGMENT
| PPC_EXTERN
|
6918 pcc
->msr_mask
= (1ull << MSR_VR
) |
6935 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6936 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6937 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6938 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6939 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6940 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6941 POWERPC_FLAG_BUS_CLK
;
6944 static void init_proc_7445(CPUPPCState
*env
)
6946 gen_spr_ne_601(env
);
6951 /* 74xx specific SPR */
6954 /* XXX : not implemented */
6955 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6956 SPR_NOACCESS
, SPR_NOACCESS
,
6957 &spr_read_generic
, &spr_write_generic
,
6960 /* XXX : not implemented */
6961 spr_register(env
, SPR_ICTRL
, "ICTRL",
6962 SPR_NOACCESS
, SPR_NOACCESS
,
6963 &spr_read_generic
, &spr_write_generic
,
6966 /* XXX : not implemented */
6967 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6968 SPR_NOACCESS
, SPR_NOACCESS
,
6969 &spr_read_generic
, &spr_write_generic
,
6972 /* XXX : not implemented */
6973 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6974 SPR_NOACCESS
, SPR_NOACCESS
,
6975 &spr_read_generic
, &spr_write_generic
,
6977 /* XXX : not implemented */
6978 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6979 &spr_read_ureg
, SPR_NOACCESS
,
6980 &spr_read_ureg
, SPR_NOACCESS
,
6982 /* XXX : not implemented */
6983 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6984 SPR_NOACCESS
, SPR_NOACCESS
,
6985 &spr_read_generic
, &spr_write_generic
,
6987 /* XXX : not implemented */
6988 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6989 &spr_read_ureg
, SPR_NOACCESS
,
6990 &spr_read_ureg
, SPR_NOACCESS
,
6993 spr_register(env
, SPR_SPRG4
, "SPRG4",
6994 SPR_NOACCESS
, SPR_NOACCESS
,
6995 &spr_read_generic
, &spr_write_generic
,
6997 spr_register(env
, SPR_USPRG4
, "USPRG4",
6998 &spr_read_ureg
, SPR_NOACCESS
,
6999 &spr_read_ureg
, SPR_NOACCESS
,
7001 spr_register(env
, SPR_SPRG5
, "SPRG5",
7002 SPR_NOACCESS
, SPR_NOACCESS
,
7003 &spr_read_generic
, &spr_write_generic
,
7005 spr_register(env
, SPR_USPRG5
, "USPRG5",
7006 &spr_read_ureg
, SPR_NOACCESS
,
7007 &spr_read_ureg
, SPR_NOACCESS
,
7009 spr_register(env
, SPR_SPRG6
, "SPRG6",
7010 SPR_NOACCESS
, SPR_NOACCESS
,
7011 &spr_read_generic
, &spr_write_generic
,
7013 spr_register(env
, SPR_USPRG6
, "USPRG6",
7014 &spr_read_ureg
, SPR_NOACCESS
,
7015 &spr_read_ureg
, SPR_NOACCESS
,
7017 spr_register(env
, SPR_SPRG7
, "SPRG7",
7018 SPR_NOACCESS
, SPR_NOACCESS
,
7019 &spr_read_generic
, &spr_write_generic
,
7021 spr_register(env
, SPR_USPRG7
, "USPRG7",
7022 &spr_read_ureg
, SPR_NOACCESS
,
7023 &spr_read_ureg
, SPR_NOACCESS
,
7025 /* Memory management */
7028 gen_74xx_soft_tlb(env
, 128, 2);
7029 init_excp_7450(env
);
7030 env
->dcache_line_size
= 32;
7031 env
->icache_line_size
= 32;
7032 /* Allocate hardware IRQ controller */
7033 ppc6xx_irq_init(env_archcpu(env
));
7036 POWERPC_FAMILY(7445)(ObjectClass
*oc
, void *data
)
7038 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7039 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7041 dc
->desc
= "PowerPC 7445 (aka G4)";
7042 pcc
->init_proc
= init_proc_7445
;
7043 pcc
->check_pow
= check_pow_hid0_74xx
;
7044 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7045 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7046 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7048 PPC_CACHE
| PPC_CACHE_ICBI
|
7049 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7050 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7051 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7052 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7053 PPC_SEGMENT
| PPC_EXTERN
|
7055 pcc
->msr_mask
= (1ull << MSR_VR
) |
7072 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7073 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7074 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7075 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7076 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7077 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7078 POWERPC_FLAG_BUS_CLK
;
7081 static void init_proc_7455(CPUPPCState
*env
)
7083 gen_spr_ne_601(env
);
7088 /* 74xx specific SPR */
7090 /* Level 3 cache control */
7093 /* XXX : not implemented */
7094 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7095 SPR_NOACCESS
, SPR_NOACCESS
,
7096 &spr_read_generic
, &spr_write_generic
,
7099 /* XXX : not implemented */
7100 spr_register(env
, SPR_ICTRL
, "ICTRL",
7101 SPR_NOACCESS
, SPR_NOACCESS
,
7102 &spr_read_generic
, &spr_write_generic
,
7105 /* XXX : not implemented */
7106 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7107 SPR_NOACCESS
, SPR_NOACCESS
,
7108 &spr_read_generic
, &spr_write_generic
,
7111 /* XXX : not implemented */
7112 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7113 SPR_NOACCESS
, SPR_NOACCESS
,
7114 &spr_read_generic
, &spr_write_generic
,
7116 /* XXX : not implemented */
7117 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7118 &spr_read_ureg
, SPR_NOACCESS
,
7119 &spr_read_ureg
, SPR_NOACCESS
,
7121 /* XXX : not implemented */
7122 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7123 SPR_NOACCESS
, SPR_NOACCESS
,
7124 &spr_read_generic
, &spr_write_generic
,
7126 /* XXX : not implemented */
7127 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7128 &spr_read_ureg
, SPR_NOACCESS
,
7129 &spr_read_ureg
, SPR_NOACCESS
,
7132 spr_register(env
, SPR_SPRG4
, "SPRG4",
7133 SPR_NOACCESS
, SPR_NOACCESS
,
7134 &spr_read_generic
, &spr_write_generic
,
7136 spr_register(env
, SPR_USPRG4
, "USPRG4",
7137 &spr_read_ureg
, SPR_NOACCESS
,
7138 &spr_read_ureg
, SPR_NOACCESS
,
7140 spr_register(env
, SPR_SPRG5
, "SPRG5",
7141 SPR_NOACCESS
, SPR_NOACCESS
,
7142 &spr_read_generic
, &spr_write_generic
,
7144 spr_register(env
, SPR_USPRG5
, "USPRG5",
7145 &spr_read_ureg
, SPR_NOACCESS
,
7146 &spr_read_ureg
, SPR_NOACCESS
,
7148 spr_register(env
, SPR_SPRG6
, "SPRG6",
7149 SPR_NOACCESS
, SPR_NOACCESS
,
7150 &spr_read_generic
, &spr_write_generic
,
7152 spr_register(env
, SPR_USPRG6
, "USPRG6",
7153 &spr_read_ureg
, SPR_NOACCESS
,
7154 &spr_read_ureg
, SPR_NOACCESS
,
7156 spr_register(env
, SPR_SPRG7
, "SPRG7",
7157 SPR_NOACCESS
, SPR_NOACCESS
,
7158 &spr_read_generic
, &spr_write_generic
,
7160 spr_register(env
, SPR_USPRG7
, "USPRG7",
7161 &spr_read_ureg
, SPR_NOACCESS
,
7162 &spr_read_ureg
, SPR_NOACCESS
,
7164 /* Memory management */
7167 gen_74xx_soft_tlb(env
, 128, 2);
7168 init_excp_7450(env
);
7169 env
->dcache_line_size
= 32;
7170 env
->icache_line_size
= 32;
7171 /* Allocate hardware IRQ controller */
7172 ppc6xx_irq_init(env_archcpu(env
));
7175 POWERPC_FAMILY(7455)(ObjectClass
*oc
, void *data
)
7177 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7178 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7180 dc
->desc
= "PowerPC 7455 (aka G4)";
7181 pcc
->init_proc
= init_proc_7455
;
7182 pcc
->check_pow
= check_pow_hid0_74xx
;
7183 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7184 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7185 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7187 PPC_CACHE
| PPC_CACHE_ICBI
|
7188 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7189 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7190 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7191 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7192 PPC_SEGMENT
| PPC_EXTERN
|
7194 pcc
->msr_mask
= (1ull << MSR_VR
) |
7211 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7212 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7213 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7214 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7215 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7216 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7217 POWERPC_FLAG_BUS_CLK
;
7220 static void init_proc_7457(CPUPPCState
*env
)
7222 gen_spr_ne_601(env
);
7227 /* 74xx specific SPR */
7229 /* Level 3 cache control */
7232 /* XXX : not implemented */
7233 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
7234 SPR_NOACCESS
, SPR_NOACCESS
,
7235 &spr_read_generic
, &spr_write_generic
,
7238 /* XXX : not implemented */
7239 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
7240 SPR_NOACCESS
, SPR_NOACCESS
,
7241 &spr_read_generic
, &spr_write_generic
,
7244 /* XXX : not implemented */
7245 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
7246 SPR_NOACCESS
, SPR_NOACCESS
,
7247 &spr_read_generic
, &spr_write_generic
,
7250 /* XXX : not implemented */
7251 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
7252 SPR_NOACCESS
, SPR_NOACCESS
,
7253 &spr_read_generic
, &spr_write_generic
,
7256 /* XXX : not implemented */
7257 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7258 SPR_NOACCESS
, SPR_NOACCESS
,
7259 &spr_read_generic
, &spr_write_generic
,
7262 /* XXX : not implemented */
7263 spr_register(env
, SPR_ICTRL
, "ICTRL",
7264 SPR_NOACCESS
, SPR_NOACCESS
,
7265 &spr_read_generic
, &spr_write_generic
,
7268 /* XXX : not implemented */
7269 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7270 SPR_NOACCESS
, SPR_NOACCESS
,
7271 &spr_read_generic
, &spr_write_generic
,
7274 /* XXX : not implemented */
7275 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7276 SPR_NOACCESS
, SPR_NOACCESS
,
7277 &spr_read_generic
, &spr_write_generic
,
7279 /* XXX : not implemented */
7280 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7281 &spr_read_ureg
, SPR_NOACCESS
,
7282 &spr_read_ureg
, SPR_NOACCESS
,
7284 /* XXX : not implemented */
7285 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7286 SPR_NOACCESS
, SPR_NOACCESS
,
7287 &spr_read_generic
, &spr_write_generic
,
7289 /* XXX : not implemented */
7290 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7291 &spr_read_ureg
, SPR_NOACCESS
,
7292 &spr_read_ureg
, SPR_NOACCESS
,
7295 spr_register(env
, SPR_SPRG4
, "SPRG4",
7296 SPR_NOACCESS
, SPR_NOACCESS
,
7297 &spr_read_generic
, &spr_write_generic
,
7299 spr_register(env
, SPR_USPRG4
, "USPRG4",
7300 &spr_read_ureg
, SPR_NOACCESS
,
7301 &spr_read_ureg
, SPR_NOACCESS
,
7303 spr_register(env
, SPR_SPRG5
, "SPRG5",
7304 SPR_NOACCESS
, SPR_NOACCESS
,
7305 &spr_read_generic
, &spr_write_generic
,
7307 spr_register(env
, SPR_USPRG5
, "USPRG5",
7308 &spr_read_ureg
, SPR_NOACCESS
,
7309 &spr_read_ureg
, SPR_NOACCESS
,
7311 spr_register(env
, SPR_SPRG6
, "SPRG6",
7312 SPR_NOACCESS
, SPR_NOACCESS
,
7313 &spr_read_generic
, &spr_write_generic
,
7315 spr_register(env
, SPR_USPRG6
, "USPRG6",
7316 &spr_read_ureg
, SPR_NOACCESS
,
7317 &spr_read_ureg
, SPR_NOACCESS
,
7319 spr_register(env
, SPR_SPRG7
, "SPRG7",
7320 SPR_NOACCESS
, SPR_NOACCESS
,
7321 &spr_read_generic
, &spr_write_generic
,
7323 spr_register(env
, SPR_USPRG7
, "USPRG7",
7324 &spr_read_ureg
, SPR_NOACCESS
,
7325 &spr_read_ureg
, SPR_NOACCESS
,
7327 /* Memory management */
7330 gen_74xx_soft_tlb(env
, 128, 2);
7331 init_excp_7450(env
);
7332 env
->dcache_line_size
= 32;
7333 env
->icache_line_size
= 32;
7334 /* Allocate hardware IRQ controller */
7335 ppc6xx_irq_init(env_archcpu(env
));
7338 POWERPC_FAMILY(7457)(ObjectClass
*oc
, void *data
)
7340 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7341 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7343 dc
->desc
= "PowerPC 7457 (aka G4)";
7344 pcc
->init_proc
= init_proc_7457
;
7345 pcc
->check_pow
= check_pow_hid0_74xx
;
7346 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7347 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7348 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7350 PPC_CACHE
| PPC_CACHE_ICBI
|
7351 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7352 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7353 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7354 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7355 PPC_SEGMENT
| PPC_EXTERN
|
7357 pcc
->msr_mask
= (1ull << MSR_VR
) |
7374 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7375 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7376 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7377 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7378 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7379 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7380 POWERPC_FLAG_BUS_CLK
;
7383 static void init_proc_e600(CPUPPCState
*env
)
7385 gen_spr_ne_601(env
);
7390 /* 74xx specific SPR */
7392 /* XXX : not implemented */
7393 spr_register(env
, SPR_UBAMR
, "UBAMR",
7394 &spr_read_ureg
, SPR_NOACCESS
,
7395 &spr_read_ureg
, SPR_NOACCESS
,
7397 /* XXX : not implemented */
7398 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7399 SPR_NOACCESS
, SPR_NOACCESS
,
7400 &spr_read_generic
, &spr_write_generic
,
7402 /* XXX : not implemented */
7403 spr_register(env
, SPR_ICTRL
, "ICTRL",
7404 SPR_NOACCESS
, SPR_NOACCESS
,
7405 &spr_read_generic
, &spr_write_generic
,
7407 /* XXX : not implemented */
7408 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7409 SPR_NOACCESS
, SPR_NOACCESS
,
7410 &spr_read_generic
, &spr_write_generic
,
7412 /* XXX : not implemented */
7413 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7414 SPR_NOACCESS
, SPR_NOACCESS
,
7415 &spr_read_generic
, &spr_write_generic
,
7417 /* XXX : not implemented */
7418 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7419 &spr_read_ureg
, SPR_NOACCESS
,
7420 &spr_read_ureg
, SPR_NOACCESS
,
7422 /* XXX : not implemented */
7423 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7424 SPR_NOACCESS
, SPR_NOACCESS
,
7425 &spr_read_generic
, &spr_write_generic
,
7427 /* XXX : not implemented */
7428 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7429 &spr_read_ureg
, SPR_NOACCESS
,
7430 &spr_read_ureg
, SPR_NOACCESS
,
7433 spr_register(env
, SPR_SPRG4
, "SPRG4",
7434 SPR_NOACCESS
, SPR_NOACCESS
,
7435 &spr_read_generic
, &spr_write_generic
,
7437 spr_register(env
, SPR_USPRG4
, "USPRG4",
7438 &spr_read_ureg
, SPR_NOACCESS
,
7439 &spr_read_ureg
, SPR_NOACCESS
,
7441 spr_register(env
, SPR_SPRG5
, "SPRG5",
7442 SPR_NOACCESS
, SPR_NOACCESS
,
7443 &spr_read_generic
, &spr_write_generic
,
7445 spr_register(env
, SPR_USPRG5
, "USPRG5",
7446 &spr_read_ureg
, SPR_NOACCESS
,
7447 &spr_read_ureg
, SPR_NOACCESS
,
7449 spr_register(env
, SPR_SPRG6
, "SPRG6",
7450 SPR_NOACCESS
, SPR_NOACCESS
,
7451 &spr_read_generic
, &spr_write_generic
,
7453 spr_register(env
, SPR_USPRG6
, "USPRG6",
7454 &spr_read_ureg
, SPR_NOACCESS
,
7455 &spr_read_ureg
, SPR_NOACCESS
,
7457 spr_register(env
, SPR_SPRG7
, "SPRG7",
7458 SPR_NOACCESS
, SPR_NOACCESS
,
7459 &spr_read_generic
, &spr_write_generic
,
7461 spr_register(env
, SPR_USPRG7
, "USPRG7",
7462 &spr_read_ureg
, SPR_NOACCESS
,
7463 &spr_read_ureg
, SPR_NOACCESS
,
7465 /* Memory management */
7468 gen_74xx_soft_tlb(env
, 128, 2);
7469 init_excp_7450(env
);
7470 env
->dcache_line_size
= 32;
7471 env
->icache_line_size
= 32;
7472 /* Allocate hardware IRQ controller */
7473 ppc6xx_irq_init(env_archcpu(env
));
7476 POWERPC_FAMILY(e600
)(ObjectClass
*oc
, void *data
)
7478 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7479 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7481 dc
->desc
= "PowerPC e600";
7482 pcc
->init_proc
= init_proc_e600
;
7483 pcc
->check_pow
= check_pow_hid0_74xx
;
7484 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7485 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7486 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7488 PPC_CACHE
| PPC_CACHE_ICBI
|
7489 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7490 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7491 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7492 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7493 PPC_SEGMENT
| PPC_EXTERN
|
7495 pcc
->insns_flags2
= PPC_NONE
;
7496 pcc
->msr_mask
= (1ull << MSR_VR
) |
7513 pcc
->mmu_model
= POWERPC_MMU_32B
;
7514 #if defined(CONFIG_SOFTMMU)
7515 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
7517 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7518 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7519 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7520 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7521 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7522 POWERPC_FLAG_BUS_CLK
;
7525 #if defined(TARGET_PPC64)
7526 #if defined(CONFIG_USER_ONLY)
7527 #define POWERPC970_HID5_INIT 0x00000080
7529 #define POWERPC970_HID5_INIT 0x00000000
7532 static void gen_fscr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7533 int bit
, int sprn
, int cause
)
7535 TCGv_i32 t1
= tcg_const_i32(bit
);
7536 TCGv_i32 t2
= tcg_const_i32(sprn
);
7537 TCGv_i32 t3
= tcg_const_i32(cause
);
7539 gen_helper_fscr_facility_check(cpu_env
, t1
, t2
, t3
);
7541 tcg_temp_free_i32(t3
);
7542 tcg_temp_free_i32(t2
);
7543 tcg_temp_free_i32(t1
);
7546 static void gen_msr_facility_check(DisasContext
*ctx
, int facility_sprn
,
7547 int bit
, int sprn
, int cause
)
7549 TCGv_i32 t1
= tcg_const_i32(bit
);
7550 TCGv_i32 t2
= tcg_const_i32(sprn
);
7551 TCGv_i32 t3
= tcg_const_i32(cause
);
7553 gen_helper_msr_facility_check(cpu_env
, t1
, t2
, t3
);
7555 tcg_temp_free_i32(t3
);
7556 tcg_temp_free_i32(t2
);
7557 tcg_temp_free_i32(t1
);
7560 static void spr_read_prev_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
7562 TCGv spr_up
= tcg_temp_new();
7563 TCGv spr
= tcg_temp_new();
7565 gen_load_spr(spr
, sprn
- 1);
7566 tcg_gen_shri_tl(spr_up
, spr
, 32);
7567 tcg_gen_ext32u_tl(cpu_gpr
[gprn
], spr_up
);
7570 tcg_temp_free(spr_up
);
7573 static void spr_write_prev_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
7575 TCGv spr
= tcg_temp_new();
7577 gen_load_spr(spr
, sprn
- 1);
7578 tcg_gen_deposit_tl(spr
, spr
, cpu_gpr
[gprn
], 32, 32);
7579 gen_store_spr(sprn
- 1, spr
);
7584 static int check_pow_970(CPUPPCState
*env
)
7586 if (env
->spr
[SPR_HID0
] & (HID0_DEEPNAP
| HID0_DOZE
| HID0_NAP
)) {
7593 static void gen_spr_970_hid(CPUPPCState
*env
)
7595 /* Hardware implementation registers */
7596 /* XXX : not implemented */
7597 spr_register(env
, SPR_HID0
, "HID0",
7598 SPR_NOACCESS
, SPR_NOACCESS
,
7599 &spr_read_generic
, &spr_write_clear
,
7601 spr_register(env
, SPR_HID1
, "HID1",
7602 SPR_NOACCESS
, SPR_NOACCESS
,
7603 &spr_read_generic
, &spr_write_generic
,
7605 spr_register(env
, SPR_970_HID5
, "HID5",
7606 SPR_NOACCESS
, SPR_NOACCESS
,
7607 &spr_read_generic
, &spr_write_generic
,
7608 POWERPC970_HID5_INIT
);
7611 static void gen_spr_970_hior(CPUPPCState
*env
)
7613 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7614 SPR_NOACCESS
, SPR_NOACCESS
,
7615 &spr_read_hior
, &spr_write_hior
,
7619 static void gen_spr_book3s_ctrl(CPUPPCState
*env
)
7621 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
7622 SPR_NOACCESS
, SPR_NOACCESS
,
7623 SPR_NOACCESS
, &spr_write_generic
,
7625 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
7626 &spr_read_ureg
, SPR_NOACCESS
,
7627 &spr_read_ureg
, SPR_NOACCESS
,
7631 static void gen_spr_book3s_altivec(CPUPPCState
*env
)
7633 if (!(env
->insns_flags
& PPC_ALTIVEC
)) {
7637 spr_register_kvm(env
, SPR_VRSAVE
, "VRSAVE",
7638 &spr_read_generic
, &spr_write_generic
,
7639 &spr_read_generic
, &spr_write_generic
,
7640 KVM_REG_PPC_VRSAVE
, 0x00000000);
7643 * Can't find information on what this should be on reset. This
7644 * value is the one used by 74xx processors.
7646 vscr_init(env
, 0x00010000);
7649 static void gen_spr_book3s_dbg(CPUPPCState
*env
)
7652 * TODO: different specs define different scopes for these,
7653 * will have to address this:
7654 * 970: super/write and super/read
7655 * powerisa 2.03..2.04: hypv/write and super/read.
7656 * powerisa 2.05 and newer: hypv/write and hypv/read.
7658 spr_register_kvm(env
, SPR_DABR
, "DABR",
7659 SPR_NOACCESS
, SPR_NOACCESS
,
7660 &spr_read_generic
, &spr_write_generic
,
7661 KVM_REG_PPC_DABR
, 0x00000000);
7662 spr_register_kvm(env
, SPR_DABRX
, "DABRX",
7663 SPR_NOACCESS
, SPR_NOACCESS
,
7664 &spr_read_generic
, &spr_write_generic
,
7665 KVM_REG_PPC_DABRX
, 0x00000000);
7668 static void gen_spr_book3s_207_dbg(CPUPPCState
*env
)
7670 spr_register_kvm_hv(env
, SPR_DAWR
, "DAWR",
7671 SPR_NOACCESS
, SPR_NOACCESS
,
7672 SPR_NOACCESS
, SPR_NOACCESS
,
7673 &spr_read_generic
, &spr_write_generic
,
7674 KVM_REG_PPC_DAWR
, 0x00000000);
7675 spr_register_kvm_hv(env
, SPR_DAWRX
, "DAWRX",
7676 SPR_NOACCESS
, SPR_NOACCESS
,
7677 SPR_NOACCESS
, SPR_NOACCESS
,
7678 &spr_read_generic
, &spr_write_generic
,
7679 KVM_REG_PPC_DAWRX
, 0x00000000);
7680 spr_register_kvm_hv(env
, SPR_CIABR
, "CIABR",
7681 SPR_NOACCESS
, SPR_NOACCESS
,
7682 SPR_NOACCESS
, SPR_NOACCESS
,
7683 &spr_read_generic
, &spr_write_generic
,
7684 KVM_REG_PPC_CIABR
, 0x00000000);
7687 static void gen_spr_970_dbg(CPUPPCState
*env
)
7690 spr_register(env
, SPR_IABR
, "IABR",
7691 SPR_NOACCESS
, SPR_NOACCESS
,
7692 &spr_read_generic
, &spr_write_generic
,
7696 static void gen_spr_book3s_pmu_sup(CPUPPCState
*env
)
7698 spr_register_kvm(env
, SPR_POWER_MMCR0
, "MMCR0",
7699 SPR_NOACCESS
, SPR_NOACCESS
,
7700 &spr_read_generic
, &spr_write_generic
,
7701 KVM_REG_PPC_MMCR0
, 0x00000000);
7702 spr_register_kvm(env
, SPR_POWER_MMCR1
, "MMCR1",
7703 SPR_NOACCESS
, SPR_NOACCESS
,
7704 &spr_read_generic
, &spr_write_generic
,
7705 KVM_REG_PPC_MMCR1
, 0x00000000);
7706 spr_register_kvm(env
, SPR_POWER_MMCRA
, "MMCRA",
7707 SPR_NOACCESS
, SPR_NOACCESS
,
7708 &spr_read_generic
, &spr_write_generic
,
7709 KVM_REG_PPC_MMCRA
, 0x00000000);
7710 spr_register_kvm(env
, SPR_POWER_PMC1
, "PMC1",
7711 SPR_NOACCESS
, SPR_NOACCESS
,
7712 &spr_read_generic
, &spr_write_generic
,
7713 KVM_REG_PPC_PMC1
, 0x00000000);
7714 spr_register_kvm(env
, SPR_POWER_PMC2
, "PMC2",
7715 SPR_NOACCESS
, SPR_NOACCESS
,
7716 &spr_read_generic
, &spr_write_generic
,
7717 KVM_REG_PPC_PMC2
, 0x00000000);
7718 spr_register_kvm(env
, SPR_POWER_PMC3
, "PMC3",
7719 SPR_NOACCESS
, SPR_NOACCESS
,
7720 &spr_read_generic
, &spr_write_generic
,
7721 KVM_REG_PPC_PMC3
, 0x00000000);
7722 spr_register_kvm(env
, SPR_POWER_PMC4
, "PMC4",
7723 SPR_NOACCESS
, SPR_NOACCESS
,
7724 &spr_read_generic
, &spr_write_generic
,
7725 KVM_REG_PPC_PMC4
, 0x00000000);
7726 spr_register_kvm(env
, SPR_POWER_PMC5
, "PMC5",
7727 SPR_NOACCESS
, SPR_NOACCESS
,
7728 &spr_read_generic
, &spr_write_generic
,
7729 KVM_REG_PPC_PMC5
, 0x00000000);
7730 spr_register_kvm(env
, SPR_POWER_PMC6
, "PMC6",
7731 SPR_NOACCESS
, SPR_NOACCESS
,
7732 &spr_read_generic
, &spr_write_generic
,
7733 KVM_REG_PPC_PMC6
, 0x00000000);
7734 spr_register_kvm(env
, SPR_POWER_SIAR
, "SIAR",
7735 SPR_NOACCESS
, SPR_NOACCESS
,
7736 &spr_read_generic
, &spr_write_generic
,
7737 KVM_REG_PPC_SIAR
, 0x00000000);
7738 spr_register_kvm(env
, SPR_POWER_SDAR
, "SDAR",
7739 SPR_NOACCESS
, SPR_NOACCESS
,
7740 &spr_read_generic
, &spr_write_generic
,
7741 KVM_REG_PPC_SDAR
, 0x00000000);
7744 static void gen_spr_book3s_pmu_user(CPUPPCState
*env
)
7746 spr_register(env
, SPR_POWER_UMMCR0
, "UMMCR0",
7747 &spr_read_ureg
, SPR_NOACCESS
,
7748 &spr_read_ureg
, &spr_write_ureg
,
7750 spr_register(env
, SPR_POWER_UMMCR1
, "UMMCR1",
7751 &spr_read_ureg
, SPR_NOACCESS
,
7752 &spr_read_ureg
, &spr_write_ureg
,
7754 spr_register(env
, SPR_POWER_UMMCRA
, "UMMCRA",
7755 &spr_read_ureg
, SPR_NOACCESS
,
7756 &spr_read_ureg
, &spr_write_ureg
,
7758 spr_register(env
, SPR_POWER_UPMC1
, "UPMC1",
7759 &spr_read_ureg
, SPR_NOACCESS
,
7760 &spr_read_ureg
, &spr_write_ureg
,
7762 spr_register(env
, SPR_POWER_UPMC2
, "UPMC2",
7763 &spr_read_ureg
, SPR_NOACCESS
,
7764 &spr_read_ureg
, &spr_write_ureg
,
7766 spr_register(env
, SPR_POWER_UPMC3
, "UPMC3",
7767 &spr_read_ureg
, SPR_NOACCESS
,
7768 &spr_read_ureg
, &spr_write_ureg
,
7770 spr_register(env
, SPR_POWER_UPMC4
, "UPMC4",
7771 &spr_read_ureg
, SPR_NOACCESS
,
7772 &spr_read_ureg
, &spr_write_ureg
,
7774 spr_register(env
, SPR_POWER_UPMC5
, "UPMC5",
7775 &spr_read_ureg
, SPR_NOACCESS
,
7776 &spr_read_ureg
, &spr_write_ureg
,
7778 spr_register(env
, SPR_POWER_UPMC6
, "UPMC6",
7779 &spr_read_ureg
, SPR_NOACCESS
,
7780 &spr_read_ureg
, &spr_write_ureg
,
7782 spr_register(env
, SPR_POWER_USIAR
, "USIAR",
7783 &spr_read_ureg
, SPR_NOACCESS
,
7784 &spr_read_ureg
, &spr_write_ureg
,
7786 spr_register(env
, SPR_POWER_USDAR
, "USDAR",
7787 &spr_read_ureg
, SPR_NOACCESS
,
7788 &spr_read_ureg
, &spr_write_ureg
,
7792 static void gen_spr_970_pmu_sup(CPUPPCState
*env
)
7794 spr_register_kvm(env
, SPR_970_PMC7
, "PMC7",
7795 SPR_NOACCESS
, SPR_NOACCESS
,
7796 &spr_read_generic
, &spr_write_generic
,
7797 KVM_REG_PPC_PMC7
, 0x00000000);
7798 spr_register_kvm(env
, SPR_970_PMC8
, "PMC8",
7799 SPR_NOACCESS
, SPR_NOACCESS
,
7800 &spr_read_generic
, &spr_write_generic
,
7801 KVM_REG_PPC_PMC8
, 0x00000000);
7804 static void gen_spr_970_pmu_user(CPUPPCState
*env
)
7806 spr_register(env
, SPR_970_UPMC7
, "UPMC7",
7807 &spr_read_ureg
, SPR_NOACCESS
,
7808 &spr_read_ureg
, &spr_write_ureg
,
7810 spr_register(env
, SPR_970_UPMC8
, "UPMC8",
7811 &spr_read_ureg
, SPR_NOACCESS
,
7812 &spr_read_ureg
, &spr_write_ureg
,
7816 static void gen_spr_power8_pmu_sup(CPUPPCState
*env
)
7818 spr_register_kvm(env
, SPR_POWER_MMCR2
, "MMCR2",
7819 SPR_NOACCESS
, SPR_NOACCESS
,
7820 &spr_read_generic
, &spr_write_generic
,
7821 KVM_REG_PPC_MMCR2
, 0x00000000);
7822 spr_register_kvm(env
, SPR_POWER_MMCRS
, "MMCRS",
7823 SPR_NOACCESS
, SPR_NOACCESS
,
7824 &spr_read_generic
, &spr_write_generic
,
7825 KVM_REG_PPC_MMCRS
, 0x00000000);
7826 spr_register_kvm(env
, SPR_POWER_SIER
, "SIER",
7827 SPR_NOACCESS
, SPR_NOACCESS
,
7828 &spr_read_generic
, &spr_write_generic
,
7829 KVM_REG_PPC_SIER
, 0x00000000);
7830 spr_register_kvm(env
, SPR_POWER_SPMC1
, "SPMC1",
7831 SPR_NOACCESS
, SPR_NOACCESS
,
7832 &spr_read_generic
, &spr_write_generic
,
7833 KVM_REG_PPC_SPMC1
, 0x00000000);
7834 spr_register_kvm(env
, SPR_POWER_SPMC2
, "SPMC2",
7835 SPR_NOACCESS
, SPR_NOACCESS
,
7836 &spr_read_generic
, &spr_write_generic
,
7837 KVM_REG_PPC_SPMC2
, 0x00000000);
7838 spr_register_kvm(env
, SPR_TACR
, "TACR",
7839 SPR_NOACCESS
, SPR_NOACCESS
,
7840 &spr_read_generic
, &spr_write_generic
,
7841 KVM_REG_PPC_TACR
, 0x00000000);
7842 spr_register_kvm(env
, SPR_TCSCR
, "TCSCR",
7843 SPR_NOACCESS
, SPR_NOACCESS
,
7844 &spr_read_generic
, &spr_write_generic
,
7845 KVM_REG_PPC_TCSCR
, 0x00000000);
7846 spr_register_kvm(env
, SPR_CSIGR
, "CSIGR",
7847 SPR_NOACCESS
, SPR_NOACCESS
,
7848 &spr_read_generic
, &spr_write_generic
,
7849 KVM_REG_PPC_CSIGR
, 0x00000000);
7852 static void gen_spr_power8_pmu_user(CPUPPCState
*env
)
7854 spr_register(env
, SPR_POWER_UMMCR2
, "UMMCR2",
7855 &spr_read_ureg
, SPR_NOACCESS
,
7856 &spr_read_ureg
, &spr_write_ureg
,
7858 spr_register(env
, SPR_POWER_USIER
, "USIER",
7859 &spr_read_generic
, SPR_NOACCESS
,
7860 &spr_read_generic
, &spr_write_generic
,
7864 static void gen_spr_power5p_ear(CPUPPCState
*env
)
7866 /* External access control */
7867 spr_register(env
, SPR_EAR
, "EAR",
7868 SPR_NOACCESS
, SPR_NOACCESS
,
7869 &spr_read_generic
, &spr_write_generic
,
7873 static void gen_spr_power5p_tb(CPUPPCState
*env
)
7875 /* TBU40 (High 40 bits of the Timebase register */
7876 spr_register_hv(env
, SPR_TBU40
, "TBU40",
7877 SPR_NOACCESS
, SPR_NOACCESS
,
7878 SPR_NOACCESS
, SPR_NOACCESS
,
7879 SPR_NOACCESS
, &spr_write_tbu40
,
7883 #if !defined(CONFIG_USER_ONLY)
7884 static void spr_write_hmer(DisasContext
*ctx
, int sprn
, int gprn
)
7886 TCGv hmer
= tcg_temp_new();
7888 gen_load_spr(hmer
, sprn
);
7889 tcg_gen_and_tl(hmer
, cpu_gpr
[gprn
], hmer
);
7890 gen_store_spr(sprn
, hmer
);
7891 spr_store_dump_spr(sprn
);
7892 tcg_temp_free(hmer
);
7895 static void spr_write_lpcr(DisasContext
*ctx
, int sprn
, int gprn
)
7897 gen_helper_store_lpcr(cpu_env
, cpu_gpr
[gprn
]);
7899 #endif /* !defined(CONFIG_USER_ONLY) */
7901 static void gen_spr_970_lpar(CPUPPCState
*env
)
7903 #if !defined(CONFIG_USER_ONLY)
7905 * PPC970: HID4 covers things later controlled by the LPCR and
7906 * RMOR in later CPUs, but with a different encoding. We only
7907 * support the 970 in "Apple mode" which has all hypervisor
7908 * facilities disabled by strapping, so we can basically just
7911 spr_register(env
, SPR_970_HID4
, "HID4",
7912 SPR_NOACCESS
, SPR_NOACCESS
,
7913 &spr_read_generic
, &spr_write_generic
,
7918 static void gen_spr_power5p_lpar(CPUPPCState
*env
)
7920 #if !defined(CONFIG_USER_ONLY)
7921 /* Logical partitionning */
7922 spr_register_kvm_hv(env
, SPR_LPCR
, "LPCR",
7923 SPR_NOACCESS
, SPR_NOACCESS
,
7924 SPR_NOACCESS
, SPR_NOACCESS
,
7925 &spr_read_generic
, &spr_write_lpcr
,
7926 KVM_REG_PPC_LPCR
, LPCR_LPES0
| LPCR_LPES1
);
7927 spr_register_hv(env
, SPR_HDEC
, "HDEC",
7928 SPR_NOACCESS
, SPR_NOACCESS
,
7929 SPR_NOACCESS
, SPR_NOACCESS
,
7930 &spr_read_hdecr
, &spr_write_hdecr
, 0);
7934 static void gen_spr_book3s_ids(CPUPPCState
*env
)
7936 /* FIXME: Will need to deal with thread vs core only SPRs */
7938 /* Processor identification */
7939 spr_register_hv(env
, SPR_PIR
, "PIR",
7940 SPR_NOACCESS
, SPR_NOACCESS
,
7941 &spr_read_generic
, SPR_NOACCESS
,
7942 &spr_read_generic
, NULL
,
7944 spr_register_hv(env
, SPR_HID0
, "HID0",
7945 SPR_NOACCESS
, SPR_NOACCESS
,
7946 SPR_NOACCESS
, SPR_NOACCESS
,
7947 &spr_read_generic
, &spr_write_generic
,
7949 spr_register_hv(env
, SPR_TSCR
, "TSCR",
7950 SPR_NOACCESS
, SPR_NOACCESS
,
7951 SPR_NOACCESS
, SPR_NOACCESS
,
7952 &spr_read_generic
, &spr_write_generic
,
7954 spr_register_hv(env
, SPR_HMER
, "HMER",
7955 SPR_NOACCESS
, SPR_NOACCESS
,
7956 SPR_NOACCESS
, SPR_NOACCESS
,
7957 &spr_read_generic
, &spr_write_hmer
,
7959 spr_register_hv(env
, SPR_HMEER
, "HMEER",
7960 SPR_NOACCESS
, SPR_NOACCESS
,
7961 SPR_NOACCESS
, SPR_NOACCESS
,
7962 &spr_read_generic
, &spr_write_generic
,
7964 spr_register_hv(env
, SPR_TFMR
, "TFMR",
7965 SPR_NOACCESS
, SPR_NOACCESS
,
7966 SPR_NOACCESS
, SPR_NOACCESS
,
7967 &spr_read_generic
, &spr_write_generic
,
7969 spr_register_hv(env
, SPR_LPIDR
, "LPIDR",
7970 SPR_NOACCESS
, SPR_NOACCESS
,
7971 SPR_NOACCESS
, SPR_NOACCESS
,
7972 &spr_read_generic
, &spr_write_lpidr
,
7974 spr_register_hv(env
, SPR_HFSCR
, "HFSCR",
7975 SPR_NOACCESS
, SPR_NOACCESS
,
7976 SPR_NOACCESS
, SPR_NOACCESS
,
7977 &spr_read_generic
, &spr_write_generic
,
7979 spr_register_hv(env
, SPR_MMCRC
, "MMCRC",
7980 SPR_NOACCESS
, SPR_NOACCESS
,
7981 SPR_NOACCESS
, SPR_NOACCESS
,
7982 &spr_read_generic
, &spr_write_generic
,
7984 spr_register_hv(env
, SPR_MMCRH
, "MMCRH",
7985 SPR_NOACCESS
, SPR_NOACCESS
,
7986 SPR_NOACCESS
, SPR_NOACCESS
,
7987 &spr_read_generic
, &spr_write_generic
,
7989 spr_register_hv(env
, SPR_HSPRG0
, "HSPRG0",
7990 SPR_NOACCESS
, SPR_NOACCESS
,
7991 SPR_NOACCESS
, SPR_NOACCESS
,
7992 &spr_read_generic
, &spr_write_generic
,
7994 spr_register_hv(env
, SPR_HSPRG1
, "HSPRG1",
7995 SPR_NOACCESS
, SPR_NOACCESS
,
7996 SPR_NOACCESS
, SPR_NOACCESS
,
7997 &spr_read_generic
, &spr_write_generic
,
7999 spr_register_hv(env
, SPR_HSRR0
, "HSRR0",
8000 SPR_NOACCESS
, SPR_NOACCESS
,
8001 SPR_NOACCESS
, SPR_NOACCESS
,
8002 &spr_read_generic
, &spr_write_generic
,
8004 spr_register_hv(env
, SPR_HSRR1
, "HSRR1",
8005 SPR_NOACCESS
, SPR_NOACCESS
,
8006 SPR_NOACCESS
, SPR_NOACCESS
,
8007 &spr_read_generic
, &spr_write_generic
,
8009 spr_register_hv(env
, SPR_HDAR
, "HDAR",
8010 SPR_NOACCESS
, SPR_NOACCESS
,
8011 SPR_NOACCESS
, SPR_NOACCESS
,
8012 &spr_read_generic
, &spr_write_generic
,
8014 spr_register_hv(env
, SPR_HDSISR
, "HDSISR",
8015 SPR_NOACCESS
, SPR_NOACCESS
,
8016 SPR_NOACCESS
, SPR_NOACCESS
,
8017 &spr_read_generic
, &spr_write_generic
,
8019 spr_register_hv(env
, SPR_HRMOR
, "HRMOR",
8020 SPR_NOACCESS
, SPR_NOACCESS
,
8021 SPR_NOACCESS
, SPR_NOACCESS
,
8022 &spr_read_generic
, &spr_write_generic
,
8026 static void gen_spr_rmor(CPUPPCState
*env
)
8028 spr_register_hv(env
, SPR_RMOR
, "RMOR",
8029 SPR_NOACCESS
, SPR_NOACCESS
,
8030 SPR_NOACCESS
, SPR_NOACCESS
,
8031 &spr_read_generic
, &spr_write_generic
,
8035 static void gen_spr_power8_ids(CPUPPCState
*env
)
8037 /* Thread identification */
8038 spr_register(env
, SPR_TIR
, "TIR",
8039 SPR_NOACCESS
, SPR_NOACCESS
,
8040 &spr_read_generic
, SPR_NOACCESS
,
8044 static void gen_spr_book3s_purr(CPUPPCState
*env
)
8046 #if !defined(CONFIG_USER_ONLY)
8047 /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
8048 spr_register_kvm_hv(env
, SPR_PURR
, "PURR",
8049 &spr_read_purr
, SPR_NOACCESS
,
8050 &spr_read_purr
, SPR_NOACCESS
,
8051 &spr_read_purr
, &spr_write_purr
,
8052 KVM_REG_PPC_PURR
, 0x00000000);
8053 spr_register_kvm_hv(env
, SPR_SPURR
, "SPURR",
8054 &spr_read_purr
, SPR_NOACCESS
,
8055 &spr_read_purr
, SPR_NOACCESS
,
8056 &spr_read_purr
, &spr_write_purr
,
8057 KVM_REG_PPC_SPURR
, 0x00000000);
8061 static void gen_spr_power6_dbg(CPUPPCState
*env
)
8063 #if !defined(CONFIG_USER_ONLY)
8064 spr_register(env
, SPR_CFAR
, "SPR_CFAR",
8065 SPR_NOACCESS
, SPR_NOACCESS
,
8066 &spr_read_cfar
, &spr_write_cfar
,
8071 static void gen_spr_power5p_common(CPUPPCState
*env
)
8073 spr_register_kvm(env
, SPR_PPR
, "PPR",
8074 &spr_read_generic
, &spr_write_generic
,
8075 &spr_read_generic
, &spr_write_generic
,
8076 KVM_REG_PPC_PPR
, 0x00000000);
8079 static void gen_spr_power6_common(CPUPPCState
*env
)
8081 #if !defined(CONFIG_USER_ONLY)
8082 spr_register_kvm(env
, SPR_DSCR
, "SPR_DSCR",
8083 SPR_NOACCESS
, SPR_NOACCESS
,
8084 &spr_read_generic
, &spr_write_generic
,
8085 KVM_REG_PPC_DSCR
, 0x00000000);
8088 * Register PCR to report POWERPC_EXCP_PRIV_REG instead of
8089 * POWERPC_EXCP_INVAL_SPR in userspace. Permit hypervisor access.
8091 spr_register_hv(env
, SPR_PCR
, "PCR",
8092 SPR_NOACCESS
, SPR_NOACCESS
,
8093 SPR_NOACCESS
, SPR_NOACCESS
,
8094 &spr_read_generic
, &spr_write_pcr
,
8098 static void spr_read_tar(DisasContext
*ctx
, int gprn
, int sprn
)
8100 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
8101 spr_read_generic(ctx
, gprn
, sprn
);
8104 static void spr_write_tar(DisasContext
*ctx
, int sprn
, int gprn
)
8106 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
8107 spr_write_generic(ctx
, sprn
, gprn
);
8110 static void gen_spr_power8_tce_address_control(CPUPPCState
*env
)
8112 spr_register_kvm(env
, SPR_TAR
, "TAR",
8113 &spr_read_tar
, &spr_write_tar
,
8114 &spr_read_generic
, &spr_write_generic
,
8115 KVM_REG_PPC_TAR
, 0x00000000);
8118 static void spr_read_tm(DisasContext
*ctx
, int gprn
, int sprn
)
8120 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8121 spr_read_generic(ctx
, gprn
, sprn
);
8124 static void spr_write_tm(DisasContext
*ctx
, int sprn
, int gprn
)
8126 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8127 spr_write_generic(ctx
, sprn
, gprn
);
8130 static void spr_read_tm_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
8132 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8133 spr_read_prev_upper32(ctx
, gprn
, sprn
);
8136 static void spr_write_tm_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
8138 gen_msr_facility_check(ctx
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
8139 spr_write_prev_upper32(ctx
, sprn
, gprn
);
8142 static void gen_spr_power8_tm(CPUPPCState
*env
)
8144 spr_register_kvm(env
, SPR_TFHAR
, "TFHAR",
8145 &spr_read_tm
, &spr_write_tm
,
8146 &spr_read_tm
, &spr_write_tm
,
8147 KVM_REG_PPC_TFHAR
, 0x00000000);
8148 spr_register_kvm(env
, SPR_TFIAR
, "TFIAR",
8149 &spr_read_tm
, &spr_write_tm
,
8150 &spr_read_tm
, &spr_write_tm
,
8151 KVM_REG_PPC_TFIAR
, 0x00000000);
8152 spr_register_kvm(env
, SPR_TEXASR
, "TEXASR",
8153 &spr_read_tm
, &spr_write_tm
,
8154 &spr_read_tm
, &spr_write_tm
,
8155 KVM_REG_PPC_TEXASR
, 0x00000000);
8156 spr_register(env
, SPR_TEXASRU
, "TEXASRU",
8157 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
8158 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
8162 static void spr_read_ebb(DisasContext
*ctx
, int gprn
, int sprn
)
8164 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8165 spr_read_generic(ctx
, gprn
, sprn
);
8168 static void spr_write_ebb(DisasContext
*ctx
, int sprn
, int gprn
)
8170 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8171 spr_write_generic(ctx
, sprn
, gprn
);
8174 static void spr_read_ebb_upper32(DisasContext
*ctx
, int gprn
, int sprn
)
8176 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8177 spr_read_prev_upper32(ctx
, gprn
, sprn
);
8180 static void spr_write_ebb_upper32(DisasContext
*ctx
, int sprn
, int gprn
)
8182 gen_fscr_facility_check(ctx
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
8183 spr_write_prev_upper32(ctx
, sprn
, gprn
);
8186 static void gen_spr_power8_ebb(CPUPPCState
*env
)
8188 spr_register(env
, SPR_BESCRS
, "BESCRS",
8189 &spr_read_ebb
, &spr_write_ebb
,
8190 &spr_read_generic
, &spr_write_generic
,
8192 spr_register(env
, SPR_BESCRSU
, "BESCRSU",
8193 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
8194 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
8196 spr_register(env
, SPR_BESCRR
, "BESCRR",
8197 &spr_read_ebb
, &spr_write_ebb
,
8198 &spr_read_generic
, &spr_write_generic
,
8200 spr_register(env
, SPR_BESCRRU
, "BESCRRU",
8201 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
8202 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
8204 spr_register_kvm(env
, SPR_EBBHR
, "EBBHR",
8205 &spr_read_ebb
, &spr_write_ebb
,
8206 &spr_read_generic
, &spr_write_generic
,
8207 KVM_REG_PPC_EBBHR
, 0x00000000);
8208 spr_register_kvm(env
, SPR_EBBRR
, "EBBRR",
8209 &spr_read_ebb
, &spr_write_ebb
,
8210 &spr_read_generic
, &spr_write_generic
,
8211 KVM_REG_PPC_EBBRR
, 0x00000000);
8212 spr_register_kvm(env
, SPR_BESCR
, "BESCR",
8213 &spr_read_ebb
, &spr_write_ebb
,
8214 &spr_read_generic
, &spr_write_generic
,
8215 KVM_REG_PPC_BESCR
, 0x00000000);
8218 /* Virtual Time Base */
8219 static void gen_spr_vtb(CPUPPCState
*env
)
8221 spr_register_kvm_hv(env
, SPR_VTB
, "VTB",
8222 SPR_NOACCESS
, SPR_NOACCESS
,
8223 &spr_read_vtb
, SPR_NOACCESS
,
8224 &spr_read_vtb
, &spr_write_vtb
,
8225 KVM_REG_PPC_VTB
, 0x00000000);
8228 static void gen_spr_power8_fscr(CPUPPCState
*env
)
8230 #if defined(CONFIG_USER_ONLY)
8231 target_ulong initval
= 1ULL << FSCR_TAR
;
8233 target_ulong initval
= 0;
8235 spr_register_kvm(env
, SPR_FSCR
, "FSCR",
8236 SPR_NOACCESS
, SPR_NOACCESS
,
8237 &spr_read_generic
, &spr_write_generic
,
8238 KVM_REG_PPC_FSCR
, initval
);
8241 static void gen_spr_power8_pspb(CPUPPCState
*env
)
8243 spr_register_kvm(env
, SPR_PSPB
, "PSPB",
8244 SPR_NOACCESS
, SPR_NOACCESS
,
8245 &spr_read_generic
, &spr_write_generic32
,
8246 KVM_REG_PPC_PSPB
, 0);
8249 static void gen_spr_power8_dpdes(CPUPPCState
*env
)
8251 #if !defined(CONFIG_USER_ONLY)
8252 /* Directed Privileged Door-bell Exception State, used for IPI */
8253 spr_register_kvm_hv(env
, SPR_DPDES
, "DPDES",
8254 SPR_NOACCESS
, SPR_NOACCESS
,
8255 &spr_read_dpdes
, SPR_NOACCESS
,
8256 &spr_read_dpdes
, &spr_write_dpdes
,
8257 KVM_REG_PPC_DPDES
, 0x00000000);
8261 static void gen_spr_power8_ic(CPUPPCState
*env
)
8263 #if !defined(CONFIG_USER_ONLY)
8264 spr_register_hv(env
, SPR_IC
, "IC",
8265 SPR_NOACCESS
, SPR_NOACCESS
,
8266 &spr_read_generic
, SPR_NOACCESS
,
8267 &spr_read_generic
, &spr_write_generic
,
8272 static void gen_spr_power8_book4(CPUPPCState
*env
)
8274 /* Add a number of P8 book4 registers */
8275 #if !defined(CONFIG_USER_ONLY)
8276 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
8277 SPR_NOACCESS
, SPR_NOACCESS
,
8278 &spr_read_generic
, &spr_write_generic
,
8279 KVM_REG_PPC_ACOP
, 0);
8280 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
8281 SPR_NOACCESS
, SPR_NOACCESS
,
8282 &spr_read_generic
, &spr_write_pidr
,
8283 KVM_REG_PPC_PID
, 0);
8284 spr_register_kvm(env
, SPR_WORT
, "WORT",
8285 SPR_NOACCESS
, SPR_NOACCESS
,
8286 &spr_read_generic
, &spr_write_generic
,
8287 KVM_REG_PPC_WORT
, 0);
8291 static void gen_spr_power7_book4(CPUPPCState
*env
)
8293 /* Add a number of P7 book4 registers */
8294 #if !defined(CONFIG_USER_ONLY)
8295 spr_register_kvm(env
, SPR_ACOP
, "ACOP",
8296 SPR_NOACCESS
, SPR_NOACCESS
,
8297 &spr_read_generic
, &spr_write_generic
,
8298 KVM_REG_PPC_ACOP
, 0);
8299 spr_register_kvm(env
, SPR_BOOKS_PID
, "PID",
8300 SPR_NOACCESS
, SPR_NOACCESS
,
8301 &spr_read_generic
, &spr_write_generic
,
8302 KVM_REG_PPC_PID
, 0);
8306 static void gen_spr_power8_rpr(CPUPPCState
*env
)
8308 #if !defined(CONFIG_USER_ONLY)
8309 spr_register_hv(env
, SPR_RPR
, "RPR",
8310 SPR_NOACCESS
, SPR_NOACCESS
,
8311 SPR_NOACCESS
, SPR_NOACCESS
,
8312 &spr_read_generic
, &spr_write_generic
,
8313 0x00000103070F1F3F);
8317 static void gen_spr_power9_mmu(CPUPPCState
*env
)
8319 #if !defined(CONFIG_USER_ONLY)
8320 /* Partition Table Control */
8321 spr_register_kvm_hv(env
, SPR_PTCR
, "PTCR",
8322 SPR_NOACCESS
, SPR_NOACCESS
,
8323 SPR_NOACCESS
, SPR_NOACCESS
,
8324 &spr_read_generic
, &spr_write_ptcr
,
8325 KVM_REG_PPC_PTCR
, 0x00000000);
8326 /* Address Segment Descriptor Register */
8327 spr_register_hv(env
, SPR_ASDR
, "ASDR",
8328 SPR_NOACCESS
, SPR_NOACCESS
,
8329 SPR_NOACCESS
, SPR_NOACCESS
,
8330 &spr_read_generic
, &spr_write_generic
,
8331 0x0000000000000000);
8335 static void init_proc_book3s_common(CPUPPCState
*env
)
8337 gen_spr_ne_601(env
);
8339 gen_spr_usprg3(env
);
8340 gen_spr_book3s_altivec(env
);
8341 gen_spr_book3s_pmu_sup(env
);
8342 gen_spr_book3s_pmu_user(env
);
8343 gen_spr_book3s_ctrl(env
);
8346 static void init_proc_970(CPUPPCState
*env
)
8348 /* Common Registers */
8349 init_proc_book3s_common(env
);
8351 gen_spr_book3s_dbg(env
);
8353 /* 970 Specific Registers */
8354 gen_spr_970_hid(env
);
8355 gen_spr_970_hior(env
);
8357 gen_spr_970_pmu_sup(env
);
8358 gen_spr_970_pmu_user(env
);
8359 gen_spr_970_lpar(env
);
8360 gen_spr_970_dbg(env
);
8363 env
->dcache_line_size
= 128;
8364 env
->icache_line_size
= 128;
8366 /* Allocate hardware IRQ controller */
8368 ppc970_irq_init(env_archcpu(env
));
8371 POWERPC_FAMILY(970)(ObjectClass
*oc
, void *data
)
8373 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8374 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8376 dc
->desc
= "PowerPC 970";
8377 pcc
->init_proc
= init_proc_970
;
8378 pcc
->check_pow
= check_pow_970
;
8379 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8380 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8381 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8383 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8384 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8385 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8386 PPC_64B
| PPC_ALTIVEC
|
8387 PPC_SEGMENT_64B
| PPC_SLBI
;
8388 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8389 pcc
->msr_mask
= (1ull << MSR_SF
) |
8404 pcc
->mmu_model
= POWERPC_MMU_64B
;
8405 #if defined(CONFIG_SOFTMMU)
8406 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8407 pcc
->hash64_opts
= &ppc_hash64_opts_basic
;
8409 pcc
->excp_model
= POWERPC_EXCP_970
;
8410 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8411 pcc
->bfd_mach
= bfd_mach_ppc64
;
8412 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8413 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8414 POWERPC_FLAG_BUS_CLK
;
8415 pcc
->l1_dcache_size
= 0x8000;
8416 pcc
->l1_icache_size
= 0x10000;
8419 static void init_proc_power5plus(CPUPPCState
*env
)
8421 /* Common Registers */
8422 init_proc_book3s_common(env
);
8424 gen_spr_book3s_dbg(env
);
8426 /* POWER5+ Specific Registers */
8427 gen_spr_970_hid(env
);
8428 gen_spr_970_hior(env
);
8430 gen_spr_970_pmu_sup(env
);
8431 gen_spr_970_pmu_user(env
);
8432 gen_spr_power5p_common(env
);
8433 gen_spr_power5p_lpar(env
);
8434 gen_spr_power5p_ear(env
);
8435 gen_spr_power5p_tb(env
);
8438 env
->dcache_line_size
= 128;
8439 env
->icache_line_size
= 128;
8441 /* Allocate hardware IRQ controller */
8443 ppc970_irq_init(env_archcpu(env
));
8446 POWERPC_FAMILY(POWER5P
)(ObjectClass
*oc
, void *data
)
8448 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8449 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8451 dc
->fw_name
= "PowerPC,POWER5";
8452 dc
->desc
= "POWER5+";
8453 pcc
->init_proc
= init_proc_power5plus
;
8454 pcc
->check_pow
= check_pow_970
;
8455 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
8456 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8457 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8459 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8460 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8461 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8463 PPC_SEGMENT_64B
| PPC_SLBI
;
8464 pcc
->insns_flags2
= PPC2_FP_CVT_S64
;
8465 pcc
->msr_mask
= (1ull << MSR_SF
) |
8480 pcc
->lpcr_mask
= LPCR_RMLS
| LPCR_ILE
| LPCR_LPES0
| LPCR_LPES1
|
8481 LPCR_RMI
| LPCR_HDICE
;
8482 pcc
->mmu_model
= POWERPC_MMU_2_03
;
8483 #if defined(CONFIG_SOFTMMU)
8484 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8485 pcc
->hash64_opts
= &ppc_hash64_opts_basic
;
8486 pcc
->lrg_decr_bits
= 32;
8488 pcc
->excp_model
= POWERPC_EXCP_970
;
8489 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
8490 pcc
->bfd_mach
= bfd_mach_ppc64
;
8491 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8492 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8493 POWERPC_FLAG_BUS_CLK
;
8494 pcc
->l1_dcache_size
= 0x8000;
8495 pcc
->l1_icache_size
= 0x10000;
8498 static void init_proc_POWER7(CPUPPCState
*env
)
8500 /* Common Registers */
8501 init_proc_book3s_common(env
);
8503 gen_spr_book3s_dbg(env
);
8505 /* POWER7 Specific Registers */
8506 gen_spr_book3s_ids(env
);
8509 gen_spr_book3s_purr(env
);
8510 gen_spr_power5p_common(env
);
8511 gen_spr_power5p_lpar(env
);
8512 gen_spr_power5p_ear(env
);
8513 gen_spr_power5p_tb(env
);
8514 gen_spr_power6_common(env
);
8515 gen_spr_power6_dbg(env
);
8516 gen_spr_power7_book4(env
);
8519 env
->dcache_line_size
= 128;
8520 env
->icache_line_size
= 128;
8522 /* Allocate hardware IRQ controller */
8523 init_excp_POWER7(env
);
8524 ppcPOWER7_irq_init(env_archcpu(env
));
8527 static bool ppc_pvr_match_power7(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8529 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7P_BASE
) {
8532 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER7_BASE
) {
8538 static bool cpu_has_work_POWER7(CPUState
*cs
)
8540 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
8541 CPUPPCState
*env
= &cpu
->env
;
8544 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
8547 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
8548 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE0
)) {
8551 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
8552 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE1
)) {
8555 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
)) &&
8556 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE2
)) {
8559 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HMI
)) &&
8560 (env
->spr
[SPR_LPCR
] & LPCR_P7_PECE2
)) {
8563 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
8568 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
8572 POWERPC_FAMILY(POWER7
)(ObjectClass
*oc
, void *data
)
8574 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8575 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8576 CPUClass
*cc
= CPU_CLASS(oc
);
8578 dc
->fw_name
= "PowerPC,POWER7";
8579 dc
->desc
= "POWER7";
8580 pcc
->pvr_match
= ppc_pvr_match_power7
;
8581 pcc
->pcr_mask
= PCR_VEC_DIS
| PCR_VSX_DIS
| PCR_COMPAT_2_05
;
8582 pcc
->pcr_supported
= PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8583 pcc
->init_proc
= init_proc_POWER7
;
8584 pcc
->check_pow
= check_pow_nocheck
;
8585 cc
->has_work
= cpu_has_work_POWER7
;
8586 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8587 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8588 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8589 PPC_FLOAT_FRSQRTES
|
8592 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8593 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8594 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8595 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
8596 PPC_SEGMENT_64B
| PPC_SLBI
|
8597 PPC_POPCNTB
| PPC_POPCNTWD
|
8599 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
8600 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8601 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8602 PPC2_FP_TST_ISA206
| PPC2_FP_CVT_S64
|
8604 pcc
->msr_mask
= (1ull << MSR_SF
) |
8620 pcc
->lpcr_mask
= LPCR_VPM0
| LPCR_VPM1
| LPCR_ISL
| LPCR_DPFD
|
8621 LPCR_VRMASD
| LPCR_RMLS
| LPCR_ILE
|
8622 LPCR_P7_PECE0
| LPCR_P7_PECE1
| LPCR_P7_PECE2
|
8623 LPCR_MER
| LPCR_TC
|
8624 LPCR_LPES0
| LPCR_LPES1
| LPCR_HDICE
;
8625 pcc
->lpcr_pm
= LPCR_P7_PECE0
| LPCR_P7_PECE1
| LPCR_P7_PECE2
;
8626 pcc
->mmu_model
= POWERPC_MMU_2_06
;
8627 #if defined(CONFIG_SOFTMMU)
8628 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8629 pcc
->hash64_opts
= &ppc_hash64_opts_POWER7
;
8630 pcc
->lrg_decr_bits
= 32;
8632 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
8633 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8634 pcc
->bfd_mach
= bfd_mach_ppc64
;
8635 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8636 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8637 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8639 pcc
->l1_dcache_size
= 0x8000;
8640 pcc
->l1_icache_size
= 0x8000;
8641 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8644 static void init_proc_POWER8(CPUPPCState
*env
)
8646 /* Common Registers */
8647 init_proc_book3s_common(env
);
8649 gen_spr_book3s_207_dbg(env
);
8651 /* POWER8 Specific Registers */
8652 gen_spr_book3s_ids(env
);
8656 gen_spr_book3s_purr(env
);
8657 gen_spr_power5p_common(env
);
8658 gen_spr_power5p_lpar(env
);
8659 gen_spr_power5p_ear(env
);
8660 gen_spr_power5p_tb(env
);
8661 gen_spr_power6_common(env
);
8662 gen_spr_power6_dbg(env
);
8663 gen_spr_power8_tce_address_control(env
);
8664 gen_spr_power8_ids(env
);
8665 gen_spr_power8_ebb(env
);
8666 gen_spr_power8_fscr(env
);
8667 gen_spr_power8_pmu_sup(env
);
8668 gen_spr_power8_pmu_user(env
);
8669 gen_spr_power8_tm(env
);
8670 gen_spr_power8_pspb(env
);
8671 gen_spr_power8_dpdes(env
);
8673 gen_spr_power8_ic(env
);
8674 gen_spr_power8_book4(env
);
8675 gen_spr_power8_rpr(env
);
8678 env
->dcache_line_size
= 128;
8679 env
->icache_line_size
= 128;
8681 /* Allocate hardware IRQ controller */
8682 init_excp_POWER8(env
);
8683 ppcPOWER7_irq_init(env_archcpu(env
));
8686 static bool ppc_pvr_match_power8(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8688 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8NVL_BASE
) {
8691 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8E_BASE
) {
8694 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER8_BASE
) {
8700 static bool cpu_has_work_POWER8(CPUState
*cs
)
8702 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
8703 CPUPPCState
*env
= &cpu
->env
;
8706 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
8709 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
8710 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE2
)) {
8713 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
8714 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE3
)) {
8717 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
)) &&
8718 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE4
)) {
8721 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HMI
)) &&
8722 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE4
)) {
8725 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DOORBELL
)) &&
8726 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE0
)) {
8729 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HDOORBELL
)) &&
8730 (env
->spr
[SPR_LPCR
] & LPCR_P8_PECE1
)) {
8733 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
8738 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
8742 POWERPC_FAMILY(POWER8
)(ObjectClass
*oc
, void *data
)
8744 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8745 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8746 CPUClass
*cc
= CPU_CLASS(oc
);
8748 dc
->fw_name
= "PowerPC,POWER8";
8749 dc
->desc
= "POWER8";
8750 pcc
->pvr_match
= ppc_pvr_match_power8
;
8751 pcc
->pcr_mask
= PCR_TM_DIS
| PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8752 pcc
->pcr_supported
= PCR_COMPAT_2_07
| PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
8753 pcc
->init_proc
= init_proc_POWER8
;
8754 pcc
->check_pow
= check_pow_nocheck
;
8755 cc
->has_work
= cpu_has_work_POWER8
;
8756 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8757 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8758 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8759 PPC_FLOAT_FRSQRTES
|
8762 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8763 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8764 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8765 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
8766 PPC_SEGMENT_64B
| PPC_SLBI
|
8767 PPC_POPCNTB
| PPC_POPCNTWD
|
8769 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
8770 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8771 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8772 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
8773 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
8774 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
8775 PPC2_TM
| PPC2_PM_ISA206
;
8776 pcc
->msr_mask
= (1ull << MSR_SF
) |
8796 pcc
->lpcr_mask
= LPCR_VPM0
| LPCR_VPM1
| LPCR_ISL
| LPCR_KBV
|
8797 LPCR_DPFD
| LPCR_VRMASD
| LPCR_RMLS
| LPCR_ILE
|
8798 LPCR_AIL
| LPCR_ONL
| LPCR_P8_PECE0
| LPCR_P8_PECE1
|
8799 LPCR_P8_PECE2
| LPCR_P8_PECE3
| LPCR_P8_PECE4
|
8800 LPCR_MER
| LPCR_TC
| LPCR_LPES0
| LPCR_HDICE
;
8801 pcc
->lpcr_pm
= LPCR_P8_PECE0
| LPCR_P8_PECE1
| LPCR_P8_PECE2
|
8802 LPCR_P8_PECE3
| LPCR_P8_PECE4
;
8803 pcc
->mmu_model
= POWERPC_MMU_2_07
;
8804 #if defined(CONFIG_SOFTMMU)
8805 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8806 pcc
->hash64_opts
= &ppc_hash64_opts_POWER7
;
8807 pcc
->lrg_decr_bits
= 32;
8808 pcc
->n_host_threads
= 8;
8810 pcc
->excp_model
= POWERPC_EXCP_POWER8
;
8811 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8812 pcc
->bfd_mach
= bfd_mach_ppc64
;
8813 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8814 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8815 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8816 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
;
8817 pcc
->l1_dcache_size
= 0x8000;
8818 pcc
->l1_icache_size
= 0x8000;
8819 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8822 #ifdef CONFIG_SOFTMMU
8824 * Radix pg sizes and AP encodings for dt node ibm,processor-radix-AP-encodings
8825 * Encoded as array of int_32s in the form:
8826 * 0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
8828 * y -> radix mode supported page size (encoded as a shift)
8830 static struct ppc_radix_page_info POWER9_radix_page_info
= {
8833 0x0000000c, /* 4K - enc: 0x0 */
8834 0xa0000010, /* 64K - enc: 0x5 */
8835 0x20000015, /* 2M - enc: 0x1 */
8836 0x4000001e /* 1G - enc: 0x2 */
8839 #endif /* CONFIG_SOFTMMU */
8841 static void init_proc_POWER9(CPUPPCState
*env
)
8843 /* Common Registers */
8844 init_proc_book3s_common(env
);
8845 gen_spr_book3s_207_dbg(env
);
8847 /* POWER8 Specific Registers */
8848 gen_spr_book3s_ids(env
);
8851 gen_spr_book3s_purr(env
);
8852 gen_spr_power5p_common(env
);
8853 gen_spr_power5p_lpar(env
);
8854 gen_spr_power5p_ear(env
);
8855 gen_spr_power5p_tb(env
);
8856 gen_spr_power6_common(env
);
8857 gen_spr_power6_dbg(env
);
8858 gen_spr_power8_tce_address_control(env
);
8859 gen_spr_power8_ids(env
);
8860 gen_spr_power8_ebb(env
);
8861 gen_spr_power8_fscr(env
);
8862 gen_spr_power8_pmu_sup(env
);
8863 gen_spr_power8_pmu_user(env
);
8864 gen_spr_power8_tm(env
);
8865 gen_spr_power8_pspb(env
);
8866 gen_spr_power8_dpdes(env
);
8868 gen_spr_power8_ic(env
);
8869 gen_spr_power8_book4(env
);
8870 gen_spr_power8_rpr(env
);
8871 gen_spr_power9_mmu(env
);
8873 /* POWER9 Specific registers */
8874 spr_register_kvm(env
, SPR_TIDR
, "TIDR", NULL
, NULL
,
8875 spr_read_generic
, spr_write_generic
,
8876 KVM_REG_PPC_TIDR
, 0);
8878 /* FIXME: Filter fields properly based on privilege level */
8879 spr_register_kvm_hv(env
, SPR_PSSCR
, "PSSCR", NULL
, NULL
, NULL
, NULL
,
8880 spr_read_generic
, spr_write_generic
,
8881 KVM_REG_PPC_PSSCR
, 0);
8884 env
->dcache_line_size
= 128;
8885 env
->icache_line_size
= 128;
8887 /* Allocate hardware IRQ controller */
8888 init_excp_POWER9(env
);
8889 ppcPOWER9_irq_init(env_archcpu(env
));
8892 static bool ppc_pvr_match_power9(PowerPCCPUClass
*pcc
, uint32_t pvr
)
8894 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER9_BASE
) {
8900 static bool cpu_has_work_POWER9(CPUState
*cs
)
8902 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
8903 CPUPPCState
*env
= &cpu
->env
;
8906 uint64_t psscr
= env
->spr
[SPR_PSSCR
];
8908 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
8912 /* If EC is clear, just return true on any pending interrupt */
8913 if (!(psscr
& PSSCR_EC
)) {
8916 /* External Exception */
8917 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
8918 (env
->spr
[SPR_LPCR
] & LPCR_EEE
)) {
8919 bool heic
= !!(env
->spr
[SPR_LPCR
] & LPCR_HEIC
);
8920 if (heic
== 0 || !msr_hv
|| msr_pr
) {
8924 /* Decrementer Exception */
8925 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
8926 (env
->spr
[SPR_LPCR
] & LPCR_DEE
)) {
8929 /* Machine Check or Hypervisor Maintenance Exception */
8930 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
|
8931 1u << PPC_INTERRUPT_HMI
)) && (env
->spr
[SPR_LPCR
] & LPCR_OEE
)) {
8934 /* Privileged Doorbell Exception */
8935 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DOORBELL
)) &&
8936 (env
->spr
[SPR_LPCR
] & LPCR_PDEE
)) {
8939 /* Hypervisor Doorbell Exception */
8940 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HDOORBELL
)) &&
8941 (env
->spr
[SPR_LPCR
] & LPCR_HDEE
)) {
8944 /* Hypervisor virtualization exception */
8945 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HVIRT
)) &&
8946 (env
->spr
[SPR_LPCR
] & LPCR_HVEE
)) {
8949 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
8954 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
8958 POWERPC_FAMILY(POWER9
)(ObjectClass
*oc
, void *data
)
8960 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8961 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8962 CPUClass
*cc
= CPU_CLASS(oc
);
8964 dc
->fw_name
= "PowerPC,POWER9";
8965 dc
->desc
= "POWER9";
8966 pcc
->pvr_match
= ppc_pvr_match_power9
;
8967 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
| PCR_COMPAT_2_07
;
8968 pcc
->pcr_supported
= PCR_COMPAT_3_00
| PCR_COMPAT_2_07
| PCR_COMPAT_2_06
|
8970 pcc
->init_proc
= init_proc_POWER9
;
8971 pcc
->check_pow
= check_pow_nocheck
;
8972 cc
->has_work
= cpu_has_work_POWER9
;
8973 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8974 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8975 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8976 PPC_FLOAT_FRSQRTES
|
8979 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8980 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8982 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
8983 PPC_SEGMENT_64B
| PPC_SLBI
|
8984 PPC_POPCNTB
| PPC_POPCNTWD
|
8986 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
8987 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8988 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8989 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
8990 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
8991 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
8992 PPC2_TM
| PPC2_ISA300
| PPC2_PRCNTL
;
8993 pcc
->msr_mask
= (1ull << MSR_SF
) |
9011 pcc
->lpcr_mask
= LPCR_VPM1
| LPCR_ISL
| LPCR_KBV
| LPCR_DPFD
|
9012 (LPCR_PECE_U_MASK
& LPCR_HVEE
) | LPCR_ILE
| LPCR_AIL
|
9013 LPCR_UPRT
| LPCR_EVIRT
| LPCR_ONL
| LPCR_HR
| LPCR_LD
|
9014 (LPCR_PECE_L_MASK
& (LPCR_PDEE
| LPCR_HDEE
| LPCR_EEE
|
9015 LPCR_DEE
| LPCR_OEE
))
9016 | LPCR_MER
| LPCR_GTSE
| LPCR_TC
|
9017 LPCR_HEIC
| LPCR_LPES0
| LPCR_HVICE
| LPCR_HDICE
;
9018 pcc
->lpcr_pm
= LPCR_PDEE
| LPCR_HDEE
| LPCR_EEE
| LPCR_DEE
| LPCR_OEE
;
9019 pcc
->mmu_model
= POWERPC_MMU_3_00
;
9020 #if defined(CONFIG_SOFTMMU)
9021 pcc
->handle_mmu_fault
= ppc64_v3_handle_mmu_fault
;
9022 /* segment page size remain the same */
9023 pcc
->hash64_opts
= &ppc_hash64_opts_POWER7
;
9024 pcc
->radix_page_info
= &POWER9_radix_page_info
;
9025 pcc
->lrg_decr_bits
= 56;
9026 pcc
->n_host_threads
= 4;
9028 pcc
->excp_model
= POWERPC_EXCP_POWER9
;
9029 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER9
;
9030 pcc
->bfd_mach
= bfd_mach_ppc64
;
9031 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
9032 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
9033 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
9034 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
| POWERPC_FLAG_SCV
;
9035 pcc
->l1_dcache_size
= 0x8000;
9036 pcc
->l1_icache_size
= 0x8000;
9037 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
9040 #ifdef CONFIG_SOFTMMU
9042 * Radix pg sizes and AP encodings for dt node ibm,processor-radix-AP-encodings
9043 * Encoded as array of int_32s in the form:
9044 * 0bxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
9046 * y -> radix mode supported page size (encoded as a shift)
9048 static struct ppc_radix_page_info POWER10_radix_page_info
= {
9051 0x0000000c, /* 4K - enc: 0x0 */
9052 0xa0000010, /* 64K - enc: 0x5 */
9053 0x20000015, /* 2M - enc: 0x1 */
9054 0x4000001e /* 1G - enc: 0x2 */
9057 #endif /* CONFIG_SOFTMMU */
9059 static void init_proc_POWER10(CPUPPCState
*env
)
9061 /* Common Registers */
9062 init_proc_book3s_common(env
);
9063 gen_spr_book3s_207_dbg(env
);
9065 /* POWER8 Specific Registers */
9066 gen_spr_book3s_ids(env
);
9069 gen_spr_book3s_purr(env
);
9070 gen_spr_power5p_common(env
);
9071 gen_spr_power5p_lpar(env
);
9072 gen_spr_power5p_ear(env
);
9073 gen_spr_power6_common(env
);
9074 gen_spr_power6_dbg(env
);
9075 gen_spr_power8_tce_address_control(env
);
9076 gen_spr_power8_ids(env
);
9077 gen_spr_power8_ebb(env
);
9078 gen_spr_power8_fscr(env
);
9079 gen_spr_power8_pmu_sup(env
);
9080 gen_spr_power8_pmu_user(env
);
9081 gen_spr_power8_tm(env
);
9082 gen_spr_power8_pspb(env
);
9084 gen_spr_power8_ic(env
);
9085 gen_spr_power8_book4(env
);
9086 gen_spr_power8_rpr(env
);
9087 gen_spr_power9_mmu(env
);
9089 /* FIXME: Filter fields properly based on privilege level */
9090 spr_register_kvm_hv(env
, SPR_PSSCR
, "PSSCR", NULL
, NULL
, NULL
, NULL
,
9091 spr_read_generic
, spr_write_generic
,
9092 KVM_REG_PPC_PSSCR
, 0);
9095 env
->dcache_line_size
= 128;
9096 env
->icache_line_size
= 128;
9098 /* Allocate hardware IRQ controller */
9099 init_excp_POWER10(env
);
9100 ppcPOWER9_irq_init(env_archcpu(env
));
9103 static bool ppc_pvr_match_power10(PowerPCCPUClass
*pcc
, uint32_t pvr
)
9105 if ((pvr
& CPU_POWERPC_POWER_SERVER_MASK
) == CPU_POWERPC_POWER10_BASE
) {
9111 static bool cpu_has_work_POWER10(CPUState
*cs
)
9113 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9114 CPUPPCState
*env
= &cpu
->env
;
9117 uint64_t psscr
= env
->spr
[SPR_PSSCR
];
9119 if (!(cs
->interrupt_request
& CPU_INTERRUPT_HARD
)) {
9123 /* If EC is clear, just return true on any pending interrupt */
9124 if (!(psscr
& PSSCR_EC
)) {
9127 /* External Exception */
9128 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_EXT
)) &&
9129 (env
->spr
[SPR_LPCR
] & LPCR_EEE
)) {
9130 bool heic
= !!(env
->spr
[SPR_LPCR
] & LPCR_HEIC
);
9131 if (heic
== 0 || !msr_hv
|| msr_pr
) {
9135 /* Decrementer Exception */
9136 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DECR
)) &&
9137 (env
->spr
[SPR_LPCR
] & LPCR_DEE
)) {
9140 /* Machine Check or Hypervisor Maintenance Exception */
9141 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_MCK
|
9142 1u << PPC_INTERRUPT_HMI
)) && (env
->spr
[SPR_LPCR
] & LPCR_OEE
)) {
9145 /* Privileged Doorbell Exception */
9146 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_DOORBELL
)) &&
9147 (env
->spr
[SPR_LPCR
] & LPCR_PDEE
)) {
9150 /* Hypervisor Doorbell Exception */
9151 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HDOORBELL
)) &&
9152 (env
->spr
[SPR_LPCR
] & LPCR_HDEE
)) {
9155 /* Hypervisor virtualization exception */
9156 if ((env
->pending_interrupts
& (1u << PPC_INTERRUPT_HVIRT
)) &&
9157 (env
->spr
[SPR_LPCR
] & LPCR_HVEE
)) {
9160 if (env
->pending_interrupts
& (1u << PPC_INTERRUPT_RESET
)) {
9165 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
9169 POWERPC_FAMILY(POWER10
)(ObjectClass
*oc
, void *data
)
9171 DeviceClass
*dc
= DEVICE_CLASS(oc
);
9172 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9173 CPUClass
*cc
= CPU_CLASS(oc
);
9175 dc
->fw_name
= "PowerPC,POWER10";
9176 dc
->desc
= "POWER10";
9177 pcc
->pvr_match
= ppc_pvr_match_power10
;
9178 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
| PCR_COMPAT_2_07
|
9180 pcc
->pcr_supported
= PCR_COMPAT_3_10
| PCR_COMPAT_3_00
| PCR_COMPAT_2_07
|
9181 PCR_COMPAT_2_06
| PCR_COMPAT_2_05
;
9182 pcc
->init_proc
= init_proc_POWER10
;
9183 pcc
->check_pow
= check_pow_nocheck
;
9184 cc
->has_work
= cpu_has_work_POWER10
;
9185 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
9186 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
9187 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
9188 PPC_FLOAT_FRSQRTES
|
9191 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
9192 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
9194 PPC_64B
| PPC_64H
| PPC_64BX
| PPC_ALTIVEC
|
9195 PPC_SEGMENT_64B
| PPC_SLBI
|
9196 PPC_POPCNTB
| PPC_POPCNTWD
|
9198 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
9199 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
9200 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
9201 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
9202 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
9203 PPC2_ISA205
| PPC2_ISA207S
| PPC2_FP_CVT_S64
|
9204 PPC2_TM
| PPC2_ISA300
| PPC2_PRCNTL
;
9205 pcc
->msr_mask
= (1ull << MSR_SF
) |
9223 pcc
->lpcr_mask
= LPCR_VPM1
| LPCR_ISL
| LPCR_KBV
| LPCR_DPFD
|
9224 (LPCR_PECE_U_MASK
& LPCR_HVEE
) | LPCR_ILE
| LPCR_AIL
|
9225 LPCR_UPRT
| LPCR_EVIRT
| LPCR_ONL
| LPCR_HR
| LPCR_LD
|
9226 (LPCR_PECE_L_MASK
& (LPCR_PDEE
| LPCR_HDEE
| LPCR_EEE
|
9227 LPCR_DEE
| LPCR_OEE
))
9228 | LPCR_MER
| LPCR_GTSE
| LPCR_TC
|
9229 LPCR_HEIC
| LPCR_LPES0
| LPCR_HVICE
| LPCR_HDICE
;
9230 pcc
->lpcr_pm
= LPCR_PDEE
| LPCR_HDEE
| LPCR_EEE
| LPCR_DEE
| LPCR_OEE
;
9231 pcc
->mmu_model
= POWERPC_MMU_3_00
;
9232 #if defined(CONFIG_SOFTMMU)
9233 pcc
->handle_mmu_fault
= ppc64_v3_handle_mmu_fault
;
9234 /* segment page size remain the same */
9235 pcc
->hash64_opts
= &ppc_hash64_opts_POWER7
;
9236 pcc
->radix_page_info
= &POWER10_radix_page_info
;
9237 pcc
->lrg_decr_bits
= 56;
9239 pcc
->excp_model
= POWERPC_EXCP_POWER9
;
9240 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER9
;
9241 pcc
->bfd_mach
= bfd_mach_ppc64
;
9242 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
9243 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
9244 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
9245 POWERPC_FLAG_VSX
| POWERPC_FLAG_TM
;
9246 pcc
->l1_dcache_size
= 0x8000;
9247 pcc
->l1_icache_size
= 0x8000;
9248 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
9251 #if !defined(CONFIG_USER_ONLY)
9252 void cpu_ppc_set_vhyp(PowerPCCPU
*cpu
, PPCVirtualHypervisor
*vhyp
)
9254 CPUPPCState
*env
= &cpu
->env
;
9259 * With a virtual hypervisor mode we never allow the CPU to go
9260 * hypervisor mode itself
9262 env
->msr_mask
&= ~MSR_HVB
;
9265 #endif /* !defined(CONFIG_USER_ONLY) */
9267 #endif /* defined(TARGET_PPC64) */
9269 /*****************************************************************************/
9270 /* Generic CPU instantiation routine */
9271 static void init_ppc_proc(PowerPCCPU
*cpu
)
9273 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9274 CPUPPCState
*env
= &cpu
->env
;
9275 #if !defined(CONFIG_USER_ONLY)
9278 env
->irq_inputs
= NULL
;
9279 /* Set all exception vectors to an invalid address */
9280 for (i
= 0; i
< POWERPC_EXCP_NB
; i
++) {
9281 env
->excp_vectors
[i
] = (target_ulong
)(-1ULL);
9283 env
->ivor_mask
= 0x00000000;
9284 env
->ivpr_mask
= 0x00000000;
9285 /* Default MMU definitions */
9289 env
->tlb_type
= TLB_NONE
;
9291 /* Register SPR common to all PowerPC implementations */
9292 gen_spr_generic(env
);
9293 spr_register(env
, SPR_PVR
, "PVR",
9294 /* Linux permits userspace to read PVR */
9295 #if defined(CONFIG_LINUX_USER)
9301 &spr_read_generic
, SPR_NOACCESS
,
9303 /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
9304 if (pcc
->svr
!= POWERPC_SVR_NONE
) {
9305 if (pcc
->svr
& POWERPC_SVR_E500
) {
9306 spr_register(env
, SPR_E500_SVR
, "SVR",
9307 SPR_NOACCESS
, SPR_NOACCESS
,
9308 &spr_read_generic
, SPR_NOACCESS
,
9309 pcc
->svr
& ~POWERPC_SVR_E500
);
9311 spr_register(env
, SPR_SVR
, "SVR",
9312 SPR_NOACCESS
, SPR_NOACCESS
,
9313 &spr_read_generic
, SPR_NOACCESS
,
9317 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
9318 (*pcc
->init_proc
)(env
);
9320 #if !defined(CONFIG_USER_ONLY)
9321 ppc_gdb_gen_spr_xml(cpu
);
9324 /* MSR bits & flags consistency checks */
9325 if (env
->msr_mask
& (1 << 25)) {
9326 switch (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
9327 case POWERPC_FLAG_SPE
:
9328 case POWERPC_FLAG_VRE
:
9331 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9332 "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
9335 } else if (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
9336 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9337 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
9340 if (env
->msr_mask
& (1 << 17)) {
9341 switch (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
9342 case POWERPC_FLAG_TGPR
:
9343 case POWERPC_FLAG_CE
:
9346 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9347 "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
9350 } else if (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
9351 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9352 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
9355 if (env
->msr_mask
& (1 << 10)) {
9356 switch (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
9357 POWERPC_FLAG_UBLE
)) {
9358 case POWERPC_FLAG_SE
:
9359 case POWERPC_FLAG_DWE
:
9360 case POWERPC_FLAG_UBLE
:
9363 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9364 "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
9365 "POWERPC_FLAG_UBLE\n");
9368 } else if (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
9369 POWERPC_FLAG_UBLE
)) {
9370 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9371 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
9372 "POWERPC_FLAG_UBLE\n");
9375 if (env
->msr_mask
& (1 << 9)) {
9376 switch (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
9377 case POWERPC_FLAG_BE
:
9378 case POWERPC_FLAG_DE
:
9381 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9382 "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
9385 } else if (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
9386 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9387 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
9390 if (env
->msr_mask
& (1 << 2)) {
9391 switch (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
9392 case POWERPC_FLAG_PX
:
9393 case POWERPC_FLAG_PMM
:
9396 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9397 "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
9400 } else if (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
9401 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
9402 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
9405 if ((env
->flags
& (POWERPC_FLAG_RTC_CLK
| POWERPC_FLAG_BUS_CLK
)) == 0) {
9406 fprintf(stderr
, "PowerPC flags inconsistency\n"
9407 "Should define the time-base and decrementer clock source\n");
9410 /* Allocate TLBs buffer when needed */
9411 #if !defined(CONFIG_USER_ONLY)
9412 if (env
->nb_tlb
!= 0) {
9413 int nb_tlb
= env
->nb_tlb
;
9414 if (env
->id_tlbs
!= 0) {
9417 switch (env
->tlb_type
) {
9419 env
->tlb
.tlb6
= g_new0(ppc6xx_tlb_t
, nb_tlb
);
9422 env
->tlb
.tlbe
= g_new0(ppcemb_tlb_t
, nb_tlb
);
9425 env
->tlb
.tlbm
= g_new0(ppcmas_tlb_t
, nb_tlb
);
9428 /* Pre-compute some useful values */
9429 env
->tlb_per_way
= env
->nb_tlb
/ env
->nb_ways
;
9431 if (env
->irq_inputs
== NULL
) {
9432 warn_report("no internal IRQ controller registered."
9433 " Attempt QEMU to crash very soon !");
9436 if (env
->check_pow
== NULL
) {
9437 warn_report("no power management check handler registered."
9438 " Attempt QEMU to crash very soon !");
9442 #if defined(PPC_DUMP_CPU)
9443 static void dump_ppc_sprs(CPUPPCState
*env
)
9446 #if !defined(CONFIG_USER_ONLY)
9452 printf("Special purpose registers:\n");
9453 for (i
= 0; i
< 32; i
++) {
9454 for (j
= 0; j
< 32; j
++) {
9456 spr
= &env
->spr_cb
[n
];
9457 uw
= spr
->uea_write
!= NULL
&& spr
->uea_write
!= SPR_NOACCESS
;
9458 ur
= spr
->uea_read
!= NULL
&& spr
->uea_read
!= SPR_NOACCESS
;
9459 #if !defined(CONFIG_USER_ONLY)
9460 sw
= spr
->oea_write
!= NULL
&& spr
->oea_write
!= SPR_NOACCESS
;
9461 sr
= spr
->oea_read
!= NULL
&& spr
->oea_read
!= SPR_NOACCESS
;
9462 if (sw
|| sr
|| uw
|| ur
) {
9463 printf("SPR: %4d (%03x) %-8s s%c%c u%c%c\n",
9464 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
9465 sw
? 'w' : '-', sr
? 'r' : '-',
9466 uw
? 'w' : '-', ur
? 'r' : '-');
9470 printf("SPR: %4d (%03x) %-8s u%c%c\n",
9471 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
9472 uw
? 'w' : '-', ur
? 'r' : '-');
9482 /*****************************************************************************/
9486 PPC_DIRECT
= 0, /* Opcode routine */
9487 PPC_INDIRECT
= 1, /* Indirect opcode table */
9490 #define PPC_OPCODE_MASK 0x3
9492 static inline int is_indirect_opcode(void *handler
)
9494 return ((uintptr_t)handler
& PPC_OPCODE_MASK
) == PPC_INDIRECT
;
9497 static inline opc_handler_t
**ind_table(void *handler
)
9499 return (opc_handler_t
**)((uintptr_t)handler
& ~PPC_OPCODE_MASK
);
9502 /* Instruction table creation */
9503 /* Opcodes tables creation */
9504 static void fill_new_table(opc_handler_t
**table
, int len
)
9508 for (i
= 0; i
< len
; i
++) {
9509 table
[i
] = &invalid_handler
;
9513 static int create_new_table(opc_handler_t
**table
, unsigned char idx
)
9515 opc_handler_t
**tmp
;
9517 tmp
= g_new(opc_handler_t
*, PPC_CPU_INDIRECT_OPCODES_LEN
);
9518 fill_new_table(tmp
, PPC_CPU_INDIRECT_OPCODES_LEN
);
9519 table
[idx
] = (opc_handler_t
*)((uintptr_t)tmp
| PPC_INDIRECT
);
9524 static int insert_in_table(opc_handler_t
**table
, unsigned char idx
,
9525 opc_handler_t
*handler
)
9527 if (table
[idx
] != &invalid_handler
) {
9530 table
[idx
] = handler
;
9535 static int register_direct_insn(opc_handler_t
**ppc_opcodes
,
9536 unsigned char idx
, opc_handler_t
*handler
)
9538 if (insert_in_table(ppc_opcodes
, idx
, handler
) < 0) {
9539 printf("*** ERROR: opcode %02x already assigned in main "
9540 "opcode table\n", idx
);
9541 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9542 printf(" Registered handler '%s' - new handler '%s'\n",
9543 ppc_opcodes
[idx
]->oname
, handler
->oname
);
9551 static int register_ind_in_table(opc_handler_t
**table
,
9552 unsigned char idx1
, unsigned char idx2
,
9553 opc_handler_t
*handler
)
9555 if (table
[idx1
] == &invalid_handler
) {
9556 if (create_new_table(table
, idx1
) < 0) {
9557 printf("*** ERROR: unable to create indirect table "
9558 "idx=%02x\n", idx1
);
9562 if (!is_indirect_opcode(table
[idx1
])) {
9563 printf("*** ERROR: idx %02x already assigned to a direct "
9565 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9566 printf(" Registered handler '%s' - new handler '%s'\n",
9567 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
9572 if (handler
!= NULL
&&
9573 insert_in_table(ind_table(table
[idx1
]), idx2
, handler
) < 0) {
9574 printf("*** ERROR: opcode %02x already assigned in "
9575 "opcode table %02x\n", idx2
, idx1
);
9576 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
9577 printf(" Registered handler '%s' - new handler '%s'\n",
9578 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
9586 static int register_ind_insn(opc_handler_t
**ppc_opcodes
,
9587 unsigned char idx1
, unsigned char idx2
,
9588 opc_handler_t
*handler
)
9590 return register_ind_in_table(ppc_opcodes
, idx1
, idx2
, handler
);
9593 static int register_dblind_insn(opc_handler_t
**ppc_opcodes
,
9594 unsigned char idx1
, unsigned char idx2
,
9595 unsigned char idx3
, opc_handler_t
*handler
)
9597 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
9598 printf("*** ERROR: unable to join indirect table idx "
9599 "[%02x-%02x]\n", idx1
, idx2
);
9602 if (register_ind_in_table(ind_table(ppc_opcodes
[idx1
]), idx2
, idx3
,
9604 printf("*** ERROR: unable to insert opcode "
9605 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
9612 static int register_trplind_insn(opc_handler_t
**ppc_opcodes
,
9613 unsigned char idx1
, unsigned char idx2
,
9614 unsigned char idx3
, unsigned char idx4
,
9615 opc_handler_t
*handler
)
9617 opc_handler_t
**table
;
9619 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
9620 printf("*** ERROR: unable to join indirect table idx "
9621 "[%02x-%02x]\n", idx1
, idx2
);
9624 table
= ind_table(ppc_opcodes
[idx1
]);
9625 if (register_ind_in_table(table
, idx2
, idx3
, NULL
) < 0) {
9626 printf("*** ERROR: unable to join 2nd-level indirect table idx "
9627 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
9630 table
= ind_table(table
[idx2
]);
9631 if (register_ind_in_table(table
, idx3
, idx4
, handler
) < 0) {
9632 printf("*** ERROR: unable to insert opcode "
9633 "[%02x-%02x-%02x-%02x]\n", idx1
, idx2
, idx3
, idx4
);
9638 static int register_insn(opc_handler_t
**ppc_opcodes
, opcode_t
*insn
)
9640 if (insn
->opc2
!= 0xFF) {
9641 if (insn
->opc3
!= 0xFF) {
9642 if (insn
->opc4
!= 0xFF) {
9643 if (register_trplind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
9644 insn
->opc3
, insn
->opc4
,
9645 &insn
->handler
) < 0) {
9649 if (register_dblind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
9650 insn
->opc3
, &insn
->handler
) < 0) {
9655 if (register_ind_insn(ppc_opcodes
, insn
->opc1
,
9656 insn
->opc2
, &insn
->handler
) < 0) {
9661 if (register_direct_insn(ppc_opcodes
, insn
->opc1
, &insn
->handler
) < 0) {
9669 static int test_opcode_table(opc_handler_t
**table
, int len
)
9673 for (i
= 0, count
= 0; i
< len
; i
++) {
9674 /* Consistency fixup */
9675 if (table
[i
] == NULL
) {
9676 table
[i
] = &invalid_handler
;
9678 if (table
[i
] != &invalid_handler
) {
9679 if (is_indirect_opcode(table
[i
])) {
9680 tmp
= test_opcode_table(ind_table(table
[i
]),
9681 PPC_CPU_INDIRECT_OPCODES_LEN
);
9684 table
[i
] = &invalid_handler
;
9697 static void fix_opcode_tables(opc_handler_t
**ppc_opcodes
)
9699 if (test_opcode_table(ppc_opcodes
, PPC_CPU_OPCODES_LEN
) == 0) {
9700 printf("*** WARNING: no opcode defined !\n");
9704 /*****************************************************************************/
9705 static void create_ppc_opcodes(PowerPCCPU
*cpu
, Error
**errp
)
9707 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9710 fill_new_table(cpu
->opcodes
, PPC_CPU_OPCODES_LEN
);
9711 for (opc
= opcodes
; opc
< &opcodes
[ARRAY_SIZE(opcodes
)]; opc
++) {
9712 if (((opc
->handler
.type
& pcc
->insns_flags
) != 0) ||
9713 ((opc
->handler
.type2
& pcc
->insns_flags2
) != 0)) {
9714 if (register_insn(cpu
->opcodes
, opc
) < 0) {
9715 error_setg(errp
, "ERROR initializing PowerPC instruction "
9716 "0x%02x 0x%02x 0x%02x", opc
->opc1
, opc
->opc2
,
9722 fix_opcode_tables(cpu
->opcodes
);
9727 #if defined(PPC_DUMP_CPU)
9728 static void dump_ppc_insns(CPUPPCState
*env
)
9730 opc_handler_t
**table
, *handler
;
9732 uint8_t opc1
, opc2
, opc3
, opc4
;
9734 printf("Instructions set:\n");
9735 /* opc1 is 6 bits long */
9736 for (opc1
= 0x00; opc1
< PPC_CPU_OPCODES_LEN
; opc1
++) {
9737 table
= env
->opcodes
;
9738 handler
= table
[opc1
];
9739 if (is_indirect_opcode(handler
)) {
9740 /* opc2 is 5 bits long */
9741 for (opc2
= 0; opc2
< PPC_CPU_INDIRECT_OPCODES_LEN
; opc2
++) {
9742 table
= env
->opcodes
;
9743 handler
= env
->opcodes
[opc1
];
9744 table
= ind_table(handler
);
9745 handler
= table
[opc2
];
9746 if (is_indirect_opcode(handler
)) {
9747 table
= ind_table(handler
);
9748 /* opc3 is 5 bits long */
9749 for (opc3
= 0; opc3
< PPC_CPU_INDIRECT_OPCODES_LEN
;
9751 handler
= table
[opc3
];
9752 if (is_indirect_opcode(handler
)) {
9753 table
= ind_table(handler
);
9754 /* opc4 is 5 bits long */
9755 for (opc4
= 0; opc4
< PPC_CPU_INDIRECT_OPCODES_LEN
;
9757 handler
= table
[opc4
];
9758 if (handler
->handler
!= &gen_invalid
) {
9759 printf("INSN: %02x %02x %02x %02x -- "
9760 "(%02d %04d %02d) : %s\n",
9761 opc1
, opc2
, opc3
, opc4
,
9762 opc1
, (opc3
<< 5) | opc2
, opc4
,
9767 if (handler
->handler
!= &gen_invalid
) {
9768 /* Special hack to properly dump SPE insns */
9769 p
= strchr(handler
->oname
, '_');
9771 printf("INSN: %02x %02x %02x (%02d %04d) : "
9773 opc1
, opc2
, opc3
, opc1
,
9778 if ((p
- handler
->oname
) != strlen(q
)
9779 || (memcmp(handler
->oname
, q
, strlen(q
))
9781 /* First instruction */
9782 printf("INSN: %02x %02x %02x"
9783 "(%02d %04d) : %.*s\n",
9784 opc1
, opc2
<< 1, opc3
, opc1
,
9785 (opc3
<< 6) | (opc2
<< 1),
9786 (int)(p
- handler
->oname
),
9789 if (strcmp(p
+ 1, q
) != 0) {
9790 /* Second instruction */
9791 printf("INSN: %02x %02x %02x "
9792 "(%02d %04d) : %s\n", opc1
,
9793 (opc2
<< 1) | 1, opc3
, opc1
,
9794 (opc3
<< 6) | (opc2
<< 1) | 1,
9802 if (handler
->handler
!= &gen_invalid
) {
9803 printf("INSN: %02x %02x -- (%02d %04d) : %s\n",
9804 opc1
, opc2
, opc1
, opc2
, handler
->oname
);
9809 if (handler
->handler
!= &gen_invalid
) {
9810 printf("INSN: %02x -- -- (%02d ----) : %s\n",
9811 opc1
, opc1
, handler
->oname
);
9818 static bool avr_need_swap(CPUPPCState
*env
)
9820 #ifdef HOST_WORDS_BIGENDIAN
9827 #if !defined(CONFIG_USER_ONLY)
9828 static int gdb_find_spr_idx(CPUPPCState
*env
, int n
)
9832 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
9833 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
9835 if (spr
->name
&& spr
->gdb_id
== n
) {
9842 static int gdb_get_spr_reg(CPUPPCState
*env
, GByteArray
*buf
, int n
)
9847 reg
= gdb_find_spr_idx(env
, n
);
9852 len
= TARGET_LONG_SIZE
;
9853 gdb_get_regl(buf
, env
->spr
[reg
]);
9854 ppc_maybe_bswap_register(env
, gdb_get_reg_ptr(buf
, len
), len
);
9858 static int gdb_set_spr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9863 reg
= gdb_find_spr_idx(env
, n
);
9868 len
= TARGET_LONG_SIZE
;
9869 ppc_maybe_bswap_register(env
, mem_buf
, len
);
9870 env
->spr
[reg
] = ldn_p(mem_buf
, len
);
9876 static int gdb_get_float_reg(CPUPPCState
*env
, GByteArray
*buf
, int n
)
9880 gdb_get_float64(buf
, *cpu_fpr_ptr(env
, n
));
9881 mem_buf
= gdb_get_reg_ptr(buf
, 8);
9882 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9886 gdb_get_reg32(buf
, env
->fpscr
);
9887 mem_buf
= gdb_get_reg_ptr(buf
, 4);
9888 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9894 static int gdb_set_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9897 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9898 *cpu_fpr_ptr(env
, n
) = ldfq_p(mem_buf
);
9902 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9903 helper_store_fpscr(env
, ldl_p(mem_buf
), 0xffffffff);
9909 static int gdb_get_avr_reg(CPUPPCState
*env
, GByteArray
*buf
, int n
)
9914 ppc_avr_t
*avr
= cpu_avr_ptr(env
, n
);
9915 if (!avr_need_swap(env
)) {
9916 gdb_get_reg128(buf
, avr
->u64
[0] , avr
->u64
[1]);
9918 gdb_get_reg128(buf
, avr
->u64
[1] , avr
->u64
[0]);
9920 mem_buf
= gdb_get_reg_ptr(buf
, 16);
9921 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9922 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
9926 gdb_get_reg32(buf
, helper_mfvscr(env
));
9927 mem_buf
= gdb_get_reg_ptr(buf
, 4);
9928 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9932 gdb_get_reg32(buf
, (uint32_t)env
->spr
[SPR_VRSAVE
]);
9933 mem_buf
= gdb_get_reg_ptr(buf
, 4);
9934 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9940 static int gdb_set_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9943 ppc_avr_t
*avr
= cpu_avr_ptr(env
, n
);
9944 ppc_maybe_bswap_register(env
, mem_buf
, 8);
9945 ppc_maybe_bswap_register(env
, mem_buf
+ 8, 8);
9946 if (!avr_need_swap(env
)) {
9947 avr
->u64
[0] = ldq_p(mem_buf
);
9948 avr
->u64
[1] = ldq_p(mem_buf
+ 8);
9950 avr
->u64
[1] = ldq_p(mem_buf
);
9951 avr
->u64
[0] = ldq_p(mem_buf
+ 8);
9956 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9957 helper_mtvscr(env
, ldl_p(mem_buf
));
9961 ppc_maybe_bswap_register(env
, mem_buf
, 4);
9962 env
->spr
[SPR_VRSAVE
] = (target_ulong
)ldl_p(mem_buf
);
9968 static int gdb_get_spe_reg(CPUPPCState
*env
, GByteArray
*buf
, int n
)
9971 #if defined(TARGET_PPC64)
9972 gdb_get_reg32(buf
, env
->gpr
[n
] >> 32);
9973 ppc_maybe_bswap_register(env
, gdb_get_reg_ptr(buf
, 4), 4);
9975 gdb_get_reg32(buf
, env
->gprh
[n
]);
9980 gdb_get_reg64(buf
, env
->spe_acc
);
9981 ppc_maybe_bswap_register(env
, gdb_get_reg_ptr(buf
, 8), 8);
9985 gdb_get_reg32(buf
, env
->spe_fscr
);
9986 ppc_maybe_bswap_register(env
, gdb_get_reg_ptr(buf
, 4), 4);
9992 static int gdb_set_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
9995 #if defined(TARGET_PPC64)
9996 target_ulong lo
= (uint32_t)env
->gpr
[n
];
9999 ppc_maybe_bswap_register(env
, mem_buf
, 4);
10001 hi
= (target_ulong
)ldl_p(mem_buf
) << 32;
10002 env
->gpr
[n
] = lo
| hi
;
10004 env
->gprh
[n
] = ldl_p(mem_buf
);
10009 ppc_maybe_bswap_register(env
, mem_buf
, 8);
10010 env
->spe_acc
= ldq_p(mem_buf
);
10014 ppc_maybe_bswap_register(env
, mem_buf
, 4);
10015 env
->spe_fscr
= ldl_p(mem_buf
);
10021 static int gdb_get_vsx_reg(CPUPPCState
*env
, GByteArray
*buf
, int n
)
10024 gdb_get_reg64(buf
, *cpu_vsrl_ptr(env
, n
));
10025 ppc_maybe_bswap_register(env
, gdb_get_reg_ptr(buf
, 8), 8);
10031 static int gdb_set_vsx_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
10034 ppc_maybe_bswap_register(env
, mem_buf
, 8);
10035 *cpu_vsrl_ptr(env
, n
) = ldq_p(mem_buf
);
10041 static int ppc_fixup_cpu(PowerPCCPU
*cpu
)
10043 CPUPPCState
*env
= &cpu
->env
;
10046 * TCG doesn't (yet) emulate some groups of instructions that are
10047 * implemented on some otherwise supported CPUs (e.g. VSX and
10048 * decimal floating point instructions on POWER7). We remove
10049 * unsupported instruction groups from the cpu state's instruction
10050 * masks and hope the guest can cope. For at least the pseries
10051 * machine, the unavailability of these instructions can be
10052 * advertised to the guest via the device tree.
10054 if ((env
->insns_flags
& ~PPC_TCG_INSNS
)
10055 || (env
->insns_flags2
& ~PPC_TCG_INSNS2
)) {
10056 warn_report("Disabling some instructions which are not "
10057 "emulated by TCG (0x%" PRIx64
", 0x%" PRIx64
")",
10058 env
->insns_flags
& ~PPC_TCG_INSNS
,
10059 env
->insns_flags2
& ~PPC_TCG_INSNS2
);
10061 env
->insns_flags
&= PPC_TCG_INSNS
;
10062 env
->insns_flags2
&= PPC_TCG_INSNS2
;
10066 static void ppc_cpu_realize(DeviceState
*dev
, Error
**errp
)
10068 CPUState
*cs
= CPU(dev
);
10069 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
10070 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10071 Error
*local_err
= NULL
;
10073 cpu_exec_realizefn(cs
, &local_err
);
10074 if (local_err
!= NULL
) {
10075 error_propagate(errp
, local_err
);
10078 if (cpu
->vcpu_id
== UNASSIGNED_CPU_INDEX
) {
10079 cpu
->vcpu_id
= cs
->cpu_index
;
10082 if (tcg_enabled()) {
10083 if (ppc_fixup_cpu(cpu
) != 0) {
10084 error_setg(errp
, "Unable to emulate selected CPU with TCG");
10089 create_ppc_opcodes(cpu
, &local_err
);
10090 if (local_err
!= NULL
) {
10091 error_propagate(errp
, local_err
);
10094 init_ppc_proc(cpu
);
10096 if (pcc
->insns_flags
& PPC_FLOAT
) {
10097 gdb_register_coprocessor(cs
, gdb_get_float_reg
, gdb_set_float_reg
,
10098 33, "power-fpu.xml", 0);
10100 if (pcc
->insns_flags
& PPC_ALTIVEC
) {
10101 gdb_register_coprocessor(cs
, gdb_get_avr_reg
, gdb_set_avr_reg
,
10102 34, "power-altivec.xml", 0);
10104 if (pcc
->insns_flags
& PPC_SPE
) {
10105 gdb_register_coprocessor(cs
, gdb_get_spe_reg
, gdb_set_spe_reg
,
10106 34, "power-spe.xml", 0);
10108 if (pcc
->insns_flags2
& PPC2_VSX
) {
10109 gdb_register_coprocessor(cs
, gdb_get_vsx_reg
, gdb_set_vsx_reg
,
10110 32, "power-vsx.xml", 0);
10112 #ifndef CONFIG_USER_ONLY
10113 gdb_register_coprocessor(cs
, gdb_get_spr_reg
, gdb_set_spr_reg
,
10114 pcc
->gdb_num_sprs
, "power-spr.xml", 0);
10116 qemu_init_vcpu(cs
);
10118 pcc
->parent_realize(dev
, errp
);
10120 #if defined(PPC_DUMP_CPU)
10122 CPUPPCState
*env
= &cpu
->env
;
10123 const char *mmu_model
, *excp_model
, *bus_model
;
10124 switch (env
->mmu_model
) {
10125 case POWERPC_MMU_32B
:
10126 mmu_model
= "PowerPC 32";
10128 case POWERPC_MMU_SOFT_6xx
:
10129 mmu_model
= "PowerPC 6xx/7xx with software driven TLBs";
10131 case POWERPC_MMU_SOFT_74xx
:
10132 mmu_model
= "PowerPC 74xx with software driven TLBs";
10134 case POWERPC_MMU_SOFT_4xx
:
10135 mmu_model
= "PowerPC 4xx with software driven TLBs";
10137 case POWERPC_MMU_SOFT_4xx_Z
:
10138 mmu_model
= "PowerPC 4xx with software driven TLBs "
10139 "and zones protections";
10141 case POWERPC_MMU_REAL
:
10142 mmu_model
= "PowerPC real mode only";
10144 case POWERPC_MMU_MPC8xx
:
10145 mmu_model
= "PowerPC MPC8xx";
10147 case POWERPC_MMU_BOOKE
:
10148 mmu_model
= "PowerPC BookE";
10150 case POWERPC_MMU_BOOKE206
:
10151 mmu_model
= "PowerPC BookE 2.06";
10153 case POWERPC_MMU_601
:
10154 mmu_model
= "PowerPC 601";
10156 #if defined(TARGET_PPC64)
10157 case POWERPC_MMU_64B
:
10158 mmu_model
= "PowerPC 64";
10162 mmu_model
= "Unknown or invalid";
10165 switch (env
->excp_model
) {
10166 case POWERPC_EXCP_STD
:
10167 excp_model
= "PowerPC";
10169 case POWERPC_EXCP_40x
:
10170 excp_model
= "PowerPC 40x";
10172 case POWERPC_EXCP_601
:
10173 excp_model
= "PowerPC 601";
10175 case POWERPC_EXCP_602
:
10176 excp_model
= "PowerPC 602";
10178 case POWERPC_EXCP_603
:
10179 excp_model
= "PowerPC 603";
10181 case POWERPC_EXCP_603E
:
10182 excp_model
= "PowerPC 603e";
10184 case POWERPC_EXCP_604
:
10185 excp_model
= "PowerPC 604";
10187 case POWERPC_EXCP_7x0
:
10188 excp_model
= "PowerPC 740/750";
10190 case POWERPC_EXCP_7x5
:
10191 excp_model
= "PowerPC 745/755";
10193 case POWERPC_EXCP_74xx
:
10194 excp_model
= "PowerPC 74xx";
10196 case POWERPC_EXCP_BOOKE
:
10197 excp_model
= "PowerPC BookE";
10199 #if defined(TARGET_PPC64)
10200 case POWERPC_EXCP_970
:
10201 excp_model
= "PowerPC 970";
10205 excp_model
= "Unknown or invalid";
10208 switch (env
->bus_model
) {
10209 case PPC_FLAGS_INPUT_6xx
:
10210 bus_model
= "PowerPC 6xx";
10212 case PPC_FLAGS_INPUT_BookE
:
10213 bus_model
= "PowerPC BookE";
10215 case PPC_FLAGS_INPUT_405
:
10216 bus_model
= "PowerPC 405";
10218 case PPC_FLAGS_INPUT_401
:
10219 bus_model
= "PowerPC 401/403";
10221 case PPC_FLAGS_INPUT_RCPU
:
10222 bus_model
= "RCPU / MPC8xx";
10224 #if defined(TARGET_PPC64)
10225 case PPC_FLAGS_INPUT_970
:
10226 bus_model
= "PowerPC 970";
10230 bus_model
= "Unknown or invalid";
10233 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64
"\n"
10234 " MMU model : %s\n",
10235 object_class_get_name(OBJECT_CLASS(pcc
)),
10236 pcc
->pvr
, pcc
->msr_mask
, mmu_model
);
10237 #if !defined(CONFIG_USER_ONLY)
10238 if (env
->tlb
.tlb6
) {
10239 printf(" %d %s TLB in %d ways\n",
10240 env
->nb_tlb
, env
->id_tlbs
? "splitted" : "merged",
10244 printf(" Exceptions model : %s\n"
10245 " Bus model : %s\n",
10246 excp_model
, bus_model
);
10247 printf(" MSR features :\n");
10248 if (env
->flags
& POWERPC_FLAG_SPE
) {
10249 printf(" signal processing engine enable"
10251 } else if (env
->flags
& POWERPC_FLAG_VRE
) {
10252 printf(" vector processor enable\n");
10254 if (env
->flags
& POWERPC_FLAG_TGPR
) {
10255 printf(" temporary GPRs\n");
10256 } else if (env
->flags
& POWERPC_FLAG_CE
) {
10257 printf(" critical input enable\n");
10259 if (env
->flags
& POWERPC_FLAG_SE
) {
10260 printf(" single-step trace mode\n");
10261 } else if (env
->flags
& POWERPC_FLAG_DWE
) {
10262 printf(" debug wait enable\n");
10263 } else if (env
->flags
& POWERPC_FLAG_UBLE
) {
10264 printf(" user BTB lock enable\n");
10266 if (env
->flags
& POWERPC_FLAG_BE
) {
10267 printf(" branch-step trace mode\n");
10268 } else if (env
->flags
& POWERPC_FLAG_DE
) {
10269 printf(" debug interrupt enable\n");
10271 if (env
->flags
& POWERPC_FLAG_PX
) {
10272 printf(" inclusive protection\n");
10273 } else if (env
->flags
& POWERPC_FLAG_PMM
) {
10274 printf(" performance monitor mark\n");
10276 if (env
->flags
== POWERPC_FLAG_NONE
) {
10279 printf(" Time-base/decrementer clock source: %s\n",
10280 env
->flags
& POWERPC_FLAG_RTC_CLK
? "RTC clock" : "bus clock");
10281 dump_ppc_insns(env
);
10282 dump_ppc_sprs(env
);
10289 cpu_exec_unrealizefn(cs
);
10292 static void ppc_cpu_unrealize(DeviceState
*dev
)
10294 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
10295 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10296 opc_handler_t
**table
, **table_2
;
10299 pcc
->parent_unrealize(dev
);
10301 for (i
= 0; i
< PPC_CPU_OPCODES_LEN
; i
++) {
10302 if (cpu
->opcodes
[i
] == &invalid_handler
) {
10305 if (is_indirect_opcode(cpu
->opcodes
[i
])) {
10306 table
= ind_table(cpu
->opcodes
[i
]);
10307 for (j
= 0; j
< PPC_CPU_INDIRECT_OPCODES_LEN
; j
++) {
10308 if (table
[j
] == &invalid_handler
) {
10311 if (is_indirect_opcode(table
[j
])) {
10312 table_2
= ind_table(table
[j
]);
10313 for (k
= 0; k
< PPC_CPU_INDIRECT_OPCODES_LEN
; k
++) {
10314 if (table_2
[k
] != &invalid_handler
&&
10315 is_indirect_opcode(table_2
[k
])) {
10316 g_free((opc_handler_t
*)((uintptr_t)table_2
[k
] &
10320 g_free((opc_handler_t
*)((uintptr_t)table
[j
] &
10324 g_free((opc_handler_t
*)((uintptr_t)cpu
->opcodes
[i
] &
10330 static gint
ppc_cpu_compare_class_pvr(gconstpointer a
, gconstpointer b
)
10332 ObjectClass
*oc
= (ObjectClass
*)a
;
10333 uint32_t pvr
= *(uint32_t *)b
;
10334 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
10336 /* -cpu host does a PVR lookup during construction */
10337 if (unlikely(strcmp(object_class_get_name(oc
),
10338 TYPE_HOST_POWERPC_CPU
) == 0)) {
10342 return pcc
->pvr
== pvr
? 0 : -1;
10345 PowerPCCPUClass
*ppc_cpu_class_by_pvr(uint32_t pvr
)
10347 GSList
*list
, *item
;
10348 PowerPCCPUClass
*pcc
= NULL
;
10350 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10351 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr
);
10352 if (item
!= NULL
) {
10353 pcc
= POWERPC_CPU_CLASS(item
->data
);
10355 g_slist_free(list
);
10360 static gint
ppc_cpu_compare_class_pvr_mask(gconstpointer a
, gconstpointer b
)
10362 ObjectClass
*oc
= (ObjectClass
*)a
;
10363 uint32_t pvr
= *(uint32_t *)b
;
10364 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
10366 /* -cpu host does a PVR lookup during construction */
10367 if (unlikely(strcmp(object_class_get_name(oc
),
10368 TYPE_HOST_POWERPC_CPU
) == 0)) {
10372 if (pcc
->pvr_match(pcc
, pvr
)) {
10379 PowerPCCPUClass
*ppc_cpu_class_by_pvr_mask(uint32_t pvr
)
10381 GSList
*list
, *item
;
10382 PowerPCCPUClass
*pcc
= NULL
;
10384 list
= object_class_get_list(TYPE_POWERPC_CPU
, true);
10385 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr_mask
);
10386 if (item
!= NULL
) {
10387 pcc
= POWERPC_CPU_CLASS(item
->data
);
10389 g_slist_free(list
);
10394 static const char *ppc_cpu_lookup_alias(const char *alias
)
10398 for (ai
= 0; ppc_cpu_aliases
[ai
].alias
!= NULL
; ai
++) {
10399 if (strcmp(ppc_cpu_aliases
[ai
].alias
, alias
) == 0) {
10400 return ppc_cpu_aliases
[ai
].model
;
10407 static ObjectClass
*ppc_cpu_class_by_name(const char *name
)
10409 char *cpu_model
, *typename
;
10415 * Lookup by PVR if cpu_model is valid 8 digit hex number (excl:
10416 * 0x prefix if present)
10418 if (!qemu_strtoul(name
, &p
, 16, &pvr
)) {
10419 int len
= p
- name
;
10420 len
= (len
== 10) && (name
[1] == 'x') ? len
- 2 : len
;
10421 if ((len
== 8) && (*p
== '\0')) {
10422 return OBJECT_CLASS(ppc_cpu_class_by_pvr(pvr
));
10426 cpu_model
= g_ascii_strdown(name
, -1);
10427 p
= ppc_cpu_lookup_alias(cpu_model
);
10430 cpu_model
= g_strdup(p
);
10433 typename
= g_strdup_printf("%s" POWERPC_CPU_TYPE_SUFFIX
, cpu_model
);
10434 oc
= object_class_by_name(typename
);
10441 static void ppc_cpu_parse_featurestr(const char *type
, char *features
,
10444 Object
*machine
= qdev_get_machine();
10445 const PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(object_class_by_name(type
));
10451 if (object_property_find(machine
, "max-cpu-compat", NULL
)) {
10454 char *s
= features
;
10455 Error
*local_err
= NULL
;
10456 char *compat_str
= NULL
;
10459 * Backwards compatibility hack:
10461 * CPUs had a "compat=" property which didn't make sense for
10462 * anything except pseries. It was replaced by "max-cpu-compat"
10463 * machine option. This supports old command lines like
10464 * -cpu POWER8,compat=power7
10465 * By stripping the compat option and applying it to the machine
10466 * before passing it on to the cpu level parser.
10468 inpieces
= g_strsplit(features
, ",", 0);
10470 for (i
= 0; inpieces
[i
]; i
++) {
10471 if (g_str_has_prefix(inpieces
[i
], "compat=")) {
10472 warn_report_once("CPU 'compat' property is deprecated; "
10473 "use max-cpu-compat machine property instead");
10474 compat_str
= inpieces
[i
];
10477 if ((i
!= 0) && (s
!= features
)) {
10478 s
= g_stpcpy(s
, ",");
10480 s
= g_stpcpy(s
, inpieces
[i
]);
10484 char *v
= compat_str
+ strlen("compat=");
10485 object_property_set_str(machine
, "max-cpu-compat", v
, &local_err
);
10487 g_strfreev(inpieces
);
10489 error_propagate(errp
, local_err
);
10494 /* do property processing with generic handler */
10495 pcc
->parent_parse_features(type
, features
, errp
);
10498 PowerPCCPUClass
*ppc_cpu_get_family_class(PowerPCCPUClass
*pcc
)
10500 ObjectClass
*oc
= OBJECT_CLASS(pcc
);
10502 while (oc
&& !object_class_is_abstract(oc
)) {
10503 oc
= object_class_get_parent(oc
);
10507 return POWERPC_CPU_CLASS(oc
);
10510 /* Sort by PVR, ordering special case "host" last. */
10511 static gint
ppc_cpu_list_compare(gconstpointer a
, gconstpointer b
)
10513 ObjectClass
*oc_a
= (ObjectClass
*)a
;
10514 ObjectClass
*oc_b
= (ObjectClass
*)b
;
10515 PowerPCCPUClass
*pcc_a
= POWERPC_CPU_CLASS(oc_a
);
10516 PowerPCCPUClass
*pcc_b
= POWERPC_CPU_CLASS(oc_b
);
10517 const char *name_a
= object_class_get_name(oc_a
);
10518 const char *name_b
= object_class_get_name(oc_b
);
10520 if (strcmp(name_a
, TYPE_HOST_POWERPC_CPU
) == 0) {
10522 } else if (strcmp(name_b
, TYPE_HOST_POWERPC_CPU
) == 0) {
10525 /* Avoid an integer overflow during subtraction */
10526 if (pcc_a
->pvr
< pcc_b
->pvr
) {
10528 } else if (pcc_a
->pvr
> pcc_b
->pvr
) {
10536 static void ppc_cpu_list_entry(gpointer data
, gpointer user_data
)
10538 ObjectClass
*oc
= data
;
10539 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10540 DeviceClass
*family
= DEVICE_CLASS(ppc_cpu_get_family_class(pcc
));
10541 const char *typename
= object_class_get_name(oc
);
10545 if (unlikely(strcmp(typename
, TYPE_HOST_POWERPC_CPU
) == 0)) {
10549 name
= g_strndup(typename
,
10550 strlen(typename
) - strlen(POWERPC_CPU_TYPE_SUFFIX
));
10551 qemu_printf("PowerPC %-16s PVR %08x\n", name
, pcc
->pvr
);
10552 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
10553 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
10554 ObjectClass
*alias_oc
= ppc_cpu_class_by_name(alias
->model
);
10556 if (alias_oc
!= oc
) {
10560 * If running with KVM, we might update the family alias later, so
10561 * avoid printing the wrong alias here and use "preferred" instead
10563 if (strcmp(alias
->alias
, family
->desc
) == 0) {
10564 qemu_printf("PowerPC %-16s (alias for preferred %s CPU)\n",
10565 alias
->alias
, family
->desc
);
10567 qemu_printf("PowerPC %-16s (alias for %s)\n",
10568 alias
->alias
, name
);
10574 void ppc_cpu_list(void)
10578 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10579 list
= g_slist_sort(list
, ppc_cpu_list_compare
);
10580 g_slist_foreach(list
, ppc_cpu_list_entry
, NULL
);
10581 g_slist_free(list
);
10585 qemu_printf("PowerPC %-16s\n", "host");
10589 static void ppc_cpu_defs_entry(gpointer data
, gpointer user_data
)
10591 ObjectClass
*oc
= data
;
10592 CpuDefinitionInfoList
**first
= user_data
;
10593 const char *typename
;
10594 CpuDefinitionInfoList
*entry
;
10595 CpuDefinitionInfo
*info
;
10597 typename
= object_class_get_name(oc
);
10598 info
= g_malloc0(sizeof(*info
));
10599 info
->name
= g_strndup(typename
,
10600 strlen(typename
) - strlen(POWERPC_CPU_TYPE_SUFFIX
));
10602 entry
= g_malloc0(sizeof(*entry
));
10603 entry
->value
= info
;
10604 entry
->next
= *first
;
10608 CpuDefinitionInfoList
*qmp_query_cpu_definitions(Error
**errp
)
10610 CpuDefinitionInfoList
*cpu_list
= NULL
;
10614 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
10615 g_slist_foreach(list
, ppc_cpu_defs_entry
, &cpu_list
);
10616 g_slist_free(list
);
10618 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
10619 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
10621 CpuDefinitionInfoList
*entry
;
10622 CpuDefinitionInfo
*info
;
10624 oc
= ppc_cpu_class_by_name(alias
->model
);
10629 info
= g_malloc0(sizeof(*info
));
10630 info
->name
= g_strdup(alias
->alias
);
10631 info
->q_typename
= g_strdup(object_class_get_name(oc
));
10633 entry
= g_malloc0(sizeof(*entry
));
10634 entry
->value
= info
;
10635 entry
->next
= cpu_list
;
10642 static void ppc_cpu_set_pc(CPUState
*cs
, vaddr value
)
10644 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10646 cpu
->env
.nip
= value
;
10649 static bool ppc_cpu_has_work(CPUState
*cs
)
10651 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10652 CPUPPCState
*env
= &cpu
->env
;
10654 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
10657 static void ppc_cpu_reset(DeviceState
*dev
)
10659 CPUState
*s
= CPU(dev
);
10660 PowerPCCPU
*cpu
= POWERPC_CPU(s
);
10661 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10662 CPUPPCState
*env
= &cpu
->env
;
10666 pcc
->parent_reset(dev
);
10668 msr
= (target_ulong
)0;
10669 msr
|= (target_ulong
)MSR_HVB
;
10670 msr
|= (target_ulong
)0 << MSR_AP
; /* TO BE CHECKED */
10671 msr
|= (target_ulong
)0 << MSR_SA
; /* TO BE CHECKED */
10672 msr
|= (target_ulong
)1 << MSR_EP
;
10673 #if defined(DO_SINGLE_STEP) && 0
10674 /* Single step trace mode */
10675 msr
|= (target_ulong
)1 << MSR_SE
;
10676 msr
|= (target_ulong
)1 << MSR_BE
;
10678 #if defined(CONFIG_USER_ONLY)
10679 msr
|= (target_ulong
)1 << MSR_FP
; /* Allow floating point usage */
10680 msr
|= (target_ulong
)1 << MSR_FE0
; /* Allow floating point exceptions */
10681 msr
|= (target_ulong
)1 << MSR_FE1
;
10682 msr
|= (target_ulong
)1 << MSR_VR
; /* Allow altivec usage */
10683 msr
|= (target_ulong
)1 << MSR_VSX
; /* Allow VSX usage */
10684 msr
|= (target_ulong
)1 << MSR_SPE
; /* Allow SPE usage */
10685 msr
|= (target_ulong
)1 << MSR_PR
;
10686 #if defined(TARGET_PPC64)
10687 msr
|= (target_ulong
)1 << MSR_TM
; /* Transactional memory */
10689 #if !defined(TARGET_WORDS_BIGENDIAN)
10690 msr
|= (target_ulong
)1 << MSR_LE
; /* Little-endian user mode */
10691 if (!((env
->msr_mask
>> MSR_LE
) & 1)) {
10692 fprintf(stderr
, "Selected CPU does not support little-endian.\n");
10698 #if defined(TARGET_PPC64)
10699 if (env
->mmu_model
& POWERPC_MMU_64
) {
10700 msr
|= (1ULL << MSR_SF
);
10704 hreg_store_msr(env
, msr
, 1);
10706 #if !defined(CONFIG_USER_ONLY)
10707 env
->nip
= env
->hreset_vector
| env
->excp_prefix
;
10708 if (env
->mmu_model
!= POWERPC_MMU_REAL
) {
10709 ppc_tlb_invalidate_all(env
);
10713 hreg_compute_hflags(env
);
10714 env
->reserve_addr
= (target_ulong
)-1ULL;
10715 /* Be sure no exception or interrupt is pending */
10716 env
->pending_interrupts
= 0;
10717 s
->exception_index
= POWERPC_EXCP_NONE
;
10718 env
->error_code
= 0;
10719 ppc_irq_reset(cpu
);
10721 /* tininess for underflow is detected before rounding */
10722 set_float_detect_tininess(float_tininess_before_rounding
,
10725 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
10726 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
10731 env
->spr
[i
] = spr
->default_value
;
10735 #ifndef CONFIG_USER_ONLY
10736 static bool ppc_cpu_is_big_endian(CPUState
*cs
)
10738 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10739 CPUPPCState
*env
= &cpu
->env
;
10741 cpu_synchronize_state(cs
);
10746 static void ppc_cpu_exec_enter(CPUState
*cs
)
10748 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10751 PPCVirtualHypervisorClass
*vhc
=
10752 PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu
->vhyp
);
10753 vhc
->cpu_exec_enter(cpu
->vhyp
, cpu
);
10757 static void ppc_cpu_exec_exit(CPUState
*cs
)
10759 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10762 PPCVirtualHypervisorClass
*vhc
=
10763 PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu
->vhyp
);
10764 vhc
->cpu_exec_exit(cpu
->vhyp
, cpu
);
10769 static void ppc_cpu_instance_init(Object
*obj
)
10771 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
10772 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
10773 CPUPPCState
*env
= &cpu
->env
;
10775 cpu_set_cpustate_pointers(cpu
);
10776 cpu
->vcpu_id
= UNASSIGNED_CPU_INDEX
;
10778 env
->msr_mask
= pcc
->msr_mask
;
10779 env
->mmu_model
= pcc
->mmu_model
;
10780 env
->excp_model
= pcc
->excp_model
;
10781 env
->bus_model
= pcc
->bus_model
;
10782 env
->insns_flags
= pcc
->insns_flags
;
10783 env
->insns_flags2
= pcc
->insns_flags2
;
10784 env
->flags
= pcc
->flags
;
10785 env
->bfd_mach
= pcc
->bfd_mach
;
10786 env
->check_pow
= pcc
->check_pow
;
10789 * Mark HV mode as supported if the CPU has an MSR_HV bit in the
10790 * msr_mask. The mask can later be cleared by PAPR mode but the hv
10791 * mode support will remain, thus enforcing that we cannot use
10792 * priv. instructions in guest in PAPR mode. For 970 we currently
10793 * simply don't set HV in msr_mask thus simulating an "Apple mode"
10794 * 970. If we ever want to support 970 HV mode, we'll have to add
10795 * a processor attribute of some sort.
10797 #if !defined(CONFIG_USER_ONLY)
10798 env
->has_hv_mode
= !!(env
->msr_mask
& MSR_HVB
);
10801 ppc_hash64_init(cpu
);
10804 static void ppc_cpu_instance_finalize(Object
*obj
)
10806 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
10808 ppc_hash64_finalize(cpu
);
10811 static bool ppc_pvr_match_default(PowerPCCPUClass
*pcc
, uint32_t pvr
)
10813 return pcc
->pvr
== pvr
;
10816 static gchar
*ppc_gdb_arch_name(CPUState
*cs
)
10818 #if defined(TARGET_PPC64)
10819 return g_strdup("powerpc:common64");
10821 return g_strdup("powerpc:common");
10825 static void ppc_disas_set_info(CPUState
*cs
, disassemble_info
*info
)
10827 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
10828 CPUPPCState
*env
= &cpu
->env
;
10830 if ((env
->hflags
>> MSR_LE
) & 1) {
10831 info
->endian
= BFD_ENDIAN_LITTLE
;
10833 info
->mach
= env
->bfd_mach
;
10834 if (!env
->bfd_mach
) {
10835 #ifdef TARGET_PPC64
10836 info
->mach
= bfd_mach_ppc64
;
10838 info
->mach
= bfd_mach_ppc
;
10841 info
->disassembler_options
= (char *)"any";
10842 info
->print_insn
= print_insn_ppc
;
10844 info
->cap_arch
= CS_ARCH_PPC
;
10845 #ifdef TARGET_PPC64
10846 info
->cap_mode
= CS_MODE_64
;
10850 static Property ppc_cpu_properties
[] = {
10851 DEFINE_PROP_BOOL("pre-2.8-migration", PowerPCCPU
, pre_2_8_migration
, false),
10852 DEFINE_PROP_BOOL("pre-2.10-migration", PowerPCCPU
, pre_2_10_migration
,
10854 DEFINE_PROP_BOOL("pre-3.0-migration", PowerPCCPU
, pre_3_0_migration
,
10856 DEFINE_PROP_END_OF_LIST(),
10859 static void ppc_cpu_class_init(ObjectClass
*oc
, void *data
)
10861 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
10862 CPUClass
*cc
= CPU_CLASS(oc
);
10863 DeviceClass
*dc
= DEVICE_CLASS(oc
);
10865 device_class_set_parent_realize(dc
, ppc_cpu_realize
,
10866 &pcc
->parent_realize
);
10867 device_class_set_parent_unrealize(dc
, ppc_cpu_unrealize
,
10868 &pcc
->parent_unrealize
);
10869 pcc
->pvr_match
= ppc_pvr_match_default
;
10870 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_always
;
10871 device_class_set_props(dc
, ppc_cpu_properties
);
10873 device_class_set_parent_reset(dc
, ppc_cpu_reset
, &pcc
->parent_reset
);
10875 cc
->class_by_name
= ppc_cpu_class_by_name
;
10876 pcc
->parent_parse_features
= cc
->parse_features
;
10877 cc
->parse_features
= ppc_cpu_parse_featurestr
;
10878 cc
->has_work
= ppc_cpu_has_work
;
10879 cc
->do_interrupt
= ppc_cpu_do_interrupt
;
10880 cc
->cpu_exec_interrupt
= ppc_cpu_exec_interrupt
;
10881 cc
->dump_state
= ppc_cpu_dump_state
;
10882 cc
->dump_statistics
= ppc_cpu_dump_statistics
;
10883 cc
->set_pc
= ppc_cpu_set_pc
;
10884 cc
->gdb_read_register
= ppc_cpu_gdb_read_register
;
10885 cc
->gdb_write_register
= ppc_cpu_gdb_write_register
;
10886 cc
->do_unaligned_access
= ppc_cpu_do_unaligned_access
;
10887 #ifndef CONFIG_USER_ONLY
10888 cc
->get_phys_page_debug
= ppc_cpu_get_phys_page_debug
;
10889 cc
->vmsd
= &vmstate_ppc_cpu
;
10891 #if defined(CONFIG_SOFTMMU)
10892 cc
->write_elf64_note
= ppc64_cpu_write_elf64_note
;
10893 cc
->write_elf32_note
= ppc32_cpu_write_elf32_note
;
10896 cc
->gdb_num_core_regs
= 71;
10897 #ifndef CONFIG_USER_ONLY
10898 cc
->gdb_get_dynamic_xml
= ppc_gdb_get_dynamic_xml
;
10900 #ifdef USE_APPLE_GDB
10901 cc
->gdb_read_register
= ppc_cpu_gdb_read_register_apple
;
10902 cc
->gdb_write_register
= ppc_cpu_gdb_write_register_apple
;
10903 cc
->gdb_num_core_regs
= 71 + 32;
10906 cc
->gdb_arch_name
= ppc_gdb_arch_name
;
10907 #if defined(TARGET_PPC64)
10908 cc
->gdb_core_xml_file
= "power64-core.xml";
10910 cc
->gdb_core_xml_file
= "power-core.xml";
10912 #ifndef CONFIG_USER_ONLY
10913 cc
->virtio_is_big_endian
= ppc_cpu_is_big_endian
;
10916 cc
->tcg_initialize
= ppc_translate_init
;
10917 cc
->tlb_fill
= ppc_cpu_tlb_fill
;
10919 #ifndef CONFIG_USER_ONLY
10920 cc
->cpu_exec_enter
= ppc_cpu_exec_enter
;
10921 cc
->cpu_exec_exit
= ppc_cpu_exec_exit
;
10924 cc
->disas_set_info
= ppc_disas_set_info
;
10926 dc
->fw_name
= "PowerPC,UNKNOWN";
10929 static const TypeInfo ppc_cpu_type_info
= {
10930 .name
= TYPE_POWERPC_CPU
,
10931 .parent
= TYPE_CPU
,
10932 .instance_size
= sizeof(PowerPCCPU
),
10933 .instance_init
= ppc_cpu_instance_init
,
10934 .instance_finalize
= ppc_cpu_instance_finalize
,
10936 .class_size
= sizeof(PowerPCCPUClass
),
10937 .class_init
= ppc_cpu_class_init
,
10940 #ifndef CONFIG_USER_ONLY
10941 static const TypeInfo ppc_vhyp_type_info
= {
10942 .name
= TYPE_PPC_VIRTUAL_HYPERVISOR
,
10943 .parent
= TYPE_INTERFACE
,
10944 .class_size
= sizeof(PPCVirtualHypervisorClass
),
10948 static void ppc_cpu_register_types(void)
10950 type_register_static(&ppc_cpu_type_info
);
10951 #ifndef CONFIG_USER_ONLY
10952 type_register_static(&ppc_vhyp_type_info
);
10956 type_init(ppc_cpu_register_types
)