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"
32 //#define PPC_DUMP_CPU
33 //#define PPC_DEBUG_SPR
34 //#define PPC_DUMP_SPR_ACCESSES
36 /* For user-mode emulation, we don't emulate any IRQ controller */
37 #if defined(CONFIG_USER_ONLY)
38 #define PPC_IRQ_INIT_FN(name) \
39 static inline void glue(glue(ppc, name),_irq_init) (CPUPPCState *env) \
43 #define PPC_IRQ_INIT_FN(name) \
44 void glue(glue(ppc, name),_irq_init) (CPUPPCState *env);
50 PPC_IRQ_INIT_FN(POWER7
);
51 PPC_IRQ_INIT_FN(e500
);
54 * do nothing but store/retrieve spr value
56 static void spr_load_dump_spr(int sprn
)
58 #ifdef PPC_DUMP_SPR_ACCESSES
59 TCGv_i32 t0
= tcg_const_i32(sprn
);
60 gen_helper_load_dump_spr(cpu_env
, t0
);
61 tcg_temp_free_i32(t0
);
65 static void spr_read_generic (void *opaque
, int gprn
, int sprn
)
67 gen_load_spr(cpu_gpr
[gprn
], sprn
);
68 spr_load_dump_spr(sprn
);
71 static void spr_store_dump_spr(int sprn
)
73 #ifdef PPC_DUMP_SPR_ACCESSES
74 TCGv_i32 t0
= tcg_const_i32(sprn
);
75 gen_helper_store_dump_spr(cpu_env
, t0
);
76 tcg_temp_free_i32(t0
);
80 static void spr_write_generic (void *opaque
, int sprn
, int gprn
)
82 gen_store_spr(sprn
, cpu_gpr
[gprn
]);
83 spr_store_dump_spr(sprn
);
86 #if !defined(CONFIG_USER_ONLY)
87 static void spr_write_generic32(void *opaque
, int sprn
, int gprn
)
90 TCGv t0
= tcg_temp_new();
91 tcg_gen_ext32u_tl(t0
, cpu_gpr
[gprn
]);
92 gen_store_spr(sprn
, t0
);
94 spr_store_dump_spr(sprn
);
96 spr_write_generic(opaque
, sprn
, gprn
);
100 static void spr_write_clear (void *opaque
, int sprn
, int gprn
)
102 TCGv t0
= tcg_temp_new();
103 TCGv t1
= tcg_temp_new();
104 gen_load_spr(t0
, sprn
);
105 tcg_gen_neg_tl(t1
, cpu_gpr
[gprn
]);
106 tcg_gen_and_tl(t0
, t0
, t1
);
107 gen_store_spr(sprn
, t0
);
112 static void spr_access_nop(void *opaque
, int sprn
, int gprn
)
118 /* SPR common to all PowerPC */
120 static void spr_read_xer (void *opaque
, int gprn
, int sprn
)
122 gen_read_xer(cpu_gpr
[gprn
]);
125 static void spr_write_xer (void *opaque
, int sprn
, int gprn
)
127 gen_write_xer(cpu_gpr
[gprn
]);
131 static void spr_read_lr (void *opaque
, int gprn
, int sprn
)
133 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_lr
);
136 static void spr_write_lr (void *opaque
, int sprn
, int gprn
)
138 tcg_gen_mov_tl(cpu_lr
, cpu_gpr
[gprn
]);
142 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
143 static void spr_read_cfar (void *opaque
, int gprn
, int sprn
)
145 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_cfar
);
148 static void spr_write_cfar (void *opaque
, int sprn
, int gprn
)
150 tcg_gen_mov_tl(cpu_cfar
, cpu_gpr
[gprn
]);
152 #endif /* defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY) */
155 static void spr_read_ctr (void *opaque
, int gprn
, int sprn
)
157 tcg_gen_mov_tl(cpu_gpr
[gprn
], cpu_ctr
);
160 static void spr_write_ctr (void *opaque
, int sprn
, int gprn
)
162 tcg_gen_mov_tl(cpu_ctr
, cpu_gpr
[gprn
]);
165 /* User read access to SPR */
171 static void spr_read_ureg (void *opaque
, int gprn
, int sprn
)
173 gen_load_spr(cpu_gpr
[gprn
], sprn
+ 0x10);
176 /* SPR common to all non-embedded PowerPC */
178 #if !defined(CONFIG_USER_ONLY)
179 static void spr_read_decr (void *opaque
, int gprn
, int sprn
)
184 gen_helper_load_decr(cpu_gpr
[gprn
], cpu_env
);
187 gen_stop_exception(opaque
);
191 static void spr_write_decr (void *opaque
, int sprn
, int gprn
)
196 gen_helper_store_decr(cpu_env
, cpu_gpr
[gprn
]);
199 gen_stop_exception(opaque
);
204 /* SPR common to all non-embedded PowerPC, except 601 */
206 static void spr_read_tbl (void *opaque
, int gprn
, int sprn
)
211 gen_helper_load_tbl(cpu_gpr
[gprn
], cpu_env
);
214 gen_stop_exception(opaque
);
218 static void spr_read_tbu (void *opaque
, int gprn
, int sprn
)
223 gen_helper_load_tbu(cpu_gpr
[gprn
], cpu_env
);
226 gen_stop_exception(opaque
);
230 __attribute__ (( unused
))
231 static void spr_read_atbl (void *opaque
, int gprn
, int sprn
)
233 gen_helper_load_atbl(cpu_gpr
[gprn
], cpu_env
);
236 __attribute__ (( unused
))
237 static void spr_read_atbu (void *opaque
, int gprn
, int sprn
)
239 gen_helper_load_atbu(cpu_gpr
[gprn
], cpu_env
);
242 #if !defined(CONFIG_USER_ONLY)
243 static void spr_write_tbl (void *opaque
, int sprn
, int gprn
)
248 gen_helper_store_tbl(cpu_env
, cpu_gpr
[gprn
]);
251 gen_stop_exception(opaque
);
255 static void spr_write_tbu (void *opaque
, int sprn
, int gprn
)
260 gen_helper_store_tbu(cpu_env
, cpu_gpr
[gprn
]);
263 gen_stop_exception(opaque
);
267 __attribute__ (( unused
))
268 static void spr_write_atbl (void *opaque
, int sprn
, int gprn
)
270 gen_helper_store_atbl(cpu_env
, cpu_gpr
[gprn
]);
273 __attribute__ (( unused
))
274 static void spr_write_atbu (void *opaque
, int sprn
, int gprn
)
276 gen_helper_store_atbu(cpu_env
, cpu_gpr
[gprn
]);
279 #if defined(TARGET_PPC64)
280 __attribute__ (( unused
))
281 static void spr_read_purr (void *opaque
, int gprn
, int sprn
)
283 gen_helper_load_purr(cpu_gpr
[gprn
], cpu_env
);
288 #if !defined(CONFIG_USER_ONLY)
289 /* IBAT0U...IBAT0U */
290 /* IBAT0L...IBAT7L */
291 static void spr_read_ibat (void *opaque
, int gprn
, int sprn
)
293 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
296 static void spr_read_ibat_h (void *opaque
, int gprn
, int sprn
)
298 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][(sprn
- SPR_IBAT4U
) / 2]));
301 static void spr_write_ibatu (void *opaque
, int sprn
, int gprn
)
303 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
304 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
305 tcg_temp_free_i32(t0
);
308 static void spr_write_ibatu_h (void *opaque
, int sprn
, int gprn
)
310 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4U
) / 2) + 4);
311 gen_helper_store_ibatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
312 tcg_temp_free_i32(t0
);
315 static void spr_write_ibatl (void *opaque
, int sprn
, int gprn
)
317 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0L
) / 2);
318 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
319 tcg_temp_free_i32(t0
);
322 static void spr_write_ibatl_h (void *opaque
, int sprn
, int gprn
)
324 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_IBAT4L
) / 2) + 4);
325 gen_helper_store_ibatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
326 tcg_temp_free_i32(t0
);
329 /* DBAT0U...DBAT7U */
330 /* DBAT0L...DBAT7L */
331 static void spr_read_dbat (void *opaque
, int gprn
, int sprn
)
333 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, DBAT
[sprn
& 1][(sprn
- SPR_DBAT0U
) / 2]));
336 static void spr_read_dbat_h (void *opaque
, int gprn
, int sprn
)
338 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, DBAT
[sprn
& 1][((sprn
- SPR_DBAT4U
) / 2) + 4]));
341 static void spr_write_dbatu (void *opaque
, int sprn
, int gprn
)
343 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0U
) / 2);
344 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
345 tcg_temp_free_i32(t0
);
348 static void spr_write_dbatu_h (void *opaque
, int sprn
, int gprn
)
350 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4U
) / 2) + 4);
351 gen_helper_store_dbatu(cpu_env
, t0
, cpu_gpr
[gprn
]);
352 tcg_temp_free_i32(t0
);
355 static void spr_write_dbatl (void *opaque
, int sprn
, int gprn
)
357 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_DBAT0L
) / 2);
358 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
359 tcg_temp_free_i32(t0
);
362 static void spr_write_dbatl_h (void *opaque
, int sprn
, int gprn
)
364 TCGv_i32 t0
= tcg_const_i32(((sprn
- SPR_DBAT4L
) / 2) + 4);
365 gen_helper_store_dbatl(cpu_env
, t0
, cpu_gpr
[gprn
]);
366 tcg_temp_free_i32(t0
);
370 static void spr_write_sdr1 (void *opaque
, int sprn
, int gprn
)
372 gen_helper_store_sdr1(cpu_env
, cpu_gpr
[gprn
]);
375 /* 64 bits PowerPC specific SPRs */
376 #if defined(TARGET_PPC64)
377 static void spr_read_hior (void *opaque
, int gprn
, int sprn
)
379 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
382 static void spr_write_hior (void *opaque
, int sprn
, int gprn
)
384 TCGv t0
= tcg_temp_new();
385 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0x3FFFFF00000ULL
);
386 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
392 /* PowerPC 601 specific registers */
394 static void spr_read_601_rtcl (void *opaque
, int gprn
, int sprn
)
396 gen_helper_load_601_rtcl(cpu_gpr
[gprn
], cpu_env
);
399 static void spr_read_601_rtcu (void *opaque
, int gprn
, int sprn
)
401 gen_helper_load_601_rtcu(cpu_gpr
[gprn
], cpu_env
);
404 #if !defined(CONFIG_USER_ONLY)
405 static void spr_write_601_rtcu (void *opaque
, int sprn
, int gprn
)
407 gen_helper_store_601_rtcu(cpu_env
, cpu_gpr
[gprn
]);
410 static void spr_write_601_rtcl (void *opaque
, int sprn
, int gprn
)
412 gen_helper_store_601_rtcl(cpu_env
, cpu_gpr
[gprn
]);
415 static void spr_write_hid0_601 (void *opaque
, int sprn
, int gprn
)
417 DisasContext
*ctx
= opaque
;
419 gen_helper_store_hid0_601(cpu_env
, cpu_gpr
[gprn
]);
420 /* Must stop the translation as endianness may have changed */
421 gen_stop_exception(ctx
);
426 #if !defined(CONFIG_USER_ONLY)
427 static void spr_read_601_ubat (void *opaque
, int gprn
, int sprn
)
429 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, IBAT
[sprn
& 1][(sprn
- SPR_IBAT0U
) / 2]));
432 static void spr_write_601_ubatu (void *opaque
, int sprn
, int gprn
)
434 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
435 gen_helper_store_601_batl(cpu_env
, t0
, cpu_gpr
[gprn
]);
436 tcg_temp_free_i32(t0
);
439 static void spr_write_601_ubatl (void *opaque
, int sprn
, int gprn
)
441 TCGv_i32 t0
= tcg_const_i32((sprn
- SPR_IBAT0U
) / 2);
442 gen_helper_store_601_batu(cpu_env
, t0
, cpu_gpr
[gprn
]);
443 tcg_temp_free_i32(t0
);
447 /* PowerPC 40x specific registers */
448 #if !defined(CONFIG_USER_ONLY)
449 static void spr_read_40x_pit (void *opaque
, int gprn
, int sprn
)
451 gen_helper_load_40x_pit(cpu_gpr
[gprn
], cpu_env
);
454 static void spr_write_40x_pit (void *opaque
, int sprn
, int gprn
)
456 gen_helper_store_40x_pit(cpu_env
, cpu_gpr
[gprn
]);
459 static void spr_write_40x_dbcr0 (void *opaque
, int sprn
, int gprn
)
461 DisasContext
*ctx
= opaque
;
463 gen_helper_store_40x_dbcr0(cpu_env
, cpu_gpr
[gprn
]);
464 /* We must stop translation as we may have rebooted */
465 gen_stop_exception(ctx
);
468 static void spr_write_40x_sler (void *opaque
, int sprn
, int gprn
)
470 gen_helper_store_40x_sler(cpu_env
, cpu_gpr
[gprn
]);
473 static void spr_write_booke_tcr (void *opaque
, int sprn
, int gprn
)
475 gen_helper_store_booke_tcr(cpu_env
, cpu_gpr
[gprn
]);
478 static void spr_write_booke_tsr (void *opaque
, int sprn
, int gprn
)
480 gen_helper_store_booke_tsr(cpu_env
, cpu_gpr
[gprn
]);
484 /* PowerPC 403 specific registers */
485 /* PBL1 / PBU1 / PBL2 / PBU2 */
486 #if !defined(CONFIG_USER_ONLY)
487 static void spr_read_403_pbr (void *opaque
, int gprn
, int sprn
)
489 tcg_gen_ld_tl(cpu_gpr
[gprn
], cpu_env
, offsetof(CPUPPCState
, pb
[sprn
- SPR_403_PBL1
]));
492 static void spr_write_403_pbr (void *opaque
, int sprn
, int gprn
)
494 TCGv_i32 t0
= tcg_const_i32(sprn
- SPR_403_PBL1
);
495 gen_helper_store_403_pbr(cpu_env
, t0
, cpu_gpr
[gprn
]);
496 tcg_temp_free_i32(t0
);
499 static void spr_write_pir (void *opaque
, int sprn
, int gprn
)
501 TCGv t0
= tcg_temp_new();
502 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], 0xF);
503 gen_store_spr(SPR_PIR
, t0
);
508 /* SPE specific registers */
509 static void spr_read_spefscr (void *opaque
, int gprn
, int sprn
)
511 TCGv_i32 t0
= tcg_temp_new_i32();
512 tcg_gen_ld_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
513 tcg_gen_extu_i32_tl(cpu_gpr
[gprn
], t0
);
514 tcg_temp_free_i32(t0
);
517 static void spr_write_spefscr (void *opaque
, int sprn
, int gprn
)
519 TCGv_i32 t0
= tcg_temp_new_i32();
520 tcg_gen_trunc_tl_i32(t0
, cpu_gpr
[gprn
]);
521 tcg_gen_st_i32(t0
, cpu_env
, offsetof(CPUPPCState
, spe_fscr
));
522 tcg_temp_free_i32(t0
);
525 #if !defined(CONFIG_USER_ONLY)
526 /* Callback used to write the exception vector base */
527 static void spr_write_excp_prefix (void *opaque
, int sprn
, int gprn
)
529 TCGv t0
= tcg_temp_new();
530 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivpr_mask
));
531 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
532 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_prefix
));
533 gen_store_spr(sprn
, t0
);
537 static void spr_write_excp_vector (void *opaque
, int sprn
, int gprn
)
539 DisasContext
*ctx
= opaque
;
542 if (sprn
>= SPR_BOOKE_IVOR0
&& sprn
<= SPR_BOOKE_IVOR15
) {
543 sprn_offs
= sprn
- SPR_BOOKE_IVOR0
;
544 } else if (sprn
>= SPR_BOOKE_IVOR32
&& sprn
<= SPR_BOOKE_IVOR37
) {
545 sprn_offs
= sprn
- SPR_BOOKE_IVOR32
+ 32;
546 } else if (sprn
>= SPR_BOOKE_IVOR38
&& sprn
<= SPR_BOOKE_IVOR42
) {
547 sprn_offs
= sprn
- SPR_BOOKE_IVOR38
+ 38;
549 printf("Trying to write an unknown exception vector %d %03x\n",
551 gen_inval_exception(ctx
, POWERPC_EXCP_PRIV_REG
);
555 TCGv t0
= tcg_temp_new();
556 tcg_gen_ld_tl(t0
, cpu_env
, offsetof(CPUPPCState
, ivor_mask
));
557 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
558 tcg_gen_st_tl(t0
, cpu_env
, offsetof(CPUPPCState
, excp_vectors
[sprn_offs
]));
559 gen_store_spr(sprn
, t0
);
564 static inline void vscr_init (CPUPPCState
*env
, uint32_t val
)
567 /* Altivec always uses round-to-nearest */
568 set_float_rounding_mode(float_round_nearest_even
, &env
->vec_status
);
569 set_flush_to_zero(vscr_nj
, &env
->vec_status
);
572 #ifdef CONFIG_USER_ONLY
573 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
574 oea_read, oea_write, one_reg_id, initial_value) \
575 _spr_register(env, num, name, uea_read, uea_write, initial_value)
577 #if !defined(CONFIG_KVM)
578 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
579 oea_read, oea_write, one_reg_id, initial_value) \
580 _spr_register(env, num, name, uea_read, uea_write, \
581 oea_read, oea_write, initial_value)
583 #define spr_register_kvm(env, num, name, uea_read, uea_write, \
584 oea_read, oea_write, one_reg_id, initial_value) \
585 _spr_register(env, num, name, uea_read, uea_write, \
586 oea_read, oea_write, one_reg_id, initial_value)
590 #define spr_register(env, num, name, uea_read, uea_write, \
591 oea_read, oea_write, initial_value) \
592 spr_register_kvm(env, num, name, uea_read, uea_write, \
593 oea_read, oea_write, 0, initial_value)
595 static inline void _spr_register(CPUPPCState
*env
, int num
,
597 void (*uea_read
)(void *opaque
, int gprn
, int sprn
),
598 void (*uea_write
)(void *opaque
, int sprn
, int gprn
),
599 #if !defined(CONFIG_USER_ONLY)
601 void (*oea_read
)(void *opaque
, int gprn
, int sprn
),
602 void (*oea_write
)(void *opaque
, int sprn
, int gprn
),
604 #if defined(CONFIG_KVM)
607 target_ulong initial_value
)
611 spr
= &env
->spr_cb
[num
];
612 if (spr
->name
!= NULL
||env
-> spr
[num
] != 0x00000000 ||
613 #if !defined(CONFIG_USER_ONLY)
614 spr
->oea_read
!= NULL
|| spr
->oea_write
!= NULL
||
616 spr
->uea_read
!= NULL
|| spr
->uea_write
!= NULL
) {
617 printf("Error: Trying to register SPR %d (%03x) twice !\n", num
, num
);
620 #if defined(PPC_DEBUG_SPR)
621 printf("*** register spr %d (%03x) %s val " TARGET_FMT_lx
"\n", num
, num
,
622 name
, initial_value
);
625 spr
->uea_read
= uea_read
;
626 spr
->uea_write
= uea_write
;
627 #if !defined(CONFIG_USER_ONLY)
628 spr
->oea_read
= oea_read
;
629 spr
->oea_write
= oea_write
;
631 #if defined(CONFIG_KVM)
632 spr
->one_reg_id
= one_reg_id
,
634 env
->spr
[num
] = spr
->default_value
= initial_value
;
637 /* Generic PowerPC SPRs */
638 static void gen_spr_generic (CPUPPCState
*env
)
640 /* Integer processing */
641 spr_register(env
, SPR_XER
, "XER",
642 &spr_read_xer
, &spr_write_xer
,
643 &spr_read_xer
, &spr_write_xer
,
646 spr_register(env
, SPR_LR
, "LR",
647 &spr_read_lr
, &spr_write_lr
,
648 &spr_read_lr
, &spr_write_lr
,
650 spr_register(env
, SPR_CTR
, "CTR",
651 &spr_read_ctr
, &spr_write_ctr
,
652 &spr_read_ctr
, &spr_write_ctr
,
654 /* Interrupt processing */
655 spr_register(env
, SPR_SRR0
, "SRR0",
656 SPR_NOACCESS
, SPR_NOACCESS
,
657 &spr_read_generic
, &spr_write_generic
,
659 spr_register(env
, SPR_SRR1
, "SRR1",
660 SPR_NOACCESS
, SPR_NOACCESS
,
661 &spr_read_generic
, &spr_write_generic
,
663 /* Processor control */
664 spr_register(env
, SPR_SPRG0
, "SPRG0",
665 SPR_NOACCESS
, SPR_NOACCESS
,
666 &spr_read_generic
, &spr_write_generic
,
668 spr_register(env
, SPR_SPRG1
, "SPRG1",
669 SPR_NOACCESS
, SPR_NOACCESS
,
670 &spr_read_generic
, &spr_write_generic
,
672 spr_register(env
, SPR_SPRG2
, "SPRG2",
673 SPR_NOACCESS
, SPR_NOACCESS
,
674 &spr_read_generic
, &spr_write_generic
,
676 spr_register(env
, SPR_SPRG3
, "SPRG3",
677 SPR_NOACCESS
, SPR_NOACCESS
,
678 &spr_read_generic
, &spr_write_generic
,
682 /* SPR common to all non-embedded PowerPC, including 601 */
683 static void gen_spr_ne_601 (CPUPPCState
*env
)
685 /* Exception processing */
686 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
687 SPR_NOACCESS
, SPR_NOACCESS
,
688 &spr_read_generic
, &spr_write_generic
,
689 KVM_REG_PPC_DSISR
, 0x00000000);
690 spr_register_kvm(env
, SPR_DAR
, "DAR",
691 SPR_NOACCESS
, SPR_NOACCESS
,
692 &spr_read_generic
, &spr_write_generic
,
693 KVM_REG_PPC_DAR
, 0x00000000);
695 spr_register(env
, SPR_DECR
, "DECR",
696 SPR_NOACCESS
, SPR_NOACCESS
,
697 &spr_read_decr
, &spr_write_decr
,
699 /* Memory management */
700 spr_register(env
, SPR_SDR1
, "SDR1",
701 SPR_NOACCESS
, SPR_NOACCESS
,
702 &spr_read_generic
, &spr_write_sdr1
,
707 static void gen_low_BATs (CPUPPCState
*env
)
709 #if !defined(CONFIG_USER_ONLY)
710 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
711 SPR_NOACCESS
, SPR_NOACCESS
,
712 &spr_read_ibat
, &spr_write_ibatu
,
714 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
715 SPR_NOACCESS
, SPR_NOACCESS
,
716 &spr_read_ibat
, &spr_write_ibatl
,
718 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
719 SPR_NOACCESS
, SPR_NOACCESS
,
720 &spr_read_ibat
, &spr_write_ibatu
,
722 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
723 SPR_NOACCESS
, SPR_NOACCESS
,
724 &spr_read_ibat
, &spr_write_ibatl
,
726 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
727 SPR_NOACCESS
, SPR_NOACCESS
,
728 &spr_read_ibat
, &spr_write_ibatu
,
730 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
731 SPR_NOACCESS
, SPR_NOACCESS
,
732 &spr_read_ibat
, &spr_write_ibatl
,
734 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
735 SPR_NOACCESS
, SPR_NOACCESS
,
736 &spr_read_ibat
, &spr_write_ibatu
,
738 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
739 SPR_NOACCESS
, SPR_NOACCESS
,
740 &spr_read_ibat
, &spr_write_ibatl
,
742 spr_register(env
, SPR_DBAT0U
, "DBAT0U",
743 SPR_NOACCESS
, SPR_NOACCESS
,
744 &spr_read_dbat
, &spr_write_dbatu
,
746 spr_register(env
, SPR_DBAT0L
, "DBAT0L",
747 SPR_NOACCESS
, SPR_NOACCESS
,
748 &spr_read_dbat
, &spr_write_dbatl
,
750 spr_register(env
, SPR_DBAT1U
, "DBAT1U",
751 SPR_NOACCESS
, SPR_NOACCESS
,
752 &spr_read_dbat
, &spr_write_dbatu
,
754 spr_register(env
, SPR_DBAT1L
, "DBAT1L",
755 SPR_NOACCESS
, SPR_NOACCESS
,
756 &spr_read_dbat
, &spr_write_dbatl
,
758 spr_register(env
, SPR_DBAT2U
, "DBAT2U",
759 SPR_NOACCESS
, SPR_NOACCESS
,
760 &spr_read_dbat
, &spr_write_dbatu
,
762 spr_register(env
, SPR_DBAT2L
, "DBAT2L",
763 SPR_NOACCESS
, SPR_NOACCESS
,
764 &spr_read_dbat
, &spr_write_dbatl
,
766 spr_register(env
, SPR_DBAT3U
, "DBAT3U",
767 SPR_NOACCESS
, SPR_NOACCESS
,
768 &spr_read_dbat
, &spr_write_dbatu
,
770 spr_register(env
, SPR_DBAT3L
, "DBAT3L",
771 SPR_NOACCESS
, SPR_NOACCESS
,
772 &spr_read_dbat
, &spr_write_dbatl
,
779 static void gen_high_BATs (CPUPPCState
*env
)
781 #if !defined(CONFIG_USER_ONLY)
782 spr_register(env
, SPR_IBAT4U
, "IBAT4U",
783 SPR_NOACCESS
, SPR_NOACCESS
,
784 &spr_read_ibat_h
, &spr_write_ibatu_h
,
786 spr_register(env
, SPR_IBAT4L
, "IBAT4L",
787 SPR_NOACCESS
, SPR_NOACCESS
,
788 &spr_read_ibat_h
, &spr_write_ibatl_h
,
790 spr_register(env
, SPR_IBAT5U
, "IBAT5U",
791 SPR_NOACCESS
, SPR_NOACCESS
,
792 &spr_read_ibat_h
, &spr_write_ibatu_h
,
794 spr_register(env
, SPR_IBAT5L
, "IBAT5L",
795 SPR_NOACCESS
, SPR_NOACCESS
,
796 &spr_read_ibat_h
, &spr_write_ibatl_h
,
798 spr_register(env
, SPR_IBAT6U
, "IBAT6U",
799 SPR_NOACCESS
, SPR_NOACCESS
,
800 &spr_read_ibat_h
, &spr_write_ibatu_h
,
802 spr_register(env
, SPR_IBAT6L
, "IBAT6L",
803 SPR_NOACCESS
, SPR_NOACCESS
,
804 &spr_read_ibat_h
, &spr_write_ibatl_h
,
806 spr_register(env
, SPR_IBAT7U
, "IBAT7U",
807 SPR_NOACCESS
, SPR_NOACCESS
,
808 &spr_read_ibat_h
, &spr_write_ibatu_h
,
810 spr_register(env
, SPR_IBAT7L
, "IBAT7L",
811 SPR_NOACCESS
, SPR_NOACCESS
,
812 &spr_read_ibat_h
, &spr_write_ibatl_h
,
814 spr_register(env
, SPR_DBAT4U
, "DBAT4U",
815 SPR_NOACCESS
, SPR_NOACCESS
,
816 &spr_read_dbat_h
, &spr_write_dbatu_h
,
818 spr_register(env
, SPR_DBAT4L
, "DBAT4L",
819 SPR_NOACCESS
, SPR_NOACCESS
,
820 &spr_read_dbat_h
, &spr_write_dbatl_h
,
822 spr_register(env
, SPR_DBAT5U
, "DBAT5U",
823 SPR_NOACCESS
, SPR_NOACCESS
,
824 &spr_read_dbat_h
, &spr_write_dbatu_h
,
826 spr_register(env
, SPR_DBAT5L
, "DBAT5L",
827 SPR_NOACCESS
, SPR_NOACCESS
,
828 &spr_read_dbat_h
, &spr_write_dbatl_h
,
830 spr_register(env
, SPR_DBAT6U
, "DBAT6U",
831 SPR_NOACCESS
, SPR_NOACCESS
,
832 &spr_read_dbat_h
, &spr_write_dbatu_h
,
834 spr_register(env
, SPR_DBAT6L
, "DBAT6L",
835 SPR_NOACCESS
, SPR_NOACCESS
,
836 &spr_read_dbat_h
, &spr_write_dbatl_h
,
838 spr_register(env
, SPR_DBAT7U
, "DBAT7U",
839 SPR_NOACCESS
, SPR_NOACCESS
,
840 &spr_read_dbat_h
, &spr_write_dbatu_h
,
842 spr_register(env
, SPR_DBAT7L
, "DBAT7L",
843 SPR_NOACCESS
, SPR_NOACCESS
,
844 &spr_read_dbat_h
, &spr_write_dbatl_h
,
850 /* Generic PowerPC time base */
851 static void gen_tbl (CPUPPCState
*env
)
853 spr_register(env
, SPR_VTBL
, "TBL",
854 &spr_read_tbl
, SPR_NOACCESS
,
855 &spr_read_tbl
, SPR_NOACCESS
,
857 spr_register(env
, SPR_TBL
, "TBL",
858 &spr_read_tbl
, SPR_NOACCESS
,
859 &spr_read_tbl
, &spr_write_tbl
,
861 spr_register(env
, SPR_VTBU
, "TBU",
862 &spr_read_tbu
, SPR_NOACCESS
,
863 &spr_read_tbu
, SPR_NOACCESS
,
865 spr_register(env
, SPR_TBU
, "TBU",
866 &spr_read_tbu
, SPR_NOACCESS
,
867 &spr_read_tbu
, &spr_write_tbu
,
871 /* Softare table search registers */
872 static void gen_6xx_7xx_soft_tlb (CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
874 #if !defined(CONFIG_USER_ONLY)
875 env
->nb_tlb
= nb_tlbs
;
876 env
->nb_ways
= nb_ways
;
878 env
->tlb_type
= TLB_6XX
;
879 spr_register(env
, SPR_DMISS
, "DMISS",
880 SPR_NOACCESS
, SPR_NOACCESS
,
881 &spr_read_generic
, SPR_NOACCESS
,
883 spr_register(env
, SPR_DCMP
, "DCMP",
884 SPR_NOACCESS
, SPR_NOACCESS
,
885 &spr_read_generic
, SPR_NOACCESS
,
887 spr_register(env
, SPR_HASH1
, "HASH1",
888 SPR_NOACCESS
, SPR_NOACCESS
,
889 &spr_read_generic
, SPR_NOACCESS
,
891 spr_register(env
, SPR_HASH2
, "HASH2",
892 SPR_NOACCESS
, SPR_NOACCESS
,
893 &spr_read_generic
, SPR_NOACCESS
,
895 spr_register(env
, SPR_IMISS
, "IMISS",
896 SPR_NOACCESS
, SPR_NOACCESS
,
897 &spr_read_generic
, SPR_NOACCESS
,
899 spr_register(env
, SPR_ICMP
, "ICMP",
900 SPR_NOACCESS
, SPR_NOACCESS
,
901 &spr_read_generic
, SPR_NOACCESS
,
903 spr_register(env
, SPR_RPA
, "RPA",
904 SPR_NOACCESS
, SPR_NOACCESS
,
905 &spr_read_generic
, &spr_write_generic
,
910 /* SPR common to MPC755 and G2 */
911 static void gen_spr_G2_755 (CPUPPCState
*env
)
914 spr_register(env
, SPR_SPRG4
, "SPRG4",
915 SPR_NOACCESS
, SPR_NOACCESS
,
916 &spr_read_generic
, &spr_write_generic
,
918 spr_register(env
, SPR_SPRG5
, "SPRG5",
919 SPR_NOACCESS
, SPR_NOACCESS
,
920 &spr_read_generic
, &spr_write_generic
,
922 spr_register(env
, SPR_SPRG6
, "SPRG6",
923 SPR_NOACCESS
, SPR_NOACCESS
,
924 &spr_read_generic
, &spr_write_generic
,
926 spr_register(env
, SPR_SPRG7
, "SPRG7",
927 SPR_NOACCESS
, SPR_NOACCESS
,
928 &spr_read_generic
, &spr_write_generic
,
932 /* SPR common to all 7xx PowerPC implementations */
933 static void gen_spr_7xx (CPUPPCState
*env
)
936 /* XXX : not implemented */
937 spr_register_kvm(env
, SPR_DABR
, "DABR",
938 SPR_NOACCESS
, SPR_NOACCESS
,
939 &spr_read_generic
, &spr_write_generic
,
940 KVM_REG_PPC_DABR
, 0x00000000);
941 /* XXX : not implemented */
942 spr_register(env
, SPR_IABR
, "IABR",
943 SPR_NOACCESS
, SPR_NOACCESS
,
944 &spr_read_generic
, &spr_write_generic
,
946 /* Cache management */
947 /* XXX : not implemented */
948 spr_register(env
, SPR_ICTC
, "ICTC",
949 SPR_NOACCESS
, SPR_NOACCESS
,
950 &spr_read_generic
, &spr_write_generic
,
952 /* Performance monitors */
953 /* XXX : not implemented */
954 spr_register(env
, SPR_MMCR0
, "MMCR0",
955 SPR_NOACCESS
, SPR_NOACCESS
,
956 &spr_read_generic
, &spr_write_generic
,
958 /* XXX : not implemented */
959 spr_register(env
, SPR_MMCR1
, "MMCR1",
960 SPR_NOACCESS
, SPR_NOACCESS
,
961 &spr_read_generic
, &spr_write_generic
,
963 /* XXX : not implemented */
964 spr_register(env
, SPR_PMC1
, "PMC1",
965 SPR_NOACCESS
, SPR_NOACCESS
,
966 &spr_read_generic
, &spr_write_generic
,
968 /* XXX : not implemented */
969 spr_register(env
, SPR_PMC2
, "PMC2",
970 SPR_NOACCESS
, SPR_NOACCESS
,
971 &spr_read_generic
, &spr_write_generic
,
973 /* XXX : not implemented */
974 spr_register(env
, SPR_PMC3
, "PMC3",
975 SPR_NOACCESS
, SPR_NOACCESS
,
976 &spr_read_generic
, &spr_write_generic
,
978 /* XXX : not implemented */
979 spr_register(env
, SPR_PMC4
, "PMC4",
980 SPR_NOACCESS
, SPR_NOACCESS
,
981 &spr_read_generic
, &spr_write_generic
,
983 /* XXX : not implemented */
984 spr_register(env
, SPR_SIAR
, "SIAR",
985 SPR_NOACCESS
, SPR_NOACCESS
,
986 &spr_read_generic
, SPR_NOACCESS
,
988 /* XXX : not implemented */
989 spr_register(env
, SPR_UMMCR0
, "UMMCR0",
990 &spr_read_ureg
, SPR_NOACCESS
,
991 &spr_read_ureg
, SPR_NOACCESS
,
993 /* XXX : not implemented */
994 spr_register(env
, SPR_UMMCR1
, "UMMCR1",
995 &spr_read_ureg
, SPR_NOACCESS
,
996 &spr_read_ureg
, SPR_NOACCESS
,
998 /* XXX : not implemented */
999 spr_register(env
, SPR_UPMC1
, "UPMC1",
1000 &spr_read_ureg
, SPR_NOACCESS
,
1001 &spr_read_ureg
, SPR_NOACCESS
,
1003 /* XXX : not implemented */
1004 spr_register(env
, SPR_UPMC2
, "UPMC2",
1005 &spr_read_ureg
, SPR_NOACCESS
,
1006 &spr_read_ureg
, SPR_NOACCESS
,
1008 /* XXX : not implemented */
1009 spr_register(env
, SPR_UPMC3
, "UPMC3",
1010 &spr_read_ureg
, SPR_NOACCESS
,
1011 &spr_read_ureg
, SPR_NOACCESS
,
1013 /* XXX : not implemented */
1014 spr_register(env
, SPR_UPMC4
, "UPMC4",
1015 &spr_read_ureg
, SPR_NOACCESS
,
1016 &spr_read_ureg
, SPR_NOACCESS
,
1018 /* XXX : not implemented */
1019 spr_register(env
, SPR_USIAR
, "USIAR",
1020 &spr_read_ureg
, SPR_NOACCESS
,
1021 &spr_read_ureg
, SPR_NOACCESS
,
1023 /* External access control */
1024 /* XXX : not implemented */
1025 spr_register(env
, SPR_EAR
, "EAR",
1026 SPR_NOACCESS
, SPR_NOACCESS
,
1027 &spr_read_generic
, &spr_write_generic
,
1032 #ifndef CONFIG_USER_ONLY
1033 static void spr_read_uamr (void *opaque
, int gprn
, int sprn
)
1035 gen_load_spr(cpu_gpr
[gprn
], SPR_AMR
);
1036 spr_load_dump_spr(SPR_AMR
);
1039 static void spr_write_uamr (void *opaque
, int sprn
, int gprn
)
1041 gen_store_spr(SPR_AMR
, cpu_gpr
[gprn
]);
1042 spr_store_dump_spr(SPR_AMR
);
1045 static void spr_write_uamr_pr (void *opaque
, int sprn
, int gprn
)
1047 TCGv t0
= tcg_temp_new();
1049 gen_load_spr(t0
, SPR_UAMOR
);
1050 tcg_gen_and_tl(t0
, t0
, cpu_gpr
[gprn
]);
1051 gen_store_spr(SPR_AMR
, t0
);
1052 spr_store_dump_spr(SPR_AMR
);
1054 #endif /* CONFIG_USER_ONLY */
1056 static void gen_spr_amr (CPUPPCState
*env
)
1058 #ifndef CONFIG_USER_ONLY
1059 /* Virtual Page Class Key protection */
1060 /* The AMR is accessible either via SPR 13 or SPR 29. 13 is
1061 * userspace accessible, 29 is privileged. So we only need to set
1062 * the kvm ONE_REG id on one of them, we use 29 */
1063 spr_register(env
, SPR_UAMR
, "UAMR",
1064 &spr_read_uamr
, &spr_write_uamr_pr
,
1065 &spr_read_uamr
, &spr_write_uamr
,
1067 spr_register_kvm(env
, SPR_AMR
, "AMR",
1068 SPR_NOACCESS
, SPR_NOACCESS
,
1069 &spr_read_generic
, &spr_write_generic
,
1070 KVM_REG_PPC_AMR
, 0);
1071 spr_register_kvm(env
, SPR_UAMOR
, "UAMOR",
1072 SPR_NOACCESS
, SPR_NOACCESS
,
1073 &spr_read_generic
, &spr_write_generic
,
1074 KVM_REG_PPC_UAMOR
, 0);
1075 #endif /* !CONFIG_USER_ONLY */
1077 #endif /* TARGET_PPC64 */
1079 static void gen_spr_thrm (CPUPPCState
*env
)
1081 /* Thermal management */
1082 /* XXX : not implemented */
1083 spr_register(env
, SPR_THRM1
, "THRM1",
1084 SPR_NOACCESS
, SPR_NOACCESS
,
1085 &spr_read_generic
, &spr_write_generic
,
1087 /* XXX : not implemented */
1088 spr_register(env
, SPR_THRM2
, "THRM2",
1089 SPR_NOACCESS
, SPR_NOACCESS
,
1090 &spr_read_generic
, &spr_write_generic
,
1092 /* XXX : not implemented */
1093 spr_register(env
, SPR_THRM3
, "THRM3",
1094 SPR_NOACCESS
, SPR_NOACCESS
,
1095 &spr_read_generic
, &spr_write_generic
,
1099 /* SPR specific to PowerPC 604 implementation */
1100 static void gen_spr_604 (CPUPPCState
*env
)
1102 /* Processor identification */
1103 spr_register(env
, SPR_PIR
, "PIR",
1104 SPR_NOACCESS
, SPR_NOACCESS
,
1105 &spr_read_generic
, &spr_write_pir
,
1108 /* XXX : not implemented */
1109 spr_register(env
, SPR_IABR
, "IABR",
1110 SPR_NOACCESS
, SPR_NOACCESS
,
1111 &spr_read_generic
, &spr_write_generic
,
1113 /* XXX : not implemented */
1114 spr_register_kvm(env
, SPR_DABR
, "DABR",
1115 SPR_NOACCESS
, SPR_NOACCESS
,
1116 &spr_read_generic
, &spr_write_generic
,
1117 KVM_REG_PPC_DABR
, 0x00000000);
1118 /* Performance counters */
1119 /* XXX : not implemented */
1120 spr_register(env
, SPR_MMCR0
, "MMCR0",
1121 SPR_NOACCESS
, SPR_NOACCESS
,
1122 &spr_read_generic
, &spr_write_generic
,
1124 /* XXX : not implemented */
1125 spr_register(env
, SPR_PMC1
, "PMC1",
1126 SPR_NOACCESS
, SPR_NOACCESS
,
1127 &spr_read_generic
, &spr_write_generic
,
1129 /* XXX : not implemented */
1130 spr_register(env
, SPR_PMC2
, "PMC2",
1131 SPR_NOACCESS
, SPR_NOACCESS
,
1132 &spr_read_generic
, &spr_write_generic
,
1134 /* XXX : not implemented */
1135 spr_register(env
, SPR_SIAR
, "SIAR",
1136 SPR_NOACCESS
, SPR_NOACCESS
,
1137 &spr_read_generic
, SPR_NOACCESS
,
1139 /* XXX : not implemented */
1140 spr_register(env
, SPR_SDA
, "SDA",
1141 SPR_NOACCESS
, SPR_NOACCESS
,
1142 &spr_read_generic
, SPR_NOACCESS
,
1144 /* External access control */
1145 /* XXX : not implemented */
1146 spr_register(env
, SPR_EAR
, "EAR",
1147 SPR_NOACCESS
, SPR_NOACCESS
,
1148 &spr_read_generic
, &spr_write_generic
,
1152 /* SPR specific to PowerPC 603 implementation */
1153 static void gen_spr_603 (CPUPPCState
*env
)
1155 /* External access control */
1156 /* XXX : not implemented */
1157 spr_register(env
, SPR_EAR
, "EAR",
1158 SPR_NOACCESS
, SPR_NOACCESS
,
1159 &spr_read_generic
, &spr_write_generic
,
1162 /* XXX : not implemented */
1163 spr_register(env
, SPR_IABR
, "IABR",
1164 SPR_NOACCESS
, SPR_NOACCESS
,
1165 &spr_read_generic
, &spr_write_generic
,
1170 /* SPR specific to PowerPC G2 implementation */
1171 static void gen_spr_G2 (CPUPPCState
*env
)
1173 /* Memory base address */
1175 /* XXX : not implemented */
1176 spr_register(env
, SPR_MBAR
, "MBAR",
1177 SPR_NOACCESS
, SPR_NOACCESS
,
1178 &spr_read_generic
, &spr_write_generic
,
1180 /* Exception processing */
1181 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1182 SPR_NOACCESS
, SPR_NOACCESS
,
1183 &spr_read_generic
, &spr_write_generic
,
1185 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1186 SPR_NOACCESS
, SPR_NOACCESS
,
1187 &spr_read_generic
, &spr_write_generic
,
1190 /* XXX : not implemented */
1191 spr_register(env
, SPR_DABR
, "DABR",
1192 SPR_NOACCESS
, SPR_NOACCESS
,
1193 &spr_read_generic
, &spr_write_generic
,
1195 /* XXX : not implemented */
1196 spr_register(env
, SPR_DABR2
, "DABR2",
1197 SPR_NOACCESS
, SPR_NOACCESS
,
1198 &spr_read_generic
, &spr_write_generic
,
1200 /* XXX : not implemented */
1201 spr_register(env
, SPR_IABR
, "IABR",
1202 SPR_NOACCESS
, SPR_NOACCESS
,
1203 &spr_read_generic
, &spr_write_generic
,
1205 /* XXX : not implemented */
1206 spr_register(env
, SPR_IABR2
, "IABR2",
1207 SPR_NOACCESS
, SPR_NOACCESS
,
1208 &spr_read_generic
, &spr_write_generic
,
1210 /* XXX : not implemented */
1211 spr_register(env
, SPR_IBCR
, "IBCR",
1212 SPR_NOACCESS
, SPR_NOACCESS
,
1213 &spr_read_generic
, &spr_write_generic
,
1215 /* XXX : not implemented */
1216 spr_register(env
, SPR_DBCR
, "DBCR",
1217 SPR_NOACCESS
, SPR_NOACCESS
,
1218 &spr_read_generic
, &spr_write_generic
,
1222 /* SPR specific to PowerPC 602 implementation */
1223 static void gen_spr_602 (CPUPPCState
*env
)
1226 /* XXX : not implemented */
1227 spr_register(env
, SPR_SER
, "SER",
1228 SPR_NOACCESS
, SPR_NOACCESS
,
1229 &spr_read_generic
, &spr_write_generic
,
1231 /* XXX : not implemented */
1232 spr_register(env
, SPR_SEBR
, "SEBR",
1233 SPR_NOACCESS
, SPR_NOACCESS
,
1234 &spr_read_generic
, &spr_write_generic
,
1236 /* XXX : not implemented */
1237 spr_register(env
, SPR_ESASRR
, "ESASRR",
1238 SPR_NOACCESS
, SPR_NOACCESS
,
1239 &spr_read_generic
, &spr_write_generic
,
1241 /* Floating point status */
1242 /* XXX : not implemented */
1243 spr_register(env
, SPR_SP
, "SP",
1244 SPR_NOACCESS
, SPR_NOACCESS
,
1245 &spr_read_generic
, &spr_write_generic
,
1247 /* XXX : not implemented */
1248 spr_register(env
, SPR_LT
, "LT",
1249 SPR_NOACCESS
, SPR_NOACCESS
,
1250 &spr_read_generic
, &spr_write_generic
,
1252 /* Watchdog timer */
1253 /* XXX : not implemented */
1254 spr_register(env
, SPR_TCR
, "TCR",
1255 SPR_NOACCESS
, SPR_NOACCESS
,
1256 &spr_read_generic
, &spr_write_generic
,
1258 /* Interrupt base */
1259 spr_register(env
, SPR_IBR
, "IBR",
1260 SPR_NOACCESS
, SPR_NOACCESS
,
1261 &spr_read_generic
, &spr_write_generic
,
1263 /* XXX : not implemented */
1264 spr_register(env
, SPR_IABR
, "IABR",
1265 SPR_NOACCESS
, SPR_NOACCESS
,
1266 &spr_read_generic
, &spr_write_generic
,
1270 /* SPR specific to PowerPC 601 implementation */
1271 static void gen_spr_601 (CPUPPCState
*env
)
1273 /* Multiplication/division register */
1275 spr_register(env
, SPR_MQ
, "MQ",
1276 &spr_read_generic
, &spr_write_generic
,
1277 &spr_read_generic
, &spr_write_generic
,
1280 spr_register(env
, SPR_601_RTCU
, "RTCU",
1281 SPR_NOACCESS
, SPR_NOACCESS
,
1282 SPR_NOACCESS
, &spr_write_601_rtcu
,
1284 spr_register(env
, SPR_601_VRTCU
, "RTCU",
1285 &spr_read_601_rtcu
, SPR_NOACCESS
,
1286 &spr_read_601_rtcu
, SPR_NOACCESS
,
1288 spr_register(env
, SPR_601_RTCL
, "RTCL",
1289 SPR_NOACCESS
, SPR_NOACCESS
,
1290 SPR_NOACCESS
, &spr_write_601_rtcl
,
1292 spr_register(env
, SPR_601_VRTCL
, "RTCL",
1293 &spr_read_601_rtcl
, SPR_NOACCESS
,
1294 &spr_read_601_rtcl
, SPR_NOACCESS
,
1298 spr_register(env
, SPR_601_UDECR
, "UDECR",
1299 &spr_read_decr
, SPR_NOACCESS
,
1300 &spr_read_decr
, SPR_NOACCESS
,
1303 /* External access control */
1304 /* XXX : not implemented */
1305 spr_register(env
, SPR_EAR
, "EAR",
1306 SPR_NOACCESS
, SPR_NOACCESS
,
1307 &spr_read_generic
, &spr_write_generic
,
1309 /* Memory management */
1310 #if !defined(CONFIG_USER_ONLY)
1311 spr_register(env
, SPR_IBAT0U
, "IBAT0U",
1312 SPR_NOACCESS
, SPR_NOACCESS
,
1313 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1315 spr_register(env
, SPR_IBAT0L
, "IBAT0L",
1316 SPR_NOACCESS
, SPR_NOACCESS
,
1317 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1319 spr_register(env
, SPR_IBAT1U
, "IBAT1U",
1320 SPR_NOACCESS
, SPR_NOACCESS
,
1321 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1323 spr_register(env
, SPR_IBAT1L
, "IBAT1L",
1324 SPR_NOACCESS
, SPR_NOACCESS
,
1325 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1327 spr_register(env
, SPR_IBAT2U
, "IBAT2U",
1328 SPR_NOACCESS
, SPR_NOACCESS
,
1329 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1331 spr_register(env
, SPR_IBAT2L
, "IBAT2L",
1332 SPR_NOACCESS
, SPR_NOACCESS
,
1333 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1335 spr_register(env
, SPR_IBAT3U
, "IBAT3U",
1336 SPR_NOACCESS
, SPR_NOACCESS
,
1337 &spr_read_601_ubat
, &spr_write_601_ubatu
,
1339 spr_register(env
, SPR_IBAT3L
, "IBAT3L",
1340 SPR_NOACCESS
, SPR_NOACCESS
,
1341 &spr_read_601_ubat
, &spr_write_601_ubatl
,
1347 static void gen_spr_74xx (CPUPPCState
*env
)
1349 /* Processor identification */
1350 spr_register(env
, SPR_PIR
, "PIR",
1351 SPR_NOACCESS
, SPR_NOACCESS
,
1352 &spr_read_generic
, &spr_write_pir
,
1354 /* XXX : not implemented */
1355 spr_register(env
, SPR_MMCR2
, "MMCR2",
1356 SPR_NOACCESS
, SPR_NOACCESS
,
1357 &spr_read_generic
, &spr_write_generic
,
1359 /* XXX : not implemented */
1360 spr_register(env
, SPR_UMMCR2
, "UMMCR2",
1361 &spr_read_ureg
, SPR_NOACCESS
,
1362 &spr_read_ureg
, SPR_NOACCESS
,
1364 /* XXX: not implemented */
1365 spr_register(env
, SPR_BAMR
, "BAMR",
1366 SPR_NOACCESS
, SPR_NOACCESS
,
1367 &spr_read_generic
, &spr_write_generic
,
1369 /* XXX : not implemented */
1370 spr_register(env
, SPR_MSSCR0
, "MSSCR0",
1371 SPR_NOACCESS
, SPR_NOACCESS
,
1372 &spr_read_generic
, &spr_write_generic
,
1374 /* Hardware implementation registers */
1375 /* XXX : not implemented */
1376 spr_register(env
, SPR_HID0
, "HID0",
1377 SPR_NOACCESS
, SPR_NOACCESS
,
1378 &spr_read_generic
, &spr_write_generic
,
1380 /* XXX : not implemented */
1381 spr_register(env
, SPR_HID1
, "HID1",
1382 SPR_NOACCESS
, SPR_NOACCESS
,
1383 &spr_read_generic
, &spr_write_generic
,
1386 spr_register(env
, SPR_VRSAVE
, "VRSAVE",
1387 &spr_read_generic
, &spr_write_generic
,
1388 &spr_read_generic
, &spr_write_generic
,
1390 /* XXX : not implemented */
1391 spr_register(env
, SPR_L2CR
, "L2CR",
1392 SPR_NOACCESS
, SPR_NOACCESS
,
1393 &spr_read_generic
, spr_access_nop
,
1395 /* Not strictly an SPR */
1396 vscr_init(env
, 0x00010000);
1399 static void gen_l3_ctrl (CPUPPCState
*env
)
1402 /* XXX : not implemented */
1403 spr_register(env
, SPR_L3CR
, "L3CR",
1404 SPR_NOACCESS
, SPR_NOACCESS
,
1405 &spr_read_generic
, &spr_write_generic
,
1408 /* XXX : not implemented */
1409 spr_register(env
, SPR_L3ITCR0
, "L3ITCR0",
1410 SPR_NOACCESS
, SPR_NOACCESS
,
1411 &spr_read_generic
, &spr_write_generic
,
1414 /* XXX : not implemented */
1415 spr_register(env
, SPR_L3PM
, "L3PM",
1416 SPR_NOACCESS
, SPR_NOACCESS
,
1417 &spr_read_generic
, &spr_write_generic
,
1421 static void gen_74xx_soft_tlb (CPUPPCState
*env
, int nb_tlbs
, int nb_ways
)
1423 #if !defined(CONFIG_USER_ONLY)
1424 env
->nb_tlb
= nb_tlbs
;
1425 env
->nb_ways
= nb_ways
;
1427 env
->tlb_type
= TLB_6XX
;
1428 /* XXX : not implemented */
1429 spr_register(env
, SPR_PTEHI
, "PTEHI",
1430 SPR_NOACCESS
, SPR_NOACCESS
,
1431 &spr_read_generic
, &spr_write_generic
,
1433 /* XXX : not implemented */
1434 spr_register(env
, SPR_PTELO
, "PTELO",
1435 SPR_NOACCESS
, SPR_NOACCESS
,
1436 &spr_read_generic
, &spr_write_generic
,
1438 /* XXX : not implemented */
1439 spr_register(env
, SPR_TLBMISS
, "TLBMISS",
1440 SPR_NOACCESS
, SPR_NOACCESS
,
1441 &spr_read_generic
, &spr_write_generic
,
1446 #if !defined(CONFIG_USER_ONLY)
1447 static void spr_write_e500_l1csr0 (void *opaque
, int sprn
, int gprn
)
1449 TCGv t0
= tcg_temp_new();
1451 tcg_gen_andi_tl(t0
, cpu_gpr
[gprn
], ~256);
1452 gen_store_spr(sprn
, t0
);
1456 static void spr_write_booke206_mmucsr0 (void *opaque
, int sprn
, int gprn
)
1458 TCGv_i32 t0
= tcg_const_i32(sprn
);
1459 gen_helper_booke206_tlbflush(cpu_env
, t0
);
1460 tcg_temp_free_i32(t0
);
1463 static void spr_write_booke_pid (void *opaque
, int sprn
, int gprn
)
1465 TCGv_i32 t0
= tcg_const_i32(sprn
);
1466 gen_helper_booke_setpid(cpu_env
, t0
, cpu_gpr
[gprn
]);
1467 tcg_temp_free_i32(t0
);
1471 static void gen_spr_usprgh (CPUPPCState
*env
)
1473 spr_register(env
, SPR_USPRG4
, "USPRG4",
1474 &spr_read_ureg
, SPR_NOACCESS
,
1475 &spr_read_ureg
, SPR_NOACCESS
,
1477 spr_register(env
, SPR_USPRG5
, "USPRG5",
1478 &spr_read_ureg
, SPR_NOACCESS
,
1479 &spr_read_ureg
, SPR_NOACCESS
,
1481 spr_register(env
, SPR_USPRG6
, "USPRG6",
1482 &spr_read_ureg
, SPR_NOACCESS
,
1483 &spr_read_ureg
, SPR_NOACCESS
,
1485 spr_register(env
, SPR_USPRG7
, "USPRG7",
1486 &spr_read_ureg
, SPR_NOACCESS
,
1487 &spr_read_ureg
, SPR_NOACCESS
,
1491 /* PowerPC BookE SPR */
1492 static void gen_spr_BookE (CPUPPCState
*env
, uint64_t ivor_mask
)
1494 const char *ivor_names
[64] = {
1495 "IVOR0", "IVOR1", "IVOR2", "IVOR3",
1496 "IVOR4", "IVOR5", "IVOR6", "IVOR7",
1497 "IVOR8", "IVOR9", "IVOR10", "IVOR11",
1498 "IVOR12", "IVOR13", "IVOR14", "IVOR15",
1499 "IVOR16", "IVOR17", "IVOR18", "IVOR19",
1500 "IVOR20", "IVOR21", "IVOR22", "IVOR23",
1501 "IVOR24", "IVOR25", "IVOR26", "IVOR27",
1502 "IVOR28", "IVOR29", "IVOR30", "IVOR31",
1503 "IVOR32", "IVOR33", "IVOR34", "IVOR35",
1504 "IVOR36", "IVOR37", "IVOR38", "IVOR39",
1505 "IVOR40", "IVOR41", "IVOR42", "IVOR43",
1506 "IVOR44", "IVOR45", "IVOR46", "IVOR47",
1507 "IVOR48", "IVOR49", "IVOR50", "IVOR51",
1508 "IVOR52", "IVOR53", "IVOR54", "IVOR55",
1509 "IVOR56", "IVOR57", "IVOR58", "IVOR59",
1510 "IVOR60", "IVOR61", "IVOR62", "IVOR63",
1512 #define SPR_BOOKE_IVORxx (-1)
1513 int ivor_sprn
[64] = {
1514 SPR_BOOKE_IVOR0
, SPR_BOOKE_IVOR1
, SPR_BOOKE_IVOR2
, SPR_BOOKE_IVOR3
,
1515 SPR_BOOKE_IVOR4
, SPR_BOOKE_IVOR5
, SPR_BOOKE_IVOR6
, SPR_BOOKE_IVOR7
,
1516 SPR_BOOKE_IVOR8
, SPR_BOOKE_IVOR9
, SPR_BOOKE_IVOR10
, SPR_BOOKE_IVOR11
,
1517 SPR_BOOKE_IVOR12
, SPR_BOOKE_IVOR13
, SPR_BOOKE_IVOR14
, SPR_BOOKE_IVOR15
,
1518 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1519 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1520 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1521 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1522 SPR_BOOKE_IVOR32
, SPR_BOOKE_IVOR33
, SPR_BOOKE_IVOR34
, SPR_BOOKE_IVOR35
,
1523 SPR_BOOKE_IVOR36
, SPR_BOOKE_IVOR37
, SPR_BOOKE_IVOR38
, SPR_BOOKE_IVOR39
,
1524 SPR_BOOKE_IVOR40
, SPR_BOOKE_IVOR41
, SPR_BOOKE_IVOR42
, SPR_BOOKE_IVORxx
,
1525 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1526 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1527 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1528 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1529 SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
, SPR_BOOKE_IVORxx
,
1533 /* Interrupt processing */
1534 spr_register(env
, SPR_BOOKE_CSRR0
, "CSRR0",
1535 SPR_NOACCESS
, SPR_NOACCESS
,
1536 &spr_read_generic
, &spr_write_generic
,
1538 spr_register(env
, SPR_BOOKE_CSRR1
, "CSRR1",
1539 SPR_NOACCESS
, SPR_NOACCESS
,
1540 &spr_read_generic
, &spr_write_generic
,
1543 /* XXX : not implemented */
1544 spr_register(env
, SPR_BOOKE_IAC1
, "IAC1",
1545 SPR_NOACCESS
, SPR_NOACCESS
,
1546 &spr_read_generic
, &spr_write_generic
,
1548 /* XXX : not implemented */
1549 spr_register(env
, SPR_BOOKE_IAC2
, "IAC2",
1550 SPR_NOACCESS
, SPR_NOACCESS
,
1551 &spr_read_generic
, &spr_write_generic
,
1553 /* XXX : not implemented */
1554 spr_register(env
, SPR_BOOKE_DAC1
, "DAC1",
1555 SPR_NOACCESS
, SPR_NOACCESS
,
1556 &spr_read_generic
, &spr_write_generic
,
1558 /* XXX : not implemented */
1559 spr_register(env
, SPR_BOOKE_DAC2
, "DAC2",
1560 SPR_NOACCESS
, SPR_NOACCESS
,
1561 &spr_read_generic
, &spr_write_generic
,
1563 /* XXX : not implemented */
1564 spr_register(env
, SPR_BOOKE_DBCR0
, "DBCR0",
1565 SPR_NOACCESS
, SPR_NOACCESS
,
1566 &spr_read_generic
, &spr_write_40x_dbcr0
,
1568 /* XXX : not implemented */
1569 spr_register(env
, SPR_BOOKE_DBCR1
, "DBCR1",
1570 SPR_NOACCESS
, SPR_NOACCESS
,
1571 &spr_read_generic
, &spr_write_generic
,
1573 /* XXX : not implemented */
1574 spr_register(env
, SPR_BOOKE_DBCR2
, "DBCR2",
1575 SPR_NOACCESS
, SPR_NOACCESS
,
1576 &spr_read_generic
, &spr_write_generic
,
1578 /* XXX : not implemented */
1579 spr_register(env
, SPR_BOOKE_DBSR
, "DBSR",
1580 SPR_NOACCESS
, SPR_NOACCESS
,
1581 &spr_read_generic
, &spr_write_clear
,
1583 spr_register(env
, SPR_BOOKE_DEAR
, "DEAR",
1584 SPR_NOACCESS
, SPR_NOACCESS
,
1585 &spr_read_generic
, &spr_write_generic
,
1587 spr_register(env
, SPR_BOOKE_ESR
, "ESR",
1588 SPR_NOACCESS
, SPR_NOACCESS
,
1589 &spr_read_generic
, &spr_write_generic
,
1591 spr_register(env
, SPR_BOOKE_IVPR
, "IVPR",
1592 SPR_NOACCESS
, SPR_NOACCESS
,
1593 &spr_read_generic
, &spr_write_excp_prefix
,
1595 /* Exception vectors */
1596 for (i
= 0; i
< 64; i
++) {
1597 if (ivor_mask
& (1ULL << i
)) {
1598 if (ivor_sprn
[i
] == SPR_BOOKE_IVORxx
) {
1599 fprintf(stderr
, "ERROR: IVOR %d SPR is not defined\n", i
);
1602 spr_register(env
, ivor_sprn
[i
], ivor_names
[i
],
1603 SPR_NOACCESS
, SPR_NOACCESS
,
1604 &spr_read_generic
, &spr_write_excp_vector
,
1608 spr_register(env
, SPR_BOOKE_PID
, "PID",
1609 SPR_NOACCESS
, SPR_NOACCESS
,
1610 &spr_read_generic
, &spr_write_booke_pid
,
1612 spr_register(env
, SPR_BOOKE_TCR
, "TCR",
1613 SPR_NOACCESS
, SPR_NOACCESS
,
1614 &spr_read_generic
, &spr_write_booke_tcr
,
1616 spr_register(env
, SPR_BOOKE_TSR
, "TSR",
1617 SPR_NOACCESS
, SPR_NOACCESS
,
1618 &spr_read_generic
, &spr_write_booke_tsr
,
1621 spr_register(env
, SPR_DECR
, "DECR",
1622 SPR_NOACCESS
, SPR_NOACCESS
,
1623 &spr_read_decr
, &spr_write_decr
,
1625 spr_register(env
, SPR_BOOKE_DECAR
, "DECAR",
1626 SPR_NOACCESS
, SPR_NOACCESS
,
1627 SPR_NOACCESS
, &spr_write_generic
,
1630 spr_register(env
, SPR_USPRG0
, "USPRG0",
1631 &spr_read_generic
, &spr_write_generic
,
1632 &spr_read_generic
, &spr_write_generic
,
1634 spr_register(env
, SPR_SPRG4
, "SPRG4",
1635 SPR_NOACCESS
, SPR_NOACCESS
,
1636 &spr_read_generic
, &spr_write_generic
,
1638 spr_register(env
, SPR_SPRG5
, "SPRG5",
1639 SPR_NOACCESS
, SPR_NOACCESS
,
1640 &spr_read_generic
, &spr_write_generic
,
1642 spr_register(env
, SPR_SPRG6
, "SPRG6",
1643 SPR_NOACCESS
, SPR_NOACCESS
,
1644 &spr_read_generic
, &spr_write_generic
,
1646 spr_register(env
, SPR_SPRG7
, "SPRG7",
1647 SPR_NOACCESS
, SPR_NOACCESS
,
1648 &spr_read_generic
, &spr_write_generic
,
1652 static inline uint32_t gen_tlbncfg(uint32_t assoc
, uint32_t minsize
,
1653 uint32_t maxsize
, uint32_t flags
,
1656 return (assoc
<< TLBnCFG_ASSOC_SHIFT
) |
1657 (minsize
<< TLBnCFG_MINSIZE_SHIFT
) |
1658 (maxsize
<< TLBnCFG_MAXSIZE_SHIFT
) |
1662 /* BookE 2.06 storage control registers */
1663 static void gen_spr_BookE206(CPUPPCState
*env
, uint32_t mas_mask
,
1666 #if !defined(CONFIG_USER_ONLY)
1667 const char *mas_names
[8] = {
1668 "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
1671 SPR_BOOKE_MAS0
, SPR_BOOKE_MAS1
, SPR_BOOKE_MAS2
, SPR_BOOKE_MAS3
,
1672 SPR_BOOKE_MAS4
, SPR_BOOKE_MAS5
, SPR_BOOKE_MAS6
, SPR_BOOKE_MAS7
,
1676 /* TLB assist registers */
1677 /* XXX : not implemented */
1678 for (i
= 0; i
< 8; i
++) {
1679 void (*uea_write
)(void *o
, int sprn
, int gprn
) = &spr_write_generic32
;
1680 if (i
== 2 && (mas_mask
& (1 << i
)) && (env
->insns_flags
& PPC_64B
)) {
1681 uea_write
= &spr_write_generic
;
1683 if (mas_mask
& (1 << i
)) {
1684 spr_register(env
, mas_sprn
[i
], mas_names
[i
],
1685 SPR_NOACCESS
, SPR_NOACCESS
,
1686 &spr_read_generic
, uea_write
,
1690 if (env
->nb_pids
> 1) {
1691 /* XXX : not implemented */
1692 spr_register(env
, SPR_BOOKE_PID1
, "PID1",
1693 SPR_NOACCESS
, SPR_NOACCESS
,
1694 &spr_read_generic
, &spr_write_booke_pid
,
1697 if (env
->nb_pids
> 2) {
1698 /* XXX : not implemented */
1699 spr_register(env
, SPR_BOOKE_PID2
, "PID2",
1700 SPR_NOACCESS
, SPR_NOACCESS
,
1701 &spr_read_generic
, &spr_write_booke_pid
,
1704 /* XXX : not implemented */
1705 spr_register(env
, SPR_MMUCFG
, "MMUCFG",
1706 SPR_NOACCESS
, SPR_NOACCESS
,
1707 &spr_read_generic
, SPR_NOACCESS
,
1708 0x00000000); /* TOFIX */
1709 switch (env
->nb_ways
) {
1711 spr_register(env
, SPR_BOOKE_TLB3CFG
, "TLB3CFG",
1712 SPR_NOACCESS
, SPR_NOACCESS
,
1713 &spr_read_generic
, SPR_NOACCESS
,
1717 spr_register(env
, SPR_BOOKE_TLB2CFG
, "TLB2CFG",
1718 SPR_NOACCESS
, SPR_NOACCESS
,
1719 &spr_read_generic
, SPR_NOACCESS
,
1723 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
1724 SPR_NOACCESS
, SPR_NOACCESS
,
1725 &spr_read_generic
, SPR_NOACCESS
,
1729 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
1730 SPR_NOACCESS
, SPR_NOACCESS
,
1731 &spr_read_generic
, SPR_NOACCESS
,
1740 gen_spr_usprgh(env
);
1743 /* SPR specific to PowerPC 440 implementation */
1744 static void gen_spr_440 (CPUPPCState
*env
)
1747 /* XXX : not implemented */
1748 spr_register(env
, SPR_440_DNV0
, "DNV0",
1749 SPR_NOACCESS
, SPR_NOACCESS
,
1750 &spr_read_generic
, &spr_write_generic
,
1752 /* XXX : not implemented */
1753 spr_register(env
, SPR_440_DNV1
, "DNV1",
1754 SPR_NOACCESS
, SPR_NOACCESS
,
1755 &spr_read_generic
, &spr_write_generic
,
1757 /* XXX : not implemented */
1758 spr_register(env
, SPR_440_DNV2
, "DNV2",
1759 SPR_NOACCESS
, SPR_NOACCESS
,
1760 &spr_read_generic
, &spr_write_generic
,
1762 /* XXX : not implemented */
1763 spr_register(env
, SPR_440_DNV3
, "DNV3",
1764 SPR_NOACCESS
, SPR_NOACCESS
,
1765 &spr_read_generic
, &spr_write_generic
,
1767 /* XXX : not implemented */
1768 spr_register(env
, SPR_440_DTV0
, "DTV0",
1769 SPR_NOACCESS
, SPR_NOACCESS
,
1770 &spr_read_generic
, &spr_write_generic
,
1772 /* XXX : not implemented */
1773 spr_register(env
, SPR_440_DTV1
, "DTV1",
1774 SPR_NOACCESS
, SPR_NOACCESS
,
1775 &spr_read_generic
, &spr_write_generic
,
1777 /* XXX : not implemented */
1778 spr_register(env
, SPR_440_DTV2
, "DTV2",
1779 SPR_NOACCESS
, SPR_NOACCESS
,
1780 &spr_read_generic
, &spr_write_generic
,
1782 /* XXX : not implemented */
1783 spr_register(env
, SPR_440_DTV3
, "DTV3",
1784 SPR_NOACCESS
, SPR_NOACCESS
,
1785 &spr_read_generic
, &spr_write_generic
,
1787 /* XXX : not implemented */
1788 spr_register(env
, SPR_440_DVLIM
, "DVLIM",
1789 SPR_NOACCESS
, SPR_NOACCESS
,
1790 &spr_read_generic
, &spr_write_generic
,
1792 /* XXX : not implemented */
1793 spr_register(env
, SPR_440_INV0
, "INV0",
1794 SPR_NOACCESS
, SPR_NOACCESS
,
1795 &spr_read_generic
, &spr_write_generic
,
1797 /* XXX : not implemented */
1798 spr_register(env
, SPR_440_INV1
, "INV1",
1799 SPR_NOACCESS
, SPR_NOACCESS
,
1800 &spr_read_generic
, &spr_write_generic
,
1802 /* XXX : not implemented */
1803 spr_register(env
, SPR_440_INV2
, "INV2",
1804 SPR_NOACCESS
, SPR_NOACCESS
,
1805 &spr_read_generic
, &spr_write_generic
,
1807 /* XXX : not implemented */
1808 spr_register(env
, SPR_440_INV3
, "INV3",
1809 SPR_NOACCESS
, SPR_NOACCESS
,
1810 &spr_read_generic
, &spr_write_generic
,
1812 /* XXX : not implemented */
1813 spr_register(env
, SPR_440_ITV0
, "ITV0",
1814 SPR_NOACCESS
, SPR_NOACCESS
,
1815 &spr_read_generic
, &spr_write_generic
,
1817 /* XXX : not implemented */
1818 spr_register(env
, SPR_440_ITV1
, "ITV1",
1819 SPR_NOACCESS
, SPR_NOACCESS
,
1820 &spr_read_generic
, &spr_write_generic
,
1822 /* XXX : not implemented */
1823 spr_register(env
, SPR_440_ITV2
, "ITV2",
1824 SPR_NOACCESS
, SPR_NOACCESS
,
1825 &spr_read_generic
, &spr_write_generic
,
1827 /* XXX : not implemented */
1828 spr_register(env
, SPR_440_ITV3
, "ITV3",
1829 SPR_NOACCESS
, SPR_NOACCESS
,
1830 &spr_read_generic
, &spr_write_generic
,
1832 /* XXX : not implemented */
1833 spr_register(env
, SPR_440_IVLIM
, "IVLIM",
1834 SPR_NOACCESS
, SPR_NOACCESS
,
1835 &spr_read_generic
, &spr_write_generic
,
1838 /* XXX : not implemented */
1839 spr_register(env
, SPR_BOOKE_DCDBTRH
, "DCDBTRH",
1840 SPR_NOACCESS
, SPR_NOACCESS
,
1841 &spr_read_generic
, SPR_NOACCESS
,
1843 /* XXX : not implemented */
1844 spr_register(env
, SPR_BOOKE_DCDBTRL
, "DCDBTRL",
1845 SPR_NOACCESS
, SPR_NOACCESS
,
1846 &spr_read_generic
, SPR_NOACCESS
,
1848 /* XXX : not implemented */
1849 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
1850 SPR_NOACCESS
, SPR_NOACCESS
,
1851 &spr_read_generic
, SPR_NOACCESS
,
1853 /* XXX : not implemented */
1854 spr_register(env
, SPR_BOOKE_ICDBTRH
, "ICDBTRH",
1855 SPR_NOACCESS
, SPR_NOACCESS
,
1856 &spr_read_generic
, SPR_NOACCESS
,
1858 /* XXX : not implemented */
1859 spr_register(env
, SPR_BOOKE_ICDBTRL
, "ICDBTRL",
1860 SPR_NOACCESS
, SPR_NOACCESS
,
1861 &spr_read_generic
, SPR_NOACCESS
,
1863 /* XXX : not implemented */
1864 spr_register(env
, SPR_440_DBDR
, "DBDR",
1865 SPR_NOACCESS
, SPR_NOACCESS
,
1866 &spr_read_generic
, &spr_write_generic
,
1868 /* Processor control */
1869 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
1870 SPR_NOACCESS
, SPR_NOACCESS
,
1871 &spr_read_generic
, &spr_write_generic
,
1873 spr_register(env
, SPR_440_RSTCFG
, "RSTCFG",
1874 SPR_NOACCESS
, SPR_NOACCESS
,
1875 &spr_read_generic
, SPR_NOACCESS
,
1877 /* Storage control */
1878 spr_register(env
, SPR_440_MMUCR
, "MMUCR",
1879 SPR_NOACCESS
, SPR_NOACCESS
,
1880 &spr_read_generic
, &spr_write_generic
,
1884 /* SPR shared between PowerPC 40x implementations */
1885 static void gen_spr_40x (CPUPPCState
*env
)
1888 /* not emulated, as QEMU do not emulate caches */
1889 spr_register(env
, SPR_40x_DCCR
, "DCCR",
1890 SPR_NOACCESS
, SPR_NOACCESS
,
1891 &spr_read_generic
, &spr_write_generic
,
1893 /* not emulated, as QEMU do not emulate caches */
1894 spr_register(env
, SPR_40x_ICCR
, "ICCR",
1895 SPR_NOACCESS
, SPR_NOACCESS
,
1896 &spr_read_generic
, &spr_write_generic
,
1898 /* not emulated, as QEMU do not emulate caches */
1899 spr_register(env
, SPR_BOOKE_ICDBDR
, "ICDBDR",
1900 SPR_NOACCESS
, SPR_NOACCESS
,
1901 &spr_read_generic
, SPR_NOACCESS
,
1904 spr_register(env
, SPR_40x_DEAR
, "DEAR",
1905 SPR_NOACCESS
, SPR_NOACCESS
,
1906 &spr_read_generic
, &spr_write_generic
,
1908 spr_register(env
, SPR_40x_ESR
, "ESR",
1909 SPR_NOACCESS
, SPR_NOACCESS
,
1910 &spr_read_generic
, &spr_write_generic
,
1912 spr_register(env
, SPR_40x_EVPR
, "EVPR",
1913 SPR_NOACCESS
, SPR_NOACCESS
,
1914 &spr_read_generic
, &spr_write_excp_prefix
,
1916 spr_register(env
, SPR_40x_SRR2
, "SRR2",
1917 &spr_read_generic
, &spr_write_generic
,
1918 &spr_read_generic
, &spr_write_generic
,
1920 spr_register(env
, SPR_40x_SRR3
, "SRR3",
1921 &spr_read_generic
, &spr_write_generic
,
1922 &spr_read_generic
, &spr_write_generic
,
1925 spr_register(env
, SPR_40x_PIT
, "PIT",
1926 SPR_NOACCESS
, SPR_NOACCESS
,
1927 &spr_read_40x_pit
, &spr_write_40x_pit
,
1929 spr_register(env
, SPR_40x_TCR
, "TCR",
1930 SPR_NOACCESS
, SPR_NOACCESS
,
1931 &spr_read_generic
, &spr_write_booke_tcr
,
1933 spr_register(env
, SPR_40x_TSR
, "TSR",
1934 SPR_NOACCESS
, SPR_NOACCESS
,
1935 &spr_read_generic
, &spr_write_booke_tsr
,
1939 /* SPR specific to PowerPC 405 implementation */
1940 static void gen_spr_405 (CPUPPCState
*env
)
1943 spr_register(env
, SPR_40x_PID
, "PID",
1944 SPR_NOACCESS
, SPR_NOACCESS
,
1945 &spr_read_generic
, &spr_write_generic
,
1947 spr_register(env
, SPR_4xx_CCR0
, "CCR0",
1948 SPR_NOACCESS
, SPR_NOACCESS
,
1949 &spr_read_generic
, &spr_write_generic
,
1951 /* Debug interface */
1952 /* XXX : not implemented */
1953 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
1954 SPR_NOACCESS
, SPR_NOACCESS
,
1955 &spr_read_generic
, &spr_write_40x_dbcr0
,
1957 /* XXX : not implemented */
1958 spr_register(env
, SPR_405_DBCR1
, "DBCR1",
1959 SPR_NOACCESS
, SPR_NOACCESS
,
1960 &spr_read_generic
, &spr_write_generic
,
1962 /* XXX : not implemented */
1963 spr_register(env
, SPR_40x_DBSR
, "DBSR",
1964 SPR_NOACCESS
, SPR_NOACCESS
,
1965 &spr_read_generic
, &spr_write_clear
,
1966 /* Last reset was system reset */
1968 /* XXX : not implemented */
1969 spr_register(env
, SPR_40x_DAC1
, "DAC1",
1970 SPR_NOACCESS
, SPR_NOACCESS
,
1971 &spr_read_generic
, &spr_write_generic
,
1973 spr_register(env
, SPR_40x_DAC2
, "DAC2",
1974 SPR_NOACCESS
, SPR_NOACCESS
,
1975 &spr_read_generic
, &spr_write_generic
,
1977 /* XXX : not implemented */
1978 spr_register(env
, SPR_405_DVC1
, "DVC1",
1979 SPR_NOACCESS
, SPR_NOACCESS
,
1980 &spr_read_generic
, &spr_write_generic
,
1982 /* XXX : not implemented */
1983 spr_register(env
, SPR_405_DVC2
, "DVC2",
1984 SPR_NOACCESS
, SPR_NOACCESS
,
1985 &spr_read_generic
, &spr_write_generic
,
1987 /* XXX : not implemented */
1988 spr_register(env
, SPR_40x_IAC1
, "IAC1",
1989 SPR_NOACCESS
, SPR_NOACCESS
,
1990 &spr_read_generic
, &spr_write_generic
,
1992 spr_register(env
, SPR_40x_IAC2
, "IAC2",
1993 SPR_NOACCESS
, SPR_NOACCESS
,
1994 &spr_read_generic
, &spr_write_generic
,
1996 /* XXX : not implemented */
1997 spr_register(env
, SPR_405_IAC3
, "IAC3",
1998 SPR_NOACCESS
, SPR_NOACCESS
,
1999 &spr_read_generic
, &spr_write_generic
,
2001 /* XXX : not implemented */
2002 spr_register(env
, SPR_405_IAC4
, "IAC4",
2003 SPR_NOACCESS
, SPR_NOACCESS
,
2004 &spr_read_generic
, &spr_write_generic
,
2006 /* Storage control */
2007 /* XXX: TODO: not implemented */
2008 spr_register(env
, SPR_405_SLER
, "SLER",
2009 SPR_NOACCESS
, SPR_NOACCESS
,
2010 &spr_read_generic
, &spr_write_40x_sler
,
2012 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2013 SPR_NOACCESS
, SPR_NOACCESS
,
2014 &spr_read_generic
, &spr_write_generic
,
2016 /* XXX : not implemented */
2017 spr_register(env
, SPR_405_SU0R
, "SU0R",
2018 SPR_NOACCESS
, SPR_NOACCESS
,
2019 &spr_read_generic
, &spr_write_generic
,
2022 spr_register(env
, SPR_USPRG0
, "USPRG0",
2023 &spr_read_ureg
, SPR_NOACCESS
,
2024 &spr_read_ureg
, SPR_NOACCESS
,
2026 spr_register(env
, SPR_SPRG4
, "SPRG4",
2027 SPR_NOACCESS
, SPR_NOACCESS
,
2028 &spr_read_generic
, &spr_write_generic
,
2030 spr_register(env
, SPR_SPRG5
, "SPRG5",
2031 SPR_NOACCESS
, SPR_NOACCESS
,
2032 spr_read_generic
, &spr_write_generic
,
2034 spr_register(env
, SPR_SPRG6
, "SPRG6",
2035 SPR_NOACCESS
, SPR_NOACCESS
,
2036 spr_read_generic
, &spr_write_generic
,
2038 spr_register(env
, SPR_SPRG7
, "SPRG7",
2039 SPR_NOACCESS
, SPR_NOACCESS
,
2040 spr_read_generic
, &spr_write_generic
,
2042 gen_spr_usprgh(env
);
2045 /* SPR shared between PowerPC 401 & 403 implementations */
2046 static void gen_spr_401_403 (CPUPPCState
*env
)
2049 spr_register(env
, SPR_403_VTBL
, "TBL",
2050 &spr_read_tbl
, SPR_NOACCESS
,
2051 &spr_read_tbl
, SPR_NOACCESS
,
2053 spr_register(env
, SPR_403_TBL
, "TBL",
2054 SPR_NOACCESS
, SPR_NOACCESS
,
2055 SPR_NOACCESS
, &spr_write_tbl
,
2057 spr_register(env
, SPR_403_VTBU
, "TBU",
2058 &spr_read_tbu
, SPR_NOACCESS
,
2059 &spr_read_tbu
, SPR_NOACCESS
,
2061 spr_register(env
, SPR_403_TBU
, "TBU",
2062 SPR_NOACCESS
, SPR_NOACCESS
,
2063 SPR_NOACCESS
, &spr_write_tbu
,
2066 /* not emulated, as QEMU do not emulate caches */
2067 spr_register(env
, SPR_403_CDBCR
, "CDBCR",
2068 SPR_NOACCESS
, SPR_NOACCESS
,
2069 &spr_read_generic
, &spr_write_generic
,
2073 /* SPR specific to PowerPC 401 implementation */
2074 static void gen_spr_401 (CPUPPCState
*env
)
2076 /* Debug interface */
2077 /* XXX : not implemented */
2078 spr_register(env
, SPR_40x_DBCR0
, "DBCR",
2079 SPR_NOACCESS
, SPR_NOACCESS
,
2080 &spr_read_generic
, &spr_write_40x_dbcr0
,
2082 /* XXX : not implemented */
2083 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2084 SPR_NOACCESS
, SPR_NOACCESS
,
2085 &spr_read_generic
, &spr_write_clear
,
2086 /* Last reset was system reset */
2088 /* XXX : not implemented */
2089 spr_register(env
, SPR_40x_DAC1
, "DAC",
2090 SPR_NOACCESS
, SPR_NOACCESS
,
2091 &spr_read_generic
, &spr_write_generic
,
2093 /* XXX : not implemented */
2094 spr_register(env
, SPR_40x_IAC1
, "IAC",
2095 SPR_NOACCESS
, SPR_NOACCESS
,
2096 &spr_read_generic
, &spr_write_generic
,
2098 /* Storage control */
2099 /* XXX: TODO: not implemented */
2100 spr_register(env
, SPR_405_SLER
, "SLER",
2101 SPR_NOACCESS
, SPR_NOACCESS
,
2102 &spr_read_generic
, &spr_write_40x_sler
,
2104 /* not emulated, as QEMU never does speculative access */
2105 spr_register(env
, SPR_40x_SGR
, "SGR",
2106 SPR_NOACCESS
, SPR_NOACCESS
,
2107 &spr_read_generic
, &spr_write_generic
,
2109 /* not emulated, as QEMU do not emulate caches */
2110 spr_register(env
, SPR_40x_DCWR
, "DCWR",
2111 SPR_NOACCESS
, SPR_NOACCESS
,
2112 &spr_read_generic
, &spr_write_generic
,
2116 static void gen_spr_401x2 (CPUPPCState
*env
)
2119 spr_register(env
, SPR_40x_PID
, "PID",
2120 SPR_NOACCESS
, SPR_NOACCESS
,
2121 &spr_read_generic
, &spr_write_generic
,
2123 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2124 SPR_NOACCESS
, SPR_NOACCESS
,
2125 &spr_read_generic
, &spr_write_generic
,
2129 /* SPR specific to PowerPC 403 implementation */
2130 static void gen_spr_403 (CPUPPCState
*env
)
2132 /* Debug interface */
2133 /* XXX : not implemented */
2134 spr_register(env
, SPR_40x_DBCR0
, "DBCR0",
2135 SPR_NOACCESS
, SPR_NOACCESS
,
2136 &spr_read_generic
, &spr_write_40x_dbcr0
,
2138 /* XXX : not implemented */
2139 spr_register(env
, SPR_40x_DBSR
, "DBSR",
2140 SPR_NOACCESS
, SPR_NOACCESS
,
2141 &spr_read_generic
, &spr_write_clear
,
2142 /* Last reset was system reset */
2144 /* XXX : not implemented */
2145 spr_register(env
, SPR_40x_DAC1
, "DAC1",
2146 SPR_NOACCESS
, SPR_NOACCESS
,
2147 &spr_read_generic
, &spr_write_generic
,
2149 /* XXX : not implemented */
2150 spr_register(env
, SPR_40x_DAC2
, "DAC2",
2151 SPR_NOACCESS
, SPR_NOACCESS
,
2152 &spr_read_generic
, &spr_write_generic
,
2154 /* XXX : not implemented */
2155 spr_register(env
, SPR_40x_IAC1
, "IAC1",
2156 SPR_NOACCESS
, SPR_NOACCESS
,
2157 &spr_read_generic
, &spr_write_generic
,
2159 /* XXX : not implemented */
2160 spr_register(env
, SPR_40x_IAC2
, "IAC2",
2161 SPR_NOACCESS
, SPR_NOACCESS
,
2162 &spr_read_generic
, &spr_write_generic
,
2166 static void gen_spr_403_real (CPUPPCState
*env
)
2168 spr_register(env
, SPR_403_PBL1
, "PBL1",
2169 SPR_NOACCESS
, SPR_NOACCESS
,
2170 &spr_read_403_pbr
, &spr_write_403_pbr
,
2172 spr_register(env
, SPR_403_PBU1
, "PBU1",
2173 SPR_NOACCESS
, SPR_NOACCESS
,
2174 &spr_read_403_pbr
, &spr_write_403_pbr
,
2176 spr_register(env
, SPR_403_PBL2
, "PBL2",
2177 SPR_NOACCESS
, SPR_NOACCESS
,
2178 &spr_read_403_pbr
, &spr_write_403_pbr
,
2180 spr_register(env
, SPR_403_PBU2
, "PBU2",
2181 SPR_NOACCESS
, SPR_NOACCESS
,
2182 &spr_read_403_pbr
, &spr_write_403_pbr
,
2186 static void gen_spr_403_mmu (CPUPPCState
*env
)
2189 spr_register(env
, SPR_40x_PID
, "PID",
2190 SPR_NOACCESS
, SPR_NOACCESS
,
2191 &spr_read_generic
, &spr_write_generic
,
2193 spr_register(env
, SPR_40x_ZPR
, "ZPR",
2194 SPR_NOACCESS
, SPR_NOACCESS
,
2195 &spr_read_generic
, &spr_write_generic
,
2199 /* SPR specific to PowerPC compression coprocessor extension */
2200 static void gen_spr_compress (CPUPPCState
*env
)
2202 /* XXX : not implemented */
2203 spr_register(env
, SPR_401_SKR
, "SKR",
2204 SPR_NOACCESS
, SPR_NOACCESS
,
2205 &spr_read_generic
, &spr_write_generic
,
2209 static void gen_spr_5xx_8xx (CPUPPCState
*env
)
2211 /* Exception processing */
2212 spr_register_kvm(env
, SPR_DSISR
, "DSISR",
2213 SPR_NOACCESS
, SPR_NOACCESS
,
2214 &spr_read_generic
, &spr_write_generic
,
2215 KVM_REG_PPC_DSISR
, 0x00000000);
2216 spr_register_kvm(env
, SPR_DAR
, "DAR",
2217 SPR_NOACCESS
, SPR_NOACCESS
,
2218 &spr_read_generic
, &spr_write_generic
,
2219 KVM_REG_PPC_DAR
, 0x00000000);
2221 spr_register(env
, SPR_DECR
, "DECR",
2222 SPR_NOACCESS
, SPR_NOACCESS
,
2223 &spr_read_decr
, &spr_write_decr
,
2225 /* XXX : not implemented */
2226 spr_register(env
, SPR_MPC_EIE
, "EIE",
2227 SPR_NOACCESS
, SPR_NOACCESS
,
2228 &spr_read_generic
, &spr_write_generic
,
2230 /* XXX : not implemented */
2231 spr_register(env
, SPR_MPC_EID
, "EID",
2232 SPR_NOACCESS
, SPR_NOACCESS
,
2233 &spr_read_generic
, &spr_write_generic
,
2235 /* XXX : not implemented */
2236 spr_register(env
, SPR_MPC_NRI
, "NRI",
2237 SPR_NOACCESS
, SPR_NOACCESS
,
2238 &spr_read_generic
, &spr_write_generic
,
2240 /* XXX : not implemented */
2241 spr_register(env
, SPR_MPC_CMPA
, "CMPA",
2242 SPR_NOACCESS
, SPR_NOACCESS
,
2243 &spr_read_generic
, &spr_write_generic
,
2245 /* XXX : not implemented */
2246 spr_register(env
, SPR_MPC_CMPB
, "CMPB",
2247 SPR_NOACCESS
, SPR_NOACCESS
,
2248 &spr_read_generic
, &spr_write_generic
,
2250 /* XXX : not implemented */
2251 spr_register(env
, SPR_MPC_CMPC
, "CMPC",
2252 SPR_NOACCESS
, SPR_NOACCESS
,
2253 &spr_read_generic
, &spr_write_generic
,
2255 /* XXX : not implemented */
2256 spr_register(env
, SPR_MPC_CMPD
, "CMPD",
2257 SPR_NOACCESS
, SPR_NOACCESS
,
2258 &spr_read_generic
, &spr_write_generic
,
2260 /* XXX : not implemented */
2261 spr_register(env
, SPR_MPC_ECR
, "ECR",
2262 SPR_NOACCESS
, SPR_NOACCESS
,
2263 &spr_read_generic
, &spr_write_generic
,
2265 /* XXX : not implemented */
2266 spr_register(env
, SPR_MPC_DER
, "DER",
2267 SPR_NOACCESS
, SPR_NOACCESS
,
2268 &spr_read_generic
, &spr_write_generic
,
2270 /* XXX : not implemented */
2271 spr_register(env
, SPR_MPC_COUNTA
, "COUNTA",
2272 SPR_NOACCESS
, SPR_NOACCESS
,
2273 &spr_read_generic
, &spr_write_generic
,
2275 /* XXX : not implemented */
2276 spr_register(env
, SPR_MPC_COUNTB
, "COUNTB",
2277 SPR_NOACCESS
, SPR_NOACCESS
,
2278 &spr_read_generic
, &spr_write_generic
,
2280 /* XXX : not implemented */
2281 spr_register(env
, SPR_MPC_CMPE
, "CMPE",
2282 SPR_NOACCESS
, SPR_NOACCESS
,
2283 &spr_read_generic
, &spr_write_generic
,
2285 /* XXX : not implemented */
2286 spr_register(env
, SPR_MPC_CMPF
, "CMPF",
2287 SPR_NOACCESS
, SPR_NOACCESS
,
2288 &spr_read_generic
, &spr_write_generic
,
2290 /* XXX : not implemented */
2291 spr_register(env
, SPR_MPC_CMPG
, "CMPG",
2292 SPR_NOACCESS
, SPR_NOACCESS
,
2293 &spr_read_generic
, &spr_write_generic
,
2295 /* XXX : not implemented */
2296 spr_register(env
, SPR_MPC_CMPH
, "CMPH",
2297 SPR_NOACCESS
, SPR_NOACCESS
,
2298 &spr_read_generic
, &spr_write_generic
,
2300 /* XXX : not implemented */
2301 spr_register(env
, SPR_MPC_LCTRL1
, "LCTRL1",
2302 SPR_NOACCESS
, SPR_NOACCESS
,
2303 &spr_read_generic
, &spr_write_generic
,
2305 /* XXX : not implemented */
2306 spr_register(env
, SPR_MPC_LCTRL2
, "LCTRL2",
2307 SPR_NOACCESS
, SPR_NOACCESS
,
2308 &spr_read_generic
, &spr_write_generic
,
2310 /* XXX : not implemented */
2311 spr_register(env
, SPR_MPC_BAR
, "BAR",
2312 SPR_NOACCESS
, SPR_NOACCESS
,
2313 &spr_read_generic
, &spr_write_generic
,
2315 /* XXX : not implemented */
2316 spr_register(env
, SPR_MPC_DPDR
, "DPDR",
2317 SPR_NOACCESS
, SPR_NOACCESS
,
2318 &spr_read_generic
, &spr_write_generic
,
2320 /* XXX : not implemented */
2321 spr_register(env
, SPR_MPC_IMMR
, "IMMR",
2322 SPR_NOACCESS
, SPR_NOACCESS
,
2323 &spr_read_generic
, &spr_write_generic
,
2327 static void gen_spr_5xx (CPUPPCState
*env
)
2329 /* XXX : not implemented */
2330 spr_register(env
, SPR_RCPU_MI_GRA
, "MI_GRA",
2331 SPR_NOACCESS
, SPR_NOACCESS
,
2332 &spr_read_generic
, &spr_write_generic
,
2334 /* XXX : not implemented */
2335 spr_register(env
, SPR_RCPU_L2U_GRA
, "L2U_GRA",
2336 SPR_NOACCESS
, SPR_NOACCESS
,
2337 &spr_read_generic
, &spr_write_generic
,
2339 /* XXX : not implemented */
2340 spr_register(env
, SPR_RPCU_BBCMCR
, "L2U_BBCMCR",
2341 SPR_NOACCESS
, SPR_NOACCESS
,
2342 &spr_read_generic
, &spr_write_generic
,
2344 /* XXX : not implemented */
2345 spr_register(env
, SPR_RCPU_L2U_MCR
, "L2U_MCR",
2346 SPR_NOACCESS
, SPR_NOACCESS
,
2347 &spr_read_generic
, &spr_write_generic
,
2349 /* XXX : not implemented */
2350 spr_register(env
, SPR_RCPU_MI_RBA0
, "MI_RBA0",
2351 SPR_NOACCESS
, SPR_NOACCESS
,
2352 &spr_read_generic
, &spr_write_generic
,
2354 /* XXX : not implemented */
2355 spr_register(env
, SPR_RCPU_MI_RBA1
, "MI_RBA1",
2356 SPR_NOACCESS
, SPR_NOACCESS
,
2357 &spr_read_generic
, &spr_write_generic
,
2359 /* XXX : not implemented */
2360 spr_register(env
, SPR_RCPU_MI_RBA2
, "MI_RBA2",
2361 SPR_NOACCESS
, SPR_NOACCESS
,
2362 &spr_read_generic
, &spr_write_generic
,
2364 /* XXX : not implemented */
2365 spr_register(env
, SPR_RCPU_MI_RBA3
, "MI_RBA3",
2366 SPR_NOACCESS
, SPR_NOACCESS
,
2367 &spr_read_generic
, &spr_write_generic
,
2369 /* XXX : not implemented */
2370 spr_register(env
, SPR_RCPU_L2U_RBA0
, "L2U_RBA0",
2371 SPR_NOACCESS
, SPR_NOACCESS
,
2372 &spr_read_generic
, &spr_write_generic
,
2374 /* XXX : not implemented */
2375 spr_register(env
, SPR_RCPU_L2U_RBA1
, "L2U_RBA1",
2376 SPR_NOACCESS
, SPR_NOACCESS
,
2377 &spr_read_generic
, &spr_write_generic
,
2379 /* XXX : not implemented */
2380 spr_register(env
, SPR_RCPU_L2U_RBA2
, "L2U_RBA2",
2381 SPR_NOACCESS
, SPR_NOACCESS
,
2382 &spr_read_generic
, &spr_write_generic
,
2384 /* XXX : not implemented */
2385 spr_register(env
, SPR_RCPU_L2U_RBA3
, "L2U_RBA3",
2386 SPR_NOACCESS
, SPR_NOACCESS
,
2387 &spr_read_generic
, &spr_write_generic
,
2389 /* XXX : not implemented */
2390 spr_register(env
, SPR_RCPU_MI_RA0
, "MI_RA0",
2391 SPR_NOACCESS
, SPR_NOACCESS
,
2392 &spr_read_generic
, &spr_write_generic
,
2394 /* XXX : not implemented */
2395 spr_register(env
, SPR_RCPU_MI_RA1
, "MI_RA1",
2396 SPR_NOACCESS
, SPR_NOACCESS
,
2397 &spr_read_generic
, &spr_write_generic
,
2399 /* XXX : not implemented */
2400 spr_register(env
, SPR_RCPU_MI_RA2
, "MI_RA2",
2401 SPR_NOACCESS
, SPR_NOACCESS
,
2402 &spr_read_generic
, &spr_write_generic
,
2404 /* XXX : not implemented */
2405 spr_register(env
, SPR_RCPU_MI_RA3
, "MI_RA3",
2406 SPR_NOACCESS
, SPR_NOACCESS
,
2407 &spr_read_generic
, &spr_write_generic
,
2409 /* XXX : not implemented */
2410 spr_register(env
, SPR_RCPU_L2U_RA0
, "L2U_RA0",
2411 SPR_NOACCESS
, SPR_NOACCESS
,
2412 &spr_read_generic
, &spr_write_generic
,
2414 /* XXX : not implemented */
2415 spr_register(env
, SPR_RCPU_L2U_RA1
, "L2U_RA1",
2416 SPR_NOACCESS
, SPR_NOACCESS
,
2417 &spr_read_generic
, &spr_write_generic
,
2419 /* XXX : not implemented */
2420 spr_register(env
, SPR_RCPU_L2U_RA2
, "L2U_RA2",
2421 SPR_NOACCESS
, SPR_NOACCESS
,
2422 &spr_read_generic
, &spr_write_generic
,
2424 /* XXX : not implemented */
2425 spr_register(env
, SPR_RCPU_L2U_RA3
, "L2U_RA3",
2426 SPR_NOACCESS
, SPR_NOACCESS
,
2427 &spr_read_generic
, &spr_write_generic
,
2429 /* XXX : not implemented */
2430 spr_register(env
, SPR_RCPU_FPECR
, "FPECR",
2431 SPR_NOACCESS
, SPR_NOACCESS
,
2432 &spr_read_generic
, &spr_write_generic
,
2436 static void gen_spr_8xx (CPUPPCState
*env
)
2438 /* XXX : not implemented */
2439 spr_register(env
, SPR_MPC_IC_CST
, "IC_CST",
2440 SPR_NOACCESS
, SPR_NOACCESS
,
2441 &spr_read_generic
, &spr_write_generic
,
2443 /* XXX : not implemented */
2444 spr_register(env
, SPR_MPC_IC_ADR
, "IC_ADR",
2445 SPR_NOACCESS
, SPR_NOACCESS
,
2446 &spr_read_generic
, &spr_write_generic
,
2448 /* XXX : not implemented */
2449 spr_register(env
, SPR_MPC_IC_DAT
, "IC_DAT",
2450 SPR_NOACCESS
, SPR_NOACCESS
,
2451 &spr_read_generic
, &spr_write_generic
,
2453 /* XXX : not implemented */
2454 spr_register(env
, SPR_MPC_DC_CST
, "DC_CST",
2455 SPR_NOACCESS
, SPR_NOACCESS
,
2456 &spr_read_generic
, &spr_write_generic
,
2458 /* XXX : not implemented */
2459 spr_register(env
, SPR_MPC_DC_ADR
, "DC_ADR",
2460 SPR_NOACCESS
, SPR_NOACCESS
,
2461 &spr_read_generic
, &spr_write_generic
,
2463 /* XXX : not implemented */
2464 spr_register(env
, SPR_MPC_DC_DAT
, "DC_DAT",
2465 SPR_NOACCESS
, SPR_NOACCESS
,
2466 &spr_read_generic
, &spr_write_generic
,
2468 /* XXX : not implemented */
2469 spr_register(env
, SPR_MPC_MI_CTR
, "MI_CTR",
2470 SPR_NOACCESS
, SPR_NOACCESS
,
2471 &spr_read_generic
, &spr_write_generic
,
2473 /* XXX : not implemented */
2474 spr_register(env
, SPR_MPC_MI_AP
, "MI_AP",
2475 SPR_NOACCESS
, SPR_NOACCESS
,
2476 &spr_read_generic
, &spr_write_generic
,
2478 /* XXX : not implemented */
2479 spr_register(env
, SPR_MPC_MI_EPN
, "MI_EPN",
2480 SPR_NOACCESS
, SPR_NOACCESS
,
2481 &spr_read_generic
, &spr_write_generic
,
2483 /* XXX : not implemented */
2484 spr_register(env
, SPR_MPC_MI_TWC
, "MI_TWC",
2485 SPR_NOACCESS
, SPR_NOACCESS
,
2486 &spr_read_generic
, &spr_write_generic
,
2488 /* XXX : not implemented */
2489 spr_register(env
, SPR_MPC_MI_RPN
, "MI_RPN",
2490 SPR_NOACCESS
, SPR_NOACCESS
,
2491 &spr_read_generic
, &spr_write_generic
,
2493 /* XXX : not implemented */
2494 spr_register(env
, SPR_MPC_MI_DBCAM
, "MI_DBCAM",
2495 SPR_NOACCESS
, SPR_NOACCESS
,
2496 &spr_read_generic
, &spr_write_generic
,
2498 /* XXX : not implemented */
2499 spr_register(env
, SPR_MPC_MI_DBRAM0
, "MI_DBRAM0",
2500 SPR_NOACCESS
, SPR_NOACCESS
,
2501 &spr_read_generic
, &spr_write_generic
,
2503 /* XXX : not implemented */
2504 spr_register(env
, SPR_MPC_MI_DBRAM1
, "MI_DBRAM1",
2505 SPR_NOACCESS
, SPR_NOACCESS
,
2506 &spr_read_generic
, &spr_write_generic
,
2508 /* XXX : not implemented */
2509 spr_register(env
, SPR_MPC_MD_CTR
, "MD_CTR",
2510 SPR_NOACCESS
, SPR_NOACCESS
,
2511 &spr_read_generic
, &spr_write_generic
,
2513 /* XXX : not implemented */
2514 spr_register(env
, SPR_MPC_MD_CASID
, "MD_CASID",
2515 SPR_NOACCESS
, SPR_NOACCESS
,
2516 &spr_read_generic
, &spr_write_generic
,
2518 /* XXX : not implemented */
2519 spr_register(env
, SPR_MPC_MD_AP
, "MD_AP",
2520 SPR_NOACCESS
, SPR_NOACCESS
,
2521 &spr_read_generic
, &spr_write_generic
,
2523 /* XXX : not implemented */
2524 spr_register(env
, SPR_MPC_MD_EPN
, "MD_EPN",
2525 SPR_NOACCESS
, SPR_NOACCESS
,
2526 &spr_read_generic
, &spr_write_generic
,
2528 /* XXX : not implemented */
2529 spr_register(env
, SPR_MPC_MD_TWB
, "MD_TWB",
2530 SPR_NOACCESS
, SPR_NOACCESS
,
2531 &spr_read_generic
, &spr_write_generic
,
2533 /* XXX : not implemented */
2534 spr_register(env
, SPR_MPC_MD_TWC
, "MD_TWC",
2535 SPR_NOACCESS
, SPR_NOACCESS
,
2536 &spr_read_generic
, &spr_write_generic
,
2538 /* XXX : not implemented */
2539 spr_register(env
, SPR_MPC_MD_RPN
, "MD_RPN",
2540 SPR_NOACCESS
, SPR_NOACCESS
,
2541 &spr_read_generic
, &spr_write_generic
,
2543 /* XXX : not implemented */
2544 spr_register(env
, SPR_MPC_MD_TW
, "MD_TW",
2545 SPR_NOACCESS
, SPR_NOACCESS
,
2546 &spr_read_generic
, &spr_write_generic
,
2548 /* XXX : not implemented */
2549 spr_register(env
, SPR_MPC_MD_DBCAM
, "MD_DBCAM",
2550 SPR_NOACCESS
, SPR_NOACCESS
,
2551 &spr_read_generic
, &spr_write_generic
,
2553 /* XXX : not implemented */
2554 spr_register(env
, SPR_MPC_MD_DBRAM0
, "MD_DBRAM0",
2555 SPR_NOACCESS
, SPR_NOACCESS
,
2556 &spr_read_generic
, &spr_write_generic
,
2558 /* XXX : not implemented */
2559 spr_register(env
, SPR_MPC_MD_DBRAM1
, "MD_DBRAM1",
2560 SPR_NOACCESS
, SPR_NOACCESS
,
2561 &spr_read_generic
, &spr_write_generic
,
2567 * AMR => SPR 29 (Power 2.04)
2568 * CTRL => SPR 136 (Power 2.04)
2569 * CTRL => SPR 152 (Power 2.04)
2570 * SCOMC => SPR 276 (64 bits ?)
2571 * SCOMD => SPR 277 (64 bits ?)
2572 * TBU40 => SPR 286 (Power 2.04 hypv)
2573 * HSPRG0 => SPR 304 (Power 2.04 hypv)
2574 * HSPRG1 => SPR 305 (Power 2.04 hypv)
2575 * HDSISR => SPR 306 (Power 2.04 hypv)
2576 * HDAR => SPR 307 (Power 2.04 hypv)
2577 * PURR => SPR 309 (Power 2.04 hypv)
2578 * HDEC => SPR 310 (Power 2.04 hypv)
2579 * HIOR => SPR 311 (hypv)
2580 * RMOR => SPR 312 (970)
2581 * HRMOR => SPR 313 (Power 2.04 hypv)
2582 * HSRR0 => SPR 314 (Power 2.04 hypv)
2583 * HSRR1 => SPR 315 (Power 2.04 hypv)
2584 * LPIDR => SPR 317 (970)
2585 * EPR => SPR 702 (Power 2.04 emb)
2586 * perf => 768-783 (Power 2.04)
2587 * perf => 784-799 (Power 2.04)
2588 * PPR => SPR 896 (Power 2.04)
2589 * EPLC => SPR 947 (Power 2.04 emb)
2590 * EPSC => SPR 948 (Power 2.04 emb)
2591 * DABRX => 1015 (Power 2.04 hypv)
2592 * FPECR => SPR 1022 (?)
2593 * ... and more (thermal management, performance counters, ...)
2596 /*****************************************************************************/
2597 /* Exception vectors models */
2598 static void init_excp_4xx_real (CPUPPCState
*env
)
2600 #if !defined(CONFIG_USER_ONLY)
2601 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2602 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2603 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2604 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2605 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2606 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2607 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2608 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2609 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2610 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2611 env
->ivor_mask
= 0x0000FFF0UL
;
2612 env
->ivpr_mask
= 0xFFFF0000UL
;
2613 /* Hardware reset vector */
2614 env
->hreset_vector
= 0xFFFFFFFCUL
;
2618 static void init_excp_4xx_softmmu (CPUPPCState
*env
)
2620 #if !defined(CONFIG_USER_ONLY)
2621 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000100;
2622 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2623 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2624 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2625 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2626 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2627 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2628 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2629 env
->excp_vectors
[POWERPC_EXCP_PIT
] = 0x00001000;
2630 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00001010;
2631 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001020;
2632 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001100;
2633 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001200;
2634 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00002000;
2635 env
->ivor_mask
= 0x0000FFF0UL
;
2636 env
->ivpr_mask
= 0xFFFF0000UL
;
2637 /* Hardware reset vector */
2638 env
->hreset_vector
= 0xFFFFFFFCUL
;
2642 static void init_excp_MPC5xx (CPUPPCState
*env
)
2644 #if !defined(CONFIG_USER_ONLY)
2645 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2646 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2647 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2648 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2649 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2650 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2651 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2652 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2653 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2654 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2655 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2656 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2657 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2658 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2659 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2660 env
->ivor_mask
= 0x0000FFF0UL
;
2661 env
->ivpr_mask
= 0xFFFF0000UL
;
2662 /* Hardware reset vector */
2663 env
->hreset_vector
= 0x00000100UL
;
2667 static void init_excp_MPC8xx (CPUPPCState
*env
)
2669 #if !defined(CONFIG_USER_ONLY)
2670 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2671 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2672 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2673 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2674 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2675 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2676 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2677 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000900;
2678 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2679 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2680 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2681 env
->excp_vectors
[POWERPC_EXCP_FPA
] = 0x00000E00;
2682 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001000;
2683 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00001100;
2684 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00001200;
2685 env
->excp_vectors
[POWERPC_EXCP_ITLBE
] = 0x00001300;
2686 env
->excp_vectors
[POWERPC_EXCP_DTLBE
] = 0x00001400;
2687 env
->excp_vectors
[POWERPC_EXCP_DABR
] = 0x00001C00;
2688 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001C00;
2689 env
->excp_vectors
[POWERPC_EXCP_MEXTBR
] = 0x00001E00;
2690 env
->excp_vectors
[POWERPC_EXCP_NMEXTBR
] = 0x00001F00;
2691 env
->ivor_mask
= 0x0000FFF0UL
;
2692 env
->ivpr_mask
= 0xFFFF0000UL
;
2693 /* Hardware reset vector */
2694 env
->hreset_vector
= 0x00000100UL
;
2698 static void init_excp_G2 (CPUPPCState
*env
)
2700 #if !defined(CONFIG_USER_ONLY)
2701 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2702 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2703 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2704 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2705 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2706 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2707 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2708 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2709 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2710 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000A00;
2711 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2712 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2713 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2714 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2715 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2716 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2717 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2718 /* Hardware reset vector */
2719 env
->hreset_vector
= 0x00000100UL
;
2723 static void init_excp_e200(CPUPPCState
*env
, target_ulong ivpr_mask
)
2725 #if !defined(CONFIG_USER_ONLY)
2726 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000FFC;
2727 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2728 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2729 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2730 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2731 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2732 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2733 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2734 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2735 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2736 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2737 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2738 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2739 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2740 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2741 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2742 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2743 env
->excp_vectors
[POWERPC_EXCP_SPEU
] = 0x00000000;
2744 env
->excp_vectors
[POWERPC_EXCP_EFPDI
] = 0x00000000;
2745 env
->excp_vectors
[POWERPC_EXCP_EFPRI
] = 0x00000000;
2746 env
->ivor_mask
= 0x0000FFF7UL
;
2747 env
->ivpr_mask
= ivpr_mask
;
2748 /* Hardware reset vector */
2749 env
->hreset_vector
= 0xFFFFFFFCUL
;
2753 static void init_excp_BookE (CPUPPCState
*env
)
2755 #if !defined(CONFIG_USER_ONLY)
2756 env
->excp_vectors
[POWERPC_EXCP_CRITICAL
] = 0x00000000;
2757 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000000;
2758 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000000;
2759 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000000;
2760 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000000;
2761 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000000;
2762 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000000;
2763 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000000;
2764 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000000;
2765 env
->excp_vectors
[POWERPC_EXCP_APU
] = 0x00000000;
2766 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000000;
2767 env
->excp_vectors
[POWERPC_EXCP_FIT
] = 0x00000000;
2768 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00000000;
2769 env
->excp_vectors
[POWERPC_EXCP_DTLB
] = 0x00000000;
2770 env
->excp_vectors
[POWERPC_EXCP_ITLB
] = 0x00000000;
2771 env
->excp_vectors
[POWERPC_EXCP_DEBUG
] = 0x00000000;
2772 env
->ivor_mask
= 0x0000FFE0UL
;
2773 env
->ivpr_mask
= 0xFFFF0000UL
;
2774 /* Hardware reset vector */
2775 env
->hreset_vector
= 0xFFFFFFFCUL
;
2779 static void init_excp_601 (CPUPPCState
*env
)
2781 #if !defined(CONFIG_USER_ONLY)
2782 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2783 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2784 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2785 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2786 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2787 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2788 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2789 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2790 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2791 env
->excp_vectors
[POWERPC_EXCP_IO
] = 0x00000A00;
2792 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2793 env
->excp_vectors
[POWERPC_EXCP_RUNM
] = 0x00002000;
2794 /* Hardware reset vector */
2795 env
->hreset_vector
= 0x00000100UL
;
2799 static void init_excp_602 (CPUPPCState
*env
)
2801 #if !defined(CONFIG_USER_ONLY)
2802 /* XXX: exception prefix has a special behavior on 602 */
2803 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2804 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2805 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2806 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2807 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2808 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2809 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2810 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2811 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2812 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2813 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2814 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2815 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2816 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2817 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2818 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2819 env
->excp_vectors
[POWERPC_EXCP_WDT
] = 0x00001500;
2820 env
->excp_vectors
[POWERPC_EXCP_EMUL
] = 0x00001600;
2821 /* Hardware reset vector */
2822 env
->hreset_vector
= 0x00000100UL
;
2826 static void init_excp_603 (CPUPPCState
*env
)
2828 #if !defined(CONFIG_USER_ONLY)
2829 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2830 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2831 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2832 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2833 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2834 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2835 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2836 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2837 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2838 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2839 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2840 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2841 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2842 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2843 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2844 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2845 /* Hardware reset vector */
2846 env
->hreset_vector
= 0x00000100UL
;
2850 static void init_excp_604 (CPUPPCState
*env
)
2852 #if !defined(CONFIG_USER_ONLY)
2853 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2854 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2855 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2856 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2857 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2858 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2859 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2860 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2861 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2862 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2863 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2864 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2865 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2866 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2867 /* Hardware reset vector */
2868 env
->hreset_vector
= 0x00000100UL
;
2872 static void init_excp_7x0 (CPUPPCState
*env
)
2874 #if !defined(CONFIG_USER_ONLY)
2875 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2876 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2877 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2878 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2879 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2880 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2881 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2882 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2883 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2884 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2885 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2886 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2887 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2888 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2889 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2890 /* Hardware reset vector */
2891 env
->hreset_vector
= 0x00000100UL
;
2895 static void init_excp_750cl (CPUPPCState
*env
)
2897 #if !defined(CONFIG_USER_ONLY)
2898 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2899 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2900 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2901 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2902 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2903 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2904 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2905 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2906 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2907 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2908 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2909 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2910 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2911 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2912 /* Hardware reset vector */
2913 env
->hreset_vector
= 0x00000100UL
;
2917 static void init_excp_750cx (CPUPPCState
*env
)
2919 #if !defined(CONFIG_USER_ONLY)
2920 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2921 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2922 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2923 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2924 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2925 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2926 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2927 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2928 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2929 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2930 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2931 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2932 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2933 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2934 /* Hardware reset vector */
2935 env
->hreset_vector
= 0x00000100UL
;
2939 /* XXX: Check if this is correct */
2940 static void init_excp_7x5 (CPUPPCState
*env
)
2942 #if !defined(CONFIG_USER_ONLY)
2943 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2944 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2945 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2946 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2947 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2948 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2949 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2950 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2951 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2952 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2953 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2954 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2955 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
2956 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
2957 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
2958 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2959 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2960 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2961 /* Hardware reset vector */
2962 env
->hreset_vector
= 0x00000100UL
;
2966 static void init_excp_7400 (CPUPPCState
*env
)
2968 #if !defined(CONFIG_USER_ONLY)
2969 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2970 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2971 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2972 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2973 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2974 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
2975 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
2976 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
2977 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
2978 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
2979 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
2980 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
2981 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
2982 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
2983 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
2984 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
2985 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001700;
2986 /* Hardware reset vector */
2987 env
->hreset_vector
= 0x00000100UL
;
2991 static void init_excp_7450 (CPUPPCState
*env
)
2993 #if !defined(CONFIG_USER_ONLY)
2994 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
2995 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
2996 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
2997 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
2998 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
2999 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3000 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3001 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3002 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3003 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3004 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3005 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3006 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3007 env
->excp_vectors
[POWERPC_EXCP_IFTLB
] = 0x00001000;
3008 env
->excp_vectors
[POWERPC_EXCP_DLTLB
] = 0x00001100;
3009 env
->excp_vectors
[POWERPC_EXCP_DSTLB
] = 0x00001200;
3010 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3011 env
->excp_vectors
[POWERPC_EXCP_SMI
] = 0x00001400;
3012 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001600;
3013 /* Hardware reset vector */
3014 env
->hreset_vector
= 0x00000100UL
;
3018 #if defined (TARGET_PPC64)
3019 static void init_excp_970 (CPUPPCState
*env
)
3021 #if !defined(CONFIG_USER_ONLY)
3022 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3023 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3024 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3025 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3026 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3027 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3028 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3029 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3030 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3031 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3032 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3033 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3034 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3035 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3036 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3037 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3038 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3039 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
3040 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
3041 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
3042 /* Hardware reset vector */
3043 env
->hreset_vector
= 0x0000000000000100ULL
;
3047 static void init_excp_POWER7 (CPUPPCState
*env
)
3049 #if !defined(CONFIG_USER_ONLY)
3050 env
->excp_vectors
[POWERPC_EXCP_RESET
] = 0x00000100;
3051 env
->excp_vectors
[POWERPC_EXCP_MCHECK
] = 0x00000200;
3052 env
->excp_vectors
[POWERPC_EXCP_DSI
] = 0x00000300;
3053 env
->excp_vectors
[POWERPC_EXCP_DSEG
] = 0x00000380;
3054 env
->excp_vectors
[POWERPC_EXCP_ISI
] = 0x00000400;
3055 env
->excp_vectors
[POWERPC_EXCP_ISEG
] = 0x00000480;
3056 env
->excp_vectors
[POWERPC_EXCP_EXTERNAL
] = 0x00000500;
3057 env
->excp_vectors
[POWERPC_EXCP_ALIGN
] = 0x00000600;
3058 env
->excp_vectors
[POWERPC_EXCP_PROGRAM
] = 0x00000700;
3059 env
->excp_vectors
[POWERPC_EXCP_FPU
] = 0x00000800;
3060 env
->excp_vectors
[POWERPC_EXCP_DECR
] = 0x00000900;
3061 env
->excp_vectors
[POWERPC_EXCP_HDECR
] = 0x00000980;
3062 env
->excp_vectors
[POWERPC_EXCP_SYSCALL
] = 0x00000C00;
3063 env
->excp_vectors
[POWERPC_EXCP_TRACE
] = 0x00000D00;
3064 env
->excp_vectors
[POWERPC_EXCP_PERFM
] = 0x00000F00;
3065 env
->excp_vectors
[POWERPC_EXCP_VPU
] = 0x00000F20;
3066 env
->excp_vectors
[POWERPC_EXCP_VSXU
] = 0x00000F40;
3067 env
->excp_vectors
[POWERPC_EXCP_IABR
] = 0x00001300;
3068 env
->excp_vectors
[POWERPC_EXCP_MAINT
] = 0x00001600;
3069 env
->excp_vectors
[POWERPC_EXCP_VPUA
] = 0x00001700;
3070 env
->excp_vectors
[POWERPC_EXCP_THERM
] = 0x00001800;
3071 /* Hardware reset vector */
3072 env
->hreset_vector
= 0x0000000000000100ULL
;
3077 /*****************************************************************************/
3078 /* Power management enable checks */
3079 static int check_pow_none (CPUPPCState
*env
)
3084 static int check_pow_nocheck (CPUPPCState
*env
)
3089 static int check_pow_hid0 (CPUPPCState
*env
)
3091 if (env
->spr
[SPR_HID0
] & 0x00E00000)
3097 static int check_pow_hid0_74xx (CPUPPCState
*env
)
3099 if (env
->spr
[SPR_HID0
] & 0x00600000)
3105 /*****************************************************************************/
3106 /* PowerPC implementations definitions */
3108 #define POWERPC_FAMILY(_name) \
3110 glue(glue(ppc_, _name), _cpu_family_class_init)(ObjectClass *, void *); \
3112 static const TypeInfo \
3113 glue(glue(ppc_, _name), _cpu_family_type_info) = { \
3114 .name = stringify(_name) "-family-" TYPE_POWERPC_CPU, \
3115 .parent = TYPE_POWERPC_CPU, \
3117 .class_init = glue(glue(ppc_, _name), _cpu_family_class_init), \
3120 static void glue(glue(ppc_, _name), _cpu_family_register_types)(void) \
3122 type_register_static( \
3123 &glue(glue(ppc_, _name), _cpu_family_type_info)); \
3126 type_init(glue(glue(ppc_, _name), _cpu_family_register_types)) \
3128 static void glue(glue(ppc_, _name), _cpu_family_class_init)
3130 static void init_proc_401 (CPUPPCState
*env
)
3133 gen_spr_401_403(env
);
3135 init_excp_4xx_real(env
);
3136 env
->dcache_line_size
= 32;
3137 env
->icache_line_size
= 32;
3138 /* Allocate hardware IRQ controller */
3139 ppc40x_irq_init(env
);
3141 SET_FIT_PERIOD(12, 16, 20, 24);
3142 SET_WDT_PERIOD(16, 20, 24, 28);
3145 POWERPC_FAMILY(401)(ObjectClass
*oc
, void *data
)
3147 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3148 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3150 dc
->desc
= "PowerPC 401";
3151 pcc
->init_proc
= init_proc_401
;
3152 pcc
->check_pow
= check_pow_nocheck
;
3153 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3154 PPC_WRTEE
| PPC_DCR
|
3155 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3157 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3158 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3159 pcc
->msr_mask
= (1ull << MSR_KEY
) |
3168 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3169 pcc
->excp_model
= POWERPC_EXCP_40x
;
3170 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3171 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3172 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3173 POWERPC_FLAG_BUS_CLK
;
3176 static void init_proc_401x2 (CPUPPCState
*env
)
3179 gen_spr_401_403(env
);
3181 gen_spr_compress(env
);
3182 /* Memory management */
3183 #if !defined(CONFIG_USER_ONLY)
3187 env
->tlb_type
= TLB_EMB
;
3189 init_excp_4xx_softmmu(env
);
3190 env
->dcache_line_size
= 32;
3191 env
->icache_line_size
= 32;
3192 /* Allocate hardware IRQ controller */
3193 ppc40x_irq_init(env
);
3195 SET_FIT_PERIOD(12, 16, 20, 24);
3196 SET_WDT_PERIOD(16, 20, 24, 28);
3199 POWERPC_FAMILY(401x2
)(ObjectClass
*oc
, void *data
)
3201 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3202 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3204 dc
->desc
= "PowerPC 401x2";
3205 pcc
->init_proc
= init_proc_401x2
;
3206 pcc
->check_pow
= check_pow_nocheck
;
3207 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3208 PPC_DCR
| PPC_WRTEE
|
3209 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3210 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3211 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3212 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3213 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3214 pcc
->msr_mask
= (1ull << 20) |
3226 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3227 pcc
->excp_model
= POWERPC_EXCP_40x
;
3228 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3229 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3230 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3231 POWERPC_FLAG_BUS_CLK
;
3234 static void init_proc_401x3 (CPUPPCState
*env
)
3237 gen_spr_401_403(env
);
3240 gen_spr_compress(env
);
3241 init_excp_4xx_softmmu(env
);
3242 env
->dcache_line_size
= 32;
3243 env
->icache_line_size
= 32;
3244 /* Allocate hardware IRQ controller */
3245 ppc40x_irq_init(env
);
3247 SET_FIT_PERIOD(12, 16, 20, 24);
3248 SET_WDT_PERIOD(16, 20, 24, 28);
3251 POWERPC_FAMILY(401x3
)(ObjectClass
*oc
, void *data
)
3253 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3254 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3256 dc
->desc
= "PowerPC 401x3";
3257 pcc
->init_proc
= init_proc_401x3
;
3258 pcc
->check_pow
= check_pow_nocheck
;
3259 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3260 PPC_DCR
| PPC_WRTEE
|
3261 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3262 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3263 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3264 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3265 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3266 pcc
->msr_mask
= (1ull << 20) |
3279 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3280 pcc
->excp_model
= POWERPC_EXCP_40x
;
3281 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3282 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3283 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3284 POWERPC_FLAG_BUS_CLK
;
3287 static void init_proc_IOP480 (CPUPPCState
*env
)
3290 gen_spr_401_403(env
);
3292 gen_spr_compress(env
);
3293 /* Memory management */
3294 #if !defined(CONFIG_USER_ONLY)
3298 env
->tlb_type
= TLB_EMB
;
3300 init_excp_4xx_softmmu(env
);
3301 env
->dcache_line_size
= 32;
3302 env
->icache_line_size
= 32;
3303 /* Allocate hardware IRQ controller */
3304 ppc40x_irq_init(env
);
3306 SET_FIT_PERIOD(8, 12, 16, 20);
3307 SET_WDT_PERIOD(16, 20, 24, 28);
3310 POWERPC_FAMILY(IOP480
)(ObjectClass
*oc
, void *data
)
3312 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3313 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3315 dc
->desc
= "IOP480";
3316 pcc
->init_proc
= init_proc_IOP480
;
3317 pcc
->check_pow
= check_pow_nocheck
;
3318 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3319 PPC_DCR
| PPC_WRTEE
|
3320 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3321 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3322 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3323 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3324 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3325 pcc
->msr_mask
= (1ull << 20) |
3337 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3338 pcc
->excp_model
= POWERPC_EXCP_40x
;
3339 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3340 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3341 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
3342 POWERPC_FLAG_BUS_CLK
;
3345 static void init_proc_403 (CPUPPCState
*env
)
3348 gen_spr_401_403(env
);
3350 gen_spr_403_real(env
);
3351 init_excp_4xx_real(env
);
3352 env
->dcache_line_size
= 32;
3353 env
->icache_line_size
= 32;
3354 /* Allocate hardware IRQ controller */
3355 ppc40x_irq_init(env
);
3357 SET_FIT_PERIOD(8, 12, 16, 20);
3358 SET_WDT_PERIOD(16, 20, 24, 28);
3361 POWERPC_FAMILY(403)(ObjectClass
*oc
, void *data
)
3363 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3364 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3366 dc
->desc
= "PowerPC 403";
3367 pcc
->init_proc
= init_proc_403
;
3368 pcc
->check_pow
= check_pow_nocheck
;
3369 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3370 PPC_DCR
| PPC_WRTEE
|
3371 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3373 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3374 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3375 pcc
->msr_mask
= (1ull << MSR_POW
) |
3384 pcc
->mmu_model
= POWERPC_MMU_REAL
;
3385 pcc
->excp_model
= POWERPC_EXCP_40x
;
3386 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3387 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3388 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3389 POWERPC_FLAG_BUS_CLK
;
3392 static void init_proc_403GCX (CPUPPCState
*env
)
3395 gen_spr_401_403(env
);
3397 gen_spr_403_real(env
);
3398 gen_spr_403_mmu(env
);
3399 /* Bus access control */
3400 /* not emulated, as QEMU never does speculative access */
3401 spr_register(env
, SPR_40x_SGR
, "SGR",
3402 SPR_NOACCESS
, SPR_NOACCESS
,
3403 &spr_read_generic
, &spr_write_generic
,
3405 /* not emulated, as QEMU do not emulate caches */
3406 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3407 SPR_NOACCESS
, SPR_NOACCESS
,
3408 &spr_read_generic
, &spr_write_generic
,
3410 /* Memory management */
3411 #if !defined(CONFIG_USER_ONLY)
3415 env
->tlb_type
= TLB_EMB
;
3417 init_excp_4xx_softmmu(env
);
3418 env
->dcache_line_size
= 32;
3419 env
->icache_line_size
= 32;
3420 /* Allocate hardware IRQ controller */
3421 ppc40x_irq_init(env
);
3423 SET_FIT_PERIOD(8, 12, 16, 20);
3424 SET_WDT_PERIOD(16, 20, 24, 28);
3427 POWERPC_FAMILY(403GCX
)(ObjectClass
*oc
, void *data
)
3429 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3430 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3432 dc
->desc
= "PowerPC 403 GCX";
3433 pcc
->init_proc
= init_proc_403GCX
;
3434 pcc
->check_pow
= check_pow_nocheck
;
3435 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3436 PPC_DCR
| PPC_WRTEE
|
3437 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3439 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3440 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3441 PPC_4xx_COMMON
| PPC_40x_EXCP
;
3442 pcc
->msr_mask
= (1ull << MSR_POW
) |
3451 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx_Z
;
3452 pcc
->excp_model
= POWERPC_EXCP_40x
;
3453 pcc
->bus_model
= PPC_FLAGS_INPUT_401
;
3454 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3455 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_PX
|
3456 POWERPC_FLAG_BUS_CLK
;
3459 static void init_proc_405 (CPUPPCState
*env
)
3465 /* Bus access control */
3466 /* not emulated, as QEMU never does speculative access */
3467 spr_register(env
, SPR_40x_SGR
, "SGR",
3468 SPR_NOACCESS
, SPR_NOACCESS
,
3469 &spr_read_generic
, &spr_write_generic
,
3471 /* not emulated, as QEMU do not emulate caches */
3472 spr_register(env
, SPR_40x_DCWR
, "DCWR",
3473 SPR_NOACCESS
, SPR_NOACCESS
,
3474 &spr_read_generic
, &spr_write_generic
,
3476 /* Memory management */
3477 #if !defined(CONFIG_USER_ONLY)
3481 env
->tlb_type
= TLB_EMB
;
3483 init_excp_4xx_softmmu(env
);
3484 env
->dcache_line_size
= 32;
3485 env
->icache_line_size
= 32;
3486 /* Allocate hardware IRQ controller */
3487 ppc40x_irq_init(env
);
3489 SET_FIT_PERIOD(8, 12, 16, 20);
3490 SET_WDT_PERIOD(16, 20, 24, 28);
3493 POWERPC_FAMILY(405)(ObjectClass
*oc
, void *data
)
3495 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3496 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3498 dc
->desc
= "PowerPC 405";
3499 pcc
->init_proc
= init_proc_405
;
3500 pcc
->check_pow
= check_pow_nocheck
;
3501 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
3502 PPC_DCR
| PPC_WRTEE
|
3503 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_40x_ICBT
|
3504 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3505 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
3506 PPC_40x_TLB
| PPC_MEM_TLBIA
| PPC_MEM_TLBSYNC
|
3507 PPC_4xx_COMMON
| PPC_405_MAC
| PPC_40x_EXCP
;
3508 pcc
->msr_mask
= (1ull << MSR_POW
) |
3517 pcc
->mmu_model
= POWERPC_MMU_SOFT_4xx
;
3518 pcc
->excp_model
= POWERPC_EXCP_40x
;
3519 pcc
->bus_model
= PPC_FLAGS_INPUT_405
;
3520 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3521 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3522 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3525 static void init_proc_440EP (CPUPPCState
*env
)
3529 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3531 gen_spr_usprgh(env
);
3532 /* Processor identification */
3533 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3534 SPR_NOACCESS
, SPR_NOACCESS
,
3535 &spr_read_generic
, &spr_write_pir
,
3537 /* XXX : not implemented */
3538 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3539 SPR_NOACCESS
, SPR_NOACCESS
,
3540 &spr_read_generic
, &spr_write_generic
,
3542 /* XXX : not implemented */
3543 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3544 SPR_NOACCESS
, SPR_NOACCESS
,
3545 &spr_read_generic
, &spr_write_generic
,
3547 /* XXX : not implemented */
3548 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3549 SPR_NOACCESS
, SPR_NOACCESS
,
3550 &spr_read_generic
, &spr_write_generic
,
3552 /* XXX : not implemented */
3553 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3554 SPR_NOACCESS
, SPR_NOACCESS
,
3555 &spr_read_generic
, &spr_write_generic
,
3557 /* XXX : not implemented */
3558 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3559 SPR_NOACCESS
, SPR_NOACCESS
,
3560 &spr_read_generic
, &spr_write_generic
,
3562 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3563 SPR_NOACCESS
, SPR_NOACCESS
,
3564 &spr_read_generic
, &spr_write_generic
,
3566 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3567 SPR_NOACCESS
, SPR_NOACCESS
,
3568 &spr_read_generic
, &spr_write_generic
,
3570 /* XXX : not implemented */
3571 spr_register(env
, SPR_440_CCR1
, "CCR1",
3572 SPR_NOACCESS
, SPR_NOACCESS
,
3573 &spr_read_generic
, &spr_write_generic
,
3575 /* Memory management */
3576 #if !defined(CONFIG_USER_ONLY)
3580 env
->tlb_type
= TLB_EMB
;
3582 init_excp_BookE(env
);
3583 env
->dcache_line_size
= 32;
3584 env
->icache_line_size
= 32;
3585 ppc40x_irq_init(env
);
3587 SET_FIT_PERIOD(12, 16, 20, 24);
3588 SET_WDT_PERIOD(20, 24, 28, 32);
3591 POWERPC_FAMILY(440EP
)(ObjectClass
*oc
, void *data
)
3593 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3594 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3596 dc
->desc
= "PowerPC 440 EP";
3597 pcc
->init_proc
= init_proc_440EP
;
3598 pcc
->check_pow
= check_pow_nocheck
;
3599 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3600 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
3601 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
3603 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
3604 PPC_CACHE
| PPC_CACHE_ICBI
|
3605 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3606 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3607 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3609 pcc
->msr_mask
= (1ull << MSR_POW
) |
3621 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3622 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3623 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3624 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3625 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3626 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3629 static void init_proc_440GP (CPUPPCState
*env
)
3633 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3635 gen_spr_usprgh(env
);
3636 /* Processor identification */
3637 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3638 SPR_NOACCESS
, SPR_NOACCESS
,
3639 &spr_read_generic
, &spr_write_pir
,
3641 /* XXX : not implemented */
3642 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3643 SPR_NOACCESS
, SPR_NOACCESS
,
3644 &spr_read_generic
, &spr_write_generic
,
3646 /* XXX : not implemented */
3647 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3648 SPR_NOACCESS
, SPR_NOACCESS
,
3649 &spr_read_generic
, &spr_write_generic
,
3651 /* XXX : not implemented */
3652 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3653 SPR_NOACCESS
, SPR_NOACCESS
,
3654 &spr_read_generic
, &spr_write_generic
,
3656 /* XXX : not implemented */
3657 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3658 SPR_NOACCESS
, SPR_NOACCESS
,
3659 &spr_read_generic
, &spr_write_generic
,
3661 /* Memory management */
3662 #if !defined(CONFIG_USER_ONLY)
3666 env
->tlb_type
= TLB_EMB
;
3668 init_excp_BookE(env
);
3669 env
->dcache_line_size
= 32;
3670 env
->icache_line_size
= 32;
3671 /* XXX: TODO: allocate internal IRQ controller */
3673 SET_FIT_PERIOD(12, 16, 20, 24);
3674 SET_WDT_PERIOD(20, 24, 28, 32);
3677 POWERPC_FAMILY(440GP
)(ObjectClass
*oc
, void *data
)
3679 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3680 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3682 dc
->desc
= "PowerPC 440 GP";
3683 pcc
->init_proc
= init_proc_440GP
;
3684 pcc
->check_pow
= check_pow_nocheck
;
3685 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3686 PPC_DCR
| PPC_DCRX
| PPC_WRTEE
| PPC_MFAPIDI
|
3687 PPC_CACHE
| PPC_CACHE_ICBI
|
3688 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3689 PPC_MEM_TLBSYNC
| PPC_TLBIVA
| PPC_MFTB
|
3690 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3692 pcc
->msr_mask
= (1ull << MSR_POW
) |
3704 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3705 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3706 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3707 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3708 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3709 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3712 static void init_proc_440x4 (CPUPPCState
*env
)
3716 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3718 gen_spr_usprgh(env
);
3719 /* Processor identification */
3720 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3721 SPR_NOACCESS
, SPR_NOACCESS
,
3722 &spr_read_generic
, &spr_write_pir
,
3724 /* XXX : not implemented */
3725 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3726 SPR_NOACCESS
, SPR_NOACCESS
,
3727 &spr_read_generic
, &spr_write_generic
,
3729 /* XXX : not implemented */
3730 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3731 SPR_NOACCESS
, SPR_NOACCESS
,
3732 &spr_read_generic
, &spr_write_generic
,
3734 /* XXX : not implemented */
3735 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3736 SPR_NOACCESS
, SPR_NOACCESS
,
3737 &spr_read_generic
, &spr_write_generic
,
3739 /* XXX : not implemented */
3740 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3741 SPR_NOACCESS
, SPR_NOACCESS
,
3742 &spr_read_generic
, &spr_write_generic
,
3744 /* Memory management */
3745 #if !defined(CONFIG_USER_ONLY)
3749 env
->tlb_type
= TLB_EMB
;
3751 init_excp_BookE(env
);
3752 env
->dcache_line_size
= 32;
3753 env
->icache_line_size
= 32;
3754 /* XXX: TODO: allocate internal IRQ controller */
3756 SET_FIT_PERIOD(12, 16, 20, 24);
3757 SET_WDT_PERIOD(20, 24, 28, 32);
3760 POWERPC_FAMILY(440x4
)(ObjectClass
*oc
, void *data
)
3762 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3763 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3765 dc
->desc
= "PowerPC 440x4";
3766 pcc
->init_proc
= init_proc_440x4
;
3767 pcc
->check_pow
= check_pow_nocheck
;
3768 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3769 PPC_DCR
| PPC_WRTEE
|
3770 PPC_CACHE
| PPC_CACHE_ICBI
|
3771 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3772 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3773 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3775 pcc
->msr_mask
= (1ull << MSR_POW
) |
3787 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3788 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3789 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3790 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3791 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3792 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3795 static void init_proc_440x5 (CPUPPCState
*env
)
3799 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3801 gen_spr_usprgh(env
);
3802 /* Processor identification */
3803 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3804 SPR_NOACCESS
, SPR_NOACCESS
,
3805 &spr_read_generic
, &spr_write_pir
,
3807 /* XXX : not implemented */
3808 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3809 SPR_NOACCESS
, SPR_NOACCESS
,
3810 &spr_read_generic
, &spr_write_generic
,
3812 /* XXX : not implemented */
3813 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3814 SPR_NOACCESS
, SPR_NOACCESS
,
3815 &spr_read_generic
, &spr_write_generic
,
3817 /* XXX : not implemented */
3818 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3819 SPR_NOACCESS
, SPR_NOACCESS
,
3820 &spr_read_generic
, &spr_write_generic
,
3822 /* XXX : not implemented */
3823 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3824 SPR_NOACCESS
, SPR_NOACCESS
,
3825 &spr_read_generic
, &spr_write_generic
,
3827 /* XXX : not implemented */
3828 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3829 SPR_NOACCESS
, SPR_NOACCESS
,
3830 &spr_read_generic
, &spr_write_generic
,
3832 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3833 SPR_NOACCESS
, SPR_NOACCESS
,
3834 &spr_read_generic
, &spr_write_generic
,
3836 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3837 SPR_NOACCESS
, SPR_NOACCESS
,
3838 &spr_read_generic
, &spr_write_generic
,
3840 /* XXX : not implemented */
3841 spr_register(env
, SPR_440_CCR1
, "CCR1",
3842 SPR_NOACCESS
, SPR_NOACCESS
,
3843 &spr_read_generic
, &spr_write_generic
,
3845 /* Memory management */
3846 #if !defined(CONFIG_USER_ONLY)
3850 env
->tlb_type
= TLB_EMB
;
3852 init_excp_BookE(env
);
3853 env
->dcache_line_size
= 32;
3854 env
->icache_line_size
= 32;
3855 ppc40x_irq_init(env
);
3857 SET_FIT_PERIOD(12, 16, 20, 24);
3858 SET_WDT_PERIOD(20, 24, 28, 32);
3861 POWERPC_FAMILY(440x5
)(ObjectClass
*oc
, void *data
)
3863 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3864 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3866 dc
->desc
= "PowerPC 440x5";
3867 pcc
->init_proc
= init_proc_440x5
;
3868 pcc
->check_pow
= check_pow_nocheck
;
3869 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3870 PPC_DCR
| PPC_WRTEE
| PPC_RFMCI
|
3871 PPC_CACHE
| PPC_CACHE_ICBI
|
3872 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3873 PPC_MEM_TLBSYNC
| PPC_MFTB
|
3874 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3876 pcc
->msr_mask
= (1ull << MSR_POW
) |
3888 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3889 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3890 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3891 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3892 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
3893 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
3896 static void init_proc_460 (CPUPPCState
*env
)
3900 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
3902 gen_spr_usprgh(env
);
3903 /* Processor identification */
3904 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
3905 SPR_NOACCESS
, SPR_NOACCESS
,
3906 &spr_read_generic
, &spr_write_pir
,
3908 /* XXX : not implemented */
3909 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
3910 SPR_NOACCESS
, SPR_NOACCESS
,
3911 &spr_read_generic
, &spr_write_generic
,
3913 /* XXX : not implemented */
3914 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
3915 SPR_NOACCESS
, SPR_NOACCESS
,
3916 &spr_read_generic
, &spr_write_generic
,
3918 /* XXX : not implemented */
3919 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
3920 SPR_NOACCESS
, SPR_NOACCESS
,
3921 &spr_read_generic
, &spr_write_generic
,
3923 /* XXX : not implemented */
3924 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
3925 SPR_NOACCESS
, SPR_NOACCESS
,
3926 &spr_read_generic
, &spr_write_generic
,
3928 /* XXX : not implemented */
3929 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
3930 SPR_NOACCESS
, SPR_NOACCESS
,
3931 &spr_read_generic
, &spr_write_generic
,
3933 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
3934 SPR_NOACCESS
, SPR_NOACCESS
,
3935 &spr_read_generic
, &spr_write_generic
,
3937 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
3938 SPR_NOACCESS
, SPR_NOACCESS
,
3939 &spr_read_generic
, &spr_write_generic
,
3941 /* XXX : not implemented */
3942 spr_register(env
, SPR_440_CCR1
, "CCR1",
3943 SPR_NOACCESS
, SPR_NOACCESS
,
3944 &spr_read_generic
, &spr_write_generic
,
3946 /* XXX : not implemented */
3947 spr_register(env
, SPR_DCRIPR
, "SPR_DCRIPR",
3948 &spr_read_generic
, &spr_write_generic
,
3949 &spr_read_generic
, &spr_write_generic
,
3951 /* Memory management */
3952 #if !defined(CONFIG_USER_ONLY)
3956 env
->tlb_type
= TLB_EMB
;
3958 init_excp_BookE(env
);
3959 env
->dcache_line_size
= 32;
3960 env
->icache_line_size
= 32;
3961 /* XXX: TODO: allocate internal IRQ controller */
3963 SET_FIT_PERIOD(12, 16, 20, 24);
3964 SET_WDT_PERIOD(20, 24, 28, 32);
3967 POWERPC_FAMILY(460)(ObjectClass
*oc
, void *data
)
3969 DeviceClass
*dc
= DEVICE_CLASS(oc
);
3970 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
3972 dc
->desc
= "PowerPC 460 (guessed)";
3973 pcc
->init_proc
= init_proc_460
;
3974 pcc
->check_pow
= check_pow_nocheck
;
3975 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
3976 PPC_DCR
| PPC_DCRX
| PPC_DCRUX
|
3977 PPC_WRTEE
| PPC_MFAPIDI
| PPC_MFTB
|
3978 PPC_CACHE
| PPC_CACHE_ICBI
|
3979 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
3980 PPC_MEM_TLBSYNC
| PPC_TLBIVA
|
3981 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
3983 pcc
->msr_mask
= (1ull << MSR_POW
) |
3995 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
3996 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
3997 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
3998 pcc
->bfd_mach
= bfd_mach_ppc_403
;
3999 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4000 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4003 static void init_proc_460F (CPUPPCState
*env
)
4007 gen_spr_BookE(env
, 0x000000000000FFFFULL
);
4009 gen_spr_usprgh(env
);
4010 /* Processor identification */
4011 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4012 SPR_NOACCESS
, SPR_NOACCESS
,
4013 &spr_read_generic
, &spr_write_pir
,
4015 /* XXX : not implemented */
4016 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4017 SPR_NOACCESS
, SPR_NOACCESS
,
4018 &spr_read_generic
, &spr_write_generic
,
4020 /* XXX : not implemented */
4021 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4022 SPR_NOACCESS
, SPR_NOACCESS
,
4023 &spr_read_generic
, &spr_write_generic
,
4025 /* XXX : not implemented */
4026 spr_register(env
, SPR_BOOKE_DVC1
, "DVC1",
4027 SPR_NOACCESS
, SPR_NOACCESS
,
4028 &spr_read_generic
, &spr_write_generic
,
4030 /* XXX : not implemented */
4031 spr_register(env
, SPR_BOOKE_DVC2
, "DVC2",
4032 SPR_NOACCESS
, SPR_NOACCESS
,
4033 &spr_read_generic
, &spr_write_generic
,
4035 /* XXX : not implemented */
4036 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4037 SPR_NOACCESS
, SPR_NOACCESS
,
4038 &spr_read_generic
, &spr_write_generic
,
4040 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4041 SPR_NOACCESS
, SPR_NOACCESS
,
4042 &spr_read_generic
, &spr_write_generic
,
4044 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4045 SPR_NOACCESS
, SPR_NOACCESS
,
4046 &spr_read_generic
, &spr_write_generic
,
4048 /* XXX : not implemented */
4049 spr_register(env
, SPR_440_CCR1
, "CCR1",
4050 SPR_NOACCESS
, SPR_NOACCESS
,
4051 &spr_read_generic
, &spr_write_generic
,
4053 /* XXX : not implemented */
4054 spr_register(env
, SPR_DCRIPR
, "SPR_DCRIPR",
4055 &spr_read_generic
, &spr_write_generic
,
4056 &spr_read_generic
, &spr_write_generic
,
4058 /* Memory management */
4059 #if !defined(CONFIG_USER_ONLY)
4063 env
->tlb_type
= TLB_EMB
;
4065 init_excp_BookE(env
);
4066 env
->dcache_line_size
= 32;
4067 env
->icache_line_size
= 32;
4068 /* XXX: TODO: allocate internal IRQ controller */
4070 SET_FIT_PERIOD(12, 16, 20, 24);
4071 SET_WDT_PERIOD(20, 24, 28, 32);
4074 POWERPC_FAMILY(460F
)(ObjectClass
*oc
, void *data
)
4076 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4077 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4079 dc
->desc
= "PowerPC 460F (guessed)";
4080 pcc
->init_proc
= init_proc_460F
;
4081 pcc
->check_pow
= check_pow_nocheck
;
4082 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4083 PPC_FLOAT
| PPC_FLOAT_FRES
| PPC_FLOAT_FSEL
|
4084 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
4085 PPC_FLOAT_STFIWX
| PPC_MFTB
|
4086 PPC_DCR
| PPC_DCRX
| PPC_DCRUX
|
4087 PPC_WRTEE
| PPC_MFAPIDI
|
4088 PPC_CACHE
| PPC_CACHE_ICBI
|
4089 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4090 PPC_MEM_TLBSYNC
| PPC_TLBIVA
|
4091 PPC_BOOKE
| PPC_4xx_COMMON
| PPC_405_MAC
|
4093 pcc
->msr_mask
= (1ull << MSR_POW
) |
4105 pcc
->mmu_model
= POWERPC_MMU_BOOKE
;
4106 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4107 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4108 pcc
->bfd_mach
= bfd_mach_ppc_403
;
4109 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DWE
|
4110 POWERPC_FLAG_DE
| POWERPC_FLAG_BUS_CLK
;
4113 static void init_proc_MPC5xx (CPUPPCState
*env
)
4117 gen_spr_5xx_8xx(env
);
4119 init_excp_MPC5xx(env
);
4120 env
->dcache_line_size
= 32;
4121 env
->icache_line_size
= 32;
4122 /* XXX: TODO: allocate internal IRQ controller */
4125 POWERPC_FAMILY(MPC5xx
)(ObjectClass
*oc
, void *data
)
4127 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4128 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4130 dc
->desc
= "Freescale 5xx cores (aka RCPU)";
4131 pcc
->init_proc
= init_proc_MPC5xx
;
4132 pcc
->check_pow
= check_pow_none
;
4133 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4134 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4135 PPC_CACHE_ICBI
| PPC_FLOAT
| PPC_FLOAT_STFIWX
|
4137 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4149 pcc
->mmu_model
= POWERPC_MMU_REAL
;
4150 pcc
->excp_model
= POWERPC_EXCP_603
;
4151 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4152 pcc
->bfd_mach
= bfd_mach_ppc_505
;
4153 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4154 POWERPC_FLAG_BUS_CLK
;
4157 static void init_proc_MPC8xx (CPUPPCState
*env
)
4161 gen_spr_5xx_8xx(env
);
4163 init_excp_MPC8xx(env
);
4164 env
->dcache_line_size
= 32;
4165 env
->icache_line_size
= 32;
4166 /* XXX: TODO: allocate internal IRQ controller */
4169 POWERPC_FAMILY(MPC8xx
)(ObjectClass
*oc
, void *data
)
4171 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4172 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4174 dc
->desc
= "Freescale 8xx cores (aka PowerQUICC)";
4175 pcc
->init_proc
= init_proc_MPC8xx
;
4176 pcc
->check_pow
= check_pow_none
;
4177 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
|
4178 PPC_MEM_EIEIO
| PPC_MEM_SYNC
|
4179 PPC_CACHE_ICBI
| PPC_MFTB
;
4180 pcc
->msr_mask
= (1ull << MSR_ILE
) |
4192 pcc
->mmu_model
= POWERPC_MMU_MPC8xx
;
4193 pcc
->excp_model
= POWERPC_EXCP_603
;
4194 pcc
->bus_model
= PPC_FLAGS_INPUT_RCPU
;
4195 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4196 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
4197 POWERPC_FLAG_BUS_CLK
;
4200 /* Freescale 82xx cores (aka PowerQUICC-II) */
4202 static void init_proc_G2 (CPUPPCState
*env
)
4204 gen_spr_ne_601(env
);
4205 gen_spr_G2_755(env
);
4209 /* External access control */
4210 /* XXX : not implemented */
4211 spr_register(env
, SPR_EAR
, "EAR",
4212 SPR_NOACCESS
, SPR_NOACCESS
,
4213 &spr_read_generic
, &spr_write_generic
,
4215 /* Hardware implementation register */
4216 /* XXX : not implemented */
4217 spr_register(env
, SPR_HID0
, "HID0",
4218 SPR_NOACCESS
, SPR_NOACCESS
,
4219 &spr_read_generic
, &spr_write_generic
,
4221 /* XXX : not implemented */
4222 spr_register(env
, SPR_HID1
, "HID1",
4223 SPR_NOACCESS
, SPR_NOACCESS
,
4224 &spr_read_generic
, &spr_write_generic
,
4226 /* XXX : not implemented */
4227 spr_register(env
, SPR_HID2
, "HID2",
4228 SPR_NOACCESS
, SPR_NOACCESS
,
4229 &spr_read_generic
, &spr_write_generic
,
4231 /* Memory management */
4234 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4236 env
->dcache_line_size
= 32;
4237 env
->icache_line_size
= 32;
4238 /* Allocate hardware IRQ controller */
4239 ppc6xx_irq_init(env
);
4242 POWERPC_FAMILY(G2
)(ObjectClass
*oc
, void *data
)
4244 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4245 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4247 dc
->desc
= "PowerPC G2";
4248 pcc
->init_proc
= init_proc_G2
;
4249 pcc
->check_pow
= check_pow_hid0
;
4250 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4251 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4253 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4254 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4255 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4256 PPC_SEGMENT
| PPC_EXTERN
;
4257 pcc
->msr_mask
= (1ull << MSR_POW
) |
4258 (1ull << MSR_TGPR
) |
4272 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4273 pcc
->excp_model
= POWERPC_EXCP_G2
;
4274 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4275 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4276 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4277 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4280 static void init_proc_G2LE (CPUPPCState
*env
)
4282 gen_spr_ne_601(env
);
4283 gen_spr_G2_755(env
);
4287 /* External access control */
4288 /* XXX : not implemented */
4289 spr_register(env
, SPR_EAR
, "EAR",
4290 SPR_NOACCESS
, SPR_NOACCESS
,
4291 &spr_read_generic
, &spr_write_generic
,
4293 /* Hardware implementation register */
4294 /* XXX : not implemented */
4295 spr_register(env
, SPR_HID0
, "HID0",
4296 SPR_NOACCESS
, SPR_NOACCESS
,
4297 &spr_read_generic
, &spr_write_generic
,
4299 /* XXX : not implemented */
4300 spr_register(env
, SPR_HID1
, "HID1",
4301 SPR_NOACCESS
, SPR_NOACCESS
,
4302 &spr_read_generic
, &spr_write_generic
,
4304 /* XXX : not implemented */
4305 spr_register(env
, SPR_HID2
, "HID2",
4306 SPR_NOACCESS
, SPR_NOACCESS
,
4307 &spr_read_generic
, &spr_write_generic
,
4310 /* XXX : not implemented */
4311 spr_register(env
, SPR_DABR
, "DABR",
4312 SPR_NOACCESS
, SPR_NOACCESS
,
4313 &spr_read_generic
, &spr_write_generic
,
4315 /* XXX : not implemented */
4316 spr_register(env
, SPR_DABR2
, "DABR2",
4317 SPR_NOACCESS
, SPR_NOACCESS
,
4318 &spr_read_generic
, &spr_write_generic
,
4320 /* XXX : not implemented */
4321 spr_register(env
, SPR_IABR2
, "IABR2",
4322 SPR_NOACCESS
, SPR_NOACCESS
,
4323 &spr_read_generic
, &spr_write_generic
,
4325 /* XXX : not implemented */
4326 spr_register(env
, SPR_IBCR
, "IBCR",
4327 SPR_NOACCESS
, SPR_NOACCESS
,
4328 &spr_read_generic
, &spr_write_generic
,
4330 /* XXX : not implemented */
4331 spr_register(env
, SPR_DBCR
, "DBCR",
4332 SPR_NOACCESS
, SPR_NOACCESS
,
4333 &spr_read_generic
, &spr_write_generic
,
4336 /* Memory management */
4339 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4341 env
->dcache_line_size
= 32;
4342 env
->icache_line_size
= 32;
4343 /* Allocate hardware IRQ controller */
4344 ppc6xx_irq_init(env
);
4347 POWERPC_FAMILY(G2LE
)(ObjectClass
*oc
, void *data
)
4349 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4350 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4352 dc
->desc
= "PowerPC G2LE";
4353 pcc
->init_proc
= init_proc_G2LE
;
4354 pcc
->check_pow
= check_pow_hid0
;
4355 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4356 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4358 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4359 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4360 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4361 PPC_SEGMENT
| PPC_EXTERN
;
4362 pcc
->msr_mask
= (1ull << MSR_POW
) |
4363 (1ull << MSR_TGPR
) |
4379 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4380 pcc
->excp_model
= POWERPC_EXCP_G2
;
4381 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4382 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
4383 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4384 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4387 static void init_proc_e200 (CPUPPCState
*env
)
4391 gen_spr_BookE(env
, 0x000000070000FFFFULL
);
4392 /* XXX : not implemented */
4393 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4394 &spr_read_spefscr
, &spr_write_spefscr
,
4395 &spr_read_spefscr
, &spr_write_spefscr
,
4397 /* Memory management */
4398 gen_spr_BookE206(env
, 0x0000005D, NULL
);
4399 /* XXX : not implemented */
4400 spr_register(env
, SPR_HID0
, "HID0",
4401 SPR_NOACCESS
, SPR_NOACCESS
,
4402 &spr_read_generic
, &spr_write_generic
,
4404 /* XXX : not implemented */
4405 spr_register(env
, SPR_HID1
, "HID1",
4406 SPR_NOACCESS
, SPR_NOACCESS
,
4407 &spr_read_generic
, &spr_write_generic
,
4409 /* XXX : not implemented */
4410 spr_register(env
, SPR_Exxx_ALTCTXCR
, "ALTCTXCR",
4411 SPR_NOACCESS
, SPR_NOACCESS
,
4412 &spr_read_generic
, &spr_write_generic
,
4414 /* XXX : not implemented */
4415 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4416 SPR_NOACCESS
, SPR_NOACCESS
,
4417 &spr_read_generic
, &spr_write_generic
,
4419 /* XXX : not implemented */
4420 spr_register(env
, SPR_Exxx_CTXCR
, "CTXCR",
4421 SPR_NOACCESS
, SPR_NOACCESS
,
4422 &spr_read_generic
, &spr_write_generic
,
4424 /* XXX : not implemented */
4425 spr_register(env
, SPR_Exxx_DBCNT
, "DBCNT",
4426 SPR_NOACCESS
, SPR_NOACCESS
,
4427 &spr_read_generic
, &spr_write_generic
,
4429 /* XXX : not implemented */
4430 spr_register(env
, SPR_Exxx_DBCR3
, "DBCR3",
4431 SPR_NOACCESS
, SPR_NOACCESS
,
4432 &spr_read_generic
, &spr_write_generic
,
4434 /* XXX : not implemented */
4435 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4436 &spr_read_generic
, SPR_NOACCESS
,
4437 &spr_read_generic
, SPR_NOACCESS
,
4439 /* XXX : not implemented */
4440 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4441 SPR_NOACCESS
, SPR_NOACCESS
,
4442 &spr_read_generic
, &spr_write_generic
,
4444 /* XXX : not implemented */
4445 spr_register(env
, SPR_Exxx_L1FINV0
, "L1FINV0",
4446 SPR_NOACCESS
, SPR_NOACCESS
,
4447 &spr_read_generic
, &spr_write_generic
,
4449 /* XXX : not implemented */
4450 spr_register(env
, SPR_BOOKE_TLB0CFG
, "TLB0CFG",
4451 SPR_NOACCESS
, SPR_NOACCESS
,
4452 &spr_read_generic
, &spr_write_generic
,
4454 /* XXX : not implemented */
4455 spr_register(env
, SPR_BOOKE_TLB1CFG
, "TLB1CFG",
4456 SPR_NOACCESS
, SPR_NOACCESS
,
4457 &spr_read_generic
, &spr_write_generic
,
4459 /* XXX : not implemented */
4460 spr_register(env
, SPR_BOOKE_IAC3
, "IAC3",
4461 SPR_NOACCESS
, SPR_NOACCESS
,
4462 &spr_read_generic
, &spr_write_generic
,
4464 /* XXX : not implemented */
4465 spr_register(env
, SPR_BOOKE_IAC4
, "IAC4",
4466 SPR_NOACCESS
, SPR_NOACCESS
,
4467 &spr_read_generic
, &spr_write_generic
,
4469 /* XXX : not implemented */
4470 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4471 SPR_NOACCESS
, SPR_NOACCESS
,
4472 &spr_read_generic
, &spr_write_generic
,
4473 0x00000000); /* TOFIX */
4474 spr_register(env
, SPR_BOOKE_DSRR0
, "DSRR0",
4475 SPR_NOACCESS
, SPR_NOACCESS
,
4476 &spr_read_generic
, &spr_write_generic
,
4478 spr_register(env
, SPR_BOOKE_DSRR1
, "DSRR1",
4479 SPR_NOACCESS
, SPR_NOACCESS
,
4480 &spr_read_generic
, &spr_write_generic
,
4482 #if !defined(CONFIG_USER_ONLY)
4486 env
->tlb_type
= TLB_EMB
;
4488 init_excp_e200(env
, 0xFFFF0000UL
);
4489 env
->dcache_line_size
= 32;
4490 env
->icache_line_size
= 32;
4491 /* XXX: TODO: allocate internal IRQ controller */
4494 POWERPC_FAMILY(e200
)(ObjectClass
*oc
, void *data
)
4496 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4497 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4499 dc
->desc
= "e200 core";
4500 pcc
->init_proc
= init_proc_e200
;
4501 pcc
->check_pow
= check_pow_hid0
;
4502 /* XXX: unimplemented instructions:
4509 * all SPE multiply-accumulate instructions
4511 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4512 PPC_SPE
| PPC_SPE_SINGLE
|
4513 PPC_WRTEE
| PPC_RFDI
|
4514 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4515 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4516 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
|
4518 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4532 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4533 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4534 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4535 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4536 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4537 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4538 POWERPC_FLAG_BUS_CLK
;
4541 static void init_proc_e300 (CPUPPCState
*env
)
4543 gen_spr_ne_601(env
);
4547 /* hardware implementation registers */
4548 /* XXX : not implemented */
4549 spr_register(env
, SPR_HID0
, "HID0",
4550 SPR_NOACCESS
, SPR_NOACCESS
,
4551 &spr_read_generic
, &spr_write_generic
,
4553 /* XXX : not implemented */
4554 spr_register(env
, SPR_HID1
, "HID1",
4555 SPR_NOACCESS
, SPR_NOACCESS
,
4556 &spr_read_generic
, &spr_write_generic
,
4558 /* XXX : not implemented */
4559 spr_register(env
, SPR_HID2
, "HID2",
4560 SPR_NOACCESS
, SPR_NOACCESS
,
4561 &spr_read_generic
, &spr_write_generic
,
4563 /* Memory management */
4566 gen_6xx_7xx_soft_tlb(env
, 64, 2);
4568 env
->dcache_line_size
= 32;
4569 env
->icache_line_size
= 32;
4570 /* Allocate hardware IRQ controller */
4571 ppc6xx_irq_init(env
);
4574 POWERPC_FAMILY(e300
)(ObjectClass
*oc
, void *data
)
4576 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4577 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4579 dc
->desc
= "e300 core";
4580 pcc
->init_proc
= init_proc_e300
;
4581 pcc
->check_pow
= check_pow_hid0
;
4582 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
4583 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
4585 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
4586 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
4587 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
4588 PPC_SEGMENT
| PPC_EXTERN
;
4589 pcc
->msr_mask
= (1ull << MSR_POW
) |
4590 (1ull << MSR_TGPR
) |
4606 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
4607 pcc
->excp_model
= POWERPC_EXCP_603
;
4608 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
4609 pcc
->bfd_mach
= bfd_mach_ppc_603
;
4610 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
4611 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
4614 #if !defined(CONFIG_USER_ONLY)
4615 static void spr_write_mas73(void *opaque
, int sprn
, int gprn
)
4617 TCGv val
= tcg_temp_new();
4618 tcg_gen_ext32u_tl(val
, cpu_gpr
[gprn
]);
4619 gen_store_spr(SPR_BOOKE_MAS3
, val
);
4620 tcg_gen_shri_tl(val
, cpu_gpr
[gprn
], 32);
4621 gen_store_spr(SPR_BOOKE_MAS7
, val
);
4625 static void spr_read_mas73(void *opaque
, int gprn
, int sprn
)
4627 TCGv mas7
= tcg_temp_new();
4628 TCGv mas3
= tcg_temp_new();
4629 gen_load_spr(mas7
, SPR_BOOKE_MAS7
);
4630 tcg_gen_shli_tl(mas7
, mas7
, 32);
4631 gen_load_spr(mas3
, SPR_BOOKE_MAS3
);
4632 tcg_gen_or_tl(cpu_gpr
[gprn
], mas3
, mas7
);
4633 tcg_temp_free(mas3
);
4634 tcg_temp_free(mas7
);
4639 enum fsl_e500_version
{
4646 static void init_proc_e500 (CPUPPCState
*env
, int version
)
4648 PowerPCCPU
*cpu
= ppc_env_get_cpu(env
);
4649 uint32_t tlbncfg
[2];
4651 uint64_t ivpr_mask
= 0xFFFF0000ULL
;
4652 uint32_t l1cfg0
= 0x3800 /* 8 ways */
4653 | 0x0020; /* 32 kb */
4654 #if !defined(CONFIG_USER_ONLY)
4661 * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't
4662 * complain when accessing them.
4663 * gen_spr_BookE(env, 0x0000000F0000FD7FULL);
4669 ivor_mask
= 0x0000000F0000FFFFULL
;
4673 ivor_mask
= 0x000003FE0000FFFFULL
;
4676 gen_spr_BookE(env
, ivor_mask
);
4677 /* Processor identification */
4678 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4679 SPR_NOACCESS
, SPR_NOACCESS
,
4680 &spr_read_generic
, &spr_write_pir
,
4682 /* XXX : not implemented */
4683 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4684 &spr_read_spefscr
, &spr_write_spefscr
,
4685 &spr_read_spefscr
, &spr_write_spefscr
,
4687 #if !defined(CONFIG_USER_ONLY)
4688 /* Memory management */
4694 tlbncfg
[0] = gen_tlbncfg(2, 1, 1, 0, 256);
4695 tlbncfg
[1] = gen_tlbncfg(16, 1, 9, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4698 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4699 tlbncfg
[1] = gen_tlbncfg(16, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4703 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4704 tlbncfg
[1] = gen_tlbncfg(64, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 64);
4707 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4714 env
->dcache_line_size
= 32;
4715 env
->icache_line_size
= 32;
4719 env
->dcache_line_size
= 64;
4720 env
->icache_line_size
= 64;
4721 l1cfg0
|= 0x1000000; /* 64 byte cache block size */
4724 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4726 gen_spr_BookE206(env
, 0x000000DF, tlbncfg
);
4727 /* XXX : not implemented */
4728 spr_register(env
, SPR_HID0
, "HID0",
4729 SPR_NOACCESS
, SPR_NOACCESS
,
4730 &spr_read_generic
, &spr_write_generic
,
4732 /* XXX : not implemented */
4733 spr_register(env
, SPR_HID1
, "HID1",
4734 SPR_NOACCESS
, SPR_NOACCESS
,
4735 &spr_read_generic
, &spr_write_generic
,
4737 /* XXX : not implemented */
4738 spr_register(env
, SPR_Exxx_BBEAR
, "BBEAR",
4739 SPR_NOACCESS
, SPR_NOACCESS
,
4740 &spr_read_generic
, &spr_write_generic
,
4742 /* XXX : not implemented */
4743 spr_register(env
, SPR_Exxx_BBTAR
, "BBTAR",
4744 SPR_NOACCESS
, SPR_NOACCESS
,
4745 &spr_read_generic
, &spr_write_generic
,
4747 /* XXX : not implemented */
4748 spr_register(env
, SPR_Exxx_MCAR
, "MCAR",
4749 SPR_NOACCESS
, SPR_NOACCESS
,
4750 &spr_read_generic
, &spr_write_generic
,
4752 /* XXX : not implemented */
4753 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4754 SPR_NOACCESS
, SPR_NOACCESS
,
4755 &spr_read_generic
, &spr_write_generic
,
4757 /* XXX : not implemented */
4758 spr_register(env
, SPR_Exxx_NPIDR
, "NPIDR",
4759 SPR_NOACCESS
, SPR_NOACCESS
,
4760 &spr_read_generic
, &spr_write_generic
,
4762 /* XXX : not implemented */
4763 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4764 SPR_NOACCESS
, SPR_NOACCESS
,
4765 &spr_read_generic
, &spr_write_generic
,
4767 /* XXX : not implemented */
4768 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4769 &spr_read_generic
, SPR_NOACCESS
,
4770 &spr_read_generic
, SPR_NOACCESS
,
4772 /* XXX : not implemented */
4773 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4774 SPR_NOACCESS
, SPR_NOACCESS
,
4775 &spr_read_generic
, &spr_write_e500_l1csr0
,
4777 /* XXX : not implemented */
4778 spr_register(env
, SPR_Exxx_L1CSR1
, "L1CSR1",
4779 SPR_NOACCESS
, SPR_NOACCESS
,
4780 &spr_read_generic
, &spr_write_generic
,
4782 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4783 SPR_NOACCESS
, SPR_NOACCESS
,
4784 &spr_read_generic
, &spr_write_generic
,
4786 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4787 SPR_NOACCESS
, SPR_NOACCESS
,
4788 &spr_read_generic
, &spr_write_generic
,
4790 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4791 SPR_NOACCESS
, SPR_NOACCESS
,
4792 &spr_read_generic
, &spr_write_booke206_mmucsr0
,
4794 spr_register(env
, SPR_BOOKE_EPR
, "EPR",
4795 SPR_NOACCESS
, SPR_NOACCESS
,
4796 &spr_read_generic
, SPR_NOACCESS
,
4798 /* XXX better abstract into Emb.xxx features */
4799 if (version
== fsl_e5500
) {
4800 spr_register(env
, SPR_BOOKE_EPCR
, "EPCR",
4801 SPR_NOACCESS
, SPR_NOACCESS
,
4802 &spr_read_generic
, &spr_write_generic
,
4804 spr_register(env
, SPR_BOOKE_MAS7_MAS3
, "MAS7_MAS3",
4805 SPR_NOACCESS
, SPR_NOACCESS
,
4806 &spr_read_mas73
, &spr_write_mas73
,
4808 ivpr_mask
= (target_ulong
)~0xFFFFULL
;
4811 #if !defined(CONFIG_USER_ONLY)
4813 env
->tlb_type
= TLB_MAS
;
4814 for (i
= 0; i
< BOOKE206_MAX_TLBN
; i
++) {
4815 env
->nb_tlb
+= booke206_tlb_size(env
, i
);
4819 init_excp_e200(env
, ivpr_mask
);
4820 /* Allocate hardware IRQ controller */
4821 ppce500_irq_init(env
);
4824 static void init_proc_e500v1(CPUPPCState
*env
)
4826 init_proc_e500(env
, fsl_e500v1
);
4829 POWERPC_FAMILY(e500v1
)(ObjectClass
*oc
, void *data
)
4831 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4832 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4834 dc
->desc
= "e500v1 core";
4835 pcc
->init_proc
= init_proc_e500v1
;
4836 pcc
->check_pow
= check_pow_hid0
;
4837 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4838 PPC_SPE
| PPC_SPE_SINGLE
|
4839 PPC_WRTEE
| PPC_RFDI
|
4840 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4841 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4842 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
4843 pcc
->insns_flags2
= PPC2_BOOKE206
;
4844 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4858 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4859 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4860 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4861 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4862 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4863 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4864 POWERPC_FLAG_BUS_CLK
;
4867 static void init_proc_e500v2(CPUPPCState
*env
)
4869 init_proc_e500(env
, fsl_e500v2
);
4872 POWERPC_FAMILY(e500v2
)(ObjectClass
*oc
, void *data
)
4874 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4875 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4877 dc
->desc
= "e500v2 core";
4878 pcc
->init_proc
= init_proc_e500v2
;
4879 pcc
->check_pow
= check_pow_hid0
;
4880 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4881 PPC_SPE
| PPC_SPE_SINGLE
| PPC_SPE_DOUBLE
|
4882 PPC_WRTEE
| PPC_RFDI
|
4883 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4884 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4885 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
4886 pcc
->insns_flags2
= PPC2_BOOKE206
;
4887 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4901 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4902 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4903 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4904 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4905 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4906 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4907 POWERPC_FLAG_BUS_CLK
;
4910 static void init_proc_e500mc(CPUPPCState
*env
)
4912 init_proc_e500(env
, fsl_e500mc
);
4915 POWERPC_FAMILY(e500mc
)(ObjectClass
*oc
, void *data
)
4917 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4918 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4920 dc
->desc
= "e500mc core";
4921 pcc
->init_proc
= init_proc_e500mc
;
4922 pcc
->check_pow
= check_pow_none
;
4923 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4924 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
4925 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4926 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4927 PPC_FLOAT
| PPC_FLOAT_FRES
|
4928 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
4929 PPC_FLOAT_STFIWX
| PPC_WAIT
|
4930 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
4931 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
;
4932 pcc
->msr_mask
= (1ull << MSR_GS
) |
4933 (1ull << MSR_UCLE
) |
4946 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4947 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4948 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4949 /* FIXME: figure out the correct flag for e500mc */
4950 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
4951 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
4952 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
4956 static void init_proc_e5500(CPUPPCState
*env
)
4958 init_proc_e500(env
, fsl_e5500
);
4961 POWERPC_FAMILY(e5500
)(ObjectClass
*oc
, void *data
)
4963 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4964 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4966 dc
->desc
= "e5500 core";
4967 pcc
->init_proc
= init_proc_e5500
;
4968 pcc
->check_pow
= check_pow_none
;
4969 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4970 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
4971 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4972 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4973 PPC_FLOAT
| PPC_FLOAT_FRES
|
4974 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
4975 PPC_FLOAT_STFIWX
| PPC_WAIT
|
4976 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
4977 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
;
4978 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
;
4979 pcc
->msr_mask
= (1ull << MSR_CM
) |
4981 (1ull << MSR_UCLE
) |
4994 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4995 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4996 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4997 /* FIXME: figure out the correct flag for e5500 */
4998 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
4999 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5000 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5004 /* Non-embedded PowerPC */
5006 /* POWER : same as 601, without mfmsr, mfsr */
5007 POWERPC_FAMILY(POWER
)(ObjectClass
*oc
, void *data
)
5009 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5010 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5013 /* pcc->insns_flags = XXX_TODO; */
5014 /* POWER RSC (from RAD6000) */
5015 pcc
->msr_mask
= (1ull << MSR_EE
) |
5028 #define POWERPC_MSRR_601 (0x0000000000001040ULL)
5030 static void init_proc_601 (CPUPPCState
*env
)
5032 gen_spr_ne_601(env
);
5034 /* Hardware implementation registers */
5035 /* XXX : not implemented */
5036 spr_register(env
, SPR_HID0
, "HID0",
5037 SPR_NOACCESS
, SPR_NOACCESS
,
5038 &spr_read_generic
, &spr_write_hid0_601
,
5040 /* XXX : not implemented */
5041 spr_register(env
, SPR_HID1
, "HID1",
5042 SPR_NOACCESS
, SPR_NOACCESS
,
5043 &spr_read_generic
, &spr_write_generic
,
5045 /* XXX : not implemented */
5046 spr_register(env
, SPR_601_HID2
, "HID2",
5047 SPR_NOACCESS
, SPR_NOACCESS
,
5048 &spr_read_generic
, &spr_write_generic
,
5050 /* XXX : not implemented */
5051 spr_register(env
, SPR_601_HID5
, "HID5",
5052 SPR_NOACCESS
, SPR_NOACCESS
,
5053 &spr_read_generic
, &spr_write_generic
,
5055 /* Memory management */
5057 /* XXX: beware that dcache line size is 64
5058 * but dcbz uses 32 bytes "sectors"
5059 * XXX: this breaks clcs instruction !
5061 env
->dcache_line_size
= 32;
5062 env
->icache_line_size
= 64;
5063 /* Allocate hardware IRQ controller */
5064 ppc6xx_irq_init(env
);
5067 POWERPC_FAMILY(601)(ObjectClass
*oc
, void *data
)
5069 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5070 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5072 dc
->desc
= "PowerPC 601";
5073 pcc
->init_proc
= init_proc_601
;
5074 pcc
->check_pow
= check_pow_none
;
5075 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5077 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5078 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5079 PPC_SEGMENT
| PPC_EXTERN
;
5080 pcc
->msr_mask
= (1ull << MSR_EE
) |
5090 pcc
->mmu_model
= POWERPC_MMU_601
;
5091 #if defined(CONFIG_SOFTMMU)
5092 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5094 pcc
->excp_model
= POWERPC_EXCP_601
;
5095 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5096 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5097 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5100 #define POWERPC_MSRR_601v (0x0000000000001040ULL)
5102 static void init_proc_601v (CPUPPCState
*env
)
5105 /* XXX : not implemented */
5106 spr_register(env
, SPR_601_HID15
, "HID15",
5107 SPR_NOACCESS
, SPR_NOACCESS
,
5108 &spr_read_generic
, &spr_write_generic
,
5112 POWERPC_FAMILY(601v
)(ObjectClass
*oc
, void *data
)
5114 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5115 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5117 dc
->desc
= "PowerPC 601v";
5118 pcc
->init_proc
= init_proc_601v
;
5119 pcc
->check_pow
= check_pow_none
;
5120 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5122 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5123 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5124 PPC_SEGMENT
| PPC_EXTERN
;
5125 pcc
->msr_mask
= (1ull << MSR_EE
) |
5135 pcc
->mmu_model
= POWERPC_MMU_601
;
5136 #if defined(CONFIG_SOFTMMU)
5137 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5139 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5140 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5141 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5144 static void init_proc_602 (CPUPPCState
*env
)
5146 gen_spr_ne_601(env
);
5150 /* hardware implementation registers */
5151 /* XXX : not implemented */
5152 spr_register(env
, SPR_HID0
, "HID0",
5153 SPR_NOACCESS
, SPR_NOACCESS
,
5154 &spr_read_generic
, &spr_write_generic
,
5156 /* XXX : not implemented */
5157 spr_register(env
, SPR_HID1
, "HID1",
5158 SPR_NOACCESS
, SPR_NOACCESS
,
5159 &spr_read_generic
, &spr_write_generic
,
5161 /* Memory management */
5163 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5165 env
->dcache_line_size
= 32;
5166 env
->icache_line_size
= 32;
5167 /* Allocate hardware IRQ controller */
5168 ppc6xx_irq_init(env
);
5171 POWERPC_FAMILY(602)(ObjectClass
*oc
, void *data
)
5173 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5174 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5176 dc
->desc
= "PowerPC 602";
5177 pcc
->init_proc
= init_proc_602
;
5178 pcc
->check_pow
= check_pow_hid0
;
5179 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5180 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5181 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5182 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5183 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5184 PPC_MEM_TLBIE
| PPC_6xx_TLB
| PPC_MEM_TLBSYNC
|
5185 PPC_SEGMENT
| PPC_602_SPEC
;
5186 pcc
->msr_mask
= (1ull << MSR_VSX
) |
5189 (1ull << MSR_TGPR
) |
5204 /* XXX: 602 MMU is quite specific. Should add a special case */
5205 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5206 pcc
->excp_model
= POWERPC_EXCP_602
;
5207 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5208 pcc
->bfd_mach
= bfd_mach_ppc_602
;
5209 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5210 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5213 static void init_proc_603 (CPUPPCState
*env
)
5215 gen_spr_ne_601(env
);
5219 /* hardware implementation registers */
5220 /* XXX : not implemented */
5221 spr_register(env
, SPR_HID0
, "HID0",
5222 SPR_NOACCESS
, SPR_NOACCESS
,
5223 &spr_read_generic
, &spr_write_generic
,
5225 /* XXX : not implemented */
5226 spr_register(env
, SPR_HID1
, "HID1",
5227 SPR_NOACCESS
, SPR_NOACCESS
,
5228 &spr_read_generic
, &spr_write_generic
,
5230 /* Memory management */
5232 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5234 env
->dcache_line_size
= 32;
5235 env
->icache_line_size
= 32;
5236 /* Allocate hardware IRQ controller */
5237 ppc6xx_irq_init(env
);
5240 POWERPC_FAMILY(603)(ObjectClass
*oc
, void *data
)
5242 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5243 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5245 dc
->desc
= "PowerPC 603";
5246 pcc
->init_proc
= init_proc_603
;
5247 pcc
->check_pow
= check_pow_hid0
;
5248 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5249 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5250 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5251 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5252 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5253 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5254 PPC_SEGMENT
| PPC_EXTERN
;
5255 pcc
->msr_mask
= (1ull << MSR_POW
) |
5256 (1ull << MSR_TGPR
) |
5271 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5272 pcc
->excp_model
= POWERPC_EXCP_603
;
5273 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5274 pcc
->bfd_mach
= bfd_mach_ppc_603
;
5275 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5276 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5279 static void init_proc_603E (CPUPPCState
*env
)
5281 gen_spr_ne_601(env
);
5285 /* hardware implementation registers */
5286 /* XXX : not implemented */
5287 spr_register(env
, SPR_HID0
, "HID0",
5288 SPR_NOACCESS
, SPR_NOACCESS
,
5289 &spr_read_generic
, &spr_write_generic
,
5291 /* XXX : not implemented */
5292 spr_register(env
, SPR_HID1
, "HID1",
5293 SPR_NOACCESS
, SPR_NOACCESS
,
5294 &spr_read_generic
, &spr_write_generic
,
5296 /* Memory management */
5298 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5300 env
->dcache_line_size
= 32;
5301 env
->icache_line_size
= 32;
5302 /* Allocate hardware IRQ controller */
5303 ppc6xx_irq_init(env
);
5306 POWERPC_FAMILY(603E
)(ObjectClass
*oc
, void *data
)
5308 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5309 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5311 dc
->desc
= "PowerPC 603e";
5312 pcc
->init_proc
= init_proc_603E
;
5313 pcc
->check_pow
= check_pow_hid0
;
5314 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5315 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5316 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5317 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5318 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5319 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5320 PPC_SEGMENT
| PPC_EXTERN
;
5321 pcc
->msr_mask
= (1ull << MSR_POW
) |
5322 (1ull << MSR_TGPR
) |
5337 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5338 pcc
->excp_model
= POWERPC_EXCP_603E
;
5339 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5340 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
5341 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5342 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5345 static void init_proc_604 (CPUPPCState
*env
)
5347 gen_spr_ne_601(env
);
5351 /* Hardware implementation registers */
5352 /* XXX : not implemented */
5353 spr_register(env
, SPR_HID0
, "HID0",
5354 SPR_NOACCESS
, SPR_NOACCESS
,
5355 &spr_read_generic
, &spr_write_generic
,
5357 /* Memory management */
5360 env
->dcache_line_size
= 32;
5361 env
->icache_line_size
= 32;
5362 /* Allocate hardware IRQ controller */
5363 ppc6xx_irq_init(env
);
5366 POWERPC_FAMILY(604)(ObjectClass
*oc
, void *data
)
5368 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5369 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5371 dc
->desc
= "PowerPC 604";
5372 pcc
->init_proc
= init_proc_604
;
5373 pcc
->check_pow
= check_pow_nocheck
;
5374 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5375 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5376 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5377 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5378 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5379 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5380 PPC_SEGMENT
| PPC_EXTERN
;
5381 pcc
->msr_mask
= (1ull << MSR_POW
) |
5397 pcc
->mmu_model
= POWERPC_MMU_32B
;
5398 #if defined(CONFIG_SOFTMMU)
5399 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5401 pcc
->excp_model
= POWERPC_EXCP_604
;
5402 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5403 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5404 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5405 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5408 static void init_proc_604E (CPUPPCState
*env
)
5410 gen_spr_ne_601(env
);
5412 /* XXX : not implemented */
5413 spr_register(env
, SPR_MMCR1
, "MMCR1",
5414 SPR_NOACCESS
, SPR_NOACCESS
,
5415 &spr_read_generic
, &spr_write_generic
,
5417 /* XXX : not implemented */
5418 spr_register(env
, SPR_PMC3
, "PMC3",
5419 SPR_NOACCESS
, SPR_NOACCESS
,
5420 &spr_read_generic
, &spr_write_generic
,
5422 /* XXX : not implemented */
5423 spr_register(env
, SPR_PMC4
, "PMC4",
5424 SPR_NOACCESS
, SPR_NOACCESS
,
5425 &spr_read_generic
, &spr_write_generic
,
5429 /* Hardware implementation registers */
5430 /* XXX : not implemented */
5431 spr_register(env
, SPR_HID0
, "HID0",
5432 SPR_NOACCESS
, SPR_NOACCESS
,
5433 &spr_read_generic
, &spr_write_generic
,
5435 /* XXX : not implemented */
5436 spr_register(env
, SPR_HID1
, "HID1",
5437 SPR_NOACCESS
, SPR_NOACCESS
,
5438 &spr_read_generic
, &spr_write_generic
,
5440 /* Memory management */
5443 env
->dcache_line_size
= 32;
5444 env
->icache_line_size
= 32;
5445 /* Allocate hardware IRQ controller */
5446 ppc6xx_irq_init(env
);
5449 POWERPC_FAMILY(604E
)(ObjectClass
*oc
, void *data
)
5451 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5452 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5454 dc
->desc
= "PowerPC 604E";
5455 pcc
->init_proc
= init_proc_604E
;
5456 pcc
->check_pow
= check_pow_nocheck
;
5457 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5458 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5459 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5460 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5461 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5462 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5463 PPC_SEGMENT
| PPC_EXTERN
;
5464 pcc
->msr_mask
= (1ull << MSR_POW
) |
5480 pcc
->mmu_model
= POWERPC_MMU_32B
;
5481 #if defined(CONFIG_SOFTMMU)
5482 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5484 pcc
->excp_model
= POWERPC_EXCP_604
;
5485 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5486 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5487 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5488 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5491 static void init_proc_740 (CPUPPCState
*env
)
5493 gen_spr_ne_601(env
);
5497 /* Thermal management */
5499 /* Hardware implementation registers */
5500 /* XXX : not implemented */
5501 spr_register(env
, SPR_HID0
, "HID0",
5502 SPR_NOACCESS
, SPR_NOACCESS
,
5503 &spr_read_generic
, &spr_write_generic
,
5505 /* XXX : not implemented */
5506 spr_register(env
, SPR_HID1
, "HID1",
5507 SPR_NOACCESS
, SPR_NOACCESS
,
5508 &spr_read_generic
, &spr_write_generic
,
5510 /* Memory management */
5513 env
->dcache_line_size
= 32;
5514 env
->icache_line_size
= 32;
5515 /* Allocate hardware IRQ controller */
5516 ppc6xx_irq_init(env
);
5519 POWERPC_FAMILY(740)(ObjectClass
*oc
, void *data
)
5521 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5522 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5524 dc
->desc
= "PowerPC 740";
5525 pcc
->init_proc
= init_proc_740
;
5526 pcc
->check_pow
= check_pow_hid0
;
5527 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5528 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5529 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5530 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5531 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5532 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5533 PPC_SEGMENT
| PPC_EXTERN
;
5534 pcc
->msr_mask
= (1ull << MSR_POW
) |
5550 pcc
->mmu_model
= POWERPC_MMU_32B
;
5551 #if defined(CONFIG_SOFTMMU)
5552 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5554 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5555 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5556 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5557 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5558 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5561 static void init_proc_750 (CPUPPCState
*env
)
5563 gen_spr_ne_601(env
);
5565 /* XXX : not implemented */
5566 spr_register(env
, SPR_L2CR
, "L2CR",
5567 SPR_NOACCESS
, SPR_NOACCESS
,
5568 &spr_read_generic
, spr_access_nop
,
5572 /* Thermal management */
5574 /* Hardware implementation registers */
5575 /* XXX : not implemented */
5576 spr_register(env
, SPR_HID0
, "HID0",
5577 SPR_NOACCESS
, SPR_NOACCESS
,
5578 &spr_read_generic
, &spr_write_generic
,
5580 /* XXX : not implemented */
5581 spr_register(env
, SPR_HID1
, "HID1",
5582 SPR_NOACCESS
, SPR_NOACCESS
,
5583 &spr_read_generic
, &spr_write_generic
,
5585 /* Memory management */
5587 /* XXX: high BATs are also present but are known to be bugged on
5591 env
->dcache_line_size
= 32;
5592 env
->icache_line_size
= 32;
5593 /* Allocate hardware IRQ controller */
5594 ppc6xx_irq_init(env
);
5597 POWERPC_FAMILY(750)(ObjectClass
*oc
, void *data
)
5599 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5600 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5602 dc
->desc
= "PowerPC 750";
5603 pcc
->init_proc
= init_proc_750
;
5604 pcc
->check_pow
= check_pow_hid0
;
5605 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5606 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5607 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5608 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5609 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5610 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5611 PPC_SEGMENT
| PPC_EXTERN
;
5612 pcc
->msr_mask
= (1ull << MSR_POW
) |
5628 pcc
->mmu_model
= POWERPC_MMU_32B
;
5629 #if defined(CONFIG_SOFTMMU)
5630 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5632 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5633 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5634 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5635 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5636 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5639 static void init_proc_750cl (CPUPPCState
*env
)
5641 gen_spr_ne_601(env
);
5643 /* XXX : not implemented */
5644 spr_register(env
, SPR_L2CR
, "L2CR",
5645 SPR_NOACCESS
, SPR_NOACCESS
,
5646 &spr_read_generic
, spr_access_nop
,
5650 /* Thermal management */
5651 /* Those registers are fake on 750CL */
5652 spr_register(env
, SPR_THRM1
, "THRM1",
5653 SPR_NOACCESS
, SPR_NOACCESS
,
5654 &spr_read_generic
, &spr_write_generic
,
5656 spr_register(env
, SPR_THRM2
, "THRM2",
5657 SPR_NOACCESS
, SPR_NOACCESS
,
5658 &spr_read_generic
, &spr_write_generic
,
5660 spr_register(env
, SPR_THRM3
, "THRM3",
5661 SPR_NOACCESS
, SPR_NOACCESS
,
5662 &spr_read_generic
, &spr_write_generic
,
5664 /* XXX: not implemented */
5665 spr_register(env
, SPR_750_TDCL
, "TDCL",
5666 SPR_NOACCESS
, SPR_NOACCESS
,
5667 &spr_read_generic
, &spr_write_generic
,
5669 spr_register(env
, SPR_750_TDCH
, "TDCH",
5670 SPR_NOACCESS
, SPR_NOACCESS
,
5671 &spr_read_generic
, &spr_write_generic
,
5674 /* XXX : not implemented */
5675 spr_register(env
, SPR_750_WPAR
, "WPAR",
5676 SPR_NOACCESS
, SPR_NOACCESS
,
5677 &spr_read_generic
, &spr_write_generic
,
5679 spr_register(env
, SPR_750_DMAL
, "DMAL",
5680 SPR_NOACCESS
, SPR_NOACCESS
,
5681 &spr_read_generic
, &spr_write_generic
,
5683 spr_register(env
, SPR_750_DMAU
, "DMAU",
5684 SPR_NOACCESS
, SPR_NOACCESS
,
5685 &spr_read_generic
, &spr_write_generic
,
5687 /* Hardware implementation registers */
5688 /* XXX : not implemented */
5689 spr_register(env
, SPR_HID0
, "HID0",
5690 SPR_NOACCESS
, SPR_NOACCESS
,
5691 &spr_read_generic
, &spr_write_generic
,
5693 /* XXX : not implemented */
5694 spr_register(env
, SPR_HID1
, "HID1",
5695 SPR_NOACCESS
, SPR_NOACCESS
,
5696 &spr_read_generic
, &spr_write_generic
,
5698 /* XXX : not implemented */
5699 spr_register(env
, SPR_750CL_HID2
, "HID2",
5700 SPR_NOACCESS
, SPR_NOACCESS
,
5701 &spr_read_generic
, &spr_write_generic
,
5703 /* XXX : not implemented */
5704 spr_register(env
, SPR_750CL_HID4
, "HID4",
5705 SPR_NOACCESS
, SPR_NOACCESS
,
5706 &spr_read_generic
, &spr_write_generic
,
5708 /* Quantization registers */
5709 /* XXX : not implemented */
5710 spr_register(env
, SPR_750_GQR0
, "GQR0",
5711 SPR_NOACCESS
, SPR_NOACCESS
,
5712 &spr_read_generic
, &spr_write_generic
,
5714 /* XXX : not implemented */
5715 spr_register(env
, SPR_750_GQR1
, "GQR1",
5716 SPR_NOACCESS
, SPR_NOACCESS
,
5717 &spr_read_generic
, &spr_write_generic
,
5719 /* XXX : not implemented */
5720 spr_register(env
, SPR_750_GQR2
, "GQR2",
5721 SPR_NOACCESS
, SPR_NOACCESS
,
5722 &spr_read_generic
, &spr_write_generic
,
5724 /* XXX : not implemented */
5725 spr_register(env
, SPR_750_GQR3
, "GQR3",
5726 SPR_NOACCESS
, SPR_NOACCESS
,
5727 &spr_read_generic
, &spr_write_generic
,
5729 /* XXX : not implemented */
5730 spr_register(env
, SPR_750_GQR4
, "GQR4",
5731 SPR_NOACCESS
, SPR_NOACCESS
,
5732 &spr_read_generic
, &spr_write_generic
,
5734 /* XXX : not implemented */
5735 spr_register(env
, SPR_750_GQR5
, "GQR5",
5736 SPR_NOACCESS
, SPR_NOACCESS
,
5737 &spr_read_generic
, &spr_write_generic
,
5739 /* XXX : not implemented */
5740 spr_register(env
, SPR_750_GQR6
, "GQR6",
5741 SPR_NOACCESS
, SPR_NOACCESS
,
5742 &spr_read_generic
, &spr_write_generic
,
5744 /* XXX : not implemented */
5745 spr_register(env
, SPR_750_GQR7
, "GQR7",
5746 SPR_NOACCESS
, SPR_NOACCESS
,
5747 &spr_read_generic
, &spr_write_generic
,
5749 /* Memory management */
5751 /* PowerPC 750cl has 8 DBATs and 8 IBATs */
5753 init_excp_750cl(env
);
5754 env
->dcache_line_size
= 32;
5755 env
->icache_line_size
= 32;
5756 /* Allocate hardware IRQ controller */
5757 ppc6xx_irq_init(env
);
5760 POWERPC_FAMILY(750cl
)(ObjectClass
*oc
, void *data
)
5762 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5763 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5765 dc
->desc
= "PowerPC 750 CL";
5766 pcc
->init_proc
= init_proc_750cl
;
5767 pcc
->check_pow
= check_pow_hid0
;
5768 /* XXX: not implemented:
5769 * cache lock instructions:
5771 * floating point paired instructions
5806 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5807 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5808 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5809 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5810 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5811 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5812 PPC_SEGMENT
| PPC_EXTERN
;
5813 pcc
->msr_mask
= (1ull << MSR_POW
) |
5829 pcc
->mmu_model
= POWERPC_MMU_32B
;
5830 #if defined(CONFIG_SOFTMMU)
5831 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5833 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5834 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5835 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5836 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5837 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5840 static void init_proc_750cx (CPUPPCState
*env
)
5842 gen_spr_ne_601(env
);
5844 /* XXX : not implemented */
5845 spr_register(env
, SPR_L2CR
, "L2CR",
5846 SPR_NOACCESS
, SPR_NOACCESS
,
5847 &spr_read_generic
, spr_access_nop
,
5851 /* Thermal management */
5853 /* This register is not implemented but is present for compatibility */
5854 spr_register(env
, SPR_SDA
, "SDA",
5855 SPR_NOACCESS
, SPR_NOACCESS
,
5856 &spr_read_generic
, &spr_write_generic
,
5858 /* Hardware implementation registers */
5859 /* XXX : not implemented */
5860 spr_register(env
, SPR_HID0
, "HID0",
5861 SPR_NOACCESS
, SPR_NOACCESS
,
5862 &spr_read_generic
, &spr_write_generic
,
5864 /* XXX : not implemented */
5865 spr_register(env
, SPR_HID1
, "HID1",
5866 SPR_NOACCESS
, SPR_NOACCESS
,
5867 &spr_read_generic
, &spr_write_generic
,
5869 /* Memory management */
5871 /* PowerPC 750cx has 8 DBATs and 8 IBATs */
5873 init_excp_750cx(env
);
5874 env
->dcache_line_size
= 32;
5875 env
->icache_line_size
= 32;
5876 /* Allocate hardware IRQ controller */
5877 ppc6xx_irq_init(env
);
5880 POWERPC_FAMILY(750cx
)(ObjectClass
*oc
, void *data
)
5882 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5883 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5885 dc
->desc
= "PowerPC 750CX";
5886 pcc
->init_proc
= init_proc_750cx
;
5887 pcc
->check_pow
= check_pow_hid0
;
5888 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5889 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5890 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5891 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5892 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5893 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5894 PPC_SEGMENT
| PPC_EXTERN
;
5895 pcc
->msr_mask
= (1ull << MSR_POW
) |
5911 pcc
->mmu_model
= POWERPC_MMU_32B
;
5912 #if defined(CONFIG_SOFTMMU)
5913 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5915 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5916 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5917 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5918 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5919 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5922 static void init_proc_750fx (CPUPPCState
*env
)
5924 gen_spr_ne_601(env
);
5926 /* XXX : not implemented */
5927 spr_register(env
, SPR_L2CR
, "L2CR",
5928 SPR_NOACCESS
, SPR_NOACCESS
,
5929 &spr_read_generic
, spr_access_nop
,
5933 /* Thermal management */
5935 /* XXX : not implemented */
5936 spr_register(env
, SPR_750_THRM4
, "THRM4",
5937 SPR_NOACCESS
, SPR_NOACCESS
,
5938 &spr_read_generic
, &spr_write_generic
,
5940 /* Hardware implementation registers */
5941 /* XXX : not implemented */
5942 spr_register(env
, SPR_HID0
, "HID0",
5943 SPR_NOACCESS
, SPR_NOACCESS
,
5944 &spr_read_generic
, &spr_write_generic
,
5946 /* XXX : not implemented */
5947 spr_register(env
, SPR_HID1
, "HID1",
5948 SPR_NOACCESS
, SPR_NOACCESS
,
5949 &spr_read_generic
, &spr_write_generic
,
5951 /* XXX : not implemented */
5952 spr_register(env
, SPR_750FX_HID2
, "HID2",
5953 SPR_NOACCESS
, SPR_NOACCESS
,
5954 &spr_read_generic
, &spr_write_generic
,
5956 /* Memory management */
5958 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
5961 env
->dcache_line_size
= 32;
5962 env
->icache_line_size
= 32;
5963 /* Allocate hardware IRQ controller */
5964 ppc6xx_irq_init(env
);
5967 POWERPC_FAMILY(750fx
)(ObjectClass
*oc
, void *data
)
5969 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5970 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5972 dc
->desc
= "PowerPC 750FX";
5973 pcc
->init_proc
= init_proc_750fx
;
5974 pcc
->check_pow
= check_pow_hid0
;
5975 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5976 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5977 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5978 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5979 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5980 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5981 PPC_SEGMENT
| PPC_EXTERN
;
5982 pcc
->msr_mask
= (1ull << MSR_POW
) |
5998 pcc
->mmu_model
= POWERPC_MMU_32B
;
5999 #if defined(CONFIG_SOFTMMU)
6000 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6002 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6003 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6004 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6005 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6006 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6009 static void init_proc_750gx (CPUPPCState
*env
)
6011 gen_spr_ne_601(env
);
6013 /* XXX : not implemented (XXX: different from 750fx) */
6014 spr_register(env
, SPR_L2CR
, "L2CR",
6015 SPR_NOACCESS
, SPR_NOACCESS
,
6016 &spr_read_generic
, spr_access_nop
,
6020 /* Thermal management */
6022 /* XXX : not implemented */
6023 spr_register(env
, SPR_750_THRM4
, "THRM4",
6024 SPR_NOACCESS
, SPR_NOACCESS
,
6025 &spr_read_generic
, &spr_write_generic
,
6027 /* Hardware implementation registers */
6028 /* XXX : not implemented (XXX: different from 750fx) */
6029 spr_register(env
, SPR_HID0
, "HID0",
6030 SPR_NOACCESS
, SPR_NOACCESS
,
6031 &spr_read_generic
, &spr_write_generic
,
6033 /* XXX : not implemented */
6034 spr_register(env
, SPR_HID1
, "HID1",
6035 SPR_NOACCESS
, SPR_NOACCESS
,
6036 &spr_read_generic
, &spr_write_generic
,
6038 /* XXX : not implemented (XXX: different from 750fx) */
6039 spr_register(env
, SPR_750FX_HID2
, "HID2",
6040 SPR_NOACCESS
, SPR_NOACCESS
,
6041 &spr_read_generic
, &spr_write_generic
,
6043 /* Memory management */
6045 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6048 env
->dcache_line_size
= 32;
6049 env
->icache_line_size
= 32;
6050 /* Allocate hardware IRQ controller */
6051 ppc6xx_irq_init(env
);
6054 POWERPC_FAMILY(750gx
)(ObjectClass
*oc
, void *data
)
6056 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6057 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6059 dc
->desc
= "PowerPC 750GX";
6060 pcc
->init_proc
= init_proc_750gx
;
6061 pcc
->check_pow
= check_pow_hid0
;
6062 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6063 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6064 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6065 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6066 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6067 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6068 PPC_SEGMENT
| PPC_EXTERN
;
6069 pcc
->msr_mask
= (1ull << MSR_POW
) |
6085 pcc
->mmu_model
= POWERPC_MMU_32B
;
6086 #if defined(CONFIG_SOFTMMU)
6087 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6089 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6090 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6091 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6092 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6093 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6096 static void init_proc_745 (CPUPPCState
*env
)
6098 gen_spr_ne_601(env
);
6100 gen_spr_G2_755(env
);
6103 /* Thermal management */
6105 /* Hardware implementation registers */
6106 /* XXX : not implemented */
6107 spr_register(env
, SPR_HID0
, "HID0",
6108 SPR_NOACCESS
, SPR_NOACCESS
,
6109 &spr_read_generic
, &spr_write_generic
,
6111 /* XXX : not implemented */
6112 spr_register(env
, SPR_HID1
, "HID1",
6113 SPR_NOACCESS
, SPR_NOACCESS
,
6114 &spr_read_generic
, &spr_write_generic
,
6116 /* XXX : not implemented */
6117 spr_register(env
, SPR_HID2
, "HID2",
6118 SPR_NOACCESS
, SPR_NOACCESS
,
6119 &spr_read_generic
, &spr_write_generic
,
6121 /* Memory management */
6124 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6126 env
->dcache_line_size
= 32;
6127 env
->icache_line_size
= 32;
6128 /* Allocate hardware IRQ controller */
6129 ppc6xx_irq_init(env
);
6132 POWERPC_FAMILY(745)(ObjectClass
*oc
, void *data
)
6134 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6135 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6137 dc
->desc
= "PowerPC 745";
6138 pcc
->init_proc
= init_proc_745
;
6139 pcc
->check_pow
= check_pow_hid0
;
6140 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6141 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6142 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6143 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6144 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6145 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6146 PPC_SEGMENT
| PPC_EXTERN
;
6147 pcc
->msr_mask
= (1ull << MSR_POW
) |
6163 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6164 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6165 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6166 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6167 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6168 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6171 static void init_proc_755 (CPUPPCState
*env
)
6173 gen_spr_ne_601(env
);
6175 gen_spr_G2_755(env
);
6178 /* L2 cache control */
6179 /* XXX : not implemented */
6180 spr_register(env
, SPR_L2CR
, "L2CR",
6181 SPR_NOACCESS
, SPR_NOACCESS
,
6182 &spr_read_generic
, spr_access_nop
,
6184 /* XXX : not implemented */
6185 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6186 SPR_NOACCESS
, SPR_NOACCESS
,
6187 &spr_read_generic
, &spr_write_generic
,
6189 /* Thermal management */
6191 /* Hardware implementation registers */
6192 /* XXX : not implemented */
6193 spr_register(env
, SPR_HID0
, "HID0",
6194 SPR_NOACCESS
, SPR_NOACCESS
,
6195 &spr_read_generic
, &spr_write_generic
,
6197 /* XXX : not implemented */
6198 spr_register(env
, SPR_HID1
, "HID1",
6199 SPR_NOACCESS
, SPR_NOACCESS
,
6200 &spr_read_generic
, &spr_write_generic
,
6202 /* XXX : not implemented */
6203 spr_register(env
, SPR_HID2
, "HID2",
6204 SPR_NOACCESS
, SPR_NOACCESS
,
6205 &spr_read_generic
, &spr_write_generic
,
6207 /* Memory management */
6210 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6212 env
->dcache_line_size
= 32;
6213 env
->icache_line_size
= 32;
6214 /* Allocate hardware IRQ controller */
6215 ppc6xx_irq_init(env
);
6218 POWERPC_FAMILY(755)(ObjectClass
*oc
, void *data
)
6220 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6221 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6223 dc
->desc
= "PowerPC 755";
6224 pcc
->init_proc
= init_proc_755
;
6225 pcc
->check_pow
= check_pow_hid0
;
6226 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6227 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6228 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6229 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6230 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6231 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6232 PPC_SEGMENT
| PPC_EXTERN
;
6233 pcc
->msr_mask
= (1ull << MSR_POW
) |
6249 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6250 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6251 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6252 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6253 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6254 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6257 static void init_proc_7400 (CPUPPCState
*env
)
6259 gen_spr_ne_601(env
);
6263 /* 74xx specific SPR */
6265 /* XXX : not implemented */
6266 spr_register(env
, SPR_UBAMR
, "UBAMR",
6267 &spr_read_ureg
, SPR_NOACCESS
,
6268 &spr_read_ureg
, SPR_NOACCESS
,
6270 /* XXX: this seems not implemented on all revisions. */
6271 /* XXX : not implemented */
6272 spr_register(env
, SPR_MSSCR1
, "MSSCR1",
6273 SPR_NOACCESS
, SPR_NOACCESS
,
6274 &spr_read_generic
, &spr_write_generic
,
6276 /* Thermal management */
6278 /* Memory management */
6280 init_excp_7400(env
);
6281 env
->dcache_line_size
= 32;
6282 env
->icache_line_size
= 32;
6283 /* Allocate hardware IRQ controller */
6284 ppc6xx_irq_init(env
);
6287 POWERPC_FAMILY(7400)(ObjectClass
*oc
, void *data
)
6289 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6290 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6292 dc
->desc
= "PowerPC 7400 (aka G4)";
6293 pcc
->init_proc
= init_proc_7400
;
6294 pcc
->check_pow
= check_pow_hid0
;
6295 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6296 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6297 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6299 PPC_CACHE
| PPC_CACHE_ICBI
|
6300 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6301 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6302 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6304 PPC_SEGMENT
| PPC_EXTERN
|
6306 pcc
->msr_mask
= (1ull << MSR_VR
) |
6323 pcc
->mmu_model
= POWERPC_MMU_32B
;
6324 #if defined(CONFIG_SOFTMMU)
6325 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6327 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6328 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6329 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6330 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6331 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6332 POWERPC_FLAG_BUS_CLK
;
6335 static void init_proc_7410 (CPUPPCState
*env
)
6337 gen_spr_ne_601(env
);
6341 /* 74xx specific SPR */
6343 /* XXX : not implemented */
6344 spr_register(env
, SPR_UBAMR
, "UBAMR",
6345 &spr_read_ureg
, SPR_NOACCESS
,
6346 &spr_read_ureg
, SPR_NOACCESS
,
6348 /* Thermal management */
6351 /* XXX : not implemented */
6352 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6353 SPR_NOACCESS
, SPR_NOACCESS
,
6354 &spr_read_generic
, &spr_write_generic
,
6357 /* XXX : not implemented */
6358 spr_register(env
, SPR_LDSTDB
, "LDSTDB",
6359 SPR_NOACCESS
, SPR_NOACCESS
,
6360 &spr_read_generic
, &spr_write_generic
,
6362 /* Memory management */
6364 init_excp_7400(env
);
6365 env
->dcache_line_size
= 32;
6366 env
->icache_line_size
= 32;
6367 /* Allocate hardware IRQ controller */
6368 ppc6xx_irq_init(env
);
6371 POWERPC_FAMILY(7410)(ObjectClass
*oc
, void *data
)
6373 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6374 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6376 dc
->desc
= "PowerPC 7410 (aka G4)";
6377 pcc
->init_proc
= init_proc_7410
;
6378 pcc
->check_pow
= check_pow_hid0
;
6379 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6380 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6381 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6383 PPC_CACHE
| PPC_CACHE_ICBI
|
6384 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6385 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6386 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6388 PPC_SEGMENT
| PPC_EXTERN
|
6390 pcc
->msr_mask
= (1ull << MSR_VR
) |
6407 pcc
->mmu_model
= POWERPC_MMU_32B
;
6408 #if defined(CONFIG_SOFTMMU)
6409 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6411 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6412 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6413 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6414 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6415 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6416 POWERPC_FLAG_BUS_CLK
;
6419 static void init_proc_7440 (CPUPPCState
*env
)
6421 gen_spr_ne_601(env
);
6425 /* 74xx specific SPR */
6427 /* XXX : not implemented */
6428 spr_register(env
, SPR_UBAMR
, "UBAMR",
6429 &spr_read_ureg
, SPR_NOACCESS
,
6430 &spr_read_ureg
, SPR_NOACCESS
,
6433 /* XXX : not implemented */
6434 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6435 SPR_NOACCESS
, SPR_NOACCESS
,
6436 &spr_read_generic
, &spr_write_generic
,
6439 /* XXX : not implemented */
6440 spr_register(env
, SPR_ICTRL
, "ICTRL",
6441 SPR_NOACCESS
, SPR_NOACCESS
,
6442 &spr_read_generic
, &spr_write_generic
,
6445 /* XXX : not implemented */
6446 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6447 SPR_NOACCESS
, SPR_NOACCESS
,
6448 &spr_read_generic
, &spr_write_generic
,
6451 /* XXX : not implemented */
6452 spr_register(env
, SPR_PMC5
, "PMC5",
6453 SPR_NOACCESS
, SPR_NOACCESS
,
6454 &spr_read_generic
, &spr_write_generic
,
6456 /* XXX : not implemented */
6457 spr_register(env
, SPR_UPMC5
, "UPMC5",
6458 &spr_read_ureg
, SPR_NOACCESS
,
6459 &spr_read_ureg
, SPR_NOACCESS
,
6461 /* XXX : not implemented */
6462 spr_register(env
, SPR_PMC6
, "PMC6",
6463 SPR_NOACCESS
, SPR_NOACCESS
,
6464 &spr_read_generic
, &spr_write_generic
,
6466 /* XXX : not implemented */
6467 spr_register(env
, SPR_UPMC6
, "UPMC6",
6468 &spr_read_ureg
, SPR_NOACCESS
,
6469 &spr_read_ureg
, SPR_NOACCESS
,
6471 /* Memory management */
6473 gen_74xx_soft_tlb(env
, 128, 2);
6474 init_excp_7450(env
);
6475 env
->dcache_line_size
= 32;
6476 env
->icache_line_size
= 32;
6477 /* Allocate hardware IRQ controller */
6478 ppc6xx_irq_init(env
);
6481 POWERPC_FAMILY(7440)(ObjectClass
*oc
, void *data
)
6483 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6484 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6486 dc
->desc
= "PowerPC 7440 (aka G4)";
6487 pcc
->init_proc
= init_proc_7440
;
6488 pcc
->check_pow
= check_pow_hid0_74xx
;
6489 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6490 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6491 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6493 PPC_CACHE
| PPC_CACHE_ICBI
|
6494 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6495 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6496 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6497 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6498 PPC_SEGMENT
| PPC_EXTERN
|
6500 pcc
->msr_mask
= (1ull << MSR_VR
) |
6517 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6518 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6519 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6520 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6521 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6522 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6523 POWERPC_FLAG_BUS_CLK
;
6526 static void init_proc_7450 (CPUPPCState
*env
)
6528 gen_spr_ne_601(env
);
6532 /* 74xx specific SPR */
6534 /* Level 3 cache control */
6537 /* XXX : not implemented */
6538 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
6539 SPR_NOACCESS
, SPR_NOACCESS
,
6540 &spr_read_generic
, &spr_write_generic
,
6543 /* XXX : not implemented */
6544 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
6545 SPR_NOACCESS
, SPR_NOACCESS
,
6546 &spr_read_generic
, &spr_write_generic
,
6549 /* XXX : not implemented */
6550 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
6551 SPR_NOACCESS
, SPR_NOACCESS
,
6552 &spr_read_generic
, &spr_write_generic
,
6555 /* XXX : not implemented */
6556 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
6557 SPR_NOACCESS
, SPR_NOACCESS
,
6558 &spr_read_generic
, &spr_write_generic
,
6560 /* XXX : not implemented */
6561 spr_register(env
, SPR_UBAMR
, "UBAMR",
6562 &spr_read_ureg
, SPR_NOACCESS
,
6563 &spr_read_ureg
, SPR_NOACCESS
,
6566 /* XXX : not implemented */
6567 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6568 SPR_NOACCESS
, SPR_NOACCESS
,
6569 &spr_read_generic
, &spr_write_generic
,
6572 /* XXX : not implemented */
6573 spr_register(env
, SPR_ICTRL
, "ICTRL",
6574 SPR_NOACCESS
, SPR_NOACCESS
,
6575 &spr_read_generic
, &spr_write_generic
,
6578 /* XXX : not implemented */
6579 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6580 SPR_NOACCESS
, SPR_NOACCESS
,
6581 &spr_read_generic
, &spr_write_generic
,
6584 /* XXX : not implemented */
6585 spr_register(env
, SPR_PMC5
, "PMC5",
6586 SPR_NOACCESS
, SPR_NOACCESS
,
6587 &spr_read_generic
, &spr_write_generic
,
6589 /* XXX : not implemented */
6590 spr_register(env
, SPR_UPMC5
, "UPMC5",
6591 &spr_read_ureg
, SPR_NOACCESS
,
6592 &spr_read_ureg
, SPR_NOACCESS
,
6594 /* XXX : not implemented */
6595 spr_register(env
, SPR_PMC6
, "PMC6",
6596 SPR_NOACCESS
, SPR_NOACCESS
,
6597 &spr_read_generic
, &spr_write_generic
,
6599 /* XXX : not implemented */
6600 spr_register(env
, SPR_UPMC6
, "UPMC6",
6601 &spr_read_ureg
, SPR_NOACCESS
,
6602 &spr_read_ureg
, SPR_NOACCESS
,
6604 /* Memory management */
6606 gen_74xx_soft_tlb(env
, 128, 2);
6607 init_excp_7450(env
);
6608 env
->dcache_line_size
= 32;
6609 env
->icache_line_size
= 32;
6610 /* Allocate hardware IRQ controller */
6611 ppc6xx_irq_init(env
);
6614 POWERPC_FAMILY(7450)(ObjectClass
*oc
, void *data
)
6616 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6617 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6619 dc
->desc
= "PowerPC 7450 (aka G4)";
6620 pcc
->init_proc
= init_proc_7450
;
6621 pcc
->check_pow
= check_pow_hid0_74xx
;
6622 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6623 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6624 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6626 PPC_CACHE
| PPC_CACHE_ICBI
|
6627 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6628 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6629 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6630 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6631 PPC_SEGMENT
| PPC_EXTERN
|
6633 pcc
->msr_mask
= (1ull << MSR_VR
) |
6650 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6651 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6652 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6653 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6654 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6655 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6656 POWERPC_FLAG_BUS_CLK
;
6659 static void init_proc_7445 (CPUPPCState
*env
)
6661 gen_spr_ne_601(env
);
6665 /* 74xx specific SPR */
6668 /* XXX : not implemented */
6669 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6670 SPR_NOACCESS
, SPR_NOACCESS
,
6671 &spr_read_generic
, &spr_write_generic
,
6674 /* XXX : not implemented */
6675 spr_register(env
, SPR_ICTRL
, "ICTRL",
6676 SPR_NOACCESS
, SPR_NOACCESS
,
6677 &spr_read_generic
, &spr_write_generic
,
6680 /* XXX : not implemented */
6681 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6682 SPR_NOACCESS
, SPR_NOACCESS
,
6683 &spr_read_generic
, &spr_write_generic
,
6686 /* XXX : not implemented */
6687 spr_register(env
, SPR_PMC5
, "PMC5",
6688 SPR_NOACCESS
, SPR_NOACCESS
,
6689 &spr_read_generic
, &spr_write_generic
,
6691 /* XXX : not implemented */
6692 spr_register(env
, SPR_UPMC5
, "UPMC5",
6693 &spr_read_ureg
, SPR_NOACCESS
,
6694 &spr_read_ureg
, SPR_NOACCESS
,
6696 /* XXX : not implemented */
6697 spr_register(env
, SPR_PMC6
, "PMC6",
6698 SPR_NOACCESS
, SPR_NOACCESS
,
6699 &spr_read_generic
, &spr_write_generic
,
6701 /* XXX : not implemented */
6702 spr_register(env
, SPR_UPMC6
, "UPMC6",
6703 &spr_read_ureg
, SPR_NOACCESS
,
6704 &spr_read_ureg
, SPR_NOACCESS
,
6707 spr_register(env
, SPR_SPRG4
, "SPRG4",
6708 SPR_NOACCESS
, SPR_NOACCESS
,
6709 &spr_read_generic
, &spr_write_generic
,
6711 spr_register(env
, SPR_USPRG4
, "USPRG4",
6712 &spr_read_ureg
, SPR_NOACCESS
,
6713 &spr_read_ureg
, SPR_NOACCESS
,
6715 spr_register(env
, SPR_SPRG5
, "SPRG5",
6716 SPR_NOACCESS
, SPR_NOACCESS
,
6717 &spr_read_generic
, &spr_write_generic
,
6719 spr_register(env
, SPR_USPRG5
, "USPRG5",
6720 &spr_read_ureg
, SPR_NOACCESS
,
6721 &spr_read_ureg
, SPR_NOACCESS
,
6723 spr_register(env
, SPR_SPRG6
, "SPRG6",
6724 SPR_NOACCESS
, SPR_NOACCESS
,
6725 &spr_read_generic
, &spr_write_generic
,
6727 spr_register(env
, SPR_USPRG6
, "USPRG6",
6728 &spr_read_ureg
, SPR_NOACCESS
,
6729 &spr_read_ureg
, SPR_NOACCESS
,
6731 spr_register(env
, SPR_SPRG7
, "SPRG7",
6732 SPR_NOACCESS
, SPR_NOACCESS
,
6733 &spr_read_generic
, &spr_write_generic
,
6735 spr_register(env
, SPR_USPRG7
, "USPRG7",
6736 &spr_read_ureg
, SPR_NOACCESS
,
6737 &spr_read_ureg
, SPR_NOACCESS
,
6739 /* Memory management */
6742 gen_74xx_soft_tlb(env
, 128, 2);
6743 init_excp_7450(env
);
6744 env
->dcache_line_size
= 32;
6745 env
->icache_line_size
= 32;
6746 /* Allocate hardware IRQ controller */
6747 ppc6xx_irq_init(env
);
6750 POWERPC_FAMILY(7445)(ObjectClass
*oc
, void *data
)
6752 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6753 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6755 dc
->desc
= "PowerPC 7445 (aka G4)";
6756 pcc
->init_proc
= init_proc_7445
;
6757 pcc
->check_pow
= check_pow_hid0_74xx
;
6758 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6759 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6760 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6762 PPC_CACHE
| PPC_CACHE_ICBI
|
6763 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6764 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6765 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6766 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6767 PPC_SEGMENT
| PPC_EXTERN
|
6769 pcc
->msr_mask
= (1ull << MSR_VR
) |
6786 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6787 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6788 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6789 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6790 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6791 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6792 POWERPC_FLAG_BUS_CLK
;
6795 static void init_proc_7455 (CPUPPCState
*env
)
6797 gen_spr_ne_601(env
);
6801 /* 74xx specific SPR */
6803 /* Level 3 cache control */
6806 /* XXX : not implemented */
6807 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6808 SPR_NOACCESS
, SPR_NOACCESS
,
6809 &spr_read_generic
, &spr_write_generic
,
6812 /* XXX : not implemented */
6813 spr_register(env
, SPR_ICTRL
, "ICTRL",
6814 SPR_NOACCESS
, SPR_NOACCESS
,
6815 &spr_read_generic
, &spr_write_generic
,
6818 /* XXX : not implemented */
6819 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6820 SPR_NOACCESS
, SPR_NOACCESS
,
6821 &spr_read_generic
, &spr_write_generic
,
6824 /* XXX : not implemented */
6825 spr_register(env
, SPR_PMC5
, "PMC5",
6826 SPR_NOACCESS
, SPR_NOACCESS
,
6827 &spr_read_generic
, &spr_write_generic
,
6829 /* XXX : not implemented */
6830 spr_register(env
, SPR_UPMC5
, "UPMC5",
6831 &spr_read_ureg
, SPR_NOACCESS
,
6832 &spr_read_ureg
, SPR_NOACCESS
,
6834 /* XXX : not implemented */
6835 spr_register(env
, SPR_PMC6
, "PMC6",
6836 SPR_NOACCESS
, SPR_NOACCESS
,
6837 &spr_read_generic
, &spr_write_generic
,
6839 /* XXX : not implemented */
6840 spr_register(env
, SPR_UPMC6
, "UPMC6",
6841 &spr_read_ureg
, SPR_NOACCESS
,
6842 &spr_read_ureg
, SPR_NOACCESS
,
6845 spr_register(env
, SPR_SPRG4
, "SPRG4",
6846 SPR_NOACCESS
, SPR_NOACCESS
,
6847 &spr_read_generic
, &spr_write_generic
,
6849 spr_register(env
, SPR_USPRG4
, "USPRG4",
6850 &spr_read_ureg
, SPR_NOACCESS
,
6851 &spr_read_ureg
, SPR_NOACCESS
,
6853 spr_register(env
, SPR_SPRG5
, "SPRG5",
6854 SPR_NOACCESS
, SPR_NOACCESS
,
6855 &spr_read_generic
, &spr_write_generic
,
6857 spr_register(env
, SPR_USPRG5
, "USPRG5",
6858 &spr_read_ureg
, SPR_NOACCESS
,
6859 &spr_read_ureg
, SPR_NOACCESS
,
6861 spr_register(env
, SPR_SPRG6
, "SPRG6",
6862 SPR_NOACCESS
, SPR_NOACCESS
,
6863 &spr_read_generic
, &spr_write_generic
,
6865 spr_register(env
, SPR_USPRG6
, "USPRG6",
6866 &spr_read_ureg
, SPR_NOACCESS
,
6867 &spr_read_ureg
, SPR_NOACCESS
,
6869 spr_register(env
, SPR_SPRG7
, "SPRG7",
6870 SPR_NOACCESS
, SPR_NOACCESS
,
6871 &spr_read_generic
, &spr_write_generic
,
6873 spr_register(env
, SPR_USPRG7
, "USPRG7",
6874 &spr_read_ureg
, SPR_NOACCESS
,
6875 &spr_read_ureg
, SPR_NOACCESS
,
6877 /* Memory management */
6880 gen_74xx_soft_tlb(env
, 128, 2);
6881 init_excp_7450(env
);
6882 env
->dcache_line_size
= 32;
6883 env
->icache_line_size
= 32;
6884 /* Allocate hardware IRQ controller */
6885 ppc6xx_irq_init(env
);
6888 POWERPC_FAMILY(7455)(ObjectClass
*oc
, void *data
)
6890 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6891 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6893 dc
->desc
= "PowerPC 7455 (aka G4)";
6894 pcc
->init_proc
= init_proc_7455
;
6895 pcc
->check_pow
= check_pow_hid0_74xx
;
6896 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6897 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6898 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6900 PPC_CACHE
| PPC_CACHE_ICBI
|
6901 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6902 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6903 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6904 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6905 PPC_SEGMENT
| PPC_EXTERN
|
6907 pcc
->msr_mask
= (1ull << MSR_VR
) |
6924 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6925 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6926 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6927 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6928 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6929 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6930 POWERPC_FLAG_BUS_CLK
;
6933 static void init_proc_7457 (CPUPPCState
*env
)
6935 gen_spr_ne_601(env
);
6939 /* 74xx specific SPR */
6941 /* Level 3 cache control */
6944 /* XXX : not implemented */
6945 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
6946 SPR_NOACCESS
, SPR_NOACCESS
,
6947 &spr_read_generic
, &spr_write_generic
,
6950 /* XXX : not implemented */
6951 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
6952 SPR_NOACCESS
, SPR_NOACCESS
,
6953 &spr_read_generic
, &spr_write_generic
,
6956 /* XXX : not implemented */
6957 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
6958 SPR_NOACCESS
, SPR_NOACCESS
,
6959 &spr_read_generic
, &spr_write_generic
,
6962 /* XXX : not implemented */
6963 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
6964 SPR_NOACCESS
, SPR_NOACCESS
,
6965 &spr_read_generic
, &spr_write_generic
,
6968 /* XXX : not implemented */
6969 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6970 SPR_NOACCESS
, SPR_NOACCESS
,
6971 &spr_read_generic
, &spr_write_generic
,
6974 /* XXX : not implemented */
6975 spr_register(env
, SPR_ICTRL
, "ICTRL",
6976 SPR_NOACCESS
, SPR_NOACCESS
,
6977 &spr_read_generic
, &spr_write_generic
,
6980 /* XXX : not implemented */
6981 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6982 SPR_NOACCESS
, SPR_NOACCESS
,
6983 &spr_read_generic
, &spr_write_generic
,
6986 /* XXX : not implemented */
6987 spr_register(env
, SPR_PMC5
, "PMC5",
6988 SPR_NOACCESS
, SPR_NOACCESS
,
6989 &spr_read_generic
, &spr_write_generic
,
6991 /* XXX : not implemented */
6992 spr_register(env
, SPR_UPMC5
, "UPMC5",
6993 &spr_read_ureg
, SPR_NOACCESS
,
6994 &spr_read_ureg
, SPR_NOACCESS
,
6996 /* XXX : not implemented */
6997 spr_register(env
, SPR_PMC6
, "PMC6",
6998 SPR_NOACCESS
, SPR_NOACCESS
,
6999 &spr_read_generic
, &spr_write_generic
,
7001 /* XXX : not implemented */
7002 spr_register(env
, SPR_UPMC6
, "UPMC6",
7003 &spr_read_ureg
, SPR_NOACCESS
,
7004 &spr_read_ureg
, SPR_NOACCESS
,
7007 spr_register(env
, SPR_SPRG4
, "SPRG4",
7008 SPR_NOACCESS
, SPR_NOACCESS
,
7009 &spr_read_generic
, &spr_write_generic
,
7011 spr_register(env
, SPR_USPRG4
, "USPRG4",
7012 &spr_read_ureg
, SPR_NOACCESS
,
7013 &spr_read_ureg
, SPR_NOACCESS
,
7015 spr_register(env
, SPR_SPRG5
, "SPRG5",
7016 SPR_NOACCESS
, SPR_NOACCESS
,
7017 &spr_read_generic
, &spr_write_generic
,
7019 spr_register(env
, SPR_USPRG5
, "USPRG5",
7020 &spr_read_ureg
, SPR_NOACCESS
,
7021 &spr_read_ureg
, SPR_NOACCESS
,
7023 spr_register(env
, SPR_SPRG6
, "SPRG6",
7024 SPR_NOACCESS
, SPR_NOACCESS
,
7025 &spr_read_generic
, &spr_write_generic
,
7027 spr_register(env
, SPR_USPRG6
, "USPRG6",
7028 &spr_read_ureg
, SPR_NOACCESS
,
7029 &spr_read_ureg
, SPR_NOACCESS
,
7031 spr_register(env
, SPR_SPRG7
, "SPRG7",
7032 SPR_NOACCESS
, SPR_NOACCESS
,
7033 &spr_read_generic
, &spr_write_generic
,
7035 spr_register(env
, SPR_USPRG7
, "USPRG7",
7036 &spr_read_ureg
, SPR_NOACCESS
,
7037 &spr_read_ureg
, SPR_NOACCESS
,
7039 /* Memory management */
7042 gen_74xx_soft_tlb(env
, 128, 2);
7043 init_excp_7450(env
);
7044 env
->dcache_line_size
= 32;
7045 env
->icache_line_size
= 32;
7046 /* Allocate hardware IRQ controller */
7047 ppc6xx_irq_init(env
);
7050 POWERPC_FAMILY(7457)(ObjectClass
*oc
, void *data
)
7052 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7053 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7055 dc
->desc
= "PowerPC 7457 (aka G4)";
7056 pcc
->init_proc
= init_proc_7457
;
7057 pcc
->check_pow
= check_pow_hid0_74xx
;
7058 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7059 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7060 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7062 PPC_CACHE
| PPC_CACHE_ICBI
|
7063 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7064 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7065 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7066 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7067 PPC_SEGMENT
| PPC_EXTERN
|
7069 pcc
->msr_mask
= (1ull << MSR_VR
) |
7086 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7087 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7088 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7089 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7090 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7091 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7092 POWERPC_FLAG_BUS_CLK
;
7095 static void init_proc_e600 (CPUPPCState
*env
)
7097 gen_spr_ne_601(env
);
7101 /* 74xx specific SPR */
7103 /* XXX : not implemented */
7104 spr_register(env
, SPR_UBAMR
, "UBAMR",
7105 &spr_read_ureg
, SPR_NOACCESS
,
7106 &spr_read_ureg
, SPR_NOACCESS
,
7108 /* XXX : not implemented */
7109 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7110 SPR_NOACCESS
, SPR_NOACCESS
,
7111 &spr_read_generic
, &spr_write_generic
,
7113 /* XXX : not implemented */
7114 spr_register(env
, SPR_ICTRL
, "ICTRL",
7115 SPR_NOACCESS
, SPR_NOACCESS
,
7116 &spr_read_generic
, &spr_write_generic
,
7118 /* XXX : not implemented */
7119 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7120 SPR_NOACCESS
, SPR_NOACCESS
,
7121 &spr_read_generic
, &spr_write_generic
,
7123 /* XXX : not implemented */
7124 spr_register(env
, SPR_PMC5
, "PMC5",
7125 SPR_NOACCESS
, SPR_NOACCESS
,
7126 &spr_read_generic
, &spr_write_generic
,
7128 /* XXX : not implemented */
7129 spr_register(env
, SPR_UPMC5
, "UPMC5",
7130 &spr_read_ureg
, SPR_NOACCESS
,
7131 &spr_read_ureg
, SPR_NOACCESS
,
7133 /* XXX : not implemented */
7134 spr_register(env
, SPR_PMC6
, "PMC6",
7135 SPR_NOACCESS
, SPR_NOACCESS
,
7136 &spr_read_generic
, &spr_write_generic
,
7138 /* XXX : not implemented */
7139 spr_register(env
, SPR_UPMC6
, "UPMC6",
7140 &spr_read_ureg
, SPR_NOACCESS
,
7141 &spr_read_ureg
, SPR_NOACCESS
,
7144 spr_register(env
, SPR_SPRG4
, "SPRG4",
7145 SPR_NOACCESS
, SPR_NOACCESS
,
7146 &spr_read_generic
, &spr_write_generic
,
7148 spr_register(env
, SPR_USPRG4
, "USPRG4",
7149 &spr_read_ureg
, SPR_NOACCESS
,
7150 &spr_read_ureg
, SPR_NOACCESS
,
7152 spr_register(env
, SPR_SPRG5
, "SPRG5",
7153 SPR_NOACCESS
, SPR_NOACCESS
,
7154 &spr_read_generic
, &spr_write_generic
,
7156 spr_register(env
, SPR_USPRG5
, "USPRG5",
7157 &spr_read_ureg
, SPR_NOACCESS
,
7158 &spr_read_ureg
, SPR_NOACCESS
,
7160 spr_register(env
, SPR_SPRG6
, "SPRG6",
7161 SPR_NOACCESS
, SPR_NOACCESS
,
7162 &spr_read_generic
, &spr_write_generic
,
7164 spr_register(env
, SPR_USPRG6
, "USPRG6",
7165 &spr_read_ureg
, SPR_NOACCESS
,
7166 &spr_read_ureg
, SPR_NOACCESS
,
7168 spr_register(env
, SPR_SPRG7
, "SPRG7",
7169 SPR_NOACCESS
, SPR_NOACCESS
,
7170 &spr_read_generic
, &spr_write_generic
,
7172 spr_register(env
, SPR_USPRG7
, "USPRG7",
7173 &spr_read_ureg
, SPR_NOACCESS
,
7174 &spr_read_ureg
, SPR_NOACCESS
,
7176 /* Memory management */
7179 gen_74xx_soft_tlb(env
, 128, 2);
7180 init_excp_7450(env
);
7181 env
->dcache_line_size
= 32;
7182 env
->icache_line_size
= 32;
7183 /* Allocate hardware IRQ controller */
7184 ppc6xx_irq_init(env
);
7187 POWERPC_FAMILY(e600
)(ObjectClass
*oc
, void *data
)
7189 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7190 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7192 dc
->desc
= "PowerPC e600";
7193 pcc
->init_proc
= init_proc_e600
;
7194 pcc
->check_pow
= check_pow_hid0_74xx
;
7195 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7196 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7197 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7199 PPC_CACHE
| PPC_CACHE_ICBI
|
7200 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7201 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7202 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7203 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7204 PPC_SEGMENT
| PPC_EXTERN
|
7206 pcc
->insns_flags2
= PPC_NONE
;
7207 pcc
->msr_mask
= (1ull << MSR_VR
) |
7224 pcc
->mmu_model
= POWERPC_MMU_32B
;
7225 #if defined(CONFIG_SOFTMMU)
7226 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
7228 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7229 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7230 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7231 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7232 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7233 POWERPC_FLAG_BUS_CLK
;
7236 #if defined (TARGET_PPC64)
7237 #if defined(CONFIG_USER_ONLY)
7238 #define POWERPC970_HID5_INIT 0x00000080
7240 #define POWERPC970_HID5_INIT 0x00000000
7243 static int check_pow_970 (CPUPPCState
*env
)
7245 if (env
->spr
[SPR_HID0
] & 0x00600000)
7251 static void init_proc_970 (CPUPPCState
*env
)
7253 gen_spr_ne_601(env
);
7257 /* Hardware implementation registers */
7258 /* XXX : not implemented */
7259 spr_register(env
, SPR_HID0
, "HID0",
7260 SPR_NOACCESS
, SPR_NOACCESS
,
7261 &spr_read_generic
, &spr_write_clear
,
7263 /* XXX : not implemented */
7264 spr_register(env
, SPR_HID1
, "HID1",
7265 SPR_NOACCESS
, SPR_NOACCESS
,
7266 &spr_read_generic
, &spr_write_generic
,
7268 /* XXX : not implemented */
7269 spr_register(env
, SPR_970_HID5
, "HID5",
7270 SPR_NOACCESS
, SPR_NOACCESS
,
7271 &spr_read_generic
, &spr_write_generic
,
7272 POWERPC970_HID5_INIT
);
7273 /* Memory management */
7274 /* XXX: not correct */
7276 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7277 SPR_NOACCESS
, SPR_NOACCESS
,
7278 &spr_read_hior
, &spr_write_hior
,
7280 #if !defined(CONFIG_USER_ONLY)
7284 env
->dcache_line_size
= 128;
7285 env
->icache_line_size
= 128;
7286 /* Allocate hardware IRQ controller */
7287 ppc970_irq_init(env
);
7288 /* Can't find information on what this should be on reset. This
7289 * value is the one used by 74xx processors. */
7290 vscr_init(env
, 0x00010000);
7293 POWERPC_FAMILY(970)(ObjectClass
*oc
, void *data
)
7295 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7296 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7298 dc
->desc
= "PowerPC 970";
7299 pcc
->init_proc
= init_proc_970
;
7300 pcc
->check_pow
= check_pow_970
;
7301 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7302 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7303 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7305 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7306 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7307 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7308 PPC_64B
| PPC_ALTIVEC
|
7309 PPC_SEGMENT_64B
| PPC_SLBI
;
7310 pcc
->msr_mask
= (1ull << MSR_SF
) |
7326 pcc
->mmu_model
= POWERPC_MMU_64B
;
7327 #if defined(CONFIG_SOFTMMU)
7328 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7330 pcc
->excp_model
= POWERPC_EXCP_970
;
7331 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
7332 pcc
->bfd_mach
= bfd_mach_ppc64
;
7333 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7334 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7335 POWERPC_FLAG_BUS_CLK
;
7336 pcc
->l1_dcache_size
= 0x8000;
7337 pcc
->l1_icache_size
= 0x10000;
7340 static int check_pow_970FX (CPUPPCState
*env
)
7342 if (env
->spr
[SPR_HID0
] & 0x00600000)
7348 static void init_proc_970FX (CPUPPCState
*env
)
7350 gen_spr_ne_601(env
);
7354 /* Hardware implementation registers */
7355 /* XXX : not implemented */
7356 spr_register(env
, SPR_HID0
, "HID0",
7357 SPR_NOACCESS
, SPR_NOACCESS
,
7358 &spr_read_generic
, &spr_write_clear
,
7360 /* XXX : not implemented */
7361 spr_register(env
, SPR_HID1
, "HID1",
7362 SPR_NOACCESS
, SPR_NOACCESS
,
7363 &spr_read_generic
, &spr_write_generic
,
7365 /* XXX : not implemented */
7366 spr_register(env
, SPR_970_HID5
, "HID5",
7367 SPR_NOACCESS
, SPR_NOACCESS
,
7368 &spr_read_generic
, &spr_write_generic
,
7369 POWERPC970_HID5_INIT
);
7370 /* Memory management */
7371 /* XXX: not correct */
7373 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7374 SPR_NOACCESS
, SPR_NOACCESS
,
7375 &spr_read_hior
, &spr_write_hior
,
7377 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
7378 SPR_NOACCESS
, SPR_NOACCESS
,
7379 SPR_NOACCESS
, &spr_write_generic
,
7381 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
7382 SPR_NOACCESS
, SPR_NOACCESS
,
7383 &spr_read_generic
, SPR_NOACCESS
,
7385 spr_register(env
, SPR_VRSAVE
, "SPR_VRSAVE",
7386 &spr_read_generic
, &spr_write_generic
,
7387 &spr_read_generic
, &spr_write_generic
,
7389 #if !defined(CONFIG_USER_ONLY)
7393 env
->dcache_line_size
= 128;
7394 env
->icache_line_size
= 128;
7395 /* Allocate hardware IRQ controller */
7396 ppc970_irq_init(env
);
7397 /* Can't find information on what this should be on reset. This
7398 * value is the one used by 74xx processors. */
7399 vscr_init(env
, 0x00010000);
7402 POWERPC_FAMILY(970FX
)(ObjectClass
*oc
, void *data
)
7404 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7405 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7407 dc
->desc
= "PowerPC 970FX (aka G5)";
7408 pcc
->init_proc
= init_proc_970FX
;
7409 pcc
->check_pow
= check_pow_970FX
;
7410 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7411 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7412 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7414 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7415 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7416 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7417 PPC_64B
| PPC_ALTIVEC
|
7418 PPC_SEGMENT_64B
| PPC_SLBI
;
7419 pcc
->msr_mask
= (1ull << MSR_SF
) |
7434 pcc
->mmu_model
= POWERPC_MMU_64B
;
7435 #if defined(CONFIG_SOFTMMU)
7436 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7438 pcc
->excp_model
= POWERPC_EXCP_970
;
7439 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
7440 pcc
->bfd_mach
= bfd_mach_ppc64
;
7441 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7442 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7443 POWERPC_FLAG_BUS_CLK
;
7444 pcc
->l1_dcache_size
= 0x8000;
7445 pcc
->l1_icache_size
= 0x10000;
7448 static int check_pow_970MP (CPUPPCState
*env
)
7450 if (env
->spr
[SPR_HID0
] & 0x01C00000)
7456 static void init_proc_970MP (CPUPPCState
*env
)
7458 gen_spr_ne_601(env
);
7462 /* Hardware implementation registers */
7463 /* XXX : not implemented */
7464 spr_register(env
, SPR_HID0
, "HID0",
7465 SPR_NOACCESS
, SPR_NOACCESS
,
7466 &spr_read_generic
, &spr_write_clear
,
7468 /* XXX : not implemented */
7469 spr_register(env
, SPR_HID1
, "HID1",
7470 SPR_NOACCESS
, SPR_NOACCESS
,
7471 &spr_read_generic
, &spr_write_generic
,
7473 /* XXX : not implemented */
7474 spr_register(env
, SPR_970_HID5
, "HID5",
7475 SPR_NOACCESS
, SPR_NOACCESS
,
7476 &spr_read_generic
, &spr_write_generic
,
7477 POWERPC970_HID5_INIT
);
7478 /* XXX : not implemented */
7479 /* Memory management */
7480 /* XXX: not correct */
7482 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7483 SPR_NOACCESS
, SPR_NOACCESS
,
7484 &spr_read_hior
, &spr_write_hior
,
7486 /* Logical partitionning */
7487 spr_register_kvm(env
, SPR_LPCR
, "LPCR",
7488 SPR_NOACCESS
, SPR_NOACCESS
,
7489 &spr_read_generic
, &spr_write_generic
,
7490 KVM_REG_PPC_LPCR
, 0x00000000);
7491 #if !defined(CONFIG_USER_ONLY)
7495 env
->dcache_line_size
= 128;
7496 env
->icache_line_size
= 128;
7497 /* Allocate hardware IRQ controller */
7498 ppc970_irq_init(env
);
7499 /* Can't find information on what this should be on reset. This
7500 * value is the one used by 74xx processors. */
7501 vscr_init(env
, 0x00010000);
7504 POWERPC_FAMILY(970MP
)(ObjectClass
*oc
, void *data
)
7506 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7507 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7509 dc
->desc
= "PowerPC 970 MP";
7510 pcc
->init_proc
= init_proc_970MP
;
7511 pcc
->check_pow
= check_pow_970MP
;
7512 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7513 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7514 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7516 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7517 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7518 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7519 PPC_64B
| PPC_ALTIVEC
|
7520 PPC_SEGMENT_64B
| PPC_SLBI
;
7521 pcc
->msr_mask
= (1ull << MSR_SF
) |
7537 pcc
->mmu_model
= POWERPC_MMU_64B
;
7538 #if defined(CONFIG_SOFTMMU)
7539 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7541 pcc
->excp_model
= POWERPC_EXCP_970
;
7542 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
7543 pcc
->bfd_mach
= bfd_mach_ppc64
;
7544 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7545 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7546 POWERPC_FLAG_BUS_CLK
;
7547 pcc
->l1_dcache_size
= 0x8000;
7548 pcc
->l1_icache_size
= 0x10000;
7551 static void init_proc_power5plus(CPUPPCState
*env
)
7553 gen_spr_ne_601(env
);
7557 /* Hardware implementation registers */
7558 /* XXX : not implemented */
7559 spr_register(env
, SPR_HID0
, "HID0",
7560 SPR_NOACCESS
, SPR_NOACCESS
,
7561 &spr_read_generic
, &spr_write_clear
,
7563 /* XXX : not implemented */
7564 spr_register(env
, SPR_HID1
, "HID1",
7565 SPR_NOACCESS
, SPR_NOACCESS
,
7566 &spr_read_generic
, &spr_write_generic
,
7568 /* XXX : not implemented */
7569 spr_register(env
, SPR_970_HID5
, "HID5",
7570 SPR_NOACCESS
, SPR_NOACCESS
,
7571 &spr_read_generic
, &spr_write_generic
,
7572 POWERPC970_HID5_INIT
);
7573 /* Memory management */
7574 /* XXX: not correct */
7576 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7577 SPR_NOACCESS
, SPR_NOACCESS
,
7578 &spr_read_hior
, &spr_write_hior
,
7580 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
7581 SPR_NOACCESS
, SPR_NOACCESS
,
7582 SPR_NOACCESS
, &spr_write_generic
,
7584 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
7585 SPR_NOACCESS
, SPR_NOACCESS
,
7586 &spr_read_generic
, SPR_NOACCESS
,
7588 spr_register(env
, SPR_VRSAVE
, "SPR_VRSAVE",
7589 &spr_read_generic
, &spr_write_generic
,
7590 &spr_read_generic
, &spr_write_generic
,
7592 /* Logical partitionning */
7593 spr_register_kvm(env
, SPR_LPCR
, "LPCR",
7594 SPR_NOACCESS
, SPR_NOACCESS
,
7595 &spr_read_generic
, &spr_write_generic
,
7596 KVM_REG_PPC_LPCR
, 0x00000000);
7597 #if !defined(CONFIG_USER_ONLY)
7601 env
->dcache_line_size
= 128;
7602 env
->icache_line_size
= 128;
7603 /* Allocate hardware IRQ controller */
7604 ppc970_irq_init(env
);
7605 /* Can't find information on what this should be on reset. This
7606 * value is the one used by 74xx processors. */
7607 vscr_init(env
, 0x00010000);
7610 POWERPC_FAMILY(POWER5P
)(ObjectClass
*oc
, void *data
)
7612 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7613 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7615 dc
->fw_name
= "PowerPC,POWER5";
7616 dc
->desc
= "POWER5+";
7617 pcc
->init_proc
= init_proc_power5plus
;
7618 pcc
->check_pow
= check_pow_970FX
;
7619 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7620 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7621 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7623 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7624 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7625 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7627 PPC_SEGMENT_64B
| PPC_SLBI
;
7628 pcc
->msr_mask
= (1ull << MSR_SF
) |
7643 pcc
->mmu_model
= POWERPC_MMU_64B
;
7644 #if defined(CONFIG_SOFTMMU)
7645 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7647 pcc
->excp_model
= POWERPC_EXCP_970
;
7648 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
7649 pcc
->bfd_mach
= bfd_mach_ppc64
;
7650 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7651 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7652 POWERPC_FLAG_BUS_CLK
;
7653 pcc
->l1_dcache_size
= 0x8000;
7654 pcc
->l1_icache_size
= 0x10000;
7657 static void init_proc_POWER7 (CPUPPCState
*env
)
7659 gen_spr_ne_601(env
);
7663 /* Processor identification */
7664 spr_register(env
, SPR_PIR
, "PIR",
7665 SPR_NOACCESS
, SPR_NOACCESS
,
7666 &spr_read_generic
, &spr_write_pir
,
7668 #if !defined(CONFIG_USER_ONLY)
7669 /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
7670 spr_register_kvm(env
, SPR_PURR
, "PURR",
7671 &spr_read_purr
, SPR_NOACCESS
,
7672 &spr_read_purr
, SPR_NOACCESS
,
7673 KVM_REG_PPC_PURR
, 0x00000000);
7674 spr_register_kvm(env
, SPR_SPURR
, "SPURR",
7675 &spr_read_purr
, SPR_NOACCESS
,
7676 &spr_read_purr
, SPR_NOACCESS
,
7677 KVM_REG_PPC_SPURR
, 0x00000000);
7678 spr_register(env
, SPR_CFAR
, "SPR_CFAR",
7679 SPR_NOACCESS
, SPR_NOACCESS
,
7680 &spr_read_cfar
, &spr_write_cfar
,
7682 spr_register_kvm(env
, SPR_DSCR
, "SPR_DSCR",
7683 SPR_NOACCESS
, SPR_NOACCESS
,
7684 &spr_read_generic
, &spr_write_generic
,
7685 KVM_REG_PPC_DSCR
, 0x00000000);
7686 spr_register_kvm(env
, SPR_MMCRA
, "SPR_MMCRA",
7687 SPR_NOACCESS
, SPR_NOACCESS
,
7688 &spr_read_generic
, &spr_write_generic
,
7689 KVM_REG_PPC_MMCRA
, 0x00000000);
7690 spr_register_kvm(env
, SPR_PMC5
, "SPR_PMC5",
7691 SPR_NOACCESS
, SPR_NOACCESS
,
7692 &spr_read_generic
, &spr_write_generic
,
7693 KVM_REG_PPC_PMC5
, 0x00000000);
7694 spr_register_kvm(env
, SPR_PMC6
, "SPR_PMC6",
7695 SPR_NOACCESS
, SPR_NOACCESS
,
7696 &spr_read_generic
, &spr_write_generic
,
7697 KVM_REG_PPC_PMC6
, 0x00000000);
7698 #endif /* !CONFIG_USER_ONLY */
7700 /* XXX : not implemented */
7701 spr_register(env
, SPR_CTRL
, "SPR_CTRLT",
7702 SPR_NOACCESS
, SPR_NOACCESS
,
7703 SPR_NOACCESS
, &spr_write_generic
,
7705 spr_register(env
, SPR_UCTRL
, "SPR_CTRLF",
7706 SPR_NOACCESS
, SPR_NOACCESS
,
7707 &spr_read_generic
, SPR_NOACCESS
,
7709 spr_register(env
, SPR_VRSAVE
, "SPR_VRSAVE",
7710 &spr_read_generic
, &spr_write_generic
,
7711 &spr_read_generic
, &spr_write_generic
,
7713 spr_register(env
, SPR_PPR
, "PPR",
7714 &spr_read_generic
, &spr_write_generic
,
7715 &spr_read_generic
, &spr_write_generic
,
7717 /* Logical partitionning */
7718 spr_register_kvm(env
, SPR_LPCR
, "LPCR",
7719 SPR_NOACCESS
, SPR_NOACCESS
,
7720 &spr_read_generic
, &spr_write_generic
,
7721 KVM_REG_PPC_LPCR
, 0x00000000);
7722 #if !defined(CONFIG_USER_ONLY)
7725 init_excp_POWER7(env
);
7726 env
->dcache_line_size
= 128;
7727 env
->icache_line_size
= 128;
7729 /* Allocate hardware IRQ controller */
7730 ppcPOWER7_irq_init(env
);
7731 /* Can't find information on what this should be on reset. This
7732 * value is the one used by 74xx processors. */
7733 vscr_init(env
, 0x00010000);
7736 POWERPC_FAMILY(POWER7
)(ObjectClass
*oc
, void *data
)
7738 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7739 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7741 dc
->fw_name
= "PowerPC,POWER7";
7742 dc
->desc
= "POWER7";
7743 pcc
->pvr
= CPU_POWERPC_POWER7_BASE
;
7744 pcc
->pvr_mask
= CPU_POWERPC_POWER7_MASK
;
7745 pcc
->init_proc
= init_proc_POWER7
;
7746 pcc
->check_pow
= check_pow_nocheck
;
7747 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
7748 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7749 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7750 PPC_FLOAT_FRSQRTES
|
7753 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7754 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7755 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7756 PPC_64B
| PPC_ALTIVEC
|
7757 PPC_SEGMENT_64B
| PPC_SLBI
|
7758 PPC_POPCNTB
| PPC_POPCNTWD
;
7759 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
7760 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
7761 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
7763 pcc
->msr_mask
= (1ull << MSR_SF
) |
7779 pcc
->mmu_model
= POWERPC_MMU_2_06
;
7780 #if defined(CONFIG_SOFTMMU)
7781 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7783 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
7784 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
7785 pcc
->bfd_mach
= bfd_mach_ppc64
;
7786 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7787 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7788 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
7790 pcc
->l1_dcache_size
= 0x8000;
7791 pcc
->l1_icache_size
= 0x8000;
7794 POWERPC_FAMILY(POWER7P
)(ObjectClass
*oc
, void *data
)
7796 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7797 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7799 dc
->fw_name
= "PowerPC,POWER7+";
7800 dc
->desc
= "POWER7+";
7801 pcc
->pvr
= CPU_POWERPC_POWER7P_BASE
;
7802 pcc
->pvr_mask
= CPU_POWERPC_POWER7P_MASK
;
7803 pcc
->init_proc
= init_proc_POWER7
;
7804 pcc
->check_pow
= check_pow_nocheck
;
7805 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
7806 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7807 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7808 PPC_FLOAT_FRSQRTES
|
7811 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7812 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7813 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7814 PPC_64B
| PPC_ALTIVEC
|
7815 PPC_SEGMENT_64B
| PPC_SLBI
|
7816 PPC_POPCNTB
| PPC_POPCNTWD
;
7817 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
7818 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
7819 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
7821 pcc
->msr_mask
= (1ull << MSR_SF
) |
7837 pcc
->mmu_model
= POWERPC_MMU_2_06
;
7838 #if defined(CONFIG_SOFTMMU)
7839 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7841 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
7842 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
7843 pcc
->bfd_mach
= bfd_mach_ppc64
;
7844 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7845 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7846 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
7848 pcc
->l1_dcache_size
= 0x8000;
7849 pcc
->l1_icache_size
= 0x8000;
7852 static void init_proc_POWER8(CPUPPCState
*env
)
7855 init_proc_POWER7(env
);
7857 /* P8 supports the TAR */
7858 spr_register(env
, SPR_TAR
, "TAR",
7859 &spr_read_generic
, &spr_write_generic
,
7860 &spr_read_generic
, &spr_write_generic
,
7864 POWERPC_FAMILY(POWER8
)(ObjectClass
*oc
, void *data
)
7866 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7867 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7869 dc
->fw_name
= "PowerPC,POWER8";
7870 dc
->desc
= "POWER8";
7871 pcc
->pvr
= CPU_POWERPC_POWER8_BASE
;
7872 pcc
->pvr_mask
= CPU_POWERPC_POWER8_MASK
;
7873 pcc
->init_proc
= init_proc_POWER8
;
7874 pcc
->check_pow
= check_pow_nocheck
;
7875 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
7876 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7877 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7878 PPC_FLOAT_FRSQRTES
|
7881 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7882 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7883 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7884 PPC_64B
| PPC_64BX
| PPC_ALTIVEC
|
7885 PPC_SEGMENT_64B
| PPC_SLBI
|
7886 PPC_POPCNTB
| PPC_POPCNTWD
;
7887 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
7888 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
7889 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
7890 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
7891 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
7892 PPC2_ISA205
| PPC2_ISA207S
;
7893 pcc
->msr_mask
= (1ull << MSR_SF
) |
7909 pcc
->mmu_model
= POWERPC_MMU_2_06
;
7910 #if defined(CONFIG_SOFTMMU)
7911 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7913 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
7914 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
7915 pcc
->bfd_mach
= bfd_mach_ppc64
;
7916 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7917 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7918 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
7920 pcc
->l1_dcache_size
= 0x8000;
7921 pcc
->l1_icache_size
= 0x8000;
7923 #endif /* defined (TARGET_PPC64) */
7926 /*****************************************************************************/
7927 /* Generic CPU instantiation routine */
7928 static void init_ppc_proc(PowerPCCPU
*cpu
)
7930 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
7931 CPUPPCState
*env
= &cpu
->env
;
7932 #if !defined(CONFIG_USER_ONLY)
7935 env
->irq_inputs
= NULL
;
7936 /* Set all exception vectors to an invalid address */
7937 for (i
= 0; i
< POWERPC_EXCP_NB
; i
++)
7938 env
->excp_vectors
[i
] = (target_ulong
)(-1ULL);
7939 env
->ivor_mask
= 0x00000000;
7940 env
->ivpr_mask
= 0x00000000;
7941 /* Default MMU definitions */
7945 env
->tlb_type
= TLB_NONE
;
7947 /* Register SPR common to all PowerPC implementations */
7948 gen_spr_generic(env
);
7949 spr_register(env
, SPR_PVR
, "PVR",
7950 /* Linux permits userspace to read PVR */
7951 #if defined(CONFIG_LINUX_USER)
7957 &spr_read_generic
, SPR_NOACCESS
,
7959 /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
7960 if (pcc
->svr
!= POWERPC_SVR_NONE
) {
7961 if (pcc
->svr
& POWERPC_SVR_E500
) {
7962 spr_register(env
, SPR_E500_SVR
, "SVR",
7963 SPR_NOACCESS
, SPR_NOACCESS
,
7964 &spr_read_generic
, SPR_NOACCESS
,
7965 pcc
->svr
& ~POWERPC_SVR_E500
);
7967 spr_register(env
, SPR_SVR
, "SVR",
7968 SPR_NOACCESS
, SPR_NOACCESS
,
7969 &spr_read_generic
, SPR_NOACCESS
,
7973 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
7974 (*pcc
->init_proc
)(env
);
7976 /* MSR bits & flags consistency checks */
7977 if (env
->msr_mask
& (1 << 25)) {
7978 switch (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
7979 case POWERPC_FLAG_SPE
:
7980 case POWERPC_FLAG_VRE
:
7983 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7984 "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
7987 } else if (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
7988 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7989 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
7992 if (env
->msr_mask
& (1 << 17)) {
7993 switch (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
7994 case POWERPC_FLAG_TGPR
:
7995 case POWERPC_FLAG_CE
:
7998 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7999 "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
8002 } else if (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8003 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8004 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
8007 if (env
->msr_mask
& (1 << 10)) {
8008 switch (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8009 POWERPC_FLAG_UBLE
)) {
8010 case POWERPC_FLAG_SE
:
8011 case POWERPC_FLAG_DWE
:
8012 case POWERPC_FLAG_UBLE
:
8015 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8016 "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
8017 "POWERPC_FLAG_UBLE\n");
8020 } else if (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8021 POWERPC_FLAG_UBLE
)) {
8022 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8023 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
8024 "POWERPC_FLAG_UBLE\n");
8027 if (env
->msr_mask
& (1 << 9)) {
8028 switch (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8029 case POWERPC_FLAG_BE
:
8030 case POWERPC_FLAG_DE
:
8033 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8034 "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
8037 } else if (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8038 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8039 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
8042 if (env
->msr_mask
& (1 << 2)) {
8043 switch (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8044 case POWERPC_FLAG_PX
:
8045 case POWERPC_FLAG_PMM
:
8048 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8049 "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
8052 } else if (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8053 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8054 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
8057 if ((env
->flags
& (POWERPC_FLAG_RTC_CLK
| POWERPC_FLAG_BUS_CLK
)) == 0) {
8058 fprintf(stderr
, "PowerPC flags inconsistency\n"
8059 "Should define the time-base and decrementer clock source\n");
8062 /* Allocate TLBs buffer when needed */
8063 #if !defined(CONFIG_USER_ONLY)
8064 if (env
->nb_tlb
!= 0) {
8065 int nb_tlb
= env
->nb_tlb
;
8066 if (env
->id_tlbs
!= 0)
8068 switch (env
->tlb_type
) {
8070 env
->tlb
.tlb6
= g_malloc0(nb_tlb
* sizeof(ppc6xx_tlb_t
));
8073 env
->tlb
.tlbe
= g_malloc0(nb_tlb
* sizeof(ppcemb_tlb_t
));
8076 env
->tlb
.tlbm
= g_malloc0(nb_tlb
* sizeof(ppcmas_tlb_t
));
8079 /* Pre-compute some useful values */
8080 env
->tlb_per_way
= env
->nb_tlb
/ env
->nb_ways
;
8082 if (env
->irq_inputs
== NULL
) {
8083 fprintf(stderr
, "WARNING: no internal IRQ controller registered.\n"
8084 " Attempt QEMU to crash very soon !\n");
8087 if (env
->check_pow
== NULL
) {
8088 fprintf(stderr
, "WARNING: no power management check handler "
8090 " Attempt QEMU to crash very soon !\n");
8094 #if defined(PPC_DUMP_CPU)
8095 static void dump_ppc_sprs (CPUPPCState
*env
)
8098 #if !defined(CONFIG_USER_ONLY)
8104 printf("Special purpose registers:\n");
8105 for (i
= 0; i
< 32; i
++) {
8106 for (j
= 0; j
< 32; j
++) {
8108 spr
= &env
->spr_cb
[n
];
8109 uw
= spr
->uea_write
!= NULL
&& spr
->uea_write
!= SPR_NOACCESS
;
8110 ur
= spr
->uea_read
!= NULL
&& spr
->uea_read
!= SPR_NOACCESS
;
8111 #if !defined(CONFIG_USER_ONLY)
8112 sw
= spr
->oea_write
!= NULL
&& spr
->oea_write
!= SPR_NOACCESS
;
8113 sr
= spr
->oea_read
!= NULL
&& spr
->oea_read
!= SPR_NOACCESS
;
8114 if (sw
|| sr
|| uw
|| ur
) {
8115 printf("SPR: %4d (%03x) %-8s s%c%c u%c%c\n",
8116 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
8117 sw
? 'w' : '-', sr
? 'r' : '-',
8118 uw
? 'w' : '-', ur
? 'r' : '-');
8122 printf("SPR: %4d (%03x) %-8s u%c%c\n",
8123 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
8124 uw
? 'w' : '-', ur
? 'r' : '-');
8134 /*****************************************************************************/
8140 PPC_DIRECT
= 0, /* Opcode routine */
8141 PPC_INDIRECT
= 1, /* Indirect opcode table */
8144 static inline int is_indirect_opcode (void *handler
)
8146 return ((uintptr_t)handler
& 0x03) == PPC_INDIRECT
;
8149 static inline opc_handler_t
**ind_table(void *handler
)
8151 return (opc_handler_t
**)((uintptr_t)handler
& ~3);
8154 /* Instruction table creation */
8155 /* Opcodes tables creation */
8156 static void fill_new_table (opc_handler_t
**table
, int len
)
8160 for (i
= 0; i
< len
; i
++)
8161 table
[i
] = &invalid_handler
;
8164 static int create_new_table (opc_handler_t
**table
, unsigned char idx
)
8166 opc_handler_t
**tmp
;
8168 tmp
= g_new(opc_handler_t
*, 0x20);
8169 fill_new_table(tmp
, 0x20);
8170 table
[idx
] = (opc_handler_t
*)((uintptr_t)tmp
| PPC_INDIRECT
);
8175 static int insert_in_table (opc_handler_t
**table
, unsigned char idx
,
8176 opc_handler_t
*handler
)
8178 if (table
[idx
] != &invalid_handler
)
8180 table
[idx
] = handler
;
8185 static int register_direct_insn (opc_handler_t
**ppc_opcodes
,
8186 unsigned char idx
, opc_handler_t
*handler
)
8188 if (insert_in_table(ppc_opcodes
, idx
, handler
) < 0) {
8189 printf("*** ERROR: opcode %02x already assigned in main "
8190 "opcode table\n", idx
);
8191 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8192 printf(" Registered handler '%s' - new handler '%s'\n",
8193 ppc_opcodes
[idx
]->oname
, handler
->oname
);
8201 static int register_ind_in_table (opc_handler_t
**table
,
8202 unsigned char idx1
, unsigned char idx2
,
8203 opc_handler_t
*handler
)
8205 if (table
[idx1
] == &invalid_handler
) {
8206 if (create_new_table(table
, idx1
) < 0) {
8207 printf("*** ERROR: unable to create indirect table "
8208 "idx=%02x\n", idx1
);
8212 if (!is_indirect_opcode(table
[idx1
])) {
8213 printf("*** ERROR: idx %02x already assigned to a direct "
8215 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8216 printf(" Registered handler '%s' - new handler '%s'\n",
8217 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
8222 if (handler
!= NULL
&&
8223 insert_in_table(ind_table(table
[idx1
]), idx2
, handler
) < 0) {
8224 printf("*** ERROR: opcode %02x already assigned in "
8225 "opcode table %02x\n", idx2
, idx1
);
8226 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8227 printf(" Registered handler '%s' - new handler '%s'\n",
8228 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
8236 static int register_ind_insn (opc_handler_t
**ppc_opcodes
,
8237 unsigned char idx1
, unsigned char idx2
,
8238 opc_handler_t
*handler
)
8242 ret
= register_ind_in_table(ppc_opcodes
, idx1
, idx2
, handler
);
8247 static int register_dblind_insn (opc_handler_t
**ppc_opcodes
,
8248 unsigned char idx1
, unsigned char idx2
,
8249 unsigned char idx3
, opc_handler_t
*handler
)
8251 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
8252 printf("*** ERROR: unable to join indirect table idx "
8253 "[%02x-%02x]\n", idx1
, idx2
);
8256 if (register_ind_in_table(ind_table(ppc_opcodes
[idx1
]), idx2
, idx3
,
8258 printf("*** ERROR: unable to insert opcode "
8259 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
8266 static int register_insn (opc_handler_t
**ppc_opcodes
, opcode_t
*insn
)
8268 if (insn
->opc2
!= 0xFF) {
8269 if (insn
->opc3
!= 0xFF) {
8270 if (register_dblind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
8271 insn
->opc3
, &insn
->handler
) < 0)
8274 if (register_ind_insn(ppc_opcodes
, insn
->opc1
,
8275 insn
->opc2
, &insn
->handler
) < 0)
8279 if (register_direct_insn(ppc_opcodes
, insn
->opc1
, &insn
->handler
) < 0)
8286 static int test_opcode_table (opc_handler_t
**table
, int len
)
8290 for (i
= 0, count
= 0; i
< len
; i
++) {
8291 /* Consistency fixup */
8292 if (table
[i
] == NULL
)
8293 table
[i
] = &invalid_handler
;
8294 if (table
[i
] != &invalid_handler
) {
8295 if (is_indirect_opcode(table
[i
])) {
8296 tmp
= test_opcode_table(ind_table(table
[i
]), 0x20);
8299 table
[i
] = &invalid_handler
;
8312 static void fix_opcode_tables (opc_handler_t
**ppc_opcodes
)
8314 if (test_opcode_table(ppc_opcodes
, 0x40) == 0)
8315 printf("*** WARNING: no opcode defined !\n");
8318 /*****************************************************************************/
8319 static void create_ppc_opcodes(PowerPCCPU
*cpu
, Error
**errp
)
8321 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8322 CPUPPCState
*env
= &cpu
->env
;
8325 fill_new_table(env
->opcodes
, 0x40);
8326 for (opc
= opcodes
; opc
< &opcodes
[ARRAY_SIZE(opcodes
)]; opc
++) {
8327 if (((opc
->handler
.type
& pcc
->insns_flags
) != 0) ||
8328 ((opc
->handler
.type2
& pcc
->insns_flags2
) != 0)) {
8329 if (register_insn(env
->opcodes
, opc
) < 0) {
8330 error_setg(errp
, "ERROR initializing PowerPC instruction "
8331 "0x%02x 0x%02x 0x%02x", opc
->opc1
, opc
->opc2
,
8337 fix_opcode_tables(env
->opcodes
);
8342 #if defined(PPC_DUMP_CPU)
8343 static void dump_ppc_insns (CPUPPCState
*env
)
8345 opc_handler_t
**table
, *handler
;
8347 uint8_t opc1
, opc2
, opc3
;
8349 printf("Instructions set:\n");
8350 /* opc1 is 6 bits long */
8351 for (opc1
= 0x00; opc1
< 0x40; opc1
++) {
8352 table
= env
->opcodes
;
8353 handler
= table
[opc1
];
8354 if (is_indirect_opcode(handler
)) {
8355 /* opc2 is 5 bits long */
8356 for (opc2
= 0; opc2
< 0x20; opc2
++) {
8357 table
= env
->opcodes
;
8358 handler
= env
->opcodes
[opc1
];
8359 table
= ind_table(handler
);
8360 handler
= table
[opc2
];
8361 if (is_indirect_opcode(handler
)) {
8362 table
= ind_table(handler
);
8363 /* opc3 is 5 bits long */
8364 for (opc3
= 0; opc3
< 0x20; opc3
++) {
8365 handler
= table
[opc3
];
8366 if (handler
->handler
!= &gen_invalid
) {
8367 /* Special hack to properly dump SPE insns */
8368 p
= strchr(handler
->oname
, '_');
8370 printf("INSN: %02x %02x %02x (%02d %04d) : "
8372 opc1
, opc2
, opc3
, opc1
,
8377 if ((p
- handler
->oname
) != strlen(q
) ||
8378 memcmp(handler
->oname
, q
, strlen(q
)) != 0) {
8379 /* First instruction */
8380 printf("INSN: %02x %02x %02x (%02d %04d) : "
8382 opc1
, opc2
<< 1, opc3
, opc1
,
8383 (opc3
<< 6) | (opc2
<< 1),
8384 (int)(p
- handler
->oname
),
8387 if (strcmp(p
+ 1, q
) != 0) {
8388 /* Second instruction */
8389 printf("INSN: %02x %02x %02x (%02d %04d) : "
8391 opc1
, (opc2
<< 1) | 1, opc3
, opc1
,
8392 (opc3
<< 6) | (opc2
<< 1) | 1,
8399 if (handler
->handler
!= &gen_invalid
) {
8400 printf("INSN: %02x %02x -- (%02d %04d) : %s\n",
8401 opc1
, opc2
, opc1
, opc2
, handler
->oname
);
8406 if (handler
->handler
!= &gen_invalid
) {
8407 printf("INSN: %02x -- -- (%02d ----) : %s\n",
8408 opc1
, opc1
, handler
->oname
);
8415 static int gdb_get_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8418 stfq_p(mem_buf
, env
->fpr
[n
]);
8422 stl_p(mem_buf
, env
->fpscr
);
8428 static int gdb_set_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8431 env
->fpr
[n
] = ldfq_p(mem_buf
);
8435 helper_store_fpscr(env
, ldl_p(mem_buf
), 0xffffffff);
8441 static int gdb_get_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8444 #ifdef HOST_WORDS_BIGENDIAN
8445 stq_p(mem_buf
, env
->avr
[n
].u64
[0]);
8446 stq_p(mem_buf
+8, env
->avr
[n
].u64
[1]);
8448 stq_p(mem_buf
, env
->avr
[n
].u64
[1]);
8449 stq_p(mem_buf
+8, env
->avr
[n
].u64
[0]);
8454 stl_p(mem_buf
, env
->vscr
);
8458 stl_p(mem_buf
, (uint32_t)env
->spr
[SPR_VRSAVE
]);
8464 static int gdb_set_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8467 #ifdef HOST_WORDS_BIGENDIAN
8468 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
);
8469 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
+8);
8471 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
);
8472 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
+8);
8477 env
->vscr
= ldl_p(mem_buf
);
8481 env
->spr
[SPR_VRSAVE
] = (target_ulong
)ldl_p(mem_buf
);
8487 static int gdb_get_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8490 #if defined(TARGET_PPC64)
8491 stl_p(mem_buf
, env
->gpr
[n
] >> 32);
8493 stl_p(mem_buf
, env
->gprh
[n
]);
8498 stq_p(mem_buf
, env
->spe_acc
);
8502 stl_p(mem_buf
, env
->spe_fscr
);
8508 static int gdb_set_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8511 #if defined(TARGET_PPC64)
8512 target_ulong lo
= (uint32_t)env
->gpr
[n
];
8513 target_ulong hi
= (target_ulong
)ldl_p(mem_buf
) << 32;
8514 env
->gpr
[n
] = lo
| hi
;
8516 env
->gprh
[n
] = ldl_p(mem_buf
);
8521 env
->spe_acc
= ldq_p(mem_buf
);
8525 env
->spe_fscr
= ldl_p(mem_buf
);
8531 static int ppc_fixup_cpu(PowerPCCPU
*cpu
)
8533 CPUPPCState
*env
= &cpu
->env
;
8535 /* TCG doesn't (yet) emulate some groups of instructions that
8536 * are implemented on some otherwise supported CPUs (e.g. VSX
8537 * and decimal floating point instructions on POWER7). We
8538 * remove unsupported instruction groups from the cpu state's
8539 * instruction masks and hope the guest can cope. For at
8540 * least the pseries machine, the unavailability of these
8541 * instructions can be advertised to the guest via the device
8543 if ((env
->insns_flags
& ~PPC_TCG_INSNS
)
8544 || (env
->insns_flags2
& ~PPC_TCG_INSNS2
)) {
8545 fprintf(stderr
, "Warning: Disabling some instructions which are not "
8546 "emulated by TCG (0x%" PRIx64
", 0x%" PRIx64
")\n",
8547 env
->insns_flags
& ~PPC_TCG_INSNS
,
8548 env
->insns_flags2
& ~PPC_TCG_INSNS2
);
8550 env
->insns_flags
&= PPC_TCG_INSNS
;
8551 env
->insns_flags2
&= PPC_TCG_INSNS2
;
8555 static inline bool ppc_cpu_is_valid(PowerPCCPUClass
*pcc
)
8557 #ifdef TARGET_PPCEMB
8558 return pcc
->mmu_model
== POWERPC_MMU_BOOKE
||
8559 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx
||
8560 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx_Z
;
8566 static void ppc_cpu_realizefn(DeviceState
*dev
, Error
**errp
)
8568 CPUState
*cs
= CPU(dev
);
8569 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
8570 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8571 Error
*local_err
= NULL
;
8572 #if !defined(CONFIG_USER_ONLY)
8573 int max_smt
= kvm_enabled() ? kvmppc_smt_threads() : 1;
8576 #if !defined(CONFIG_USER_ONLY)
8577 if (smp_threads
> max_smt
) {
8578 error_setg(errp
, "Cannot support more than %d threads on PPC with %s",
8579 max_smt
, kvm_enabled() ? "KVM" : "TCG");
8582 if (!is_power_of_2(smp_threads
)) {
8583 error_setg(errp
, "Cannot support %d threads on PPC with %s, "
8584 "threads count must be a power of 2.",
8585 smp_threads
, kvm_enabled() ? "KVM" : "TCG");
8589 cpu
->cpu_dt_id
= (cs
->cpu_index
/ smp_threads
) * max_smt
8590 + (cs
->cpu_index
% smp_threads
);
8593 if (tcg_enabled()) {
8594 if (ppc_fixup_cpu(cpu
) != 0) {
8595 error_setg(errp
, "Unable to emulate selected CPU with TCG");
8600 #if defined(TARGET_PPCEMB)
8601 if (!ppc_cpu_is_valid(pcc
)) {
8602 error_setg(errp
, "CPU does not possess a BookE or 4xx MMU. "
8603 "Please use qemu-system-ppc or qemu-system-ppc64 instead "
8604 "or choose another CPU model.");
8609 create_ppc_opcodes(cpu
, &local_err
);
8610 if (local_err
!= NULL
) {
8611 error_propagate(errp
, local_err
);
8616 if (pcc
->insns_flags
& PPC_FLOAT
) {
8617 gdb_register_coprocessor(cs
, gdb_get_float_reg
, gdb_set_float_reg
,
8618 33, "power-fpu.xml", 0);
8620 if (pcc
->insns_flags
& PPC_ALTIVEC
) {
8621 gdb_register_coprocessor(cs
, gdb_get_avr_reg
, gdb_set_avr_reg
,
8622 34, "power-altivec.xml", 0);
8624 if (pcc
->insns_flags
& PPC_SPE
) {
8625 gdb_register_coprocessor(cs
, gdb_get_spe_reg
, gdb_set_spe_reg
,
8626 34, "power-spe.xml", 0);
8631 pcc
->parent_realize(dev
, errp
);
8633 #if defined(PPC_DUMP_CPU)
8635 CPUPPCState
*env
= &cpu
->env
;
8636 const char *mmu_model
, *excp_model
, *bus_model
;
8637 switch (env
->mmu_model
) {
8638 case POWERPC_MMU_32B
:
8639 mmu_model
= "PowerPC 32";
8641 case POWERPC_MMU_SOFT_6xx
:
8642 mmu_model
= "PowerPC 6xx/7xx with software driven TLBs";
8644 case POWERPC_MMU_SOFT_74xx
:
8645 mmu_model
= "PowerPC 74xx with software driven TLBs";
8647 case POWERPC_MMU_SOFT_4xx
:
8648 mmu_model
= "PowerPC 4xx with software driven TLBs";
8650 case POWERPC_MMU_SOFT_4xx_Z
:
8651 mmu_model
= "PowerPC 4xx with software driven TLBs "
8652 "and zones protections";
8654 case POWERPC_MMU_REAL
:
8655 mmu_model
= "PowerPC real mode only";
8657 case POWERPC_MMU_MPC8xx
:
8658 mmu_model
= "PowerPC MPC8xx";
8660 case POWERPC_MMU_BOOKE
:
8661 mmu_model
= "PowerPC BookE";
8663 case POWERPC_MMU_BOOKE206
:
8664 mmu_model
= "PowerPC BookE 2.06";
8666 case POWERPC_MMU_601
:
8667 mmu_model
= "PowerPC 601";
8669 #if defined (TARGET_PPC64)
8670 case POWERPC_MMU_64B
:
8671 mmu_model
= "PowerPC 64";
8675 mmu_model
= "Unknown or invalid";
8678 switch (env
->excp_model
) {
8679 case POWERPC_EXCP_STD
:
8680 excp_model
= "PowerPC";
8682 case POWERPC_EXCP_40x
:
8683 excp_model
= "PowerPC 40x";
8685 case POWERPC_EXCP_601
:
8686 excp_model
= "PowerPC 601";
8688 case POWERPC_EXCP_602
:
8689 excp_model
= "PowerPC 602";
8691 case POWERPC_EXCP_603
:
8692 excp_model
= "PowerPC 603";
8694 case POWERPC_EXCP_603E
:
8695 excp_model
= "PowerPC 603e";
8697 case POWERPC_EXCP_604
:
8698 excp_model
= "PowerPC 604";
8700 case POWERPC_EXCP_7x0
:
8701 excp_model
= "PowerPC 740/750";
8703 case POWERPC_EXCP_7x5
:
8704 excp_model
= "PowerPC 745/755";
8706 case POWERPC_EXCP_74xx
:
8707 excp_model
= "PowerPC 74xx";
8709 case POWERPC_EXCP_BOOKE
:
8710 excp_model
= "PowerPC BookE";
8712 #if defined (TARGET_PPC64)
8713 case POWERPC_EXCP_970
:
8714 excp_model
= "PowerPC 970";
8718 excp_model
= "Unknown or invalid";
8721 switch (env
->bus_model
) {
8722 case PPC_FLAGS_INPUT_6xx
:
8723 bus_model
= "PowerPC 6xx";
8725 case PPC_FLAGS_INPUT_BookE
:
8726 bus_model
= "PowerPC BookE";
8728 case PPC_FLAGS_INPUT_405
:
8729 bus_model
= "PowerPC 405";
8731 case PPC_FLAGS_INPUT_401
:
8732 bus_model
= "PowerPC 401/403";
8734 case PPC_FLAGS_INPUT_RCPU
:
8735 bus_model
= "RCPU / MPC8xx";
8737 #if defined (TARGET_PPC64)
8738 case PPC_FLAGS_INPUT_970
:
8739 bus_model
= "PowerPC 970";
8743 bus_model
= "Unknown or invalid";
8746 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64
"\n"
8747 " MMU model : %s\n",
8748 object_class_get_name(OBJECT_CLASS(pcc
)),
8749 pcc
->pvr
, pcc
->msr_mask
, mmu_model
);
8750 #if !defined(CONFIG_USER_ONLY)
8751 if (env
->tlb
.tlb6
) {
8752 printf(" %d %s TLB in %d ways\n",
8753 env
->nb_tlb
, env
->id_tlbs
? "splitted" : "merged",
8757 printf(" Exceptions model : %s\n"
8758 " Bus model : %s\n",
8759 excp_model
, bus_model
);
8760 printf(" MSR features :\n");
8761 if (env
->flags
& POWERPC_FLAG_SPE
)
8762 printf(" signal processing engine enable"
8764 else if (env
->flags
& POWERPC_FLAG_VRE
)
8765 printf(" vector processor enable\n");
8766 if (env
->flags
& POWERPC_FLAG_TGPR
)
8767 printf(" temporary GPRs\n");
8768 else if (env
->flags
& POWERPC_FLAG_CE
)
8769 printf(" critical input enable\n");
8770 if (env
->flags
& POWERPC_FLAG_SE
)
8771 printf(" single-step trace mode\n");
8772 else if (env
->flags
& POWERPC_FLAG_DWE
)
8773 printf(" debug wait enable\n");
8774 else if (env
->flags
& POWERPC_FLAG_UBLE
)
8775 printf(" user BTB lock enable\n");
8776 if (env
->flags
& POWERPC_FLAG_BE
)
8777 printf(" branch-step trace mode\n");
8778 else if (env
->flags
& POWERPC_FLAG_DE
)
8779 printf(" debug interrupt enable\n");
8780 if (env
->flags
& POWERPC_FLAG_PX
)
8781 printf(" inclusive protection\n");
8782 else if (env
->flags
& POWERPC_FLAG_PMM
)
8783 printf(" performance monitor mark\n");
8784 if (env
->flags
== POWERPC_FLAG_NONE
)
8786 printf(" Time-base/decrementer clock source: %s\n",
8787 env
->flags
& POWERPC_FLAG_RTC_CLK
? "RTC clock" : "bus clock");
8788 dump_ppc_insns(env
);
8795 static void ppc_cpu_unrealizefn(DeviceState
*dev
, Error
**errp
)
8797 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
8798 CPUPPCState
*env
= &cpu
->env
;
8801 for (i
= 0; i
< PPC_CPU_OPCODES_LEN
; i
++) {
8802 if (env
->opcodes
[i
] != &invalid_handler
) {
8803 g_free(env
->opcodes
[i
]);
8808 static gint
ppc_cpu_compare_class_pvr(gconstpointer a
, gconstpointer b
)
8810 ObjectClass
*oc
= (ObjectClass
*)a
;
8811 uint32_t pvr
= *(uint32_t *)b
;
8812 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
8814 /* -cpu host does a PVR lookup during construction */
8815 if (unlikely(strcmp(object_class_get_name(oc
),
8816 TYPE_HOST_POWERPC_CPU
) == 0)) {
8820 if (!ppc_cpu_is_valid(pcc
)) {
8824 return pcc
->pvr
== pvr
? 0 : -1;
8827 PowerPCCPUClass
*ppc_cpu_class_by_pvr(uint32_t pvr
)
8829 GSList
*list
, *item
;
8830 PowerPCCPUClass
*pcc
= NULL
;
8832 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
8833 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr
);
8835 pcc
= POWERPC_CPU_CLASS(item
->data
);
8842 static gint
ppc_cpu_compare_class_pvr_mask(gconstpointer a
, gconstpointer b
)
8844 ObjectClass
*oc
= (ObjectClass
*)a
;
8845 uint32_t pvr
= *(uint32_t *)b
;
8846 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
8849 /* -cpu host does a PVR lookup during construction */
8850 if (unlikely(strcmp(object_class_get_name(oc
),
8851 TYPE_HOST_POWERPC_CPU
) == 0)) {
8855 if (!ppc_cpu_is_valid(pcc
)) {
8859 ret
= (((pcc
->pvr
& pcc
->pvr_mask
) == (pvr
& pcc
->pvr_mask
)) ? 0 : -1);
8864 PowerPCCPUClass
*ppc_cpu_class_by_pvr_mask(uint32_t pvr
)
8866 GSList
*list
, *item
;
8867 PowerPCCPUClass
*pcc
= NULL
;
8869 list
= object_class_get_list(TYPE_POWERPC_CPU
, true);
8870 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr_mask
);
8872 pcc
= POWERPC_CPU_CLASS(item
->data
);
8879 static gint
ppc_cpu_compare_class_name(gconstpointer a
, gconstpointer b
)
8881 ObjectClass
*oc
= (ObjectClass
*)a
;
8882 const char *name
= b
;
8883 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8885 if (strncasecmp(name
, object_class_get_name(oc
), strlen(name
)) == 0 &&
8886 ppc_cpu_is_valid(pcc
) &&
8887 strcmp(object_class_get_name(oc
) + strlen(name
),
8888 "-" TYPE_POWERPC_CPU
) == 0) {
8896 static ObjectClass
*ppc_cpu_class_by_name(const char *name
);
8898 static ObjectClass
*ppc_cpu_class_by_alias(PowerPCCPUAlias
*alias
)
8900 ObjectClass
*invalid_class
= (void*)ppc_cpu_class_by_alias
;
8902 /* Cache target class lookups in the alias table */
8904 alias
->oc
= ppc_cpu_class_by_name(alias
->model
);
8906 /* Fast check for non-existing aliases */
8907 alias
->oc
= invalid_class
;
8911 if (alias
->oc
== invalid_class
) {
8918 static ObjectClass
*ppc_cpu_class_by_name(const char *name
)
8920 GSList
*list
, *item
;
8921 ObjectClass
*ret
= NULL
;
8925 /* Check if the given name is a PVR */
8927 if (len
== 10 && name
[0] == '0' && name
[1] == 'x') {
8930 } else if (len
== 8) {
8933 for (i
= 0; i
< 8; i
++) {
8934 if (!qemu_isxdigit(*p
++))
8938 ret
= OBJECT_CLASS(ppc_cpu_class_by_pvr(strtoul(name
, NULL
, 16)));
8943 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
8944 item
= g_slist_find_custom(list
, name
, ppc_cpu_compare_class_name
);
8946 ret
= OBJECT_CLASS(item
->data
);
8954 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
8955 if (strcmp(ppc_cpu_aliases
[i
].alias
, name
) == 0) {
8956 return ppc_cpu_class_by_alias(&ppc_cpu_aliases
[i
]);
8963 PowerPCCPU
*cpu_ppc_init(const char *cpu_model
)
8965 return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU
, cpu_model
));
8968 /* Sort by PVR, ordering special case "host" last. */
8969 static gint
ppc_cpu_list_compare(gconstpointer a
, gconstpointer b
)
8971 ObjectClass
*oc_a
= (ObjectClass
*)a
;
8972 ObjectClass
*oc_b
= (ObjectClass
*)b
;
8973 PowerPCCPUClass
*pcc_a
= POWERPC_CPU_CLASS(oc_a
);
8974 PowerPCCPUClass
*pcc_b
= POWERPC_CPU_CLASS(oc_b
);
8975 const char *name_a
= object_class_get_name(oc_a
);
8976 const char *name_b
= object_class_get_name(oc_b
);
8978 if (strcmp(name_a
, TYPE_HOST_POWERPC_CPU
) == 0) {
8980 } else if (strcmp(name_b
, TYPE_HOST_POWERPC_CPU
) == 0) {
8983 /* Avoid an integer overflow during subtraction */
8984 if (pcc_a
->pvr
< pcc_b
->pvr
) {
8986 } else if (pcc_a
->pvr
> pcc_b
->pvr
) {
8994 static void ppc_cpu_list_entry(gpointer data
, gpointer user_data
)
8996 ObjectClass
*oc
= data
;
8997 CPUListState
*s
= user_data
;
8998 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8999 const char *typename
= object_class_get_name(oc
);
9003 if (!ppc_cpu_is_valid(pcc
)) {
9006 if (unlikely(strcmp(typename
, TYPE_HOST_POWERPC_CPU
) == 0)) {
9010 name
= g_strndup(typename
,
9011 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
9012 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s PVR %08x\n",
9014 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9015 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
9016 ObjectClass
*alias_oc
= ppc_cpu_class_by_alias(alias
);
9018 if (alias_oc
!= oc
) {
9021 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s (alias for %s)\n",
9022 alias
->alias
, name
);
9027 void ppc_cpu_list(FILE *f
, fprintf_function cpu_fprintf
)
9031 .cpu_fprintf
= cpu_fprintf
,
9035 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9036 list
= g_slist_sort(list
, ppc_cpu_list_compare
);
9037 g_slist_foreach(list
, ppc_cpu_list_entry
, &s
);
9041 cpu_fprintf(f
, "\n");
9042 cpu_fprintf(f
, "PowerPC %-16s\n", "host");
9046 static void ppc_cpu_defs_entry(gpointer data
, gpointer user_data
)
9048 ObjectClass
*oc
= data
;
9049 CpuDefinitionInfoList
**first
= user_data
;
9050 const char *typename
;
9051 CpuDefinitionInfoList
*entry
;
9052 CpuDefinitionInfo
*info
;
9053 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9055 if (!ppc_cpu_is_valid(pcc
)) {
9059 typename
= object_class_get_name(oc
);
9060 info
= g_malloc0(sizeof(*info
));
9061 info
->name
= g_strndup(typename
,
9062 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
9064 entry
= g_malloc0(sizeof(*entry
));
9065 entry
->value
= info
;
9066 entry
->next
= *first
;
9070 CpuDefinitionInfoList
*arch_query_cpu_definitions(Error
**errp
)
9072 CpuDefinitionInfoList
*cpu_list
= NULL
;
9076 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9077 g_slist_foreach(list
, ppc_cpu_defs_entry
, &cpu_list
);
9080 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9081 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
9083 CpuDefinitionInfoList
*entry
;
9084 CpuDefinitionInfo
*info
;
9086 oc
= ppc_cpu_class_by_alias(alias
);
9091 info
= g_malloc0(sizeof(*info
));
9092 info
->name
= g_strdup(alias
->alias
);
9094 entry
= g_malloc0(sizeof(*entry
));
9095 entry
->value
= info
;
9096 entry
->next
= cpu_list
;
9103 static void ppc_cpu_set_pc(CPUState
*cs
, vaddr value
)
9105 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9107 cpu
->env
.nip
= value
;
9110 static bool ppc_cpu_has_work(CPUState
*cs
)
9112 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9113 CPUPPCState
*env
= &cpu
->env
;
9115 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
9118 /* CPUClass::reset() */
9119 static void ppc_cpu_reset(CPUState
*s
)
9121 PowerPCCPU
*cpu
= POWERPC_CPU(s
);
9122 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9123 CPUPPCState
*env
= &cpu
->env
;
9127 pcc
->parent_reset(s
);
9129 msr
= (target_ulong
)0;
9131 /* XXX: find a suitable condition to enable the hypervisor mode */
9132 msr
|= (target_ulong
)MSR_HVB
;
9134 msr
|= (target_ulong
)0 << MSR_AP
; /* TO BE CHECKED */
9135 msr
|= (target_ulong
)0 << MSR_SA
; /* TO BE CHECKED */
9136 msr
|= (target_ulong
)1 << MSR_EP
;
9137 #if defined(DO_SINGLE_STEP) && 0
9138 /* Single step trace mode */
9139 msr
|= (target_ulong
)1 << MSR_SE
;
9140 msr
|= (target_ulong
)1 << MSR_BE
;
9142 #if defined(CONFIG_USER_ONLY)
9143 msr
|= (target_ulong
)1 << MSR_FP
; /* Allow floating point usage */
9144 msr
|= (target_ulong
)1 << MSR_VR
; /* Allow altivec usage */
9145 msr
|= (target_ulong
)1 << MSR_SPE
; /* Allow SPE usage */
9146 msr
|= (target_ulong
)1 << MSR_PR
;
9149 #if defined(TARGET_PPC64)
9150 if (env
->mmu_model
& POWERPC_MMU_64
) {
9151 env
->msr
|= (1ULL << MSR_SF
);
9155 hreg_store_msr(env
, msr
, 1);
9157 #if !defined(CONFIG_USER_ONLY)
9158 env
->nip
= env
->hreset_vector
| env
->excp_prefix
;
9159 if (env
->mmu_model
!= POWERPC_MMU_REAL
) {
9160 ppc_tlb_invalidate_all(env
);
9164 hreg_compute_hflags(env
);
9165 env
->reserve_addr
= (target_ulong
)-1ULL;
9166 /* Be sure no exception or interrupt is pending */
9167 env
->pending_interrupts
= 0;
9168 s
->exception_index
= POWERPC_EXCP_NONE
;
9169 env
->error_code
= 0;
9171 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
9173 env
->slb_shadow_addr
= 0;
9174 env
->slb_shadow_size
= 0;
9177 #endif /* TARGET_PPC64 */
9179 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
9180 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
9185 env
->spr
[i
] = spr
->default_value
;
9188 /* Flush all TLBs */
9192 static void ppc_cpu_initfn(Object
*obj
)
9194 CPUState
*cs
= CPU(obj
);
9195 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
9196 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9197 CPUPPCState
*env
= &cpu
->env
;
9201 cpu
->cpu_dt_id
= cs
->cpu_index
;
9203 env
->msr_mask
= pcc
->msr_mask
;
9204 env
->mmu_model
= pcc
->mmu_model
;
9205 env
->excp_model
= pcc
->excp_model
;
9206 env
->bus_model
= pcc
->bus_model
;
9207 env
->insns_flags
= pcc
->insns_flags
;
9208 env
->insns_flags2
= pcc
->insns_flags2
;
9209 env
->flags
= pcc
->flags
;
9210 env
->bfd_mach
= pcc
->bfd_mach
;
9211 env
->check_pow
= pcc
->check_pow
;
9213 #if defined(TARGET_PPC64)
9215 env
->sps
= *pcc
->sps
;
9216 } else if (env
->mmu_model
& POWERPC_MMU_64
) {
9217 /* Use default sets of page sizes */
9218 static const struct ppc_segment_page_sizes defsps
= {
9220 { .page_shift
= 12, /* 4K */
9222 .enc
= { { .page_shift
= 12, .pte_enc
= 0 } }
9224 { .page_shift
= 24, /* 16M */
9226 .enc
= { { .page_shift
= 24, .pte_enc
= 0 } }
9232 #endif /* defined(TARGET_PPC64) */
9234 if (tcg_enabled()) {
9235 ppc_translate_init();
9239 static void ppc_cpu_class_init(ObjectClass
*oc
, void *data
)
9241 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9242 CPUClass
*cc
= CPU_CLASS(oc
);
9243 DeviceClass
*dc
= DEVICE_CLASS(oc
);
9245 pcc
->parent_realize
= dc
->realize
;
9246 pcc
->pvr
= CPU_POWERPC_DEFAULT_MASK
;
9247 pcc
->pvr_mask
= CPU_POWERPC_DEFAULT_MASK
;
9248 dc
->realize
= ppc_cpu_realizefn
;
9249 dc
->unrealize
= ppc_cpu_unrealizefn
;
9251 pcc
->parent_reset
= cc
->reset
;
9252 cc
->reset
= ppc_cpu_reset
;
9254 cc
->class_by_name
= ppc_cpu_class_by_name
;
9255 cc
->has_work
= ppc_cpu_has_work
;
9256 cc
->do_interrupt
= ppc_cpu_do_interrupt
;
9257 cc
->dump_state
= ppc_cpu_dump_state
;
9258 cc
->dump_statistics
= ppc_cpu_dump_statistics
;
9259 cc
->set_pc
= ppc_cpu_set_pc
;
9260 cc
->gdb_read_register
= ppc_cpu_gdb_read_register
;
9261 cc
->gdb_write_register
= ppc_cpu_gdb_write_register
;
9262 #ifdef CONFIG_USER_ONLY
9263 cc
->handle_mmu_fault
= ppc_cpu_handle_mmu_fault
;
9265 cc
->get_phys_page_debug
= ppc_cpu_get_phys_page_debug
;
9266 cc
->vmsd
= &vmstate_ppc_cpu
;
9267 #if defined(TARGET_PPC64)
9268 cc
->write_elf64_note
= ppc64_cpu_write_elf64_note
;
9269 cc
->write_elf64_qemunote
= ppc64_cpu_write_elf64_qemunote
;
9273 cc
->gdb_num_core_regs
= 71;
9274 #if defined(TARGET_PPC64)
9275 cc
->gdb_core_xml_file
= "power64-core.xml";
9277 cc
->gdb_core_xml_file
= "power-core.xml";
9280 dc
->fw_name
= "PowerPC,UNKNOWN";
9283 static const TypeInfo ppc_cpu_type_info
= {
9284 .name
= TYPE_POWERPC_CPU
,
9286 .instance_size
= sizeof(PowerPCCPU
),
9287 .instance_init
= ppc_cpu_initfn
,
9289 .class_size
= sizeof(PowerPCCPUClass
),
9290 .class_init
= ppc_cpu_class_init
,
9293 static void ppc_cpu_register_types(void)
9295 type_register_static(&ppc_cpu_type_info
);
9298 type_init(ppc_cpu_register_types
)