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/bfd.h"
22 #include "exec/gdbstub.h"
23 #include <sysemu/kvm.h>
25 #include "sysemu/arch_init.h"
26 #include "sysemu/cpus.h"
27 #include "cpu-models.h"
28 #include "mmu-hash32.h"
29 #include "mmu-hash64.h"
30 #include "qemu/error-report.h"
31 #include "qapi/visitor.h"
32 #include "hw/qdev-properties.h"
34 //#define PPC_DUMP_CPU
35 //#define PPC_DEBUG_SPR
36 //#define PPC_DUMP_SPR_ACCESSES
38 /* For user-mode emulation, we don't emulate any IRQ controller */
39 #if defined(CONFIG_USER_ONLY)
40 #define PPC_IRQ_INIT_FN(name) \
41 static inline void glue(glue(ppc, name),_irq_init) (CPUPPCState *env) \
45 #define PPC_IRQ_INIT_FN(name) \
46 void glue(glue(ppc, name),_irq_init) (CPUPPCState *env);
52 PPC_IRQ_INIT_FN(POWER7
);
53 PPC_IRQ_INIT_FN(e500
);
56 * do nothing but store/retrieve spr value
58 static void spr_load_dump_spr(int sprn
)
60 #ifdef PPC_DUMP_SPR_ACCESSES
61 TCGv_i32 t0
= tcg_const_i32(sprn
);
62 gen_helper_load_dump_spr(cpu_env
, t0
);
63 tcg_temp_free_i32(t0
);
67 static void spr_read_generic (void *opaque
, int gprn
, int sprn
)
69 gen_load_spr(cpu_gpr
[gprn
], sprn
);
70 spr_load_dump_spr(sprn
);
73 static void spr_store_dump_spr(int sprn
)
75 #ifdef PPC_DUMP_SPR_ACCESSES
76 TCGv_i32 t0
= tcg_const_i32(sprn
);
77 gen_helper_store_dump_spr(cpu_env
, t0
);
78 tcg_temp_free_i32(t0
);
82 static void spr_write_generic (void *opaque
, int sprn
, int gprn
)
84 gen_store_spr(sprn
, cpu_gpr
[gprn
]);
85 spr_store_dump_spr(sprn
);
88 #if !defined(CONFIG_USER_ONLY)
89 static void spr_write_generic32(void *opaque
, int sprn
, int gprn
)
92 TCGv t0
= tcg_temp_new();
93 tcg_gen_ext32u_tl(t0
, cpu_gpr
[gprn
]);
94 gen_store_spr(sprn
, t0
);
96 spr_store_dump_spr(sprn
);
98 spr_write_generic(opaque
, sprn
, gprn
);
102 static void spr_write_clear (void *opaque
, int sprn
, int gprn
)
104 TCGv t0
= tcg_temp_new();
105 TCGv t1
= tcg_temp_new();
106 gen_load_spr(t0
, sprn
);
107 tcg_gen_neg_tl(t1
, cpu_gpr
[gprn
]);
108 tcg_gen_and_tl(t0
, t0
, t1
);
109 gen_store_spr(sprn
, t0
);
114 static void spr_access_nop(void *opaque
, int sprn
, int gprn
)
120 /* SPR common to all PowerPC */
122 static void spr_read_xer (void *opaque
, int gprn
, int sprn
)
124 gen_read_xer(cpu_gpr
[gprn
]);
127 static void spr_write_xer (void *opaque
, int sprn
, int gprn
)
129 gen_write_xer(cpu_gpr
[gprn
]);
133 static void spr_read_lr (void *opaque
, int gprn
, int sprn
)
135 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_lr
);
138 static void spr_write_lr (void *opaque
, int sprn
, int gprn
)
140 tcg_gen_mov_tl(cpu_lr
, cpu_gpr
[gprn
]);
144 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
145 static void spr_read_cfar (void *opaque
, int gprn
, int sprn
)
147 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_cfar
);
150 static void spr_write_cfar (void *opaque
, int sprn
, int gprn
)
152 tcg_gen_mov_tl(cpu_cfar
, cpu_gpr
[gprn
]);
154 #endif /* defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) */
157 static void spr_read_ctr (void *opaque
, int gprn
, int sprn
)
159 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_ctr
);
162 static void spr_write_ctr (void *opaque
, int sprn
, int gprn
)
164 tcg_gen_mov_tl(cpu_ctr
, cpu_gpr
[gprn
]);
167 /* User read access to SPR */
173 static void spr_read_ureg (void *opaque
, int gprn
, int sprn
)
175 gen_load_spr(cpu_gpr
[gprn
], sprn
+ 0x10);
178 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
179 static void spr_write_ureg(void *opaque
, int sprn
, int gprn
)
181 gen_store_spr(sprn
+ 0x10, cpu_gpr
[gprn
]);
185 /* SPR common to all non-embedded PowerPC */
187 #if !defined(CONFIG_USER_ONLY)
188 static void spr_read_decr (void *opaque
, int gprn
, int sprn
)
193 gen_helper_load_decr(cpu_gpr
[gprn
], cpu_env
);
196 gen_stop_exception(opaque
);
200 static void spr_write_decr (void *opaque
, int sprn
, int gprn
)
205 gen_helper_store_decr(cpu_env
, cpu_gpr
[gprn
]);
208 gen_stop_exception(opaque
);
213 /* SPR common to all non-embedded PowerPC, except 601 */
215 static void spr_read_tbl (void *opaque
, int gprn
, int sprn
)
220 gen_helper_load_tbl(cpu_gpr
[gprn
], cpu_env
);
223 gen_stop_exception(opaque
);
227 static void spr_read_tbu (void *opaque
, int gprn
, int sprn
)
232 gen_helper_load_tbu(cpu_gpr
[gprn
], cpu_env
);
235 gen_stop_exception(opaque
);
239 __attribute__ (( unused
))
240 static void spr_read_atbl (void *opaque
, int gprn
, int sprn
)
242 gen_helper_load_atbl(cpu_gpr
[gprn
], cpu_env
);
245 __attribute__ (( unused
))
246 static void spr_read_atbu (void *opaque
, int gprn
, int sprn
)
248 gen_helper_load_atbu(cpu_gpr
[gprn
], cpu_env
);
251 #if !defined(CONFIG_USER_ONLY)
252 static void spr_write_tbl (void *opaque
, int sprn
, int gprn
)
257 gen_helper_store_tbl(cpu_env
, cpu_gpr
[gprn
]);
260 gen_stop_exception(opaque
);
264 static void spr_write_tbu (void *opaque
, int sprn
, int gprn
)
269 gen_helper_store_tbu(cpu_env
, cpu_gpr
[gprn
]);
272 gen_stop_exception(opaque
);
276 __attribute__ (( unused
))
277 static void spr_write_atbl (void *opaque
, int sprn
, int gprn
)
279 gen_helper_store_atbl(cpu_env
, cpu_gpr
[gprn
]);
282 __attribute__ (( unused
))
283 static void spr_write_atbu (void *opaque
, int sprn
, int gprn
)
285 gen_helper_store_atbu(cpu_env
, cpu_gpr
[gprn
]);
288 #if defined(TARGET_PPC64)
289 __attribute__ (( unused
))
290 static void spr_read_purr (void *opaque
, int gprn
, int sprn
)
292 gen_helper_load_purr(cpu_gpr
[gprn
], cpu_env
);
297 #if !defined(CONFIG_USER_ONLY)
298 /* IBAT0U...IBAT0U */
299 /* IBAT0L...IBAT7L */
300 static void spr_read_ibat (void *opaque
, int gprn
, int sprn
)
302 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
305 static void spr_read_ibat_h (void *opaque
, int gprn
, int sprn
)
307 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][(sprn
- SPR_IBAT4U
) / 2]));
310 static void spr_write_ibatu (void *opaque
, int sprn
, int gprn
)
312 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
313 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
314 tcg_temp_free_i32(t0
);
317 static void spr_write_ibatu_h (void *opaque
, int sprn
, int gprn
)
319 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4U
) / 2) + 4);
320 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
321 tcg_temp_free_i32(t0
);
324 static void spr_write_ibatl (void *opaque
, int sprn
, int gprn
)
326 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0L
) / 2);
327 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
328 tcg_temp_free_i32(t0
);
331 static void spr_write_ibatl_h (void *opaque
, int sprn
, int gprn
)
333 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4L
) / 2) + 4);
334 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
335 tcg_temp_free_i32(t0
);
338 /* DBAT0U...DBAT7U */
339 /* DBAT0L...DBAT7L */
340 static void spr_read_dbat (void *opaque
, int gprn
, int sprn
)
342 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, DBAT
[sprn
& 1][(sprn
- SPR_DBAT0U
) / 2]));
345 static void spr_read_dbat_h (void *opaque
, int gprn
, int sprn
)
347 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, DBAT
[sprn
& 1][((sprn
- SPR_DBAT4U
) / 2) + 4]));
350 static void spr_write_dbatu (void *opaque
, int sprn
, int gprn
)
352 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0U
) / 2);
353 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
354 tcg_temp_free_i32(t0
);
357 static void spr_write_dbatu_h (void *opaque
, int sprn
, int gprn
)
359 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4U
) / 2) + 4);
360 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
361 tcg_temp_free_i32(t0
);
364 static void spr_write_dbatl (void *opaque
, int sprn
, int gprn
)
366 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0L
) / 2);
367 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
368 tcg_temp_free_i32(t0
);
371 static void spr_write_dbatl_h (void *opaque
, int sprn
, int gprn
)
373 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4L
) / 2) + 4);
374 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
375 tcg_temp_free_i32(t0
);
379 static void spr_write_sdr1 (void *opaque
, int sprn
, int gprn
)
381 gen_helper_store_sdr1(cpu_env
, cpu_gpr
[gprn
]);
384 /* 64 bits PowerPC specific SPRs */
385 #if defined(TARGET_PPC64)
386 static void spr_read_hior (void *opaque
, int gprn
, int sprn
)
388 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
391 static void spr_write_hior (void *opaque
, int sprn
, int gprn
)
393 TCGv t0
= tcg_temp_new();
394 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0x3FFFFF00000ULL
);
395 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
401 /* PowerPC 601 specific registers */
403 static void spr_read_601_rtcl (void *opaque
, int gprn
, int sprn
)
405 gen_helper_load_601_rtcl(cpu_gpr
[gprn
], cpu_env
);
408 static void spr_read_601_rtcu (void *opaque
, int gprn
, int sprn
)
410 gen_helper_load_601_rtcu(cpu_gpr
[gprn
], cpu_env
);
413 #if !defined(CONFIG_USER_ONLY)
414 static void spr_write_601_rtcu (void *opaque
, int sprn
, int gprn
)
416 gen_helper_store_601_rtcu(cpu_env
, cpu_gpr
[gprn
]);
419 static void spr_write_601_rtcl (void *opaque
, int sprn
, int gprn
)
421 gen_helper_store_601_rtcl(cpu_env
, cpu_gpr
[gprn
]);
424 static void spr_write_hid0_601 (void *opaque
, int sprn
, int gprn
)
426 DisasContext
*ctx
= opaque
;
428 gen_helper_store_hid0_601(cpu_env
, cpu_gpr
[gprn
]);
429 /* Must stop the translation as endianness may have changed */
430 gen_stop_exception(ctx
);
435 #if !defined(CONFIG_USER_ONLY)
436 static void spr_read_601_ubat (void *opaque
, int gprn
, int sprn
)
438 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
441 static void spr_write_601_ubatu (void *opaque
, int sprn
, int gprn
)
443 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
444 gen_helper_store_601_batl(cpu_env
, t0
, cpu_gpr
[gprn
]);
445 tcg_temp_free_i32(t0
);
448 static void spr_write_601_ubatl (void *opaque
, int sprn
, int gprn
)
450 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
451 gen_helper_store_601_batu(cpu_env
, t0
, cpu_gpr
[gprn
]);
452 tcg_temp_free_i32(t0
);
456 /* PowerPC 40x specific registers */
457 #if !defined(CONFIG_USER_ONLY)
458 static void spr_read_40x_pit (void *opaque
, int gprn
, int sprn
)
460 gen_helper_load_40x_pit(cpu_gpr
[gprn
], cpu_env
);
463 static void spr_write_40x_pit (void *opaque
, int sprn
, int gprn
)
465 gen_helper_store_40x_pit(cpu_env
, cpu_gpr
[gprn
]);
468 static void spr_write_40x_dbcr0 (void *opaque
, int sprn
, int gprn
)
470 DisasContext
*ctx
= opaque
;
472 gen_helper_store_40x_dbcr0(cpu_env
, cpu_gpr
[gprn
]);
473 /* We must stop translation as we may have rebooted */
474 gen_stop_exception(ctx
);
477 static void spr_write_40x_sler (void *opaque
, int sprn
, int gprn
)
479 gen_helper_store_40x_sler(cpu_env
, cpu_gpr
[gprn
]);
482 static void spr_write_booke_tcr (void *opaque
, int sprn
, int gprn
)
484 gen_helper_store_booke_tcr(cpu_env
, cpu_gpr
[gprn
]);
487 static void spr_write_booke_tsr (void *opaque
, int sprn
, int gprn
)
489 gen_helper_store_booke_tsr(cpu_env
, cpu_gpr
[gprn
]);
493 /* PowerPC 403 specific registers */
494 /* PBL1 / PBU1 / PBL2 / PBU2 */
495 #if !defined(CONFIG_USER_ONLY)
496 static void spr_read_403_pbr (void *opaque
, int gprn
, int sprn
)
498 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, pb
[sprn
- SPR_403_PBL1
]));
501 static void spr_write_403_pbr (void *opaque
, int sprn
, int gprn
)
503 TCGv_i32 t0
= tcg_const_i32(sprn
- SPR_403_PBL1
);
504 gen_helper_store_403_pbr(cpu_env
, t0
, cpu_gpr
[gprn
]);
505 tcg_temp_free_i32(t0
);
508 static void spr_write_pir (void *opaque
, int sprn
, int gprn
)
510 TCGv t0
= tcg_temp_new();
511 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0xF);
512 gen_store_spr(SPR_PIR
, t0
);
517 /* SPE specific registers */
518 static void spr_read_spefscr (void *opaque
, int gprn
, int sprn
)
520 TCGv_i32 t0
= tcg_temp_new_i32();
521 tcg_gen_ld_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
522 tcg_gen_extu_i32_tl(cpu_gpr
[gprn
], t0
);
523 tcg_temp_free_i32(t0
);
526 static void spr_write_spefscr (void *opaque
, int sprn
, int gprn
)
528 TCGv_i32 t0
= tcg_temp_new_i32();
529 tcg_gen_trunc_tl_i32(t0
, cpu_gpr
[gprn
]);
530 tcg_gen_st_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
531 tcg_temp_free_i32(t0
);
534 #if !defined(CONFIG_USER_ONLY)
535 /* Callback used to write the exception vector base */
536 static void spr_write_excp_prefix (void *opaque
, int sprn
, int gprn
)
538 TCGv t0
= tcg_temp_new();
539 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivpr_mask
));
540 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
541 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
542 gen_store_spr(sprn
, t0
);
546 static void spr_write_excp_vector (void *opaque
, int sprn
, int gprn
)
548 DisasContext
*ctx
= opaque
;
551 if (sprn
>= SPR_BOOKE_IVOR0
&& sprn
<= SPR_BOOKE_IVOR15
) {
552 sprn_offs
= sprn
- SPR_BOOKE_IVOR0
;
553 } else if (sprn
>= SPR_BOOKE_IVOR32
&& sprn
<= SPR_BOOKE_IVOR37
) {
554 sprn_offs
= sprn
- SPR_BOOKE_IVOR32
+ 32;
555 } else if (sprn
>= SPR_BOOKE_IVOR38
&& sprn
<= SPR_BOOKE_IVOR42
) {
556 sprn_offs
= sprn
- SPR_BOOKE_IVOR38
+ 38;
558 printf("Trying to write an unknown exception vector %d %03x\n",
560 gen_inval_exception(ctx
, POWERPC_EXCP_PRIV_REG
);
564 TCGv t0
= tcg_temp_new();
565 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivor_mask
));
566 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
567 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_vectors
[sprn_offs
]));
568 gen_store_spr(sprn
, t0
);
573 static inline void vscr_init (CPUPPCState
*env
, uint32_t val
)
576 /* Altivec always uses round-to-nearest */
577 set_float_rounding_mode(float_round_nearest_even
, &env
->vec_status
);
578 set_flush_to_zero(vscr_nj
, &env
->vec_status
);
581 #ifdef CONFIG_USER_ONLY
582 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
583 oea_read, oea_write, one_reg_id, initial_value) \
584 _spr_register(env, num, name, uea_read, uea_write, initial_value)
586 #if !defined(CONFIG_KVM)
587 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
588 oea_read, oea_write, one_reg_id, initial_value) \
589 _spr_register(env, num, name, uea_read, uea_write, \
590 oea_read, oea_write, initial_value)
592 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
593 oea_read, oea_write, one_reg_id, initial_value) \
594 _spr_register(env, num, name, uea_read, uea_write, \
595 oea_read, oea_write, one_reg_id, initial_value)
599 #define spr_register(env, num, name, uea_read, uea_write, \
600 oea_read, oea_write, initial_value) \
601 spr_register_kvm(env, num, name, uea_read, uea_write, \
602 oea_read, oea_write, 0, initial_value)
604 static inline void _spr_register(CPUPPCState
*env
, int num
,
606 void (*uea_read
)(void *opaque
, int gprn
, int sprn
),
607 void (*uea_write
)(void *opaque
, int sprn
, int gprn
),
608 #if !defined(CONFIG_USER_ONLY)
610 void (*oea_read
)(void *opaque
, int gprn
, int sprn
),
611 void (*oea_write
)(void *opaque
, int sprn
, int gprn
),
613 #if defined(CONFIG_KVM)
616 target_ulong initial_value
)
620 spr
= &env
->spr_cb
[num
];
621 if (spr
->name
!= NULL
||env
-> spr
[num
] != 0x00000000 ||
622 #if !defined(CONFIG_USER_ONLY)
623 spr
->oea_read
!= NULL
|| spr
->oea_write
!= NULL
||
625 spr
->uea_read
!= NULL
|| spr
->uea_write
!= NULL
) {
626 printf("Error: Trying to register SPR %d (%03x) twice !\n", num
, num
);
629 #if defined(PPC_DEBUG_SPR)
630 printf("*** register spr %d (%03x) %s val " TARGET_FMT_lx
"\n", num
, num
,
631 name
, initial_value
);
634 spr
->uea_read
= uea_read
;
635 spr
->uea_write
= uea_write
;
636 #if !defined(CONFIG_USER_ONLY)
637 spr
->oea_read
= oea_read
;
638 spr
->oea_write
= oea_write
;
640 #if defined(CONFIG_KVM)
641 spr
->one_reg_id
= one_reg_id
,
643 env
->spr
[num
] = spr
->default_value
= initial_value
;
646 /* Generic PowerPC SPRs */
647 static void gen_spr_generic (CPUPPCState
*env
)
649 /* Integer processing */
650 spr_register(env
, SPR_XER
, "XER",
651 &spr_read_xer
, &spr_write_xer
,
652 &spr_read_xer
, &spr_write_xer
,
655 spr_register(env
, SPR_LR
, "LR",
656 &spr_read_lr
, &spr_write_lr
,
657 &spr_read_lr
, &spr_write_lr
,
659 spr_register(env
, SPR_CTR
, "CTR",
660 &spr_read_ctr
, &spr_write_ctr
,
661 &spr_read_ctr
, &spr_write_ctr
,
663 /* Interrupt processing */
664 spr_register(env
, SPR_SRR0
, "SRR0",
665 SPR_NOACCESS
, SPR_NOACCESS
,
666 &spr_read_generic
, &spr_write_generic
,
668 spr_register(env
, SPR_SRR1
, "SRR1",
669 SPR_NOACCESS
, SPR_NOACCESS
,
670 &spr_read_generic
, &spr_write_generic
,
672 /* Processor control */
673 spr_register(env
, SPR_SPRG0
, "SPRG0",
674 SPR_NOACCESS
, SPR_NOACCESS
,
675 &spr_read_generic
, &spr_write_generic
,
677 spr_register(env
, SPR_SPRG1
, "SPRG1",
678 SPR_NOACCESS
, SPR_NOACCESS
,
679 &spr_read_generic
, &spr_write_generic
,
681 spr_register(env
, SPR_SPRG2
, "SPRG2",
682 SPR_NOACCESS
, SPR_NOACCESS
,
683 &spr_read_generic
, &spr_write_generic
,
685 spr_register(env
, SPR_SPRG3
, "SPRG3",
686 SPR_NOACCESS
, SPR_NOACCESS
,
687 &spr_read_generic
, &spr_write_generic
,
691 /* SPR common to all non-embedded PowerPC, including 601 */
692 static void gen_spr_ne_601 (CPUPPCState
*env
)
694 /* Exception processing */
695 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
696 SPR_NOACCESS
, SPR_NOACCESS
,
697 &spr_read_generic
, &spr_write_generic
,
698 KVM_REG_PPC_DSISR
, 0x00000000);
699 spr_register_kvm(env
, SPR_DAR
, "DAR",
700 SPR_NOACCESS
, SPR_NOACCESS
,
701 &spr_read_generic
, &spr_write_generic
,
702 KVM_REG_PPC_DAR
, 0x00000000);
704 spr_register(env
, SPR_DECR
, "DECR",
705 SPR_NOACCESS
, SPR_NOACCESS
,
706 &spr_read_decr
, &spr_write_decr
,
708 /* Memory management */
709 spr_register(env
, SPR_SDR1
, "SDR1",
710 SPR_NOACCESS
, SPR_NOACCESS
,
711 &spr_read_generic
, &spr_write_sdr1
,
716 static void gen_low_BATs (CPUPPCState
*env
)
718 #if !defined(CONFIG_USER_ONLY)
719 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
720 SPR_NOACCESS
, SPR_NOACCESS
,
721 &spr_read_ibat
, &spr_write_ibatu
,
723 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
724 SPR_NOACCESS
, SPR_NOACCESS
,
725 &spr_read_ibat
, &spr_write_ibatl
,
727 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
728 SPR_NOACCESS
, SPR_NOACCESS
,
729 &spr_read_ibat
, &spr_write_ibatu
,
731 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
732 SPR_NOACCESS
, SPR_NOACCESS
,
733 &spr_read_ibat
, &spr_write_ibatl
,
735 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
736 SPR_NOACCESS
, SPR_NOACCESS
,
737 &spr_read_ibat
, &spr_write_ibatu
,
739 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
740 SPR_NOACCESS
, SPR_NOACCESS
,
741 &spr_read_ibat
, &spr_write_ibatl
,
743 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
744 SPR_NOACCESS
, SPR_NOACCESS
,
745 &spr_read_ibat
, &spr_write_ibatu
,
747 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
748 SPR_NOACCESS
, SPR_NOACCESS
,
749 &spr_read_ibat
, &spr_write_ibatl
,
751 spr_register(env
, SPR_DBAT0U
, "DBAT0U",
752 SPR_NOACCESS
, SPR_NOACCESS
,
753 &spr_read_dbat
, &spr_write_dbatu
,
755 spr_register(env
, SPR_DBAT0L
, "DBAT0L",
756 SPR_NOACCESS
, SPR_NOACCESS
,
757 &spr_read_dbat
, &spr_write_dbatl
,
759 spr_register(env
, SPR_DBAT1U
, "DBAT1U",
760 SPR_NOACCESS
, SPR_NOACCESS
,
761 &spr_read_dbat
, &spr_write_dbatu
,
763 spr_register(env
, SPR_DBAT1L
, "DBAT1L",
764 SPR_NOACCESS
, SPR_NOACCESS
,
765 &spr_read_dbat
, &spr_write_dbatl
,
767 spr_register(env
, SPR_DBAT2U
, "DBAT2U",
768 SPR_NOACCESS
, SPR_NOACCESS
,
769 &spr_read_dbat
, &spr_write_dbatu
,
771 spr_register(env
, SPR_DBAT2L
, "DBAT2L",
772 SPR_NOACCESS
, SPR_NOACCESS
,
773 &spr_read_dbat
, &spr_write_dbatl
,
775 spr_register(env
, SPR_DBAT3U
, "DBAT3U",
776 SPR_NOACCESS
, SPR_NOACCESS
,
777 &spr_read_dbat
, &spr_write_dbatu
,
779 spr_register(env
, SPR_DBAT3L
, "DBAT3L",
780 SPR_NOACCESS
, SPR_NOACCESS
,
781 &spr_read_dbat
, &spr_write_dbatl
,
788 static void gen_high_BATs (CPUPPCState
*env
)
790 #if !defined(CONFIG_USER_ONLY)
791 spr_register(env
, SPR_IBAT4U
, "IBAT4U",
792 SPR_NOACCESS
, SPR_NOACCESS
,
793 &spr_read_ibat_h
, &spr_write_ibatu_h
,
795 spr_register(env
, SPR_IBAT4L
, "IBAT4L",
796 SPR_NOACCESS
, SPR_NOACCESS
,
797 &spr_read_ibat_h
, &spr_write_ibatl_h
,
799 spr_register(env
, SPR_IBAT5U
, "IBAT5U",
800 SPR_NOACCESS
, SPR_NOACCESS
,
801 &spr_read_ibat_h
, &spr_write_ibatu_h
,
803 spr_register(env
, SPR_IBAT5L
, "IBAT5L",
804 SPR_NOACCESS
, SPR_NOACCESS
,
805 &spr_read_ibat_h
, &spr_write_ibatl_h
,
807 spr_register(env
, SPR_IBAT6U
, "IBAT6U",
808 SPR_NOACCESS
, SPR_NOACCESS
,
809 &spr_read_ibat_h
, &spr_write_ibatu_h
,
811 spr_register(env
, SPR_IBAT6L
, "IBAT6L",
812 SPR_NOACCESS
, SPR_NOACCESS
,
813 &spr_read_ibat_h
, &spr_write_ibatl_h
,
815 spr_register(env
, SPR_IBAT7U
, "IBAT7U",
816 SPR_NOACCESS
, SPR_NOACCESS
,
817 &spr_read_ibat_h
, &spr_write_ibatu_h
,
819 spr_register(env
, SPR_IBAT7L
, "IBAT7L",
820 SPR_NOACCESS
, SPR_NOACCESS
,
821 &spr_read_ibat_h
, &spr_write_ibatl_h
,
823 spr_register(env
, SPR_DBAT4U
, "DBAT4U",
824 SPR_NOACCESS
, SPR_NOACCESS
,
825 &spr_read_dbat_h
, &spr_write_dbatu_h
,
827 spr_register(env
, SPR_DBAT4L
, "DBAT4L",
828 SPR_NOACCESS
, SPR_NOACCESS
,
829 &spr_read_dbat_h
, &spr_write_dbatl_h
,
831 spr_register(env
, SPR_DBAT5U
, "DBAT5U",
832 SPR_NOACCESS
, SPR_NOACCESS
,
833 &spr_read_dbat_h
, &spr_write_dbatu_h
,
835 spr_register(env
, SPR_DBAT5L
, "DBAT5L",
836 SPR_NOACCESS
, SPR_NOACCESS
,
837 &spr_read_dbat_h
, &spr_write_dbatl_h
,
839 spr_register(env
, SPR_DBAT6U
, "DBAT6U",
840 SPR_NOACCESS
, SPR_NOACCESS
,
841 &spr_read_dbat_h
, &spr_write_dbatu_h
,
843 spr_register(env
, SPR_DBAT6L
, "DBAT6L",
844 SPR_NOACCESS
, SPR_NOACCESS
,
845 &spr_read_dbat_h
, &spr_write_dbatl_h
,
847 spr_register(env
, SPR_DBAT7U
, "DBAT7U",
848 SPR_NOACCESS
, SPR_NOACCESS
,
849 &spr_read_dbat_h
, &spr_write_dbatu_h
,
851 spr_register(env
, SPR_DBAT7L
, "DBAT7L",
852 SPR_NOACCESS
, SPR_NOACCESS
,
853 &spr_read_dbat_h
, &spr_write_dbatl_h
,
859 /* Generic PowerPC time base */
860 static void gen_tbl (CPUPPCState
*env
)
862 spr_register(env
, SPR_VTBL
, "TBL",
863 &spr_read_tbl
, SPR_NOACCESS
,
864 &spr_read_tbl
, SPR_NOACCESS
,
866 spr_register(env
, SPR_TBL
, "TBL",
867 &spr_read_tbl
, SPR_NOACCESS
,
868 &spr_read_tbl
, &spr_write_tbl
,
870 spr_register(env
, SPR_VTBU
, "TBU",
871 &spr_read_tbu
, SPR_NOACCESS
,
872 &spr_read_tbu
, SPR_NOACCESS
,
874 spr_register(env
, SPR_TBU
, "TBU",
875 &spr_read_tbu
, SPR_NOACCESS
,
876 &spr_read_tbu
, &spr_write_tbu
,
880 /* Softare table search registers */
881 static void gen_6xx_7xx_soft_tlb (CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
883 #if !defined(CONFIG_USER_ONLY)
884 env
->nb_tlb
= nb_tlbs
;
885 env
->nb_ways
= nb_ways
;
887 env
->tlb_type
= TLB_6XX
;
888 spr_register(env
, SPR_DMISS
, "DMISS",
889 SPR_NOACCESS
, SPR_NOACCESS
,
890 &spr_read_generic
, SPR_NOACCESS
,
892 spr_register(env
, SPR_DCMP
, "DCMP",
893 SPR_NOACCESS
, SPR_NOACCESS
,
894 &spr_read_generic
, SPR_NOACCESS
,
896 spr_register(env
, SPR_HASH1
, "HASH1",
897 SPR_NOACCESS
, SPR_NOACCESS
,
898 &spr_read_generic
, SPR_NOACCESS
,
900 spr_register(env
, SPR_HASH2
, "HASH2",
901 SPR_NOACCESS
, SPR_NOACCESS
,
902 &spr_read_generic
, SPR_NOACCESS
,
904 spr_register(env
, SPR_IMISS
, "IMISS",
905 SPR_NOACCESS
, SPR_NOACCESS
,
906 &spr_read_generic
, SPR_NOACCESS
,
908 spr_register(env
, SPR_ICMP
, "ICMP",
909 SPR_NOACCESS
, SPR_NOACCESS
,
910 &spr_read_generic
, SPR_NOACCESS
,
912 spr_register(env
, SPR_RPA
, "RPA",
913 SPR_NOACCESS
, SPR_NOACCESS
,
914 &spr_read_generic
, &spr_write_generic
,
919 /* SPR common to MPC755 and G2 */
920 static void gen_spr_G2_755 (CPUPPCState
*env
)
923 spr_register(env
, SPR_SPRG4
, "SPRG4",
924 SPR_NOACCESS
, SPR_NOACCESS
,
925 &spr_read_generic
, &spr_write_generic
,
927 spr_register(env
, SPR_SPRG5
, "SPRG5",
928 SPR_NOACCESS
, SPR_NOACCESS
,
929 &spr_read_generic
, &spr_write_generic
,
931 spr_register(env
, SPR_SPRG6
, "SPRG6",
932 SPR_NOACCESS
, SPR_NOACCESS
,
933 &spr_read_generic
, &spr_write_generic
,
935 spr_register(env
, SPR_SPRG7
, "SPRG7",
936 SPR_NOACCESS
, SPR_NOACCESS
,
937 &spr_read_generic
, &spr_write_generic
,
941 /* SPR common to all 7xx PowerPC implementations */
942 static void gen_spr_7xx (CPUPPCState
*env
)
945 /* XXX : not implemented */
946 spr_register_kvm(env
, SPR_DABR
, "DABR",
947 SPR_NOACCESS
, SPR_NOACCESS
,
948 &spr_read_generic
, &spr_write_generic
,
949 KVM_REG_PPC_DABR
, 0x00000000);
950 /* XXX : not implemented */
951 spr_register(env
, SPR_IABR
, "IABR",
952 SPR_NOACCESS
, SPR_NOACCESS
,
953 &spr_read_generic
, &spr_write_generic
,
955 /* Cache management */
956 /* XXX : not implemented */
957 spr_register(env
, SPR_ICTC
, "ICTC",
958 SPR_NOACCESS
, SPR_NOACCESS
,
959 &spr_read_generic
, &spr_write_generic
,
961 /* Performance monitors */
962 /* XXX : not implemented */
963 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
964 SPR_NOACCESS
, SPR_NOACCESS
,
965 &spr_read_generic
, &spr_write_generic
,
967 /* XXX : not implemented */
968 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
969 SPR_NOACCESS
, SPR_NOACCESS
,
970 &spr_read_generic
, &spr_write_generic
,
972 /* XXX : not implemented */
973 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
974 SPR_NOACCESS
, SPR_NOACCESS
,
975 &spr_read_generic
, &spr_write_generic
,
977 /* XXX : not implemented */
978 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
979 SPR_NOACCESS
, SPR_NOACCESS
,
980 &spr_read_generic
, &spr_write_generic
,
982 /* XXX : not implemented */
983 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
984 SPR_NOACCESS
, SPR_NOACCESS
,
985 &spr_read_generic
, &spr_write_generic
,
987 /* XXX : not implemented */
988 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
989 SPR_NOACCESS
, SPR_NOACCESS
,
990 &spr_read_generic
, &spr_write_generic
,
992 /* XXX : not implemented */
993 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
994 SPR_NOACCESS
, SPR_NOACCESS
,
995 &spr_read_generic
, SPR_NOACCESS
,
997 /* XXX : not implemented */
998 spr_register(env
, SPR_7XX_UMMCR0
, "UMMCR0",
999 &spr_read_ureg
, SPR_NOACCESS
,
1000 &spr_read_ureg
, SPR_NOACCESS
,
1002 /* XXX : not implemented */
1003 spr_register(env
, SPR_7XX_UMMCR1
, "UMMCR1",
1004 &spr_read_ureg
, SPR_NOACCESS
,
1005 &spr_read_ureg
, SPR_NOACCESS
,
1007 /* XXX : not implemented */
1008 spr_register(env
, SPR_7XX_UPMC1
, "UPMC1",
1009 &spr_read_ureg
, SPR_NOACCESS
,
1010 &spr_read_ureg
, SPR_NOACCESS
,
1012 /* XXX : not implemented */
1013 spr_register(env
, SPR_7XX_UPMC2
, "UPMC2",
1014 &spr_read_ureg
, SPR_NOACCESS
,
1015 &spr_read_ureg
, SPR_NOACCESS
,
1017 /* XXX : not implemented */
1018 spr_register(env
, SPR_7XX_UPMC3
, "UPMC3",
1019 &spr_read_ureg
, SPR_NOACCESS
,
1020 &spr_read_ureg
, SPR_NOACCESS
,
1022 /* XXX : not implemented */
1023 spr_register(env
, SPR_7XX_UPMC4
, "UPMC4",
1024 &spr_read_ureg
, SPR_NOACCESS
,
1025 &spr_read_ureg
, SPR_NOACCESS
,
1027 /* XXX : not implemented */
1028 spr_register(env
, SPR_7XX_USIAR
, "USIAR",
1029 &spr_read_ureg
, SPR_NOACCESS
,
1030 &spr_read_ureg
, SPR_NOACCESS
,
1032 /* External access control */
1033 /* XXX : not implemented */
1034 spr_register(env
, SPR_EAR
, "EAR",
1035 SPR_NOACCESS
, SPR_NOACCESS
,
1036 &spr_read_generic
, &spr_write_generic
,
1041 #ifndef CONFIG_USER_ONLY
1042 static void spr_read_uamr (void *opaque
, int gprn
, int sprn
)
1044 gen_load_spr(cpu_gpr
[gprn
], SPR_AMR
);
1045 spr_load_dump_spr(SPR_AMR
);
1048 static void spr_write_uamr (void *opaque
, int sprn
, int gprn
)
1050 gen_store_spr(SPR_AMR
, cpu_gpr
[gprn
]);
1051 spr_store_dump_spr(SPR_AMR
);
1054 static void spr_write_uamr_pr (void *opaque
, int sprn
, int gprn
)
1056 TCGv t0
= tcg_temp_new();
1058 gen_load_spr(t0
, SPR_UAMOR
);
1059 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
1060 gen_store_spr(SPR_AMR
, t0
);
1061 spr_store_dump_spr(SPR_AMR
);
1063 #endif /* CONFIG_USER_ONLY */
1065 static void gen_spr_amr (CPUPPCState
*env
)
1067 #ifndef CONFIG_USER_ONLY
1068 /* Virtual Page Class Key protection */
1069 /* The AMR is accessible either via SPR 13 or SPR 29. 13 is
1070 * userspace accessible, 29 is privileged. So we only need to set
1071 * the kvm ONE_REG id on one of them, we use 29 */
1072 spr_register(env
, SPR_UAMR
, "UAMR",
1073 &spr_read_uamr
, &spr_write_uamr_pr
,
1074 &spr_read_uamr
, &spr_write_uamr
,
1076 spr_register_kvm(env
, SPR_AMR
, "AMR",
1077 SPR_NOACCESS
, SPR_NOACCESS
,
1078 &spr_read_generic
, &spr_write_generic
,
1079 KVM_REG_PPC_AMR
, 0);
1080 spr_register_kvm(env
, SPR_UAMOR
, "UAMOR",
1081 SPR_NOACCESS
, SPR_NOACCESS
,
1082 &spr_read_generic
, &spr_write_generic
,
1083 KVM_REG_PPC_UAMOR
, 0);
1084 #endif /* !CONFIG_USER_ONLY */
1086 #endif /* TARGET_PPC64 */
1088 static void gen_spr_thrm (CPUPPCState
*env
)
1090 /* Thermal management */
1091 /* XXX : not implemented */
1092 spr_register(env
, SPR_THRM1
, "THRM1",
1093 SPR_NOACCESS
, SPR_NOACCESS
,
1094 &spr_read_generic
, &spr_write_generic
,
1096 /* XXX : not implemented */
1097 spr_register(env
, SPR_THRM2
, "THRM2",
1098 SPR_NOACCESS
, SPR_NOACCESS
,
1099 &spr_read_generic
, &spr_write_generic
,
1101 /* XXX : not implemented */
1102 spr_register(env
, SPR_THRM3
, "THRM3",
1103 SPR_NOACCESS
, SPR_NOACCESS
,
1104 &spr_read_generic
, &spr_write_generic
,
1108 /* SPR specific to PowerPC 604 implementation */
1109 static void gen_spr_604 (CPUPPCState
*env
)
1111 /* Processor identification */
1112 spr_register(env
, SPR_PIR
, "PIR",
1113 SPR_NOACCESS
, SPR_NOACCESS
,
1114 &spr_read_generic
, &spr_write_pir
,
1117 /* XXX : not implemented */
1118 spr_register(env
, SPR_IABR
, "IABR",
1119 SPR_NOACCESS
, SPR_NOACCESS
,
1120 &spr_read_generic
, &spr_write_generic
,
1122 /* XXX : not implemented */
1123 spr_register_kvm(env
, SPR_DABR
, "DABR",
1124 SPR_NOACCESS
, SPR_NOACCESS
,
1125 &spr_read_generic
, &spr_write_generic
,
1126 KVM_REG_PPC_DABR
, 0x00000000);
1127 /* Performance counters */
1128 /* XXX : not implemented */
1129 spr_register(env
, SPR_7XX_MMCR0
, "MMCR0",
1130 SPR_NOACCESS
, SPR_NOACCESS
,
1131 &spr_read_generic
, &spr_write_generic
,
1133 /* XXX : not implemented */
1134 spr_register(env
, SPR_7XX_PMC1
, "PMC1",
1135 SPR_NOACCESS
, SPR_NOACCESS
,
1136 &spr_read_generic
, &spr_write_generic
,
1138 /* XXX : not implemented */
1139 spr_register(env
, SPR_7XX_PMC2
, "PMC2",
1140 SPR_NOACCESS
, SPR_NOACCESS
,
1141 &spr_read_generic
, &spr_write_generic
,
1143 /* XXX : not implemented */
1144 spr_register(env
, SPR_7XX_SIAR
, "SIAR",
1145 SPR_NOACCESS
, SPR_NOACCESS
,
1146 &spr_read_generic
, SPR_NOACCESS
,
1148 /* XXX : not implemented */
1149 spr_register(env
, SPR_SDA
, "SDA",
1150 SPR_NOACCESS
, SPR_NOACCESS
,
1151 &spr_read_generic
, SPR_NOACCESS
,
1153 /* External access control */
1154 /* XXX : not implemented */
1155 spr_register(env
, SPR_EAR
, "EAR",
1156 SPR_NOACCESS
, SPR_NOACCESS
,
1157 &spr_read_generic
, &spr_write_generic
,
1161 /* SPR specific to PowerPC 603 implementation */
1162 static void gen_spr_603 (CPUPPCState
*env
)
1164 /* External access control */
1165 /* XXX : not implemented */
1166 spr_register(env
, SPR_EAR
, "EAR",
1167 SPR_NOACCESS
, SPR_NOACCESS
,
1168 &spr_read_generic
, &spr_write_generic
,
1171 /* XXX : not implemented */
1172 spr_register(env
, SPR_IABR
, "IABR",
1173 SPR_NOACCESS
, SPR_NOACCESS
,
1174 &spr_read_generic
, &spr_write_generic
,
1179 /* SPR specific to PowerPC G2 implementation */
1180 static void gen_spr_G2 (CPUPPCState
*env
)
1182 /* Memory base address */
1184 /* XXX : not implemented */
1185 spr_register(env
, SPR_MBAR
, "MBAR",
1186 SPR_NOACCESS
, SPR_NOACCESS
,
1187 &spr_read_generic
, &spr_write_generic
,
1189 /* Exception processing */
1190 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1191 SPR_NOACCESS
, SPR_NOACCESS
,
1192 &spr_read_generic
, &spr_write_generic
,
1194 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1195 SPR_NOACCESS
, SPR_NOACCESS
,
1196 &spr_read_generic
, &spr_write_generic
,
1199 /* XXX : not implemented */
1200 spr_register(env
, SPR_DABR
, "DABR",
1201 SPR_NOACCESS
, SPR_NOACCESS
,
1202 &spr_read_generic
, &spr_write_generic
,
1204 /* XXX : not implemented */
1205 spr_register(env
, SPR_DABR2
, "DABR2",
1206 SPR_NOACCESS
, SPR_NOACCESS
,
1207 &spr_read_generic
, &spr_write_generic
,
1209 /* XXX : not implemented */
1210 spr_register(env
, SPR_IABR
, "IABR",
1211 SPR_NOACCESS
, SPR_NOACCESS
,
1212 &spr_read_generic
, &spr_write_generic
,
1214 /* XXX : not implemented */
1215 spr_register(env
, SPR_IABR2
, "IABR2",
1216 SPR_NOACCESS
, SPR_NOACCESS
,
1217 &spr_read_generic
, &spr_write_generic
,
1219 /* XXX : not implemented */
1220 spr_register(env
, SPR_IBCR
, "IBCR",
1221 SPR_NOACCESS
, SPR_NOACCESS
,
1222 &spr_read_generic
, &spr_write_generic
,
1224 /* XXX : not implemented */
1225 spr_register(env
, SPR_DBCR
, "DBCR",
1226 SPR_NOACCESS
, SPR_NOACCESS
,
1227 &spr_read_generic
, &spr_write_generic
,
1231 /* SPR specific to PowerPC 602 implementation */
1232 static void gen_spr_602 (CPUPPCState
*env
)
1235 /* XXX : not implemented */
1236 spr_register(env
, SPR_SER
, "SER",
1237 SPR_NOACCESS
, SPR_NOACCESS
,
1238 &spr_read_generic
, &spr_write_generic
,
1240 /* XXX : not implemented */
1241 spr_register(env
, SPR_SEBR
, "SEBR",
1242 SPR_NOACCESS
, SPR_NOACCESS
,
1243 &spr_read_generic
, &spr_write_generic
,
1245 /* XXX : not implemented */
1246 spr_register(env
, SPR_ESASRR
, "ESASRR",
1247 SPR_NOACCESS
, SPR_NOACCESS
,
1248 &spr_read_generic
, &spr_write_generic
,
1250 /* Floating point status */
1251 /* XXX : not implemented */
1252 spr_register(env
, SPR_SP
, "SP",
1253 SPR_NOACCESS
, SPR_NOACCESS
,
1254 &spr_read_generic
, &spr_write_generic
,
1256 /* XXX : not implemented */
1257 spr_register(env
, SPR_LT
, "LT",
1258 SPR_NOACCESS
, SPR_NOACCESS
,
1259 &spr_read_generic
, &spr_write_generic
,
1261 /* Watchdog timer */
1262 /* XXX : not implemented */
1263 spr_register(env
, SPR_TCR
, "TCR",
1264 SPR_NOACCESS
, SPR_NOACCESS
,
1265 &spr_read_generic
, &spr_write_generic
,
1267 /* Interrupt base */
1268 spr_register(env
, SPR_IBR
, "IBR",
1269 SPR_NOACCESS
, SPR_NOACCESS
,
1270 &spr_read_generic
, &spr_write_generic
,
1272 /* XXX : not implemented */
1273 spr_register(env
, SPR_IABR
, "IABR",
1274 SPR_NOACCESS
, SPR_NOACCESS
,
1275 &spr_read_generic
, &spr_write_generic
,
1279 /* SPR specific to PowerPC 601 implementation */
1280 static void gen_spr_601 (CPUPPCState
*env
)
1282 /* Multiplication/division register */
1284 spr_register(env
, SPR_MQ
, "MQ",
1285 &spr_read_generic
, &spr_write_generic
,
1286 &spr_read_generic
, &spr_write_generic
,
1289 spr_register(env
, SPR_601_RTCU
, "RTCU",
1290 SPR_NOACCESS
, SPR_NOACCESS
,
1291 SPR_NOACCESS
, &spr_write_601_rtcu
,
1293 spr_register(env
, SPR_601_VRTCU
, "RTCU",
1294 &spr_read_601_rtcu
, SPR_NOACCESS
,
1295 &spr_read_601_rtcu
, SPR_NOACCESS
,
1297 spr_register(env
, SPR_601_RTCL
, "RTCL",
1298 SPR_NOACCESS
, SPR_NOACCESS
,
1299 SPR_NOACCESS
, &spr_write_601_rtcl
,
1301 spr_register(env
, SPR_601_VRTCL
, "RTCL",
1302 &spr_read_601_rtcl
, SPR_NOACCESS
,
1303 &spr_read_601_rtcl
, SPR_NOACCESS
,
1307 spr_register(env
, SPR_601_UDECR
, "UDECR",
1308 &spr_read_decr
, SPR_NOACCESS
,
1309 &spr_read_decr
, SPR_NOACCESS
,
1312 /* External access control */
1313 /* XXX : not implemented */
1314 spr_register(env
, SPR_EAR
, "EAR",
1315 SPR_NOACCESS
, SPR_NOACCESS
,
1316 &spr_read_generic
, &spr_write_generic
,
1318 /* Memory management */
1319 #if !defined(CONFIG_USER_ONLY)
1320 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
1321 SPR_NOACCESS
, SPR_NOACCESS
,
1322 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1324 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
1325 SPR_NOACCESS
, SPR_NOACCESS
,
1326 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1328 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
1329 SPR_NOACCESS
, SPR_NOACCESS
,
1330 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1332 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
1333 SPR_NOACCESS
, SPR_NOACCESS
,
1334 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1336 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
1337 SPR_NOACCESS
, SPR_NOACCESS
,
1338 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1340 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
1341 SPR_NOACCESS
, SPR_NOACCESS
,
1342 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1344 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
1345 SPR_NOACCESS
, SPR_NOACCESS
,
1346 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1348 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
1349 SPR_NOACCESS
, SPR_NOACCESS
,
1350 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1356 static void gen_spr_74xx (CPUPPCState
*env
)
1358 /* Processor identification */
1359 spr_register(env
, SPR_PIR
, "PIR",
1360 SPR_NOACCESS
, SPR_NOACCESS
,
1361 &spr_read_generic
, &spr_write_pir
,
1363 /* XXX : not implemented */
1364 spr_register(env
, SPR_74XX_MMCR2
, "MMCR2",
1365 SPR_NOACCESS
, SPR_NOACCESS
,
1366 &spr_read_generic
, &spr_write_generic
,
1368 /* XXX : not implemented */
1369 spr_register(env
, SPR_74XX_UMMCR2
, "UMMCR2",
1370 &spr_read_ureg
, SPR_NOACCESS
,
1371 &spr_read_ureg
, SPR_NOACCESS
,
1373 /* XXX: not implemented */
1374 spr_register(env
, SPR_BAMR
, "BAMR",
1375 SPR_NOACCESS
, SPR_NOACCESS
,
1376 &spr_read_generic
, &spr_write_generic
,
1378 /* XXX : not implemented */
1379 spr_register(env
, SPR_MSSCR0
, "MSSCR0",
1380 SPR_NOACCESS
, SPR_NOACCESS
,
1381 &spr_read_generic
, &spr_write_generic
,
1383 /* Hardware implementation registers */
1384 /* XXX : not implemented */
1385 spr_register(env
, SPR_HID0
, "HID0",
1386 SPR_NOACCESS
, SPR_NOACCESS
,
1387 &spr_read_generic
, &spr_write_generic
,
1389 /* XXX : not implemented */
1390 spr_register(env
, SPR_HID1
, "HID1",
1391 SPR_NOACCESS
, SPR_NOACCESS
,
1392 &spr_read_generic
, &spr_write_generic
,
1395 spr_register(env
, SPR_VRSAVE
, "VRSAVE",
1396 &spr_read_generic
, &spr_write_generic
,
1397 &spr_read_generic
, &spr_write_generic
,
1399 /* XXX : not implemented */
1400 spr_register(env
, SPR_L2CR
, "L2CR",
1401 SPR_NOACCESS
, SPR_NOACCESS
,
1402 &spr_read_generic
, spr_access_nop
,
1404 /* Not strictly an SPR */
1405 vscr_init(env
, 0x00010000);
1408 static void gen_l3_ctrl (CPUPPCState
*env
)
1411 /* XXX : not implemented */
1412 spr_register(env
, SPR_L3CR
, "L3CR",
1413 SPR_NOACCESS
, SPR_NOACCESS
,
1414 &spr_read_generic
, &spr_write_generic
,
1417 /* XXX : not implemented */
1418 spr_register(env
, SPR_L3ITCR0
, "L3ITCR0",
1419 SPR_NOACCESS
, SPR_NOACCESS
,
1420 &spr_read_generic
, &spr_write_generic
,
1423 /* XXX : not implemented */
1424 spr_register(env
, SPR_L3PM
, "L3PM",
1425 SPR_NOACCESS
, SPR_NOACCESS
,
1426 &spr_read_generic
, &spr_write_generic
,
1430 static void gen_74xx_soft_tlb (CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
1432 #if !defined(CONFIG_USER_ONLY)
1433 env
->nb_tlb
= nb_tlbs
;
1434 env
->nb_ways
= nb_ways
;
1436 env
->tlb_type
= TLB_6XX
;
1437 /* XXX : not implemented */
1438 spr_register(env
, SPR_PTEHI
, "PTEHI",
1439 SPR_NOACCESS
, SPR_NOACCESS
,
1440 &spr_read_generic
, &spr_write_generic
,
1442 /* XXX : not implemented */
1443 spr_register(env
, SPR_PTELO
, "PTELO",
1444 SPR_NOACCESS
, SPR_NOACCESS
,
1445 &spr_read_generic
, &spr_write_generic
,
1447 /* XXX : not implemented */
1448 spr_register(env
, SPR_TLBMISS
, "TLBMISS",
1449 SPR_NOACCESS
, SPR_NOACCESS
,
1450 &spr_read_generic
, &spr_write_generic
,
1455 #if !defined(CONFIG_USER_ONLY)
1456 static void spr_write_e500_l1csr0 (void *opaque
, int sprn
, int gprn
)
1458 TCGv t0
= tcg_temp_new();
1460 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR0_DCE
| L1CSR0_CPE
);
1461 gen_store_spr(sprn
, t0
);
1465 static void spr_write_e500_l1csr1(void *opaque
, int sprn
, int gprn
)
1467 TCGv t0
= tcg_temp_new();
1469 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], L1CSR1_ICE
| L1CSR1_CPE
);
1470 gen_store_spr(sprn
, t0
);
1474 static void spr_write_booke206_mmucsr0 (void *opaque
, int sprn
, int gprn
)
1476 gen_helper_booke206_tlbflush(cpu_env
, cpu_gpr
[gprn
]);
1479 static void spr_write_booke_pid (void *opaque
, int sprn
, int gprn
)
1481 TCGv_i32 t0
= tcg_const_i32(sprn
);
1482 gen_helper_booke_setpid(cpu_env
, t0
, cpu_gpr
[gprn
]);
1483 tcg_temp_free_i32(t0
);
1487 static void gen_spr_usprgh (CPUPPCState
*env
)
1489 spr_register(env
, SPR_USPRG4
, "USPRG4",
1490 &spr_read_ureg
, SPR_NOACCESS
,
1491 &spr_read_ureg
, SPR_NOACCESS
,
1493 spr_register(env
, SPR_USPRG5
, "USPRG5",
1494 &spr_read_ureg
, SPR_NOACCESS
,
1495 &spr_read_ureg
, SPR_NOACCESS
,
1497 spr_register(env
, SPR_USPRG6
, "USPRG6",
1498 &spr_read_ureg
, SPR_NOACCESS
,
1499 &spr_read_ureg
, SPR_NOACCESS
,
1501 spr_register(env
, SPR_USPRG7
, "USPRG7",
1502 &spr_read_ureg
, SPR_NOACCESS
,
1503 &spr_read_ureg
, SPR_NOACCESS
,
1507 /* PowerPC BookE SPR */
1508 static void gen_spr_BookE (CPUPPCState
*env
, uint64_t ivor_mask
)
1510 const char *ivor_names
[64] = {
1511 "IVOR0", "IVOR1", "IVOR2", "IVOR3",
1512 "IVOR4", "IVOR5", "IVOR6", "IVOR7",
1513 "IVOR8", "IVOR9", "IVOR10", "IVOR11",
1514 "IVOR12", "IVOR13", "IVOR14", "IVOR15",
1515 "IVOR16", "IVOR17", "IVOR18", "IVOR19",
1516 "IVOR20", "IVOR21", "IVOR22", "IVOR23",
1517 "IVOR24", "IVOR25", "IVOR26", "IVOR27",
1518 "IVOR28", "IVOR29", "IVOR30", "IVOR31",
1519 "IVOR32", "IVOR33", "IVOR34", "IVOR35",
1520 "IVOR36", "IVOR37", "IVOR38", "IVOR39",
1521 "IVOR40", "IVOR41", "IVOR42", "IVOR43",
1522 "IVOR44", "IVOR45", "IVOR46", "IVOR47",
1523 "IVOR48", "IVOR49", "IVOR50", "IVOR51",
1524 "IVOR52", "IVOR53", "IVOR54", "IVOR55",
1525 "IVOR56", "IVOR57", "IVOR58", "IVOR59",
1526 "IVOR60", "IVOR61", "IVOR62", "IVOR63",
1528 #define SPR_BOOKE_IVORxx (-1)
1529 int ivor_sprn
[64] = {
1530 SPR_BOOKE_IVOR0
, SPR_BOOKE_IVOR1
, SPR_BOOKE_IVOR2
, SPR_BOOKE_IVOR3
,
1531 SPR_BOOKE_IVOR4
, SPR_BOOKE_IVOR5
, SPR_BOOKE_IVOR6
, SPR_BOOKE_IVOR7
,
1532 SPR_BOOKE_IVOR8
, SPR_BOOKE_IVOR9
, SPR_BOOKE_IVOR10
, SPR_BOOKE_IVOR11
,
1533 SPR_BOOKE_IVOR12
, SPR_BOOKE_IVOR13
, SPR_BOOKE_IVOR14
, SPR_BOOKE_IVOR15
,
1534 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1535 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1536 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1537 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1538 SPR_BOOKE_IVOR32
, SPR_BOOKE_IVOR33
, SPR_BOOKE_IVOR34
, SPR_BOOKE_IVOR35
,
1539 SPR_BOOKE_IVOR36
, SPR_BOOKE_IVOR37
, SPR_BOOKE_IVOR38
, SPR_BOOKE_IVOR39
,
1540 SPR_BOOKE_IVOR40
, SPR_BOOKE_IVOR41
, SPR_BOOKE_IVOR42
, SPR_BOOKE_IVORxx
,
1541 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1542 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1543 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1544 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1545 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1549 /* Interrupt processing */
1550 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1551 SPR_NOACCESS
, SPR_NOACCESS
,
1552 &spr_read_generic
, &spr_write_generic
,
1554 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1555 SPR_NOACCESS
, SPR_NOACCESS
,
1556 &spr_read_generic
, &spr_write_generic
,
1559 /* XXX : not implemented */
1560 spr_register(env
, SPR_BOOKE_IAC1
, "IAC1",
1561 SPR_NOACCESS
, SPR_NOACCESS
,
1562 &spr_read_generic
, &spr_write_generic
,
1564 /* XXX : not implemented */
1565 spr_register(env
, SPR_BOOKE_IAC2
, "IAC2",
1566 SPR_NOACCESS
, SPR_NOACCESS
,
1567 &spr_read_generic
, &spr_write_generic
,
1569 /* XXX : not implemented */
1570 spr_register(env
, SPR_BOOKE_DAC1
, "DAC1",
1571 SPR_NOACCESS
, SPR_NOACCESS
,
1572 &spr_read_generic
, &spr_write_generic
,
1574 /* XXX : not implemented */
1575 spr_register(env
, SPR_BOOKE_DAC2
, "DAC2",
1576 SPR_NOACCESS
, SPR_NOACCESS
,
1577 &spr_read_generic
, &spr_write_generic
,
1579 /* XXX : not implemented */
1580 spr_register(env
, SPR_BOOKE_DBCR0
, "DBCR0",
1581 SPR_NOACCESS
, SPR_NOACCESS
,
1582 &spr_read_generic
, &spr_write_40x_dbcr0
,
1584 /* XXX : not implemented */
1585 spr_register(env
, SPR_BOOKE_DBCR1
, "DBCR1",
1586 SPR_NOACCESS
, SPR_NOACCESS
,
1587 &spr_read_generic
, &spr_write_generic
,
1589 /* XXX : not implemented */
1590 spr_register(env
, SPR_BOOKE_DBCR2
, "DBCR2",
1591 SPR_NOACCESS
, SPR_NOACCESS
,
1592 &spr_read_generic
, &spr_write_generic
,
1594 /* XXX : not implemented */
1595 spr_register(env
, SPR_BOOKE_DBSR
, "DBSR",
1596 SPR_NOACCESS
, SPR_NOACCESS
,
1597 &spr_read_generic
, &spr_write_clear
,
1599 spr_register(env
, SPR_BOOKE_DEAR
, "DEAR",
1600 SPR_NOACCESS
, SPR_NOACCESS
,
1601 &spr_read_generic
, &spr_write_generic
,
1603 spr_register(env
, SPR_BOOKE_ESR
, "ESR",
1604 SPR_NOACCESS
, SPR_NOACCESS
,
1605 &spr_read_generic
, &spr_write_generic
,
1607 spr_register(env
, SPR_BOOKE_IVPR
, "IVPR",
1608 SPR_NOACCESS
, SPR_NOACCESS
,
1609 &spr_read_generic
, &spr_write_excp_prefix
,
1611 /* Exception vectors */
1612 for (i
= 0; i
< 64; i
++) {
1613 if (ivor_mask
& (1ULL << i
)) {
1614 if (ivor_sprn
[i
] == SPR_BOOKE_IVORxx
) {
1615 fprintf(stderr
, "ERROR: IVOR %d SPR is not defined\n", i
);
1618 spr_register(env
, ivor_sprn
[i
], ivor_names
[i
],
1619 SPR_NOACCESS
, SPR_NOACCESS
,
1620 &spr_read_generic
, &spr_write_excp_vector
,
1624 spr_register(env
, SPR_BOOKE_PID
, "PID",
1625 SPR_NOACCESS
, SPR_NOACCESS
,
1626 &spr_read_generic
, &spr_write_booke_pid
,
1628 spr_register(env
, SPR_BOOKE_TCR
, "TCR",
1629 SPR_NOACCESS
, SPR_NOACCESS
,
1630 &spr_read_generic
, &spr_write_booke_tcr
,
1632 spr_register(env
, SPR_BOOKE_TSR
, "TSR",
1633 SPR_NOACCESS
, SPR_NOACCESS
,
1634 &spr_read_generic
, &spr_write_booke_tsr
,
1637 spr_register(env
, SPR_DECR
, "DECR",
1638 SPR_NOACCESS
, SPR_NOACCESS
,
1639 &spr_read_decr
, &spr_write_decr
,
1641 spr_register(env
, SPR_BOOKE_DECAR
, "DECAR",
1642 SPR_NOACCESS
, SPR_NOACCESS
,
1643 SPR_NOACCESS
, &spr_write_generic
,
1646 spr_register(env
, SPR_USPRG0
, "USPRG0",
1647 &spr_read_generic
, &spr_write_generic
,
1648 &spr_read_generic
, &spr_write_generic
,
1650 spr_register(env
, SPR_SPRG4
, "SPRG4",
1651 SPR_NOACCESS
, SPR_NOACCESS
,
1652 &spr_read_generic
, &spr_write_generic
,
1654 spr_register(env
, SPR_SPRG5
, "SPRG5",
1655 SPR_NOACCESS
, SPR_NOACCESS
,
1656 &spr_read_generic
, &spr_write_generic
,
1658 spr_register(env
, SPR_SPRG6
, "SPRG6",
1659 SPR_NOACCESS
, SPR_NOACCESS
,
1660 &spr_read_generic
, &spr_write_generic
,
1662 spr_register(env
, SPR_SPRG7
, "SPRG7",
1663 SPR_NOACCESS
, SPR_NOACCESS
,
1664 &spr_read_generic
, &spr_write_generic
,
1668 static inline uint32_t gen_tlbncfg(uint32_t assoc
, uint32_t minsize
,
1669 uint32_t maxsize
, uint32_t flags
,
1672 return (assoc
<< TLBnCFG_ASSOC_SHIFT
) |
1673 (minsize
<< TLBnCFG_MINSIZE_SHIFT
) |
1674 (maxsize
<< TLBnCFG_MAXSIZE_SHIFT
) |
1678 /* BookE 2.06 storage control registers */
1679 static void gen_spr_BookE206(CPUPPCState
*env
, uint32_t mas_mask
,
1682 #if !defined(CONFIG_USER_ONLY)
1683 const char *mas_names
[8] = {
1684 "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
1687 SPR_BOOKE_MAS0
, SPR_BOOKE_MAS1
, SPR_BOOKE_MAS2
, SPR_BOOKE_MAS3
,
1688 SPR_BOOKE_MAS4
, SPR_BOOKE_MAS5
, SPR_BOOKE_MAS6
, SPR_BOOKE_MAS7
,
1692 /* TLB assist registers */
1693 /* XXX : not implemented */
1694 for (i
= 0; i
< 8; i
++) {
1695 void (*uea_write
)(void *o
, int sprn
, int gprn
) = &spr_write_generic32
;
1696 if (i
== 2 && (mas_mask
& (1 << i
)) && (env
->insns_flags
& PPC_64B
)) {
1697 uea_write
= &spr_write_generic
;
1699 if (mas_mask
& (1 << i
)) {
1700 spr_register(env
, mas_sprn
[i
], mas_names
[i
],
1701 SPR_NOACCESS
, SPR_NOACCESS
,
1702 &spr_read_generic
, uea_write
,
1706 if (env
->nb_pids
> 1) {
1707 /* XXX : not implemented */
1708 spr_register(env
, SPR_BOOKE_PID1
, "PID1",
1709 SPR_NOACCESS
, SPR_NOACCESS
,
1710 &spr_read_generic
, &spr_write_booke_pid
,
1713 if (env
->nb_pids
> 2) {
1714 /* XXX : not implemented */
1715 spr_register(env
, SPR_BOOKE_PID2
, "PID2",
1716 SPR_NOACCESS
, SPR_NOACCESS
,
1717 &spr_read_generic
, &spr_write_booke_pid
,
1720 /* XXX : not implemented */
1721 spr_register(env
, SPR_MMUCFG
, "MMUCFG",
1722 SPR_NOACCESS
, SPR_NOACCESS
,
1723 &spr_read_generic
, SPR_NOACCESS
,
1724 0x00000000); /* TOFIX */
1725 switch (env
->nb_ways
) {
1727 spr_register(env
, SPR_BOOKE_TLB3CFG
, "TLB3CFG",
1728 SPR_NOACCESS
, SPR_NOACCESS
,
1729 &spr_read_generic
, SPR_NOACCESS
,
1733 spr_register(env
, SPR_BOOKE_TLB2CFG
, "TLB2CFG",
1734 SPR_NOACCESS
, SPR_NOACCESS
,
1735 &spr_read_generic
, SPR_NOACCESS
,
1739 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
1740 SPR_NOACCESS
, SPR_NOACCESS
,
1741 &spr_read_generic
, SPR_NOACCESS
,
1745 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
1746 SPR_NOACCESS
, SPR_NOACCESS
,
1747 &spr_read_generic
, SPR_NOACCESS
,
1756 gen_spr_usprgh(env
);
1759 /* SPR specific to PowerPC 440 implementation */
1760 static void gen_spr_440 (CPUPPCState
*env
)
1763 /* XXX : not implemented */
1764 spr_register(env
, SPR_440_DNV0
, "DNV0",
1765 SPR_NOACCESS
, SPR_NOACCESS
,
1766 &spr_read_generic
, &spr_write_generic
,
1768 /* XXX : not implemented */
1769 spr_register(env
, SPR_440_DNV1
, "DNV1",
1770 SPR_NOACCESS
, SPR_NOACCESS
,
1771 &spr_read_generic
, &spr_write_generic
,
1773 /* XXX : not implemented */
1774 spr_register(env
, SPR_440_DNV2
, "DNV2",
1775 SPR_NOACCESS
, SPR_NOACCESS
,
1776 &spr_read_generic
, &spr_write_generic
,
1778 /* XXX : not implemented */
1779 spr_register(env
, SPR_440_DNV3
, "DNV3",
1780 SPR_NOACCESS
, SPR_NOACCESS
,
1781 &spr_read_generic
, &spr_write_generic
,
1783 /* XXX : not implemented */
1784 spr_register(env
, SPR_440_DTV0
, "DTV0",
1785 SPR_NOACCESS
, SPR_NOACCESS
,
1786 &spr_read_generic
, &spr_write_generic
,
1788 /* XXX : not implemented */
1789 spr_register(env
, SPR_440_DTV1
, "DTV1",
1790 SPR_NOACCESS
, SPR_NOACCESS
,
1791 &spr_read_generic
, &spr_write_generic
,
1793 /* XXX : not implemented */
1794 spr_register(env
, SPR_440_DTV2
, "DTV2",
1795 SPR_NOACCESS
, SPR_NOACCESS
,
1796 &spr_read_generic
, &spr_write_generic
,
1798 /* XXX : not implemented */
1799 spr_register(env
, SPR_440_DTV3
, "DTV3",
1800 SPR_NOACCESS
, SPR_NOACCESS
,
1801 &spr_read_generic
, &spr_write_generic
,
1803 /* XXX : not implemented */
1804 spr_register(env
, SPR_440_DVLIM
, "DVLIM",
1805 SPR_NOACCESS
, SPR_NOACCESS
,
1806 &spr_read_generic
, &spr_write_generic
,
1808 /* XXX : not implemented */
1809 spr_register(env
, SPR_440_INV0
, "INV0",
1810 SPR_NOACCESS
, SPR_NOACCESS
,
1811 &spr_read_generic
, &spr_write_generic
,
1813 /* XXX : not implemented */
1814 spr_register(env
, SPR_440_INV1
, "INV1",
1815 SPR_NOACCESS
, SPR_NOACCESS
,
1816 &spr_read_generic
, &spr_write_generic
,
1818 /* XXX : not implemented */
1819 spr_register(env
, SPR_440_INV2
, "INV2",
1820 SPR_NOACCESS
, SPR_NOACCESS
,
1821 &spr_read_generic
, &spr_write_generic
,
1823 /* XXX : not implemented */
1824 spr_register(env
, SPR_440_INV3
, "INV3",
1825 SPR_NOACCESS
, SPR_NOACCESS
,
1826 &spr_read_generic
, &spr_write_generic
,
1828 /* XXX : not implemented */
1829 spr_register(env
, SPR_440_ITV0
, "ITV0",
1830 SPR_NOACCESS
, SPR_NOACCESS
,
1831 &spr_read_generic
, &spr_write_generic
,
1833 /* XXX : not implemented */
1834 spr_register(env
, SPR_440_ITV1
, "ITV1",
1835 SPR_NOACCESS
, SPR_NOACCESS
,
1836 &spr_read_generic
, &spr_write_generic
,
1838 /* XXX : not implemented */
1839 spr_register(env
, SPR_440_ITV2
, "ITV2",
1840 SPR_NOACCESS
, SPR_NOACCESS
,
1841 &spr_read_generic
, &spr_write_generic
,
1843 /* XXX : not implemented */
1844 spr_register(env
, SPR_440_ITV3
, "ITV3",
1845 SPR_NOACCESS
, SPR_NOACCESS
,
1846 &spr_read_generic
, &spr_write_generic
,
1848 /* XXX : not implemented */
1849 spr_register(env
, SPR_440_IVLIM
, "IVLIM",
1850 SPR_NOACCESS
, SPR_NOACCESS
,
1851 &spr_read_generic
, &spr_write_generic
,
1854 /* XXX : not implemented */
1855 spr_register(env
, SPR_BOOKE_DCDBTRH
, "DCDBTRH",
1856 SPR_NOACCESS
, SPR_NOACCESS
,
1857 &spr_read_generic
, SPR_NOACCESS
,
1859 /* XXX : not implemented */
1860 spr_register(env
, SPR_BOOKE_DCDBTRL
, "DCDBTRL",
1861 SPR_NOACCESS
, SPR_NOACCESS
,
1862 &spr_read_generic
, SPR_NOACCESS
,
1864 /* XXX : not implemented */
1865 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
1866 SPR_NOACCESS
, SPR_NOACCESS
,
1867 &spr_read_generic
, SPR_NOACCESS
,
1869 /* XXX : not implemented */
1870 spr_register(env
, SPR_BOOKE_ICDBTRH
, "ICDBTRH",
1871 SPR_NOACCESS
, SPR_NOACCESS
,
1872 &spr_read_generic
, SPR_NOACCESS
,
1874 /* XXX : not implemented */
1875 spr_register(env
, SPR_BOOKE_ICDBTRL
, "ICDBTRL",
1876 SPR_NOACCESS
, SPR_NOACCESS
,
1877 &spr_read_generic
, SPR_NOACCESS
,
1879 /* XXX : not implemented */
1880 spr_register(env
, SPR_440_DBDR
, "DBDR",
1881 SPR_NOACCESS
, SPR_NOACCESS
,
1882 &spr_read_generic
, &spr_write_generic
,
1884 /* Processor control */
1885 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
1886 SPR_NOACCESS
, SPR_NOACCESS
,
1887 &spr_read_generic
, &spr_write_generic
,
1889 spr_register(env
, SPR_440_RSTCFG
, "RSTCFG",
1890 SPR_NOACCESS
, SPR_NOACCESS
,
1891 &spr_read_generic
, SPR_NOACCESS
,
1893 /* Storage control */
1894 spr_register(env
, SPR_440_MMUCR
, "MMUCR",
1895 SPR_NOACCESS
, SPR_NOACCESS
,
1896 &spr_read_generic
, &spr_write_generic
,
1900 /* SPR shared between PowerPC 40x implementations */
1901 static void gen_spr_40x (CPUPPCState
*env
)
1904 /* not emulated, as QEMU do not emulate caches */
1905 spr_register(env
, SPR_40x_DCCR
, "DCCR",
1906 SPR_NOACCESS
, SPR_NOACCESS
,
1907 &spr_read_generic
, &spr_write_generic
,
1909 /* not emulated, as QEMU do not emulate caches */
1910 spr_register(env
, SPR_40x_ICCR
, "ICCR",
1911 SPR_NOACCESS
, SPR_NOACCESS
,
1912 &spr_read_generic
, &spr_write_generic
,
1914 /* not emulated, as QEMU do not emulate caches */
1915 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
1916 SPR_NOACCESS
, SPR_NOACCESS
,
1917 &spr_read_generic
, SPR_NOACCESS
,
1920 spr_register(env
, SPR_40x_DEAR
, "DEAR",
1921 SPR_NOACCESS
, SPR_NOACCESS
,
1922 &spr_read_generic
, &spr_write_generic
,
1924 spr_register(env
, SPR_40x_ESR
, "ESR",
1925 SPR_NOACCESS
, SPR_NOACCESS
,
1926 &spr_read_generic
, &spr_write_generic
,
1928 spr_register(env
, SPR_40x_EVPR
, "EVPR",
1929 SPR_NOACCESS
, SPR_NOACCESS
,
1930 &spr_read_generic
, &spr_write_excp_prefix
,
1932 spr_register(env
, SPR_40x_SRR2
, "SRR2",
1933 &spr_read_generic
, &spr_write_generic
,
1934 &spr_read_generic
, &spr_write_generic
,
1936 spr_register(env
, SPR_40x_SRR3
, "SRR3",
1937 &spr_read_generic
, &spr_write_generic
,
1938 &spr_read_generic
, &spr_write_generic
,
1941 spr_register(env
, SPR_40x_PIT
, "PIT",
1942 SPR_NOACCESS
, SPR_NOACCESS
,
1943 &spr_read_40x_pit
, &spr_write_40x_pit
,
1945 spr_register(env
, SPR_40x_TCR
, "TCR",
1946 SPR_NOACCESS
, SPR_NOACCESS
,
1947 &spr_read_generic
, &spr_write_booke_tcr
,
1949 spr_register(env
, SPR_40x_TSR
, "TSR",
1950 SPR_NOACCESS
, SPR_NOACCESS
,
1951 &spr_read_generic
, &spr_write_booke_tsr
,
1955 /* SPR specific to PowerPC 405 implementation */
1956 static void gen_spr_405 (CPUPPCState
*env
)
1959 spr_register(env
, SPR_40x_PID
, "PID",
1960 SPR_NOACCESS
, SPR_NOACCESS
,
1961 &spr_read_generic
, &spr_write_generic
,
1963 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
1964 SPR_NOACCESS
, SPR_NOACCESS
,
1965 &spr_read_generic
, &spr_write_generic
,
1967 /* Debug interface */
1968 /* XXX : not implemented */
1969 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
1970 SPR_NOACCESS
, SPR_NOACCESS
,
1971 &spr_read_generic
, &spr_write_40x_dbcr0
,
1973 /* XXX : not implemented */
1974 spr_register(env
, SPR_405_DBCR1
, "DBCR1",
1975 SPR_NOACCESS
, SPR_NOACCESS
,
1976 &spr_read_generic
, &spr_write_generic
,
1978 /* XXX : not implemented */
1979 spr_register(env
, SPR_40x_DBSR
, "DBSR",
1980 SPR_NOACCESS
, SPR_NOACCESS
,
1981 &spr_read_generic
, &spr_write_clear
,
1982 /* Last reset was system reset */
1984 /* XXX : not implemented */
1985 spr_register(env
, SPR_40x_DAC1
, "DAC1",
1986 SPR_NOACCESS
, SPR_NOACCESS
,
1987 &spr_read_generic
, &spr_write_generic
,
1989 spr_register(env
, SPR_40x_DAC2
, "DAC2",
1990 SPR_NOACCESS
, SPR_NOACCESS
,
1991 &spr_read_generic
, &spr_write_generic
,
1993 /* XXX : not implemented */
1994 spr_register(env
, SPR_405_DVC1
, "DVC1",
1995 SPR_NOACCESS
, SPR_NOACCESS
,
1996 &spr_read_generic
, &spr_write_generic
,
1998 /* XXX : not implemented */
1999 spr_register(env
, SPR_405_DVC2
, "DVC2",
2000 SPR_NOACCESS
, SPR_NOACCESS
,
2001 &spr_read_generic
, &spr_write_generic
,
2003 /* XXX : not implemented */
2004 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2005 SPR_NOACCESS
, SPR_NOACCESS
,
2006 &spr_read_generic
, &spr_write_generic
,
2008 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2009 SPR_NOACCESS
, SPR_NOACCESS
,
2010 &spr_read_generic
, &spr_write_generic
,
2012 /* XXX : not implemented */
2013 spr_register(env
, SPR_405_IAC3
, "IAC3",
2014 SPR_NOACCESS
, SPR_NOACCESS
,
2015 &spr_read_generic
, &spr_write_generic
,
2017 /* XXX : not implemented */
2018 spr_register(env
, SPR_405_IAC4
, "IAC4",
2019 SPR_NOACCESS
, SPR_NOACCESS
,
2020 &spr_read_generic
, &spr_write_generic
,
2022 /* Storage control */
2023 /* XXX: TODO: not implemented */
2024 spr_register(env
, SPR_405_SLER
, "SLER",
2025 SPR_NOACCESS
, SPR_NOACCESS
,
2026 &spr_read_generic
, &spr_write_40x_sler
,
2028 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2029 SPR_NOACCESS
, SPR_NOACCESS
,
2030 &spr_read_generic
, &spr_write_generic
,
2032 /* XXX : not implemented */
2033 spr_register(env
, SPR_405_SU0R
, "SU0R",
2034 SPR_NOACCESS
, SPR_NOACCESS
,
2035 &spr_read_generic
, &spr_write_generic
,
2038 spr_register(env
, SPR_USPRG0
, "USPRG0",
2039 &spr_read_ureg
, SPR_NOACCESS
,
2040 &spr_read_ureg
, SPR_NOACCESS
,
2042 spr_register(env
, SPR_SPRG4
, "SPRG4",
2043 SPR_NOACCESS
, SPR_NOACCESS
,
2044 &spr_read_generic
, &spr_write_generic
,
2046 spr_register(env
, SPR_SPRG5
, "SPRG5",
2047 SPR_NOACCESS
, SPR_NOACCESS
,
2048 spr_read_generic
, &spr_write_generic
,
2050 spr_register(env
, SPR_SPRG6
, "SPRG6",
2051 SPR_NOACCESS
, SPR_NOACCESS
,
2052 spr_read_generic
, &spr_write_generic
,
2054 spr_register(env
, SPR_SPRG7
, "SPRG7",
2055 SPR_NOACCESS
, SPR_NOACCESS
,
2056 spr_read_generic
, &spr_write_generic
,
2058 gen_spr_usprgh(env
);
2061 /* SPR shared between PowerPC 401 & 403 implementations */
2062 static void gen_spr_401_403 (CPUPPCState
*env
)
2065 spr_register(env
, SPR_403_VTBL
, "TBL",
2066 &spr_read_tbl
, SPR_NOACCESS
,
2067 &spr_read_tbl
, SPR_NOACCESS
,
2069 spr_register(env
, SPR_403_TBL
, "TBL",
2070 SPR_NOACCESS
, SPR_NOACCESS
,
2071 SPR_NOACCESS
, &spr_write_tbl
,
2073 spr_register(env
, SPR_403_VTBU
, "TBU",
2074 &spr_read_tbu
, SPR_NOACCESS
,
2075 &spr_read_tbu
, SPR_NOACCESS
,
2077 spr_register(env
, SPR_403_TBU
, "TBU",
2078 SPR_NOACCESS
, SPR_NOACCESS
,
2079 SPR_NOACCESS
, &spr_write_tbu
,
2082 /* not emulated, as QEMU do not emulate caches */
2083 spr_register(env
, SPR_403_CDBCR
, "CDBCR",
2084 SPR_NOACCESS
, SPR_NOACCESS
,
2085 &spr_read_generic
, &spr_write_generic
,
2089 /* SPR specific to PowerPC 401 implementation */
2090 static void gen_spr_401 (CPUPPCState
*env
)
2092 /* Debug interface */
2093 /* XXX : not implemented */
2094 spr_register(env
, SPR_40x_DBCR0
, "DBCR",
2095 SPR_NOACCESS
, SPR_NOACCESS
,
2096 &spr_read_generic
, &spr_write_40x_dbcr0
,
2098 /* XXX : not implemented */
2099 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2100 SPR_NOACCESS
, SPR_NOACCESS
,
2101 &spr_read_generic
, &spr_write_clear
,
2102 /* Last reset was system reset */
2104 /* XXX : not implemented */
2105 spr_register(env
, SPR_40x_DAC1
, "DAC",
2106 SPR_NOACCESS
, SPR_NOACCESS
,
2107 &spr_read_generic
, &spr_write_generic
,
2109 /* XXX : not implemented */
2110 spr_register(env
, SPR_40x_IAC1
, "IAC",
2111 SPR_NOACCESS
, SPR_NOACCESS
,
2112 &spr_read_generic
, &spr_write_generic
,
2114 /* Storage control */
2115 /* XXX: TODO: not implemented */
2116 spr_register(env
, SPR_405_SLER
, "SLER",
2117 SPR_NOACCESS
, SPR_NOACCESS
,
2118 &spr_read_generic
, &spr_write_40x_sler
,
2120 /* not emulated, as QEMU never does speculative access */
2121 spr_register(env
, SPR_40x_SGR
, "SGR",
2122 SPR_NOACCESS
, SPR_NOACCESS
,
2123 &spr_read_generic
, &spr_write_generic
,
2125 /* not emulated, as QEMU do not emulate caches */
2126 spr_register(env
, SPR_40x_DCWR
, "DCWR",
2127 SPR_NOACCESS
, SPR_NOACCESS
,
2128 &spr_read_generic
, &spr_write_generic
,
2132 static void gen_spr_401x2 (CPUPPCState
*env
)
2135 spr_register(env
, SPR_40x_PID
, "PID",
2136 SPR_NOACCESS
, SPR_NOACCESS
,
2137 &spr_read_generic
, &spr_write_generic
,
2139 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2140 SPR_NOACCESS
, SPR_NOACCESS
,
2141 &spr_read_generic
, &spr_write_generic
,
2145 /* SPR specific to PowerPC 403 implementation */
2146 static void gen_spr_403 (CPUPPCState
*env
)
2148 /* Debug interface */
2149 /* XXX : not implemented */
2150 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2151 SPR_NOACCESS
, SPR_NOACCESS
,
2152 &spr_read_generic
, &spr_write_40x_dbcr0
,
2154 /* XXX : not implemented */
2155 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2156 SPR_NOACCESS
, SPR_NOACCESS
,
2157 &spr_read_generic
, &spr_write_clear
,
2158 /* Last reset was system reset */
2160 /* XXX : not implemented */
2161 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2162 SPR_NOACCESS
, SPR_NOACCESS
,
2163 &spr_read_generic
, &spr_write_generic
,
2165 /* XXX : not implemented */
2166 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2167 SPR_NOACCESS
, SPR_NOACCESS
,
2168 &spr_read_generic
, &spr_write_generic
,
2170 /* XXX : not implemented */
2171 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2172 SPR_NOACCESS
, SPR_NOACCESS
,
2173 &spr_read_generic
, &spr_write_generic
,
2175 /* XXX : not implemented */
2176 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2177 SPR_NOACCESS
, SPR_NOACCESS
,
2178 &spr_read_generic
, &spr_write_generic
,
2182 static void gen_spr_403_real (CPUPPCState
*env
)
2184 spr_register(env
, SPR_403_PBL1
, "PBL1",
2185 SPR_NOACCESS
, SPR_NOACCESS
,
2186 &spr_read_403_pbr
, &spr_write_403_pbr
,
2188 spr_register(env
, SPR_403_PBU1
, "PBU1",
2189 SPR_NOACCESS
, SPR_NOACCESS
,
2190 &spr_read_403_pbr
, &spr_write_403_pbr
,
2192 spr_register(env
, SPR_403_PBL2
, "PBL2",
2193 SPR_NOACCESS
, SPR_NOACCESS
,
2194 &spr_read_403_pbr
, &spr_write_403_pbr
,
2196 spr_register(env
, SPR_403_PBU2
, "PBU2",
2197 SPR_NOACCESS
, SPR_NOACCESS
,
2198 &spr_read_403_pbr
, &spr_write_403_pbr
,
2202 static void gen_spr_403_mmu (CPUPPCState
*env
)
2205 spr_register(env
, SPR_40x_PID
, "PID",
2206 SPR_NOACCESS
, SPR_NOACCESS
,
2207 &spr_read_generic
, &spr_write_generic
,
2209 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2210 SPR_NOACCESS
, SPR_NOACCESS
,
2211 &spr_read_generic
, &spr_write_generic
,
2215 /* SPR specific to PowerPC compression coprocessor extension */
2216 static void gen_spr_compress (CPUPPCState
*env
)
2218 /* XXX : not implemented */
2219 spr_register(env
, SPR_401_SKR
, "SKR",
2220 SPR_NOACCESS
, SPR_NOACCESS
,
2221 &spr_read_generic
, &spr_write_generic
,
2225 static void gen_spr_5xx_8xx (CPUPPCState
*env
)
2227 /* Exception processing */
2228 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
2229 SPR_NOACCESS
, SPR_NOACCESS
,
2230 &spr_read_generic
, &spr_write_generic
,
2231 KVM_REG_PPC_DSISR
, 0x00000000);
2232 spr_register_kvm(env
, SPR_DAR
, "DAR",
2233 SPR_NOACCESS
, SPR_NOACCESS
,
2234 &spr_read_generic
, &spr_write_generic
,
2235 KVM_REG_PPC_DAR
, 0x00000000);
2237 spr_register(env
, SPR_DECR
, "DECR",
2238 SPR_NOACCESS
, SPR_NOACCESS
,
2239 &spr_read_decr
, &spr_write_decr
,
2241 /* XXX : not implemented */
2242 spr_register(env
, SPR_MPC_EIE
, "EIE",
2243 SPR_NOACCESS
, SPR_NOACCESS
,
2244 &spr_read_generic
, &spr_write_generic
,
2246 /* XXX : not implemented */
2247 spr_register(env
, SPR_MPC_EID
, "EID",
2248 SPR_NOACCESS
, SPR_NOACCESS
,
2249 &spr_read_generic
, &spr_write_generic
,
2251 /* XXX : not implemented */
2252 spr_register(env
, SPR_MPC_NRI
, "NRI",
2253 SPR_NOACCESS
, SPR_NOACCESS
,
2254 &spr_read_generic
, &spr_write_generic
,
2256 /* XXX : not implemented */
2257 spr_register(env
, SPR_MPC_CMPA
, "CMPA",
2258 SPR_NOACCESS
, SPR_NOACCESS
,
2259 &spr_read_generic
, &spr_write_generic
,
2261 /* XXX : not implemented */
2262 spr_register(env
, SPR_MPC_CMPB
, "CMPB",
2263 SPR_NOACCESS
, SPR_NOACCESS
,
2264 &spr_read_generic
, &spr_write_generic
,
2266 /* XXX : not implemented */
2267 spr_register(env
, SPR_MPC_CMPC
, "CMPC",
2268 SPR_NOACCESS
, SPR_NOACCESS
,
2269 &spr_read_generic
, &spr_write_generic
,
2271 /* XXX : not implemented */
2272 spr_register(env
, SPR_MPC_CMPD
, "CMPD",
2273 SPR_NOACCESS
, SPR_NOACCESS
,
2274 &spr_read_generic
, &spr_write_generic
,
2276 /* XXX : not implemented */
2277 spr_register(env
, SPR_MPC_ECR
, "ECR",
2278 SPR_NOACCESS
, SPR_NOACCESS
,
2279 &spr_read_generic
, &spr_write_generic
,
2281 /* XXX : not implemented */
2282 spr_register(env
, SPR_MPC_DER
, "DER",
2283 SPR_NOACCESS
, SPR_NOACCESS
,
2284 &spr_read_generic
, &spr_write_generic
,
2286 /* XXX : not implemented */
2287 spr_register(env
, SPR_MPC_COUNTA
, "COUNTA",
2288 SPR_NOACCESS
, SPR_NOACCESS
,
2289 &spr_read_generic
, &spr_write_generic
,
2291 /* XXX : not implemented */
2292 spr_register(env
, SPR_MPC_COUNTB
, "COUNTB",
2293 SPR_NOACCESS
, SPR_NOACCESS
,
2294 &spr_read_generic
, &spr_write_generic
,
2296 /* XXX : not implemented */
2297 spr_register(env
, SPR_MPC_CMPE
, "CMPE",
2298 SPR_NOACCESS
, SPR_NOACCESS
,
2299 &spr_read_generic
, &spr_write_generic
,
2301 /* XXX : not implemented */
2302 spr_register(env
, SPR_MPC_CMPF
, "CMPF",
2303 SPR_NOACCESS
, SPR_NOACCESS
,
2304 &spr_read_generic
, &spr_write_generic
,
2306 /* XXX : not implemented */
2307 spr_register(env
, SPR_MPC_CMPG
, "CMPG",
2308 SPR_NOACCESS
, SPR_NOACCESS
,
2309 &spr_read_generic
, &spr_write_generic
,
2311 /* XXX : not implemented */
2312 spr_register(env
, SPR_MPC_CMPH
, "CMPH",
2313 SPR_NOACCESS
, SPR_NOACCESS
,
2314 &spr_read_generic
, &spr_write_generic
,
2316 /* XXX : not implemented */
2317 spr_register(env
, SPR_MPC_LCTRL1
, "LCTRL1",
2318 SPR_NOACCESS
, SPR_NOACCESS
,
2319 &spr_read_generic
, &spr_write_generic
,
2321 /* XXX : not implemented */
2322 spr_register(env
, SPR_MPC_LCTRL2
, "LCTRL2",
2323 SPR_NOACCESS
, SPR_NOACCESS
,
2324 &spr_read_generic
, &spr_write_generic
,
2326 /* XXX : not implemented */
2327 spr_register(env
, SPR_MPC_BAR
, "BAR",
2328 SPR_NOACCESS
, SPR_NOACCESS
,
2329 &spr_read_generic
, &spr_write_generic
,
2331 /* XXX : not implemented */
2332 spr_register(env
, SPR_MPC_DPDR
, "DPDR",
2333 SPR_NOACCESS
, SPR_NOACCESS
,
2334 &spr_read_generic
, &spr_write_generic
,
2336 /* XXX : not implemented */
2337 spr_register(env
, SPR_MPC_IMMR
, "IMMR",
2338 SPR_NOACCESS
, SPR_NOACCESS
,
2339 &spr_read_generic
, &spr_write_generic
,
2343 static void gen_spr_5xx (CPUPPCState
*env
)
2345 /* XXX : not implemented */
2346 spr_register(env
, SPR_RCPU_MI_GRA
, "MI_GRA",
2347 SPR_NOACCESS
, SPR_NOACCESS
,
2348 &spr_read_generic
, &spr_write_generic
,
2350 /* XXX : not implemented */
2351 spr_register(env
, SPR_RCPU_L2U_GRA
, "L2U_GRA",
2352 SPR_NOACCESS
, SPR_NOACCESS
,
2353 &spr_read_generic
, &spr_write_generic
,
2355 /* XXX : not implemented */
2356 spr_register(env
, SPR_RPCU_BBCMCR
, "L2U_BBCMCR",
2357 SPR_NOACCESS
, SPR_NOACCESS
,
2358 &spr_read_generic
, &spr_write_generic
,
2360 /* XXX : not implemented */
2361 spr_register(env
, SPR_RCPU_L2U_MCR
, "L2U_MCR",
2362 SPR_NOACCESS
, SPR_NOACCESS
,
2363 &spr_read_generic
, &spr_write_generic
,
2365 /* XXX : not implemented */
2366 spr_register(env
, SPR_RCPU_MI_RBA0
, "MI_RBA0",
2367 SPR_NOACCESS
, SPR_NOACCESS
,
2368 &spr_read_generic
, &spr_write_generic
,
2370 /* XXX : not implemented */
2371 spr_register(env
, SPR_RCPU_MI_RBA1
, "MI_RBA1",
2372 SPR_NOACCESS
, SPR_NOACCESS
,
2373 &spr_read_generic
, &spr_write_generic
,
2375 /* XXX : not implemented */
2376 spr_register(env
, SPR_RCPU_MI_RBA2
, "MI_RBA2",
2377 SPR_NOACCESS
, SPR_NOACCESS
,
2378 &spr_read_generic
, &spr_write_generic
,
2380 /* XXX : not implemented */
2381 spr_register(env
, SPR_RCPU_MI_RBA3
, "MI_RBA3",
2382 SPR_NOACCESS
, SPR_NOACCESS
,
2383 &spr_read_generic
, &spr_write_generic
,
2385 /* XXX : not implemented */
2386 spr_register(env
, SPR_RCPU_L2U_RBA0
, "L2U_RBA0",
2387 SPR_NOACCESS
, SPR_NOACCESS
,
2388 &spr_read_generic
, &spr_write_generic
,
2390 /* XXX : not implemented */
2391 spr_register(env
, SPR_RCPU_L2U_RBA1
, "L2U_RBA1",
2392 SPR_NOACCESS
, SPR_NOACCESS
,
2393 &spr_read_generic
, &spr_write_generic
,
2395 /* XXX : not implemented */
2396 spr_register(env
, SPR_RCPU_L2U_RBA2
, "L2U_RBA2",
2397 SPR_NOACCESS
, SPR_NOACCESS
,
2398 &spr_read_generic
, &spr_write_generic
,
2400 /* XXX : not implemented */
2401 spr_register(env
, SPR_RCPU_L2U_RBA3
, "L2U_RBA3",
2402 SPR_NOACCESS
, SPR_NOACCESS
,
2403 &spr_read_generic
, &spr_write_generic
,
2405 /* XXX : not implemented */
2406 spr_register(env
, SPR_RCPU_MI_RA0
, "MI_RA0",
2407 SPR_NOACCESS
, SPR_NOACCESS
,
2408 &spr_read_generic
, &spr_write_generic
,
2410 /* XXX : not implemented */
2411 spr_register(env
, SPR_RCPU_MI_RA1
, "MI_RA1",
2412 SPR_NOACCESS
, SPR_NOACCESS
,
2413 &spr_read_generic
, &spr_write_generic
,
2415 /* XXX : not implemented */
2416 spr_register(env
, SPR_RCPU_MI_RA2
, "MI_RA2",
2417 SPR_NOACCESS
, SPR_NOACCESS
,
2418 &spr_read_generic
, &spr_write_generic
,
2420 /* XXX : not implemented */
2421 spr_register(env
, SPR_RCPU_MI_RA3
, "MI_RA3",
2422 SPR_NOACCESS
, SPR_NOACCESS
,
2423 &spr_read_generic
, &spr_write_generic
,
2425 /* XXX : not implemented */
2426 spr_register(env
, SPR_RCPU_L2U_RA0
, "L2U_RA0",
2427 SPR_NOACCESS
, SPR_NOACCESS
,
2428 &spr_read_generic
, &spr_write_generic
,
2430 /* XXX : not implemented */
2431 spr_register(env
, SPR_RCPU_L2U_RA1
, "L2U_RA1",
2432 SPR_NOACCESS
, SPR_NOACCESS
,
2433 &spr_read_generic
, &spr_write_generic
,
2435 /* XXX : not implemented */
2436 spr_register(env
, SPR_RCPU_L2U_RA2
, "L2U_RA2",
2437 SPR_NOACCESS
, SPR_NOACCESS
,
2438 &spr_read_generic
, &spr_write_generic
,
2440 /* XXX : not implemented */
2441 spr_register(env
, SPR_RCPU_L2U_RA3
, "L2U_RA3",
2442 SPR_NOACCESS
, SPR_NOACCESS
,
2443 &spr_read_generic
, &spr_write_generic
,
2445 /* XXX : not implemented */
2446 spr_register(env
, SPR_RCPU_FPECR
, "FPECR",
2447 SPR_NOACCESS
, SPR_NOACCESS
,
2448 &spr_read_generic
, &spr_write_generic
,
2452 static void gen_spr_8xx (CPUPPCState
*env
)
2454 /* XXX : not implemented */
2455 spr_register(env
, SPR_MPC_IC_CST
, "IC_CST",
2456 SPR_NOACCESS
, SPR_NOACCESS
,
2457 &spr_read_generic
, &spr_write_generic
,
2459 /* XXX : not implemented */
2460 spr_register(env
, SPR_MPC_IC_ADR
, "IC_ADR",
2461 SPR_NOACCESS
, SPR_NOACCESS
,
2462 &spr_read_generic
, &spr_write_generic
,
2464 /* XXX : not implemented */
2465 spr_register(env
, SPR_MPC_IC_DAT
, "IC_DAT",
2466 SPR_NOACCESS
, SPR_NOACCESS
,
2467 &spr_read_generic
, &spr_write_generic
,
2469 /* XXX : not implemented */
2470 spr_register(env
, SPR_MPC_DC_CST
, "DC_CST",
2471 SPR_NOACCESS
, SPR_NOACCESS
,
2472 &spr_read_generic
, &spr_write_generic
,
2474 /* XXX : not implemented */
2475 spr_register(env
, SPR_MPC_DC_ADR
, "DC_ADR",
2476 SPR_NOACCESS
, SPR_NOACCESS
,
2477 &spr_read_generic
, &spr_write_generic
,
2479 /* XXX : not implemented */
2480 spr_register(env
, SPR_MPC_DC_DAT
, "DC_DAT",
2481 SPR_NOACCESS
, SPR_NOACCESS
,
2482 &spr_read_generic
, &spr_write_generic
,
2484 /* XXX : not implemented */
2485 spr_register(env
, SPR_MPC_MI_CTR
, "MI_CTR",
2486 SPR_NOACCESS
, SPR_NOACCESS
,
2487 &spr_read_generic
, &spr_write_generic
,
2489 /* XXX : not implemented */
2490 spr_register(env
, SPR_MPC_MI_AP
, "MI_AP",
2491 SPR_NOACCESS
, SPR_NOACCESS
,
2492 &spr_read_generic
, &spr_write_generic
,
2494 /* XXX : not implemented */
2495 spr_register(env
, SPR_MPC_MI_EPN
, "MI_EPN",
2496 SPR_NOACCESS
, SPR_NOACCESS
,
2497 &spr_read_generic
, &spr_write_generic
,
2499 /* XXX : not implemented */
2500 spr_register(env
, SPR_MPC_MI_TWC
, "MI_TWC",
2501 SPR_NOACCESS
, SPR_NOACCESS
,
2502 &spr_read_generic
, &spr_write_generic
,
2504 /* XXX : not implemented */
2505 spr_register(env
, SPR_MPC_MI_RPN
, "MI_RPN",
2506 SPR_NOACCESS
, SPR_NOACCESS
,
2507 &spr_read_generic
, &spr_write_generic
,
2509 /* XXX : not implemented */
2510 spr_register(env
, SPR_MPC_MI_DBCAM
, "MI_DBCAM",
2511 SPR_NOACCESS
, SPR_NOACCESS
,
2512 &spr_read_generic
, &spr_write_generic
,
2514 /* XXX : not implemented */
2515 spr_register(env
, SPR_MPC_MI_DBRAM0
, "MI_DBRAM0",
2516 SPR_NOACCESS
, SPR_NOACCESS
,
2517 &spr_read_generic
, &spr_write_generic
,
2519 /* XXX : not implemented */
2520 spr_register(env
, SPR_MPC_MI_DBRAM1
, "MI_DBRAM1",
2521 SPR_NOACCESS
, SPR_NOACCESS
,
2522 &spr_read_generic
, &spr_write_generic
,
2524 /* XXX : not implemented */
2525 spr_register(env
, SPR_MPC_MD_CTR
, "MD_CTR",
2526 SPR_NOACCESS
, SPR_NOACCESS
,
2527 &spr_read_generic
, &spr_write_generic
,
2529 /* XXX : not implemented */
2530 spr_register(env
, SPR_MPC_MD_CASID
, "MD_CASID",
2531 SPR_NOACCESS
, SPR_NOACCESS
,
2532 &spr_read_generic
, &spr_write_generic
,
2534 /* XXX : not implemented */
2535 spr_register(env
, SPR_MPC_MD_AP
, "MD_AP",
2536 SPR_NOACCESS
, SPR_NOACCESS
,
2537 &spr_read_generic
, &spr_write_generic
,
2539 /* XXX : not implemented */
2540 spr_register(env
, SPR_MPC_MD_EPN
, "MD_EPN",
2541 SPR_NOACCESS
, SPR_NOACCESS
,
2542 &spr_read_generic
, &spr_write_generic
,
2544 /* XXX : not implemented */
2545 spr_register(env
, SPR_MPC_MD_TWB
, "MD_TWB",
2546 SPR_NOACCESS
, SPR_NOACCESS
,
2547 &spr_read_generic
, &spr_write_generic
,
2549 /* XXX : not implemented */
2550 spr_register(env
, SPR_MPC_MD_TWC
, "MD_TWC",
2551 SPR_NOACCESS
, SPR_NOACCESS
,
2552 &spr_read_generic
, &spr_write_generic
,
2554 /* XXX : not implemented */
2555 spr_register(env
, SPR_MPC_MD_RPN
, "MD_RPN",
2556 SPR_NOACCESS
, SPR_NOACCESS
,
2557 &spr_read_generic
, &spr_write_generic
,
2559 /* XXX : not implemented */
2560 spr_register(env
, SPR_MPC_MD_TW
, "MD_TW",
2561 SPR_NOACCESS
, SPR_NOACCESS
,
2562 &spr_read_generic
, &spr_write_generic
,
2564 /* XXX : not implemented */
2565 spr_register(env
, SPR_MPC_MD_DBCAM
, "MD_DBCAM",
2566 SPR_NOACCESS
, SPR_NOACCESS
,
2567 &spr_read_generic
, &spr_write_generic
,
2569 /* XXX : not implemented */
2570 spr_register(env
, SPR_MPC_MD_DBRAM0
, "MD_DBRAM0",
2571 SPR_NOACCESS
, SPR_NOACCESS
,
2572 &spr_read_generic
, &spr_write_generic
,
2574 /* XXX : not implemented */
2575 spr_register(env
, SPR_MPC_MD_DBRAM1
, "MD_DBRAM1",
2576 SPR_NOACCESS
, SPR_NOACCESS
,
2577 &spr_read_generic
, &spr_write_generic
,
2583 * AMR => SPR 29 (Power 2.04)
2584 * CTRL => SPR 136 (Power 2.04)
2585 * CTRL => SPR 152 (Power 2.04)
2586 * SCOMC => SPR 276 (64 bits ?)
2587 * SCOMD => SPR 277 (64 bits ?)
2588 * TBU40 => SPR 286 (Power 2.04 hypv)
2589 * HSPRG0 => SPR 304 (Power 2.04 hypv)
2590 * HSPRG1 => SPR 305 (Power 2.04 hypv)
2591 * HDSISR => SPR 306 (Power 2.04 hypv)
2592 * HDAR => SPR 307 (Power 2.04 hypv)
2593 * PURR => SPR 309 (Power 2.04 hypv)
2594 * HDEC => SPR 310 (Power 2.04 hypv)
2595 * HIOR => SPR 311 (hypv)
2596 * RMOR => SPR 312 (970)
2597 * HRMOR => SPR 313 (Power 2.04 hypv)
2598 * HSRR0 => SPR 314 (Power 2.04 hypv)
2599 * HSRR1 => SPR 315 (Power 2.04 hypv)
2600 * LPIDR => SPR 317 (970)
2601 * EPR => SPR 702 (Power 2.04 emb)
2602 * perf => 768-783 (Power 2.04)
2603 * perf => 784-799 (Power 2.04)
2604 * PPR => SPR 896 (Power 2.04)
2605 * EPLC => SPR 947 (Power 2.04 emb)
2606 * EPSC => SPR 948 (Power 2.04 emb)
2607 * DABRX => 1015 (Power 2.04 hypv)
2608 * FPECR => SPR 1022 (?)
2609 * ... and more (thermal management, performance counters, ...)
2612 /*****************************************************************************/
2613 /* Exception vectors models */
2614 static void init_excp_4xx_real (CPUPPCState
*env
)
2616 #if !defined(CONFIG_USER_ONLY)
2617 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2618 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2619 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2620 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2621 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2622 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2623 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2624 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2625 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2626 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2627 env
->ivor_mask
= 0x0000FFF0UL
;
2628 env
->ivpr_mask
= 0xFFFF0000UL
;
2629 /* Hardware reset vector */
2630 env
->hreset_vector
= 0xFFFFFFFCUL
;
2634 static void init_excp_4xx_softmmu (CPUPPCState
*env
)
2636 #if !defined(CONFIG_USER_ONLY)
2637 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2638 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2639 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2640 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2641 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2642 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2643 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2644 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2645 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2646 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2647 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2648 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001100;
2649 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001200;
2650 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2651 env
->ivor_mask
= 0x0000FFF0UL
;
2652 env
->ivpr_mask
= 0xFFFF0000UL
;
2653 /* Hardware reset vector */
2654 env
->hreset_vector
= 0xFFFFFFFCUL
;
2658 static void init_excp_MPC5xx (CPUPPCState
*env
)
2660 #if !defined(CONFIG_USER_ONLY)
2661 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2662 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2663 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2664 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2665 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2666 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2667 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2668 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2669 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2670 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2671 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2672 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2673 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2674 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2675 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2676 env
->ivor_mask
= 0x0000FFF0UL
;
2677 env
->ivpr_mask
= 0xFFFF0000UL
;
2678 /* Hardware reset vector */
2679 env
->hreset_vector
= 0x00000100UL
;
2683 static void init_excp_MPC8xx (CPUPPCState
*env
)
2685 #if !defined(CONFIG_USER_ONLY)
2686 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2687 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2688 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2689 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2690 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2691 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2692 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2693 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2694 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2695 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2696 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2697 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2698 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2699 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001100;
2700 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001200;
2701 env
->excp_vectors
[POWERPC_EXCP_ITLBE
] = 0x00001300;
2702 env
->excp_vectors
[POWERPC_EXCP_DTLBE
] = 0x00001400;
2703 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2704 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2705 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2706 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2707 env
->ivor_mask
= 0x0000FFF0UL
;
2708 env
->ivpr_mask
= 0xFFFF0000UL
;
2709 /* Hardware reset vector */
2710 env
->hreset_vector
= 0x00000100UL
;
2714 static void init_excp_G2 (CPUPPCState
*env
)
2716 #if !defined(CONFIG_USER_ONLY)
2717 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2718 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2719 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2720 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2721 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2722 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2723 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2724 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2725 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2726 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000A00;
2727 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2728 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2729 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2730 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2731 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2732 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2733 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2734 /* Hardware reset vector */
2735 env
->hreset_vector
= 0x00000100UL
;
2739 static void init_excp_e200(CPUPPCState
*env
, target_ulong ivpr_mask
)
2741 #if !defined(CONFIG_USER_ONLY)
2742 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000FFC;
2743 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2744 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2745 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2746 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2747 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2748 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2749 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2750 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2751 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2752 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2753 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2754 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2755 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2756 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2757 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2758 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2759 env
->excp_vectors
[POWERPC_EXCP_SPEU
] = 0x00000000;
2760 env
->excp_vectors
[POWERPC_EXCP_EFPDI
] = 0x00000000;
2761 env
->excp_vectors
[POWERPC_EXCP_EFPRI
] = 0x00000000;
2762 env
->ivor_mask
= 0x0000FFF7UL
;
2763 env
->ivpr_mask
= ivpr_mask
;
2764 /* Hardware reset vector */
2765 env
->hreset_vector
= 0xFFFFFFFCUL
;
2769 static void init_excp_BookE (CPUPPCState
*env
)
2771 #if !defined(CONFIG_USER_ONLY)
2772 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2773 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2774 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2775 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2776 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2777 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2778 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2779 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2780 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2781 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2782 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2783 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2784 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2785 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2786 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2787 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2788 env
->ivor_mask
= 0x0000FFE0UL
;
2789 env
->ivpr_mask
= 0xFFFF0000UL
;
2790 /* Hardware reset vector */
2791 env
->hreset_vector
= 0xFFFFFFFCUL
;
2795 static void init_excp_601 (CPUPPCState
*env
)
2797 #if !defined(CONFIG_USER_ONLY)
2798 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2799 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2800 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2801 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2802 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2803 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2804 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2805 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2806 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2807 env
->excp_vectors
[POWERPC_EXCP_IO
] = 0x00000A00;
2808 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2809 env
->excp_vectors
[POWERPC_EXCP_RUNM
] = 0x00002000;
2810 /* Hardware reset vector */
2811 env
->hreset_vector
= 0x00000100UL
;
2815 static void init_excp_602 (CPUPPCState
*env
)
2817 #if !defined(CONFIG_USER_ONLY)
2818 /* XXX: exception prefix has a special behavior on 602 */
2819 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2820 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2821 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2822 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2823 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2824 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2825 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2826 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2827 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2828 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2829 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2830 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2831 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2832 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2833 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2834 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2835 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001500;
2836 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001600;
2837 /* Hardware reset vector */
2838 env
->hreset_vector
= 0x00000100UL
;
2842 static void init_excp_603 (CPUPPCState
*env
)
2844 #if !defined(CONFIG_USER_ONLY)
2845 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2846 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2847 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2848 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2849 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2850 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2851 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2852 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2853 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2854 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2855 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2856 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2857 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2858 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2859 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2860 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2861 /* Hardware reset vector */
2862 env
->hreset_vector
= 0x00000100UL
;
2866 static void init_excp_604 (CPUPPCState
*env
)
2868 #if !defined(CONFIG_USER_ONLY)
2869 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2870 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2871 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2872 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2873 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2874 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2875 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2876 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2877 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2878 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2879 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2880 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2881 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2882 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2883 /* Hardware reset vector */
2884 env
->hreset_vector
= 0x00000100UL
;
2888 static void init_excp_7x0 (CPUPPCState
*env
)
2890 #if !defined(CONFIG_USER_ONLY)
2891 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2892 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2893 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2894 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2895 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2896 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2897 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2898 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2899 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2900 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2901 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2902 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2903 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2904 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2905 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2906 /* Hardware reset vector */
2907 env
->hreset_vector
= 0x00000100UL
;
2911 static void init_excp_750cl (CPUPPCState
*env
)
2913 #if !defined(CONFIG_USER_ONLY)
2914 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2915 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2916 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2917 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2918 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2919 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2920 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2921 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2922 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2923 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2924 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2925 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2926 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2927 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2928 /* Hardware reset vector */
2929 env
->hreset_vector
= 0x00000100UL
;
2933 static void init_excp_750cx (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_DSI
] = 0x00000300;
2939 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2940 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2941 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2942 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2943 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2944 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2945 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2946 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2947 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2948 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2949 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2950 /* Hardware reset vector */
2951 env
->hreset_vector
= 0x00000100UL
;
2955 /* XXX: Check if this is correct */
2956 static void init_excp_7x5 (CPUPPCState
*env
)
2958 #if !defined(CONFIG_USER_ONLY)
2959 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2960 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2961 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2962 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2963 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2964 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2965 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2966 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2967 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2968 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2969 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2970 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2971 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2972 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2973 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2974 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2975 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2976 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2977 /* Hardware reset vector */
2978 env
->hreset_vector
= 0x00000100UL
;
2982 static void init_excp_7400 (CPUPPCState
*env
)
2984 #if !defined(CONFIG_USER_ONLY)
2985 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2986 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2987 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2988 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2989 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2990 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2991 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2992 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2993 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2994 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2995 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2996 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2997 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
2998 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2999 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3000 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3001 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
3002 /* Hardware reset vector */
3003 env
->hreset_vector
= 0x00000100UL
;
3007 static void init_excp_7450 (CPUPPCState
*env
)
3009 #if !defined(CONFIG_USER_ONLY)
3010 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3011 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3012 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3013 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3014 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3015 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3016 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3017 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3018 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3019 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3020 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3021 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3022 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3023 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3024 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3025 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3026 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3027 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3028 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3029 /* Hardware reset vector */
3030 env
->hreset_vector
= 0x00000100UL
;
3034 #if defined (TARGET_PPC64)
3035 static void init_excp_970 (CPUPPCState
*env
)
3037 #if !defined(CONFIG_USER_ONLY)
3038 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3039 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3040 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3041 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3042 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3043 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3044 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3045 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3046 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3047 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3048 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3049 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3050 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3051 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3052 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3053 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3054 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3055 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
3056 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
3057 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
3058 /* Hardware reset vector */
3059 env
->hreset_vector
= 0x0000000000000100ULL
;
3063 static void init_excp_POWER7 (CPUPPCState
*env
)
3065 #if !defined(CONFIG_USER_ONLY)
3066 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3067 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3068 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3069 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3070 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3071 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3072 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3073 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3074 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3075 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3076 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3077 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3078 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3079 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3080 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3081 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3082 env
->excp_vectors
[POWERPC_EXCP_VSXU
] = 0x00000F40;
3083 env
->excp_vectors
[POWERPC_EXCP_FU
] = 0x00000F60;
3084 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3085 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
3086 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
3087 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
3088 /* Hardware reset vector */
3089 env
->hreset_vector
= 0x0000000000000100ULL
;
3094 /*****************************************************************************/
3095 /* Power management enable checks */
3096 static int check_pow_none (CPUPPCState
*env
)
3101 static int check_pow_nocheck (CPUPPCState
*env
)
3106 static int check_pow_hid0 (CPUPPCState
*env
)
3108 if (env
->spr
[SPR_HID0
] & 0x00E00000)
3114 static int check_pow_hid0_74xx (CPUPPCState
*env
)
3116 if (env
->spr
[SPR_HID0
] & 0x00600000)
3122 static bool ppc_cpu_interrupts_big_endian_always(PowerPCCPU
*cpu
)
3128 static bool ppc_cpu_interrupts_big_endian_lpcr(PowerPCCPU
*cpu
)
3130 return !(cpu
->env
.spr
[SPR_LPCR
] & LPCR_ILE
);
3134 /*****************************************************************************/
3135 /* PowerPC implementations definitions */
3137 #define POWERPC_FAMILY(_name) \
3139 glue(glue(ppc_, _name), _cpu_family_class_init)(ObjectClass *, void *); \
3141 static const TypeInfo \
3142 glue(glue(ppc_, _name), _cpu_family_type_info) = { \
3143 .name = stringify(_name) "-family-" TYPE_POWERPC_CPU, \
3144 .parent = TYPE_POWERPC_CPU, \
3146 .class_init = glue(glue(ppc_, _name), _cpu_family_class_init), \
3149 static void glue(glue(ppc_, _name), _cpu_family_register_types)(void) \
3151 type_register_static( \
3152 &glue(glue(ppc_, _name), _cpu_family_type_info)); \
3155 type_init(glue(glue(ppc_, _name), _cpu_family_register_types)) \
3157 static void glue(glue(ppc_, _name), _cpu_family_class_init)
3159 static void init_proc_401 (CPUPPCState
*env
)
3162 gen_spr_401_403(env
);
3164 init_excp_4xx_real(env
);
3165 env
->dcache_line_size
= 32;
3166 env
->icache_line_size
= 32;
3167 /* Allocate hardware IRQ controller */
3168 ppc40x_irq_init(env
);
3170 SET_FIT_PERIOD(12, 16, 20, 24);
3171 SET_WDT_PERIOD(16, 20, 24, 28);
3174 POWERPC_FAMILY(401)(ObjectClass
*oc
, void *data
)
3176 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3177 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3179 dc
->desc
= "PowerPC 401";
3180 pcc
->init_proc
= init_proc_401
;
3181 pcc
->check_pow
= check_pow_nocheck
;
3182 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3183 PPC_WRTEE
| PPC_DCR
|
3184 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3186 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3187 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3188 pcc
->msr_mask
= (1ull << MSR_KEY
) |
3197 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3198 pcc
->excp_model
= POWERPC_EXCP_40x
;
3199 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3200 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3201 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3202 POWERPC_FLAG_BUS_CLK
;
3205 static void init_proc_401x2 (CPUPPCState
*env
)
3208 gen_spr_401_403(env
);
3210 gen_spr_compress(env
);
3211 /* Memory management */
3212 #if !defined(CONFIG_USER_ONLY)
3216 env
->tlb_type
= TLB_EMB
;
3218 init_excp_4xx_softmmu(env
);
3219 env
->dcache_line_size
= 32;
3220 env
->icache_line_size
= 32;
3221 /* Allocate hardware IRQ controller */
3222 ppc40x_irq_init(env
);
3224 SET_FIT_PERIOD(12, 16, 20, 24);
3225 SET_WDT_PERIOD(16, 20, 24, 28);
3228 POWERPC_FAMILY(401x2
)(ObjectClass
*oc
, void *data
)
3230 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3231 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3233 dc
->desc
= "PowerPC 401x2";
3234 pcc
->init_proc
= init_proc_401x2
;
3235 pcc
->check_pow
= check_pow_nocheck
;
3236 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3237 PPC_DCR
| PPC_WRTEE
|
3238 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3239 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3240 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3241 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3242 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3243 pcc
->msr_mask
= (1ull << 20) |
3255 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3256 pcc
->excp_model
= POWERPC_EXCP_40x
;
3257 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3258 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3259 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3260 POWERPC_FLAG_BUS_CLK
;
3263 static void init_proc_401x3 (CPUPPCState
*env
)
3266 gen_spr_401_403(env
);
3269 gen_spr_compress(env
);
3270 init_excp_4xx_softmmu(env
);
3271 env
->dcache_line_size
= 32;
3272 env
->icache_line_size
= 32;
3273 /* Allocate hardware IRQ controller */
3274 ppc40x_irq_init(env
);
3276 SET_FIT_PERIOD(12, 16, 20, 24);
3277 SET_WDT_PERIOD(16, 20, 24, 28);
3280 POWERPC_FAMILY(401x3
)(ObjectClass
*oc
, void *data
)
3282 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3283 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3285 dc
->desc
= "PowerPC 401x3";
3286 pcc
->init_proc
= init_proc_401x3
;
3287 pcc
->check_pow
= check_pow_nocheck
;
3288 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3289 PPC_DCR
| PPC_WRTEE
|
3290 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3291 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3292 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3293 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3294 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3295 pcc
->msr_mask
= (1ull << 20) |
3308 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3309 pcc
->excp_model
= POWERPC_EXCP_40x
;
3310 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3311 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3312 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3313 POWERPC_FLAG_BUS_CLK
;
3316 static void init_proc_IOP480 (CPUPPCState
*env
)
3319 gen_spr_401_403(env
);
3321 gen_spr_compress(env
);
3322 /* Memory management */
3323 #if !defined(CONFIG_USER_ONLY)
3327 env
->tlb_type
= TLB_EMB
;
3329 init_excp_4xx_softmmu(env
);
3330 env
->dcache_line_size
= 32;
3331 env
->icache_line_size
= 32;
3332 /* Allocate hardware IRQ controller */
3333 ppc40x_irq_init(env
);
3335 SET_FIT_PERIOD(8, 12, 16, 20);
3336 SET_WDT_PERIOD(16, 20, 24, 28);
3339 POWERPC_FAMILY(IOP480
)(ObjectClass
*oc
, void *data
)
3341 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3342 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3344 dc
->desc
= "IOP480";
3345 pcc
->init_proc
= init_proc_IOP480
;
3346 pcc
->check_pow
= check_pow_nocheck
;
3347 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3348 PPC_DCR
| PPC_WRTEE
|
3349 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3350 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3351 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3352 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3353 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3354 pcc
->msr_mask
= (1ull << 20) |
3366 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3367 pcc
->excp_model
= POWERPC_EXCP_40x
;
3368 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3369 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3370 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3371 POWERPC_FLAG_BUS_CLK
;
3374 static void init_proc_403 (CPUPPCState
*env
)
3377 gen_spr_401_403(env
);
3379 gen_spr_403_real(env
);
3380 init_excp_4xx_real(env
);
3381 env
->dcache_line_size
= 32;
3382 env
->icache_line_size
= 32;
3383 /* Allocate hardware IRQ controller */
3384 ppc40x_irq_init(env
);
3386 SET_FIT_PERIOD(8, 12, 16, 20);
3387 SET_WDT_PERIOD(16, 20, 24, 28);
3390 POWERPC_FAMILY(403)(ObjectClass
*oc
, void *data
)
3392 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3393 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3395 dc
->desc
= "PowerPC 403";
3396 pcc
->init_proc
= init_proc_403
;
3397 pcc
->check_pow
= check_pow_nocheck
;
3398 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3399 PPC_DCR
| PPC_WRTEE
|
3400 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3402 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3403 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3404 pcc
->msr_mask
= (1ull << MSR_POW
) |
3413 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3414 pcc
->excp_model
= POWERPC_EXCP_40x
;
3415 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3416 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3417 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3418 POWERPC_FLAG_BUS_CLK
;
3421 static void init_proc_403GCX (CPUPPCState
*env
)
3424 gen_spr_401_403(env
);
3426 gen_spr_403_real(env
);
3427 gen_spr_403_mmu(env
);
3428 /* Bus access control */
3429 /* not emulated, as QEMU never does speculative access */
3430 spr_register(env
, SPR_40x_SGR
, "SGR",
3431 SPR_NOACCESS
, SPR_NOACCESS
,
3432 &spr_read_generic
, &spr_write_generic
,
3434 /* not emulated, as QEMU do not emulate caches */
3435 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3436 SPR_NOACCESS
, SPR_NOACCESS
,
3437 &spr_read_generic
, &spr_write_generic
,
3439 /* Memory management */
3440 #if !defined(CONFIG_USER_ONLY)
3444 env
->tlb_type
= TLB_EMB
;
3446 init_excp_4xx_softmmu(env
);
3447 env
->dcache_line_size
= 32;
3448 env
->icache_line_size
= 32;
3449 /* Allocate hardware IRQ controller */
3450 ppc40x_irq_init(env
);
3452 SET_FIT_PERIOD(8, 12, 16, 20);
3453 SET_WDT_PERIOD(16, 20, 24, 28);
3456 POWERPC_FAMILY(403GCX
)(ObjectClass
*oc
, void *data
)
3458 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3459 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3461 dc
->desc
= "PowerPC 403 GCX";
3462 pcc
->init_proc
= init_proc_403GCX
;
3463 pcc
->check_pow
= check_pow_nocheck
;
3464 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3465 PPC_DCR
| PPC_WRTEE
|
3466 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3468 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3469 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3470 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3471 pcc
->msr_mask
= (1ull << MSR_POW
) |
3480 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3481 pcc
->excp_model
= POWERPC_EXCP_40x
;
3482 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3483 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3484 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3485 POWERPC_FLAG_BUS_CLK
;
3488 static void init_proc_405 (CPUPPCState
*env
)
3494 /* Bus access control */
3495 /* not emulated, as QEMU never does speculative access */
3496 spr_register(env
, SPR_40x_SGR
, "SGR",
3497 SPR_NOACCESS
, SPR_NOACCESS
,
3498 &spr_read_generic
, &spr_write_generic
,
3500 /* not emulated, as QEMU do not emulate caches */
3501 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3502 SPR_NOACCESS
, SPR_NOACCESS
,
3503 &spr_read_generic
, &spr_write_generic
,
3505 /* Memory management */
3506 #if !defined(CONFIG_USER_ONLY)
3510 env
->tlb_type
= TLB_EMB
;
3512 init_excp_4xx_softmmu(env
);
3513 env
->dcache_line_size
= 32;
3514 env
->icache_line_size
= 32;
3515 /* Allocate hardware IRQ controller */
3516 ppc40x_irq_init(env
);
3518 SET_FIT_PERIOD(8, 12, 16, 20);
3519 SET_WDT_PERIOD(16, 20, 24, 28);
3522 POWERPC_FAMILY(405)(ObjectClass
*oc
, void *data
)
3524 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3525 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3527 dc
->desc
= "PowerPC 405";
3528 pcc
->init_proc
= init_proc_405
;
3529 pcc
->check_pow
= check_pow_nocheck
;
3530 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3531 PPC_DCR
| PPC_WRTEE
|
3532 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3533 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3534 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3535 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3536 PPC_4xx_COMMON
| PPC_405_MAC
| PPC_40x_EXCP
;
3537 pcc
->msr_mask
= (1ull << MSR_POW
) |
3546 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx
;
3547 pcc
->excp_model
= POWERPC_EXCP_40x
;
3548 pcc
->bus_model
= PPC_FLAGS_INPUT_405
;
3549 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3550 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3551 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3554 static void init_proc_440EP (CPUPPCState
*env
)
3558 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3560 gen_spr_usprgh(env
);
3561 /* Processor identification */
3562 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3563 SPR_NOACCESS
, SPR_NOACCESS
,
3564 &spr_read_generic
, &spr_write_pir
,
3566 /* XXX : not implemented */
3567 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3568 SPR_NOACCESS
, SPR_NOACCESS
,
3569 &spr_read_generic
, &spr_write_generic
,
3571 /* XXX : not implemented */
3572 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3573 SPR_NOACCESS
, SPR_NOACCESS
,
3574 &spr_read_generic
, &spr_write_generic
,
3576 /* XXX : not implemented */
3577 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3578 SPR_NOACCESS
, SPR_NOACCESS
,
3579 &spr_read_generic
, &spr_write_generic
,
3581 /* XXX : not implemented */
3582 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3583 SPR_NOACCESS
, SPR_NOACCESS
,
3584 &spr_read_generic
, &spr_write_generic
,
3586 /* XXX : not implemented */
3587 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3588 SPR_NOACCESS
, SPR_NOACCESS
,
3589 &spr_read_generic
, &spr_write_generic
,
3591 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3592 SPR_NOACCESS
, SPR_NOACCESS
,
3593 &spr_read_generic
, &spr_write_generic
,
3595 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3596 SPR_NOACCESS
, SPR_NOACCESS
,
3597 &spr_read_generic
, &spr_write_generic
,
3599 /* XXX : not implemented */
3600 spr_register(env
, SPR_440_CCR1
, "CCR1",
3601 SPR_NOACCESS
, SPR_NOACCESS
,
3602 &spr_read_generic
, &spr_write_generic
,
3604 /* Memory management */
3605 #if !defined(CONFIG_USER_ONLY)
3609 env
->tlb_type
= TLB_EMB
;
3611 init_excp_BookE(env
);
3612 env
->dcache_line_size
= 32;
3613 env
->icache_line_size
= 32;
3614 ppc40x_irq_init(env
);
3616 SET_FIT_PERIOD(12, 16, 20, 24);
3617 SET_WDT_PERIOD(20, 24, 28, 32);
3620 POWERPC_FAMILY(440EP
)(ObjectClass
*oc
, void *data
)
3622 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3623 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3625 dc
->desc
= "PowerPC 440 EP";
3626 pcc
->init_proc
= init_proc_440EP
;
3627 pcc
->check_pow
= check_pow_nocheck
;
3628 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3629 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
3630 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
3632 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
3633 PPC_CACHE
| PPC_CACHE_ICBI
|
3634 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3635 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3636 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3638 pcc
->msr_mask
= (1ull << MSR_POW
) |
3650 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3651 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3652 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3653 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3654 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3655 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3658 static void init_proc_440GP (CPUPPCState
*env
)
3662 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3664 gen_spr_usprgh(env
);
3665 /* Processor identification */
3666 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3667 SPR_NOACCESS
, SPR_NOACCESS
,
3668 &spr_read_generic
, &spr_write_pir
,
3670 /* XXX : not implemented */
3671 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3672 SPR_NOACCESS
, SPR_NOACCESS
,
3673 &spr_read_generic
, &spr_write_generic
,
3675 /* XXX : not implemented */
3676 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3677 SPR_NOACCESS
, SPR_NOACCESS
,
3678 &spr_read_generic
, &spr_write_generic
,
3680 /* XXX : not implemented */
3681 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3682 SPR_NOACCESS
, SPR_NOACCESS
,
3683 &spr_read_generic
, &spr_write_generic
,
3685 /* XXX : not implemented */
3686 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3687 SPR_NOACCESS
, SPR_NOACCESS
,
3688 &spr_read_generic
, &spr_write_generic
,
3690 /* Memory management */
3691 #if !defined(CONFIG_USER_ONLY)
3695 env
->tlb_type
= TLB_EMB
;
3697 init_excp_BookE(env
);
3698 env
->dcache_line_size
= 32;
3699 env
->icache_line_size
= 32;
3700 /* XXX: TODO: allocate internal IRQ controller */
3702 SET_FIT_PERIOD(12, 16, 20, 24);
3703 SET_WDT_PERIOD(20, 24, 28, 32);
3706 POWERPC_FAMILY(440GP
)(ObjectClass
*oc
, void *data
)
3708 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3709 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3711 dc
->desc
= "PowerPC 440 GP";
3712 pcc
->init_proc
= init_proc_440GP
;
3713 pcc
->check_pow
= check_pow_nocheck
;
3714 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3715 PPC_DCR
| PPC_DCRX
| PPC_WRTEE
| PPC_MFAPIDI
|
3716 PPC_CACHE
| PPC_CACHE_ICBI
|
3717 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3718 PPC_MEM_TLBSYNC
| PPC_TLBIVA
| PPC_MFTB
|
3719 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3721 pcc
->msr_mask
= (1ull << MSR_POW
) |
3733 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3734 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3735 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3736 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3737 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3738 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3741 static void init_proc_440x4 (CPUPPCState
*env
)
3745 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3747 gen_spr_usprgh(env
);
3748 /* Processor identification */
3749 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3750 SPR_NOACCESS
, SPR_NOACCESS
,
3751 &spr_read_generic
, &spr_write_pir
,
3753 /* XXX : not implemented */
3754 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3755 SPR_NOACCESS
, SPR_NOACCESS
,
3756 &spr_read_generic
, &spr_write_generic
,
3758 /* XXX : not implemented */
3759 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3760 SPR_NOACCESS
, SPR_NOACCESS
,
3761 &spr_read_generic
, &spr_write_generic
,
3763 /* XXX : not implemented */
3764 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3765 SPR_NOACCESS
, SPR_NOACCESS
,
3766 &spr_read_generic
, &spr_write_generic
,
3768 /* XXX : not implemented */
3769 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3770 SPR_NOACCESS
, SPR_NOACCESS
,
3771 &spr_read_generic
, &spr_write_generic
,
3773 /* Memory management */
3774 #if !defined(CONFIG_USER_ONLY)
3778 env
->tlb_type
= TLB_EMB
;
3780 init_excp_BookE(env
);
3781 env
->dcache_line_size
= 32;
3782 env
->icache_line_size
= 32;
3783 /* XXX: TODO: allocate internal IRQ controller */
3785 SET_FIT_PERIOD(12, 16, 20, 24);
3786 SET_WDT_PERIOD(20, 24, 28, 32);
3789 POWERPC_FAMILY(440x4
)(ObjectClass
*oc
, void *data
)
3791 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3792 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3794 dc
->desc
= "PowerPC 440x4";
3795 pcc
->init_proc
= init_proc_440x4
;
3796 pcc
->check_pow
= check_pow_nocheck
;
3797 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3798 PPC_DCR
| PPC_WRTEE
|
3799 PPC_CACHE
| PPC_CACHE_ICBI
|
3800 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3801 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3802 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3804 pcc
->msr_mask
= (1ull << MSR_POW
) |
3816 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3817 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3818 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3819 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3820 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3821 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3824 static void init_proc_440x5 (CPUPPCState
*env
)
3828 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3830 gen_spr_usprgh(env
);
3831 /* Processor identification */
3832 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3833 SPR_NOACCESS
, SPR_NOACCESS
,
3834 &spr_read_generic
, &spr_write_pir
,
3836 /* XXX : not implemented */
3837 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3838 SPR_NOACCESS
, SPR_NOACCESS
,
3839 &spr_read_generic
, &spr_write_generic
,
3841 /* XXX : not implemented */
3842 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3843 SPR_NOACCESS
, SPR_NOACCESS
,
3844 &spr_read_generic
, &spr_write_generic
,
3846 /* XXX : not implemented */
3847 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3848 SPR_NOACCESS
, SPR_NOACCESS
,
3849 &spr_read_generic
, &spr_write_generic
,
3851 /* XXX : not implemented */
3852 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3853 SPR_NOACCESS
, SPR_NOACCESS
,
3854 &spr_read_generic
, &spr_write_generic
,
3856 /* XXX : not implemented */
3857 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3858 SPR_NOACCESS
, SPR_NOACCESS
,
3859 &spr_read_generic
, &spr_write_generic
,
3861 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3862 SPR_NOACCESS
, SPR_NOACCESS
,
3863 &spr_read_generic
, &spr_write_generic
,
3865 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3866 SPR_NOACCESS
, SPR_NOACCESS
,
3867 &spr_read_generic
, &spr_write_generic
,
3869 /* XXX : not implemented */
3870 spr_register(env
, SPR_440_CCR1
, "CCR1",
3871 SPR_NOACCESS
, SPR_NOACCESS
,
3872 &spr_read_generic
, &spr_write_generic
,
3874 /* Memory management */
3875 #if !defined(CONFIG_USER_ONLY)
3879 env
->tlb_type
= TLB_EMB
;
3881 init_excp_BookE(env
);
3882 env
->dcache_line_size
= 32;
3883 env
->icache_line_size
= 32;
3884 ppc40x_irq_init(env
);
3886 SET_FIT_PERIOD(12, 16, 20, 24);
3887 SET_WDT_PERIOD(20, 24, 28, 32);
3890 POWERPC_FAMILY(440x5
)(ObjectClass
*oc
, void *data
)
3892 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3893 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3895 dc
->desc
= "PowerPC 440x5";
3896 pcc
->init_proc
= init_proc_440x5
;
3897 pcc
->check_pow
= check_pow_nocheck
;
3898 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3899 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
3900 PPC_CACHE
| PPC_CACHE_ICBI
|
3901 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3902 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3903 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3905 pcc
->msr_mask
= (1ull << MSR_POW
) |
3917 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3918 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3919 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3920 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3921 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3922 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3925 static void init_proc_460 (CPUPPCState
*env
)
3929 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3931 gen_spr_usprgh(env
);
3932 /* Processor identification */
3933 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3934 SPR_NOACCESS
, SPR_NOACCESS
,
3935 &spr_read_generic
, &spr_write_pir
,
3937 /* XXX : not implemented */
3938 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3939 SPR_NOACCESS
, SPR_NOACCESS
,
3940 &spr_read_generic
, &spr_write_generic
,
3942 /* XXX : not implemented */
3943 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3944 SPR_NOACCESS
, SPR_NOACCESS
,
3945 &spr_read_generic
, &spr_write_generic
,
3947 /* XXX : not implemented */
3948 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3949 SPR_NOACCESS
, SPR_NOACCESS
,
3950 &spr_read_generic
, &spr_write_generic
,
3952 /* XXX : not implemented */
3953 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3954 SPR_NOACCESS
, SPR_NOACCESS
,
3955 &spr_read_generic
, &spr_write_generic
,
3957 /* XXX : not implemented */
3958 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3959 SPR_NOACCESS
, SPR_NOACCESS
,
3960 &spr_read_generic
, &spr_write_generic
,
3962 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3963 SPR_NOACCESS
, SPR_NOACCESS
,
3964 &spr_read_generic
, &spr_write_generic
,
3966 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3967 SPR_NOACCESS
, SPR_NOACCESS
,
3968 &spr_read_generic
, &spr_write_generic
,
3970 /* XXX : not implemented */
3971 spr_register(env
, SPR_440_CCR1
, "CCR1",
3972 SPR_NOACCESS
, SPR_NOACCESS
,
3973 &spr_read_generic
, &spr_write_generic
,
3975 /* XXX : not implemented */
3976 spr_register(env
, SPR_DCRIPR
, "SPR_DCRIPR",
3977 &spr_read_generic
, &spr_write_generic
,
3978 &spr_read_generic
, &spr_write_generic
,
3980 /* Memory management */
3981 #if !defined(CONFIG_USER_ONLY)
3985 env
->tlb_type
= TLB_EMB
;
3987 init_excp_BookE(env
);
3988 env
->dcache_line_size
= 32;
3989 env
->icache_line_size
= 32;
3990 /* XXX: TODO: allocate internal IRQ controller */
3992 SET_FIT_PERIOD(12, 16, 20, 24);
3993 SET_WDT_PERIOD(20, 24, 28, 32);
3996 POWERPC_FAMILY(460)(ObjectClass
*oc
, void *data
)
3998 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3999 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4001 dc
->desc
= "PowerPC 460 (guessed)";
4002 pcc
->init_proc
= init_proc_460
;
4003 pcc
->check_pow
= check_pow_nocheck
;
4004 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4005 PPC_DCR
| PPC_DCRX
| PPC_DCRUX
|
4006 PPC_WRTEE
| PPC_MFAPIDI
| PPC_MFTB
|
4007 PPC_CACHE
| PPC_CACHE_ICBI
|
4008 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4009 PPC_MEM_TLBSYNC
| PPC_TLBIVA
|
4010 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4012 pcc
->msr_mask
= (1ull << MSR_POW
) |
4024 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4025 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4026 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4027 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4028 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4029 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4032 static void init_proc_460F (CPUPPCState
*env
)
4036 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4038 gen_spr_usprgh(env
);
4039 /* Processor identification */
4040 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4041 SPR_NOACCESS
, SPR_NOACCESS
,
4042 &spr_read_generic
, &spr_write_pir
,
4044 /* XXX : not implemented */
4045 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4046 SPR_NOACCESS
, SPR_NOACCESS
,
4047 &spr_read_generic
, &spr_write_generic
,
4049 /* XXX : not implemented */
4050 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4051 SPR_NOACCESS
, SPR_NOACCESS
,
4052 &spr_read_generic
, &spr_write_generic
,
4054 /* XXX : not implemented */
4055 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4056 SPR_NOACCESS
, SPR_NOACCESS
,
4057 &spr_read_generic
, &spr_write_generic
,
4059 /* XXX : not implemented */
4060 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4061 SPR_NOACCESS
, SPR_NOACCESS
,
4062 &spr_read_generic
, &spr_write_generic
,
4064 /* XXX : not implemented */
4065 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4066 SPR_NOACCESS
, SPR_NOACCESS
,
4067 &spr_read_generic
, &spr_write_generic
,
4069 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4070 SPR_NOACCESS
, SPR_NOACCESS
,
4071 &spr_read_generic
, &spr_write_generic
,
4073 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4074 SPR_NOACCESS
, SPR_NOACCESS
,
4075 &spr_read_generic
, &spr_write_generic
,
4077 /* XXX : not implemented */
4078 spr_register(env
, SPR_440_CCR1
, "CCR1",
4079 SPR_NOACCESS
, SPR_NOACCESS
,
4080 &spr_read_generic
, &spr_write_generic
,
4082 /* XXX : not implemented */
4083 spr_register(env
, SPR_DCRIPR
, "SPR_DCRIPR",
4084 &spr_read_generic
, &spr_write_generic
,
4085 &spr_read_generic
, &spr_write_generic
,
4087 /* Memory management */
4088 #if !defined(CONFIG_USER_ONLY)
4092 env
->tlb_type
= TLB_EMB
;
4094 init_excp_BookE(env
);
4095 env
->dcache_line_size
= 32;
4096 env
->icache_line_size
= 32;
4097 /* XXX: TODO: allocate internal IRQ controller */
4099 SET_FIT_PERIOD(12, 16, 20, 24);
4100 SET_WDT_PERIOD(20, 24, 28, 32);
4103 POWERPC_FAMILY(460F
)(ObjectClass
*oc
, void *data
)
4105 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4106 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4108 dc
->desc
= "PowerPC 460F (guessed)";
4109 pcc
->init_proc
= init_proc_460F
;
4110 pcc
->check_pow
= check_pow_nocheck
;
4111 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4112 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
4113 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
4114 PPC_FLOAT_STFIWX
| PPC_MFTB
|
4115 PPC_DCR
| PPC_DCRX
| PPC_DCRUX
|
4116 PPC_WRTEE
| PPC_MFAPIDI
|
4117 PPC_CACHE
| PPC_CACHE_ICBI
|
4118 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4119 PPC_MEM_TLBSYNC
| PPC_TLBIVA
|
4120 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4122 pcc
->msr_mask
= (1ull << MSR_POW
) |
4134 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4135 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4136 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4137 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4138 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4139 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4142 static void init_proc_MPC5xx (CPUPPCState
*env
)
4146 gen_spr_5xx_8xx(env
);
4148 init_excp_MPC5xx(env
);
4149 env
->dcache_line_size
= 32;
4150 env
->icache_line_size
= 32;
4151 /* XXX: TODO: allocate internal IRQ controller */
4154 POWERPC_FAMILY(MPC5xx
)(ObjectClass
*oc
, void *data
)
4156 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4157 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4159 dc
->desc
= "Freescale 5xx cores (aka RCPU)";
4160 pcc
->init_proc
= init_proc_MPC5xx
;
4161 pcc
->check_pow
= check_pow_none
;
4162 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4163 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4164 PPC_CACHE_ICBI
| PPC_FLOAT
| PPC_FLOAT_STFIWX
|
4166 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4178 pcc
->mmu_model
= POWERPC_MMU_REAL
;
4179 pcc
->excp_model
= POWERPC_EXCP_603
;
4180 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4181 pcc
->bfd_mach
= bfd_mach_ppc_505
;
4182 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4183 POWERPC_FLAG_BUS_CLK
;
4186 static void init_proc_MPC8xx (CPUPPCState
*env
)
4190 gen_spr_5xx_8xx(env
);
4192 init_excp_MPC8xx(env
);
4193 env
->dcache_line_size
= 32;
4194 env
->icache_line_size
= 32;
4195 /* XXX: TODO: allocate internal IRQ controller */
4198 POWERPC_FAMILY(MPC8xx
)(ObjectClass
*oc
, void *data
)
4200 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4201 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4203 dc
->desc
= "Freescale 8xx cores (aka PowerQUICC)";
4204 pcc
->init_proc
= init_proc_MPC8xx
;
4205 pcc
->check_pow
= check_pow_none
;
4206 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4207 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4208 PPC_CACHE_ICBI
| PPC_MFTB
;
4209 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4221 pcc
->mmu_model
= POWERPC_MMU_MPC8xx
;
4222 pcc
->excp_model
= POWERPC_EXCP_603
;
4223 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4224 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4225 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4226 POWERPC_FLAG_BUS_CLK
;
4229 /* Freescale 82xx cores (aka PowerQUICC-II) */
4231 static void init_proc_G2 (CPUPPCState
*env
)
4233 gen_spr_ne_601(env
);
4234 gen_spr_G2_755(env
);
4238 /* External access control */
4239 /* XXX : not implemented */
4240 spr_register(env
, SPR_EAR
, "EAR",
4241 SPR_NOACCESS
, SPR_NOACCESS
,
4242 &spr_read_generic
, &spr_write_generic
,
4244 /* Hardware implementation register */
4245 /* XXX : not implemented */
4246 spr_register(env
, SPR_HID0
, "HID0",
4247 SPR_NOACCESS
, SPR_NOACCESS
,
4248 &spr_read_generic
, &spr_write_generic
,
4250 /* XXX : not implemented */
4251 spr_register(env
, SPR_HID1
, "HID1",
4252 SPR_NOACCESS
, SPR_NOACCESS
,
4253 &spr_read_generic
, &spr_write_generic
,
4255 /* XXX : not implemented */
4256 spr_register(env
, SPR_HID2
, "HID2",
4257 SPR_NOACCESS
, SPR_NOACCESS
,
4258 &spr_read_generic
, &spr_write_generic
,
4260 /* Memory management */
4263 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4265 env
->dcache_line_size
= 32;
4266 env
->icache_line_size
= 32;
4267 /* Allocate hardware IRQ controller */
4268 ppc6xx_irq_init(env
);
4271 POWERPC_FAMILY(G2
)(ObjectClass
*oc
, void *data
)
4273 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4274 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4276 dc
->desc
= "PowerPC G2";
4277 pcc
->init_proc
= init_proc_G2
;
4278 pcc
->check_pow
= check_pow_hid0
;
4279 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4280 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4282 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4283 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4284 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4285 PPC_SEGMENT
| PPC_EXTERN
;
4286 pcc
->msr_mask
= (1ull << MSR_POW
) |
4287 (1ull << MSR_TGPR
) |
4301 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4302 pcc
->excp_model
= POWERPC_EXCP_G2
;
4303 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4304 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4305 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4306 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4309 static void init_proc_G2LE (CPUPPCState
*env
)
4311 gen_spr_ne_601(env
);
4312 gen_spr_G2_755(env
);
4316 /* External access control */
4317 /* XXX : not implemented */
4318 spr_register(env
, SPR_EAR
, "EAR",
4319 SPR_NOACCESS
, SPR_NOACCESS
,
4320 &spr_read_generic
, &spr_write_generic
,
4322 /* Hardware implementation register */
4323 /* XXX : not implemented */
4324 spr_register(env
, SPR_HID0
, "HID0",
4325 SPR_NOACCESS
, SPR_NOACCESS
,
4326 &spr_read_generic
, &spr_write_generic
,
4328 /* XXX : not implemented */
4329 spr_register(env
, SPR_HID1
, "HID1",
4330 SPR_NOACCESS
, SPR_NOACCESS
,
4331 &spr_read_generic
, &spr_write_generic
,
4333 /* XXX : not implemented */
4334 spr_register(env
, SPR_HID2
, "HID2",
4335 SPR_NOACCESS
, SPR_NOACCESS
,
4336 &spr_read_generic
, &spr_write_generic
,
4339 /* XXX : not implemented */
4340 spr_register(env
, SPR_DABR
, "DABR",
4341 SPR_NOACCESS
, SPR_NOACCESS
,
4342 &spr_read_generic
, &spr_write_generic
,
4344 /* XXX : not implemented */
4345 spr_register(env
, SPR_DABR2
, "DABR2",
4346 SPR_NOACCESS
, SPR_NOACCESS
,
4347 &spr_read_generic
, &spr_write_generic
,
4349 /* XXX : not implemented */
4350 spr_register(env
, SPR_IABR2
, "IABR2",
4351 SPR_NOACCESS
, SPR_NOACCESS
,
4352 &spr_read_generic
, &spr_write_generic
,
4354 /* XXX : not implemented */
4355 spr_register(env
, SPR_IBCR
, "IBCR",
4356 SPR_NOACCESS
, SPR_NOACCESS
,
4357 &spr_read_generic
, &spr_write_generic
,
4359 /* XXX : not implemented */
4360 spr_register(env
, SPR_DBCR
, "DBCR",
4361 SPR_NOACCESS
, SPR_NOACCESS
,
4362 &spr_read_generic
, &spr_write_generic
,
4365 /* Memory management */
4368 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4370 env
->dcache_line_size
= 32;
4371 env
->icache_line_size
= 32;
4372 /* Allocate hardware IRQ controller */
4373 ppc6xx_irq_init(env
);
4376 POWERPC_FAMILY(G2LE
)(ObjectClass
*oc
, void *data
)
4378 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4379 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4381 dc
->desc
= "PowerPC G2LE";
4382 pcc
->init_proc
= init_proc_G2LE
;
4383 pcc
->check_pow
= check_pow_hid0
;
4384 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4385 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4387 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4388 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4389 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4390 PPC_SEGMENT
| PPC_EXTERN
;
4391 pcc
->msr_mask
= (1ull << MSR_POW
) |
4392 (1ull << MSR_TGPR
) |
4408 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4409 pcc
->excp_model
= POWERPC_EXCP_G2
;
4410 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4411 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4412 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4413 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4416 static void init_proc_e200 (CPUPPCState
*env
)
4420 gen_spr_BookE(env
, 0x000000070000FFFFULL
);
4421 /* XXX : not implemented */
4422 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4423 &spr_read_spefscr
, &spr_write_spefscr
,
4424 &spr_read_spefscr
, &spr_write_spefscr
,
4426 /* Memory management */
4427 gen_spr_BookE206(env
, 0x0000005D, NULL
);
4428 /* XXX : not implemented */
4429 spr_register(env
, SPR_HID0
, "HID0",
4430 SPR_NOACCESS
, SPR_NOACCESS
,
4431 &spr_read_generic
, &spr_write_generic
,
4433 /* XXX : not implemented */
4434 spr_register(env
, SPR_HID1
, "HID1",
4435 SPR_NOACCESS
, SPR_NOACCESS
,
4436 &spr_read_generic
, &spr_write_generic
,
4438 /* XXX : not implemented */
4439 spr_register(env
, SPR_Exxx_ALTCTXCR
, "ALTCTXCR",
4440 SPR_NOACCESS
, SPR_NOACCESS
,
4441 &spr_read_generic
, &spr_write_generic
,
4443 /* XXX : not implemented */
4444 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4445 SPR_NOACCESS
, SPR_NOACCESS
,
4446 &spr_read_generic
, &spr_write_generic
,
4448 /* XXX : not implemented */
4449 spr_register(env
, SPR_Exxx_CTXCR
, "CTXCR",
4450 SPR_NOACCESS
, SPR_NOACCESS
,
4451 &spr_read_generic
, &spr_write_generic
,
4453 /* XXX : not implemented */
4454 spr_register(env
, SPR_Exxx_DBCNT
, "DBCNT",
4455 SPR_NOACCESS
, SPR_NOACCESS
,
4456 &spr_read_generic
, &spr_write_generic
,
4458 /* XXX : not implemented */
4459 spr_register(env
, SPR_Exxx_DBCR3
, "DBCR3",
4460 SPR_NOACCESS
, SPR_NOACCESS
,
4461 &spr_read_generic
, &spr_write_generic
,
4463 /* XXX : not implemented */
4464 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4465 &spr_read_generic
, SPR_NOACCESS
,
4466 &spr_read_generic
, SPR_NOACCESS
,
4468 /* XXX : not implemented */
4469 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4470 SPR_NOACCESS
, SPR_NOACCESS
,
4471 &spr_read_generic
, &spr_write_generic
,
4473 /* XXX : not implemented */
4474 spr_register(env
, SPR_Exxx_L1FINV0
, "L1FINV0",
4475 SPR_NOACCESS
, SPR_NOACCESS
,
4476 &spr_read_generic
, &spr_write_generic
,
4478 /* XXX : not implemented */
4479 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
4480 SPR_NOACCESS
, SPR_NOACCESS
,
4481 &spr_read_generic
, &spr_write_generic
,
4483 /* XXX : not implemented */
4484 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
4485 SPR_NOACCESS
, SPR_NOACCESS
,
4486 &spr_read_generic
, &spr_write_generic
,
4488 /* XXX : not implemented */
4489 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4490 SPR_NOACCESS
, SPR_NOACCESS
,
4491 &spr_read_generic
, &spr_write_generic
,
4493 /* XXX : not implemented */
4494 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4495 SPR_NOACCESS
, SPR_NOACCESS
,
4496 &spr_read_generic
, &spr_write_generic
,
4498 /* XXX : not implemented */
4499 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4500 SPR_NOACCESS
, SPR_NOACCESS
,
4501 &spr_read_generic
, &spr_write_generic
,
4502 0x00000000); /* TOFIX */
4503 spr_register(env
, SPR_BOOKE_DSRR0
, "DSRR0",
4504 SPR_NOACCESS
, SPR_NOACCESS
,
4505 &spr_read_generic
, &spr_write_generic
,
4507 spr_register(env
, SPR_BOOKE_DSRR1
, "DSRR1",
4508 SPR_NOACCESS
, SPR_NOACCESS
,
4509 &spr_read_generic
, &spr_write_generic
,
4511 #if !defined(CONFIG_USER_ONLY)
4515 env
->tlb_type
= TLB_EMB
;
4517 init_excp_e200(env
, 0xFFFF0000UL
);
4518 env
->dcache_line_size
= 32;
4519 env
->icache_line_size
= 32;
4520 /* XXX: TODO: allocate internal IRQ controller */
4523 POWERPC_FAMILY(e200
)(ObjectClass
*oc
, void *data
)
4525 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4526 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4528 dc
->desc
= "e200 core";
4529 pcc
->init_proc
= init_proc_e200
;
4530 pcc
->check_pow
= check_pow_hid0
;
4531 /* XXX: unimplemented instructions:
4538 * all SPE multiply-accumulate instructions
4540 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4541 PPC_SPE
| PPC_SPE_SINGLE
|
4542 PPC_WRTEE
| PPC_RFDI
|
4543 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4544 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4545 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
|
4547 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4561 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4562 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4563 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4564 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4565 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4566 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4567 POWERPC_FLAG_BUS_CLK
;
4570 static void init_proc_e300 (CPUPPCState
*env
)
4572 gen_spr_ne_601(env
);
4576 /* hardware implementation registers */
4577 /* XXX : not implemented */
4578 spr_register(env
, SPR_HID0
, "HID0",
4579 SPR_NOACCESS
, SPR_NOACCESS
,
4580 &spr_read_generic
, &spr_write_generic
,
4582 /* XXX : not implemented */
4583 spr_register(env
, SPR_HID1
, "HID1",
4584 SPR_NOACCESS
, SPR_NOACCESS
,
4585 &spr_read_generic
, &spr_write_generic
,
4587 /* XXX : not implemented */
4588 spr_register(env
, SPR_HID2
, "HID2",
4589 SPR_NOACCESS
, SPR_NOACCESS
,
4590 &spr_read_generic
, &spr_write_generic
,
4592 /* Memory management */
4595 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4597 env
->dcache_line_size
= 32;
4598 env
->icache_line_size
= 32;
4599 /* Allocate hardware IRQ controller */
4600 ppc6xx_irq_init(env
);
4603 POWERPC_FAMILY(e300
)(ObjectClass
*oc
, void *data
)
4605 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4606 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4608 dc
->desc
= "e300 core";
4609 pcc
->init_proc
= init_proc_e300
;
4610 pcc
->check_pow
= check_pow_hid0
;
4611 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4612 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4614 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4615 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4616 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4617 PPC_SEGMENT
| PPC_EXTERN
;
4618 pcc
->msr_mask
= (1ull << MSR_POW
) |
4619 (1ull << MSR_TGPR
) |
4635 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4636 pcc
->excp_model
= POWERPC_EXCP_603
;
4637 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4638 pcc
->bfd_mach
= bfd_mach_ppc_603
;
4639 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4640 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4643 #if !defined(CONFIG_USER_ONLY)
4644 static void spr_write_mas73(void *opaque
, int sprn
, int gprn
)
4646 TCGv val
= tcg_temp_new();
4647 tcg_gen_ext32u_tl(val
, cpu_gpr
[gprn
]);
4648 gen_store_spr(SPR_BOOKE_MAS3
, val
);
4649 tcg_gen_shri_tl(val
, cpu_gpr
[gprn
], 32);
4650 gen_store_spr(SPR_BOOKE_MAS7
, val
);
4654 static void spr_read_mas73(void *opaque
, int gprn
, int sprn
)
4656 TCGv mas7
= tcg_temp_new();
4657 TCGv mas3
= tcg_temp_new();
4658 gen_load_spr(mas7
, SPR_BOOKE_MAS7
);
4659 tcg_gen_shli_tl(mas7
, mas7
, 32);
4660 gen_load_spr(mas3
, SPR_BOOKE_MAS3
);
4661 tcg_gen_or_tl(cpu_gpr
[gprn
], mas3
, mas7
);
4662 tcg_temp_free(mas3
);
4663 tcg_temp_free(mas7
);
4668 enum fsl_e500_version
{
4675 static void init_proc_e500 (CPUPPCState
*env
, int version
)
4677 PowerPCCPU
*cpu
= ppc_env_get_cpu(env
);
4678 uint32_t tlbncfg
[2];
4680 uint64_t ivpr_mask
= 0xFFFF0000ULL
;
4681 uint32_t l1cfg0
= 0x3800 /* 8 ways */
4682 | 0x0020; /* 32 kb */
4683 uint32_t l1cfg1
= 0x3800 /* 8 ways */
4684 | 0x0020; /* 32 kb */
4685 #if !defined(CONFIG_USER_ONLY)
4692 * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't
4693 * complain when accessing them.
4694 * gen_spr_BookE(env, 0x0000000F0000FD7FULL);
4700 ivor_mask
= 0x0000000F0000FFFFULL
;
4704 ivor_mask
= 0x000003FE0000FFFFULL
;
4707 gen_spr_BookE(env
, ivor_mask
);
4708 /* Processor identification */
4709 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4710 SPR_NOACCESS
, SPR_NOACCESS
,
4711 &spr_read_generic
, &spr_write_pir
,
4713 /* XXX : not implemented */
4714 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4715 &spr_read_spefscr
, &spr_write_spefscr
,
4716 &spr_read_spefscr
, &spr_write_spefscr
,
4718 #if !defined(CONFIG_USER_ONLY)
4719 /* Memory management */
4725 tlbncfg
[0] = gen_tlbncfg(2, 1, 1, 0, 256);
4726 tlbncfg
[1] = gen_tlbncfg(16, 1, 9, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4729 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4730 tlbncfg
[1] = gen_tlbncfg(16, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4734 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4735 tlbncfg
[1] = gen_tlbncfg(64, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 64);
4738 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4745 env
->dcache_line_size
= 32;
4746 env
->icache_line_size
= 32;
4750 env
->dcache_line_size
= 64;
4751 env
->icache_line_size
= 64;
4752 l1cfg0
|= 0x1000000; /* 64 byte cache block size */
4753 l1cfg1
|= 0x1000000; /* 64 byte cache block size */
4756 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4758 gen_spr_BookE206(env
, 0x000000DF, tlbncfg
);
4759 /* XXX : not implemented */
4760 spr_register(env
, SPR_HID0
, "HID0",
4761 SPR_NOACCESS
, SPR_NOACCESS
,
4762 &spr_read_generic
, &spr_write_generic
,
4764 /* XXX : not implemented */
4765 spr_register(env
, SPR_HID1
, "HID1",
4766 SPR_NOACCESS
, SPR_NOACCESS
,
4767 &spr_read_generic
, &spr_write_generic
,
4769 /* XXX : not implemented */
4770 spr_register(env
, SPR_Exxx_BBEAR
, "BBEAR",
4771 SPR_NOACCESS
, SPR_NOACCESS
,
4772 &spr_read_generic
, &spr_write_generic
,
4774 /* XXX : not implemented */
4775 spr_register(env
, SPR_Exxx_BBTAR
, "BBTAR",
4776 SPR_NOACCESS
, SPR_NOACCESS
,
4777 &spr_read_generic
, &spr_write_generic
,
4779 /* XXX : not implemented */
4780 spr_register(env
, SPR_Exxx_MCAR
, "MCAR",
4781 SPR_NOACCESS
, SPR_NOACCESS
,
4782 &spr_read_generic
, &spr_write_generic
,
4784 /* XXX : not implemented */
4785 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4786 SPR_NOACCESS
, SPR_NOACCESS
,
4787 &spr_read_generic
, &spr_write_generic
,
4789 /* XXX : not implemented */
4790 spr_register(env
, SPR_Exxx_NPIDR
, "NPIDR",
4791 SPR_NOACCESS
, SPR_NOACCESS
,
4792 &spr_read_generic
, &spr_write_generic
,
4794 /* XXX : not implemented */
4795 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4796 SPR_NOACCESS
, SPR_NOACCESS
,
4797 &spr_read_generic
, &spr_write_generic
,
4799 /* XXX : not implemented */
4800 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4801 &spr_read_generic
, SPR_NOACCESS
,
4802 &spr_read_generic
, SPR_NOACCESS
,
4804 spr_register(env
, SPR_Exxx_L1CFG1
, "L1CFG1",
4805 &spr_read_generic
, SPR_NOACCESS
,
4806 &spr_read_generic
, SPR_NOACCESS
,
4808 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4809 SPR_NOACCESS
, SPR_NOACCESS
,
4810 &spr_read_generic
, &spr_write_e500_l1csr0
,
4812 spr_register(env
, SPR_Exxx_L1CSR1
, "L1CSR1",
4813 SPR_NOACCESS
, SPR_NOACCESS
,
4814 &spr_read_generic
, &spr_write_e500_l1csr1
,
4816 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4817 SPR_NOACCESS
, SPR_NOACCESS
,
4818 &spr_read_generic
, &spr_write_generic
,
4820 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4821 SPR_NOACCESS
, SPR_NOACCESS
,
4822 &spr_read_generic
, &spr_write_generic
,
4824 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4825 SPR_NOACCESS
, SPR_NOACCESS
,
4826 &spr_read_generic
, &spr_write_booke206_mmucsr0
,
4828 spr_register(env
, SPR_BOOKE_EPR
, "EPR",
4829 SPR_NOACCESS
, SPR_NOACCESS
,
4830 &spr_read_generic
, SPR_NOACCESS
,
4832 /* XXX better abstract into Emb.xxx features */
4833 if (version
== fsl_e5500
) {
4834 spr_register(env
, SPR_BOOKE_EPCR
, "EPCR",
4835 SPR_NOACCESS
, SPR_NOACCESS
,
4836 &spr_read_generic
, &spr_write_generic
,
4838 spr_register(env
, SPR_BOOKE_MAS7_MAS3
, "MAS7_MAS3",
4839 SPR_NOACCESS
, SPR_NOACCESS
,
4840 &spr_read_mas73
, &spr_write_mas73
,
4842 ivpr_mask
= (target_ulong
)~0xFFFFULL
;
4845 #if !defined(CONFIG_USER_ONLY)
4847 env
->tlb_type
= TLB_MAS
;
4848 for (i
= 0; i
< BOOKE206_MAX_TLBN
; i
++) {
4849 env
->nb_tlb
+= booke206_tlb_size(env
, i
);
4853 init_excp_e200(env
, ivpr_mask
);
4854 /* Allocate hardware IRQ controller */
4855 ppce500_irq_init(env
);
4858 static void init_proc_e500v1(CPUPPCState
*env
)
4860 init_proc_e500(env
, fsl_e500v1
);
4863 POWERPC_FAMILY(e500v1
)(ObjectClass
*oc
, void *data
)
4865 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4866 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4868 dc
->desc
= "e500v1 core";
4869 pcc
->init_proc
= init_proc_e500v1
;
4870 pcc
->check_pow
= check_pow_hid0
;
4871 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4872 PPC_SPE
| PPC_SPE_SINGLE
|
4873 PPC_WRTEE
| PPC_RFDI
|
4874 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4875 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4876 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
4877 pcc
->insns_flags2
= PPC2_BOOKE206
;
4878 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4892 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4893 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4894 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4895 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4896 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4897 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4898 POWERPC_FLAG_BUS_CLK
;
4901 static void init_proc_e500v2(CPUPPCState
*env
)
4903 init_proc_e500(env
, fsl_e500v2
);
4906 POWERPC_FAMILY(e500v2
)(ObjectClass
*oc
, void *data
)
4908 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4909 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4911 dc
->desc
= "e500v2 core";
4912 pcc
->init_proc
= init_proc_e500v2
;
4913 pcc
->check_pow
= check_pow_hid0
;
4914 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4915 PPC_SPE
| PPC_SPE_SINGLE
| PPC_SPE_DOUBLE
|
4916 PPC_WRTEE
| PPC_RFDI
|
4917 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4918 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4919 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
4920 pcc
->insns_flags2
= PPC2_BOOKE206
;
4921 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4935 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4936 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4937 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4938 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4939 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4940 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4941 POWERPC_FLAG_BUS_CLK
;
4944 static void init_proc_e500mc(CPUPPCState
*env
)
4946 init_proc_e500(env
, fsl_e500mc
);
4949 POWERPC_FAMILY(e500mc
)(ObjectClass
*oc
, void *data
)
4951 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4952 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4954 dc
->desc
= "e500mc core";
4955 pcc
->init_proc
= init_proc_e500mc
;
4956 pcc
->check_pow
= check_pow_none
;
4957 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4958 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
4959 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4960 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4961 PPC_FLOAT
| PPC_FLOAT_FRES
|
4962 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
4963 PPC_FLOAT_STFIWX
| PPC_WAIT
|
4964 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
4965 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
;
4966 pcc
->msr_mask
= (1ull << MSR_GS
) |
4967 (1ull << MSR_UCLE
) |
4980 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4981 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4982 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4983 /* FIXME: figure out the correct flag for e500mc */
4984 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
4985 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
4986 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
4990 static void init_proc_e5500(CPUPPCState
*env
)
4992 init_proc_e500(env
, fsl_e5500
);
4995 POWERPC_FAMILY(e5500
)(ObjectClass
*oc
, void *data
)
4997 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4998 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5000 dc
->desc
= "e5500 core";
5001 pcc
->init_proc
= init_proc_e5500
;
5002 pcc
->check_pow
= check_pow_none
;
5003 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
5004 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
5005 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
5006 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
5007 PPC_FLOAT
| PPC_FLOAT_FRES
|
5008 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
5009 PPC_FLOAT_STFIWX
| PPC_WAIT
|
5010 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
5011 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
;
5012 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
;
5013 pcc
->msr_mask
= (1ull << MSR_CM
) |
5015 (1ull << MSR_UCLE
) |
5028 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5029 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5030 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5031 /* FIXME: figure out the correct flag for e5500 */
5032 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5033 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5034 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5038 /* Non-embedded PowerPC */
5040 /* POWER : same as 601, without mfmsr, mfsr */
5041 POWERPC_FAMILY(POWER
)(ObjectClass
*oc
, void *data
)
5043 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5044 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5047 /* pcc->insns_flags = XXX_TODO; */
5048 /* POWER RSC (from RAD6000) */
5049 pcc
->msr_mask
= (1ull << MSR_EE
) |
5062 #define POWERPC_MSRR_601 (0x0000000000001040ULL)
5064 static void init_proc_601 (CPUPPCState
*env
)
5066 gen_spr_ne_601(env
);
5068 /* Hardware implementation registers */
5069 /* XXX : not implemented */
5070 spr_register(env
, SPR_HID0
, "HID0",
5071 SPR_NOACCESS
, SPR_NOACCESS
,
5072 &spr_read_generic
, &spr_write_hid0_601
,
5074 /* XXX : not implemented */
5075 spr_register(env
, SPR_HID1
, "HID1",
5076 SPR_NOACCESS
, SPR_NOACCESS
,
5077 &spr_read_generic
, &spr_write_generic
,
5079 /* XXX : not implemented */
5080 spr_register(env
, SPR_601_HID2
, "HID2",
5081 SPR_NOACCESS
, SPR_NOACCESS
,
5082 &spr_read_generic
, &spr_write_generic
,
5084 /* XXX : not implemented */
5085 spr_register(env
, SPR_601_HID5
, "HID5",
5086 SPR_NOACCESS
, SPR_NOACCESS
,
5087 &spr_read_generic
, &spr_write_generic
,
5089 /* Memory management */
5091 /* XXX: beware that dcache line size is 64
5092 * but dcbz uses 32 bytes "sectors"
5093 * XXX: this breaks clcs instruction !
5095 env
->dcache_line_size
= 32;
5096 env
->icache_line_size
= 64;
5097 /* Allocate hardware IRQ controller */
5098 ppc6xx_irq_init(env
);
5101 POWERPC_FAMILY(601)(ObjectClass
*oc
, void *data
)
5103 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5104 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5106 dc
->desc
= "PowerPC 601";
5107 pcc
->init_proc
= init_proc_601
;
5108 pcc
->check_pow
= check_pow_none
;
5109 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5111 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5112 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5113 PPC_SEGMENT
| PPC_EXTERN
;
5114 pcc
->msr_mask
= (1ull << MSR_EE
) |
5124 pcc
->mmu_model
= POWERPC_MMU_601
;
5125 #if defined(CONFIG_SOFTMMU)
5126 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5128 pcc
->excp_model
= POWERPC_EXCP_601
;
5129 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5130 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5131 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5134 #define POWERPC_MSRR_601v (0x0000000000001040ULL)
5136 static void init_proc_601v (CPUPPCState
*env
)
5139 /* XXX : not implemented */
5140 spr_register(env
, SPR_601_HID15
, "HID15",
5141 SPR_NOACCESS
, SPR_NOACCESS
,
5142 &spr_read_generic
, &spr_write_generic
,
5146 POWERPC_FAMILY(601v
)(ObjectClass
*oc
, void *data
)
5148 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5149 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5151 dc
->desc
= "PowerPC 601v";
5152 pcc
->init_proc
= init_proc_601v
;
5153 pcc
->check_pow
= check_pow_none
;
5154 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5156 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5157 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5158 PPC_SEGMENT
| PPC_EXTERN
;
5159 pcc
->msr_mask
= (1ull << MSR_EE
) |
5169 pcc
->mmu_model
= POWERPC_MMU_601
;
5170 #if defined(CONFIG_SOFTMMU)
5171 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5173 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5174 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5175 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5178 static void init_proc_602 (CPUPPCState
*env
)
5180 gen_spr_ne_601(env
);
5184 /* hardware implementation registers */
5185 /* XXX : not implemented */
5186 spr_register(env
, SPR_HID0
, "HID0",
5187 SPR_NOACCESS
, SPR_NOACCESS
,
5188 &spr_read_generic
, &spr_write_generic
,
5190 /* XXX : not implemented */
5191 spr_register(env
, SPR_HID1
, "HID1",
5192 SPR_NOACCESS
, SPR_NOACCESS
,
5193 &spr_read_generic
, &spr_write_generic
,
5195 /* Memory management */
5197 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5199 env
->dcache_line_size
= 32;
5200 env
->icache_line_size
= 32;
5201 /* Allocate hardware IRQ controller */
5202 ppc6xx_irq_init(env
);
5205 POWERPC_FAMILY(602)(ObjectClass
*oc
, void *data
)
5207 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5208 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5210 dc
->desc
= "PowerPC 602";
5211 pcc
->init_proc
= init_proc_602
;
5212 pcc
->check_pow
= check_pow_hid0
;
5213 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5214 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5215 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5216 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5217 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5218 PPC_MEM_TLBIE
| PPC_6xx_TLB
| PPC_MEM_TLBSYNC
|
5219 PPC_SEGMENT
| PPC_602_SPEC
;
5220 pcc
->msr_mask
= (1ull << MSR_VSX
) |
5223 (1ull << MSR_TGPR
) |
5238 /* XXX: 602 MMU is quite specific. Should add a special case */
5239 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5240 pcc
->excp_model
= POWERPC_EXCP_602
;
5241 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5242 pcc
->bfd_mach
= bfd_mach_ppc_602
;
5243 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5244 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5247 static void init_proc_603 (CPUPPCState
*env
)
5249 gen_spr_ne_601(env
);
5253 /* hardware implementation registers */
5254 /* XXX : not implemented */
5255 spr_register(env
, SPR_HID0
, "HID0",
5256 SPR_NOACCESS
, SPR_NOACCESS
,
5257 &spr_read_generic
, &spr_write_generic
,
5259 /* XXX : not implemented */
5260 spr_register(env
, SPR_HID1
, "HID1",
5261 SPR_NOACCESS
, SPR_NOACCESS
,
5262 &spr_read_generic
, &spr_write_generic
,
5264 /* Memory management */
5266 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5268 env
->dcache_line_size
= 32;
5269 env
->icache_line_size
= 32;
5270 /* Allocate hardware IRQ controller */
5271 ppc6xx_irq_init(env
);
5274 POWERPC_FAMILY(603)(ObjectClass
*oc
, void *data
)
5276 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5277 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5279 dc
->desc
= "PowerPC 603";
5280 pcc
->init_proc
= init_proc_603
;
5281 pcc
->check_pow
= check_pow_hid0
;
5282 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5283 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5284 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5285 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5286 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5287 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5288 PPC_SEGMENT
| PPC_EXTERN
;
5289 pcc
->msr_mask
= (1ull << MSR_POW
) |
5290 (1ull << MSR_TGPR
) |
5305 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5306 pcc
->excp_model
= POWERPC_EXCP_603
;
5307 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5308 pcc
->bfd_mach
= bfd_mach_ppc_603
;
5309 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5310 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5313 static void init_proc_603E (CPUPPCState
*env
)
5315 gen_spr_ne_601(env
);
5319 /* hardware implementation registers */
5320 /* XXX : not implemented */
5321 spr_register(env
, SPR_HID0
, "HID0",
5322 SPR_NOACCESS
, SPR_NOACCESS
,
5323 &spr_read_generic
, &spr_write_generic
,
5325 /* XXX : not implemented */
5326 spr_register(env
, SPR_HID1
, "HID1",
5327 SPR_NOACCESS
, SPR_NOACCESS
,
5328 &spr_read_generic
, &spr_write_generic
,
5330 /* Memory management */
5332 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5334 env
->dcache_line_size
= 32;
5335 env
->icache_line_size
= 32;
5336 /* Allocate hardware IRQ controller */
5337 ppc6xx_irq_init(env
);
5340 POWERPC_FAMILY(603E
)(ObjectClass
*oc
, void *data
)
5342 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5343 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5345 dc
->desc
= "PowerPC 603e";
5346 pcc
->init_proc
= init_proc_603E
;
5347 pcc
->check_pow
= check_pow_hid0
;
5348 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5349 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5350 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5351 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5352 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5353 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5354 PPC_SEGMENT
| PPC_EXTERN
;
5355 pcc
->msr_mask
= (1ull << MSR_POW
) |
5356 (1ull << MSR_TGPR
) |
5371 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5372 pcc
->excp_model
= POWERPC_EXCP_603E
;
5373 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5374 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
5375 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5376 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5379 static void init_proc_604 (CPUPPCState
*env
)
5381 gen_spr_ne_601(env
);
5385 /* Hardware implementation registers */
5386 /* XXX : not implemented */
5387 spr_register(env
, SPR_HID0
, "HID0",
5388 SPR_NOACCESS
, SPR_NOACCESS
,
5389 &spr_read_generic
, &spr_write_generic
,
5391 /* Memory management */
5394 env
->dcache_line_size
= 32;
5395 env
->icache_line_size
= 32;
5396 /* Allocate hardware IRQ controller */
5397 ppc6xx_irq_init(env
);
5400 POWERPC_FAMILY(604)(ObjectClass
*oc
, void *data
)
5402 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5403 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5405 dc
->desc
= "PowerPC 604";
5406 pcc
->init_proc
= init_proc_604
;
5407 pcc
->check_pow
= check_pow_nocheck
;
5408 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5409 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5410 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5411 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5412 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5413 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5414 PPC_SEGMENT
| PPC_EXTERN
;
5415 pcc
->msr_mask
= (1ull << MSR_POW
) |
5431 pcc
->mmu_model
= POWERPC_MMU_32B
;
5432 #if defined(CONFIG_SOFTMMU)
5433 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5435 pcc
->excp_model
= POWERPC_EXCP_604
;
5436 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5437 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5438 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5439 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5442 static void init_proc_604E (CPUPPCState
*env
)
5444 gen_spr_ne_601(env
);
5446 /* XXX : not implemented */
5447 spr_register(env
, SPR_7XX_MMCR1
, "MMCR1",
5448 SPR_NOACCESS
, SPR_NOACCESS
,
5449 &spr_read_generic
, &spr_write_generic
,
5451 /* XXX : not implemented */
5452 spr_register(env
, SPR_7XX_PMC3
, "PMC3",
5453 SPR_NOACCESS
, SPR_NOACCESS
,
5454 &spr_read_generic
, &spr_write_generic
,
5456 /* XXX : not implemented */
5457 spr_register(env
, SPR_7XX_PMC4
, "PMC4",
5458 SPR_NOACCESS
, SPR_NOACCESS
,
5459 &spr_read_generic
, &spr_write_generic
,
5463 /* Hardware implementation registers */
5464 /* XXX : not implemented */
5465 spr_register(env
, SPR_HID0
, "HID0",
5466 SPR_NOACCESS
, SPR_NOACCESS
,
5467 &spr_read_generic
, &spr_write_generic
,
5469 /* XXX : not implemented */
5470 spr_register(env
, SPR_HID1
, "HID1",
5471 SPR_NOACCESS
, SPR_NOACCESS
,
5472 &spr_read_generic
, &spr_write_generic
,
5474 /* Memory management */
5477 env
->dcache_line_size
= 32;
5478 env
->icache_line_size
= 32;
5479 /* Allocate hardware IRQ controller */
5480 ppc6xx_irq_init(env
);
5483 POWERPC_FAMILY(604E
)(ObjectClass
*oc
, void *data
)
5485 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5486 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5488 dc
->desc
= "PowerPC 604E";
5489 pcc
->init_proc
= init_proc_604E
;
5490 pcc
->check_pow
= check_pow_nocheck
;
5491 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5492 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5493 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5494 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5495 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5496 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5497 PPC_SEGMENT
| PPC_EXTERN
;
5498 pcc
->msr_mask
= (1ull << MSR_POW
) |
5514 pcc
->mmu_model
= POWERPC_MMU_32B
;
5515 #if defined(CONFIG_SOFTMMU)
5516 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5518 pcc
->excp_model
= POWERPC_EXCP_604
;
5519 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5520 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5521 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5522 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5525 static void init_proc_740 (CPUPPCState
*env
)
5527 gen_spr_ne_601(env
);
5531 /* Thermal management */
5533 /* Hardware implementation registers */
5534 /* XXX : not implemented */
5535 spr_register(env
, SPR_HID0
, "HID0",
5536 SPR_NOACCESS
, SPR_NOACCESS
,
5537 &spr_read_generic
, &spr_write_generic
,
5539 /* XXX : not implemented */
5540 spr_register(env
, SPR_HID1
, "HID1",
5541 SPR_NOACCESS
, SPR_NOACCESS
,
5542 &spr_read_generic
, &spr_write_generic
,
5544 /* Memory management */
5547 env
->dcache_line_size
= 32;
5548 env
->icache_line_size
= 32;
5549 /* Allocate hardware IRQ controller */
5550 ppc6xx_irq_init(env
);
5553 POWERPC_FAMILY(740)(ObjectClass
*oc
, void *data
)
5555 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5556 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5558 dc
->desc
= "PowerPC 740";
5559 pcc
->init_proc
= init_proc_740
;
5560 pcc
->check_pow
= check_pow_hid0
;
5561 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5562 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5563 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5564 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5565 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5566 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5567 PPC_SEGMENT
| PPC_EXTERN
;
5568 pcc
->msr_mask
= (1ull << MSR_POW
) |
5584 pcc
->mmu_model
= POWERPC_MMU_32B
;
5585 #if defined(CONFIG_SOFTMMU)
5586 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5588 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5589 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5590 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5591 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5592 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5595 static void init_proc_750 (CPUPPCState
*env
)
5597 gen_spr_ne_601(env
);
5599 /* XXX : not implemented */
5600 spr_register(env
, SPR_L2CR
, "L2CR",
5601 SPR_NOACCESS
, SPR_NOACCESS
,
5602 &spr_read_generic
, spr_access_nop
,
5606 /* Thermal management */
5608 /* Hardware implementation registers */
5609 /* XXX : not implemented */
5610 spr_register(env
, SPR_HID0
, "HID0",
5611 SPR_NOACCESS
, SPR_NOACCESS
,
5612 &spr_read_generic
, &spr_write_generic
,
5614 /* XXX : not implemented */
5615 spr_register(env
, SPR_HID1
, "HID1",
5616 SPR_NOACCESS
, SPR_NOACCESS
,
5617 &spr_read_generic
, &spr_write_generic
,
5619 /* Memory management */
5621 /* XXX: high BATs are also present but are known to be bugged on
5625 env
->dcache_line_size
= 32;
5626 env
->icache_line_size
= 32;
5627 /* Allocate hardware IRQ controller */
5628 ppc6xx_irq_init(env
);
5631 POWERPC_FAMILY(750)(ObjectClass
*oc
, void *data
)
5633 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5634 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5636 dc
->desc
= "PowerPC 750";
5637 pcc
->init_proc
= init_proc_750
;
5638 pcc
->check_pow
= check_pow_hid0
;
5639 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5640 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5641 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5642 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5643 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5644 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5645 PPC_SEGMENT
| PPC_EXTERN
;
5646 pcc
->msr_mask
= (1ull << MSR_POW
) |
5662 pcc
->mmu_model
= POWERPC_MMU_32B
;
5663 #if defined(CONFIG_SOFTMMU)
5664 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5666 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5667 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5668 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5669 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5670 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5673 static void init_proc_750cl (CPUPPCState
*env
)
5675 gen_spr_ne_601(env
);
5677 /* XXX : not implemented */
5678 spr_register(env
, SPR_L2CR
, "L2CR",
5679 SPR_NOACCESS
, SPR_NOACCESS
,
5680 &spr_read_generic
, spr_access_nop
,
5684 /* Thermal management */
5685 /* Those registers are fake on 750CL */
5686 spr_register(env
, SPR_THRM1
, "THRM1",
5687 SPR_NOACCESS
, SPR_NOACCESS
,
5688 &spr_read_generic
, &spr_write_generic
,
5690 spr_register(env
, SPR_THRM2
, "THRM2",
5691 SPR_NOACCESS
, SPR_NOACCESS
,
5692 &spr_read_generic
, &spr_write_generic
,
5694 spr_register(env
, SPR_THRM3
, "THRM3",
5695 SPR_NOACCESS
, SPR_NOACCESS
,
5696 &spr_read_generic
, &spr_write_generic
,
5698 /* XXX: not implemented */
5699 spr_register(env
, SPR_750_TDCL
, "TDCL",
5700 SPR_NOACCESS
, SPR_NOACCESS
,
5701 &spr_read_generic
, &spr_write_generic
,
5703 spr_register(env
, SPR_750_TDCH
, "TDCH",
5704 SPR_NOACCESS
, SPR_NOACCESS
,
5705 &spr_read_generic
, &spr_write_generic
,
5708 /* XXX : not implemented */
5709 spr_register(env
, SPR_750_WPAR
, "WPAR",
5710 SPR_NOACCESS
, SPR_NOACCESS
,
5711 &spr_read_generic
, &spr_write_generic
,
5713 spr_register(env
, SPR_750_DMAL
, "DMAL",
5714 SPR_NOACCESS
, SPR_NOACCESS
,
5715 &spr_read_generic
, &spr_write_generic
,
5717 spr_register(env
, SPR_750_DMAU
, "DMAU",
5718 SPR_NOACCESS
, SPR_NOACCESS
,
5719 &spr_read_generic
, &spr_write_generic
,
5721 /* Hardware implementation registers */
5722 /* XXX : not implemented */
5723 spr_register(env
, SPR_HID0
, "HID0",
5724 SPR_NOACCESS
, SPR_NOACCESS
,
5725 &spr_read_generic
, &spr_write_generic
,
5727 /* XXX : not implemented */
5728 spr_register(env
, SPR_HID1
, "HID1",
5729 SPR_NOACCESS
, SPR_NOACCESS
,
5730 &spr_read_generic
, &spr_write_generic
,
5732 /* XXX : not implemented */
5733 spr_register(env
, SPR_750CL_HID2
, "HID2",
5734 SPR_NOACCESS
, SPR_NOACCESS
,
5735 &spr_read_generic
, &spr_write_generic
,
5737 /* XXX : not implemented */
5738 spr_register(env
, SPR_750CL_HID4
, "HID4",
5739 SPR_NOACCESS
, SPR_NOACCESS
,
5740 &spr_read_generic
, &spr_write_generic
,
5742 /* Quantization registers */
5743 /* XXX : not implemented */
5744 spr_register(env
, SPR_750_GQR0
, "GQR0",
5745 SPR_NOACCESS
, SPR_NOACCESS
,
5746 &spr_read_generic
, &spr_write_generic
,
5748 /* XXX : not implemented */
5749 spr_register(env
, SPR_750_GQR1
, "GQR1",
5750 SPR_NOACCESS
, SPR_NOACCESS
,
5751 &spr_read_generic
, &spr_write_generic
,
5753 /* XXX : not implemented */
5754 spr_register(env
, SPR_750_GQR2
, "GQR2",
5755 SPR_NOACCESS
, SPR_NOACCESS
,
5756 &spr_read_generic
, &spr_write_generic
,
5758 /* XXX : not implemented */
5759 spr_register(env
, SPR_750_GQR3
, "GQR3",
5760 SPR_NOACCESS
, SPR_NOACCESS
,
5761 &spr_read_generic
, &spr_write_generic
,
5763 /* XXX : not implemented */
5764 spr_register(env
, SPR_750_GQR4
, "GQR4",
5765 SPR_NOACCESS
, SPR_NOACCESS
,
5766 &spr_read_generic
, &spr_write_generic
,
5768 /* XXX : not implemented */
5769 spr_register(env
, SPR_750_GQR5
, "GQR5",
5770 SPR_NOACCESS
, SPR_NOACCESS
,
5771 &spr_read_generic
, &spr_write_generic
,
5773 /* XXX : not implemented */
5774 spr_register(env
, SPR_750_GQR6
, "GQR6",
5775 SPR_NOACCESS
, SPR_NOACCESS
,
5776 &spr_read_generic
, &spr_write_generic
,
5778 /* XXX : not implemented */
5779 spr_register(env
, SPR_750_GQR7
, "GQR7",
5780 SPR_NOACCESS
, SPR_NOACCESS
,
5781 &spr_read_generic
, &spr_write_generic
,
5783 /* Memory management */
5785 /* PowerPC 750cl has 8 DBATs and 8 IBATs */
5787 init_excp_750cl(env
);
5788 env
->dcache_line_size
= 32;
5789 env
->icache_line_size
= 32;
5790 /* Allocate hardware IRQ controller */
5791 ppc6xx_irq_init(env
);
5794 POWERPC_FAMILY(750cl
)(ObjectClass
*oc
, void *data
)
5796 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5797 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5799 dc
->desc
= "PowerPC 750 CL";
5800 pcc
->init_proc
= init_proc_750cl
;
5801 pcc
->check_pow
= check_pow_hid0
;
5802 /* XXX: not implemented:
5803 * cache lock instructions:
5805 * floating point paired instructions
5840 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5841 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5842 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5843 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5844 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5845 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5846 PPC_SEGMENT
| PPC_EXTERN
;
5847 pcc
->msr_mask
= (1ull << MSR_POW
) |
5863 pcc
->mmu_model
= POWERPC_MMU_32B
;
5864 #if defined(CONFIG_SOFTMMU)
5865 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5867 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5868 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5869 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5870 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5871 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5874 static void init_proc_750cx (CPUPPCState
*env
)
5876 gen_spr_ne_601(env
);
5878 /* XXX : not implemented */
5879 spr_register(env
, SPR_L2CR
, "L2CR",
5880 SPR_NOACCESS
, SPR_NOACCESS
,
5881 &spr_read_generic
, spr_access_nop
,
5885 /* Thermal management */
5887 /* This register is not implemented but is present for compatibility */
5888 spr_register(env
, SPR_SDA
, "SDA",
5889 SPR_NOACCESS
, SPR_NOACCESS
,
5890 &spr_read_generic
, &spr_write_generic
,
5892 /* Hardware implementation registers */
5893 /* XXX : not implemented */
5894 spr_register(env
, SPR_HID0
, "HID0",
5895 SPR_NOACCESS
, SPR_NOACCESS
,
5896 &spr_read_generic
, &spr_write_generic
,
5898 /* XXX : not implemented */
5899 spr_register(env
, SPR_HID1
, "HID1",
5900 SPR_NOACCESS
, SPR_NOACCESS
,
5901 &spr_read_generic
, &spr_write_generic
,
5903 /* Memory management */
5905 /* PowerPC 750cx has 8 DBATs and 8 IBATs */
5907 init_excp_750cx(env
);
5908 env
->dcache_line_size
= 32;
5909 env
->icache_line_size
= 32;
5910 /* Allocate hardware IRQ controller */
5911 ppc6xx_irq_init(env
);
5914 POWERPC_FAMILY(750cx
)(ObjectClass
*oc
, void *data
)
5916 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5917 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5919 dc
->desc
= "PowerPC 750CX";
5920 pcc
->init_proc
= init_proc_750cx
;
5921 pcc
->check_pow
= check_pow_hid0
;
5922 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5923 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5924 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5925 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5926 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5927 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5928 PPC_SEGMENT
| PPC_EXTERN
;
5929 pcc
->msr_mask
= (1ull << MSR_POW
) |
5945 pcc
->mmu_model
= POWERPC_MMU_32B
;
5946 #if defined(CONFIG_SOFTMMU)
5947 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5949 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5950 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5951 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5952 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5953 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5956 static void init_proc_750fx (CPUPPCState
*env
)
5958 gen_spr_ne_601(env
);
5960 /* XXX : not implemented */
5961 spr_register(env
, SPR_L2CR
, "L2CR",
5962 SPR_NOACCESS
, SPR_NOACCESS
,
5963 &spr_read_generic
, spr_access_nop
,
5967 /* Thermal management */
5969 /* XXX : not implemented */
5970 spr_register(env
, SPR_750_THRM4
, "THRM4",
5971 SPR_NOACCESS
, SPR_NOACCESS
,
5972 &spr_read_generic
, &spr_write_generic
,
5974 /* Hardware implementation registers */
5975 /* XXX : not implemented */
5976 spr_register(env
, SPR_HID0
, "HID0",
5977 SPR_NOACCESS
, SPR_NOACCESS
,
5978 &spr_read_generic
, &spr_write_generic
,
5980 /* XXX : not implemented */
5981 spr_register(env
, SPR_HID1
, "HID1",
5982 SPR_NOACCESS
, SPR_NOACCESS
,
5983 &spr_read_generic
, &spr_write_generic
,
5985 /* XXX : not implemented */
5986 spr_register(env
, SPR_750FX_HID2
, "HID2",
5987 SPR_NOACCESS
, SPR_NOACCESS
,
5988 &spr_read_generic
, &spr_write_generic
,
5990 /* Memory management */
5992 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
5995 env
->dcache_line_size
= 32;
5996 env
->icache_line_size
= 32;
5997 /* Allocate hardware IRQ controller */
5998 ppc6xx_irq_init(env
);
6001 POWERPC_FAMILY(750fx
)(ObjectClass
*oc
, void *data
)
6003 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6004 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6006 dc
->desc
= "PowerPC 750FX";
6007 pcc
->init_proc
= init_proc_750fx
;
6008 pcc
->check_pow
= check_pow_hid0
;
6009 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6010 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6011 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6012 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6013 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6014 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6015 PPC_SEGMENT
| PPC_EXTERN
;
6016 pcc
->msr_mask
= (1ull << MSR_POW
) |
6032 pcc
->mmu_model
= POWERPC_MMU_32B
;
6033 #if defined(CONFIG_SOFTMMU)
6034 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6036 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6037 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6038 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6039 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6040 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6043 static void init_proc_750gx (CPUPPCState
*env
)
6045 gen_spr_ne_601(env
);
6047 /* XXX : not implemented (XXX: different from 750fx) */
6048 spr_register(env
, SPR_L2CR
, "L2CR",
6049 SPR_NOACCESS
, SPR_NOACCESS
,
6050 &spr_read_generic
, spr_access_nop
,
6054 /* Thermal management */
6056 /* XXX : not implemented */
6057 spr_register(env
, SPR_750_THRM4
, "THRM4",
6058 SPR_NOACCESS
, SPR_NOACCESS
,
6059 &spr_read_generic
, &spr_write_generic
,
6061 /* Hardware implementation registers */
6062 /* XXX : not implemented (XXX: different from 750fx) */
6063 spr_register(env
, SPR_HID0
, "HID0",
6064 SPR_NOACCESS
, SPR_NOACCESS
,
6065 &spr_read_generic
, &spr_write_generic
,
6067 /* XXX : not implemented */
6068 spr_register(env
, SPR_HID1
, "HID1",
6069 SPR_NOACCESS
, SPR_NOACCESS
,
6070 &spr_read_generic
, &spr_write_generic
,
6072 /* XXX : not implemented (XXX: different from 750fx) */
6073 spr_register(env
, SPR_750FX_HID2
, "HID2",
6074 SPR_NOACCESS
, SPR_NOACCESS
,
6075 &spr_read_generic
, &spr_write_generic
,
6077 /* Memory management */
6079 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6082 env
->dcache_line_size
= 32;
6083 env
->icache_line_size
= 32;
6084 /* Allocate hardware IRQ controller */
6085 ppc6xx_irq_init(env
);
6088 POWERPC_FAMILY(750gx
)(ObjectClass
*oc
, void *data
)
6090 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6091 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6093 dc
->desc
= "PowerPC 750GX";
6094 pcc
->init_proc
= init_proc_750gx
;
6095 pcc
->check_pow
= check_pow_hid0
;
6096 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6097 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6098 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6099 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6100 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6101 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6102 PPC_SEGMENT
| PPC_EXTERN
;
6103 pcc
->msr_mask
= (1ull << MSR_POW
) |
6119 pcc
->mmu_model
= POWERPC_MMU_32B
;
6120 #if defined(CONFIG_SOFTMMU)
6121 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6123 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6124 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6125 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6126 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6127 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6130 static void init_proc_745 (CPUPPCState
*env
)
6132 gen_spr_ne_601(env
);
6134 gen_spr_G2_755(env
);
6137 /* Thermal management */
6139 /* Hardware implementation registers */
6140 /* XXX : not implemented */
6141 spr_register(env
, SPR_HID0
, "HID0",
6142 SPR_NOACCESS
, SPR_NOACCESS
,
6143 &spr_read_generic
, &spr_write_generic
,
6145 /* XXX : not implemented */
6146 spr_register(env
, SPR_HID1
, "HID1",
6147 SPR_NOACCESS
, SPR_NOACCESS
,
6148 &spr_read_generic
, &spr_write_generic
,
6150 /* XXX : not implemented */
6151 spr_register(env
, SPR_HID2
, "HID2",
6152 SPR_NOACCESS
, SPR_NOACCESS
,
6153 &spr_read_generic
, &spr_write_generic
,
6155 /* Memory management */
6158 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6160 env
->dcache_line_size
= 32;
6161 env
->icache_line_size
= 32;
6162 /* Allocate hardware IRQ controller */
6163 ppc6xx_irq_init(env
);
6166 POWERPC_FAMILY(745)(ObjectClass
*oc
, void *data
)
6168 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6169 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6171 dc
->desc
= "PowerPC 745";
6172 pcc
->init_proc
= init_proc_745
;
6173 pcc
->check_pow
= check_pow_hid0
;
6174 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6175 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6176 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6177 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6178 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6179 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6180 PPC_SEGMENT
| PPC_EXTERN
;
6181 pcc
->msr_mask
= (1ull << MSR_POW
) |
6197 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6198 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6199 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6200 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6201 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6202 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6205 static void init_proc_755 (CPUPPCState
*env
)
6207 gen_spr_ne_601(env
);
6209 gen_spr_G2_755(env
);
6212 /* L2 cache control */
6213 /* XXX : not implemented */
6214 spr_register(env
, SPR_L2CR
, "L2CR",
6215 SPR_NOACCESS
, SPR_NOACCESS
,
6216 &spr_read_generic
, spr_access_nop
,
6218 /* XXX : not implemented */
6219 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6220 SPR_NOACCESS
, SPR_NOACCESS
,
6221 &spr_read_generic
, &spr_write_generic
,
6223 /* Thermal management */
6225 /* Hardware implementation registers */
6226 /* XXX : not implemented */
6227 spr_register(env
, SPR_HID0
, "HID0",
6228 SPR_NOACCESS
, SPR_NOACCESS
,
6229 &spr_read_generic
, &spr_write_generic
,
6231 /* XXX : not implemented */
6232 spr_register(env
, SPR_HID1
, "HID1",
6233 SPR_NOACCESS
, SPR_NOACCESS
,
6234 &spr_read_generic
, &spr_write_generic
,
6236 /* XXX : not implemented */
6237 spr_register(env
, SPR_HID2
, "HID2",
6238 SPR_NOACCESS
, SPR_NOACCESS
,
6239 &spr_read_generic
, &spr_write_generic
,
6241 /* Memory management */
6244 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6246 env
->dcache_line_size
= 32;
6247 env
->icache_line_size
= 32;
6248 /* Allocate hardware IRQ controller */
6249 ppc6xx_irq_init(env
);
6252 POWERPC_FAMILY(755)(ObjectClass
*oc
, void *data
)
6254 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6255 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6257 dc
->desc
= "PowerPC 755";
6258 pcc
->init_proc
= init_proc_755
;
6259 pcc
->check_pow
= check_pow_hid0
;
6260 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6261 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6262 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6263 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6264 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6265 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6266 PPC_SEGMENT
| PPC_EXTERN
;
6267 pcc
->msr_mask
= (1ull << MSR_POW
) |
6283 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6284 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6285 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6286 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6287 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6288 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6291 static void init_proc_7400 (CPUPPCState
*env
)
6293 gen_spr_ne_601(env
);
6297 /* 74xx specific SPR */
6299 /* XXX : not implemented */
6300 spr_register(env
, SPR_UBAMR
, "UBAMR",
6301 &spr_read_ureg
, SPR_NOACCESS
,
6302 &spr_read_ureg
, SPR_NOACCESS
,
6304 /* XXX: this seems not implemented on all revisions. */
6305 /* XXX : not implemented */
6306 spr_register(env
, SPR_MSSCR1
, "MSSCR1",
6307 SPR_NOACCESS
, SPR_NOACCESS
,
6308 &spr_read_generic
, &spr_write_generic
,
6310 /* Thermal management */
6312 /* Memory management */
6314 init_excp_7400(env
);
6315 env
->dcache_line_size
= 32;
6316 env
->icache_line_size
= 32;
6317 /* Allocate hardware IRQ controller */
6318 ppc6xx_irq_init(env
);
6321 POWERPC_FAMILY(7400)(ObjectClass
*oc
, void *data
)
6323 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6324 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6326 dc
->desc
= "PowerPC 7400 (aka G4)";
6327 pcc
->init_proc
= init_proc_7400
;
6328 pcc
->check_pow
= check_pow_hid0
;
6329 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6330 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6331 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6333 PPC_CACHE
| PPC_CACHE_ICBI
|
6334 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6335 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6336 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6338 PPC_SEGMENT
| PPC_EXTERN
|
6340 pcc
->msr_mask
= (1ull << MSR_VR
) |
6357 pcc
->mmu_model
= POWERPC_MMU_32B
;
6358 #if defined(CONFIG_SOFTMMU)
6359 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6361 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6362 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6363 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6364 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6365 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6366 POWERPC_FLAG_BUS_CLK
;
6369 static void init_proc_7410 (CPUPPCState
*env
)
6371 gen_spr_ne_601(env
);
6375 /* 74xx specific SPR */
6377 /* XXX : not implemented */
6378 spr_register(env
, SPR_UBAMR
, "UBAMR",
6379 &spr_read_ureg
, SPR_NOACCESS
,
6380 &spr_read_ureg
, SPR_NOACCESS
,
6382 /* Thermal management */
6385 /* XXX : not implemented */
6386 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6387 SPR_NOACCESS
, SPR_NOACCESS
,
6388 &spr_read_generic
, &spr_write_generic
,
6391 /* XXX : not implemented */
6392 spr_register(env
, SPR_LDSTDB
, "LDSTDB",
6393 SPR_NOACCESS
, SPR_NOACCESS
,
6394 &spr_read_generic
, &spr_write_generic
,
6396 /* Memory management */
6398 init_excp_7400(env
);
6399 env
->dcache_line_size
= 32;
6400 env
->icache_line_size
= 32;
6401 /* Allocate hardware IRQ controller */
6402 ppc6xx_irq_init(env
);
6405 POWERPC_FAMILY(7410)(ObjectClass
*oc
, void *data
)
6407 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6408 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6410 dc
->desc
= "PowerPC 7410 (aka G4)";
6411 pcc
->init_proc
= init_proc_7410
;
6412 pcc
->check_pow
= check_pow_hid0
;
6413 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6414 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6415 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6417 PPC_CACHE
| PPC_CACHE_ICBI
|
6418 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6419 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6420 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6422 PPC_SEGMENT
| PPC_EXTERN
|
6424 pcc
->msr_mask
= (1ull << MSR_VR
) |
6441 pcc
->mmu_model
= POWERPC_MMU_32B
;
6442 #if defined(CONFIG_SOFTMMU)
6443 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6445 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6446 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6447 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6448 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6449 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6450 POWERPC_FLAG_BUS_CLK
;
6453 static void init_proc_7440 (CPUPPCState
*env
)
6455 gen_spr_ne_601(env
);
6459 /* 74xx specific SPR */
6461 /* XXX : not implemented */
6462 spr_register(env
, SPR_UBAMR
, "UBAMR",
6463 &spr_read_ureg
, SPR_NOACCESS
,
6464 &spr_read_ureg
, SPR_NOACCESS
,
6467 /* XXX : not implemented */
6468 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6469 SPR_NOACCESS
, SPR_NOACCESS
,
6470 &spr_read_generic
, &spr_write_generic
,
6473 /* XXX : not implemented */
6474 spr_register(env
, SPR_ICTRL
, "ICTRL",
6475 SPR_NOACCESS
, SPR_NOACCESS
,
6476 &spr_read_generic
, &spr_write_generic
,
6479 /* XXX : not implemented */
6480 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6481 SPR_NOACCESS
, SPR_NOACCESS
,
6482 &spr_read_generic
, &spr_write_generic
,
6485 /* XXX : not implemented */
6486 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6487 SPR_NOACCESS
, SPR_NOACCESS
,
6488 &spr_read_generic
, &spr_write_generic
,
6490 /* XXX : not implemented */
6491 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6492 &spr_read_ureg
, SPR_NOACCESS
,
6493 &spr_read_ureg
, SPR_NOACCESS
,
6495 /* XXX : not implemented */
6496 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6497 SPR_NOACCESS
, SPR_NOACCESS
,
6498 &spr_read_generic
, &spr_write_generic
,
6500 /* XXX : not implemented */
6501 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6502 &spr_read_ureg
, SPR_NOACCESS
,
6503 &spr_read_ureg
, SPR_NOACCESS
,
6505 /* Memory management */
6507 gen_74xx_soft_tlb(env
, 128, 2);
6508 init_excp_7450(env
);
6509 env
->dcache_line_size
= 32;
6510 env
->icache_line_size
= 32;
6511 /* Allocate hardware IRQ controller */
6512 ppc6xx_irq_init(env
);
6515 POWERPC_FAMILY(7440)(ObjectClass
*oc
, void *data
)
6517 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6518 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6520 dc
->desc
= "PowerPC 7440 (aka G4)";
6521 pcc
->init_proc
= init_proc_7440
;
6522 pcc
->check_pow
= check_pow_hid0_74xx
;
6523 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6524 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6525 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6527 PPC_CACHE
| PPC_CACHE_ICBI
|
6528 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6529 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6530 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6531 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6532 PPC_SEGMENT
| PPC_EXTERN
|
6534 pcc
->msr_mask
= (1ull << MSR_VR
) |
6551 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6552 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6553 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6554 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6555 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6556 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6557 POWERPC_FLAG_BUS_CLK
;
6560 static void init_proc_7450 (CPUPPCState
*env
)
6562 gen_spr_ne_601(env
);
6566 /* 74xx specific SPR */
6568 /* Level 3 cache control */
6571 /* XXX : not implemented */
6572 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
6573 SPR_NOACCESS
, SPR_NOACCESS
,
6574 &spr_read_generic
, &spr_write_generic
,
6577 /* XXX : not implemented */
6578 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
6579 SPR_NOACCESS
, SPR_NOACCESS
,
6580 &spr_read_generic
, &spr_write_generic
,
6583 /* XXX : not implemented */
6584 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
6585 SPR_NOACCESS
, SPR_NOACCESS
,
6586 &spr_read_generic
, &spr_write_generic
,
6589 /* XXX : not implemented */
6590 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
6591 SPR_NOACCESS
, SPR_NOACCESS
,
6592 &spr_read_generic
, &spr_write_generic
,
6594 /* XXX : not implemented */
6595 spr_register(env
, SPR_UBAMR
, "UBAMR",
6596 &spr_read_ureg
, SPR_NOACCESS
,
6597 &spr_read_ureg
, SPR_NOACCESS
,
6600 /* XXX : not implemented */
6601 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6602 SPR_NOACCESS
, SPR_NOACCESS
,
6603 &spr_read_generic
, &spr_write_generic
,
6606 /* XXX : not implemented */
6607 spr_register(env
, SPR_ICTRL
, "ICTRL",
6608 SPR_NOACCESS
, SPR_NOACCESS
,
6609 &spr_read_generic
, &spr_write_generic
,
6612 /* XXX : not implemented */
6613 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6614 SPR_NOACCESS
, SPR_NOACCESS
,
6615 &spr_read_generic
, &spr_write_generic
,
6618 /* XXX : not implemented */
6619 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6620 SPR_NOACCESS
, SPR_NOACCESS
,
6621 &spr_read_generic
, &spr_write_generic
,
6623 /* XXX : not implemented */
6624 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6625 &spr_read_ureg
, SPR_NOACCESS
,
6626 &spr_read_ureg
, SPR_NOACCESS
,
6628 /* XXX : not implemented */
6629 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6630 SPR_NOACCESS
, SPR_NOACCESS
,
6631 &spr_read_generic
, &spr_write_generic
,
6633 /* XXX : not implemented */
6634 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6635 &spr_read_ureg
, SPR_NOACCESS
,
6636 &spr_read_ureg
, SPR_NOACCESS
,
6638 /* Memory management */
6640 gen_74xx_soft_tlb(env
, 128, 2);
6641 init_excp_7450(env
);
6642 env
->dcache_line_size
= 32;
6643 env
->icache_line_size
= 32;
6644 /* Allocate hardware IRQ controller */
6645 ppc6xx_irq_init(env
);
6648 POWERPC_FAMILY(7450)(ObjectClass
*oc
, void *data
)
6650 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6651 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6653 dc
->desc
= "PowerPC 7450 (aka G4)";
6654 pcc
->init_proc
= init_proc_7450
;
6655 pcc
->check_pow
= check_pow_hid0_74xx
;
6656 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6657 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6658 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6660 PPC_CACHE
| PPC_CACHE_ICBI
|
6661 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6662 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6663 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6664 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6665 PPC_SEGMENT
| PPC_EXTERN
|
6667 pcc
->msr_mask
= (1ull << MSR_VR
) |
6684 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6685 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6686 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6687 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6688 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6689 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6690 POWERPC_FLAG_BUS_CLK
;
6693 static void init_proc_7445 (CPUPPCState
*env
)
6695 gen_spr_ne_601(env
);
6699 /* 74xx specific SPR */
6702 /* XXX : not implemented */
6703 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6704 SPR_NOACCESS
, SPR_NOACCESS
,
6705 &spr_read_generic
, &spr_write_generic
,
6708 /* XXX : not implemented */
6709 spr_register(env
, SPR_ICTRL
, "ICTRL",
6710 SPR_NOACCESS
, SPR_NOACCESS
,
6711 &spr_read_generic
, &spr_write_generic
,
6714 /* XXX : not implemented */
6715 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6716 SPR_NOACCESS
, SPR_NOACCESS
,
6717 &spr_read_generic
, &spr_write_generic
,
6720 /* XXX : not implemented */
6721 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6722 SPR_NOACCESS
, SPR_NOACCESS
,
6723 &spr_read_generic
, &spr_write_generic
,
6725 /* XXX : not implemented */
6726 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6727 &spr_read_ureg
, SPR_NOACCESS
,
6728 &spr_read_ureg
, SPR_NOACCESS
,
6730 /* XXX : not implemented */
6731 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6732 SPR_NOACCESS
, SPR_NOACCESS
,
6733 &spr_read_generic
, &spr_write_generic
,
6735 /* XXX : not implemented */
6736 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6737 &spr_read_ureg
, SPR_NOACCESS
,
6738 &spr_read_ureg
, SPR_NOACCESS
,
6741 spr_register(env
, SPR_SPRG4
, "SPRG4",
6742 SPR_NOACCESS
, SPR_NOACCESS
,
6743 &spr_read_generic
, &spr_write_generic
,
6745 spr_register(env
, SPR_USPRG4
, "USPRG4",
6746 &spr_read_ureg
, SPR_NOACCESS
,
6747 &spr_read_ureg
, SPR_NOACCESS
,
6749 spr_register(env
, SPR_SPRG5
, "SPRG5",
6750 SPR_NOACCESS
, SPR_NOACCESS
,
6751 &spr_read_generic
, &spr_write_generic
,
6753 spr_register(env
, SPR_USPRG5
, "USPRG5",
6754 &spr_read_ureg
, SPR_NOACCESS
,
6755 &spr_read_ureg
, SPR_NOACCESS
,
6757 spr_register(env
, SPR_SPRG6
, "SPRG6",
6758 SPR_NOACCESS
, SPR_NOACCESS
,
6759 &spr_read_generic
, &spr_write_generic
,
6761 spr_register(env
, SPR_USPRG6
, "USPRG6",
6762 &spr_read_ureg
, SPR_NOACCESS
,
6763 &spr_read_ureg
, SPR_NOACCESS
,
6765 spr_register(env
, SPR_SPRG7
, "SPRG7",
6766 SPR_NOACCESS
, SPR_NOACCESS
,
6767 &spr_read_generic
, &spr_write_generic
,
6769 spr_register(env
, SPR_USPRG7
, "USPRG7",
6770 &spr_read_ureg
, SPR_NOACCESS
,
6771 &spr_read_ureg
, SPR_NOACCESS
,
6773 /* Memory management */
6776 gen_74xx_soft_tlb(env
, 128, 2);
6777 init_excp_7450(env
);
6778 env
->dcache_line_size
= 32;
6779 env
->icache_line_size
= 32;
6780 /* Allocate hardware IRQ controller */
6781 ppc6xx_irq_init(env
);
6784 POWERPC_FAMILY(7445)(ObjectClass
*oc
, void *data
)
6786 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6787 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6789 dc
->desc
= "PowerPC 7445 (aka G4)";
6790 pcc
->init_proc
= init_proc_7445
;
6791 pcc
->check_pow
= check_pow_hid0_74xx
;
6792 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6793 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6794 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6796 PPC_CACHE
| PPC_CACHE_ICBI
|
6797 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6798 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6799 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6800 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6801 PPC_SEGMENT
| PPC_EXTERN
|
6803 pcc
->msr_mask
= (1ull << MSR_VR
) |
6820 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6821 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6822 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6823 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6824 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6825 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6826 POWERPC_FLAG_BUS_CLK
;
6829 static void init_proc_7455 (CPUPPCState
*env
)
6831 gen_spr_ne_601(env
);
6835 /* 74xx specific SPR */
6837 /* Level 3 cache control */
6840 /* XXX : not implemented */
6841 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6842 SPR_NOACCESS
, SPR_NOACCESS
,
6843 &spr_read_generic
, &spr_write_generic
,
6846 /* XXX : not implemented */
6847 spr_register(env
, SPR_ICTRL
, "ICTRL",
6848 SPR_NOACCESS
, SPR_NOACCESS
,
6849 &spr_read_generic
, &spr_write_generic
,
6852 /* XXX : not implemented */
6853 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6854 SPR_NOACCESS
, SPR_NOACCESS
,
6855 &spr_read_generic
, &spr_write_generic
,
6858 /* XXX : not implemented */
6859 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
6860 SPR_NOACCESS
, SPR_NOACCESS
,
6861 &spr_read_generic
, &spr_write_generic
,
6863 /* XXX : not implemented */
6864 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
6865 &spr_read_ureg
, SPR_NOACCESS
,
6866 &spr_read_ureg
, SPR_NOACCESS
,
6868 /* XXX : not implemented */
6869 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
6870 SPR_NOACCESS
, SPR_NOACCESS
,
6871 &spr_read_generic
, &spr_write_generic
,
6873 /* XXX : not implemented */
6874 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
6875 &spr_read_ureg
, SPR_NOACCESS
,
6876 &spr_read_ureg
, SPR_NOACCESS
,
6879 spr_register(env
, SPR_SPRG4
, "SPRG4",
6880 SPR_NOACCESS
, SPR_NOACCESS
,
6881 &spr_read_generic
, &spr_write_generic
,
6883 spr_register(env
, SPR_USPRG4
, "USPRG4",
6884 &spr_read_ureg
, SPR_NOACCESS
,
6885 &spr_read_ureg
, SPR_NOACCESS
,
6887 spr_register(env
, SPR_SPRG5
, "SPRG5",
6888 SPR_NOACCESS
, SPR_NOACCESS
,
6889 &spr_read_generic
, &spr_write_generic
,
6891 spr_register(env
, SPR_USPRG5
, "USPRG5",
6892 &spr_read_ureg
, SPR_NOACCESS
,
6893 &spr_read_ureg
, SPR_NOACCESS
,
6895 spr_register(env
, SPR_SPRG6
, "SPRG6",
6896 SPR_NOACCESS
, SPR_NOACCESS
,
6897 &spr_read_generic
, &spr_write_generic
,
6899 spr_register(env
, SPR_USPRG6
, "USPRG6",
6900 &spr_read_ureg
, SPR_NOACCESS
,
6901 &spr_read_ureg
, SPR_NOACCESS
,
6903 spr_register(env
, SPR_SPRG7
, "SPRG7",
6904 SPR_NOACCESS
, SPR_NOACCESS
,
6905 &spr_read_generic
, &spr_write_generic
,
6907 spr_register(env
, SPR_USPRG7
, "USPRG7",
6908 &spr_read_ureg
, SPR_NOACCESS
,
6909 &spr_read_ureg
, SPR_NOACCESS
,
6911 /* Memory management */
6914 gen_74xx_soft_tlb(env
, 128, 2);
6915 init_excp_7450(env
);
6916 env
->dcache_line_size
= 32;
6917 env
->icache_line_size
= 32;
6918 /* Allocate hardware IRQ controller */
6919 ppc6xx_irq_init(env
);
6922 POWERPC_FAMILY(7455)(ObjectClass
*oc
, void *data
)
6924 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6925 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6927 dc
->desc
= "PowerPC 7455 (aka G4)";
6928 pcc
->init_proc
= init_proc_7455
;
6929 pcc
->check_pow
= check_pow_hid0_74xx
;
6930 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6931 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6932 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6934 PPC_CACHE
| PPC_CACHE_ICBI
|
6935 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6936 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6937 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6938 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6939 PPC_SEGMENT
| PPC_EXTERN
|
6941 pcc
->msr_mask
= (1ull << MSR_VR
) |
6958 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6959 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6960 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6961 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6962 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6963 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6964 POWERPC_FLAG_BUS_CLK
;
6967 static void init_proc_7457 (CPUPPCState
*env
)
6969 gen_spr_ne_601(env
);
6973 /* 74xx specific SPR */
6975 /* Level 3 cache control */
6978 /* XXX : not implemented */
6979 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
6980 SPR_NOACCESS
, SPR_NOACCESS
,
6981 &spr_read_generic
, &spr_write_generic
,
6984 /* XXX : not implemented */
6985 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
6986 SPR_NOACCESS
, SPR_NOACCESS
,
6987 &spr_read_generic
, &spr_write_generic
,
6990 /* XXX : not implemented */
6991 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
6992 SPR_NOACCESS
, SPR_NOACCESS
,
6993 &spr_read_generic
, &spr_write_generic
,
6996 /* XXX : not implemented */
6997 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
6998 SPR_NOACCESS
, SPR_NOACCESS
,
6999 &spr_read_generic
, &spr_write_generic
,
7002 /* XXX : not implemented */
7003 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7004 SPR_NOACCESS
, SPR_NOACCESS
,
7005 &spr_read_generic
, &spr_write_generic
,
7008 /* XXX : not implemented */
7009 spr_register(env
, SPR_ICTRL
, "ICTRL",
7010 SPR_NOACCESS
, SPR_NOACCESS
,
7011 &spr_read_generic
, &spr_write_generic
,
7014 /* XXX : not implemented */
7015 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7016 SPR_NOACCESS
, SPR_NOACCESS
,
7017 &spr_read_generic
, &spr_write_generic
,
7020 /* XXX : not implemented */
7021 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7022 SPR_NOACCESS
, SPR_NOACCESS
,
7023 &spr_read_generic
, &spr_write_generic
,
7025 /* XXX : not implemented */
7026 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7027 &spr_read_ureg
, SPR_NOACCESS
,
7028 &spr_read_ureg
, SPR_NOACCESS
,
7030 /* XXX : not implemented */
7031 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7032 SPR_NOACCESS
, SPR_NOACCESS
,
7033 &spr_read_generic
, &spr_write_generic
,
7035 /* XXX : not implemented */
7036 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7037 &spr_read_ureg
, SPR_NOACCESS
,
7038 &spr_read_ureg
, SPR_NOACCESS
,
7041 spr_register(env
, SPR_SPRG4
, "SPRG4",
7042 SPR_NOACCESS
, SPR_NOACCESS
,
7043 &spr_read_generic
, &spr_write_generic
,
7045 spr_register(env
, SPR_USPRG4
, "USPRG4",
7046 &spr_read_ureg
, SPR_NOACCESS
,
7047 &spr_read_ureg
, SPR_NOACCESS
,
7049 spr_register(env
, SPR_SPRG5
, "SPRG5",
7050 SPR_NOACCESS
, SPR_NOACCESS
,
7051 &spr_read_generic
, &spr_write_generic
,
7053 spr_register(env
, SPR_USPRG5
, "USPRG5",
7054 &spr_read_ureg
, SPR_NOACCESS
,
7055 &spr_read_ureg
, SPR_NOACCESS
,
7057 spr_register(env
, SPR_SPRG6
, "SPRG6",
7058 SPR_NOACCESS
, SPR_NOACCESS
,
7059 &spr_read_generic
, &spr_write_generic
,
7061 spr_register(env
, SPR_USPRG6
, "USPRG6",
7062 &spr_read_ureg
, SPR_NOACCESS
,
7063 &spr_read_ureg
, SPR_NOACCESS
,
7065 spr_register(env
, SPR_SPRG7
, "SPRG7",
7066 SPR_NOACCESS
, SPR_NOACCESS
,
7067 &spr_read_generic
, &spr_write_generic
,
7069 spr_register(env
, SPR_USPRG7
, "USPRG7",
7070 &spr_read_ureg
, SPR_NOACCESS
,
7071 &spr_read_ureg
, SPR_NOACCESS
,
7073 /* Memory management */
7076 gen_74xx_soft_tlb(env
, 128, 2);
7077 init_excp_7450(env
);
7078 env
->dcache_line_size
= 32;
7079 env
->icache_line_size
= 32;
7080 /* Allocate hardware IRQ controller */
7081 ppc6xx_irq_init(env
);
7084 POWERPC_FAMILY(7457)(ObjectClass
*oc
, void *data
)
7086 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7087 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7089 dc
->desc
= "PowerPC 7457 (aka G4)";
7090 pcc
->init_proc
= init_proc_7457
;
7091 pcc
->check_pow
= check_pow_hid0_74xx
;
7092 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7093 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7094 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7096 PPC_CACHE
| PPC_CACHE_ICBI
|
7097 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7098 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7099 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7100 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7101 PPC_SEGMENT
| PPC_EXTERN
|
7103 pcc
->msr_mask
= (1ull << MSR_VR
) |
7120 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7121 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7122 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7123 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7124 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7125 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7126 POWERPC_FLAG_BUS_CLK
;
7129 static void init_proc_e600 (CPUPPCState
*env
)
7131 gen_spr_ne_601(env
);
7135 /* 74xx specific SPR */
7137 /* XXX : not implemented */
7138 spr_register(env
, SPR_UBAMR
, "UBAMR",
7139 &spr_read_ureg
, SPR_NOACCESS
,
7140 &spr_read_ureg
, SPR_NOACCESS
,
7142 /* XXX : not implemented */
7143 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7144 SPR_NOACCESS
, SPR_NOACCESS
,
7145 &spr_read_generic
, &spr_write_generic
,
7147 /* XXX : not implemented */
7148 spr_register(env
, SPR_ICTRL
, "ICTRL",
7149 SPR_NOACCESS
, SPR_NOACCESS
,
7150 &spr_read_generic
, &spr_write_generic
,
7152 /* XXX : not implemented */
7153 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7154 SPR_NOACCESS
, SPR_NOACCESS
,
7155 &spr_read_generic
, &spr_write_generic
,
7157 /* XXX : not implemented */
7158 spr_register(env
, SPR_7XX_PMC5
, "PMC5",
7159 SPR_NOACCESS
, SPR_NOACCESS
,
7160 &spr_read_generic
, &spr_write_generic
,
7162 /* XXX : not implemented */
7163 spr_register(env
, SPR_7XX_UPMC5
, "UPMC5",
7164 &spr_read_ureg
, SPR_NOACCESS
,
7165 &spr_read_ureg
, SPR_NOACCESS
,
7167 /* XXX : not implemented */
7168 spr_register(env
, SPR_7XX_PMC6
, "PMC6",
7169 SPR_NOACCESS
, SPR_NOACCESS
,
7170 &spr_read_generic
, &spr_write_generic
,
7172 /* XXX : not implemented */
7173 spr_register(env
, SPR_7XX_UPMC6
, "UPMC6",
7174 &spr_read_ureg
, SPR_NOACCESS
,
7175 &spr_read_ureg
, SPR_NOACCESS
,
7178 spr_register(env
, SPR_SPRG4
, "SPRG4",
7179 SPR_NOACCESS
, SPR_NOACCESS
,
7180 &spr_read_generic
, &spr_write_generic
,
7182 spr_register(env
, SPR_USPRG4
, "USPRG4",
7183 &spr_read_ureg
, SPR_NOACCESS
,
7184 &spr_read_ureg
, SPR_NOACCESS
,
7186 spr_register(env
, SPR_SPRG5
, "SPRG5",
7187 SPR_NOACCESS
, SPR_NOACCESS
,
7188 &spr_read_generic
, &spr_write_generic
,
7190 spr_register(env
, SPR_USPRG5
, "USPRG5",
7191 &spr_read_ureg
, SPR_NOACCESS
,
7192 &spr_read_ureg
, SPR_NOACCESS
,
7194 spr_register(env
, SPR_SPRG6
, "SPRG6",
7195 SPR_NOACCESS
, SPR_NOACCESS
,
7196 &spr_read_generic
, &spr_write_generic
,
7198 spr_register(env
, SPR_USPRG6
, "USPRG6",
7199 &spr_read_ureg
, SPR_NOACCESS
,
7200 &spr_read_ureg
, SPR_NOACCESS
,
7202 spr_register(env
, SPR_SPRG7
, "SPRG7",
7203 SPR_NOACCESS
, SPR_NOACCESS
,
7204 &spr_read_generic
, &spr_write_generic
,
7206 spr_register(env
, SPR_USPRG7
, "USPRG7",
7207 &spr_read_ureg
, SPR_NOACCESS
,
7208 &spr_read_ureg
, SPR_NOACCESS
,
7210 /* Memory management */
7213 gen_74xx_soft_tlb(env
, 128, 2);
7214 init_excp_7450(env
);
7215 env
->dcache_line_size
= 32;
7216 env
->icache_line_size
= 32;
7217 /* Allocate hardware IRQ controller */
7218 ppc6xx_irq_init(env
);
7221 POWERPC_FAMILY(e600
)(ObjectClass
*oc
, void *data
)
7223 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7224 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7226 dc
->desc
= "PowerPC e600";
7227 pcc
->init_proc
= init_proc_e600
;
7228 pcc
->check_pow
= check_pow_hid0_74xx
;
7229 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7230 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7231 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7233 PPC_CACHE
| PPC_CACHE_ICBI
|
7234 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7235 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7236 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7237 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7238 PPC_SEGMENT
| PPC_EXTERN
|
7240 pcc
->insns_flags2
= PPC_NONE
;
7241 pcc
->msr_mask
= (1ull << MSR_VR
) |
7258 pcc
->mmu_model
= POWERPC_MMU_32B
;
7259 #if defined(CONFIG_SOFTMMU)
7260 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
7262 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7263 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7264 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7265 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7266 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7267 POWERPC_FLAG_BUS_CLK
;
7270 #if defined (TARGET_PPC64)
7271 #if defined(CONFIG_USER_ONLY)
7272 #define POWERPC970_HID5_INIT 0x00000080
7274 #define POWERPC970_HID5_INIT 0x00000000
7277 enum BOOK3S_CPU_TYPE
{
7279 BOOK3S_CPU_POWER5PLUS
,
7285 static void gen_fscr_facility_check(void *opaque
, int facility_sprn
, int bit
,
7286 int sprn
, int cause
)
7288 TCGv_i32 t1
= tcg_const_i32(bit
);
7289 TCGv_i32 t2
= tcg_const_i32(sprn
);
7290 TCGv_i32 t3
= tcg_const_i32(cause
);
7292 gen_update_current_nip(opaque
);
7293 gen_helper_fscr_facility_check(cpu_env
, t1
, t2
, t3
);
7295 tcg_temp_free_i32(t3
);
7296 tcg_temp_free_i32(t2
);
7297 tcg_temp_free_i32(t1
);
7300 static void gen_msr_facility_check(void *opaque
, int facility_sprn
, int bit
,
7301 int sprn
, int cause
)
7303 TCGv_i32 t1
= tcg_const_i32(bit
);
7304 TCGv_i32 t2
= tcg_const_i32(sprn
);
7305 TCGv_i32 t3
= tcg_const_i32(cause
);
7307 gen_update_current_nip(opaque
);
7308 gen_helper_msr_facility_check(cpu_env
, t1
, t2
, t3
);
7310 tcg_temp_free_i32(t3
);
7311 tcg_temp_free_i32(t2
);
7312 tcg_temp_free_i32(t1
);
7315 static void spr_read_prev_upper32(void *opaque
, int gprn
, int sprn
)
7317 TCGv spr_up
= tcg_temp_new();
7318 TCGv spr
= tcg_temp_new();
7320 gen_load_spr(spr
, sprn
- 1);
7321 tcg_gen_shri_tl(spr_up
, spr
, 32);
7322 tcg_gen_ext32u_tl(cpu_gpr
[gprn
], spr_up
);
7325 tcg_temp_free(spr_up
);
7328 static void spr_write_prev_upper32(void *opaque
, int sprn
, int gprn
)
7330 TCGv spr
= tcg_temp_new();
7332 gen_load_spr(spr
, sprn
- 1);
7333 tcg_gen_deposit_tl(spr
, spr
, cpu_gpr
[gprn
], 32, 32);
7334 gen_store_spr(sprn
- 1, spr
);
7339 static int check_pow_970 (CPUPPCState
*env
)
7341 if (env
->spr
[SPR_HID0
] & (HID0_DEEPNAP
| HID0_DOZE
| HID0_NAP
)) {
7348 static void gen_spr_970_hid(CPUPPCState
*env
)
7350 /* Hardware implementation registers */
7351 /* XXX : not implemented */
7352 spr_register(env
, SPR_HID0
, "HID0",
7353 SPR_NOACCESS
, SPR_NOACCESS
,
7354 &spr_read_generic
, &spr_write_clear
,
7356 spr_register(env
, SPR_HID1
, "HID1",
7357 SPR_NOACCESS
, SPR_NOACCESS
,
7358 &spr_read_generic
, &spr_write_generic
,
7360 spr_register(env
, SPR_970_HID5
, "HID5",
7361 SPR_NOACCESS
, SPR_NOACCESS
,
7362 &spr_read_generic
, &spr_write_generic
,
7363 POWERPC970_HID5_INIT
);
7366 static void gen_spr_970_hior(CPUPPCState
*env
)
7368 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7369 SPR_NOACCESS
, SPR_NOACCESS
,
7370 &spr_read_hior
, &spr_write_hior
,
7374 static void gen_spr_970_lpar(CPUPPCState
*env
)
7376 /* Logical partitionning */
7377 /* PPC970: HID4 is effectively the LPCR */
7378 spr_register(env
, SPR_970_HID4
, "HID4",
7379 SPR_NOACCESS
, SPR_NOACCESS
,
7380 &spr_read_generic
, &spr_write_generic
,
7384 static void gen_spr_book3s_common(CPUPPCState
*env
)
7386 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
7387 SPR_NOACCESS
, SPR_NOACCESS
,
7388 SPR_NOACCESS
, &spr_write_generic
,
7390 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
7391 &spr_read_ureg
, SPR_NOACCESS
,
7392 &spr_read_ureg
, SPR_NOACCESS
,
7396 static void gen_spr_book3s_altivec(CPUPPCState
*env
)
7398 if (!(env
->insns_flags
& PPC_ALTIVEC
)) {
7402 spr_register_kvm(env
, SPR_VRSAVE
, "VRSAVE",
7403 &spr_read_generic
, &spr_write_generic
,
7404 &spr_read_generic
, &spr_write_generic
,
7405 KVM_REG_PPC_VRSAVE
, 0x00000000);
7407 /* Can't find information on what this should be on reset. This
7408 * value is the one used by 74xx processors. */
7409 vscr_init(env
, 0x00010000);
7412 static void gen_spr_book3s_dbg(CPUPPCState
*env
)
7415 * TODO: different specs define different scopes for these,
7416 * will have to address this:
7417 * 970: super/write and super/read
7418 * powerisa 2.03..2.04: hypv/write and super/read.
7419 * powerisa 2.05 and newer: hypv/write and hypv/read.
7421 spr_register_kvm(env
, SPR_DABR
, "DABR",
7422 SPR_NOACCESS
, SPR_NOACCESS
,
7423 &spr_read_generic
, &spr_write_generic
,
7424 KVM_REG_PPC_DABR
, 0x00000000);
7425 spr_register_kvm(env
, SPR_DABRX
, "DABRX",
7426 SPR_NOACCESS
, SPR_NOACCESS
,
7427 &spr_read_generic
, &spr_write_generic
,
7428 KVM_REG_PPC_DABRX
, 0x00000000);
7431 static void gen_spr_970_dbg(CPUPPCState
*env
)
7434 spr_register(env
, SPR_IABR
, "IABR",
7435 SPR_NOACCESS
, SPR_NOACCESS
,
7436 &spr_read_generic
, &spr_write_generic
,
7440 static void gen_spr_book3s_pmu_sup(CPUPPCState
*env
)
7442 spr_register_kvm(env
, SPR_POWER_MMCR0
, "MMCR0",
7443 SPR_NOACCESS
, SPR_NOACCESS
,
7444 &spr_read_generic
, &spr_write_generic
,
7445 KVM_REG_PPC_MMCR0
, 0x00000000);
7446 spr_register_kvm(env
, SPR_POWER_MMCR1
, "MMCR1",
7447 SPR_NOACCESS
, SPR_NOACCESS
,
7448 &spr_read_generic
, &spr_write_generic
,
7449 KVM_REG_PPC_MMCR1
, 0x00000000);
7450 spr_register_kvm(env
, SPR_POWER_MMCRA
, "MMCRA",
7451 SPR_NOACCESS
, SPR_NOACCESS
,
7452 &spr_read_generic
, &spr_write_generic
,
7453 KVM_REG_PPC_MMCRA
, 0x00000000);
7454 spr_register_kvm(env
, SPR_POWER_PMC1
, "PMC1",
7455 SPR_NOACCESS
, SPR_NOACCESS
,
7456 &spr_read_generic
, &spr_write_generic
,
7457 KVM_REG_PPC_PMC1
, 0x00000000);
7458 spr_register_kvm(env
, SPR_POWER_PMC2
, "PMC2",
7459 SPR_NOACCESS
, SPR_NOACCESS
,
7460 &spr_read_generic
, &spr_write_generic
,
7461 KVM_REG_PPC_PMC2
, 0x00000000);
7462 spr_register_kvm(env
, SPR_POWER_PMC3
, "PMC3",
7463 SPR_NOACCESS
, SPR_NOACCESS
,
7464 &spr_read_generic
, &spr_write_generic
,
7465 KVM_REG_PPC_PMC3
, 0x00000000);
7466 spr_register_kvm(env
, SPR_POWER_PMC4
, "PMC4",
7467 SPR_NOACCESS
, SPR_NOACCESS
,
7468 &spr_read_generic
, &spr_write_generic
,
7469 KVM_REG_PPC_PMC4
, 0x00000000);
7470 spr_register_kvm(env
, SPR_POWER_PMC5
, "PMC5",
7471 SPR_NOACCESS
, SPR_NOACCESS
,
7472 &spr_read_generic
, &spr_write_generic
,
7473 KVM_REG_PPC_PMC5
, 0x00000000);
7474 spr_register_kvm(env
, SPR_POWER_PMC6
, "PMC6",
7475 SPR_NOACCESS
, SPR_NOACCESS
,
7476 &spr_read_generic
, &spr_write_generic
,
7477 KVM_REG_PPC_PMC6
, 0x00000000);
7478 spr_register_kvm(env
, SPR_POWER_SIAR
, "SIAR",
7479 SPR_NOACCESS
, SPR_NOACCESS
,
7480 &spr_read_generic
, &spr_write_generic
,
7481 KVM_REG_PPC_SIAR
, 0x00000000);
7482 spr_register_kvm(env
, SPR_POWER_SDAR
, "SDAR",
7483 SPR_NOACCESS
, SPR_NOACCESS
,
7484 &spr_read_generic
, &spr_write_generic
,
7485 KVM_REG_PPC_SDAR
, 0x00000000);
7488 static void gen_spr_book3s_pmu_user(CPUPPCState
*env
)
7490 spr_register(env
, SPR_POWER_UMMCR0
, "UMMCR0",
7491 &spr_read_ureg
, SPR_NOACCESS
,
7492 &spr_read_ureg
, &spr_write_ureg
,
7494 spr_register(env
, SPR_POWER_UMMCR1
, "UMMCR1",
7495 &spr_read_ureg
, SPR_NOACCESS
,
7496 &spr_read_ureg
, &spr_write_ureg
,
7498 spr_register(env
, SPR_POWER_UMMCRA
, "UMMCRA",
7499 &spr_read_ureg
, SPR_NOACCESS
,
7500 &spr_read_ureg
, &spr_write_ureg
,
7502 spr_register(env
, SPR_POWER_UPMC1
, "UPMC1",
7503 &spr_read_ureg
, SPR_NOACCESS
,
7504 &spr_read_ureg
, &spr_write_ureg
,
7506 spr_register(env
, SPR_POWER_UPMC2
, "UPMC2",
7507 &spr_read_ureg
, SPR_NOACCESS
,
7508 &spr_read_ureg
, &spr_write_ureg
,
7510 spr_register(env
, SPR_POWER_UPMC3
, "UPMC3",
7511 &spr_read_ureg
, SPR_NOACCESS
,
7512 &spr_read_ureg
, &spr_write_ureg
,
7514 spr_register(env
, SPR_POWER_UPMC4
, "UPMC4",
7515 &spr_read_ureg
, SPR_NOACCESS
,
7516 &spr_read_ureg
, &spr_write_ureg
,
7518 spr_register(env
, SPR_POWER_UPMC5
, "UPMC5",
7519 &spr_read_ureg
, SPR_NOACCESS
,
7520 &spr_read_ureg
, &spr_write_ureg
,
7522 spr_register(env
, SPR_POWER_UPMC6
, "UPMC6",
7523 &spr_read_ureg
, SPR_NOACCESS
,
7524 &spr_read_ureg
, &spr_write_ureg
,
7526 spr_register(env
, SPR_POWER_USIAR
, "USIAR",
7527 &spr_read_ureg
, SPR_NOACCESS
,
7528 &spr_read_ureg
, &spr_write_ureg
,
7530 spr_register(env
, SPR_POWER_USDAR
, "USDAR",
7531 &spr_read_ureg
, SPR_NOACCESS
,
7532 &spr_read_ureg
, &spr_write_ureg
,
7536 static void gen_spr_970_pmu_sup(CPUPPCState
*env
)
7538 spr_register_kvm(env
, SPR_970_PMC7
, "PMC7",
7539 SPR_NOACCESS
, SPR_NOACCESS
,
7540 &spr_read_generic
, &spr_write_generic
,
7541 KVM_REG_PPC_PMC7
, 0x00000000);
7542 spr_register_kvm(env
, SPR_970_PMC8
, "PMC8",
7543 SPR_NOACCESS
, SPR_NOACCESS
,
7544 &spr_read_generic
, &spr_write_generic
,
7545 KVM_REG_PPC_PMC8
, 0x00000000);
7548 static void gen_spr_970_pmu_user(CPUPPCState
*env
)
7550 spr_register(env
, SPR_970_UPMC7
, "UPMC7",
7551 &spr_read_ureg
, SPR_NOACCESS
,
7552 &spr_read_ureg
, &spr_write_ureg
,
7554 spr_register(env
, SPR_970_UPMC8
, "UPMC8",
7555 &spr_read_ureg
, SPR_NOACCESS
,
7556 &spr_read_ureg
, &spr_write_ureg
,
7560 static void gen_spr_power8_pmu_sup(CPUPPCState
*env
)
7562 spr_register_kvm(env
, SPR_POWER_MMCR2
, "MMCR2",
7563 SPR_NOACCESS
, SPR_NOACCESS
,
7564 &spr_read_generic
, &spr_write_generic
,
7565 KVM_REG_PPC_MMCR2
, 0x00000000);
7566 spr_register_kvm(env
, SPR_POWER_MMCRS
, "MMCRS",
7567 SPR_NOACCESS
, SPR_NOACCESS
,
7568 &spr_read_generic
, &spr_write_generic
,
7569 KVM_REG_PPC_MMCRS
, 0x00000000);
7572 static void gen_spr_power8_pmu_user(CPUPPCState
*env
)
7574 spr_register(env
, SPR_POWER_UMMCR2
, "UMMCR2",
7575 &spr_read_ureg
, SPR_NOACCESS
,
7576 &spr_read_ureg
, &spr_write_ureg
,
7580 static void gen_spr_power5p_ear(CPUPPCState
*env
)
7582 /* External access control */
7583 spr_register(env
, SPR_EAR
, "EAR",
7584 SPR_NOACCESS
, SPR_NOACCESS
,
7585 &spr_read_generic
, &spr_write_generic
,
7589 static void gen_spr_power5p_lpar(CPUPPCState
*env
)
7591 /* Logical partitionning */
7592 spr_register_kvm(env
, SPR_LPCR
, "LPCR",
7593 SPR_NOACCESS
, SPR_NOACCESS
,
7594 &spr_read_generic
, &spr_write_generic
,
7595 KVM_REG_PPC_LPCR
, 0x00000000);
7598 static void gen_spr_book3s_ids(CPUPPCState
*env
)
7600 /* Processor identification */
7601 spr_register(env
, SPR_PIR
, "PIR",
7602 SPR_NOACCESS
, SPR_NOACCESS
,
7603 &spr_read_generic
, &spr_write_pir
,
7607 static void gen_spr_power8_ids(CPUPPCState
*env
)
7609 /* Thread identification */
7610 spr_register(env
, SPR_TIR
, "TIR",
7611 SPR_NOACCESS
, SPR_NOACCESS
,
7612 &spr_read_generic
, SPR_NOACCESS
,
7616 static void gen_spr_book3s_purr(CPUPPCState
*env
)
7618 #if !defined(CONFIG_USER_ONLY)
7619 /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
7620 spr_register_kvm(env
, SPR_PURR
, "PURR",
7621 &spr_read_purr
, SPR_NOACCESS
,
7622 &spr_read_purr
, SPR_NOACCESS
,
7623 KVM_REG_PPC_PURR
, 0x00000000);
7624 spr_register_kvm(env
, SPR_SPURR
, "SPURR",
7625 &spr_read_purr
, SPR_NOACCESS
,
7626 &spr_read_purr
, SPR_NOACCESS
,
7627 KVM_REG_PPC_SPURR
, 0x00000000);
7631 static void gen_spr_power6_dbg(CPUPPCState
*env
)
7633 #if !defined(CONFIG_USER_ONLY)
7634 spr_register(env
, SPR_CFAR
, "SPR_CFAR",
7635 SPR_NOACCESS
, SPR_NOACCESS
,
7636 &spr_read_cfar
, &spr_write_cfar
,
7641 static void gen_spr_power5p_common(CPUPPCState
*env
)
7643 spr_register_kvm(env
, SPR_PPR
, "PPR",
7644 &spr_read_generic
, &spr_write_generic
,
7645 &spr_read_generic
, &spr_write_generic
,
7646 KVM_REG_PPC_PPR
, 0x00000000);
7649 static void gen_spr_power6_common(CPUPPCState
*env
)
7651 #if !defined(CONFIG_USER_ONLY)
7652 spr_register_kvm(env
, SPR_DSCR
, "SPR_DSCR",
7653 SPR_NOACCESS
, SPR_NOACCESS
,
7654 &spr_read_generic
, &spr_write_generic
,
7655 KVM_REG_PPC_DSCR
, 0x00000000);
7658 * Register PCR to report POWERPC_EXCP_PRIV_REG instead of
7659 * POWERPC_EXCP_INVAL_SPR.
7661 spr_register(env
, SPR_PCR
, "PCR",
7662 SPR_NOACCESS
, SPR_NOACCESS
,
7663 SPR_NOACCESS
, SPR_NOACCESS
,
7667 static void spr_read_tar(void *opaque
, int gprn
, int sprn
)
7669 gen_fscr_facility_check(opaque
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
7670 spr_read_generic(opaque
, gprn
, sprn
);
7673 static void spr_write_tar(void *opaque
, int sprn
, int gprn
)
7675 gen_fscr_facility_check(opaque
, SPR_FSCR
, FSCR_TAR
, sprn
, FSCR_IC_TAR
);
7676 spr_write_generic(opaque
, sprn
, gprn
);
7679 static void gen_spr_power8_tce_address_control(CPUPPCState
*env
)
7681 spr_register(env
, SPR_TAR
, "TAR",
7682 &spr_read_tar
, &spr_write_tar
,
7683 &spr_read_generic
, &spr_write_generic
,
7687 static void spr_read_tm(void *opaque
, int gprn
, int sprn
)
7689 gen_msr_facility_check(opaque
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
7690 spr_read_generic(opaque
, gprn
, sprn
);
7693 static void spr_write_tm(void *opaque
, int sprn
, int gprn
)
7695 gen_msr_facility_check(opaque
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
7696 spr_write_generic(opaque
, sprn
, gprn
);
7699 static void spr_read_tm_upper32(void *opaque
, int gprn
, int sprn
)
7701 gen_msr_facility_check(opaque
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
7702 spr_read_prev_upper32(opaque
, gprn
, sprn
);
7705 static void spr_write_tm_upper32(void *opaque
, int sprn
, int gprn
)
7707 gen_msr_facility_check(opaque
, SPR_FSCR
, MSR_TM
, sprn
, FSCR_IC_TM
);
7708 spr_write_prev_upper32(opaque
, sprn
, gprn
);
7711 static void gen_spr_power8_tm(CPUPPCState
*env
)
7713 spr_register_kvm(env
, SPR_TFHAR
, "TFHAR",
7714 &spr_read_tm
, &spr_write_tm
,
7715 &spr_read_tm
, &spr_write_tm
,
7716 KVM_REG_PPC_TFHAR
, 0x00000000);
7717 spr_register_kvm(env
, SPR_TFIAR
, "TFIAR",
7718 &spr_read_tm
, &spr_write_tm
,
7719 &spr_read_tm
, &spr_write_tm
,
7720 KVM_REG_PPC_TFIAR
, 0x00000000);
7721 spr_register_kvm(env
, SPR_TEXASR
, "TEXASR",
7722 &spr_read_tm
, &spr_write_tm
,
7723 &spr_read_tm
, &spr_write_tm
,
7724 KVM_REG_PPC_TEXASR
, 0x00000000);
7725 spr_register(env
, SPR_TEXASRU
, "TEXASRU",
7726 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
7727 &spr_read_tm_upper32
, &spr_write_tm_upper32
,
7731 static void spr_read_ebb(void *opaque
, int gprn
, int sprn
)
7733 gen_fscr_facility_check(opaque
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
7734 spr_read_generic(opaque
, gprn
, sprn
);
7737 static void spr_write_ebb(void *opaque
, int sprn
, int gprn
)
7739 gen_fscr_facility_check(opaque
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
7740 spr_write_generic(opaque
, sprn
, gprn
);
7743 static void spr_read_ebb_upper32(void *opaque
, int gprn
, int sprn
)
7745 gen_fscr_facility_check(opaque
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
7746 spr_read_prev_upper32(opaque
, gprn
, sprn
);
7749 static void spr_write_ebb_upper32(void *opaque
, int sprn
, int gprn
)
7751 gen_fscr_facility_check(opaque
, SPR_FSCR
, FSCR_EBB
, sprn
, FSCR_IC_EBB
);
7752 spr_write_prev_upper32(opaque
, sprn
, gprn
);
7755 static void gen_spr_power8_ebb(CPUPPCState
*env
)
7757 spr_register(env
, SPR_BESCRS
, "BESCRS",
7758 &spr_read_ebb
, &spr_write_ebb
,
7759 &spr_read_generic
, &spr_write_generic
,
7761 spr_register(env
, SPR_BESCRSU
, "BESCRSU",
7762 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
7763 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
7765 spr_register(env
, SPR_BESCRR
, "BESCRR",
7766 &spr_read_ebb
, &spr_write_ebb
,
7767 &spr_read_generic
, &spr_write_generic
,
7769 spr_register(env
, SPR_BESCRRU
, "BESCRRU",
7770 &spr_read_ebb_upper32
, &spr_write_ebb_upper32
,
7771 &spr_read_prev_upper32
, &spr_write_prev_upper32
,
7773 spr_register_kvm(env
, SPR_EBBHR
, "EBBHR",
7774 &spr_read_ebb
, &spr_write_ebb
,
7775 &spr_read_generic
, &spr_write_generic
,
7776 KVM_REG_PPC_EBBHR
, 0x00000000);
7777 spr_register_kvm(env
, SPR_EBBRR
, "EBBRR",
7778 &spr_read_ebb
, &spr_write_ebb
,
7779 &spr_read_generic
, &spr_write_generic
,
7780 KVM_REG_PPC_EBBRR
, 0x00000000);
7781 spr_register_kvm(env
, SPR_BESCR
, "BESCR",
7782 &spr_read_ebb
, &spr_write_ebb
,
7783 &spr_read_generic
, &spr_write_generic
,
7784 KVM_REG_PPC_BESCR
, 0x00000000);
7787 static void gen_spr_power8_fscr(CPUPPCState
*env
)
7789 #if defined(CONFIG_USER_ONLY)
7790 target_ulong initval
= 1ULL << FSCR_TAR
;
7792 target_ulong initval
= 0;
7794 spr_register_kvm(env
, SPR_FSCR
, "FSCR",
7795 SPR_NOACCESS
, SPR_NOACCESS
,
7796 &spr_read_generic
, &spr_write_generic
,
7797 KVM_REG_PPC_FSCR
, initval
);
7800 static void init_proc_book3s_64(CPUPPCState
*env
, int version
)
7802 gen_spr_ne_601(env
);
7804 gen_spr_book3s_altivec(env
);
7805 gen_spr_book3s_pmu_sup(env
);
7806 gen_spr_book3s_pmu_user(env
);
7807 gen_spr_book3s_common(env
);
7810 case BOOK3S_CPU_970
:
7811 case BOOK3S_CPU_POWER5PLUS
:
7812 gen_spr_970_hid(env
);
7813 gen_spr_970_hior(env
);
7815 gen_spr_970_pmu_sup(env
);
7816 gen_spr_970_pmu_user(env
);
7818 case BOOK3S_CPU_POWER7
:
7819 case BOOK3S_CPU_POWER8
:
7820 gen_spr_book3s_ids(env
);
7822 gen_spr_book3s_purr(env
);
7825 g_assert_not_reached();
7827 if (version
>= BOOK3S_CPU_POWER5PLUS
) {
7828 gen_spr_power5p_common(env
);
7829 gen_spr_power5p_lpar(env
);
7830 gen_spr_power5p_ear(env
);
7832 gen_spr_970_lpar(env
);
7834 if (version
== BOOK3S_CPU_970
) {
7835 gen_spr_970_dbg(env
);
7837 if (version
>= BOOK3S_CPU_POWER6
) {
7838 gen_spr_power6_common(env
);
7839 gen_spr_power6_dbg(env
);
7841 if (version
>= BOOK3S_CPU_POWER8
) {
7842 gen_spr_power8_tce_address_control(env
);
7843 gen_spr_power8_ids(env
);
7844 gen_spr_power8_ebb(env
);
7845 gen_spr_power8_fscr(env
);
7846 gen_spr_power8_pmu_sup(env
);
7847 gen_spr_power8_pmu_user(env
);
7848 gen_spr_power8_tm(env
);
7850 if (version
< BOOK3S_CPU_POWER8
) {
7851 gen_spr_book3s_dbg(env
);
7853 #if !defined(CONFIG_USER_ONLY)
7855 case BOOK3S_CPU_970
:
7856 case BOOK3S_CPU_POWER5PLUS
:
7859 case BOOK3S_CPU_POWER7
:
7860 case BOOK3S_CPU_POWER8
:
7866 /* Allocate hardware IRQ controller */
7868 case BOOK3S_CPU_970
:
7869 case BOOK3S_CPU_POWER5PLUS
:
7871 ppc970_irq_init(env
);
7873 case BOOK3S_CPU_POWER7
:
7874 case BOOK3S_CPU_POWER8
:
7875 init_excp_POWER7(env
);
7876 ppcPOWER7_irq_init(env
);
7879 g_assert_not_reached();
7882 env
->dcache_line_size
= 128;
7883 env
->icache_line_size
= 128;
7886 static void init_proc_970(CPUPPCState
*env
)
7888 init_proc_book3s_64(env
, BOOK3S_CPU_970
);
7891 POWERPC_FAMILY(970)(ObjectClass
*oc
, void *data
)
7893 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7894 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7896 dc
->desc
= "PowerPC 970";
7897 pcc
->init_proc
= init_proc_970
;
7898 pcc
->check_pow
= check_pow_970
;
7899 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7900 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7901 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7903 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7904 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7905 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7906 PPC_64B
| PPC_ALTIVEC
|
7907 PPC_SEGMENT_64B
| PPC_SLBI
;
7908 pcc
->msr_mask
= (1ull << MSR_SF
) |
7923 pcc
->mmu_model
= POWERPC_MMU_64B
;
7924 #if defined(CONFIG_SOFTMMU)
7925 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7927 pcc
->excp_model
= POWERPC_EXCP_970
;
7928 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
7929 pcc
->bfd_mach
= bfd_mach_ppc64
;
7930 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7931 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7932 POWERPC_FLAG_BUS_CLK
;
7933 pcc
->l1_dcache_size
= 0x8000;
7934 pcc
->l1_icache_size
= 0x10000;
7937 static void init_proc_power5plus(CPUPPCState
*env
)
7939 init_proc_book3s_64(env
, BOOK3S_CPU_POWER5PLUS
);
7942 POWERPC_FAMILY(POWER5P
)(ObjectClass
*oc
, void *data
)
7944 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7945 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7947 dc
->fw_name
= "PowerPC,POWER5";
7948 dc
->desc
= "POWER5+";
7949 pcc
->init_proc
= init_proc_power5plus
;
7950 pcc
->check_pow
= check_pow_970
;
7951 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7952 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7953 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7955 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7956 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7957 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7959 PPC_SEGMENT_64B
| PPC_SLBI
;
7960 pcc
->msr_mask
= (1ull << MSR_SF
) |
7975 pcc
->mmu_model
= POWERPC_MMU_64B
;
7976 #if defined(CONFIG_SOFTMMU)
7977 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7979 pcc
->excp_model
= POWERPC_EXCP_970
;
7980 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
7981 pcc
->bfd_mach
= bfd_mach_ppc64
;
7982 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7983 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7984 POWERPC_FLAG_BUS_CLK
;
7985 pcc
->l1_dcache_size
= 0x8000;
7986 pcc
->l1_icache_size
= 0x10000;
7989 static void powerpc_get_compat(Object
*obj
, Visitor
*v
,
7990 void *opaque
, const char *name
, Error
**errp
)
7992 char *value
= (char *)"";
7993 Property
*prop
= opaque
;
7994 uint32_t *max_compat
= qdev_get_prop_ptr(DEVICE(obj
), prop
);
7996 switch (*max_compat
) {
7997 case CPU_POWERPC_LOGICAL_2_05
:
7998 value
= (char *)"power6";
8000 case CPU_POWERPC_LOGICAL_2_06
:
8001 value
= (char *)"power7";
8003 case CPU_POWERPC_LOGICAL_2_07
:
8004 value
= (char *)"power8";
8009 error_setg(errp
, "Internal error: compat is set to %x",
8010 max_compat
? *max_compat
: -1);
8014 visit_type_str(v
, &value
, name
, errp
);
8017 static void powerpc_set_compat(Object
*obj
, Visitor
*v
,
8018 void *opaque
, const char *name
, Error
**errp
)
8020 Error
*error
= NULL
;
8022 Property
*prop
= opaque
;
8023 uint32_t *max_compat
= qdev_get_prop_ptr(DEVICE(obj
), prop
);
8025 visit_type_str(v
, &value
, name
, &error
);
8027 error_propagate(errp
, error
);
8031 if (strcmp(value
, "power6") == 0) {
8032 *max_compat
= CPU_POWERPC_LOGICAL_2_05
;
8033 } else if (strcmp(value
, "power7") == 0) {
8034 *max_compat
= CPU_POWERPC_LOGICAL_2_06
;
8035 } else if (strcmp(value
, "power8") == 0) {
8036 *max_compat
= CPU_POWERPC_LOGICAL_2_07
;
8038 error_setg(errp
, "Invalid compatibility mode \"%s\"", value
);
8044 static PropertyInfo powerpc_compat_propinfo
= {
8046 .legacy_name
= "powerpc-server-compat",
8047 .get
= powerpc_get_compat
,
8048 .set
= powerpc_set_compat
,
8051 #define DEFINE_PROP_POWERPC_COMPAT(_n, _s, _f) \
8052 DEFINE_PROP(_n, _s, _f, powerpc_compat_propinfo, uint32_t)
8054 static Property powerpc_servercpu_properties
[] = {
8055 DEFINE_PROP_POWERPC_COMPAT("compat", PowerPCCPU
, max_compat
),
8056 DEFINE_PROP_END_OF_LIST(),
8059 static void init_proc_POWER7 (CPUPPCState
*env
)
8061 init_proc_book3s_64(env
, BOOK3S_CPU_POWER7
);
8064 POWERPC_FAMILY(POWER7
)(ObjectClass
*oc
, void *data
)
8066 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8067 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8069 dc
->fw_name
= "PowerPC,POWER7";
8070 dc
->desc
= "POWER7";
8071 dc
->props
= powerpc_servercpu_properties
;
8072 pcc
->pvr
= CPU_POWERPC_POWER7_BASE
;
8073 pcc
->pvr_mask
= CPU_POWERPC_POWER7_MASK
;
8074 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
;
8075 pcc
->init_proc
= init_proc_POWER7
;
8076 pcc
->check_pow
= check_pow_nocheck
;
8077 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8078 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8079 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8080 PPC_FLOAT_FRSQRTES
|
8083 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8084 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8085 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8086 PPC_64B
| PPC_ALTIVEC
|
8087 PPC_SEGMENT_64B
| PPC_SLBI
|
8088 PPC_POPCNTB
| PPC_POPCNTWD
;
8089 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
8090 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8091 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8093 pcc
->msr_mask
= (1ull << MSR_SF
) |
8109 pcc
->mmu_model
= POWERPC_MMU_2_06
;
8110 #if defined(CONFIG_SOFTMMU)
8111 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8113 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
8114 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8115 pcc
->bfd_mach
= bfd_mach_ppc64
;
8116 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8117 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8118 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8120 pcc
->l1_dcache_size
= 0x8000;
8121 pcc
->l1_icache_size
= 0x8000;
8122 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8125 POWERPC_FAMILY(POWER7P
)(ObjectClass
*oc
, void *data
)
8127 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8128 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8130 dc
->fw_name
= "PowerPC,POWER7+";
8131 dc
->desc
= "POWER7+";
8132 dc
->props
= powerpc_servercpu_properties
;
8133 pcc
->pvr
= CPU_POWERPC_POWER7P_BASE
;
8134 pcc
->pvr_mask
= CPU_POWERPC_POWER7P_MASK
;
8135 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
;
8136 pcc
->init_proc
= init_proc_POWER7
;
8137 pcc
->check_pow
= check_pow_nocheck
;
8138 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8139 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8140 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8141 PPC_FLOAT_FRSQRTES
|
8144 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8145 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8146 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8147 PPC_64B
| PPC_ALTIVEC
|
8148 PPC_SEGMENT_64B
| PPC_SLBI
|
8149 PPC_POPCNTB
| PPC_POPCNTWD
;
8150 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
8151 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8152 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8154 pcc
->msr_mask
= (1ull << MSR_SF
) |
8170 pcc
->mmu_model
= POWERPC_MMU_2_06
;
8171 #if defined(CONFIG_SOFTMMU)
8172 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8174 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
8175 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8176 pcc
->bfd_mach
= bfd_mach_ppc64
;
8177 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8178 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8179 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8181 pcc
->l1_dcache_size
= 0x8000;
8182 pcc
->l1_icache_size
= 0x8000;
8183 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8186 static void init_proc_POWER8(CPUPPCState
*env
)
8188 init_proc_book3s_64(env
, BOOK3S_CPU_POWER8
);
8191 POWERPC_FAMILY(POWER8
)(ObjectClass
*oc
, void *data
)
8193 DeviceClass
*dc
= DEVICE_CLASS(oc
);
8194 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8196 dc
->fw_name
= "PowerPC,POWER8";
8197 dc
->desc
= "POWER8";
8198 dc
->props
= powerpc_servercpu_properties
;
8199 pcc
->pvr
= CPU_POWERPC_POWER8_BASE
;
8200 pcc
->pvr_mask
= CPU_POWERPC_POWER8_MASK
;
8201 pcc
->pcr_mask
= PCR_COMPAT_2_05
| PCR_COMPAT_2_06
;
8202 pcc
->init_proc
= init_proc_POWER8
;
8203 pcc
->check_pow
= check_pow_nocheck
;
8204 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
8205 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
8206 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
8207 PPC_FLOAT_FRSQRTES
|
8210 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
8211 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
8212 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
8213 PPC_64B
| PPC_64BX
| PPC_ALTIVEC
|
8214 PPC_SEGMENT_64B
| PPC_SLBI
|
8215 PPC_POPCNTB
| PPC_POPCNTWD
;
8216 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
8217 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
8218 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
8219 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
8220 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
8221 PPC2_ISA205
| PPC2_ISA207S
;
8222 pcc
->msr_mask
= (1ull << MSR_SF
) |
8239 pcc
->mmu_model
= POWERPC_MMU_2_06
;
8240 #if defined(CONFIG_SOFTMMU)
8241 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
8243 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
8244 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
8245 pcc
->bfd_mach
= bfd_mach_ppc64
;
8246 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
8247 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
8248 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
8250 pcc
->l1_dcache_size
= 0x8000;
8251 pcc
->l1_icache_size
= 0x8000;
8252 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_lpcr
;
8254 #endif /* defined (TARGET_PPC64) */
8257 /*****************************************************************************/
8258 /* Generic CPU instantiation routine */
8259 static void init_ppc_proc(PowerPCCPU
*cpu
)
8261 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8262 CPUPPCState
*env
= &cpu
->env
;
8263 #if !defined(CONFIG_USER_ONLY)
8266 env
->irq_inputs
= NULL
;
8267 /* Set all exception vectors to an invalid address */
8268 for (i
= 0; i
< POWERPC_EXCP_NB
; i
++)
8269 env
->excp_vectors
[i
] = (target_ulong
)(-1ULL);
8270 env
->ivor_mask
= 0x00000000;
8271 env
->ivpr_mask
= 0x00000000;
8272 /* Default MMU definitions */
8276 env
->tlb_type
= TLB_NONE
;
8278 /* Register SPR common to all PowerPC implementations */
8279 gen_spr_generic(env
);
8280 spr_register(env
, SPR_PVR
, "PVR",
8281 /* Linux permits userspace to read PVR */
8282 #if defined(CONFIG_LINUX_USER)
8288 &spr_read_generic
, SPR_NOACCESS
,
8290 /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
8291 if (pcc
->svr
!= POWERPC_SVR_NONE
) {
8292 if (pcc
->svr
& POWERPC_SVR_E500
) {
8293 spr_register(env
, SPR_E500_SVR
, "SVR",
8294 SPR_NOACCESS
, SPR_NOACCESS
,
8295 &spr_read_generic
, SPR_NOACCESS
,
8296 pcc
->svr
& ~POWERPC_SVR_E500
);
8298 spr_register(env
, SPR_SVR
, "SVR",
8299 SPR_NOACCESS
, SPR_NOACCESS
,
8300 &spr_read_generic
, SPR_NOACCESS
,
8304 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
8305 (*pcc
->init_proc
)(env
);
8307 /* MSR bits & flags consistency checks */
8308 if (env
->msr_mask
& (1 << 25)) {
8309 switch (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
8310 case POWERPC_FLAG_SPE
:
8311 case POWERPC_FLAG_VRE
:
8314 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8315 "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
8318 } else if (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
8319 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8320 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
8323 if (env
->msr_mask
& (1 << 17)) {
8324 switch (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8325 case POWERPC_FLAG_TGPR
:
8326 case POWERPC_FLAG_CE
:
8329 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8330 "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
8333 } else if (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8334 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8335 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
8338 if (env
->msr_mask
& (1 << 10)) {
8339 switch (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8340 POWERPC_FLAG_UBLE
)) {
8341 case POWERPC_FLAG_SE
:
8342 case POWERPC_FLAG_DWE
:
8343 case POWERPC_FLAG_UBLE
:
8346 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8347 "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
8348 "POWERPC_FLAG_UBLE\n");
8351 } else if (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8352 POWERPC_FLAG_UBLE
)) {
8353 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8354 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
8355 "POWERPC_FLAG_UBLE\n");
8358 if (env
->msr_mask
& (1 << 9)) {
8359 switch (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8360 case POWERPC_FLAG_BE
:
8361 case POWERPC_FLAG_DE
:
8364 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8365 "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
8368 } else if (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8369 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8370 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
8373 if (env
->msr_mask
& (1 << 2)) {
8374 switch (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8375 case POWERPC_FLAG_PX
:
8376 case POWERPC_FLAG_PMM
:
8379 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8380 "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
8383 } else if (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8384 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8385 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
8388 if ((env
->flags
& (POWERPC_FLAG_RTC_CLK
| POWERPC_FLAG_BUS_CLK
)) == 0) {
8389 fprintf(stderr
, "PowerPC flags inconsistency\n"
8390 "Should define the time-base and decrementer clock source\n");
8393 /* Allocate TLBs buffer when needed */
8394 #if !defined(CONFIG_USER_ONLY)
8395 if (env
->nb_tlb
!= 0) {
8396 int nb_tlb
= env
->nb_tlb
;
8397 if (env
->id_tlbs
!= 0)
8399 switch (env
->tlb_type
) {
8401 env
->tlb
.tlb6
= g_malloc0(nb_tlb
* sizeof(ppc6xx_tlb_t
));
8404 env
->tlb
.tlbe
= g_malloc0(nb_tlb
* sizeof(ppcemb_tlb_t
));
8407 env
->tlb
.tlbm
= g_malloc0(nb_tlb
* sizeof(ppcmas_tlb_t
));
8410 /* Pre-compute some useful values */
8411 env
->tlb_per_way
= env
->nb_tlb
/ env
->nb_ways
;
8413 if (env
->irq_inputs
== NULL
) {
8414 fprintf(stderr
, "WARNING: no internal IRQ controller registered.\n"
8415 " Attempt QEMU to crash very soon !\n");
8418 if (env
->check_pow
== NULL
) {
8419 fprintf(stderr
, "WARNING: no power management check handler "
8421 " Attempt QEMU to crash very soon !\n");
8425 #if defined(PPC_DUMP_CPU)
8426 static void dump_ppc_sprs (CPUPPCState
*env
)
8429 #if !defined(CONFIG_USER_ONLY)
8435 printf("Special purpose registers:\n");
8436 for (i
= 0; i
< 32; i
++) {
8437 for (j
= 0; j
< 32; j
++) {
8439 spr
= &env
->spr_cb
[n
];
8440 uw
= spr
->uea_write
!= NULL
&& spr
->uea_write
!= SPR_NOACCESS
;
8441 ur
= spr
->uea_read
!= NULL
&& spr
->uea_read
!= SPR_NOACCESS
;
8442 #if !defined(CONFIG_USER_ONLY)
8443 sw
= spr
->oea_write
!= NULL
&& spr
->oea_write
!= SPR_NOACCESS
;
8444 sr
= spr
->oea_read
!= NULL
&& spr
->oea_read
!= SPR_NOACCESS
;
8445 if (sw
|| sr
|| uw
|| ur
) {
8446 printf("SPR: %4d (%03x) %-8s s%c%c u%c%c\n",
8447 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
8448 sw
? 'w' : '-', sr
? 'r' : '-',
8449 uw
? 'w' : '-', ur
? 'r' : '-');
8453 printf("SPR: %4d (%03x) %-8s u%c%c\n",
8454 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
8455 uw
? 'w' : '-', ur
? 'r' : '-');
8465 /*****************************************************************************/
8471 PPC_DIRECT
= 0, /* Opcode routine */
8472 PPC_INDIRECT
= 1, /* Indirect opcode table */
8475 static inline int is_indirect_opcode (void *handler
)
8477 return ((uintptr_t)handler
& 0x03) == PPC_INDIRECT
;
8480 static inline opc_handler_t
**ind_table(void *handler
)
8482 return (opc_handler_t
**)((uintptr_t)handler
& ~3);
8485 /* Instruction table creation */
8486 /* Opcodes tables creation */
8487 static void fill_new_table (opc_handler_t
**table
, int len
)
8491 for (i
= 0; i
< len
; i
++)
8492 table
[i
] = &invalid_handler
;
8495 static int create_new_table (opc_handler_t
**table
, unsigned char idx
)
8497 opc_handler_t
**tmp
;
8499 tmp
= g_new(opc_handler_t
*, 0x20);
8500 fill_new_table(tmp
, 0x20);
8501 table
[idx
] = (opc_handler_t
*)((uintptr_t)tmp
| PPC_INDIRECT
);
8506 static int insert_in_table (opc_handler_t
**table
, unsigned char idx
,
8507 opc_handler_t
*handler
)
8509 if (table
[idx
] != &invalid_handler
)
8511 table
[idx
] = handler
;
8516 static int register_direct_insn (opc_handler_t
**ppc_opcodes
,
8517 unsigned char idx
, opc_handler_t
*handler
)
8519 if (insert_in_table(ppc_opcodes
, idx
, handler
) < 0) {
8520 printf("*** ERROR: opcode %02x already assigned in main "
8521 "opcode table\n", idx
);
8522 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8523 printf(" Registered handler '%s' - new handler '%s'\n",
8524 ppc_opcodes
[idx
]->oname
, handler
->oname
);
8532 static int register_ind_in_table (opc_handler_t
**table
,
8533 unsigned char idx1
, unsigned char idx2
,
8534 opc_handler_t
*handler
)
8536 if (table
[idx1
] == &invalid_handler
) {
8537 if (create_new_table(table
, idx1
) < 0) {
8538 printf("*** ERROR: unable to create indirect table "
8539 "idx=%02x\n", idx1
);
8543 if (!is_indirect_opcode(table
[idx1
])) {
8544 printf("*** ERROR: idx %02x already assigned to a direct "
8546 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8547 printf(" Registered handler '%s' - new handler '%s'\n",
8548 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
8553 if (handler
!= NULL
&&
8554 insert_in_table(ind_table(table
[idx1
]), idx2
, handler
) < 0) {
8555 printf("*** ERROR: opcode %02x already assigned in "
8556 "opcode table %02x\n", idx2
, idx1
);
8557 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8558 printf(" Registered handler '%s' - new handler '%s'\n",
8559 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
8567 static int register_ind_insn (opc_handler_t
**ppc_opcodes
,
8568 unsigned char idx1
, unsigned char idx2
,
8569 opc_handler_t
*handler
)
8573 ret
= register_ind_in_table(ppc_opcodes
, idx1
, idx2
, handler
);
8578 static int register_dblind_insn (opc_handler_t
**ppc_opcodes
,
8579 unsigned char idx1
, unsigned char idx2
,
8580 unsigned char idx3
, opc_handler_t
*handler
)
8582 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
8583 printf("*** ERROR: unable to join indirect table idx "
8584 "[%02x-%02x]\n", idx1
, idx2
);
8587 if (register_ind_in_table(ind_table(ppc_opcodes
[idx1
]), idx2
, idx3
,
8589 printf("*** ERROR: unable to insert opcode "
8590 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
8597 static int register_insn (opc_handler_t
**ppc_opcodes
, opcode_t
*insn
)
8599 if (insn
->opc2
!= 0xFF) {
8600 if (insn
->opc3
!= 0xFF) {
8601 if (register_dblind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
8602 insn
->opc3
, &insn
->handler
) < 0)
8605 if (register_ind_insn(ppc_opcodes
, insn
->opc1
,
8606 insn
->opc2
, &insn
->handler
) < 0)
8610 if (register_direct_insn(ppc_opcodes
, insn
->opc1
, &insn
->handler
) < 0)
8617 static int test_opcode_table (opc_handler_t
**table
, int len
)
8621 for (i
= 0, count
= 0; i
< len
; i
++) {
8622 /* Consistency fixup */
8623 if (table
[i
] == NULL
)
8624 table
[i
] = &invalid_handler
;
8625 if (table
[i
] != &invalid_handler
) {
8626 if (is_indirect_opcode(table
[i
])) {
8627 tmp
= test_opcode_table(ind_table(table
[i
]), 0x20);
8630 table
[i
] = &invalid_handler
;
8643 static void fix_opcode_tables (opc_handler_t
**ppc_opcodes
)
8645 if (test_opcode_table(ppc_opcodes
, 0x40) == 0)
8646 printf("*** WARNING: no opcode defined !\n");
8649 /*****************************************************************************/
8650 static void create_ppc_opcodes(PowerPCCPU
*cpu
, Error
**errp
)
8652 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8653 CPUPPCState
*env
= &cpu
->env
;
8656 fill_new_table(env
->opcodes
, 0x40);
8657 for (opc
= opcodes
; opc
< &opcodes
[ARRAY_SIZE(opcodes
)]; opc
++) {
8658 if (((opc
->handler
.type
& pcc
->insns_flags
) != 0) ||
8659 ((opc
->handler
.type2
& pcc
->insns_flags2
) != 0)) {
8660 if (register_insn(env
->opcodes
, opc
) < 0) {
8661 error_setg(errp
, "ERROR initializing PowerPC instruction "
8662 "0x%02x 0x%02x 0x%02x", opc
->opc1
, opc
->opc2
,
8668 fix_opcode_tables(env
->opcodes
);
8673 #if defined(PPC_DUMP_CPU)
8674 static void dump_ppc_insns (CPUPPCState
*env
)
8676 opc_handler_t
**table
, *handler
;
8678 uint8_t opc1
, opc2
, opc3
;
8680 printf("Instructions set:\n");
8681 /* opc1 is 6 bits long */
8682 for (opc1
= 0x00; opc1
< 0x40; opc1
++) {
8683 table
= env
->opcodes
;
8684 handler
= table
[opc1
];
8685 if (is_indirect_opcode(handler
)) {
8686 /* opc2 is 5 bits long */
8687 for (opc2
= 0; opc2
< 0x20; opc2
++) {
8688 table
= env
->opcodes
;
8689 handler
= env
->opcodes
[opc1
];
8690 table
= ind_table(handler
);
8691 handler
= table
[opc2
];
8692 if (is_indirect_opcode(handler
)) {
8693 table
= ind_table(handler
);
8694 /* opc3 is 5 bits long */
8695 for (opc3
= 0; opc3
< 0x20; opc3
++) {
8696 handler
= table
[opc3
];
8697 if (handler
->handler
!= &gen_invalid
) {
8698 /* Special hack to properly dump SPE insns */
8699 p
= strchr(handler
->oname
, '_');
8701 printf("INSN: %02x %02x %02x (%02d %04d) : "
8703 opc1
, opc2
, opc3
, opc1
,
8708 if ((p
- handler
->oname
) != strlen(q
) ||
8709 memcmp(handler
->oname
, q
, strlen(q
)) != 0) {
8710 /* First instruction */
8711 printf("INSN: %02x %02x %02x (%02d %04d) : "
8713 opc1
, opc2
<< 1, opc3
, opc1
,
8714 (opc3
<< 6) | (opc2
<< 1),
8715 (int)(p
- handler
->oname
),
8718 if (strcmp(p
+ 1, q
) != 0) {
8719 /* Second instruction */
8720 printf("INSN: %02x %02x %02x (%02d %04d) : "
8722 opc1
, (opc2
<< 1) | 1, opc3
, opc1
,
8723 (opc3
<< 6) | (opc2
<< 1) | 1,
8730 if (handler
->handler
!= &gen_invalid
) {
8731 printf("INSN: %02x %02x -- (%02d %04d) : %s\n",
8732 opc1
, opc2
, opc1
, opc2
, handler
->oname
);
8737 if (handler
->handler
!= &gen_invalid
) {
8738 printf("INSN: %02x -- -- (%02d ----) : %s\n",
8739 opc1
, opc1
, handler
->oname
);
8746 static int gdb_get_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8749 stfq_p(mem_buf
, env
->fpr
[n
]);
8753 stl_p(mem_buf
, env
->fpscr
);
8759 static int gdb_set_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8762 env
->fpr
[n
] = ldfq_p(mem_buf
);
8766 helper_store_fpscr(env
, ldl_p(mem_buf
), 0xffffffff);
8772 static int gdb_get_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8775 #ifdef HOST_WORDS_BIGENDIAN
8776 stq_p(mem_buf
, env
->avr
[n
].u64
[0]);
8777 stq_p(mem_buf
+8, env
->avr
[n
].u64
[1]);
8779 stq_p(mem_buf
, env
->avr
[n
].u64
[1]);
8780 stq_p(mem_buf
+8, env
->avr
[n
].u64
[0]);
8785 stl_p(mem_buf
, env
->vscr
);
8789 stl_p(mem_buf
, (uint32_t)env
->spr
[SPR_VRSAVE
]);
8795 static int gdb_set_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8798 #ifdef HOST_WORDS_BIGENDIAN
8799 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
);
8800 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
+8);
8802 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
);
8803 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
+8);
8808 env
->vscr
= ldl_p(mem_buf
);
8812 env
->spr
[SPR_VRSAVE
] = (target_ulong
)ldl_p(mem_buf
);
8818 static int gdb_get_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8821 #if defined(TARGET_PPC64)
8822 stl_p(mem_buf
, env
->gpr
[n
] >> 32);
8824 stl_p(mem_buf
, env
->gprh
[n
]);
8829 stq_p(mem_buf
, env
->spe_acc
);
8833 stl_p(mem_buf
, env
->spe_fscr
);
8839 static int gdb_set_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8842 #if defined(TARGET_PPC64)
8843 target_ulong lo
= (uint32_t)env
->gpr
[n
];
8844 target_ulong hi
= (target_ulong
)ldl_p(mem_buf
) << 32;
8845 env
->gpr
[n
] = lo
| hi
;
8847 env
->gprh
[n
] = ldl_p(mem_buf
);
8852 env
->spe_acc
= ldq_p(mem_buf
);
8856 env
->spe_fscr
= ldl_p(mem_buf
);
8862 static int ppc_fixup_cpu(PowerPCCPU
*cpu
)
8864 CPUPPCState
*env
= &cpu
->env
;
8866 /* TCG doesn't (yet) emulate some groups of instructions that
8867 * are implemented on some otherwise supported CPUs (e.g. VSX
8868 * and decimal floating point instructions on POWER7). We
8869 * remove unsupported instruction groups from the cpu state's
8870 * instruction masks and hope the guest can cope. For at
8871 * least the pseries machine, the unavailability of these
8872 * instructions can be advertised to the guest via the device
8874 if ((env
->insns_flags
& ~PPC_TCG_INSNS
)
8875 || (env
->insns_flags2
& ~PPC_TCG_INSNS2
)) {
8876 fprintf(stderr
, "Warning: Disabling some instructions which are not "
8877 "emulated by TCG (0x%" PRIx64
", 0x%" PRIx64
")\n",
8878 env
->insns_flags
& ~PPC_TCG_INSNS
,
8879 env
->insns_flags2
& ~PPC_TCG_INSNS2
);
8881 env
->insns_flags
&= PPC_TCG_INSNS
;
8882 env
->insns_flags2
&= PPC_TCG_INSNS2
;
8886 static inline bool ppc_cpu_is_valid(PowerPCCPUClass
*pcc
)
8888 #ifdef TARGET_PPCEMB
8889 return pcc
->mmu_model
== POWERPC_MMU_BOOKE
||
8890 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx
||
8891 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx_Z
;
8897 static void ppc_cpu_realizefn(DeviceState
*dev
, Error
**errp
)
8899 CPUState
*cs
= CPU(dev
);
8900 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
8901 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8902 Error
*local_err
= NULL
;
8903 #if !defined(CONFIG_USER_ONLY)
8904 int max_smt
= kvm_enabled() ? kvmppc_smt_threads() : 1;
8907 #if !defined(CONFIG_USER_ONLY)
8908 if (smp_threads
> max_smt
) {
8909 error_setg(errp
, "Cannot support more than %d threads on PPC with %s",
8910 max_smt
, kvm_enabled() ? "KVM" : "TCG");
8913 if (!is_power_of_2(smp_threads
)) {
8914 error_setg(errp
, "Cannot support %d threads on PPC with %s, "
8915 "threads count must be a power of 2.",
8916 smp_threads
, kvm_enabled() ? "KVM" : "TCG");
8920 cpu
->cpu_dt_id
= (cs
->cpu_index
/ smp_threads
) * max_smt
8921 + (cs
->cpu_index
% smp_threads
);
8924 if (tcg_enabled()) {
8925 if (ppc_fixup_cpu(cpu
) != 0) {
8926 error_setg(errp
, "Unable to emulate selected CPU with TCG");
8931 #if defined(TARGET_PPCEMB)
8932 if (!ppc_cpu_is_valid(pcc
)) {
8933 error_setg(errp
, "CPU does not possess a BookE or 4xx MMU. "
8934 "Please use qemu-system-ppc or qemu-system-ppc64 instead "
8935 "or choose another CPU model.");
8940 create_ppc_opcodes(cpu
, &local_err
);
8941 if (local_err
!= NULL
) {
8942 error_propagate(errp
, local_err
);
8947 if (pcc
->insns_flags
& PPC_FLOAT
) {
8948 gdb_register_coprocessor(cs
, gdb_get_float_reg
, gdb_set_float_reg
,
8949 33, "power-fpu.xml", 0);
8951 if (pcc
->insns_flags
& PPC_ALTIVEC
) {
8952 gdb_register_coprocessor(cs
, gdb_get_avr_reg
, gdb_set_avr_reg
,
8953 34, "power-altivec.xml", 0);
8955 if (pcc
->insns_flags
& PPC_SPE
) {
8956 gdb_register_coprocessor(cs
, gdb_get_spe_reg
, gdb_set_spe_reg
,
8957 34, "power-spe.xml", 0);
8962 pcc
->parent_realize(dev
, errp
);
8964 #if defined(PPC_DUMP_CPU)
8966 CPUPPCState
*env
= &cpu
->env
;
8967 const char *mmu_model
, *excp_model
, *bus_model
;
8968 switch (env
->mmu_model
) {
8969 case POWERPC_MMU_32B
:
8970 mmu_model
= "PowerPC 32";
8972 case POWERPC_MMU_SOFT_6xx
:
8973 mmu_model
= "PowerPC 6xx/7xx with software driven TLBs";
8975 case POWERPC_MMU_SOFT_74xx
:
8976 mmu_model
= "PowerPC 74xx with software driven TLBs";
8978 case POWERPC_MMU_SOFT_4xx
:
8979 mmu_model
= "PowerPC 4xx with software driven TLBs";
8981 case POWERPC_MMU_SOFT_4xx_Z
:
8982 mmu_model
= "PowerPC 4xx with software driven TLBs "
8983 "and zones protections";
8985 case POWERPC_MMU_REAL
:
8986 mmu_model
= "PowerPC real mode only";
8988 case POWERPC_MMU_MPC8xx
:
8989 mmu_model
= "PowerPC MPC8xx";
8991 case POWERPC_MMU_BOOKE
:
8992 mmu_model
= "PowerPC BookE";
8994 case POWERPC_MMU_BOOKE206
:
8995 mmu_model
= "PowerPC BookE 2.06";
8997 case POWERPC_MMU_601
:
8998 mmu_model
= "PowerPC 601";
9000 #if defined (TARGET_PPC64)
9001 case POWERPC_MMU_64B
:
9002 mmu_model
= "PowerPC 64";
9006 mmu_model
= "Unknown or invalid";
9009 switch (env
->excp_model
) {
9010 case POWERPC_EXCP_STD
:
9011 excp_model
= "PowerPC";
9013 case POWERPC_EXCP_40x
:
9014 excp_model
= "PowerPC 40x";
9016 case POWERPC_EXCP_601
:
9017 excp_model
= "PowerPC 601";
9019 case POWERPC_EXCP_602
:
9020 excp_model
= "PowerPC 602";
9022 case POWERPC_EXCP_603
:
9023 excp_model
= "PowerPC 603";
9025 case POWERPC_EXCP_603E
:
9026 excp_model
= "PowerPC 603e";
9028 case POWERPC_EXCP_604
:
9029 excp_model
= "PowerPC 604";
9031 case POWERPC_EXCP_7x0
:
9032 excp_model
= "PowerPC 740/750";
9034 case POWERPC_EXCP_7x5
:
9035 excp_model
= "PowerPC 745/755";
9037 case POWERPC_EXCP_74xx
:
9038 excp_model
= "PowerPC 74xx";
9040 case POWERPC_EXCP_BOOKE
:
9041 excp_model
= "PowerPC BookE";
9043 #if defined (TARGET_PPC64)
9044 case POWERPC_EXCP_970
:
9045 excp_model
= "PowerPC 970";
9049 excp_model
= "Unknown or invalid";
9052 switch (env
->bus_model
) {
9053 case PPC_FLAGS_INPUT_6xx
:
9054 bus_model
= "PowerPC 6xx";
9056 case PPC_FLAGS_INPUT_BookE
:
9057 bus_model
= "PowerPC BookE";
9059 case PPC_FLAGS_INPUT_405
:
9060 bus_model
= "PowerPC 405";
9062 case PPC_FLAGS_INPUT_401
:
9063 bus_model
= "PowerPC 401/403";
9065 case PPC_FLAGS_INPUT_RCPU
:
9066 bus_model
= "RCPU / MPC8xx";
9068 #if defined (TARGET_PPC64)
9069 case PPC_FLAGS_INPUT_970
:
9070 bus_model
= "PowerPC 970";
9074 bus_model
= "Unknown or invalid";
9077 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64
"\n"
9078 " MMU model : %s\n",
9079 object_class_get_name(OBJECT_CLASS(pcc
)),
9080 pcc
->pvr
, pcc
->msr_mask
, mmu_model
);
9081 #if !defined(CONFIG_USER_ONLY)
9082 if (env
->tlb
.tlb6
) {
9083 printf(" %d %s TLB in %d ways\n",
9084 env
->nb_tlb
, env
->id_tlbs
? "splitted" : "merged",
9088 printf(" Exceptions model : %s\n"
9089 " Bus model : %s\n",
9090 excp_model
, bus_model
);
9091 printf(" MSR features :\n");
9092 if (env
->flags
& POWERPC_FLAG_SPE
)
9093 printf(" signal processing engine enable"
9095 else if (env
->flags
& POWERPC_FLAG_VRE
)
9096 printf(" vector processor enable\n");
9097 if (env
->flags
& POWERPC_FLAG_TGPR
)
9098 printf(" temporary GPRs\n");
9099 else if (env
->flags
& POWERPC_FLAG_CE
)
9100 printf(" critical input enable\n");
9101 if (env
->flags
& POWERPC_FLAG_SE
)
9102 printf(" single-step trace mode\n");
9103 else if (env
->flags
& POWERPC_FLAG_DWE
)
9104 printf(" debug wait enable\n");
9105 else if (env
->flags
& POWERPC_FLAG_UBLE
)
9106 printf(" user BTB lock enable\n");
9107 if (env
->flags
& POWERPC_FLAG_BE
)
9108 printf(" branch-step trace mode\n");
9109 else if (env
->flags
& POWERPC_FLAG_DE
)
9110 printf(" debug interrupt enable\n");
9111 if (env
->flags
& POWERPC_FLAG_PX
)
9112 printf(" inclusive protection\n");
9113 else if (env
->flags
& POWERPC_FLAG_PMM
)
9114 printf(" performance monitor mark\n");
9115 if (env
->flags
== POWERPC_FLAG_NONE
)
9117 printf(" Time-base/decrementer clock source: %s\n",
9118 env
->flags
& POWERPC_FLAG_RTC_CLK
? "RTC clock" : "bus clock");
9119 dump_ppc_insns(env
);
9126 static void ppc_cpu_unrealizefn(DeviceState
*dev
, Error
**errp
)
9128 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
9129 CPUPPCState
*env
= &cpu
->env
;
9132 for (i
= 0; i
< PPC_CPU_OPCODES_LEN
; i
++) {
9133 if (env
->opcodes
[i
] != &invalid_handler
) {
9134 g_free(env
->opcodes
[i
]);
9139 int ppc_get_compat_smt_threads(PowerPCCPU
*cpu
)
9141 int ret
= smp_threads
;
9142 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9144 switch (cpu
->cpu_version
) {
9145 case CPU_POWERPC_LOGICAL_2_05
:
9148 case CPU_POWERPC_LOGICAL_2_06
:
9151 case CPU_POWERPC_LOGICAL_2_07
:
9155 if (pcc
->pcr_mask
& PCR_COMPAT_2_06
) {
9157 } else if (pcc
->pcr_mask
& PCR_COMPAT_2_05
) {
9163 return MIN(ret
, smp_threads
);
9166 int ppc_set_compat(PowerPCCPU
*cpu
, uint32_t cpu_version
)
9169 CPUPPCState
*env
= &cpu
->env
;
9171 cpu
->cpu_version
= cpu_version
;
9173 switch (cpu_version
) {
9174 case CPU_POWERPC_LOGICAL_2_05
:
9175 env
->spr
[SPR_PCR
] = PCR_COMPAT_2_05
;
9177 case CPU_POWERPC_LOGICAL_2_06
:
9178 env
->spr
[SPR_PCR
] = PCR_COMPAT_2_06
;
9180 case CPU_POWERPC_LOGICAL_2_06_PLUS
:
9181 env
->spr
[SPR_PCR
] = PCR_COMPAT_2_06
;
9184 env
->spr
[SPR_PCR
] = 0;
9188 if (kvm_enabled() && kvmppc_set_compat(cpu
, cpu
->max_compat
) < 0) {
9189 error_report("Unable to set compatibility mode in KVM");
9196 static gint
ppc_cpu_compare_class_pvr(gconstpointer a
, gconstpointer b
)
9198 ObjectClass
*oc
= (ObjectClass
*)a
;
9199 uint32_t pvr
= *(uint32_t *)b
;
9200 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
9202 /* -cpu host does a PVR lookup during construction */
9203 if (unlikely(strcmp(object_class_get_name(oc
),
9204 TYPE_HOST_POWERPC_CPU
) == 0)) {
9208 if (!ppc_cpu_is_valid(pcc
)) {
9212 return pcc
->pvr
== pvr
? 0 : -1;
9215 PowerPCCPUClass
*ppc_cpu_class_by_pvr(uint32_t pvr
)
9217 GSList
*list
, *item
;
9218 PowerPCCPUClass
*pcc
= NULL
;
9220 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9221 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr
);
9223 pcc
= POWERPC_CPU_CLASS(item
->data
);
9230 static gint
ppc_cpu_compare_class_pvr_mask(gconstpointer a
, gconstpointer b
)
9232 ObjectClass
*oc
= (ObjectClass
*)a
;
9233 uint32_t pvr
= *(uint32_t *)b
;
9234 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
9237 /* -cpu host does a PVR lookup during construction */
9238 if (unlikely(strcmp(object_class_get_name(oc
),
9239 TYPE_HOST_POWERPC_CPU
) == 0)) {
9243 if (!ppc_cpu_is_valid(pcc
)) {
9247 ret
= (((pcc
->pvr
& pcc
->pvr_mask
) == (pvr
& pcc
->pvr_mask
)) ? 0 : -1);
9252 PowerPCCPUClass
*ppc_cpu_class_by_pvr_mask(uint32_t pvr
)
9254 GSList
*list
, *item
;
9255 PowerPCCPUClass
*pcc
= NULL
;
9257 list
= object_class_get_list(TYPE_POWERPC_CPU
, true);
9258 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr_mask
);
9260 pcc
= POWERPC_CPU_CLASS(item
->data
);
9267 static gint
ppc_cpu_compare_class_name(gconstpointer a
, gconstpointer b
)
9269 ObjectClass
*oc
= (ObjectClass
*)a
;
9270 const char *name
= b
;
9271 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9273 if (strncasecmp(name
, object_class_get_name(oc
), strlen(name
)) == 0 &&
9274 ppc_cpu_is_valid(pcc
) &&
9275 strcmp(object_class_get_name(oc
) + strlen(name
),
9276 "-" TYPE_POWERPC_CPU
) == 0) {
9284 static ObjectClass
*ppc_cpu_class_by_name(const char *name
);
9286 static ObjectClass
*ppc_cpu_class_by_alias(PowerPCCPUAlias
*alias
)
9288 ObjectClass
*invalid_class
= (void*)ppc_cpu_class_by_alias
;
9290 /* Cache target class lookups in the alias table */
9292 alias
->oc
= ppc_cpu_class_by_name(alias
->model
);
9294 /* Fast check for non-existing aliases */
9295 alias
->oc
= invalid_class
;
9299 if (alias
->oc
== invalid_class
) {
9306 static ObjectClass
*ppc_cpu_class_by_name(const char *name
)
9308 GSList
*list
, *item
;
9309 ObjectClass
*ret
= NULL
;
9313 /* Check if the given name is a PVR */
9315 if (len
== 10 && name
[0] == '0' && name
[1] == 'x') {
9318 } else if (len
== 8) {
9321 for (i
= 0; i
< 8; i
++) {
9322 if (!qemu_isxdigit(*p
++))
9326 ret
= OBJECT_CLASS(ppc_cpu_class_by_pvr(strtoul(name
, NULL
, 16)));
9331 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9332 item
= g_slist_find_custom(list
, name
, ppc_cpu_compare_class_name
);
9334 ret
= OBJECT_CLASS(item
->data
);
9342 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9343 if (strcmp(ppc_cpu_aliases
[i
].alias
, name
) == 0) {
9344 return ppc_cpu_class_by_alias(&ppc_cpu_aliases
[i
]);
9351 PowerPCCPU
*cpu_ppc_init(const char *cpu_model
)
9353 return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU
, cpu_model
));
9356 /* Sort by PVR, ordering special case "host" last. */
9357 static gint
ppc_cpu_list_compare(gconstpointer a
, gconstpointer b
)
9359 ObjectClass
*oc_a
= (ObjectClass
*)a
;
9360 ObjectClass
*oc_b
= (ObjectClass
*)b
;
9361 PowerPCCPUClass
*pcc_a
= POWERPC_CPU_CLASS(oc_a
);
9362 PowerPCCPUClass
*pcc_b
= POWERPC_CPU_CLASS(oc_b
);
9363 const char *name_a
= object_class_get_name(oc_a
);
9364 const char *name_b
= object_class_get_name(oc_b
);
9366 if (strcmp(name_a
, TYPE_HOST_POWERPC_CPU
) == 0) {
9368 } else if (strcmp(name_b
, TYPE_HOST_POWERPC_CPU
) == 0) {
9371 /* Avoid an integer overflow during subtraction */
9372 if (pcc_a
->pvr
< pcc_b
->pvr
) {
9374 } else if (pcc_a
->pvr
> pcc_b
->pvr
) {
9382 static void ppc_cpu_list_entry(gpointer data
, gpointer user_data
)
9384 ObjectClass
*oc
= data
;
9385 CPUListState
*s
= user_data
;
9386 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9387 const char *typename
= object_class_get_name(oc
);
9391 if (!ppc_cpu_is_valid(pcc
)) {
9394 if (unlikely(strcmp(typename
, TYPE_HOST_POWERPC_CPU
) == 0)) {
9398 name
= g_strndup(typename
,
9399 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
9400 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s PVR %08x\n",
9402 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9403 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
9404 ObjectClass
*alias_oc
= ppc_cpu_class_by_alias(alias
);
9406 if (alias_oc
!= oc
) {
9409 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s (alias for %s)\n",
9410 alias
->alias
, name
);
9415 void ppc_cpu_list(FILE *f
, fprintf_function cpu_fprintf
)
9419 .cpu_fprintf
= cpu_fprintf
,
9423 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9424 list
= g_slist_sort(list
, ppc_cpu_list_compare
);
9425 g_slist_foreach(list
, ppc_cpu_list_entry
, &s
);
9429 cpu_fprintf(f
, "\n");
9430 cpu_fprintf(f
, "PowerPC %-16s\n", "host");
9434 static void ppc_cpu_defs_entry(gpointer data
, gpointer user_data
)
9436 ObjectClass
*oc
= data
;
9437 CpuDefinitionInfoList
**first
= user_data
;
9438 const char *typename
;
9439 CpuDefinitionInfoList
*entry
;
9440 CpuDefinitionInfo
*info
;
9441 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9443 if (!ppc_cpu_is_valid(pcc
)) {
9447 typename
= object_class_get_name(oc
);
9448 info
= g_malloc0(sizeof(*info
));
9449 info
->name
= g_strndup(typename
,
9450 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
9452 entry
= g_malloc0(sizeof(*entry
));
9453 entry
->value
= info
;
9454 entry
->next
= *first
;
9458 CpuDefinitionInfoList
*arch_query_cpu_definitions(Error
**errp
)
9460 CpuDefinitionInfoList
*cpu_list
= NULL
;
9464 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9465 g_slist_foreach(list
, ppc_cpu_defs_entry
, &cpu_list
);
9468 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9469 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
9471 CpuDefinitionInfoList
*entry
;
9472 CpuDefinitionInfo
*info
;
9474 oc
= ppc_cpu_class_by_alias(alias
);
9479 info
= g_malloc0(sizeof(*info
));
9480 info
->name
= g_strdup(alias
->alias
);
9482 entry
= g_malloc0(sizeof(*entry
));
9483 entry
->value
= info
;
9484 entry
->next
= cpu_list
;
9491 static void ppc_cpu_set_pc(CPUState
*cs
, vaddr value
)
9493 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9495 cpu
->env
.nip
= value
;
9498 static bool ppc_cpu_has_work(CPUState
*cs
)
9500 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9501 CPUPPCState
*env
= &cpu
->env
;
9503 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
9506 /* CPUClass::reset() */
9507 static void ppc_cpu_reset(CPUState
*s
)
9509 PowerPCCPU
*cpu
= POWERPC_CPU(s
);
9510 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9511 CPUPPCState
*env
= &cpu
->env
;
9515 pcc
->parent_reset(s
);
9517 msr
= (target_ulong
)0;
9519 /* XXX: find a suitable condition to enable the hypervisor mode */
9520 msr
|= (target_ulong
)MSR_HVB
;
9522 msr
|= (target_ulong
)0 << MSR_AP
; /* TO BE CHECKED */
9523 msr
|= (target_ulong
)0 << MSR_SA
; /* TO BE CHECKED */
9524 msr
|= (target_ulong
)1 << MSR_EP
;
9525 #if defined(DO_SINGLE_STEP) && 0
9526 /* Single step trace mode */
9527 msr
|= (target_ulong
)1 << MSR_SE
;
9528 msr
|= (target_ulong
)1 << MSR_BE
;
9530 #if defined(CONFIG_USER_ONLY)
9531 msr
|= (target_ulong
)1 << MSR_FP
; /* Allow floating point usage */
9532 msr
|= (target_ulong
)1 << MSR_VR
; /* Allow altivec usage */
9533 msr
|= (target_ulong
)1 << MSR_VSX
; /* Allow VSX usage */
9534 msr
|= (target_ulong
)1 << MSR_SPE
; /* Allow SPE usage */
9535 msr
|= (target_ulong
)1 << MSR_PR
;
9536 #if defined(TARGET_PPC64)
9537 msr
|= (target_ulong
)1 << MSR_TM
; /* Transactional memory */
9539 #if !defined(TARGET_WORDS_BIGENDIAN)
9540 msr
|= (target_ulong
)1 << MSR_LE
; /* Little-endian user mode */
9544 #if defined(TARGET_PPC64)
9545 if (env
->mmu_model
& POWERPC_MMU_64
) {
9546 env
->msr
|= (1ULL << MSR_SF
);
9550 hreg_store_msr(env
, msr
, 1);
9552 #if !defined(CONFIG_USER_ONLY)
9553 env
->nip
= env
->hreset_vector
| env
->excp_prefix
;
9554 if (env
->mmu_model
!= POWERPC_MMU_REAL
) {
9555 ppc_tlb_invalidate_all(env
);
9559 hreg_compute_hflags(env
);
9560 env
->reserve_addr
= (target_ulong
)-1ULL;
9561 /* Be sure no exception or interrupt is pending */
9562 env
->pending_interrupts
= 0;
9563 s
->exception_index
= POWERPC_EXCP_NONE
;
9564 env
->error_code
= 0;
9566 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
9568 env
->slb_shadow_addr
= 0;
9569 env
->slb_shadow_size
= 0;
9572 #endif /* TARGET_PPC64 */
9574 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
9575 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
9580 env
->spr
[i
] = spr
->default_value
;
9583 /* Flush all TLBs */
9587 static void ppc_cpu_initfn(Object
*obj
)
9589 CPUState
*cs
= CPU(obj
);
9590 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
9591 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9592 CPUPPCState
*env
= &cpu
->env
;
9596 cpu
->cpu_dt_id
= cs
->cpu_index
;
9598 env
->msr_mask
= pcc
->msr_mask
;
9599 env
->mmu_model
= pcc
->mmu_model
;
9600 env
->excp_model
= pcc
->excp_model
;
9601 env
->bus_model
= pcc
->bus_model
;
9602 env
->insns_flags
= pcc
->insns_flags
;
9603 env
->insns_flags2
= pcc
->insns_flags2
;
9604 env
->flags
= pcc
->flags
;
9605 env
->bfd_mach
= pcc
->bfd_mach
;
9606 env
->check_pow
= pcc
->check_pow
;
9608 #if defined(TARGET_PPC64)
9610 env
->sps
= *pcc
->sps
;
9611 } else if (env
->mmu_model
& POWERPC_MMU_64
) {
9612 /* Use default sets of page sizes */
9613 static const struct ppc_segment_page_sizes defsps
= {
9615 { .page_shift
= 12, /* 4K */
9617 .enc
= { { .page_shift
= 12, .pte_enc
= 0 } }
9619 { .page_shift
= 24, /* 16M */
9621 .enc
= { { .page_shift
= 24, .pte_enc
= 0 } }
9627 #endif /* defined(TARGET_PPC64) */
9629 if (tcg_enabled()) {
9630 ppc_translate_init();
9634 static void ppc_cpu_class_init(ObjectClass
*oc
, void *data
)
9636 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9637 CPUClass
*cc
= CPU_CLASS(oc
);
9638 DeviceClass
*dc
= DEVICE_CLASS(oc
);
9640 pcc
->parent_realize
= dc
->realize
;
9641 pcc
->pvr
= CPU_POWERPC_DEFAULT_MASK
;
9642 pcc
->pvr_mask
= CPU_POWERPC_DEFAULT_MASK
;
9643 pcc
->interrupts_big_endian
= ppc_cpu_interrupts_big_endian_always
;
9644 dc
->realize
= ppc_cpu_realizefn
;
9645 dc
->unrealize
= ppc_cpu_unrealizefn
;
9647 pcc
->parent_reset
= cc
->reset
;
9648 cc
->reset
= ppc_cpu_reset
;
9650 cc
->class_by_name
= ppc_cpu_class_by_name
;
9651 cc
->has_work
= ppc_cpu_has_work
;
9652 cc
->do_interrupt
= ppc_cpu_do_interrupt
;
9653 cc
->dump_state
= ppc_cpu_dump_state
;
9654 cc
->dump_statistics
= ppc_cpu_dump_statistics
;
9655 cc
->set_pc
= ppc_cpu_set_pc
;
9656 cc
->gdb_read_register
= ppc_cpu_gdb_read_register
;
9657 cc
->gdb_write_register
= ppc_cpu_gdb_write_register
;
9658 #ifdef CONFIG_USER_ONLY
9659 cc
->handle_mmu_fault
= ppc_cpu_handle_mmu_fault
;
9661 cc
->get_phys_page_debug
= ppc_cpu_get_phys_page_debug
;
9662 cc
->vmsd
= &vmstate_ppc_cpu
;
9663 #if defined(TARGET_PPC64)
9664 cc
->write_elf64_note
= ppc64_cpu_write_elf64_note
;
9665 cc
->write_elf64_qemunote
= ppc64_cpu_write_elf64_qemunote
;
9669 cc
->gdb_num_core_regs
= 71;
9670 #if defined(TARGET_PPC64)
9671 cc
->gdb_core_xml_file
= "power64-core.xml";
9673 cc
->gdb_core_xml_file
= "power-core.xml";
9676 dc
->fw_name
= "PowerPC,UNKNOWN";
9679 static const TypeInfo ppc_cpu_type_info
= {
9680 .name
= TYPE_POWERPC_CPU
,
9682 .instance_size
= sizeof(PowerPCCPU
),
9683 .instance_init
= ppc_cpu_initfn
,
9685 .class_size
= sizeof(PowerPCCPUClass
),
9686 .class_init
= ppc_cpu_class_init
,
9689 static void ppc_cpu_register_types(void)
9691 type_register_static(&ppc_cpu_type_info
);
9694 type_init(ppc_cpu_register_types
)