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 uint32_t l1cfg1
= 0x3800 /* 8 ways */
4655 | 0x0020; /* 32 kb */
4656 #if !defined(CONFIG_USER_ONLY)
4663 * XXX The e500 doesn't implement IVOR7 and IVOR9, but doesn't
4664 * complain when accessing them.
4665 * gen_spr_BookE(env, 0x0000000F0000FD7FULL);
4671 ivor_mask
= 0x0000000F0000FFFFULL
;
4675 ivor_mask
= 0x000003FE0000FFFFULL
;
4678 gen_spr_BookE(env
, ivor_mask
);
4679 /* Processor identification */
4680 spr_register(env
, SPR_BOOKE_PIR
, "PIR",
4681 SPR_NOACCESS
, SPR_NOACCESS
,
4682 &spr_read_generic
, &spr_write_pir
,
4684 /* XXX : not implemented */
4685 spr_register(env
, SPR_BOOKE_SPEFSCR
, "SPEFSCR",
4686 &spr_read_spefscr
, &spr_write_spefscr
,
4687 &spr_read_spefscr
, &spr_write_spefscr
,
4689 #if !defined(CONFIG_USER_ONLY)
4690 /* Memory management */
4696 tlbncfg
[0] = gen_tlbncfg(2, 1, 1, 0, 256);
4697 tlbncfg
[1] = gen_tlbncfg(16, 1, 9, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4700 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4701 tlbncfg
[1] = gen_tlbncfg(16, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 16);
4705 tlbncfg
[0] = gen_tlbncfg(4, 1, 1, 0, 512);
4706 tlbncfg
[1] = gen_tlbncfg(64, 1, 12, TLBnCFG_AVAIL
| TLBnCFG_IPROT
, 64);
4709 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4716 env
->dcache_line_size
= 32;
4717 env
->icache_line_size
= 32;
4721 env
->dcache_line_size
= 64;
4722 env
->icache_line_size
= 64;
4723 l1cfg0
|= 0x1000000; /* 64 byte cache block size */
4724 l1cfg1
|= 0x1000000; /* 64 byte cache block size */
4727 cpu_abort(CPU(cpu
), "Unknown CPU: " TARGET_FMT_lx
"\n", env
->spr
[SPR_PVR
]);
4729 gen_spr_BookE206(env
, 0x000000DF, tlbncfg
);
4730 /* XXX : not implemented */
4731 spr_register(env
, SPR_HID0
, "HID0",
4732 SPR_NOACCESS
, SPR_NOACCESS
,
4733 &spr_read_generic
, &spr_write_generic
,
4735 /* XXX : not implemented */
4736 spr_register(env
, SPR_HID1
, "HID1",
4737 SPR_NOACCESS
, SPR_NOACCESS
,
4738 &spr_read_generic
, &spr_write_generic
,
4740 /* XXX : not implemented */
4741 spr_register(env
, SPR_Exxx_BBEAR
, "BBEAR",
4742 SPR_NOACCESS
, SPR_NOACCESS
,
4743 &spr_read_generic
, &spr_write_generic
,
4745 /* XXX : not implemented */
4746 spr_register(env
, SPR_Exxx_BBTAR
, "BBTAR",
4747 SPR_NOACCESS
, SPR_NOACCESS
,
4748 &spr_read_generic
, &spr_write_generic
,
4750 /* XXX : not implemented */
4751 spr_register(env
, SPR_Exxx_MCAR
, "MCAR",
4752 SPR_NOACCESS
, SPR_NOACCESS
,
4753 &spr_read_generic
, &spr_write_generic
,
4755 /* XXX : not implemented */
4756 spr_register(env
, SPR_BOOKE_MCSR
, "MCSR",
4757 SPR_NOACCESS
, SPR_NOACCESS
,
4758 &spr_read_generic
, &spr_write_generic
,
4760 /* XXX : not implemented */
4761 spr_register(env
, SPR_Exxx_NPIDR
, "NPIDR",
4762 SPR_NOACCESS
, SPR_NOACCESS
,
4763 &spr_read_generic
, &spr_write_generic
,
4765 /* XXX : not implemented */
4766 spr_register(env
, SPR_Exxx_BUCSR
, "BUCSR",
4767 SPR_NOACCESS
, SPR_NOACCESS
,
4768 &spr_read_generic
, &spr_write_generic
,
4770 /* XXX : not implemented */
4771 spr_register(env
, SPR_Exxx_L1CFG0
, "L1CFG0",
4772 &spr_read_generic
, SPR_NOACCESS
,
4773 &spr_read_generic
, SPR_NOACCESS
,
4775 spr_register(env
, SPR_Exxx_L1CFG1
, "L1CFG1",
4776 &spr_read_generic
, SPR_NOACCESS
,
4777 &spr_read_generic
, SPR_NOACCESS
,
4779 spr_register(env
, SPR_Exxx_L1CSR0
, "L1CSR0",
4780 SPR_NOACCESS
, SPR_NOACCESS
,
4781 &spr_read_generic
, &spr_write_e500_l1csr0
,
4783 /* XXX : not implemented */
4784 spr_register(env
, SPR_Exxx_L1CSR1
, "L1CSR1",
4785 SPR_NOACCESS
, SPR_NOACCESS
,
4786 &spr_read_generic
, &spr_write_generic
,
4788 spr_register(env
, SPR_BOOKE_MCSRR0
, "MCSRR0",
4789 SPR_NOACCESS
, SPR_NOACCESS
,
4790 &spr_read_generic
, &spr_write_generic
,
4792 spr_register(env
, SPR_BOOKE_MCSRR1
, "MCSRR1",
4793 SPR_NOACCESS
, SPR_NOACCESS
,
4794 &spr_read_generic
, &spr_write_generic
,
4796 spr_register(env
, SPR_MMUCSR0
, "MMUCSR0",
4797 SPR_NOACCESS
, SPR_NOACCESS
,
4798 &spr_read_generic
, &spr_write_booke206_mmucsr0
,
4800 spr_register(env
, SPR_BOOKE_EPR
, "EPR",
4801 SPR_NOACCESS
, SPR_NOACCESS
,
4802 &spr_read_generic
, SPR_NOACCESS
,
4804 /* XXX better abstract into Emb.xxx features */
4805 if (version
== fsl_e5500
) {
4806 spr_register(env
, SPR_BOOKE_EPCR
, "EPCR",
4807 SPR_NOACCESS
, SPR_NOACCESS
,
4808 &spr_read_generic
, &spr_write_generic
,
4810 spr_register(env
, SPR_BOOKE_MAS7_MAS3
, "MAS7_MAS3",
4811 SPR_NOACCESS
, SPR_NOACCESS
,
4812 &spr_read_mas73
, &spr_write_mas73
,
4814 ivpr_mask
= (target_ulong
)~0xFFFFULL
;
4817 #if !defined(CONFIG_USER_ONLY)
4819 env
->tlb_type
= TLB_MAS
;
4820 for (i
= 0; i
< BOOKE206_MAX_TLBN
; i
++) {
4821 env
->nb_tlb
+= booke206_tlb_size(env
, i
);
4825 init_excp_e200(env
, ivpr_mask
);
4826 /* Allocate hardware IRQ controller */
4827 ppce500_irq_init(env
);
4830 static void init_proc_e500v1(CPUPPCState
*env
)
4832 init_proc_e500(env
, fsl_e500v1
);
4835 POWERPC_FAMILY(e500v1
)(ObjectClass
*oc
, void *data
)
4837 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4838 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4840 dc
->desc
= "e500v1 core";
4841 pcc
->init_proc
= init_proc_e500v1
;
4842 pcc
->check_pow
= check_pow_hid0
;
4843 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4844 PPC_SPE
| PPC_SPE_SINGLE
|
4845 PPC_WRTEE
| PPC_RFDI
|
4846 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4847 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4848 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
4849 pcc
->insns_flags2
= PPC2_BOOKE206
;
4850 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4864 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4865 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4866 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4867 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4868 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4869 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4870 POWERPC_FLAG_BUS_CLK
;
4873 static void init_proc_e500v2(CPUPPCState
*env
)
4875 init_proc_e500(env
, fsl_e500v2
);
4878 POWERPC_FAMILY(e500v2
)(ObjectClass
*oc
, void *data
)
4880 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4881 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4883 dc
->desc
= "e500v2 core";
4884 pcc
->init_proc
= init_proc_e500v2
;
4885 pcc
->check_pow
= check_pow_hid0
;
4886 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4887 PPC_SPE
| PPC_SPE_SINGLE
| PPC_SPE_DOUBLE
|
4888 PPC_WRTEE
| PPC_RFDI
|
4889 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4890 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4891 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
4892 pcc
->insns_flags2
= PPC2_BOOKE206
;
4893 pcc
->msr_mask
= (1ull << MSR_UCLE
) |
4907 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4908 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4909 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4910 pcc
->bfd_mach
= bfd_mach_ppc_860
;
4911 pcc
->flags
= POWERPC_FLAG_SPE
| POWERPC_FLAG_CE
|
4912 POWERPC_FLAG_UBLE
| POWERPC_FLAG_DE
|
4913 POWERPC_FLAG_BUS_CLK
;
4916 static void init_proc_e500mc(CPUPPCState
*env
)
4918 init_proc_e500(env
, fsl_e500mc
);
4921 POWERPC_FAMILY(e500mc
)(ObjectClass
*oc
, void *data
)
4923 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4924 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4926 dc
->desc
= "e500mc core";
4927 pcc
->init_proc
= init_proc_e500mc
;
4928 pcc
->check_pow
= check_pow_none
;
4929 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4930 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
4931 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4932 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4933 PPC_FLOAT
| PPC_FLOAT_FRES
|
4934 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
4935 PPC_FLOAT_STFIWX
| PPC_WAIT
|
4936 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
;
4937 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
;
4938 pcc
->msr_mask
= (1ull << MSR_GS
) |
4939 (1ull << MSR_UCLE
) |
4952 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
4953 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
4954 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
4955 /* FIXME: figure out the correct flag for e500mc */
4956 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
4957 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
4958 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
4962 static void init_proc_e5500(CPUPPCState
*env
)
4964 init_proc_e500(env
, fsl_e5500
);
4967 POWERPC_FAMILY(e5500
)(ObjectClass
*oc
, void *data
)
4969 DeviceClass
*dc
= DEVICE_CLASS(oc
);
4970 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
4972 dc
->desc
= "e5500 core";
4973 pcc
->init_proc
= init_proc_e5500
;
4974 pcc
->check_pow
= check_pow_none
;
4975 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
|
4976 PPC_WRTEE
| PPC_RFDI
| PPC_RFMCI
|
4977 PPC_CACHE
| PPC_CACHE_LOCK
| PPC_CACHE_ICBI
|
4978 PPC_CACHE_DCBZ
| PPC_CACHE_DCBA
|
4979 PPC_FLOAT
| PPC_FLOAT_FRES
|
4980 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_FSEL
|
4981 PPC_FLOAT_STFIWX
| PPC_WAIT
|
4982 PPC_MEM_TLBSYNC
| PPC_TLBIVAX
| PPC_MEM_SYNC
|
4983 PPC_64B
| PPC_POPCNTB
| PPC_POPCNTWD
;
4984 pcc
->insns_flags2
= PPC2_BOOKE206
| PPC2_PRCNTL
| PPC2_PERM_ISA206
;
4985 pcc
->msr_mask
= (1ull << MSR_CM
) |
4987 (1ull << MSR_UCLE
) |
5000 pcc
->mmu_model
= POWERPC_MMU_BOOKE206
;
5001 pcc
->excp_model
= POWERPC_EXCP_BOOKE
;
5002 pcc
->bus_model
= PPC_FLAGS_INPUT_BookE
;
5003 /* FIXME: figure out the correct flag for e5500 */
5004 pcc
->bfd_mach
= bfd_mach_ppc_e500
;
5005 pcc
->flags
= POWERPC_FLAG_CE
| POWERPC_FLAG_DE
|
5006 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5010 /* Non-embedded PowerPC */
5012 /* POWER : same as 601, without mfmsr, mfsr */
5013 POWERPC_FAMILY(POWER
)(ObjectClass
*oc
, void *data
)
5015 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5016 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5019 /* pcc->insns_flags = XXX_TODO; */
5020 /* POWER RSC (from RAD6000) */
5021 pcc
->msr_mask
= (1ull << MSR_EE
) |
5034 #define POWERPC_MSRR_601 (0x0000000000001040ULL)
5036 static void init_proc_601 (CPUPPCState
*env
)
5038 gen_spr_ne_601(env
);
5040 /* Hardware implementation registers */
5041 /* XXX : not implemented */
5042 spr_register(env
, SPR_HID0
, "HID0",
5043 SPR_NOACCESS
, SPR_NOACCESS
,
5044 &spr_read_generic
, &spr_write_hid0_601
,
5046 /* XXX : not implemented */
5047 spr_register(env
, SPR_HID1
, "HID1",
5048 SPR_NOACCESS
, SPR_NOACCESS
,
5049 &spr_read_generic
, &spr_write_generic
,
5051 /* XXX : not implemented */
5052 spr_register(env
, SPR_601_HID2
, "HID2",
5053 SPR_NOACCESS
, SPR_NOACCESS
,
5054 &spr_read_generic
, &spr_write_generic
,
5056 /* XXX : not implemented */
5057 spr_register(env
, SPR_601_HID5
, "HID5",
5058 SPR_NOACCESS
, SPR_NOACCESS
,
5059 &spr_read_generic
, &spr_write_generic
,
5061 /* Memory management */
5063 /* XXX: beware that dcache line size is 64
5064 * but dcbz uses 32 bytes "sectors"
5065 * XXX: this breaks clcs instruction !
5067 env
->dcache_line_size
= 32;
5068 env
->icache_line_size
= 64;
5069 /* Allocate hardware IRQ controller */
5070 ppc6xx_irq_init(env
);
5073 POWERPC_FAMILY(601)(ObjectClass
*oc
, void *data
)
5075 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5076 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5078 dc
->desc
= "PowerPC 601";
5079 pcc
->init_proc
= init_proc_601
;
5080 pcc
->check_pow
= check_pow_none
;
5081 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5083 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5084 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5085 PPC_SEGMENT
| PPC_EXTERN
;
5086 pcc
->msr_mask
= (1ull << MSR_EE
) |
5096 pcc
->mmu_model
= POWERPC_MMU_601
;
5097 #if defined(CONFIG_SOFTMMU)
5098 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5100 pcc
->excp_model
= POWERPC_EXCP_601
;
5101 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5102 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5103 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5106 #define POWERPC_MSRR_601v (0x0000000000001040ULL)
5108 static void init_proc_601v (CPUPPCState
*env
)
5111 /* XXX : not implemented */
5112 spr_register(env
, SPR_601_HID15
, "HID15",
5113 SPR_NOACCESS
, SPR_NOACCESS
,
5114 &spr_read_generic
, &spr_write_generic
,
5118 POWERPC_FAMILY(601v
)(ObjectClass
*oc
, void *data
)
5120 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5121 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5123 dc
->desc
= "PowerPC 601v";
5124 pcc
->init_proc
= init_proc_601v
;
5125 pcc
->check_pow
= check_pow_none
;
5126 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_POWER_BR
|
5128 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5129 PPC_MEM_SYNC
| PPC_MEM_EIEIO
| PPC_MEM_TLBIE
|
5130 PPC_SEGMENT
| PPC_EXTERN
;
5131 pcc
->msr_mask
= (1ull << MSR_EE
) |
5141 pcc
->mmu_model
= POWERPC_MMU_601
;
5142 #if defined(CONFIG_SOFTMMU)
5143 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5145 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5146 pcc
->bfd_mach
= bfd_mach_ppc_601
;
5147 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_RTC_CLK
;
5150 static void init_proc_602 (CPUPPCState
*env
)
5152 gen_spr_ne_601(env
);
5156 /* hardware implementation registers */
5157 /* XXX : not implemented */
5158 spr_register(env
, SPR_HID0
, "HID0",
5159 SPR_NOACCESS
, SPR_NOACCESS
,
5160 &spr_read_generic
, &spr_write_generic
,
5162 /* XXX : not implemented */
5163 spr_register(env
, SPR_HID1
, "HID1",
5164 SPR_NOACCESS
, SPR_NOACCESS
,
5165 &spr_read_generic
, &spr_write_generic
,
5167 /* Memory management */
5169 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5171 env
->dcache_line_size
= 32;
5172 env
->icache_line_size
= 32;
5173 /* Allocate hardware IRQ controller */
5174 ppc6xx_irq_init(env
);
5177 POWERPC_FAMILY(602)(ObjectClass
*oc
, void *data
)
5179 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5180 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5182 dc
->desc
= "PowerPC 602";
5183 pcc
->init_proc
= init_proc_602
;
5184 pcc
->check_pow
= check_pow_hid0
;
5185 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5186 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5187 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5188 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5189 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5190 PPC_MEM_TLBIE
| PPC_6xx_TLB
| PPC_MEM_TLBSYNC
|
5191 PPC_SEGMENT
| PPC_602_SPEC
;
5192 pcc
->msr_mask
= (1ull << MSR_VSX
) |
5195 (1ull << MSR_TGPR
) |
5210 /* XXX: 602 MMU is quite specific. Should add a special case */
5211 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5212 pcc
->excp_model
= POWERPC_EXCP_602
;
5213 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5214 pcc
->bfd_mach
= bfd_mach_ppc_602
;
5215 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5216 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5219 static void init_proc_603 (CPUPPCState
*env
)
5221 gen_spr_ne_601(env
);
5225 /* hardware implementation registers */
5226 /* XXX : not implemented */
5227 spr_register(env
, SPR_HID0
, "HID0",
5228 SPR_NOACCESS
, SPR_NOACCESS
,
5229 &spr_read_generic
, &spr_write_generic
,
5231 /* XXX : not implemented */
5232 spr_register(env
, SPR_HID1
, "HID1",
5233 SPR_NOACCESS
, SPR_NOACCESS
,
5234 &spr_read_generic
, &spr_write_generic
,
5236 /* Memory management */
5238 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5240 env
->dcache_line_size
= 32;
5241 env
->icache_line_size
= 32;
5242 /* Allocate hardware IRQ controller */
5243 ppc6xx_irq_init(env
);
5246 POWERPC_FAMILY(603)(ObjectClass
*oc
, void *data
)
5248 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5249 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5251 dc
->desc
= "PowerPC 603";
5252 pcc
->init_proc
= init_proc_603
;
5253 pcc
->check_pow
= check_pow_hid0
;
5254 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5255 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5256 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5257 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5258 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5259 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5260 PPC_SEGMENT
| PPC_EXTERN
;
5261 pcc
->msr_mask
= (1ull << MSR_POW
) |
5262 (1ull << MSR_TGPR
) |
5277 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5278 pcc
->excp_model
= POWERPC_EXCP_603
;
5279 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5280 pcc
->bfd_mach
= bfd_mach_ppc_603
;
5281 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5282 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5285 static void init_proc_603E (CPUPPCState
*env
)
5287 gen_spr_ne_601(env
);
5291 /* hardware implementation registers */
5292 /* XXX : not implemented */
5293 spr_register(env
, SPR_HID0
, "HID0",
5294 SPR_NOACCESS
, SPR_NOACCESS
,
5295 &spr_read_generic
, &spr_write_generic
,
5297 /* XXX : not implemented */
5298 spr_register(env
, SPR_HID1
, "HID1",
5299 SPR_NOACCESS
, SPR_NOACCESS
,
5300 &spr_read_generic
, &spr_write_generic
,
5302 /* Memory management */
5304 gen_6xx_7xx_soft_tlb(env
, 64, 2);
5306 env
->dcache_line_size
= 32;
5307 env
->icache_line_size
= 32;
5308 /* Allocate hardware IRQ controller */
5309 ppc6xx_irq_init(env
);
5312 POWERPC_FAMILY(603E
)(ObjectClass
*oc
, void *data
)
5314 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5315 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5317 dc
->desc
= "PowerPC 603e";
5318 pcc
->init_proc
= init_proc_603E
;
5319 pcc
->check_pow
= check_pow_hid0
;
5320 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5321 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5322 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5323 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5324 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5325 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
5326 PPC_SEGMENT
| PPC_EXTERN
;
5327 pcc
->msr_mask
= (1ull << MSR_POW
) |
5328 (1ull << MSR_TGPR
) |
5343 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
5344 pcc
->excp_model
= POWERPC_EXCP_603E
;
5345 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5346 pcc
->bfd_mach
= bfd_mach_ppc_ec603e
;
5347 pcc
->flags
= POWERPC_FLAG_TGPR
| POWERPC_FLAG_SE
|
5348 POWERPC_FLAG_BE
| POWERPC_FLAG_BUS_CLK
;
5351 static void init_proc_604 (CPUPPCState
*env
)
5353 gen_spr_ne_601(env
);
5357 /* Hardware implementation registers */
5358 /* XXX : not implemented */
5359 spr_register(env
, SPR_HID0
, "HID0",
5360 SPR_NOACCESS
, SPR_NOACCESS
,
5361 &spr_read_generic
, &spr_write_generic
,
5363 /* Memory management */
5366 env
->dcache_line_size
= 32;
5367 env
->icache_line_size
= 32;
5368 /* Allocate hardware IRQ controller */
5369 ppc6xx_irq_init(env
);
5372 POWERPC_FAMILY(604)(ObjectClass
*oc
, void *data
)
5374 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5375 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5377 dc
->desc
= "PowerPC 604";
5378 pcc
->init_proc
= init_proc_604
;
5379 pcc
->check_pow
= check_pow_nocheck
;
5380 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5381 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5382 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5383 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5384 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5385 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5386 PPC_SEGMENT
| PPC_EXTERN
;
5387 pcc
->msr_mask
= (1ull << MSR_POW
) |
5403 pcc
->mmu_model
= POWERPC_MMU_32B
;
5404 #if defined(CONFIG_SOFTMMU)
5405 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5407 pcc
->excp_model
= POWERPC_EXCP_604
;
5408 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5409 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5410 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5411 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5414 static void init_proc_604E (CPUPPCState
*env
)
5416 gen_spr_ne_601(env
);
5418 /* XXX : not implemented */
5419 spr_register(env
, SPR_MMCR1
, "MMCR1",
5420 SPR_NOACCESS
, SPR_NOACCESS
,
5421 &spr_read_generic
, &spr_write_generic
,
5423 /* XXX : not implemented */
5424 spr_register(env
, SPR_PMC3
, "PMC3",
5425 SPR_NOACCESS
, SPR_NOACCESS
,
5426 &spr_read_generic
, &spr_write_generic
,
5428 /* XXX : not implemented */
5429 spr_register(env
, SPR_PMC4
, "PMC4",
5430 SPR_NOACCESS
, SPR_NOACCESS
,
5431 &spr_read_generic
, &spr_write_generic
,
5435 /* Hardware implementation registers */
5436 /* XXX : not implemented */
5437 spr_register(env
, SPR_HID0
, "HID0",
5438 SPR_NOACCESS
, SPR_NOACCESS
,
5439 &spr_read_generic
, &spr_write_generic
,
5441 /* XXX : not implemented */
5442 spr_register(env
, SPR_HID1
, "HID1",
5443 SPR_NOACCESS
, SPR_NOACCESS
,
5444 &spr_read_generic
, &spr_write_generic
,
5446 /* Memory management */
5449 env
->dcache_line_size
= 32;
5450 env
->icache_line_size
= 32;
5451 /* Allocate hardware IRQ controller */
5452 ppc6xx_irq_init(env
);
5455 POWERPC_FAMILY(604E
)(ObjectClass
*oc
, void *data
)
5457 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5458 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5460 dc
->desc
= "PowerPC 604E";
5461 pcc
->init_proc
= init_proc_604E
;
5462 pcc
->check_pow
= check_pow_nocheck
;
5463 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5464 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5465 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5466 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5467 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5468 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5469 PPC_SEGMENT
| PPC_EXTERN
;
5470 pcc
->msr_mask
= (1ull << MSR_POW
) |
5486 pcc
->mmu_model
= POWERPC_MMU_32B
;
5487 #if defined(CONFIG_SOFTMMU)
5488 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5490 pcc
->excp_model
= POWERPC_EXCP_604
;
5491 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5492 pcc
->bfd_mach
= bfd_mach_ppc_604
;
5493 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5494 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5497 static void init_proc_740 (CPUPPCState
*env
)
5499 gen_spr_ne_601(env
);
5503 /* Thermal management */
5505 /* Hardware implementation registers */
5506 /* XXX : not implemented */
5507 spr_register(env
, SPR_HID0
, "HID0",
5508 SPR_NOACCESS
, SPR_NOACCESS
,
5509 &spr_read_generic
, &spr_write_generic
,
5511 /* XXX : not implemented */
5512 spr_register(env
, SPR_HID1
, "HID1",
5513 SPR_NOACCESS
, SPR_NOACCESS
,
5514 &spr_read_generic
, &spr_write_generic
,
5516 /* Memory management */
5519 env
->dcache_line_size
= 32;
5520 env
->icache_line_size
= 32;
5521 /* Allocate hardware IRQ controller */
5522 ppc6xx_irq_init(env
);
5525 POWERPC_FAMILY(740)(ObjectClass
*oc
, void *data
)
5527 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5528 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5530 dc
->desc
= "PowerPC 740";
5531 pcc
->init_proc
= init_proc_740
;
5532 pcc
->check_pow
= check_pow_hid0
;
5533 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5534 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5535 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5536 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5537 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5538 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5539 PPC_SEGMENT
| PPC_EXTERN
;
5540 pcc
->msr_mask
= (1ull << MSR_POW
) |
5556 pcc
->mmu_model
= POWERPC_MMU_32B
;
5557 #if defined(CONFIG_SOFTMMU)
5558 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5560 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5561 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5562 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5563 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5564 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5567 static void init_proc_750 (CPUPPCState
*env
)
5569 gen_spr_ne_601(env
);
5571 /* XXX : not implemented */
5572 spr_register(env
, SPR_L2CR
, "L2CR",
5573 SPR_NOACCESS
, SPR_NOACCESS
,
5574 &spr_read_generic
, spr_access_nop
,
5578 /* Thermal management */
5580 /* Hardware implementation registers */
5581 /* XXX : not implemented */
5582 spr_register(env
, SPR_HID0
, "HID0",
5583 SPR_NOACCESS
, SPR_NOACCESS
,
5584 &spr_read_generic
, &spr_write_generic
,
5586 /* XXX : not implemented */
5587 spr_register(env
, SPR_HID1
, "HID1",
5588 SPR_NOACCESS
, SPR_NOACCESS
,
5589 &spr_read_generic
, &spr_write_generic
,
5591 /* Memory management */
5593 /* XXX: high BATs are also present but are known to be bugged on
5597 env
->dcache_line_size
= 32;
5598 env
->icache_line_size
= 32;
5599 /* Allocate hardware IRQ controller */
5600 ppc6xx_irq_init(env
);
5603 POWERPC_FAMILY(750)(ObjectClass
*oc
, void *data
)
5605 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5606 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5608 dc
->desc
= "PowerPC 750";
5609 pcc
->init_proc
= init_proc_750
;
5610 pcc
->check_pow
= check_pow_hid0
;
5611 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5612 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5613 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5614 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5615 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5616 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5617 PPC_SEGMENT
| PPC_EXTERN
;
5618 pcc
->msr_mask
= (1ull << MSR_POW
) |
5634 pcc
->mmu_model
= POWERPC_MMU_32B
;
5635 #if defined(CONFIG_SOFTMMU)
5636 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5638 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5639 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5640 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5641 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5642 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5645 static void init_proc_750cl (CPUPPCState
*env
)
5647 gen_spr_ne_601(env
);
5649 /* XXX : not implemented */
5650 spr_register(env
, SPR_L2CR
, "L2CR",
5651 SPR_NOACCESS
, SPR_NOACCESS
,
5652 &spr_read_generic
, spr_access_nop
,
5656 /* Thermal management */
5657 /* Those registers are fake on 750CL */
5658 spr_register(env
, SPR_THRM1
, "THRM1",
5659 SPR_NOACCESS
, SPR_NOACCESS
,
5660 &spr_read_generic
, &spr_write_generic
,
5662 spr_register(env
, SPR_THRM2
, "THRM2",
5663 SPR_NOACCESS
, SPR_NOACCESS
,
5664 &spr_read_generic
, &spr_write_generic
,
5666 spr_register(env
, SPR_THRM3
, "THRM3",
5667 SPR_NOACCESS
, SPR_NOACCESS
,
5668 &spr_read_generic
, &spr_write_generic
,
5670 /* XXX: not implemented */
5671 spr_register(env
, SPR_750_TDCL
, "TDCL",
5672 SPR_NOACCESS
, SPR_NOACCESS
,
5673 &spr_read_generic
, &spr_write_generic
,
5675 spr_register(env
, SPR_750_TDCH
, "TDCH",
5676 SPR_NOACCESS
, SPR_NOACCESS
,
5677 &spr_read_generic
, &spr_write_generic
,
5680 /* XXX : not implemented */
5681 spr_register(env
, SPR_750_WPAR
, "WPAR",
5682 SPR_NOACCESS
, SPR_NOACCESS
,
5683 &spr_read_generic
, &spr_write_generic
,
5685 spr_register(env
, SPR_750_DMAL
, "DMAL",
5686 SPR_NOACCESS
, SPR_NOACCESS
,
5687 &spr_read_generic
, &spr_write_generic
,
5689 spr_register(env
, SPR_750_DMAU
, "DMAU",
5690 SPR_NOACCESS
, SPR_NOACCESS
,
5691 &spr_read_generic
, &spr_write_generic
,
5693 /* Hardware implementation registers */
5694 /* XXX : not implemented */
5695 spr_register(env
, SPR_HID0
, "HID0",
5696 SPR_NOACCESS
, SPR_NOACCESS
,
5697 &spr_read_generic
, &spr_write_generic
,
5699 /* XXX : not implemented */
5700 spr_register(env
, SPR_HID1
, "HID1",
5701 SPR_NOACCESS
, SPR_NOACCESS
,
5702 &spr_read_generic
, &spr_write_generic
,
5704 /* XXX : not implemented */
5705 spr_register(env
, SPR_750CL_HID2
, "HID2",
5706 SPR_NOACCESS
, SPR_NOACCESS
,
5707 &spr_read_generic
, &spr_write_generic
,
5709 /* XXX : not implemented */
5710 spr_register(env
, SPR_750CL_HID4
, "HID4",
5711 SPR_NOACCESS
, SPR_NOACCESS
,
5712 &spr_read_generic
, &spr_write_generic
,
5714 /* Quantization registers */
5715 /* XXX : not implemented */
5716 spr_register(env
, SPR_750_GQR0
, "GQR0",
5717 SPR_NOACCESS
, SPR_NOACCESS
,
5718 &spr_read_generic
, &spr_write_generic
,
5720 /* XXX : not implemented */
5721 spr_register(env
, SPR_750_GQR1
, "GQR1",
5722 SPR_NOACCESS
, SPR_NOACCESS
,
5723 &spr_read_generic
, &spr_write_generic
,
5725 /* XXX : not implemented */
5726 spr_register(env
, SPR_750_GQR2
, "GQR2",
5727 SPR_NOACCESS
, SPR_NOACCESS
,
5728 &spr_read_generic
, &spr_write_generic
,
5730 /* XXX : not implemented */
5731 spr_register(env
, SPR_750_GQR3
, "GQR3",
5732 SPR_NOACCESS
, SPR_NOACCESS
,
5733 &spr_read_generic
, &spr_write_generic
,
5735 /* XXX : not implemented */
5736 spr_register(env
, SPR_750_GQR4
, "GQR4",
5737 SPR_NOACCESS
, SPR_NOACCESS
,
5738 &spr_read_generic
, &spr_write_generic
,
5740 /* XXX : not implemented */
5741 spr_register(env
, SPR_750_GQR5
, "GQR5",
5742 SPR_NOACCESS
, SPR_NOACCESS
,
5743 &spr_read_generic
, &spr_write_generic
,
5745 /* XXX : not implemented */
5746 spr_register(env
, SPR_750_GQR6
, "GQR6",
5747 SPR_NOACCESS
, SPR_NOACCESS
,
5748 &spr_read_generic
, &spr_write_generic
,
5750 /* XXX : not implemented */
5751 spr_register(env
, SPR_750_GQR7
, "GQR7",
5752 SPR_NOACCESS
, SPR_NOACCESS
,
5753 &spr_read_generic
, &spr_write_generic
,
5755 /* Memory management */
5757 /* PowerPC 750cl has 8 DBATs and 8 IBATs */
5759 init_excp_750cl(env
);
5760 env
->dcache_line_size
= 32;
5761 env
->icache_line_size
= 32;
5762 /* Allocate hardware IRQ controller */
5763 ppc6xx_irq_init(env
);
5766 POWERPC_FAMILY(750cl
)(ObjectClass
*oc
, void *data
)
5768 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5769 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5771 dc
->desc
= "PowerPC 750 CL";
5772 pcc
->init_proc
= init_proc_750cl
;
5773 pcc
->check_pow
= check_pow_hid0
;
5774 /* XXX: not implemented:
5775 * cache lock instructions:
5777 * floating point paired instructions
5812 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5813 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5814 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5815 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5816 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5817 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5818 PPC_SEGMENT
| PPC_EXTERN
;
5819 pcc
->msr_mask
= (1ull << MSR_POW
) |
5835 pcc
->mmu_model
= POWERPC_MMU_32B
;
5836 #if defined(CONFIG_SOFTMMU)
5837 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5839 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5840 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5841 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5842 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5843 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5846 static void init_proc_750cx (CPUPPCState
*env
)
5848 gen_spr_ne_601(env
);
5850 /* XXX : not implemented */
5851 spr_register(env
, SPR_L2CR
, "L2CR",
5852 SPR_NOACCESS
, SPR_NOACCESS
,
5853 &spr_read_generic
, spr_access_nop
,
5857 /* Thermal management */
5859 /* This register is not implemented but is present for compatibility */
5860 spr_register(env
, SPR_SDA
, "SDA",
5861 SPR_NOACCESS
, SPR_NOACCESS
,
5862 &spr_read_generic
, &spr_write_generic
,
5864 /* Hardware implementation registers */
5865 /* XXX : not implemented */
5866 spr_register(env
, SPR_HID0
, "HID0",
5867 SPR_NOACCESS
, SPR_NOACCESS
,
5868 &spr_read_generic
, &spr_write_generic
,
5870 /* XXX : not implemented */
5871 spr_register(env
, SPR_HID1
, "HID1",
5872 SPR_NOACCESS
, SPR_NOACCESS
,
5873 &spr_read_generic
, &spr_write_generic
,
5875 /* Memory management */
5877 /* PowerPC 750cx has 8 DBATs and 8 IBATs */
5879 init_excp_750cx(env
);
5880 env
->dcache_line_size
= 32;
5881 env
->icache_line_size
= 32;
5882 /* Allocate hardware IRQ controller */
5883 ppc6xx_irq_init(env
);
5886 POWERPC_FAMILY(750cx
)(ObjectClass
*oc
, void *data
)
5888 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5889 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5891 dc
->desc
= "PowerPC 750CX";
5892 pcc
->init_proc
= init_proc_750cx
;
5893 pcc
->check_pow
= check_pow_hid0
;
5894 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5895 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5896 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5897 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5898 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5899 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5900 PPC_SEGMENT
| PPC_EXTERN
;
5901 pcc
->msr_mask
= (1ull << MSR_POW
) |
5917 pcc
->mmu_model
= POWERPC_MMU_32B
;
5918 #if defined(CONFIG_SOFTMMU)
5919 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
5921 pcc
->excp_model
= POWERPC_EXCP_7x0
;
5922 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
5923 pcc
->bfd_mach
= bfd_mach_ppc_750
;
5924 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
5925 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
5928 static void init_proc_750fx (CPUPPCState
*env
)
5930 gen_spr_ne_601(env
);
5932 /* XXX : not implemented */
5933 spr_register(env
, SPR_L2CR
, "L2CR",
5934 SPR_NOACCESS
, SPR_NOACCESS
,
5935 &spr_read_generic
, spr_access_nop
,
5939 /* Thermal management */
5941 /* XXX : not implemented */
5942 spr_register(env
, SPR_750_THRM4
, "THRM4",
5943 SPR_NOACCESS
, SPR_NOACCESS
,
5944 &spr_read_generic
, &spr_write_generic
,
5946 /* Hardware implementation registers */
5947 /* XXX : not implemented */
5948 spr_register(env
, SPR_HID0
, "HID0",
5949 SPR_NOACCESS
, SPR_NOACCESS
,
5950 &spr_read_generic
, &spr_write_generic
,
5952 /* XXX : not implemented */
5953 spr_register(env
, SPR_HID1
, "HID1",
5954 SPR_NOACCESS
, SPR_NOACCESS
,
5955 &spr_read_generic
, &spr_write_generic
,
5957 /* XXX : not implemented */
5958 spr_register(env
, SPR_750FX_HID2
, "HID2",
5959 SPR_NOACCESS
, SPR_NOACCESS
,
5960 &spr_read_generic
, &spr_write_generic
,
5962 /* Memory management */
5964 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
5967 env
->dcache_line_size
= 32;
5968 env
->icache_line_size
= 32;
5969 /* Allocate hardware IRQ controller */
5970 ppc6xx_irq_init(env
);
5973 POWERPC_FAMILY(750fx
)(ObjectClass
*oc
, void *data
)
5975 DeviceClass
*dc
= DEVICE_CLASS(oc
);
5976 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
5978 dc
->desc
= "PowerPC 750FX";
5979 pcc
->init_proc
= init_proc_750fx
;
5980 pcc
->check_pow
= check_pow_hid0
;
5981 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
5982 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
5983 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
5984 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
5985 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
5986 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
5987 PPC_SEGMENT
| PPC_EXTERN
;
5988 pcc
->msr_mask
= (1ull << MSR_POW
) |
6004 pcc
->mmu_model
= POWERPC_MMU_32B
;
6005 #if defined(CONFIG_SOFTMMU)
6006 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6008 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6009 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6010 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6011 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6012 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6015 static void init_proc_750gx (CPUPPCState
*env
)
6017 gen_spr_ne_601(env
);
6019 /* XXX : not implemented (XXX: different from 750fx) */
6020 spr_register(env
, SPR_L2CR
, "L2CR",
6021 SPR_NOACCESS
, SPR_NOACCESS
,
6022 &spr_read_generic
, spr_access_nop
,
6026 /* Thermal management */
6028 /* XXX : not implemented */
6029 spr_register(env
, SPR_750_THRM4
, "THRM4",
6030 SPR_NOACCESS
, SPR_NOACCESS
,
6031 &spr_read_generic
, &spr_write_generic
,
6033 /* Hardware implementation registers */
6034 /* XXX : not implemented (XXX: different from 750fx) */
6035 spr_register(env
, SPR_HID0
, "HID0",
6036 SPR_NOACCESS
, SPR_NOACCESS
,
6037 &spr_read_generic
, &spr_write_generic
,
6039 /* XXX : not implemented */
6040 spr_register(env
, SPR_HID1
, "HID1",
6041 SPR_NOACCESS
, SPR_NOACCESS
,
6042 &spr_read_generic
, &spr_write_generic
,
6044 /* XXX : not implemented (XXX: different from 750fx) */
6045 spr_register(env
, SPR_750FX_HID2
, "HID2",
6046 SPR_NOACCESS
, SPR_NOACCESS
,
6047 &spr_read_generic
, &spr_write_generic
,
6049 /* Memory management */
6051 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
6054 env
->dcache_line_size
= 32;
6055 env
->icache_line_size
= 32;
6056 /* Allocate hardware IRQ controller */
6057 ppc6xx_irq_init(env
);
6060 POWERPC_FAMILY(750gx
)(ObjectClass
*oc
, void *data
)
6062 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6063 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6065 dc
->desc
= "PowerPC 750GX";
6066 pcc
->init_proc
= init_proc_750gx
;
6067 pcc
->check_pow
= check_pow_hid0
;
6068 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6069 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6070 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6071 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6072 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6073 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6074 PPC_SEGMENT
| PPC_EXTERN
;
6075 pcc
->msr_mask
= (1ull << MSR_POW
) |
6091 pcc
->mmu_model
= POWERPC_MMU_32B
;
6092 #if defined(CONFIG_SOFTMMU)
6093 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6095 pcc
->excp_model
= POWERPC_EXCP_7x0
;
6096 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6097 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6098 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6099 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6102 static void init_proc_745 (CPUPPCState
*env
)
6104 gen_spr_ne_601(env
);
6106 gen_spr_G2_755(env
);
6109 /* Thermal management */
6111 /* Hardware implementation registers */
6112 /* XXX : not implemented */
6113 spr_register(env
, SPR_HID0
, "HID0",
6114 SPR_NOACCESS
, SPR_NOACCESS
,
6115 &spr_read_generic
, &spr_write_generic
,
6117 /* XXX : not implemented */
6118 spr_register(env
, SPR_HID1
, "HID1",
6119 SPR_NOACCESS
, SPR_NOACCESS
,
6120 &spr_read_generic
, &spr_write_generic
,
6122 /* XXX : not implemented */
6123 spr_register(env
, SPR_HID2
, "HID2",
6124 SPR_NOACCESS
, SPR_NOACCESS
,
6125 &spr_read_generic
, &spr_write_generic
,
6127 /* Memory management */
6130 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6132 env
->dcache_line_size
= 32;
6133 env
->icache_line_size
= 32;
6134 /* Allocate hardware IRQ controller */
6135 ppc6xx_irq_init(env
);
6138 POWERPC_FAMILY(745)(ObjectClass
*oc
, void *data
)
6140 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6141 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6143 dc
->desc
= "PowerPC 745";
6144 pcc
->init_proc
= init_proc_745
;
6145 pcc
->check_pow
= check_pow_hid0
;
6146 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6147 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6148 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6149 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6150 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6151 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6152 PPC_SEGMENT
| PPC_EXTERN
;
6153 pcc
->msr_mask
= (1ull << MSR_POW
) |
6169 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6170 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6171 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6172 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6173 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6174 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6177 static void init_proc_755 (CPUPPCState
*env
)
6179 gen_spr_ne_601(env
);
6181 gen_spr_G2_755(env
);
6184 /* L2 cache control */
6185 /* XXX : not implemented */
6186 spr_register(env
, SPR_L2CR
, "L2CR",
6187 SPR_NOACCESS
, SPR_NOACCESS
,
6188 &spr_read_generic
, spr_access_nop
,
6190 /* XXX : not implemented */
6191 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6192 SPR_NOACCESS
, SPR_NOACCESS
,
6193 &spr_read_generic
, &spr_write_generic
,
6195 /* Thermal management */
6197 /* Hardware implementation registers */
6198 /* XXX : not implemented */
6199 spr_register(env
, SPR_HID0
, "HID0",
6200 SPR_NOACCESS
, SPR_NOACCESS
,
6201 &spr_read_generic
, &spr_write_generic
,
6203 /* XXX : not implemented */
6204 spr_register(env
, SPR_HID1
, "HID1",
6205 SPR_NOACCESS
, SPR_NOACCESS
,
6206 &spr_read_generic
, &spr_write_generic
,
6208 /* XXX : not implemented */
6209 spr_register(env
, SPR_HID2
, "HID2",
6210 SPR_NOACCESS
, SPR_NOACCESS
,
6211 &spr_read_generic
, &spr_write_generic
,
6213 /* Memory management */
6216 gen_6xx_7xx_soft_tlb(env
, 64, 2);
6218 env
->dcache_line_size
= 32;
6219 env
->icache_line_size
= 32;
6220 /* Allocate hardware IRQ controller */
6221 ppc6xx_irq_init(env
);
6224 POWERPC_FAMILY(755)(ObjectClass
*oc
, void *data
)
6226 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6227 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6229 dc
->desc
= "PowerPC 755";
6230 pcc
->init_proc
= init_proc_755
;
6231 pcc
->check_pow
= check_pow_hid0
;
6232 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6233 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6234 PPC_FLOAT_FRSQRTE
| PPC_FLOAT_STFIWX
|
6235 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
6236 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6237 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
| PPC_6xx_TLB
|
6238 PPC_SEGMENT
| PPC_EXTERN
;
6239 pcc
->msr_mask
= (1ull << MSR_POW
) |
6255 pcc
->mmu_model
= POWERPC_MMU_SOFT_6xx
;
6256 pcc
->excp_model
= POWERPC_EXCP_7x5
;
6257 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6258 pcc
->bfd_mach
= bfd_mach_ppc_750
;
6259 pcc
->flags
= POWERPC_FLAG_SE
| POWERPC_FLAG_BE
|
6260 POWERPC_FLAG_PMM
| POWERPC_FLAG_BUS_CLK
;
6263 static void init_proc_7400 (CPUPPCState
*env
)
6265 gen_spr_ne_601(env
);
6269 /* 74xx specific SPR */
6271 /* XXX : not implemented */
6272 spr_register(env
, SPR_UBAMR
, "UBAMR",
6273 &spr_read_ureg
, SPR_NOACCESS
,
6274 &spr_read_ureg
, SPR_NOACCESS
,
6276 /* XXX: this seems not implemented on all revisions. */
6277 /* XXX : not implemented */
6278 spr_register(env
, SPR_MSSCR1
, "MSSCR1",
6279 SPR_NOACCESS
, SPR_NOACCESS
,
6280 &spr_read_generic
, &spr_write_generic
,
6282 /* Thermal management */
6284 /* Memory management */
6286 init_excp_7400(env
);
6287 env
->dcache_line_size
= 32;
6288 env
->icache_line_size
= 32;
6289 /* Allocate hardware IRQ controller */
6290 ppc6xx_irq_init(env
);
6293 POWERPC_FAMILY(7400)(ObjectClass
*oc
, void *data
)
6295 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6296 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6298 dc
->desc
= "PowerPC 7400 (aka G4)";
6299 pcc
->init_proc
= init_proc_7400
;
6300 pcc
->check_pow
= check_pow_hid0
;
6301 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6302 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6303 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6305 PPC_CACHE
| PPC_CACHE_ICBI
|
6306 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6307 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6308 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6310 PPC_SEGMENT
| PPC_EXTERN
|
6312 pcc
->msr_mask
= (1ull << MSR_VR
) |
6329 pcc
->mmu_model
= POWERPC_MMU_32B
;
6330 #if defined(CONFIG_SOFTMMU)
6331 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6333 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6334 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6335 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6336 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6337 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6338 POWERPC_FLAG_BUS_CLK
;
6341 static void init_proc_7410 (CPUPPCState
*env
)
6343 gen_spr_ne_601(env
);
6347 /* 74xx specific SPR */
6349 /* XXX : not implemented */
6350 spr_register(env
, SPR_UBAMR
, "UBAMR",
6351 &spr_read_ureg
, SPR_NOACCESS
,
6352 &spr_read_ureg
, SPR_NOACCESS
,
6354 /* Thermal management */
6357 /* XXX : not implemented */
6358 spr_register(env
, SPR_L2PMCR
, "L2PMCR",
6359 SPR_NOACCESS
, SPR_NOACCESS
,
6360 &spr_read_generic
, &spr_write_generic
,
6363 /* XXX : not implemented */
6364 spr_register(env
, SPR_LDSTDB
, "LDSTDB",
6365 SPR_NOACCESS
, SPR_NOACCESS
,
6366 &spr_read_generic
, &spr_write_generic
,
6368 /* Memory management */
6370 init_excp_7400(env
);
6371 env
->dcache_line_size
= 32;
6372 env
->icache_line_size
= 32;
6373 /* Allocate hardware IRQ controller */
6374 ppc6xx_irq_init(env
);
6377 POWERPC_FAMILY(7410)(ObjectClass
*oc
, void *data
)
6379 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6380 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6382 dc
->desc
= "PowerPC 7410 (aka G4)";
6383 pcc
->init_proc
= init_proc_7410
;
6384 pcc
->check_pow
= check_pow_hid0
;
6385 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6386 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6387 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6389 PPC_CACHE
| PPC_CACHE_ICBI
|
6390 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6391 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6392 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6394 PPC_SEGMENT
| PPC_EXTERN
|
6396 pcc
->msr_mask
= (1ull << MSR_VR
) |
6413 pcc
->mmu_model
= POWERPC_MMU_32B
;
6414 #if defined(CONFIG_SOFTMMU)
6415 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
6417 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6418 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6419 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6420 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6421 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6422 POWERPC_FLAG_BUS_CLK
;
6425 static void init_proc_7440 (CPUPPCState
*env
)
6427 gen_spr_ne_601(env
);
6431 /* 74xx specific SPR */
6433 /* XXX : not implemented */
6434 spr_register(env
, SPR_UBAMR
, "UBAMR",
6435 &spr_read_ureg
, SPR_NOACCESS
,
6436 &spr_read_ureg
, SPR_NOACCESS
,
6439 /* XXX : not implemented */
6440 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6441 SPR_NOACCESS
, SPR_NOACCESS
,
6442 &spr_read_generic
, &spr_write_generic
,
6445 /* XXX : not implemented */
6446 spr_register(env
, SPR_ICTRL
, "ICTRL",
6447 SPR_NOACCESS
, SPR_NOACCESS
,
6448 &spr_read_generic
, &spr_write_generic
,
6451 /* XXX : not implemented */
6452 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6453 SPR_NOACCESS
, SPR_NOACCESS
,
6454 &spr_read_generic
, &spr_write_generic
,
6457 /* XXX : not implemented */
6458 spr_register(env
, SPR_PMC5
, "PMC5",
6459 SPR_NOACCESS
, SPR_NOACCESS
,
6460 &spr_read_generic
, &spr_write_generic
,
6462 /* XXX : not implemented */
6463 spr_register(env
, SPR_UPMC5
, "UPMC5",
6464 &spr_read_ureg
, SPR_NOACCESS
,
6465 &spr_read_ureg
, SPR_NOACCESS
,
6467 /* XXX : not implemented */
6468 spr_register(env
, SPR_PMC6
, "PMC6",
6469 SPR_NOACCESS
, SPR_NOACCESS
,
6470 &spr_read_generic
, &spr_write_generic
,
6472 /* XXX : not implemented */
6473 spr_register(env
, SPR_UPMC6
, "UPMC6",
6474 &spr_read_ureg
, SPR_NOACCESS
,
6475 &spr_read_ureg
, SPR_NOACCESS
,
6477 /* Memory management */
6479 gen_74xx_soft_tlb(env
, 128, 2);
6480 init_excp_7450(env
);
6481 env
->dcache_line_size
= 32;
6482 env
->icache_line_size
= 32;
6483 /* Allocate hardware IRQ controller */
6484 ppc6xx_irq_init(env
);
6487 POWERPC_FAMILY(7440)(ObjectClass
*oc
, void *data
)
6489 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6490 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6492 dc
->desc
= "PowerPC 7440 (aka G4)";
6493 pcc
->init_proc
= init_proc_7440
;
6494 pcc
->check_pow
= check_pow_hid0_74xx
;
6495 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6496 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6497 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6499 PPC_CACHE
| PPC_CACHE_ICBI
|
6500 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6501 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6502 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6503 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6504 PPC_SEGMENT
| PPC_EXTERN
|
6506 pcc
->msr_mask
= (1ull << MSR_VR
) |
6523 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6524 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6525 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6526 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6527 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6528 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6529 POWERPC_FLAG_BUS_CLK
;
6532 static void init_proc_7450 (CPUPPCState
*env
)
6534 gen_spr_ne_601(env
);
6538 /* 74xx specific SPR */
6540 /* Level 3 cache control */
6543 /* XXX : not implemented */
6544 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
6545 SPR_NOACCESS
, SPR_NOACCESS
,
6546 &spr_read_generic
, &spr_write_generic
,
6549 /* XXX : not implemented */
6550 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
6551 SPR_NOACCESS
, SPR_NOACCESS
,
6552 &spr_read_generic
, &spr_write_generic
,
6555 /* XXX : not implemented */
6556 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
6557 SPR_NOACCESS
, SPR_NOACCESS
,
6558 &spr_read_generic
, &spr_write_generic
,
6561 /* XXX : not implemented */
6562 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
6563 SPR_NOACCESS
, SPR_NOACCESS
,
6564 &spr_read_generic
, &spr_write_generic
,
6566 /* XXX : not implemented */
6567 spr_register(env
, SPR_UBAMR
, "UBAMR",
6568 &spr_read_ureg
, SPR_NOACCESS
,
6569 &spr_read_ureg
, SPR_NOACCESS
,
6572 /* XXX : not implemented */
6573 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6574 SPR_NOACCESS
, SPR_NOACCESS
,
6575 &spr_read_generic
, &spr_write_generic
,
6578 /* XXX : not implemented */
6579 spr_register(env
, SPR_ICTRL
, "ICTRL",
6580 SPR_NOACCESS
, SPR_NOACCESS
,
6581 &spr_read_generic
, &spr_write_generic
,
6584 /* XXX : not implemented */
6585 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6586 SPR_NOACCESS
, SPR_NOACCESS
,
6587 &spr_read_generic
, &spr_write_generic
,
6590 /* XXX : not implemented */
6591 spr_register(env
, SPR_PMC5
, "PMC5",
6592 SPR_NOACCESS
, SPR_NOACCESS
,
6593 &spr_read_generic
, &spr_write_generic
,
6595 /* XXX : not implemented */
6596 spr_register(env
, SPR_UPMC5
, "UPMC5",
6597 &spr_read_ureg
, SPR_NOACCESS
,
6598 &spr_read_ureg
, SPR_NOACCESS
,
6600 /* XXX : not implemented */
6601 spr_register(env
, SPR_PMC6
, "PMC6",
6602 SPR_NOACCESS
, SPR_NOACCESS
,
6603 &spr_read_generic
, &spr_write_generic
,
6605 /* XXX : not implemented */
6606 spr_register(env
, SPR_UPMC6
, "UPMC6",
6607 &spr_read_ureg
, SPR_NOACCESS
,
6608 &spr_read_ureg
, SPR_NOACCESS
,
6610 /* Memory management */
6612 gen_74xx_soft_tlb(env
, 128, 2);
6613 init_excp_7450(env
);
6614 env
->dcache_line_size
= 32;
6615 env
->icache_line_size
= 32;
6616 /* Allocate hardware IRQ controller */
6617 ppc6xx_irq_init(env
);
6620 POWERPC_FAMILY(7450)(ObjectClass
*oc
, void *data
)
6622 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6623 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6625 dc
->desc
= "PowerPC 7450 (aka G4)";
6626 pcc
->init_proc
= init_proc_7450
;
6627 pcc
->check_pow
= check_pow_hid0_74xx
;
6628 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6629 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6630 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6632 PPC_CACHE
| PPC_CACHE_ICBI
|
6633 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6634 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6635 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6636 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6637 PPC_SEGMENT
| PPC_EXTERN
|
6639 pcc
->msr_mask
= (1ull << MSR_VR
) |
6656 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6657 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6658 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6659 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6660 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6661 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6662 POWERPC_FLAG_BUS_CLK
;
6665 static void init_proc_7445 (CPUPPCState
*env
)
6667 gen_spr_ne_601(env
);
6671 /* 74xx specific SPR */
6674 /* XXX : not implemented */
6675 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6676 SPR_NOACCESS
, SPR_NOACCESS
,
6677 &spr_read_generic
, &spr_write_generic
,
6680 /* XXX : not implemented */
6681 spr_register(env
, SPR_ICTRL
, "ICTRL",
6682 SPR_NOACCESS
, SPR_NOACCESS
,
6683 &spr_read_generic
, &spr_write_generic
,
6686 /* XXX : not implemented */
6687 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6688 SPR_NOACCESS
, SPR_NOACCESS
,
6689 &spr_read_generic
, &spr_write_generic
,
6692 /* XXX : not implemented */
6693 spr_register(env
, SPR_PMC5
, "PMC5",
6694 SPR_NOACCESS
, SPR_NOACCESS
,
6695 &spr_read_generic
, &spr_write_generic
,
6697 /* XXX : not implemented */
6698 spr_register(env
, SPR_UPMC5
, "UPMC5",
6699 &spr_read_ureg
, SPR_NOACCESS
,
6700 &spr_read_ureg
, SPR_NOACCESS
,
6702 /* XXX : not implemented */
6703 spr_register(env
, SPR_PMC6
, "PMC6",
6704 SPR_NOACCESS
, SPR_NOACCESS
,
6705 &spr_read_generic
, &spr_write_generic
,
6707 /* XXX : not implemented */
6708 spr_register(env
, SPR_UPMC6
, "UPMC6",
6709 &spr_read_ureg
, SPR_NOACCESS
,
6710 &spr_read_ureg
, SPR_NOACCESS
,
6713 spr_register(env
, SPR_SPRG4
, "SPRG4",
6714 SPR_NOACCESS
, SPR_NOACCESS
,
6715 &spr_read_generic
, &spr_write_generic
,
6717 spr_register(env
, SPR_USPRG4
, "USPRG4",
6718 &spr_read_ureg
, SPR_NOACCESS
,
6719 &spr_read_ureg
, SPR_NOACCESS
,
6721 spr_register(env
, SPR_SPRG5
, "SPRG5",
6722 SPR_NOACCESS
, SPR_NOACCESS
,
6723 &spr_read_generic
, &spr_write_generic
,
6725 spr_register(env
, SPR_USPRG5
, "USPRG5",
6726 &spr_read_ureg
, SPR_NOACCESS
,
6727 &spr_read_ureg
, SPR_NOACCESS
,
6729 spr_register(env
, SPR_SPRG6
, "SPRG6",
6730 SPR_NOACCESS
, SPR_NOACCESS
,
6731 &spr_read_generic
, &spr_write_generic
,
6733 spr_register(env
, SPR_USPRG6
, "USPRG6",
6734 &spr_read_ureg
, SPR_NOACCESS
,
6735 &spr_read_ureg
, SPR_NOACCESS
,
6737 spr_register(env
, SPR_SPRG7
, "SPRG7",
6738 SPR_NOACCESS
, SPR_NOACCESS
,
6739 &spr_read_generic
, &spr_write_generic
,
6741 spr_register(env
, SPR_USPRG7
, "USPRG7",
6742 &spr_read_ureg
, SPR_NOACCESS
,
6743 &spr_read_ureg
, SPR_NOACCESS
,
6745 /* Memory management */
6748 gen_74xx_soft_tlb(env
, 128, 2);
6749 init_excp_7450(env
);
6750 env
->dcache_line_size
= 32;
6751 env
->icache_line_size
= 32;
6752 /* Allocate hardware IRQ controller */
6753 ppc6xx_irq_init(env
);
6756 POWERPC_FAMILY(7445)(ObjectClass
*oc
, void *data
)
6758 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6759 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6761 dc
->desc
= "PowerPC 7445 (aka G4)";
6762 pcc
->init_proc
= init_proc_7445
;
6763 pcc
->check_pow
= check_pow_hid0_74xx
;
6764 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6765 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6766 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6768 PPC_CACHE
| PPC_CACHE_ICBI
|
6769 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6770 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6771 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6772 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6773 PPC_SEGMENT
| PPC_EXTERN
|
6775 pcc
->msr_mask
= (1ull << MSR_VR
) |
6792 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6793 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6794 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6795 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6796 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6797 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6798 POWERPC_FLAG_BUS_CLK
;
6801 static void init_proc_7455 (CPUPPCState
*env
)
6803 gen_spr_ne_601(env
);
6807 /* 74xx specific SPR */
6809 /* Level 3 cache control */
6812 /* XXX : not implemented */
6813 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6814 SPR_NOACCESS
, SPR_NOACCESS
,
6815 &spr_read_generic
, &spr_write_generic
,
6818 /* XXX : not implemented */
6819 spr_register(env
, SPR_ICTRL
, "ICTRL",
6820 SPR_NOACCESS
, SPR_NOACCESS
,
6821 &spr_read_generic
, &spr_write_generic
,
6824 /* XXX : not implemented */
6825 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6826 SPR_NOACCESS
, SPR_NOACCESS
,
6827 &spr_read_generic
, &spr_write_generic
,
6830 /* XXX : not implemented */
6831 spr_register(env
, SPR_PMC5
, "PMC5",
6832 SPR_NOACCESS
, SPR_NOACCESS
,
6833 &spr_read_generic
, &spr_write_generic
,
6835 /* XXX : not implemented */
6836 spr_register(env
, SPR_UPMC5
, "UPMC5",
6837 &spr_read_ureg
, SPR_NOACCESS
,
6838 &spr_read_ureg
, SPR_NOACCESS
,
6840 /* XXX : not implemented */
6841 spr_register(env
, SPR_PMC6
, "PMC6",
6842 SPR_NOACCESS
, SPR_NOACCESS
,
6843 &spr_read_generic
, &spr_write_generic
,
6845 /* XXX : not implemented */
6846 spr_register(env
, SPR_UPMC6
, "UPMC6",
6847 &spr_read_ureg
, SPR_NOACCESS
,
6848 &spr_read_ureg
, SPR_NOACCESS
,
6851 spr_register(env
, SPR_SPRG4
, "SPRG4",
6852 SPR_NOACCESS
, SPR_NOACCESS
,
6853 &spr_read_generic
, &spr_write_generic
,
6855 spr_register(env
, SPR_USPRG4
, "USPRG4",
6856 &spr_read_ureg
, SPR_NOACCESS
,
6857 &spr_read_ureg
, SPR_NOACCESS
,
6859 spr_register(env
, SPR_SPRG5
, "SPRG5",
6860 SPR_NOACCESS
, SPR_NOACCESS
,
6861 &spr_read_generic
, &spr_write_generic
,
6863 spr_register(env
, SPR_USPRG5
, "USPRG5",
6864 &spr_read_ureg
, SPR_NOACCESS
,
6865 &spr_read_ureg
, SPR_NOACCESS
,
6867 spr_register(env
, SPR_SPRG6
, "SPRG6",
6868 SPR_NOACCESS
, SPR_NOACCESS
,
6869 &spr_read_generic
, &spr_write_generic
,
6871 spr_register(env
, SPR_USPRG6
, "USPRG6",
6872 &spr_read_ureg
, SPR_NOACCESS
,
6873 &spr_read_ureg
, SPR_NOACCESS
,
6875 spr_register(env
, SPR_SPRG7
, "SPRG7",
6876 SPR_NOACCESS
, SPR_NOACCESS
,
6877 &spr_read_generic
, &spr_write_generic
,
6879 spr_register(env
, SPR_USPRG7
, "USPRG7",
6880 &spr_read_ureg
, SPR_NOACCESS
,
6881 &spr_read_ureg
, SPR_NOACCESS
,
6883 /* Memory management */
6886 gen_74xx_soft_tlb(env
, 128, 2);
6887 init_excp_7450(env
);
6888 env
->dcache_line_size
= 32;
6889 env
->icache_line_size
= 32;
6890 /* Allocate hardware IRQ controller */
6891 ppc6xx_irq_init(env
);
6894 POWERPC_FAMILY(7455)(ObjectClass
*oc
, void *data
)
6896 DeviceClass
*dc
= DEVICE_CLASS(oc
);
6897 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
6899 dc
->desc
= "PowerPC 7455 (aka G4)";
6900 pcc
->init_proc
= init_proc_7455
;
6901 pcc
->check_pow
= check_pow_hid0_74xx
;
6902 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
6903 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
6904 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
6906 PPC_CACHE
| PPC_CACHE_ICBI
|
6907 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
6908 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
6909 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
6910 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
6911 PPC_SEGMENT
| PPC_EXTERN
|
6913 pcc
->msr_mask
= (1ull << MSR_VR
) |
6930 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
6931 pcc
->excp_model
= POWERPC_EXCP_74xx
;
6932 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
6933 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
6934 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
6935 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
6936 POWERPC_FLAG_BUS_CLK
;
6939 static void init_proc_7457 (CPUPPCState
*env
)
6941 gen_spr_ne_601(env
);
6945 /* 74xx specific SPR */
6947 /* Level 3 cache control */
6950 /* XXX : not implemented */
6951 spr_register(env
, SPR_L3ITCR1
, "L3ITCR1",
6952 SPR_NOACCESS
, SPR_NOACCESS
,
6953 &spr_read_generic
, &spr_write_generic
,
6956 /* XXX : not implemented */
6957 spr_register(env
, SPR_L3ITCR2
, "L3ITCR2",
6958 SPR_NOACCESS
, SPR_NOACCESS
,
6959 &spr_read_generic
, &spr_write_generic
,
6962 /* XXX : not implemented */
6963 spr_register(env
, SPR_L3ITCR3
, "L3ITCR3",
6964 SPR_NOACCESS
, SPR_NOACCESS
,
6965 &spr_read_generic
, &spr_write_generic
,
6968 /* XXX : not implemented */
6969 spr_register(env
, SPR_L3OHCR
, "L3OHCR",
6970 SPR_NOACCESS
, SPR_NOACCESS
,
6971 &spr_read_generic
, &spr_write_generic
,
6974 /* XXX : not implemented */
6975 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
6976 SPR_NOACCESS
, SPR_NOACCESS
,
6977 &spr_read_generic
, &spr_write_generic
,
6980 /* XXX : not implemented */
6981 spr_register(env
, SPR_ICTRL
, "ICTRL",
6982 SPR_NOACCESS
, SPR_NOACCESS
,
6983 &spr_read_generic
, &spr_write_generic
,
6986 /* XXX : not implemented */
6987 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
6988 SPR_NOACCESS
, SPR_NOACCESS
,
6989 &spr_read_generic
, &spr_write_generic
,
6992 /* XXX : not implemented */
6993 spr_register(env
, SPR_PMC5
, "PMC5",
6994 SPR_NOACCESS
, SPR_NOACCESS
,
6995 &spr_read_generic
, &spr_write_generic
,
6997 /* XXX : not implemented */
6998 spr_register(env
, SPR_UPMC5
, "UPMC5",
6999 &spr_read_ureg
, SPR_NOACCESS
,
7000 &spr_read_ureg
, SPR_NOACCESS
,
7002 /* XXX : not implemented */
7003 spr_register(env
, SPR_PMC6
, "PMC6",
7004 SPR_NOACCESS
, SPR_NOACCESS
,
7005 &spr_read_generic
, &spr_write_generic
,
7007 /* XXX : not implemented */
7008 spr_register(env
, SPR_UPMC6
, "UPMC6",
7009 &spr_read_ureg
, SPR_NOACCESS
,
7010 &spr_read_ureg
, SPR_NOACCESS
,
7013 spr_register(env
, SPR_SPRG4
, "SPRG4",
7014 SPR_NOACCESS
, SPR_NOACCESS
,
7015 &spr_read_generic
, &spr_write_generic
,
7017 spr_register(env
, SPR_USPRG4
, "USPRG4",
7018 &spr_read_ureg
, SPR_NOACCESS
,
7019 &spr_read_ureg
, SPR_NOACCESS
,
7021 spr_register(env
, SPR_SPRG5
, "SPRG5",
7022 SPR_NOACCESS
, SPR_NOACCESS
,
7023 &spr_read_generic
, &spr_write_generic
,
7025 spr_register(env
, SPR_USPRG5
, "USPRG5",
7026 &spr_read_ureg
, SPR_NOACCESS
,
7027 &spr_read_ureg
, SPR_NOACCESS
,
7029 spr_register(env
, SPR_SPRG6
, "SPRG6",
7030 SPR_NOACCESS
, SPR_NOACCESS
,
7031 &spr_read_generic
, &spr_write_generic
,
7033 spr_register(env
, SPR_USPRG6
, "USPRG6",
7034 &spr_read_ureg
, SPR_NOACCESS
,
7035 &spr_read_ureg
, SPR_NOACCESS
,
7037 spr_register(env
, SPR_SPRG7
, "SPRG7",
7038 SPR_NOACCESS
, SPR_NOACCESS
,
7039 &spr_read_generic
, &spr_write_generic
,
7041 spr_register(env
, SPR_USPRG7
, "USPRG7",
7042 &spr_read_ureg
, SPR_NOACCESS
,
7043 &spr_read_ureg
, SPR_NOACCESS
,
7045 /* Memory management */
7048 gen_74xx_soft_tlb(env
, 128, 2);
7049 init_excp_7450(env
);
7050 env
->dcache_line_size
= 32;
7051 env
->icache_line_size
= 32;
7052 /* Allocate hardware IRQ controller */
7053 ppc6xx_irq_init(env
);
7056 POWERPC_FAMILY(7457)(ObjectClass
*oc
, void *data
)
7058 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7059 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7061 dc
->desc
= "PowerPC 7457 (aka G4)";
7062 pcc
->init_proc
= init_proc_7457
;
7063 pcc
->check_pow
= check_pow_hid0_74xx
;
7064 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7065 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7066 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7068 PPC_CACHE
| PPC_CACHE_ICBI
|
7069 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7070 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7071 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7072 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7073 PPC_SEGMENT
| PPC_EXTERN
|
7075 pcc
->msr_mask
= (1ull << MSR_VR
) |
7092 pcc
->mmu_model
= POWERPC_MMU_SOFT_74xx
;
7093 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7094 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7095 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7096 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7097 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7098 POWERPC_FLAG_BUS_CLK
;
7101 static void init_proc_e600 (CPUPPCState
*env
)
7103 gen_spr_ne_601(env
);
7107 /* 74xx specific SPR */
7109 /* XXX : not implemented */
7110 spr_register(env
, SPR_UBAMR
, "UBAMR",
7111 &spr_read_ureg
, SPR_NOACCESS
,
7112 &spr_read_ureg
, SPR_NOACCESS
,
7114 /* XXX : not implemented */
7115 spr_register(env
, SPR_LDSTCR
, "LDSTCR",
7116 SPR_NOACCESS
, SPR_NOACCESS
,
7117 &spr_read_generic
, &spr_write_generic
,
7119 /* XXX : not implemented */
7120 spr_register(env
, SPR_ICTRL
, "ICTRL",
7121 SPR_NOACCESS
, SPR_NOACCESS
,
7122 &spr_read_generic
, &spr_write_generic
,
7124 /* XXX : not implemented */
7125 spr_register(env
, SPR_MSSSR0
, "MSSSR0",
7126 SPR_NOACCESS
, SPR_NOACCESS
,
7127 &spr_read_generic
, &spr_write_generic
,
7129 /* XXX : not implemented */
7130 spr_register(env
, SPR_PMC5
, "PMC5",
7131 SPR_NOACCESS
, SPR_NOACCESS
,
7132 &spr_read_generic
, &spr_write_generic
,
7134 /* XXX : not implemented */
7135 spr_register(env
, SPR_UPMC5
, "UPMC5",
7136 &spr_read_ureg
, SPR_NOACCESS
,
7137 &spr_read_ureg
, SPR_NOACCESS
,
7139 /* XXX : not implemented */
7140 spr_register(env
, SPR_PMC6
, "PMC6",
7141 SPR_NOACCESS
, SPR_NOACCESS
,
7142 &spr_read_generic
, &spr_write_generic
,
7144 /* XXX : not implemented */
7145 spr_register(env
, SPR_UPMC6
, "UPMC6",
7146 &spr_read_ureg
, SPR_NOACCESS
,
7147 &spr_read_ureg
, SPR_NOACCESS
,
7150 spr_register(env
, SPR_SPRG4
, "SPRG4",
7151 SPR_NOACCESS
, SPR_NOACCESS
,
7152 &spr_read_generic
, &spr_write_generic
,
7154 spr_register(env
, SPR_USPRG4
, "USPRG4",
7155 &spr_read_ureg
, SPR_NOACCESS
,
7156 &spr_read_ureg
, SPR_NOACCESS
,
7158 spr_register(env
, SPR_SPRG5
, "SPRG5",
7159 SPR_NOACCESS
, SPR_NOACCESS
,
7160 &spr_read_generic
, &spr_write_generic
,
7162 spr_register(env
, SPR_USPRG5
, "USPRG5",
7163 &spr_read_ureg
, SPR_NOACCESS
,
7164 &spr_read_ureg
, SPR_NOACCESS
,
7166 spr_register(env
, SPR_SPRG6
, "SPRG6",
7167 SPR_NOACCESS
, SPR_NOACCESS
,
7168 &spr_read_generic
, &spr_write_generic
,
7170 spr_register(env
, SPR_USPRG6
, "USPRG6",
7171 &spr_read_ureg
, SPR_NOACCESS
,
7172 &spr_read_ureg
, SPR_NOACCESS
,
7174 spr_register(env
, SPR_SPRG7
, "SPRG7",
7175 SPR_NOACCESS
, SPR_NOACCESS
,
7176 &spr_read_generic
, &spr_write_generic
,
7178 spr_register(env
, SPR_USPRG7
, "USPRG7",
7179 &spr_read_ureg
, SPR_NOACCESS
,
7180 &spr_read_ureg
, SPR_NOACCESS
,
7182 /* Memory management */
7185 gen_74xx_soft_tlb(env
, 128, 2);
7186 init_excp_7450(env
);
7187 env
->dcache_line_size
= 32;
7188 env
->icache_line_size
= 32;
7189 /* Allocate hardware IRQ controller */
7190 ppc6xx_irq_init(env
);
7193 POWERPC_FAMILY(e600
)(ObjectClass
*oc
, void *data
)
7195 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7196 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7198 dc
->desc
= "PowerPC e600";
7199 pcc
->init_proc
= init_proc_e600
;
7200 pcc
->check_pow
= check_pow_hid0_74xx
;
7201 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7202 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7203 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7205 PPC_CACHE
| PPC_CACHE_ICBI
|
7206 PPC_CACHE_DCBA
| PPC_CACHE_DCBZ
|
7207 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7208 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7209 PPC_MEM_TLBIA
| PPC_74xx_TLB
|
7210 PPC_SEGMENT
| PPC_EXTERN
|
7212 pcc
->insns_flags2
= PPC_NONE
;
7213 pcc
->msr_mask
= (1ull << MSR_VR
) |
7230 pcc
->mmu_model
= POWERPC_MMU_32B
;
7231 #if defined(CONFIG_SOFTMMU)
7232 pcc
->handle_mmu_fault
= ppc_hash32_handle_mmu_fault
;
7234 pcc
->excp_model
= POWERPC_EXCP_74xx
;
7235 pcc
->bus_model
= PPC_FLAGS_INPUT_6xx
;
7236 pcc
->bfd_mach
= bfd_mach_ppc_7400
;
7237 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7238 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7239 POWERPC_FLAG_BUS_CLK
;
7242 #if defined (TARGET_PPC64)
7243 #if defined(CONFIG_USER_ONLY)
7244 #define POWERPC970_HID5_INIT 0x00000080
7246 #define POWERPC970_HID5_INIT 0x00000000
7249 static int check_pow_970 (CPUPPCState
*env
)
7251 if (env
->spr
[SPR_HID0
] & 0x00600000)
7257 static void init_proc_970 (CPUPPCState
*env
)
7259 gen_spr_ne_601(env
);
7263 /* Hardware implementation registers */
7264 /* XXX : not implemented */
7265 spr_register(env
, SPR_HID0
, "HID0",
7266 SPR_NOACCESS
, SPR_NOACCESS
,
7267 &spr_read_generic
, &spr_write_clear
,
7269 /* XXX : not implemented */
7270 spr_register(env
, SPR_HID1
, "HID1",
7271 SPR_NOACCESS
, SPR_NOACCESS
,
7272 &spr_read_generic
, &spr_write_generic
,
7274 /* XXX : not implemented */
7275 spr_register(env
, SPR_970_HID5
, "HID5",
7276 SPR_NOACCESS
, SPR_NOACCESS
,
7277 &spr_read_generic
, &spr_write_generic
,
7278 POWERPC970_HID5_INIT
);
7279 /* Memory management */
7280 /* XXX: not correct */
7282 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7283 SPR_NOACCESS
, SPR_NOACCESS
,
7284 &spr_read_hior
, &spr_write_hior
,
7286 #if !defined(CONFIG_USER_ONLY)
7290 env
->dcache_line_size
= 128;
7291 env
->icache_line_size
= 128;
7292 /* Allocate hardware IRQ controller */
7293 ppc970_irq_init(env
);
7294 /* Can't find information on what this should be on reset. This
7295 * value is the one used by 74xx processors. */
7296 vscr_init(env
, 0x00010000);
7299 POWERPC_FAMILY(970)(ObjectClass
*oc
, void *data
)
7301 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7302 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7304 dc
->desc
= "PowerPC 970";
7305 pcc
->init_proc
= init_proc_970
;
7306 pcc
->check_pow
= check_pow_970
;
7307 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7308 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7309 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7311 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7312 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7313 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7314 PPC_64B
| PPC_ALTIVEC
|
7315 PPC_SEGMENT_64B
| PPC_SLBI
;
7316 pcc
->msr_mask
= (1ull << MSR_SF
) |
7332 pcc
->mmu_model
= POWERPC_MMU_64B
;
7333 #if defined(CONFIG_SOFTMMU)
7334 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7336 pcc
->excp_model
= POWERPC_EXCP_970
;
7337 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
7338 pcc
->bfd_mach
= bfd_mach_ppc64
;
7339 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7340 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7341 POWERPC_FLAG_BUS_CLK
;
7342 pcc
->l1_dcache_size
= 0x8000;
7343 pcc
->l1_icache_size
= 0x10000;
7346 static int check_pow_970FX (CPUPPCState
*env
)
7348 if (env
->spr
[SPR_HID0
] & 0x00600000)
7354 static void init_proc_970FX (CPUPPCState
*env
)
7356 gen_spr_ne_601(env
);
7360 /* Hardware implementation registers */
7361 /* XXX : not implemented */
7362 spr_register(env
, SPR_HID0
, "HID0",
7363 SPR_NOACCESS
, SPR_NOACCESS
,
7364 &spr_read_generic
, &spr_write_clear
,
7366 /* XXX : not implemented */
7367 spr_register(env
, SPR_HID1
, "HID1",
7368 SPR_NOACCESS
, SPR_NOACCESS
,
7369 &spr_read_generic
, &spr_write_generic
,
7371 /* XXX : not implemented */
7372 spr_register(env
, SPR_970_HID5
, "HID5",
7373 SPR_NOACCESS
, SPR_NOACCESS
,
7374 &spr_read_generic
, &spr_write_generic
,
7375 POWERPC970_HID5_INIT
);
7376 /* Memory management */
7377 /* XXX: not correct */
7379 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7380 SPR_NOACCESS
, SPR_NOACCESS
,
7381 &spr_read_hior
, &spr_write_hior
,
7383 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
7384 SPR_NOACCESS
, SPR_NOACCESS
,
7385 SPR_NOACCESS
, &spr_write_generic
,
7387 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
7388 SPR_NOACCESS
, SPR_NOACCESS
,
7389 &spr_read_generic
, SPR_NOACCESS
,
7391 spr_register(env
, SPR_VRSAVE
, "SPR_VRSAVE",
7392 &spr_read_generic
, &spr_write_generic
,
7393 &spr_read_generic
, &spr_write_generic
,
7395 #if !defined(CONFIG_USER_ONLY)
7399 env
->dcache_line_size
= 128;
7400 env
->icache_line_size
= 128;
7401 /* Allocate hardware IRQ controller */
7402 ppc970_irq_init(env
);
7403 /* Can't find information on what this should be on reset. This
7404 * value is the one used by 74xx processors. */
7405 vscr_init(env
, 0x00010000);
7408 POWERPC_FAMILY(970FX
)(ObjectClass
*oc
, void *data
)
7410 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7411 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7413 dc
->desc
= "PowerPC 970FX (aka G5)";
7414 pcc
->init_proc
= init_proc_970FX
;
7415 pcc
->check_pow
= check_pow_970FX
;
7416 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7417 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7418 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7420 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7421 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7422 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7423 PPC_64B
| PPC_ALTIVEC
|
7424 PPC_SEGMENT_64B
| PPC_SLBI
;
7425 pcc
->msr_mask
= (1ull << MSR_SF
) |
7440 pcc
->mmu_model
= POWERPC_MMU_64B
;
7441 #if defined(CONFIG_SOFTMMU)
7442 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7444 pcc
->excp_model
= POWERPC_EXCP_970
;
7445 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
7446 pcc
->bfd_mach
= bfd_mach_ppc64
;
7447 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7448 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7449 POWERPC_FLAG_BUS_CLK
;
7450 pcc
->l1_dcache_size
= 0x8000;
7451 pcc
->l1_icache_size
= 0x10000;
7454 static int check_pow_970MP (CPUPPCState
*env
)
7456 if (env
->spr
[SPR_HID0
] & 0x01C00000)
7462 static void init_proc_970MP (CPUPPCState
*env
)
7464 gen_spr_ne_601(env
);
7468 /* Hardware implementation registers */
7469 /* XXX : not implemented */
7470 spr_register(env
, SPR_HID0
, "HID0",
7471 SPR_NOACCESS
, SPR_NOACCESS
,
7472 &spr_read_generic
, &spr_write_clear
,
7474 /* XXX : not implemented */
7475 spr_register(env
, SPR_HID1
, "HID1",
7476 SPR_NOACCESS
, SPR_NOACCESS
,
7477 &spr_read_generic
, &spr_write_generic
,
7479 /* XXX : not implemented */
7480 spr_register(env
, SPR_970_HID5
, "HID5",
7481 SPR_NOACCESS
, SPR_NOACCESS
,
7482 &spr_read_generic
, &spr_write_generic
,
7483 POWERPC970_HID5_INIT
);
7484 /* XXX : not implemented */
7485 /* Memory management */
7486 /* XXX: not correct */
7488 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7489 SPR_NOACCESS
, SPR_NOACCESS
,
7490 &spr_read_hior
, &spr_write_hior
,
7492 /* Logical partitionning */
7493 spr_register_kvm(env
, SPR_LPCR
, "LPCR",
7494 SPR_NOACCESS
, SPR_NOACCESS
,
7495 &spr_read_generic
, &spr_write_generic
,
7496 KVM_REG_PPC_LPCR
, 0x00000000);
7497 #if !defined(CONFIG_USER_ONLY)
7501 env
->dcache_line_size
= 128;
7502 env
->icache_line_size
= 128;
7503 /* Allocate hardware IRQ controller */
7504 ppc970_irq_init(env
);
7505 /* Can't find information on what this should be on reset. This
7506 * value is the one used by 74xx processors. */
7507 vscr_init(env
, 0x00010000);
7510 POWERPC_FAMILY(970MP
)(ObjectClass
*oc
, void *data
)
7512 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7513 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7515 dc
->desc
= "PowerPC 970 MP";
7516 pcc
->init_proc
= init_proc_970MP
;
7517 pcc
->check_pow
= check_pow_970MP
;
7518 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7519 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7520 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7522 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7523 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7524 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7525 PPC_64B
| PPC_ALTIVEC
|
7526 PPC_SEGMENT_64B
| PPC_SLBI
;
7527 pcc
->msr_mask
= (1ull << MSR_SF
) |
7543 pcc
->mmu_model
= POWERPC_MMU_64B
;
7544 #if defined(CONFIG_SOFTMMU)
7545 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7547 pcc
->excp_model
= POWERPC_EXCP_970
;
7548 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
7549 pcc
->bfd_mach
= bfd_mach_ppc64
;
7550 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7551 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7552 POWERPC_FLAG_BUS_CLK
;
7553 pcc
->l1_dcache_size
= 0x8000;
7554 pcc
->l1_icache_size
= 0x10000;
7557 static void init_proc_power5plus(CPUPPCState
*env
)
7559 gen_spr_ne_601(env
);
7563 /* Hardware implementation registers */
7564 /* XXX : not implemented */
7565 spr_register(env
, SPR_HID0
, "HID0",
7566 SPR_NOACCESS
, SPR_NOACCESS
,
7567 &spr_read_generic
, &spr_write_clear
,
7569 /* XXX : not implemented */
7570 spr_register(env
, SPR_HID1
, "HID1",
7571 SPR_NOACCESS
, SPR_NOACCESS
,
7572 &spr_read_generic
, &spr_write_generic
,
7574 /* XXX : not implemented */
7575 spr_register(env
, SPR_970_HID5
, "HID5",
7576 SPR_NOACCESS
, SPR_NOACCESS
,
7577 &spr_read_generic
, &spr_write_generic
,
7578 POWERPC970_HID5_INIT
);
7579 /* Memory management */
7580 /* XXX: not correct */
7582 spr_register(env
, SPR_HIOR
, "SPR_HIOR",
7583 SPR_NOACCESS
, SPR_NOACCESS
,
7584 &spr_read_hior
, &spr_write_hior
,
7586 spr_register(env
, SPR_CTRL
, "SPR_CTRL",
7587 SPR_NOACCESS
, SPR_NOACCESS
,
7588 SPR_NOACCESS
, &spr_write_generic
,
7590 spr_register(env
, SPR_UCTRL
, "SPR_UCTRL",
7591 SPR_NOACCESS
, SPR_NOACCESS
,
7592 &spr_read_generic
, SPR_NOACCESS
,
7594 spr_register(env
, SPR_VRSAVE
, "SPR_VRSAVE",
7595 &spr_read_generic
, &spr_write_generic
,
7596 &spr_read_generic
, &spr_write_generic
,
7598 /* Logical partitionning */
7599 spr_register_kvm(env
, SPR_LPCR
, "LPCR",
7600 SPR_NOACCESS
, SPR_NOACCESS
,
7601 &spr_read_generic
, &spr_write_generic
,
7602 KVM_REG_PPC_LPCR
, 0x00000000);
7603 #if !defined(CONFIG_USER_ONLY)
7607 env
->dcache_line_size
= 128;
7608 env
->icache_line_size
= 128;
7609 /* Allocate hardware IRQ controller */
7610 ppc970_irq_init(env
);
7611 /* Can't find information on what this should be on reset. This
7612 * value is the one used by 74xx processors. */
7613 vscr_init(env
, 0x00010000);
7616 POWERPC_FAMILY(POWER5P
)(ObjectClass
*oc
, void *data
)
7618 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7619 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7621 dc
->fw_name
= "PowerPC,POWER5";
7622 dc
->desc
= "POWER5+";
7623 pcc
->init_proc
= init_proc_power5plus
;
7624 pcc
->check_pow
= check_pow_970FX
;
7625 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_STRING
| PPC_MFTB
|
7626 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7627 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7629 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7630 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7631 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7633 PPC_SEGMENT_64B
| PPC_SLBI
;
7634 pcc
->msr_mask
= (1ull << MSR_SF
) |
7649 pcc
->mmu_model
= POWERPC_MMU_64B
;
7650 #if defined(CONFIG_SOFTMMU)
7651 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7653 pcc
->excp_model
= POWERPC_EXCP_970
;
7654 pcc
->bus_model
= PPC_FLAGS_INPUT_970
;
7655 pcc
->bfd_mach
= bfd_mach_ppc64
;
7656 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7657 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7658 POWERPC_FLAG_BUS_CLK
;
7659 pcc
->l1_dcache_size
= 0x8000;
7660 pcc
->l1_icache_size
= 0x10000;
7663 static void init_proc_POWER7 (CPUPPCState
*env
)
7665 gen_spr_ne_601(env
);
7669 /* Processor identification */
7670 spr_register(env
, SPR_PIR
, "PIR",
7671 SPR_NOACCESS
, SPR_NOACCESS
,
7672 &spr_read_generic
, &spr_write_pir
,
7674 #if !defined(CONFIG_USER_ONLY)
7675 /* PURR & SPURR: Hack - treat these as aliases for the TB for now */
7676 spr_register_kvm(env
, SPR_PURR
, "PURR",
7677 &spr_read_purr
, SPR_NOACCESS
,
7678 &spr_read_purr
, SPR_NOACCESS
,
7679 KVM_REG_PPC_PURR
, 0x00000000);
7680 spr_register_kvm(env
, SPR_SPURR
, "SPURR",
7681 &spr_read_purr
, SPR_NOACCESS
,
7682 &spr_read_purr
, SPR_NOACCESS
,
7683 KVM_REG_PPC_SPURR
, 0x00000000);
7684 spr_register(env
, SPR_CFAR
, "SPR_CFAR",
7685 SPR_NOACCESS
, SPR_NOACCESS
,
7686 &spr_read_cfar
, &spr_write_cfar
,
7688 spr_register_kvm(env
, SPR_DSCR
, "SPR_DSCR",
7689 SPR_NOACCESS
, SPR_NOACCESS
,
7690 &spr_read_generic
, &spr_write_generic
,
7691 KVM_REG_PPC_DSCR
, 0x00000000);
7692 spr_register_kvm(env
, SPR_MMCRA
, "SPR_MMCRA",
7693 SPR_NOACCESS
, SPR_NOACCESS
,
7694 &spr_read_generic
, &spr_write_generic
,
7695 KVM_REG_PPC_MMCRA
, 0x00000000);
7696 spr_register_kvm(env
, SPR_PMC5
, "SPR_PMC5",
7697 SPR_NOACCESS
, SPR_NOACCESS
,
7698 &spr_read_generic
, &spr_write_generic
,
7699 KVM_REG_PPC_PMC5
, 0x00000000);
7700 spr_register_kvm(env
, SPR_PMC6
, "SPR_PMC6",
7701 SPR_NOACCESS
, SPR_NOACCESS
,
7702 &spr_read_generic
, &spr_write_generic
,
7703 KVM_REG_PPC_PMC6
, 0x00000000);
7704 #endif /* !CONFIG_USER_ONLY */
7706 /* XXX : not implemented */
7707 spr_register(env
, SPR_CTRL
, "SPR_CTRLT",
7708 SPR_NOACCESS
, SPR_NOACCESS
,
7709 SPR_NOACCESS
, &spr_write_generic
,
7711 spr_register(env
, SPR_UCTRL
, "SPR_CTRLF",
7712 SPR_NOACCESS
, SPR_NOACCESS
,
7713 &spr_read_generic
, SPR_NOACCESS
,
7715 spr_register(env
, SPR_VRSAVE
, "SPR_VRSAVE",
7716 &spr_read_generic
, &spr_write_generic
,
7717 &spr_read_generic
, &spr_write_generic
,
7719 spr_register(env
, SPR_PPR
, "PPR",
7720 &spr_read_generic
, &spr_write_generic
,
7721 &spr_read_generic
, &spr_write_generic
,
7723 /* Logical partitionning */
7724 spr_register_kvm(env
, SPR_LPCR
, "LPCR",
7725 SPR_NOACCESS
, SPR_NOACCESS
,
7726 &spr_read_generic
, &spr_write_generic
,
7727 KVM_REG_PPC_LPCR
, 0x00000000);
7728 #if !defined(CONFIG_USER_ONLY)
7731 init_excp_POWER7(env
);
7732 env
->dcache_line_size
= 128;
7733 env
->icache_line_size
= 128;
7735 /* Allocate hardware IRQ controller */
7736 ppcPOWER7_irq_init(env
);
7737 /* Can't find information on what this should be on reset. This
7738 * value is the one used by 74xx processors. */
7739 vscr_init(env
, 0x00010000);
7742 POWERPC_FAMILY(POWER7
)(ObjectClass
*oc
, void *data
)
7744 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7745 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7747 dc
->fw_name
= "PowerPC,POWER7";
7748 dc
->desc
= "POWER7";
7749 pcc
->pvr
= CPU_POWERPC_POWER7_BASE
;
7750 pcc
->pvr_mask
= CPU_POWERPC_POWER7_MASK
;
7751 pcc
->init_proc
= init_proc_POWER7
;
7752 pcc
->check_pow
= check_pow_nocheck
;
7753 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
7754 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7755 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7756 PPC_FLOAT_FRSQRTES
|
7759 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7760 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7761 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7762 PPC_64B
| PPC_ALTIVEC
|
7763 PPC_SEGMENT_64B
| PPC_SLBI
|
7764 PPC_POPCNTB
| PPC_POPCNTWD
;
7765 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
7766 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
7767 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
7769 pcc
->msr_mask
= (1ull << MSR_SF
) |
7785 pcc
->mmu_model
= POWERPC_MMU_2_06
;
7786 #if defined(CONFIG_SOFTMMU)
7787 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7789 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
7790 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
7791 pcc
->bfd_mach
= bfd_mach_ppc64
;
7792 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7793 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7794 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
7796 pcc
->l1_dcache_size
= 0x8000;
7797 pcc
->l1_icache_size
= 0x8000;
7800 POWERPC_FAMILY(POWER7P
)(ObjectClass
*oc
, void *data
)
7802 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7803 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7805 dc
->fw_name
= "PowerPC,POWER7+";
7806 dc
->desc
= "POWER7+";
7807 pcc
->pvr
= CPU_POWERPC_POWER7P_BASE
;
7808 pcc
->pvr_mask
= CPU_POWERPC_POWER7P_MASK
;
7809 pcc
->init_proc
= init_proc_POWER7
;
7810 pcc
->check_pow
= check_pow_nocheck
;
7811 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
7812 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7813 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7814 PPC_FLOAT_FRSQRTES
|
7817 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7818 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7819 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7820 PPC_64B
| PPC_ALTIVEC
|
7821 PPC_SEGMENT_64B
| PPC_SLBI
|
7822 PPC_POPCNTB
| PPC_POPCNTWD
;
7823 pcc
->insns_flags2
= PPC2_VSX
| PPC2_DFP
| PPC2_DBRX
| PPC2_ISA205
|
7824 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
7825 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
7827 pcc
->msr_mask
= (1ull << MSR_SF
) |
7843 pcc
->mmu_model
= POWERPC_MMU_2_06
;
7844 #if defined(CONFIG_SOFTMMU)
7845 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7847 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
7848 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
7849 pcc
->bfd_mach
= bfd_mach_ppc64
;
7850 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7851 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7852 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
7854 pcc
->l1_dcache_size
= 0x8000;
7855 pcc
->l1_icache_size
= 0x8000;
7858 static void init_proc_POWER8(CPUPPCState
*env
)
7861 init_proc_POWER7(env
);
7863 /* P8 supports the TAR */
7864 spr_register(env
, SPR_TAR
, "TAR",
7865 &spr_read_generic
, &spr_write_generic
,
7866 &spr_read_generic
, &spr_write_generic
,
7870 POWERPC_FAMILY(POWER8
)(ObjectClass
*oc
, void *data
)
7872 DeviceClass
*dc
= DEVICE_CLASS(oc
);
7873 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
7875 dc
->fw_name
= "PowerPC,POWER8";
7876 dc
->desc
= "POWER8";
7877 pcc
->pvr
= CPU_POWERPC_POWER8_BASE
;
7878 pcc
->pvr_mask
= CPU_POWERPC_POWER8_MASK
;
7879 pcc
->init_proc
= init_proc_POWER8
;
7880 pcc
->check_pow
= check_pow_nocheck
;
7881 pcc
->insns_flags
= PPC_INSNS_BASE
| PPC_ISEL
| PPC_STRING
| PPC_MFTB
|
7882 PPC_FLOAT
| PPC_FLOAT_FSEL
| PPC_FLOAT_FRES
|
7883 PPC_FLOAT_FSQRT
| PPC_FLOAT_FRSQRTE
|
7884 PPC_FLOAT_FRSQRTES
|
7887 PPC_CACHE
| PPC_CACHE_ICBI
| PPC_CACHE_DCBZ
|
7888 PPC_MEM_SYNC
| PPC_MEM_EIEIO
|
7889 PPC_MEM_TLBIE
| PPC_MEM_TLBSYNC
|
7890 PPC_64B
| PPC_64BX
| PPC_ALTIVEC
|
7891 PPC_SEGMENT_64B
| PPC_SLBI
|
7892 PPC_POPCNTB
| PPC_POPCNTWD
;
7893 pcc
->insns_flags2
= PPC2_VSX
| PPC2_VSX207
| PPC2_DFP
| PPC2_DBRX
|
7894 PPC2_PERM_ISA206
| PPC2_DIVE_ISA206
|
7895 PPC2_ATOMIC_ISA206
| PPC2_FP_CVT_ISA206
|
7896 PPC2_FP_TST_ISA206
| PPC2_BCTAR_ISA207
|
7897 PPC2_LSQ_ISA207
| PPC2_ALTIVEC_207
|
7898 PPC2_ISA205
| PPC2_ISA207S
;
7899 pcc
->msr_mask
= (1ull << MSR_SF
) |
7915 pcc
->mmu_model
= POWERPC_MMU_2_06
;
7916 #if defined(CONFIG_SOFTMMU)
7917 pcc
->handle_mmu_fault
= ppc_hash64_handle_mmu_fault
;
7919 pcc
->excp_model
= POWERPC_EXCP_POWER7
;
7920 pcc
->bus_model
= PPC_FLAGS_INPUT_POWER7
;
7921 pcc
->bfd_mach
= bfd_mach_ppc64
;
7922 pcc
->flags
= POWERPC_FLAG_VRE
| POWERPC_FLAG_SE
|
7923 POWERPC_FLAG_BE
| POWERPC_FLAG_PMM
|
7924 POWERPC_FLAG_BUS_CLK
| POWERPC_FLAG_CFAR
|
7926 pcc
->l1_dcache_size
= 0x8000;
7927 pcc
->l1_icache_size
= 0x8000;
7929 #endif /* defined (TARGET_PPC64) */
7932 /*****************************************************************************/
7933 /* Generic CPU instantiation routine */
7934 static void init_ppc_proc(PowerPCCPU
*cpu
)
7936 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
7937 CPUPPCState
*env
= &cpu
->env
;
7938 #if !defined(CONFIG_USER_ONLY)
7941 env
->irq_inputs
= NULL
;
7942 /* Set all exception vectors to an invalid address */
7943 for (i
= 0; i
< POWERPC_EXCP_NB
; i
++)
7944 env
->excp_vectors
[i
] = (target_ulong
)(-1ULL);
7945 env
->ivor_mask
= 0x00000000;
7946 env
->ivpr_mask
= 0x00000000;
7947 /* Default MMU definitions */
7951 env
->tlb_type
= TLB_NONE
;
7953 /* Register SPR common to all PowerPC implementations */
7954 gen_spr_generic(env
);
7955 spr_register(env
, SPR_PVR
, "PVR",
7956 /* Linux permits userspace to read PVR */
7957 #if defined(CONFIG_LINUX_USER)
7963 &spr_read_generic
, SPR_NOACCESS
,
7965 /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
7966 if (pcc
->svr
!= POWERPC_SVR_NONE
) {
7967 if (pcc
->svr
& POWERPC_SVR_E500
) {
7968 spr_register(env
, SPR_E500_SVR
, "SVR",
7969 SPR_NOACCESS
, SPR_NOACCESS
,
7970 &spr_read_generic
, SPR_NOACCESS
,
7971 pcc
->svr
& ~POWERPC_SVR_E500
);
7973 spr_register(env
, SPR_SVR
, "SVR",
7974 SPR_NOACCESS
, SPR_NOACCESS
,
7975 &spr_read_generic
, SPR_NOACCESS
,
7979 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
7980 (*pcc
->init_proc
)(env
);
7982 /* MSR bits & flags consistency checks */
7983 if (env
->msr_mask
& (1 << 25)) {
7984 switch (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
7985 case POWERPC_FLAG_SPE
:
7986 case POWERPC_FLAG_VRE
:
7989 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7990 "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
7993 } else if (env
->flags
& (POWERPC_FLAG_SPE
| POWERPC_FLAG_VRE
)) {
7994 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
7995 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
7998 if (env
->msr_mask
& (1 << 17)) {
7999 switch (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8000 case POWERPC_FLAG_TGPR
:
8001 case POWERPC_FLAG_CE
:
8004 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8005 "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
8008 } else if (env
->flags
& (POWERPC_FLAG_TGPR
| POWERPC_FLAG_CE
)) {
8009 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8010 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
8013 if (env
->msr_mask
& (1 << 10)) {
8014 switch (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8015 POWERPC_FLAG_UBLE
)) {
8016 case POWERPC_FLAG_SE
:
8017 case POWERPC_FLAG_DWE
:
8018 case POWERPC_FLAG_UBLE
:
8021 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8022 "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
8023 "POWERPC_FLAG_UBLE\n");
8026 } else if (env
->flags
& (POWERPC_FLAG_SE
| POWERPC_FLAG_DWE
|
8027 POWERPC_FLAG_UBLE
)) {
8028 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8029 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
8030 "POWERPC_FLAG_UBLE\n");
8033 if (env
->msr_mask
& (1 << 9)) {
8034 switch (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8035 case POWERPC_FLAG_BE
:
8036 case POWERPC_FLAG_DE
:
8039 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8040 "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
8043 } else if (env
->flags
& (POWERPC_FLAG_BE
| POWERPC_FLAG_DE
)) {
8044 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8045 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
8048 if (env
->msr_mask
& (1 << 2)) {
8049 switch (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8050 case POWERPC_FLAG_PX
:
8051 case POWERPC_FLAG_PMM
:
8054 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8055 "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
8058 } else if (env
->flags
& (POWERPC_FLAG_PX
| POWERPC_FLAG_PMM
)) {
8059 fprintf(stderr
, "PowerPC MSR definition inconsistency\n"
8060 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
8063 if ((env
->flags
& (POWERPC_FLAG_RTC_CLK
| POWERPC_FLAG_BUS_CLK
)) == 0) {
8064 fprintf(stderr
, "PowerPC flags inconsistency\n"
8065 "Should define the time-base and decrementer clock source\n");
8068 /* Allocate TLBs buffer when needed */
8069 #if !defined(CONFIG_USER_ONLY)
8070 if (env
->nb_tlb
!= 0) {
8071 int nb_tlb
= env
->nb_tlb
;
8072 if (env
->id_tlbs
!= 0)
8074 switch (env
->tlb_type
) {
8076 env
->tlb
.tlb6
= g_malloc0(nb_tlb
* sizeof(ppc6xx_tlb_t
));
8079 env
->tlb
.tlbe
= g_malloc0(nb_tlb
* sizeof(ppcemb_tlb_t
));
8082 env
->tlb
.tlbm
= g_malloc0(nb_tlb
* sizeof(ppcmas_tlb_t
));
8085 /* Pre-compute some useful values */
8086 env
->tlb_per_way
= env
->nb_tlb
/ env
->nb_ways
;
8088 if (env
->irq_inputs
== NULL
) {
8089 fprintf(stderr
, "WARNING: no internal IRQ controller registered.\n"
8090 " Attempt QEMU to crash very soon !\n");
8093 if (env
->check_pow
== NULL
) {
8094 fprintf(stderr
, "WARNING: no power management check handler "
8096 " Attempt QEMU to crash very soon !\n");
8100 #if defined(PPC_DUMP_CPU)
8101 static void dump_ppc_sprs (CPUPPCState
*env
)
8104 #if !defined(CONFIG_USER_ONLY)
8110 printf("Special purpose registers:\n");
8111 for (i
= 0; i
< 32; i
++) {
8112 for (j
= 0; j
< 32; j
++) {
8114 spr
= &env
->spr_cb
[n
];
8115 uw
= spr
->uea_write
!= NULL
&& spr
->uea_write
!= SPR_NOACCESS
;
8116 ur
= spr
->uea_read
!= NULL
&& spr
->uea_read
!= SPR_NOACCESS
;
8117 #if !defined(CONFIG_USER_ONLY)
8118 sw
= spr
->oea_write
!= NULL
&& spr
->oea_write
!= SPR_NOACCESS
;
8119 sr
= spr
->oea_read
!= NULL
&& spr
->oea_read
!= SPR_NOACCESS
;
8120 if (sw
|| sr
|| uw
|| ur
) {
8121 printf("SPR: %4d (%03x) %-8s s%c%c u%c%c\n",
8122 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
8123 sw
? 'w' : '-', sr
? 'r' : '-',
8124 uw
? 'w' : '-', ur
? 'r' : '-');
8128 printf("SPR: %4d (%03x) %-8s u%c%c\n",
8129 (i
<< 5) | j
, (i
<< 5) | j
, spr
->name
,
8130 uw
? 'w' : '-', ur
? 'r' : '-');
8140 /*****************************************************************************/
8146 PPC_DIRECT
= 0, /* Opcode routine */
8147 PPC_INDIRECT
= 1, /* Indirect opcode table */
8150 static inline int is_indirect_opcode (void *handler
)
8152 return ((uintptr_t)handler
& 0x03) == PPC_INDIRECT
;
8155 static inline opc_handler_t
**ind_table(void *handler
)
8157 return (opc_handler_t
**)((uintptr_t)handler
& ~3);
8160 /* Instruction table creation */
8161 /* Opcodes tables creation */
8162 static void fill_new_table (opc_handler_t
**table
, int len
)
8166 for (i
= 0; i
< len
; i
++)
8167 table
[i
] = &invalid_handler
;
8170 static int create_new_table (opc_handler_t
**table
, unsigned char idx
)
8172 opc_handler_t
**tmp
;
8174 tmp
= g_new(opc_handler_t
*, 0x20);
8175 fill_new_table(tmp
, 0x20);
8176 table
[idx
] = (opc_handler_t
*)((uintptr_t)tmp
| PPC_INDIRECT
);
8181 static int insert_in_table (opc_handler_t
**table
, unsigned char idx
,
8182 opc_handler_t
*handler
)
8184 if (table
[idx
] != &invalid_handler
)
8186 table
[idx
] = handler
;
8191 static int register_direct_insn (opc_handler_t
**ppc_opcodes
,
8192 unsigned char idx
, opc_handler_t
*handler
)
8194 if (insert_in_table(ppc_opcodes
, idx
, handler
) < 0) {
8195 printf("*** ERROR: opcode %02x already assigned in main "
8196 "opcode table\n", idx
);
8197 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8198 printf(" Registered handler '%s' - new handler '%s'\n",
8199 ppc_opcodes
[idx
]->oname
, handler
->oname
);
8207 static int register_ind_in_table (opc_handler_t
**table
,
8208 unsigned char idx1
, unsigned char idx2
,
8209 opc_handler_t
*handler
)
8211 if (table
[idx1
] == &invalid_handler
) {
8212 if (create_new_table(table
, idx1
) < 0) {
8213 printf("*** ERROR: unable to create indirect table "
8214 "idx=%02x\n", idx1
);
8218 if (!is_indirect_opcode(table
[idx1
])) {
8219 printf("*** ERROR: idx %02x already assigned to a direct "
8221 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8222 printf(" Registered handler '%s' - new handler '%s'\n",
8223 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
8228 if (handler
!= NULL
&&
8229 insert_in_table(ind_table(table
[idx1
]), idx2
, handler
) < 0) {
8230 printf("*** ERROR: opcode %02x already assigned in "
8231 "opcode table %02x\n", idx2
, idx1
);
8232 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
8233 printf(" Registered handler '%s' - new handler '%s'\n",
8234 ind_table(table
[idx1
])[idx2
]->oname
, handler
->oname
);
8242 static int register_ind_insn (opc_handler_t
**ppc_opcodes
,
8243 unsigned char idx1
, unsigned char idx2
,
8244 opc_handler_t
*handler
)
8248 ret
= register_ind_in_table(ppc_opcodes
, idx1
, idx2
, handler
);
8253 static int register_dblind_insn (opc_handler_t
**ppc_opcodes
,
8254 unsigned char idx1
, unsigned char idx2
,
8255 unsigned char idx3
, opc_handler_t
*handler
)
8257 if (register_ind_in_table(ppc_opcodes
, idx1
, idx2
, NULL
) < 0) {
8258 printf("*** ERROR: unable to join indirect table idx "
8259 "[%02x-%02x]\n", idx1
, idx2
);
8262 if (register_ind_in_table(ind_table(ppc_opcodes
[idx1
]), idx2
, idx3
,
8264 printf("*** ERROR: unable to insert opcode "
8265 "[%02x-%02x-%02x]\n", idx1
, idx2
, idx3
);
8272 static int register_insn (opc_handler_t
**ppc_opcodes
, opcode_t
*insn
)
8274 if (insn
->opc2
!= 0xFF) {
8275 if (insn
->opc3
!= 0xFF) {
8276 if (register_dblind_insn(ppc_opcodes
, insn
->opc1
, insn
->opc2
,
8277 insn
->opc3
, &insn
->handler
) < 0)
8280 if (register_ind_insn(ppc_opcodes
, insn
->opc1
,
8281 insn
->opc2
, &insn
->handler
) < 0)
8285 if (register_direct_insn(ppc_opcodes
, insn
->opc1
, &insn
->handler
) < 0)
8292 static int test_opcode_table (opc_handler_t
**table
, int len
)
8296 for (i
= 0, count
= 0; i
< len
; i
++) {
8297 /* Consistency fixup */
8298 if (table
[i
] == NULL
)
8299 table
[i
] = &invalid_handler
;
8300 if (table
[i
] != &invalid_handler
) {
8301 if (is_indirect_opcode(table
[i
])) {
8302 tmp
= test_opcode_table(ind_table(table
[i
]), 0x20);
8305 table
[i
] = &invalid_handler
;
8318 static void fix_opcode_tables (opc_handler_t
**ppc_opcodes
)
8320 if (test_opcode_table(ppc_opcodes
, 0x40) == 0)
8321 printf("*** WARNING: no opcode defined !\n");
8324 /*****************************************************************************/
8325 static void create_ppc_opcodes(PowerPCCPU
*cpu
, Error
**errp
)
8327 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8328 CPUPPCState
*env
= &cpu
->env
;
8331 fill_new_table(env
->opcodes
, 0x40);
8332 for (opc
= opcodes
; opc
< &opcodes
[ARRAY_SIZE(opcodes
)]; opc
++) {
8333 if (((opc
->handler
.type
& pcc
->insns_flags
) != 0) ||
8334 ((opc
->handler
.type2
& pcc
->insns_flags2
) != 0)) {
8335 if (register_insn(env
->opcodes
, opc
) < 0) {
8336 error_setg(errp
, "ERROR initializing PowerPC instruction "
8337 "0x%02x 0x%02x 0x%02x", opc
->opc1
, opc
->opc2
,
8343 fix_opcode_tables(env
->opcodes
);
8348 #if defined(PPC_DUMP_CPU)
8349 static void dump_ppc_insns (CPUPPCState
*env
)
8351 opc_handler_t
**table
, *handler
;
8353 uint8_t opc1
, opc2
, opc3
;
8355 printf("Instructions set:\n");
8356 /* opc1 is 6 bits long */
8357 for (opc1
= 0x00; opc1
< 0x40; opc1
++) {
8358 table
= env
->opcodes
;
8359 handler
= table
[opc1
];
8360 if (is_indirect_opcode(handler
)) {
8361 /* opc2 is 5 bits long */
8362 for (opc2
= 0; opc2
< 0x20; opc2
++) {
8363 table
= env
->opcodes
;
8364 handler
= env
->opcodes
[opc1
];
8365 table
= ind_table(handler
);
8366 handler
= table
[opc2
];
8367 if (is_indirect_opcode(handler
)) {
8368 table
= ind_table(handler
);
8369 /* opc3 is 5 bits long */
8370 for (opc3
= 0; opc3
< 0x20; opc3
++) {
8371 handler
= table
[opc3
];
8372 if (handler
->handler
!= &gen_invalid
) {
8373 /* Special hack to properly dump SPE insns */
8374 p
= strchr(handler
->oname
, '_');
8376 printf("INSN: %02x %02x %02x (%02d %04d) : "
8378 opc1
, opc2
, opc3
, opc1
,
8383 if ((p
- handler
->oname
) != strlen(q
) ||
8384 memcmp(handler
->oname
, q
, strlen(q
)) != 0) {
8385 /* First instruction */
8386 printf("INSN: %02x %02x %02x (%02d %04d) : "
8388 opc1
, opc2
<< 1, opc3
, opc1
,
8389 (opc3
<< 6) | (opc2
<< 1),
8390 (int)(p
- handler
->oname
),
8393 if (strcmp(p
+ 1, q
) != 0) {
8394 /* Second instruction */
8395 printf("INSN: %02x %02x %02x (%02d %04d) : "
8397 opc1
, (opc2
<< 1) | 1, opc3
, opc1
,
8398 (opc3
<< 6) | (opc2
<< 1) | 1,
8405 if (handler
->handler
!= &gen_invalid
) {
8406 printf("INSN: %02x %02x -- (%02d %04d) : %s\n",
8407 opc1
, opc2
, opc1
, opc2
, handler
->oname
);
8412 if (handler
->handler
!= &gen_invalid
) {
8413 printf("INSN: %02x -- -- (%02d ----) : %s\n",
8414 opc1
, opc1
, handler
->oname
);
8421 static int gdb_get_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8424 stfq_p(mem_buf
, env
->fpr
[n
]);
8428 stl_p(mem_buf
, env
->fpscr
);
8434 static int gdb_set_float_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8437 env
->fpr
[n
] = ldfq_p(mem_buf
);
8441 helper_store_fpscr(env
, ldl_p(mem_buf
), 0xffffffff);
8447 static int gdb_get_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8450 #ifdef HOST_WORDS_BIGENDIAN
8451 stq_p(mem_buf
, env
->avr
[n
].u64
[0]);
8452 stq_p(mem_buf
+8, env
->avr
[n
].u64
[1]);
8454 stq_p(mem_buf
, env
->avr
[n
].u64
[1]);
8455 stq_p(mem_buf
+8, env
->avr
[n
].u64
[0]);
8460 stl_p(mem_buf
, env
->vscr
);
8464 stl_p(mem_buf
, (uint32_t)env
->spr
[SPR_VRSAVE
]);
8470 static int gdb_set_avr_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8473 #ifdef HOST_WORDS_BIGENDIAN
8474 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
);
8475 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
+8);
8477 env
->avr
[n
].u64
[1] = ldq_p(mem_buf
);
8478 env
->avr
[n
].u64
[0] = ldq_p(mem_buf
+8);
8483 env
->vscr
= ldl_p(mem_buf
);
8487 env
->spr
[SPR_VRSAVE
] = (target_ulong
)ldl_p(mem_buf
);
8493 static int gdb_get_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8496 #if defined(TARGET_PPC64)
8497 stl_p(mem_buf
, env
->gpr
[n
] >> 32);
8499 stl_p(mem_buf
, env
->gprh
[n
]);
8504 stq_p(mem_buf
, env
->spe_acc
);
8508 stl_p(mem_buf
, env
->spe_fscr
);
8514 static int gdb_set_spe_reg(CPUPPCState
*env
, uint8_t *mem_buf
, int n
)
8517 #if defined(TARGET_PPC64)
8518 target_ulong lo
= (uint32_t)env
->gpr
[n
];
8519 target_ulong hi
= (target_ulong
)ldl_p(mem_buf
) << 32;
8520 env
->gpr
[n
] = lo
| hi
;
8522 env
->gprh
[n
] = ldl_p(mem_buf
);
8527 env
->spe_acc
= ldq_p(mem_buf
);
8531 env
->spe_fscr
= ldl_p(mem_buf
);
8537 static int ppc_fixup_cpu(PowerPCCPU
*cpu
)
8539 CPUPPCState
*env
= &cpu
->env
;
8541 /* TCG doesn't (yet) emulate some groups of instructions that
8542 * are implemented on some otherwise supported CPUs (e.g. VSX
8543 * and decimal floating point instructions on POWER7). We
8544 * remove unsupported instruction groups from the cpu state's
8545 * instruction masks and hope the guest can cope. For at
8546 * least the pseries machine, the unavailability of these
8547 * instructions can be advertised to the guest via the device
8549 if ((env
->insns_flags
& ~PPC_TCG_INSNS
)
8550 || (env
->insns_flags2
& ~PPC_TCG_INSNS2
)) {
8551 fprintf(stderr
, "Warning: Disabling some instructions which are not "
8552 "emulated by TCG (0x%" PRIx64
", 0x%" PRIx64
")\n",
8553 env
->insns_flags
& ~PPC_TCG_INSNS
,
8554 env
->insns_flags2
& ~PPC_TCG_INSNS2
);
8556 env
->insns_flags
&= PPC_TCG_INSNS
;
8557 env
->insns_flags2
&= PPC_TCG_INSNS2
;
8561 static inline bool ppc_cpu_is_valid(PowerPCCPUClass
*pcc
)
8563 #ifdef TARGET_PPCEMB
8564 return pcc
->mmu_model
== POWERPC_MMU_BOOKE
||
8565 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx
||
8566 pcc
->mmu_model
== POWERPC_MMU_SOFT_4xx_Z
;
8572 static void ppc_cpu_realizefn(DeviceState
*dev
, Error
**errp
)
8574 CPUState
*cs
= CPU(dev
);
8575 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
8576 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
8577 Error
*local_err
= NULL
;
8578 #if !defined(CONFIG_USER_ONLY)
8579 int max_smt
= kvm_enabled() ? kvmppc_smt_threads() : 1;
8582 #if !defined(CONFIG_USER_ONLY)
8583 if (smp_threads
> max_smt
) {
8584 error_setg(errp
, "Cannot support more than %d threads on PPC with %s",
8585 max_smt
, kvm_enabled() ? "KVM" : "TCG");
8588 if (!is_power_of_2(smp_threads
)) {
8589 error_setg(errp
, "Cannot support %d threads on PPC with %s, "
8590 "threads count must be a power of 2.",
8591 smp_threads
, kvm_enabled() ? "KVM" : "TCG");
8595 cpu
->cpu_dt_id
= (cs
->cpu_index
/ smp_threads
) * max_smt
8596 + (cs
->cpu_index
% smp_threads
);
8599 if (tcg_enabled()) {
8600 if (ppc_fixup_cpu(cpu
) != 0) {
8601 error_setg(errp
, "Unable to emulate selected CPU with TCG");
8606 #if defined(TARGET_PPCEMB)
8607 if (!ppc_cpu_is_valid(pcc
)) {
8608 error_setg(errp
, "CPU does not possess a BookE or 4xx MMU. "
8609 "Please use qemu-system-ppc or qemu-system-ppc64 instead "
8610 "or choose another CPU model.");
8615 create_ppc_opcodes(cpu
, &local_err
);
8616 if (local_err
!= NULL
) {
8617 error_propagate(errp
, local_err
);
8622 if (pcc
->insns_flags
& PPC_FLOAT
) {
8623 gdb_register_coprocessor(cs
, gdb_get_float_reg
, gdb_set_float_reg
,
8624 33, "power-fpu.xml", 0);
8626 if (pcc
->insns_flags
& PPC_ALTIVEC
) {
8627 gdb_register_coprocessor(cs
, gdb_get_avr_reg
, gdb_set_avr_reg
,
8628 34, "power-altivec.xml", 0);
8630 if (pcc
->insns_flags
& PPC_SPE
) {
8631 gdb_register_coprocessor(cs
, gdb_get_spe_reg
, gdb_set_spe_reg
,
8632 34, "power-spe.xml", 0);
8637 pcc
->parent_realize(dev
, errp
);
8639 #if defined(PPC_DUMP_CPU)
8641 CPUPPCState
*env
= &cpu
->env
;
8642 const char *mmu_model
, *excp_model
, *bus_model
;
8643 switch (env
->mmu_model
) {
8644 case POWERPC_MMU_32B
:
8645 mmu_model
= "PowerPC 32";
8647 case POWERPC_MMU_SOFT_6xx
:
8648 mmu_model
= "PowerPC 6xx/7xx with software driven TLBs";
8650 case POWERPC_MMU_SOFT_74xx
:
8651 mmu_model
= "PowerPC 74xx with software driven TLBs";
8653 case POWERPC_MMU_SOFT_4xx
:
8654 mmu_model
= "PowerPC 4xx with software driven TLBs";
8656 case POWERPC_MMU_SOFT_4xx_Z
:
8657 mmu_model
= "PowerPC 4xx with software driven TLBs "
8658 "and zones protections";
8660 case POWERPC_MMU_REAL
:
8661 mmu_model
= "PowerPC real mode only";
8663 case POWERPC_MMU_MPC8xx
:
8664 mmu_model
= "PowerPC MPC8xx";
8666 case POWERPC_MMU_BOOKE
:
8667 mmu_model
= "PowerPC BookE";
8669 case POWERPC_MMU_BOOKE206
:
8670 mmu_model
= "PowerPC BookE 2.06";
8672 case POWERPC_MMU_601
:
8673 mmu_model
= "PowerPC 601";
8675 #if defined (TARGET_PPC64)
8676 case POWERPC_MMU_64B
:
8677 mmu_model
= "PowerPC 64";
8681 mmu_model
= "Unknown or invalid";
8684 switch (env
->excp_model
) {
8685 case POWERPC_EXCP_STD
:
8686 excp_model
= "PowerPC";
8688 case POWERPC_EXCP_40x
:
8689 excp_model
= "PowerPC 40x";
8691 case POWERPC_EXCP_601
:
8692 excp_model
= "PowerPC 601";
8694 case POWERPC_EXCP_602
:
8695 excp_model
= "PowerPC 602";
8697 case POWERPC_EXCP_603
:
8698 excp_model
= "PowerPC 603";
8700 case POWERPC_EXCP_603E
:
8701 excp_model
= "PowerPC 603e";
8703 case POWERPC_EXCP_604
:
8704 excp_model
= "PowerPC 604";
8706 case POWERPC_EXCP_7x0
:
8707 excp_model
= "PowerPC 740/750";
8709 case POWERPC_EXCP_7x5
:
8710 excp_model
= "PowerPC 745/755";
8712 case POWERPC_EXCP_74xx
:
8713 excp_model
= "PowerPC 74xx";
8715 case POWERPC_EXCP_BOOKE
:
8716 excp_model
= "PowerPC BookE";
8718 #if defined (TARGET_PPC64)
8719 case POWERPC_EXCP_970
:
8720 excp_model
= "PowerPC 970";
8724 excp_model
= "Unknown or invalid";
8727 switch (env
->bus_model
) {
8728 case PPC_FLAGS_INPUT_6xx
:
8729 bus_model
= "PowerPC 6xx";
8731 case PPC_FLAGS_INPUT_BookE
:
8732 bus_model
= "PowerPC BookE";
8734 case PPC_FLAGS_INPUT_405
:
8735 bus_model
= "PowerPC 405";
8737 case PPC_FLAGS_INPUT_401
:
8738 bus_model
= "PowerPC 401/403";
8740 case PPC_FLAGS_INPUT_RCPU
:
8741 bus_model
= "RCPU / MPC8xx";
8743 #if defined (TARGET_PPC64)
8744 case PPC_FLAGS_INPUT_970
:
8745 bus_model
= "PowerPC 970";
8749 bus_model
= "Unknown or invalid";
8752 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64
"\n"
8753 " MMU model : %s\n",
8754 object_class_get_name(OBJECT_CLASS(pcc
)),
8755 pcc
->pvr
, pcc
->msr_mask
, mmu_model
);
8756 #if !defined(CONFIG_USER_ONLY)
8757 if (env
->tlb
.tlb6
) {
8758 printf(" %d %s TLB in %d ways\n",
8759 env
->nb_tlb
, env
->id_tlbs
? "splitted" : "merged",
8763 printf(" Exceptions model : %s\n"
8764 " Bus model : %s\n",
8765 excp_model
, bus_model
);
8766 printf(" MSR features :\n");
8767 if (env
->flags
& POWERPC_FLAG_SPE
)
8768 printf(" signal processing engine enable"
8770 else if (env
->flags
& POWERPC_FLAG_VRE
)
8771 printf(" vector processor enable\n");
8772 if (env
->flags
& POWERPC_FLAG_TGPR
)
8773 printf(" temporary GPRs\n");
8774 else if (env
->flags
& POWERPC_FLAG_CE
)
8775 printf(" critical input enable\n");
8776 if (env
->flags
& POWERPC_FLAG_SE
)
8777 printf(" single-step trace mode\n");
8778 else if (env
->flags
& POWERPC_FLAG_DWE
)
8779 printf(" debug wait enable\n");
8780 else if (env
->flags
& POWERPC_FLAG_UBLE
)
8781 printf(" user BTB lock enable\n");
8782 if (env
->flags
& POWERPC_FLAG_BE
)
8783 printf(" branch-step trace mode\n");
8784 else if (env
->flags
& POWERPC_FLAG_DE
)
8785 printf(" debug interrupt enable\n");
8786 if (env
->flags
& POWERPC_FLAG_PX
)
8787 printf(" inclusive protection\n");
8788 else if (env
->flags
& POWERPC_FLAG_PMM
)
8789 printf(" performance monitor mark\n");
8790 if (env
->flags
== POWERPC_FLAG_NONE
)
8792 printf(" Time-base/decrementer clock source: %s\n",
8793 env
->flags
& POWERPC_FLAG_RTC_CLK
? "RTC clock" : "bus clock");
8794 dump_ppc_insns(env
);
8801 static void ppc_cpu_unrealizefn(DeviceState
*dev
, Error
**errp
)
8803 PowerPCCPU
*cpu
= POWERPC_CPU(dev
);
8804 CPUPPCState
*env
= &cpu
->env
;
8807 for (i
= 0; i
< PPC_CPU_OPCODES_LEN
; i
++) {
8808 if (env
->opcodes
[i
] != &invalid_handler
) {
8809 g_free(env
->opcodes
[i
]);
8814 static gint
ppc_cpu_compare_class_pvr(gconstpointer a
, gconstpointer b
)
8816 ObjectClass
*oc
= (ObjectClass
*)a
;
8817 uint32_t pvr
= *(uint32_t *)b
;
8818 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
8820 /* -cpu host does a PVR lookup during construction */
8821 if (unlikely(strcmp(object_class_get_name(oc
),
8822 TYPE_HOST_POWERPC_CPU
) == 0)) {
8826 if (!ppc_cpu_is_valid(pcc
)) {
8830 return pcc
->pvr
== pvr
? 0 : -1;
8833 PowerPCCPUClass
*ppc_cpu_class_by_pvr(uint32_t pvr
)
8835 GSList
*list
, *item
;
8836 PowerPCCPUClass
*pcc
= NULL
;
8838 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
8839 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr
);
8841 pcc
= POWERPC_CPU_CLASS(item
->data
);
8848 static gint
ppc_cpu_compare_class_pvr_mask(gconstpointer a
, gconstpointer b
)
8850 ObjectClass
*oc
= (ObjectClass
*)a
;
8851 uint32_t pvr
= *(uint32_t *)b
;
8852 PowerPCCPUClass
*pcc
= (PowerPCCPUClass
*)a
;
8855 /* -cpu host does a PVR lookup during construction */
8856 if (unlikely(strcmp(object_class_get_name(oc
),
8857 TYPE_HOST_POWERPC_CPU
) == 0)) {
8861 if (!ppc_cpu_is_valid(pcc
)) {
8865 ret
= (((pcc
->pvr
& pcc
->pvr_mask
) == (pvr
& pcc
->pvr_mask
)) ? 0 : -1);
8870 PowerPCCPUClass
*ppc_cpu_class_by_pvr_mask(uint32_t pvr
)
8872 GSList
*list
, *item
;
8873 PowerPCCPUClass
*pcc
= NULL
;
8875 list
= object_class_get_list(TYPE_POWERPC_CPU
, true);
8876 item
= g_slist_find_custom(list
, &pvr
, ppc_cpu_compare_class_pvr_mask
);
8878 pcc
= POWERPC_CPU_CLASS(item
->data
);
8885 static gint
ppc_cpu_compare_class_name(gconstpointer a
, gconstpointer b
)
8887 ObjectClass
*oc
= (ObjectClass
*)a
;
8888 const char *name
= b
;
8889 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
8891 if (strncasecmp(name
, object_class_get_name(oc
), strlen(name
)) == 0 &&
8892 ppc_cpu_is_valid(pcc
) &&
8893 strcmp(object_class_get_name(oc
) + strlen(name
),
8894 "-" TYPE_POWERPC_CPU
) == 0) {
8902 static ObjectClass
*ppc_cpu_class_by_name(const char *name
);
8904 static ObjectClass
*ppc_cpu_class_by_alias(PowerPCCPUAlias
*alias
)
8906 ObjectClass
*invalid_class
= (void*)ppc_cpu_class_by_alias
;
8908 /* Cache target class lookups in the alias table */
8910 alias
->oc
= ppc_cpu_class_by_name(alias
->model
);
8912 /* Fast check for non-existing aliases */
8913 alias
->oc
= invalid_class
;
8917 if (alias
->oc
== invalid_class
) {
8924 static ObjectClass
*ppc_cpu_class_by_name(const char *name
)
8926 GSList
*list
, *item
;
8927 ObjectClass
*ret
= NULL
;
8931 /* Check if the given name is a PVR */
8933 if (len
== 10 && name
[0] == '0' && name
[1] == 'x') {
8936 } else if (len
== 8) {
8939 for (i
= 0; i
< 8; i
++) {
8940 if (!qemu_isxdigit(*p
++))
8944 ret
= OBJECT_CLASS(ppc_cpu_class_by_pvr(strtoul(name
, NULL
, 16)));
8949 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
8950 item
= g_slist_find_custom(list
, name
, ppc_cpu_compare_class_name
);
8952 ret
= OBJECT_CLASS(item
->data
);
8960 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
8961 if (strcmp(ppc_cpu_aliases
[i
].alias
, name
) == 0) {
8962 return ppc_cpu_class_by_alias(&ppc_cpu_aliases
[i
]);
8969 PowerPCCPU
*cpu_ppc_init(const char *cpu_model
)
8971 return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU
, cpu_model
));
8974 /* Sort by PVR, ordering special case "host" last. */
8975 static gint
ppc_cpu_list_compare(gconstpointer a
, gconstpointer b
)
8977 ObjectClass
*oc_a
= (ObjectClass
*)a
;
8978 ObjectClass
*oc_b
= (ObjectClass
*)b
;
8979 PowerPCCPUClass
*pcc_a
= POWERPC_CPU_CLASS(oc_a
);
8980 PowerPCCPUClass
*pcc_b
= POWERPC_CPU_CLASS(oc_b
);
8981 const char *name_a
= object_class_get_name(oc_a
);
8982 const char *name_b
= object_class_get_name(oc_b
);
8984 if (strcmp(name_a
, TYPE_HOST_POWERPC_CPU
) == 0) {
8986 } else if (strcmp(name_b
, TYPE_HOST_POWERPC_CPU
) == 0) {
8989 /* Avoid an integer overflow during subtraction */
8990 if (pcc_a
->pvr
< pcc_b
->pvr
) {
8992 } else if (pcc_a
->pvr
> pcc_b
->pvr
) {
9000 static void ppc_cpu_list_entry(gpointer data
, gpointer user_data
)
9002 ObjectClass
*oc
= data
;
9003 CPUListState
*s
= user_data
;
9004 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9005 const char *typename
= object_class_get_name(oc
);
9009 if (!ppc_cpu_is_valid(pcc
)) {
9012 if (unlikely(strcmp(typename
, TYPE_HOST_POWERPC_CPU
) == 0)) {
9016 name
= g_strndup(typename
,
9017 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
9018 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s PVR %08x\n",
9020 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9021 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
9022 ObjectClass
*alias_oc
= ppc_cpu_class_by_alias(alias
);
9024 if (alias_oc
!= oc
) {
9027 (*s
->cpu_fprintf
)(s
->file
, "PowerPC %-16s (alias for %s)\n",
9028 alias
->alias
, name
);
9033 void ppc_cpu_list(FILE *f
, fprintf_function cpu_fprintf
)
9037 .cpu_fprintf
= cpu_fprintf
,
9041 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9042 list
= g_slist_sort(list
, ppc_cpu_list_compare
);
9043 g_slist_foreach(list
, ppc_cpu_list_entry
, &s
);
9047 cpu_fprintf(f
, "\n");
9048 cpu_fprintf(f
, "PowerPC %-16s\n", "host");
9052 static void ppc_cpu_defs_entry(gpointer data
, gpointer user_data
)
9054 ObjectClass
*oc
= data
;
9055 CpuDefinitionInfoList
**first
= user_data
;
9056 const char *typename
;
9057 CpuDefinitionInfoList
*entry
;
9058 CpuDefinitionInfo
*info
;
9059 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9061 if (!ppc_cpu_is_valid(pcc
)) {
9065 typename
= object_class_get_name(oc
);
9066 info
= g_malloc0(sizeof(*info
));
9067 info
->name
= g_strndup(typename
,
9068 strlen(typename
) - strlen("-" TYPE_POWERPC_CPU
));
9070 entry
= g_malloc0(sizeof(*entry
));
9071 entry
->value
= info
;
9072 entry
->next
= *first
;
9076 CpuDefinitionInfoList
*arch_query_cpu_definitions(Error
**errp
)
9078 CpuDefinitionInfoList
*cpu_list
= NULL
;
9082 list
= object_class_get_list(TYPE_POWERPC_CPU
, false);
9083 g_slist_foreach(list
, ppc_cpu_defs_entry
, &cpu_list
);
9086 for (i
= 0; ppc_cpu_aliases
[i
].alias
!= NULL
; i
++) {
9087 PowerPCCPUAlias
*alias
= &ppc_cpu_aliases
[i
];
9089 CpuDefinitionInfoList
*entry
;
9090 CpuDefinitionInfo
*info
;
9092 oc
= ppc_cpu_class_by_alias(alias
);
9097 info
= g_malloc0(sizeof(*info
));
9098 info
->name
= g_strdup(alias
->alias
);
9100 entry
= g_malloc0(sizeof(*entry
));
9101 entry
->value
= info
;
9102 entry
->next
= cpu_list
;
9109 static void ppc_cpu_set_pc(CPUState
*cs
, vaddr value
)
9111 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9113 cpu
->env
.nip
= value
;
9116 static bool ppc_cpu_has_work(CPUState
*cs
)
9118 PowerPCCPU
*cpu
= POWERPC_CPU(cs
);
9119 CPUPPCState
*env
= &cpu
->env
;
9121 return msr_ee
&& (cs
->interrupt_request
& CPU_INTERRUPT_HARD
);
9124 /* CPUClass::reset() */
9125 static void ppc_cpu_reset(CPUState
*s
)
9127 PowerPCCPU
*cpu
= POWERPC_CPU(s
);
9128 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9129 CPUPPCState
*env
= &cpu
->env
;
9133 pcc
->parent_reset(s
);
9135 msr
= (target_ulong
)0;
9137 /* XXX: find a suitable condition to enable the hypervisor mode */
9138 msr
|= (target_ulong
)MSR_HVB
;
9140 msr
|= (target_ulong
)0 << MSR_AP
; /* TO BE CHECKED */
9141 msr
|= (target_ulong
)0 << MSR_SA
; /* TO BE CHECKED */
9142 msr
|= (target_ulong
)1 << MSR_EP
;
9143 #if defined(DO_SINGLE_STEP) && 0
9144 /* Single step trace mode */
9145 msr
|= (target_ulong
)1 << MSR_SE
;
9146 msr
|= (target_ulong
)1 << MSR_BE
;
9148 #if defined(CONFIG_USER_ONLY)
9149 msr
|= (target_ulong
)1 << MSR_FP
; /* Allow floating point usage */
9150 msr
|= (target_ulong
)1 << MSR_VR
; /* Allow altivec usage */
9151 msr
|= (target_ulong
)1 << MSR_SPE
; /* Allow SPE usage */
9152 msr
|= (target_ulong
)1 << MSR_PR
;
9155 #if defined(TARGET_PPC64)
9156 if (env
->mmu_model
& POWERPC_MMU_64
) {
9157 env
->msr
|= (1ULL << MSR_SF
);
9161 hreg_store_msr(env
, msr
, 1);
9163 #if !defined(CONFIG_USER_ONLY)
9164 env
->nip
= env
->hreset_vector
| env
->excp_prefix
;
9165 if (env
->mmu_model
!= POWERPC_MMU_REAL
) {
9166 ppc_tlb_invalidate_all(env
);
9170 hreg_compute_hflags(env
);
9171 env
->reserve_addr
= (target_ulong
)-1ULL;
9172 /* Be sure no exception or interrupt is pending */
9173 env
->pending_interrupts
= 0;
9174 s
->exception_index
= POWERPC_EXCP_NONE
;
9175 env
->error_code
= 0;
9177 #if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
9179 env
->slb_shadow_addr
= 0;
9180 env
->slb_shadow_size
= 0;
9183 #endif /* TARGET_PPC64 */
9185 for (i
= 0; i
< ARRAY_SIZE(env
->spr_cb
); i
++) {
9186 ppc_spr_t
*spr
= &env
->spr_cb
[i
];
9191 env
->spr
[i
] = spr
->default_value
;
9194 /* Flush all TLBs */
9198 static void ppc_cpu_initfn(Object
*obj
)
9200 CPUState
*cs
= CPU(obj
);
9201 PowerPCCPU
*cpu
= POWERPC_CPU(obj
);
9202 PowerPCCPUClass
*pcc
= POWERPC_CPU_GET_CLASS(cpu
);
9203 CPUPPCState
*env
= &cpu
->env
;
9207 cpu
->cpu_dt_id
= cs
->cpu_index
;
9209 env
->msr_mask
= pcc
->msr_mask
;
9210 env
->mmu_model
= pcc
->mmu_model
;
9211 env
->excp_model
= pcc
->excp_model
;
9212 env
->bus_model
= pcc
->bus_model
;
9213 env
->insns_flags
= pcc
->insns_flags
;
9214 env
->insns_flags2
= pcc
->insns_flags2
;
9215 env
->flags
= pcc
->flags
;
9216 env
->bfd_mach
= pcc
->bfd_mach
;
9217 env
->check_pow
= pcc
->check_pow
;
9219 #if defined(TARGET_PPC64)
9221 env
->sps
= *pcc
->sps
;
9222 } else if (env
->mmu_model
& POWERPC_MMU_64
) {
9223 /* Use default sets of page sizes */
9224 static const struct ppc_segment_page_sizes defsps
= {
9226 { .page_shift
= 12, /* 4K */
9228 .enc
= { { .page_shift
= 12, .pte_enc
= 0 } }
9230 { .page_shift
= 24, /* 16M */
9232 .enc
= { { .page_shift
= 24, .pte_enc
= 0 } }
9238 #endif /* defined(TARGET_PPC64) */
9240 if (tcg_enabled()) {
9241 ppc_translate_init();
9245 static void ppc_cpu_class_init(ObjectClass
*oc
, void *data
)
9247 PowerPCCPUClass
*pcc
= POWERPC_CPU_CLASS(oc
);
9248 CPUClass
*cc
= CPU_CLASS(oc
);
9249 DeviceClass
*dc
= DEVICE_CLASS(oc
);
9251 pcc
->parent_realize
= dc
->realize
;
9252 pcc
->pvr
= CPU_POWERPC_DEFAULT_MASK
;
9253 pcc
->pvr_mask
= CPU_POWERPC_DEFAULT_MASK
;
9254 dc
->realize
= ppc_cpu_realizefn
;
9255 dc
->unrealize
= ppc_cpu_unrealizefn
;
9257 pcc
->parent_reset
= cc
->reset
;
9258 cc
->reset
= ppc_cpu_reset
;
9260 cc
->class_by_name
= ppc_cpu_class_by_name
;
9261 cc
->has_work
= ppc_cpu_has_work
;
9262 cc
->do_interrupt
= ppc_cpu_do_interrupt
;
9263 cc
->dump_state
= ppc_cpu_dump_state
;
9264 cc
->dump_statistics
= ppc_cpu_dump_statistics
;
9265 cc
->set_pc
= ppc_cpu_set_pc
;
9266 cc
->gdb_read_register
= ppc_cpu_gdb_read_register
;
9267 cc
->gdb_write_register
= ppc_cpu_gdb_write_register
;
9268 #ifdef CONFIG_USER_ONLY
9269 cc
->handle_mmu_fault
= ppc_cpu_handle_mmu_fault
;
9271 cc
->get_phys_page_debug
= ppc_cpu_get_phys_page_debug
;
9272 cc
->vmsd
= &vmstate_ppc_cpu
;
9273 #if defined(TARGET_PPC64)
9274 cc
->write_elf64_note
= ppc64_cpu_write_elf64_note
;
9275 cc
->write_elf64_qemunote
= ppc64_cpu_write_elf64_qemunote
;
9279 cc
->gdb_num_core_regs
= 71;
9280 #if defined(TARGET_PPC64)
9281 cc
->gdb_core_xml_file
= "power64-core.xml";
9283 cc
->gdb_core_xml_file
= "power-core.xml";
9286 dc
->fw_name
= "PowerPC,UNKNOWN";
9289 static const TypeInfo ppc_cpu_type_info
= {
9290 .name
= TYPE_POWERPC_CPU
,
9292 .instance_size
= sizeof(PowerPCCPU
),
9293 .instance_init
= ppc_cpu_initfn
,
9295 .class_size
= sizeof(PowerPCCPUClass
),
9296 .class_init
= ppc_cpu_class_init
,
9299 static void ppc_cpu_register_types(void)
9301 type_register_static(&ppc_cpu_type_info
);
9304 type_init(ppc_cpu_register_types
)