]> git.proxmox.com Git - mirror_qemu.git/blame - target-ppc/translate_init.c
A little more granularity in PowerPC instructions definition is needed
[mirror_qemu.git] / target-ppc / translate_init.c
CommitLineData
3fc6c082
FB
1/*
2 * PowerPC CPU initialization for qemu.
5fafdf24 3 *
76a66253 4 * Copyright (c) 2003-2007 Jocelyn Mayer
3fc6c082
FB
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/* A lot of PowerPC definition have been included here.
22 * Most of them are not usable for now but have been kept
23 * inside "#if defined(TODO) ... #endif" statements to make tests easier.
24 */
25
237c0af0 26#include "dis-asm.h"
ee4e83ed 27#include "host-utils.h"
237c0af0 28
3fc6c082
FB
29//#define PPC_DUMP_CPU
30//#define PPC_DEBUG_SPR
a496775f 31//#define PPC_DEBUG_IRQ
3fc6c082
FB
32
33struct ppc_def_t {
34 const unsigned char *name;
35 uint32_t pvr;
0487d6a8 36 uint64_t insns_flags;
3fc6c082 37 uint64_t msr_mask;
7820dbf3
JM
38 powerpc_mmu_t mmu_model;
39 powerpc_excp_t excp_model;
40 powerpc_input_t bus_model;
d26bfc9a 41 uint32_t flags;
237c0af0 42 int bfd_mach;
a750fc0b 43 void (*init_proc)(CPUPPCState *env);
2f462816 44 int (*check_pow)(CPUPPCState *env);
3fc6c082
FB
45};
46
e9df014c
JM
47/* For user-mode emulation, we don't emulate any IRQ controller */
48#if defined(CONFIG_USER_ONLY)
a750fc0b
JM
49#define PPC_IRQ_INIT_FN(name) \
50static inline void glue(glue(ppc, name),_irq_init) (CPUPPCState *env) \
51{ \
e9df014c
JM
52}
53#else
a750fc0b 54#define PPC_IRQ_INIT_FN(name) \
e9df014c
JM
55void glue(glue(ppc, name),_irq_init) (CPUPPCState *env);
56#endif
a750fc0b 57
4e290a0b 58PPC_IRQ_INIT_FN(40x);
e9df014c 59PPC_IRQ_INIT_FN(6xx);
d0dfae6e 60PPC_IRQ_INIT_FN(970);
e9df014c 61
3fc6c082
FB
62/* Generic callbacks:
63 * do nothing but store/retrieve spr value
64 */
04f20795 65#ifdef PPC_DUMP_SPR_ACCESSES
3fc6c082
FB
66static void spr_read_generic (void *opaque, int sprn)
67{
04f20795 68 gen_op_load_dump_spr(sprn);
3fc6c082
FB
69}
70
71static void spr_write_generic (void *opaque, int sprn)
72{
04f20795 73 gen_op_store_dump_spr(sprn);
3fc6c082 74}
04f20795
JM
75#else
76static void spr_read_generic (void *opaque, int sprn)
a496775f 77{
04f20795 78 gen_op_load_spr(sprn);
a496775f
JM
79}
80
04f20795 81static void spr_write_generic (void *opaque, int sprn)
a496775f 82{
04f20795 83 gen_op_store_spr(sprn);
a496775f 84}
04f20795 85#endif
a496775f
JM
86
87#if !defined(CONFIG_USER_ONLY)
88static void spr_write_clear (void *opaque, int sprn)
89{
90 gen_op_mask_spr(sprn);
91}
92#endif
93
76a66253 94/* SPR common to all PowerPC */
3fc6c082
FB
95/* XER */
96static void spr_read_xer (void *opaque, int sprn)
97{
98 gen_op_load_xer();
99}
100
101static void spr_write_xer (void *opaque, int sprn)
102{
103 gen_op_store_xer();
104}
105
106/* LR */
107static void spr_read_lr (void *opaque, int sprn)
108{
109 gen_op_load_lr();
110}
111
112static void spr_write_lr (void *opaque, int sprn)
113{
114 gen_op_store_lr();
115}
116
117/* CTR */
118static void spr_read_ctr (void *opaque, int sprn)
119{
120 gen_op_load_ctr();
121}
122
123static void spr_write_ctr (void *opaque, int sprn)
124{
125 gen_op_store_ctr();
126}
127
128/* User read access to SPR */
129/* USPRx */
130/* UMMCRx */
131/* UPMCx */
132/* USIA */
133/* UDECR */
134static void spr_read_ureg (void *opaque, int sprn)
135{
136 gen_op_load_spr(sprn + 0x10);
137}
138
76a66253 139/* SPR common to all non-embedded PowerPC */
3fc6c082 140/* DECR */
76a66253 141#if !defined(CONFIG_USER_ONLY)
3fc6c082
FB
142static void spr_read_decr (void *opaque, int sprn)
143{
144 gen_op_load_decr();
145}
146
147static void spr_write_decr (void *opaque, int sprn)
148{
149 gen_op_store_decr();
150}
76a66253 151#endif
3fc6c082 152
76a66253 153/* SPR common to all non-embedded PowerPC, except 601 */
3fc6c082
FB
154/* Time base */
155static void spr_read_tbl (void *opaque, int sprn)
156{
157 gen_op_load_tbl();
158}
159
76a66253 160static void spr_read_tbu (void *opaque, int sprn)
3fc6c082 161{
76a66253 162 gen_op_load_tbu();
3fc6c082
FB
163}
164
a062e36c
JM
165__attribute__ (( unused ))
166static void spr_read_atbl (void *opaque, int sprn)
167{
168 gen_op_load_atbl();
169}
170
171__attribute__ (( unused ))
172static void spr_read_atbu (void *opaque, int sprn)
173{
174 gen_op_load_atbu();
175}
176
76a66253
JM
177#if !defined(CONFIG_USER_ONLY)
178static void spr_write_tbl (void *opaque, int sprn)
3fc6c082 179{
76a66253 180 gen_op_store_tbl();
3fc6c082
FB
181}
182
183static void spr_write_tbu (void *opaque, int sprn)
184{
185 gen_op_store_tbu();
186}
a062e36c
JM
187
188__attribute__ (( unused ))
189static void spr_write_atbl (void *opaque, int sprn)
190{
191 gen_op_store_atbl();
192}
193
194__attribute__ (( unused ))
195static void spr_write_atbu (void *opaque, int sprn)
196{
197 gen_op_store_atbu();
198}
76a66253 199#endif
3fc6c082 200
76a66253 201#if !defined(CONFIG_USER_ONLY)
3fc6c082
FB
202/* IBAT0U...IBAT0U */
203/* IBAT0L...IBAT7L */
204static void spr_read_ibat (void *opaque, int sprn)
205{
206 gen_op_load_ibat(sprn & 1, (sprn - SPR_IBAT0U) / 2);
207}
208
209static void spr_read_ibat_h (void *opaque, int sprn)
210{
211 gen_op_load_ibat(sprn & 1, (sprn - SPR_IBAT4U) / 2);
212}
213
214static void spr_write_ibatu (void *opaque, int sprn)
215{
3fc6c082 216 gen_op_store_ibatu((sprn - SPR_IBAT0U) / 2);
3fc6c082
FB
217}
218
219static void spr_write_ibatu_h (void *opaque, int sprn)
220{
3fc6c082 221 gen_op_store_ibatu((sprn - SPR_IBAT4U) / 2);
3fc6c082
FB
222}
223
224static void spr_write_ibatl (void *opaque, int sprn)
225{
3fc6c082 226 gen_op_store_ibatl((sprn - SPR_IBAT0L) / 2);
3fc6c082
FB
227}
228
229static void spr_write_ibatl_h (void *opaque, int sprn)
230{
3fc6c082 231 gen_op_store_ibatl((sprn - SPR_IBAT4L) / 2);
3fc6c082
FB
232}
233
234/* DBAT0U...DBAT7U */
235/* DBAT0L...DBAT7L */
236static void spr_read_dbat (void *opaque, int sprn)
237{
238 gen_op_load_dbat(sprn & 1, (sprn - SPR_DBAT0U) / 2);
239}
240
241static void spr_read_dbat_h (void *opaque, int sprn)
242{
2e13d23a 243 gen_op_load_dbat(sprn & 1, ((sprn - SPR_DBAT4U) / 2) + 4);
3fc6c082
FB
244}
245
246static void spr_write_dbatu (void *opaque, int sprn)
247{
3fc6c082 248 gen_op_store_dbatu((sprn - SPR_DBAT0U) / 2);
3fc6c082
FB
249}
250
251static void spr_write_dbatu_h (void *opaque, int sprn)
252{
2e13d23a 253 gen_op_store_dbatu(((sprn - SPR_DBAT4U) / 2) + 4);
3fc6c082
FB
254}
255
256static void spr_write_dbatl (void *opaque, int sprn)
257{
3fc6c082 258 gen_op_store_dbatl((sprn - SPR_DBAT0L) / 2);
3fc6c082
FB
259}
260
261static void spr_write_dbatl_h (void *opaque, int sprn)
262{
2e13d23a 263 gen_op_store_dbatl(((sprn - SPR_DBAT4L) / 2) + 4);
3fc6c082
FB
264}
265
266/* SDR1 */
267static void spr_read_sdr1 (void *opaque, int sprn)
268{
269 gen_op_load_sdr1();
270}
271
272static void spr_write_sdr1 (void *opaque, int sprn)
273{
3fc6c082 274 gen_op_store_sdr1();
3fc6c082
FB
275}
276
76a66253
JM
277/* 64 bits PowerPC specific SPRs */
278/* ASR */
578bb252
JM
279#if defined(TARGET_PPC64)
280__attribute__ (( unused ))
76a66253
JM
281static void spr_read_asr (void *opaque, int sprn)
282{
283 gen_op_load_asr();
284}
285
578bb252 286__attribute__ (( unused ))
76a66253
JM
287static void spr_write_asr (void *opaque, int sprn)
288{
76a66253 289 gen_op_store_asr();
76a66253
JM
290}
291#endif
a750fc0b 292#endif
76a66253
JM
293
294/* PowerPC 601 specific registers */
295/* RTC */
296static void spr_read_601_rtcl (void *opaque, int sprn)
297{
298 gen_op_load_601_rtcl();
299}
300
301static void spr_read_601_rtcu (void *opaque, int sprn)
302{
303 gen_op_load_601_rtcu();
304}
305
306#if !defined(CONFIG_USER_ONLY)
307static void spr_write_601_rtcu (void *opaque, int sprn)
308{
309 gen_op_store_601_rtcu();
310}
311
312static void spr_write_601_rtcl (void *opaque, int sprn)
313{
314 gen_op_store_601_rtcl();
315}
056401ea
JM
316
317static void spr_write_hid0_601 (void *opaque, int sprn)
318{
319 DisasContext *ctx = opaque;
320
321 gen_op_store_hid0_601();
322 /* Must stop the translation as endianness may have changed */
323 GEN_STOP(ctx);
324}
76a66253
JM
325#endif
326
327/* Unified bats */
328#if !defined(CONFIG_USER_ONLY)
329static void spr_read_601_ubat (void *opaque, int sprn)
330{
331 gen_op_load_601_bat(sprn & 1, (sprn - SPR_IBAT0U) / 2);
332}
333
334static void spr_write_601_ubatu (void *opaque, int sprn)
335{
76a66253 336 gen_op_store_601_batu((sprn - SPR_IBAT0U) / 2);
76a66253
JM
337}
338
339static void spr_write_601_ubatl (void *opaque, int sprn)
340{
76a66253 341 gen_op_store_601_batl((sprn - SPR_IBAT0L) / 2);
76a66253
JM
342}
343#endif
344
345/* PowerPC 40x specific registers */
346#if !defined(CONFIG_USER_ONLY)
347static void spr_read_40x_pit (void *opaque, int sprn)
348{
349 gen_op_load_40x_pit();
350}
351
352static void spr_write_40x_pit (void *opaque, int sprn)
353{
354 gen_op_store_40x_pit();
355}
356
8ecc7913
JM
357static void spr_write_40x_dbcr0 (void *opaque, int sprn)
358{
359 DisasContext *ctx = opaque;
360
361 gen_op_store_40x_dbcr0();
362 /* We must stop translation as we may have rebooted */
e1833e1f 363 GEN_STOP(ctx);
8ecc7913
JM
364}
365
c294fc58
JM
366static void spr_write_40x_sler (void *opaque, int sprn)
367{
c294fc58 368 gen_op_store_40x_sler();
c294fc58
JM
369}
370
76a66253
JM
371static void spr_write_booke_tcr (void *opaque, int sprn)
372{
373 gen_op_store_booke_tcr();
374}
375
376static void spr_write_booke_tsr (void *opaque, int sprn)
377{
378 gen_op_store_booke_tsr();
379}
380#endif
381
382/* PowerPC 403 specific registers */
383/* PBL1 / PBU1 / PBL2 / PBU2 */
384#if !defined(CONFIG_USER_ONLY)
385static void spr_read_403_pbr (void *opaque, int sprn)
386{
387 gen_op_load_403_pb(sprn - SPR_403_PBL1);
388}
389
390static void spr_write_403_pbr (void *opaque, int sprn)
391{
76a66253 392 gen_op_store_403_pb(sprn - SPR_403_PBL1);
76a66253
JM
393}
394
3fc6c082
FB
395static void spr_write_pir (void *opaque, int sprn)
396{
397 gen_op_store_pir();
398}
76a66253 399#endif
3fc6c082 400
6f5d427d
JM
401#if !defined(CONFIG_USER_ONLY)
402/* Callback used to write the exception vector base */
403static void spr_write_excp_prefix (void *opaque, int sprn)
404{
405 gen_op_store_excp_prefix();
406 gen_op_store_spr(sprn);
407}
408
409static void spr_write_excp_vector (void *opaque, int sprn)
410{
411 DisasContext *ctx = opaque;
412
413 if (sprn >= SPR_BOOKE_IVOR0 && sprn <= SPR_BOOKE_IVOR15) {
414 gen_op_store_excp_vector(sprn - SPR_BOOKE_IVOR0);
415 gen_op_store_spr(sprn);
416 } else if (sprn >= SPR_BOOKE_IVOR32 && sprn <= SPR_BOOKE_IVOR37) {
417 gen_op_store_excp_vector(sprn - SPR_BOOKE_IVOR32 + 32);
418 gen_op_store_spr(sprn);
419 } else {
420 printf("Trying to write an unknown exception vector %d %03x\n",
421 sprn, sprn);
422 GEN_EXCP_PRIVREG(ctx);
423 }
424}
425#endif
426
76a66253
JM
427#if defined(CONFIG_USER_ONLY)
428#define spr_register(env, num, name, uea_read, uea_write, \
429 oea_read, oea_write, initial_value) \
430do { \
431 _spr_register(env, num, name, uea_read, uea_write, initial_value); \
432} while (0)
433static inline void _spr_register (CPUPPCState *env, int num,
434 const unsigned char *name,
435 void (*uea_read)(void *opaque, int sprn),
436 void (*uea_write)(void *opaque, int sprn),
437 target_ulong initial_value)
438#else
3fc6c082
FB
439static inline void spr_register (CPUPPCState *env, int num,
440 const unsigned char *name,
441 void (*uea_read)(void *opaque, int sprn),
442 void (*uea_write)(void *opaque, int sprn),
443 void (*oea_read)(void *opaque, int sprn),
444 void (*oea_write)(void *opaque, int sprn),
445 target_ulong initial_value)
76a66253 446#endif
3fc6c082
FB
447{
448 ppc_spr_t *spr;
449
450 spr = &env->spr_cb[num];
451 if (spr->name != NULL ||env-> spr[num] != 0x00000000 ||
76a66253
JM
452#if !defined(CONFIG_USER_ONLY)
453 spr->oea_read != NULL || spr->oea_write != NULL ||
454#endif
455 spr->uea_read != NULL || spr->uea_write != NULL) {
3fc6c082
FB
456 printf("Error: Trying to register SPR %d (%03x) twice !\n", num, num);
457 exit(1);
458 }
459#if defined(PPC_DEBUG_SPR)
1b9eb036 460 printf("*** register spr %d (%03x) %s val " ADDRX "\n", num, num, name,
76a66253 461 initial_value);
3fc6c082
FB
462#endif
463 spr->name = name;
464 spr->uea_read = uea_read;
465 spr->uea_write = uea_write;
76a66253 466#if !defined(CONFIG_USER_ONLY)
3fc6c082
FB
467 spr->oea_read = oea_read;
468 spr->oea_write = oea_write;
76a66253 469#endif
3fc6c082
FB
470 env->spr[num] = initial_value;
471}
472
473/* Generic PowerPC SPRs */
474static void gen_spr_generic (CPUPPCState *env)
475{
476 /* Integer processing */
477 spr_register(env, SPR_XER, "XER",
478 &spr_read_xer, &spr_write_xer,
479 &spr_read_xer, &spr_write_xer,
480 0x00000000);
481 /* Branch contol */
482 spr_register(env, SPR_LR, "LR",
483 &spr_read_lr, &spr_write_lr,
484 &spr_read_lr, &spr_write_lr,
485 0x00000000);
486 spr_register(env, SPR_CTR, "CTR",
487 &spr_read_ctr, &spr_write_ctr,
488 &spr_read_ctr, &spr_write_ctr,
489 0x00000000);
490 /* Interrupt processing */
491 spr_register(env, SPR_SRR0, "SRR0",
492 SPR_NOACCESS, SPR_NOACCESS,
493 &spr_read_generic, &spr_write_generic,
494 0x00000000);
495 spr_register(env, SPR_SRR1, "SRR1",
496 SPR_NOACCESS, SPR_NOACCESS,
497 &spr_read_generic, &spr_write_generic,
498 0x00000000);
499 /* Processor control */
500 spr_register(env, SPR_SPRG0, "SPRG0",
501 SPR_NOACCESS, SPR_NOACCESS,
502 &spr_read_generic, &spr_write_generic,
503 0x00000000);
504 spr_register(env, SPR_SPRG1, "SPRG1",
505 SPR_NOACCESS, SPR_NOACCESS,
506 &spr_read_generic, &spr_write_generic,
507 0x00000000);
508 spr_register(env, SPR_SPRG2, "SPRG2",
509 SPR_NOACCESS, SPR_NOACCESS,
510 &spr_read_generic, &spr_write_generic,
511 0x00000000);
512 spr_register(env, SPR_SPRG3, "SPRG3",
513 SPR_NOACCESS, SPR_NOACCESS,
514 &spr_read_generic, &spr_write_generic,
515 0x00000000);
516}
517
518/* SPR common to all non-embedded PowerPC, including 601 */
519static void gen_spr_ne_601 (CPUPPCState *env)
520{
521 /* Exception processing */
522 spr_register(env, SPR_DSISR, "DSISR",
523 SPR_NOACCESS, SPR_NOACCESS,
524 &spr_read_generic, &spr_write_generic,
525 0x00000000);
526 spr_register(env, SPR_DAR, "DAR",
527 SPR_NOACCESS, SPR_NOACCESS,
528 &spr_read_generic, &spr_write_generic,
529 0x00000000);
530 /* Timer */
531 spr_register(env, SPR_DECR, "DECR",
532 SPR_NOACCESS, SPR_NOACCESS,
533 &spr_read_decr, &spr_write_decr,
534 0x00000000);
535 /* Memory management */
536 spr_register(env, SPR_SDR1, "SDR1",
537 SPR_NOACCESS, SPR_NOACCESS,
538 &spr_read_sdr1, &spr_write_sdr1,
539 0x00000000);
540}
541
542/* BATs 0-3 */
543static void gen_low_BATs (CPUPPCState *env)
544{
f2e63a42 545#if !defined(CONFIG_USER_ONLY)
3fc6c082
FB
546 spr_register(env, SPR_IBAT0U, "IBAT0U",
547 SPR_NOACCESS, SPR_NOACCESS,
548 &spr_read_ibat, &spr_write_ibatu,
549 0x00000000);
550 spr_register(env, SPR_IBAT0L, "IBAT0L",
551 SPR_NOACCESS, SPR_NOACCESS,
552 &spr_read_ibat, &spr_write_ibatl,
553 0x00000000);
554 spr_register(env, SPR_IBAT1U, "IBAT1U",
555 SPR_NOACCESS, SPR_NOACCESS,
556 &spr_read_ibat, &spr_write_ibatu,
557 0x00000000);
558 spr_register(env, SPR_IBAT1L, "IBAT1L",
559 SPR_NOACCESS, SPR_NOACCESS,
560 &spr_read_ibat, &spr_write_ibatl,
561 0x00000000);
562 spr_register(env, SPR_IBAT2U, "IBAT2U",
563 SPR_NOACCESS, SPR_NOACCESS,
564 &spr_read_ibat, &spr_write_ibatu,
565 0x00000000);
566 spr_register(env, SPR_IBAT2L, "IBAT2L",
567 SPR_NOACCESS, SPR_NOACCESS,
568 &spr_read_ibat, &spr_write_ibatl,
569 0x00000000);
570 spr_register(env, SPR_IBAT3U, "IBAT3U",
571 SPR_NOACCESS, SPR_NOACCESS,
572 &spr_read_ibat, &spr_write_ibatu,
573 0x00000000);
574 spr_register(env, SPR_IBAT3L, "IBAT3L",
575 SPR_NOACCESS, SPR_NOACCESS,
576 &spr_read_ibat, &spr_write_ibatl,
577 0x00000000);
578 spr_register(env, SPR_DBAT0U, "DBAT0U",
579 SPR_NOACCESS, SPR_NOACCESS,
580 &spr_read_dbat, &spr_write_dbatu,
581 0x00000000);
582 spr_register(env, SPR_DBAT0L, "DBAT0L",
583 SPR_NOACCESS, SPR_NOACCESS,
584 &spr_read_dbat, &spr_write_dbatl,
585 0x00000000);
586 spr_register(env, SPR_DBAT1U, "DBAT1U",
587 SPR_NOACCESS, SPR_NOACCESS,
588 &spr_read_dbat, &spr_write_dbatu,
589 0x00000000);
590 spr_register(env, SPR_DBAT1L, "DBAT1L",
591 SPR_NOACCESS, SPR_NOACCESS,
592 &spr_read_dbat, &spr_write_dbatl,
593 0x00000000);
594 spr_register(env, SPR_DBAT2U, "DBAT2U",
595 SPR_NOACCESS, SPR_NOACCESS,
596 &spr_read_dbat, &spr_write_dbatu,
597 0x00000000);
598 spr_register(env, SPR_DBAT2L, "DBAT2L",
599 SPR_NOACCESS, SPR_NOACCESS,
600 &spr_read_dbat, &spr_write_dbatl,
601 0x00000000);
602 spr_register(env, SPR_DBAT3U, "DBAT3U",
603 SPR_NOACCESS, SPR_NOACCESS,
604 &spr_read_dbat, &spr_write_dbatu,
605 0x00000000);
606 spr_register(env, SPR_DBAT3L, "DBAT3L",
607 SPR_NOACCESS, SPR_NOACCESS,
608 &spr_read_dbat, &spr_write_dbatl,
609 0x00000000);
a750fc0b 610 env->nb_BATs += 4;
f2e63a42 611#endif
3fc6c082
FB
612}
613
614/* BATs 4-7 */
615static void gen_high_BATs (CPUPPCState *env)
616{
f2e63a42 617#if !defined(CONFIG_USER_ONLY)
3fc6c082
FB
618 spr_register(env, SPR_IBAT4U, "IBAT4U",
619 SPR_NOACCESS, SPR_NOACCESS,
620 &spr_read_ibat_h, &spr_write_ibatu_h,
621 0x00000000);
622 spr_register(env, SPR_IBAT4L, "IBAT4L",
623 SPR_NOACCESS, SPR_NOACCESS,
624 &spr_read_ibat_h, &spr_write_ibatl_h,
625 0x00000000);
626 spr_register(env, SPR_IBAT5U, "IBAT5U",
627 SPR_NOACCESS, SPR_NOACCESS,
628 &spr_read_ibat_h, &spr_write_ibatu_h,
629 0x00000000);
630 spr_register(env, SPR_IBAT5L, "IBAT5L",
631 SPR_NOACCESS, SPR_NOACCESS,
632 &spr_read_ibat_h, &spr_write_ibatl_h,
633 0x00000000);
634 spr_register(env, SPR_IBAT6U, "IBAT6U",
635 SPR_NOACCESS, SPR_NOACCESS,
636 &spr_read_ibat_h, &spr_write_ibatu_h,
637 0x00000000);
638 spr_register(env, SPR_IBAT6L, "IBAT6L",
639 SPR_NOACCESS, SPR_NOACCESS,
640 &spr_read_ibat_h, &spr_write_ibatl_h,
641 0x00000000);
642 spr_register(env, SPR_IBAT7U, "IBAT7U",
643 SPR_NOACCESS, SPR_NOACCESS,
644 &spr_read_ibat_h, &spr_write_ibatu_h,
645 0x00000000);
646 spr_register(env, SPR_IBAT7L, "IBAT7L",
647 SPR_NOACCESS, SPR_NOACCESS,
648 &spr_read_ibat_h, &spr_write_ibatl_h,
649 0x00000000);
650 spr_register(env, SPR_DBAT4U, "DBAT4U",
651 SPR_NOACCESS, SPR_NOACCESS,
652 &spr_read_dbat_h, &spr_write_dbatu_h,
653 0x00000000);
654 spr_register(env, SPR_DBAT4L, "DBAT4L",
655 SPR_NOACCESS, SPR_NOACCESS,
656 &spr_read_dbat_h, &spr_write_dbatl_h,
657 0x00000000);
658 spr_register(env, SPR_DBAT5U, "DBAT5U",
659 SPR_NOACCESS, SPR_NOACCESS,
660 &spr_read_dbat_h, &spr_write_dbatu_h,
661 0x00000000);
662 spr_register(env, SPR_DBAT5L, "DBAT5L",
663 SPR_NOACCESS, SPR_NOACCESS,
664 &spr_read_dbat_h, &spr_write_dbatl_h,
665 0x00000000);
666 spr_register(env, SPR_DBAT6U, "DBAT6U",
667 SPR_NOACCESS, SPR_NOACCESS,
668 &spr_read_dbat_h, &spr_write_dbatu_h,
669 0x00000000);
670 spr_register(env, SPR_DBAT6L, "DBAT6L",
671 SPR_NOACCESS, SPR_NOACCESS,
672 &spr_read_dbat_h, &spr_write_dbatl_h,
673 0x00000000);
674 spr_register(env, SPR_DBAT7U, "DBAT7U",
675 SPR_NOACCESS, SPR_NOACCESS,
676 &spr_read_dbat_h, &spr_write_dbatu_h,
677 0x00000000);
678 spr_register(env, SPR_DBAT7L, "DBAT7L",
679 SPR_NOACCESS, SPR_NOACCESS,
680 &spr_read_dbat_h, &spr_write_dbatl_h,
681 0x00000000);
a750fc0b 682 env->nb_BATs += 4;
f2e63a42 683#endif
3fc6c082
FB
684}
685
686/* Generic PowerPC time base */
687static void gen_tbl (CPUPPCState *env)
688{
689 spr_register(env, SPR_VTBL, "TBL",
690 &spr_read_tbl, SPR_NOACCESS,
691 &spr_read_tbl, SPR_NOACCESS,
692 0x00000000);
693 spr_register(env, SPR_TBL, "TBL",
694 SPR_NOACCESS, SPR_NOACCESS,
695 SPR_NOACCESS, &spr_write_tbl,
696 0x00000000);
697 spr_register(env, SPR_VTBU, "TBU",
698 &spr_read_tbu, SPR_NOACCESS,
699 &spr_read_tbu, SPR_NOACCESS,
700 0x00000000);
701 spr_register(env, SPR_TBU, "TBU",
702 SPR_NOACCESS, SPR_NOACCESS,
703 SPR_NOACCESS, &spr_write_tbu,
704 0x00000000);
705}
706
76a66253
JM
707/* Softare table search registers */
708static void gen_6xx_7xx_soft_tlb (CPUPPCState *env, int nb_tlbs, int nb_ways)
709{
f2e63a42 710#if !defined(CONFIG_USER_ONLY)
76a66253
JM
711 env->nb_tlb = nb_tlbs;
712 env->nb_ways = nb_ways;
713 env->id_tlbs = 1;
714 spr_register(env, SPR_DMISS, "DMISS",
715 SPR_NOACCESS, SPR_NOACCESS,
716 &spr_read_generic, SPR_NOACCESS,
717 0x00000000);
718 spr_register(env, SPR_DCMP, "DCMP",
719 SPR_NOACCESS, SPR_NOACCESS,
720 &spr_read_generic, SPR_NOACCESS,
721 0x00000000);
722 spr_register(env, SPR_HASH1, "HASH1",
723 SPR_NOACCESS, SPR_NOACCESS,
724 &spr_read_generic, SPR_NOACCESS,
725 0x00000000);
726 spr_register(env, SPR_HASH2, "HASH2",
727 SPR_NOACCESS, SPR_NOACCESS,
728 &spr_read_generic, SPR_NOACCESS,
729 0x00000000);
730 spr_register(env, SPR_IMISS, "IMISS",
731 SPR_NOACCESS, SPR_NOACCESS,
732 &spr_read_generic, SPR_NOACCESS,
733 0x00000000);
734 spr_register(env, SPR_ICMP, "ICMP",
735 SPR_NOACCESS, SPR_NOACCESS,
736 &spr_read_generic, SPR_NOACCESS,
737 0x00000000);
738 spr_register(env, SPR_RPA, "RPA",
739 SPR_NOACCESS, SPR_NOACCESS,
740 &spr_read_generic, &spr_write_generic,
741 0x00000000);
f2e63a42 742#endif
76a66253
JM
743}
744
745/* SPR common to MPC755 and G2 */
746static void gen_spr_G2_755 (CPUPPCState *env)
747{
748 /* SGPRs */
749 spr_register(env, SPR_SPRG4, "SPRG4",
750 SPR_NOACCESS, SPR_NOACCESS,
751 &spr_read_generic, &spr_write_generic,
752 0x00000000);
753 spr_register(env, SPR_SPRG5, "SPRG5",
754 SPR_NOACCESS, SPR_NOACCESS,
755 &spr_read_generic, &spr_write_generic,
756 0x00000000);
757 spr_register(env, SPR_SPRG6, "SPRG6",
758 SPR_NOACCESS, SPR_NOACCESS,
759 &spr_read_generic, &spr_write_generic,
760 0x00000000);
761 spr_register(env, SPR_SPRG7, "SPRG7",
762 SPR_NOACCESS, SPR_NOACCESS,
763 &spr_read_generic, &spr_write_generic,
764 0x00000000);
765 /* External access control */
766 /* XXX : not implemented */
767 spr_register(env, SPR_EAR, "EAR",
768 SPR_NOACCESS, SPR_NOACCESS,
769 &spr_read_generic, &spr_write_generic,
770 0x00000000);
771}
772
3fc6c082
FB
773/* SPR common to all 7xx PowerPC implementations */
774static void gen_spr_7xx (CPUPPCState *env)
775{
776 /* Breakpoints */
777 /* XXX : not implemented */
778 spr_register(env, SPR_DABR, "DABR",
779 SPR_NOACCESS, SPR_NOACCESS,
780 &spr_read_generic, &spr_write_generic,
781 0x00000000);
782 /* XXX : not implemented */
783 spr_register(env, SPR_IABR, "IABR",
784 SPR_NOACCESS, SPR_NOACCESS,
785 &spr_read_generic, &spr_write_generic,
786 0x00000000);
787 /* Cache management */
788 /* XXX : not implemented */
789 spr_register(env, SPR_ICTC, "ICTC",
790 SPR_NOACCESS, SPR_NOACCESS,
791 &spr_read_generic, &spr_write_generic,
792 0x00000000);
76a66253
JM
793 /* XXX : not implemented */
794 spr_register(env, SPR_L2CR, "L2CR",
795 SPR_NOACCESS, SPR_NOACCESS,
796 &spr_read_generic, &spr_write_generic,
797 0x00000000);
3fc6c082
FB
798 /* Performance monitors */
799 /* XXX : not implemented */
800 spr_register(env, SPR_MMCR0, "MMCR0",
801 SPR_NOACCESS, SPR_NOACCESS,
802 &spr_read_generic, &spr_write_generic,
803 0x00000000);
804 /* XXX : not implemented */
805 spr_register(env, SPR_MMCR1, "MMCR1",
806 SPR_NOACCESS, SPR_NOACCESS,
807 &spr_read_generic, &spr_write_generic,
808 0x00000000);
809 /* XXX : not implemented */
810 spr_register(env, SPR_PMC1, "PMC1",
811 SPR_NOACCESS, SPR_NOACCESS,
812 &spr_read_generic, &spr_write_generic,
813 0x00000000);
814 /* XXX : not implemented */
815 spr_register(env, SPR_PMC2, "PMC2",
816 SPR_NOACCESS, SPR_NOACCESS,
817 &spr_read_generic, &spr_write_generic,
818 0x00000000);
819 /* XXX : not implemented */
820 spr_register(env, SPR_PMC3, "PMC3",
821 SPR_NOACCESS, SPR_NOACCESS,
822 &spr_read_generic, &spr_write_generic,
823 0x00000000);
824 /* XXX : not implemented */
825 spr_register(env, SPR_PMC4, "PMC4",
826 SPR_NOACCESS, SPR_NOACCESS,
827 &spr_read_generic, &spr_write_generic,
828 0x00000000);
829 /* XXX : not implemented */
a750fc0b 830 spr_register(env, SPR_SIAR, "SIAR",
3fc6c082
FB
831 SPR_NOACCESS, SPR_NOACCESS,
832 &spr_read_generic, SPR_NOACCESS,
833 0x00000000);
578bb252 834 /* XXX : not implemented */
3fc6c082
FB
835 spr_register(env, SPR_UMMCR0, "UMMCR0",
836 &spr_read_ureg, SPR_NOACCESS,
837 &spr_read_ureg, SPR_NOACCESS,
838 0x00000000);
578bb252 839 /* XXX : not implemented */
3fc6c082
FB
840 spr_register(env, SPR_UMMCR1, "UMMCR1",
841 &spr_read_ureg, SPR_NOACCESS,
842 &spr_read_ureg, SPR_NOACCESS,
843 0x00000000);
578bb252 844 /* XXX : not implemented */
3fc6c082
FB
845 spr_register(env, SPR_UPMC1, "UPMC1",
846 &spr_read_ureg, SPR_NOACCESS,
847 &spr_read_ureg, SPR_NOACCESS,
848 0x00000000);
578bb252 849 /* XXX : not implemented */
3fc6c082
FB
850 spr_register(env, SPR_UPMC2, "UPMC2",
851 &spr_read_ureg, SPR_NOACCESS,
852 &spr_read_ureg, SPR_NOACCESS,
853 0x00000000);
578bb252 854 /* XXX : not implemented */
3fc6c082
FB
855 spr_register(env, SPR_UPMC3, "UPMC3",
856 &spr_read_ureg, SPR_NOACCESS,
857 &spr_read_ureg, SPR_NOACCESS,
858 0x00000000);
578bb252 859 /* XXX : not implemented */
3fc6c082
FB
860 spr_register(env, SPR_UPMC4, "UPMC4",
861 &spr_read_ureg, SPR_NOACCESS,
862 &spr_read_ureg, SPR_NOACCESS,
863 0x00000000);
578bb252 864 /* XXX : not implemented */
a750fc0b 865 spr_register(env, SPR_USIAR, "USIAR",
3fc6c082
FB
866 &spr_read_ureg, SPR_NOACCESS,
867 &spr_read_ureg, SPR_NOACCESS,
868 0x00000000);
a750fc0b 869 /* External access control */
3fc6c082 870 /* XXX : not implemented */
a750fc0b 871 spr_register(env, SPR_EAR, "EAR",
3fc6c082
FB
872 SPR_NOACCESS, SPR_NOACCESS,
873 &spr_read_generic, &spr_write_generic,
874 0x00000000);
a750fc0b
JM
875}
876
877static void gen_spr_thrm (CPUPPCState *env)
878{
879 /* Thermal management */
3fc6c082 880 /* XXX : not implemented */
a750fc0b 881 spr_register(env, SPR_THRM1, "THRM1",
3fc6c082
FB
882 SPR_NOACCESS, SPR_NOACCESS,
883 &spr_read_generic, &spr_write_generic,
884 0x00000000);
885 /* XXX : not implemented */
a750fc0b 886 spr_register(env, SPR_THRM2, "THRM2",
3fc6c082
FB
887 SPR_NOACCESS, SPR_NOACCESS,
888 &spr_read_generic, &spr_write_generic,
889 0x00000000);
3fc6c082 890 /* XXX : not implemented */
a750fc0b 891 spr_register(env, SPR_THRM3, "THRM3",
3fc6c082
FB
892 SPR_NOACCESS, SPR_NOACCESS,
893 &spr_read_generic, &spr_write_generic,
894 0x00000000);
895}
896
897/* SPR specific to PowerPC 604 implementation */
898static void gen_spr_604 (CPUPPCState *env)
899{
900 /* Processor identification */
901 spr_register(env, SPR_PIR, "PIR",
902 SPR_NOACCESS, SPR_NOACCESS,
903 &spr_read_generic, &spr_write_pir,
904 0x00000000);
905 /* Breakpoints */
906 /* XXX : not implemented */
907 spr_register(env, SPR_IABR, "IABR",
908 SPR_NOACCESS, SPR_NOACCESS,
909 &spr_read_generic, &spr_write_generic,
910 0x00000000);
911 /* XXX : not implemented */
912 spr_register(env, SPR_DABR, "DABR",
913 SPR_NOACCESS, SPR_NOACCESS,
914 &spr_read_generic, &spr_write_generic,
915 0x00000000);
916 /* Performance counters */
917 /* XXX : not implemented */
918 spr_register(env, SPR_MMCR0, "MMCR0",
919 SPR_NOACCESS, SPR_NOACCESS,
920 &spr_read_generic, &spr_write_generic,
921 0x00000000);
922 /* XXX : not implemented */
923 spr_register(env, SPR_MMCR1, "MMCR1",
924 SPR_NOACCESS, SPR_NOACCESS,
925 &spr_read_generic, &spr_write_generic,
926 0x00000000);
927 /* XXX : not implemented */
928 spr_register(env, SPR_PMC1, "PMC1",
929 SPR_NOACCESS, SPR_NOACCESS,
930 &spr_read_generic, &spr_write_generic,
931 0x00000000);
932 /* XXX : not implemented */
933 spr_register(env, SPR_PMC2, "PMC2",
934 SPR_NOACCESS, SPR_NOACCESS,
935 &spr_read_generic, &spr_write_generic,
936 0x00000000);
937 /* XXX : not implemented */
938 spr_register(env, SPR_PMC3, "PMC3",
939 SPR_NOACCESS, SPR_NOACCESS,
940 &spr_read_generic, &spr_write_generic,
941 0x00000000);
942 /* XXX : not implemented */
943 spr_register(env, SPR_PMC4, "PMC4",
944 SPR_NOACCESS, SPR_NOACCESS,
945 &spr_read_generic, &spr_write_generic,
946 0x00000000);
947 /* XXX : not implemented */
a750fc0b 948 spr_register(env, SPR_SIAR, "SIAR",
3fc6c082
FB
949 SPR_NOACCESS, SPR_NOACCESS,
950 &spr_read_generic, SPR_NOACCESS,
951 0x00000000);
952 /* XXX : not implemented */
953 spr_register(env, SPR_SDA, "SDA",
954 SPR_NOACCESS, SPR_NOACCESS,
955 &spr_read_generic, SPR_NOACCESS,
956 0x00000000);
957 /* External access control */
958 /* XXX : not implemented */
959 spr_register(env, SPR_EAR, "EAR",
960 SPR_NOACCESS, SPR_NOACCESS,
961 &spr_read_generic, &spr_write_generic,
962 0x00000000);
963}
964
76a66253
JM
965/* SPR specific to PowerPC 603 implementation */
966static void gen_spr_603 (CPUPPCState *env)
3fc6c082 967{
76a66253
JM
968 /* External access control */
969 /* XXX : not implemented */
970 spr_register(env, SPR_EAR, "EAR",
3fc6c082 971 SPR_NOACCESS, SPR_NOACCESS,
76a66253
JM
972 &spr_read_generic, &spr_write_generic,
973 0x00000000);
3fc6c082
FB
974}
975
76a66253
JM
976/* SPR specific to PowerPC G2 implementation */
977static void gen_spr_G2 (CPUPPCState *env)
3fc6c082 978{
76a66253
JM
979 /* Memory base address */
980 /* MBAR */
578bb252 981 /* XXX : not implemented */
76a66253
JM
982 spr_register(env, SPR_MBAR, "MBAR",
983 SPR_NOACCESS, SPR_NOACCESS,
984 &spr_read_generic, &spr_write_generic,
985 0x00000000);
986 /* System version register */
987 /* SVR */
578bb252 988 /* XXX : TODO: initialize it to an appropriate value */
76a66253
JM
989 spr_register(env, SPR_SVR, "SVR",
990 SPR_NOACCESS, SPR_NOACCESS,
991 &spr_read_generic, SPR_NOACCESS,
992 0x00000000);
993 /* Exception processing */
363be49c 994 spr_register(env, SPR_BOOKE_CSRR0, "CSRR0",
76a66253
JM
995 SPR_NOACCESS, SPR_NOACCESS,
996 &spr_read_generic, &spr_write_generic,
997 0x00000000);
363be49c 998 spr_register(env, SPR_BOOKE_CSRR1, "CSRR1",
76a66253
JM
999 SPR_NOACCESS, SPR_NOACCESS,
1000 &spr_read_generic, &spr_write_generic,
1001 0x00000000);
1002 /* Breakpoints */
1003 /* XXX : not implemented */
1004 spr_register(env, SPR_DABR, "DABR",
1005 SPR_NOACCESS, SPR_NOACCESS,
1006 &spr_read_generic, &spr_write_generic,
1007 0x00000000);
1008 /* XXX : not implemented */
1009 spr_register(env, SPR_DABR2, "DABR2",
1010 SPR_NOACCESS, SPR_NOACCESS,
1011 &spr_read_generic, &spr_write_generic,
1012 0x00000000);
1013 /* XXX : not implemented */
1014 spr_register(env, SPR_IABR, "IABR",
1015 SPR_NOACCESS, SPR_NOACCESS,
1016 &spr_read_generic, &spr_write_generic,
1017 0x00000000);
1018 /* XXX : not implemented */
1019 spr_register(env, SPR_IABR2, "IABR2",
1020 SPR_NOACCESS, SPR_NOACCESS,
1021 &spr_read_generic, &spr_write_generic,
1022 0x00000000);
1023 /* XXX : not implemented */
1024 spr_register(env, SPR_IBCR, "IBCR",
1025 SPR_NOACCESS, SPR_NOACCESS,
1026 &spr_read_generic, &spr_write_generic,
1027 0x00000000);
1028 /* XXX : not implemented */
1029 spr_register(env, SPR_DBCR, "DBCR",
1030 SPR_NOACCESS, SPR_NOACCESS,
1031 &spr_read_generic, &spr_write_generic,
1032 0x00000000);
1033}
1034
1035/* SPR specific to PowerPC 602 implementation */
1036static void gen_spr_602 (CPUPPCState *env)
1037{
1038 /* ESA registers */
1039 /* XXX : not implemented */
1040 spr_register(env, SPR_SER, "SER",
1041 SPR_NOACCESS, SPR_NOACCESS,
1042 &spr_read_generic, &spr_write_generic,
1043 0x00000000);
1044 /* XXX : not implemented */
1045 spr_register(env, SPR_SEBR, "SEBR",
1046 SPR_NOACCESS, SPR_NOACCESS,
1047 &spr_read_generic, &spr_write_generic,
1048 0x00000000);
1049 /* XXX : not implemented */
a750fc0b 1050 spr_register(env, SPR_ESASRR, "ESASRR",
76a66253
JM
1051 SPR_NOACCESS, SPR_NOACCESS,
1052 &spr_read_generic, &spr_write_generic,
1053 0x00000000);
1054 /* Floating point status */
1055 /* XXX : not implemented */
1056 spr_register(env, SPR_SP, "SP",
1057 SPR_NOACCESS, SPR_NOACCESS,
1058 &spr_read_generic, &spr_write_generic,
1059 0x00000000);
1060 /* XXX : not implemented */
1061 spr_register(env, SPR_LT, "LT",
1062 SPR_NOACCESS, SPR_NOACCESS,
1063 &spr_read_generic, &spr_write_generic,
1064 0x00000000);
1065 /* Watchdog timer */
1066 /* XXX : not implemented */
1067 spr_register(env, SPR_TCR, "TCR",
1068 SPR_NOACCESS, SPR_NOACCESS,
1069 &spr_read_generic, &spr_write_generic,
1070 0x00000000);
1071 /* Interrupt base */
1072 spr_register(env, SPR_IBR, "IBR",
1073 SPR_NOACCESS, SPR_NOACCESS,
1074 &spr_read_generic, &spr_write_generic,
1075 0x00000000);
a750fc0b
JM
1076 /* XXX : not implemented */
1077 spr_register(env, SPR_IABR, "IABR",
1078 SPR_NOACCESS, SPR_NOACCESS,
1079 &spr_read_generic, &spr_write_generic,
1080 0x00000000);
76a66253
JM
1081}
1082
1083/* SPR specific to PowerPC 601 implementation */
1084static void gen_spr_601 (CPUPPCState *env)
1085{
1086 /* Multiplication/division register */
1087 /* MQ */
1088 spr_register(env, SPR_MQ, "MQ",
1089 &spr_read_generic, &spr_write_generic,
1090 &spr_read_generic, &spr_write_generic,
1091 0x00000000);
1092 /* RTC registers */
1093 spr_register(env, SPR_601_RTCU, "RTCU",
1094 SPR_NOACCESS, SPR_NOACCESS,
1095 SPR_NOACCESS, &spr_write_601_rtcu,
1096 0x00000000);
1097 spr_register(env, SPR_601_VRTCU, "RTCU",
1098 &spr_read_601_rtcu, SPR_NOACCESS,
1099 &spr_read_601_rtcu, SPR_NOACCESS,
1100 0x00000000);
1101 spr_register(env, SPR_601_RTCL, "RTCL",
1102 SPR_NOACCESS, SPR_NOACCESS,
1103 SPR_NOACCESS, &spr_write_601_rtcl,
1104 0x00000000);
1105 spr_register(env, SPR_601_VRTCL, "RTCL",
1106 &spr_read_601_rtcl, SPR_NOACCESS,
1107 &spr_read_601_rtcl, SPR_NOACCESS,
1108 0x00000000);
1109 /* Timer */
1110#if 0 /* ? */
1111 spr_register(env, SPR_601_UDECR, "UDECR",
1112 &spr_read_decr, SPR_NOACCESS,
1113 &spr_read_decr, SPR_NOACCESS,
1114 0x00000000);
1115#endif
1116 /* External access control */
1117 /* XXX : not implemented */
1118 spr_register(env, SPR_EAR, "EAR",
1119 SPR_NOACCESS, SPR_NOACCESS,
1120 &spr_read_generic, &spr_write_generic,
1121 0x00000000);
1122 /* Memory management */
f2e63a42 1123#if !defined(CONFIG_USER_ONLY)
76a66253
JM
1124 spr_register(env, SPR_IBAT0U, "IBAT0U",
1125 SPR_NOACCESS, SPR_NOACCESS,
1126 &spr_read_601_ubat, &spr_write_601_ubatu,
1127 0x00000000);
1128 spr_register(env, SPR_IBAT0L, "IBAT0L",
1129 SPR_NOACCESS, SPR_NOACCESS,
1130 &spr_read_601_ubat, &spr_write_601_ubatl,
1131 0x00000000);
1132 spr_register(env, SPR_IBAT1U, "IBAT1U",
1133 SPR_NOACCESS, SPR_NOACCESS,
1134 &spr_read_601_ubat, &spr_write_601_ubatu,
1135 0x00000000);
1136 spr_register(env, SPR_IBAT1L, "IBAT1L",
1137 SPR_NOACCESS, SPR_NOACCESS,
1138 &spr_read_601_ubat, &spr_write_601_ubatl,
1139 0x00000000);
1140 spr_register(env, SPR_IBAT2U, "IBAT2U",
1141 SPR_NOACCESS, SPR_NOACCESS,
1142 &spr_read_601_ubat, &spr_write_601_ubatu,
1143 0x00000000);
1144 spr_register(env, SPR_IBAT2L, "IBAT2L",
1145 SPR_NOACCESS, SPR_NOACCESS,
1146 &spr_read_601_ubat, &spr_write_601_ubatl,
1147 0x00000000);
1148 spr_register(env, SPR_IBAT3U, "IBAT3U",
1149 SPR_NOACCESS, SPR_NOACCESS,
1150 &spr_read_601_ubat, &spr_write_601_ubatu,
1151 0x00000000);
1152 spr_register(env, SPR_IBAT3L, "IBAT3L",
1153 SPR_NOACCESS, SPR_NOACCESS,
1154 &spr_read_601_ubat, &spr_write_601_ubatl,
1155 0x00000000);
a750fc0b 1156 env->nb_BATs = 4;
f2e63a42 1157#endif
a750fc0b
JM
1158}
1159
1160static void gen_spr_74xx (CPUPPCState *env)
1161{
1162 /* Processor identification */
1163 spr_register(env, SPR_PIR, "PIR",
1164 SPR_NOACCESS, SPR_NOACCESS,
1165 &spr_read_generic, &spr_write_pir,
1166 0x00000000);
1167 /* XXX : not implemented */
1168 spr_register(env, SPR_MMCR2, "MMCR2",
1169 SPR_NOACCESS, SPR_NOACCESS,
1170 &spr_read_generic, &spr_write_generic,
1171 0x00000000);
578bb252 1172 /* XXX : not implemented */
a750fc0b
JM
1173 spr_register(env, SPR_UMMCR2, "UMMCR2",
1174 &spr_read_ureg, SPR_NOACCESS,
1175 &spr_read_ureg, SPR_NOACCESS,
1176 0x00000000);
1177 /* XXX: not implemented */
1178 spr_register(env, SPR_BAMR, "BAMR",
1179 SPR_NOACCESS, SPR_NOACCESS,
1180 &spr_read_generic, &spr_write_generic,
1181 0x00000000);
578bb252 1182 /* XXX : not implemented */
a750fc0b
JM
1183 spr_register(env, SPR_UBAMR, "UBAMR",
1184 &spr_read_ureg, SPR_NOACCESS,
1185 &spr_read_ureg, SPR_NOACCESS,
1186 0x00000000);
578bb252 1187 /* XXX : not implemented */
a750fc0b
JM
1188 spr_register(env, SPR_MSSCR0, "MSSCR0",
1189 SPR_NOACCESS, SPR_NOACCESS,
1190 &spr_read_generic, &spr_write_generic,
1191 0x00000000);
1192 /* Hardware implementation registers */
1193 /* XXX : not implemented */
1194 spr_register(env, SPR_HID0, "HID0",
1195 SPR_NOACCESS, SPR_NOACCESS,
1196 &spr_read_generic, &spr_write_generic,
1197 0x00000000);
1198 /* XXX : not implemented */
1199 spr_register(env, SPR_HID1, "HID1",
1200 SPR_NOACCESS, SPR_NOACCESS,
1201 &spr_read_generic, &spr_write_generic,
1202 0x00000000);
1203 /* Altivec */
1204 spr_register(env, SPR_VRSAVE, "VRSAVE",
1205 &spr_read_generic, &spr_write_generic,
1206 &spr_read_generic, &spr_write_generic,
1207 0x00000000);
1208}
1209
a750fc0b
JM
1210static void gen_l3_ctrl (CPUPPCState *env)
1211{
1212 /* L3CR */
1213 /* XXX : not implemented */
1214 spr_register(env, SPR_L3CR, "L3CR",
1215 SPR_NOACCESS, SPR_NOACCESS,
1216 &spr_read_generic, &spr_write_generic,
1217 0x00000000);
1218 /* L3ITCR0 */
578bb252 1219 /* XXX : not implemented */
a750fc0b
JM
1220 spr_register(env, SPR_L3ITCR0, "L3ITCR0",
1221 SPR_NOACCESS, SPR_NOACCESS,
1222 &spr_read_generic, &spr_write_generic,
1223 0x00000000);
1224 /* L3ITCR1 */
578bb252 1225 /* XXX : not implemented */
a750fc0b
JM
1226 spr_register(env, SPR_L3ITCR1, "L3ITCR1",
1227 SPR_NOACCESS, SPR_NOACCESS,
1228 &spr_read_generic, &spr_write_generic,
1229 0x00000000);
1230 /* L3ITCR2 */
578bb252 1231 /* XXX : not implemented */
a750fc0b
JM
1232 spr_register(env, SPR_L3ITCR2, "L3ITCR2",
1233 SPR_NOACCESS, SPR_NOACCESS,
1234 &spr_read_generic, &spr_write_generic,
1235 0x00000000);
1236 /* L3ITCR3 */
578bb252 1237 /* XXX : not implemented */
a750fc0b
JM
1238 spr_register(env, SPR_L3ITCR3, "L3ITCR3",
1239 SPR_NOACCESS, SPR_NOACCESS,
1240 &spr_read_generic, &spr_write_generic,
1241 0x00000000);
1242 /* L3OHCR */
578bb252 1243 /* XXX : not implemented */
a750fc0b
JM
1244 spr_register(env, SPR_L3OHCR, "L3OHCR",
1245 SPR_NOACCESS, SPR_NOACCESS,
1246 &spr_read_generic, &spr_write_generic,
1247 0x00000000);
1248 /* L3PM */
578bb252 1249 /* XXX : not implemented */
a750fc0b
JM
1250 spr_register(env, SPR_L3PM, "L3PM",
1251 SPR_NOACCESS, SPR_NOACCESS,
1252 &spr_read_generic, &spr_write_generic,
1253 0x00000000);
1254}
a750fc0b 1255
578bb252 1256static void gen_74xx_soft_tlb (CPUPPCState *env, int nb_tlbs, int nb_ways)
a750fc0b 1257{
f2e63a42 1258#if !defined(CONFIG_USER_ONLY)
578bb252
JM
1259 env->nb_tlb = nb_tlbs;
1260 env->nb_ways = nb_ways;
1261 env->id_tlbs = 1;
1262 /* XXX : not implemented */
a750fc0b
JM
1263 spr_register(env, SPR_PTEHI, "PTEHI",
1264 SPR_NOACCESS, SPR_NOACCESS,
1265 &spr_read_generic, &spr_write_generic,
1266 0x00000000);
578bb252 1267 /* XXX : not implemented */
a750fc0b
JM
1268 spr_register(env, SPR_PTELO, "PTELO",
1269 SPR_NOACCESS, SPR_NOACCESS,
1270 &spr_read_generic, &spr_write_generic,
1271 0x00000000);
578bb252 1272 /* XXX : not implemented */
a750fc0b
JM
1273 spr_register(env, SPR_TLBMISS, "TLBMISS",
1274 SPR_NOACCESS, SPR_NOACCESS,
1275 &spr_read_generic, &spr_write_generic,
1276 0x00000000);
f2e63a42 1277#endif
76a66253
JM
1278}
1279
1280/* PowerPC BookE SPR */
1281static void gen_spr_BookE (CPUPPCState *env)
1282{
1283 /* Processor identification */
1284 spr_register(env, SPR_BOOKE_PIR, "PIR",
1285 SPR_NOACCESS, SPR_NOACCESS,
1286 &spr_read_generic, &spr_write_pir,
1287 0x00000000);
1288 /* Interrupt processing */
363be49c 1289 spr_register(env, SPR_BOOKE_CSRR0, "CSRR0",
76a66253
JM
1290 SPR_NOACCESS, SPR_NOACCESS,
1291 &spr_read_generic, &spr_write_generic,
1292 0x00000000);
363be49c
JM
1293 spr_register(env, SPR_BOOKE_CSRR1, "CSRR1",
1294 SPR_NOACCESS, SPR_NOACCESS,
1295 &spr_read_generic, &spr_write_generic,
1296 0x00000000);
2662a059 1297#if 0
363be49c
JM
1298 spr_register(env, SPR_BOOKE_DSRR0, "DSRR0",
1299 SPR_NOACCESS, SPR_NOACCESS,
1300 &spr_read_generic, &spr_write_generic,
1301 0x00000000);
1302 spr_register(env, SPR_BOOKE_DSRR1, "DSRR1",
1303 SPR_NOACCESS, SPR_NOACCESS,
1304 &spr_read_generic, &spr_write_generic,
1305 0x00000000);
2662a059 1306#endif
76a66253
JM
1307 /* Debug */
1308 /* XXX : not implemented */
1309 spr_register(env, SPR_BOOKE_IAC1, "IAC1",
1310 SPR_NOACCESS, SPR_NOACCESS,
1311 &spr_read_generic, &spr_write_generic,
1312 0x00000000);
1313 /* XXX : not implemented */
1314 spr_register(env, SPR_BOOKE_IAC2, "IAC2",
1315 SPR_NOACCESS, SPR_NOACCESS,
1316 &spr_read_generic, &spr_write_generic,
1317 0x00000000);
1318 /* XXX : not implemented */
1319 spr_register(env, SPR_BOOKE_IAC3, "IAC3",
1320 SPR_NOACCESS, SPR_NOACCESS,
1321 &spr_read_generic, &spr_write_generic,
1322 0x00000000);
1323 /* XXX : not implemented */
1324 spr_register(env, SPR_BOOKE_IAC4, "IAC4",
1325 SPR_NOACCESS, SPR_NOACCESS,
1326 &spr_read_generic, &spr_write_generic,
1327 0x00000000);
1328 /* XXX : not implemented */
1329 spr_register(env, SPR_BOOKE_DAC1, "DAC1",
1330 SPR_NOACCESS, SPR_NOACCESS,
1331 &spr_read_generic, &spr_write_generic,
1332 0x00000000);
1333 /* XXX : not implemented */
1334 spr_register(env, SPR_BOOKE_DAC2, "DAC2",
1335 SPR_NOACCESS, SPR_NOACCESS,
1336 &spr_read_generic, &spr_write_generic,
1337 0x00000000);
1338 /* XXX : not implemented */
1339 spr_register(env, SPR_BOOKE_DVC1, "DVC1",
1340 SPR_NOACCESS, SPR_NOACCESS,
1341 &spr_read_generic, &spr_write_generic,
1342 0x00000000);
1343 /* XXX : not implemented */
1344 spr_register(env, SPR_BOOKE_DVC2, "DVC2",
1345 SPR_NOACCESS, SPR_NOACCESS,
1346 &spr_read_generic, &spr_write_generic,
1347 0x00000000);
1348 /* XXX : not implemented */
1349 spr_register(env, SPR_BOOKE_DBCR0, "DBCR0",
1350 SPR_NOACCESS, SPR_NOACCESS,
1351 &spr_read_generic, &spr_write_generic,
1352 0x00000000);
1353 /* XXX : not implemented */
1354 spr_register(env, SPR_BOOKE_DBCR1, "DBCR1",
1355 SPR_NOACCESS, SPR_NOACCESS,
1356 &spr_read_generic, &spr_write_generic,
1357 0x00000000);
1358 /* XXX : not implemented */
1359 spr_register(env, SPR_BOOKE_DBCR2, "DBCR2",
1360 SPR_NOACCESS, SPR_NOACCESS,
1361 &spr_read_generic, &spr_write_generic,
1362 0x00000000);
1363 /* XXX : not implemented */
1364 spr_register(env, SPR_BOOKE_DBSR, "DBSR",
1365 SPR_NOACCESS, SPR_NOACCESS,
8ecc7913 1366 &spr_read_generic, &spr_write_clear,
76a66253
JM
1367 0x00000000);
1368 spr_register(env, SPR_BOOKE_DEAR, "DEAR",
1369 SPR_NOACCESS, SPR_NOACCESS,
1370 &spr_read_generic, &spr_write_generic,
1371 0x00000000);
1372 spr_register(env, SPR_BOOKE_ESR, "ESR",
1373 SPR_NOACCESS, SPR_NOACCESS,
1374 &spr_read_generic, &spr_write_generic,
1375 0x00000000);
363be49c
JM
1376 spr_register(env, SPR_BOOKE_IVPR, "IVPR",
1377 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1378 &spr_read_generic, &spr_write_excp_prefix,
363be49c
JM
1379 0x00000000);
1380 /* Exception vectors */
76a66253
JM
1381 spr_register(env, SPR_BOOKE_IVOR0, "IVOR0",
1382 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1383 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1384 0x00000000);
1385 spr_register(env, SPR_BOOKE_IVOR1, "IVOR1",
1386 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1387 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1388 0x00000000);
1389 spr_register(env, SPR_BOOKE_IVOR2, "IVOR2",
1390 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1391 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1392 0x00000000);
1393 spr_register(env, SPR_BOOKE_IVOR3, "IVOR3",
1394 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1395 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1396 0x00000000);
1397 spr_register(env, SPR_BOOKE_IVOR4, "IVOR4",
1398 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1399 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1400 0x00000000);
1401 spr_register(env, SPR_BOOKE_IVOR5, "IVOR5",
1402 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1403 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1404 0x00000000);
1405 spr_register(env, SPR_BOOKE_IVOR6, "IVOR6",
1406 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1407 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1408 0x00000000);
1409 spr_register(env, SPR_BOOKE_IVOR7, "IVOR7",
1410 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1411 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1412 0x00000000);
1413 spr_register(env, SPR_BOOKE_IVOR8, "IVOR8",
1414 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1415 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1416 0x00000000);
1417 spr_register(env, SPR_BOOKE_IVOR9, "IVOR9",
1418 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1419 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1420 0x00000000);
1421 spr_register(env, SPR_BOOKE_IVOR10, "IVOR10",
1422 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1423 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1424 0x00000000);
1425 spr_register(env, SPR_BOOKE_IVOR11, "IVOR11",
1426 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1427 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1428 0x00000000);
1429 spr_register(env, SPR_BOOKE_IVOR12, "IVOR12",
1430 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1431 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1432 0x00000000);
1433 spr_register(env, SPR_BOOKE_IVOR13, "IVOR13",
1434 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1435 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1436 0x00000000);
1437 spr_register(env, SPR_BOOKE_IVOR14, "IVOR14",
1438 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1439 &spr_read_generic, &spr_write_excp_vector,
76a66253
JM
1440 0x00000000);
1441 spr_register(env, SPR_BOOKE_IVOR15, "IVOR15",
1442 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1443 &spr_read_generic, &spr_write_excp_vector,
76a66253 1444 0x00000000);
2662a059 1445#if 0
363be49c
JM
1446 spr_register(env, SPR_BOOKE_IVOR32, "IVOR32",
1447 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1448 &spr_read_generic, &spr_write_excp_vector,
363be49c
JM
1449 0x00000000);
1450 spr_register(env, SPR_BOOKE_IVOR33, "IVOR33",
1451 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1452 &spr_read_generic, &spr_write_excp_vector,
363be49c
JM
1453 0x00000000);
1454 spr_register(env, SPR_BOOKE_IVOR34, "IVOR34",
1455 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1456 &spr_read_generic, &spr_write_excp_vector,
363be49c
JM
1457 0x00000000);
1458 spr_register(env, SPR_BOOKE_IVOR35, "IVOR35",
1459 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1460 &spr_read_generic, &spr_write_excp_vector,
363be49c
JM
1461 0x00000000);
1462 spr_register(env, SPR_BOOKE_IVOR36, "IVOR36",
1463 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1464 &spr_read_generic, &spr_write_excp_vector,
363be49c
JM
1465 0x00000000);
1466 spr_register(env, SPR_BOOKE_IVOR37, "IVOR37",
1467 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1468 &spr_read_generic, &spr_write_excp_vector,
363be49c 1469 0x00000000);
2662a059 1470#endif
76a66253
JM
1471 spr_register(env, SPR_BOOKE_PID, "PID",
1472 SPR_NOACCESS, SPR_NOACCESS,
1473 &spr_read_generic, &spr_write_generic,
1474 0x00000000);
1475 spr_register(env, SPR_BOOKE_TCR, "TCR",
1476 SPR_NOACCESS, SPR_NOACCESS,
1477 &spr_read_generic, &spr_write_booke_tcr,
1478 0x00000000);
1479 spr_register(env, SPR_BOOKE_TSR, "TSR",
1480 SPR_NOACCESS, SPR_NOACCESS,
1481 &spr_read_generic, &spr_write_booke_tsr,
1482 0x00000000);
1483 /* Timer */
1484 spr_register(env, SPR_DECR, "DECR",
1485 SPR_NOACCESS, SPR_NOACCESS,
1486 &spr_read_decr, &spr_write_decr,
1487 0x00000000);
1488 spr_register(env, SPR_BOOKE_DECAR, "DECAR",
1489 SPR_NOACCESS, SPR_NOACCESS,
1490 SPR_NOACCESS, &spr_write_generic,
1491 0x00000000);
1492 /* SPRGs */
1493 spr_register(env, SPR_USPRG0, "USPRG0",
1494 &spr_read_generic, &spr_write_generic,
1495 &spr_read_generic, &spr_write_generic,
1496 0x00000000);
1497 spr_register(env, SPR_SPRG4, "SPRG4",
1498 SPR_NOACCESS, SPR_NOACCESS,
1499 &spr_read_generic, &spr_write_generic,
1500 0x00000000);
1501 spr_register(env, SPR_USPRG4, "USPRG4",
1502 &spr_read_ureg, SPR_NOACCESS,
1503 &spr_read_ureg, SPR_NOACCESS,
1504 0x00000000);
1505 spr_register(env, SPR_SPRG5, "SPRG5",
1506 SPR_NOACCESS, SPR_NOACCESS,
1507 &spr_read_generic, &spr_write_generic,
1508 0x00000000);
1509 spr_register(env, SPR_USPRG5, "USPRG5",
1510 &spr_read_ureg, SPR_NOACCESS,
1511 &spr_read_ureg, SPR_NOACCESS,
1512 0x00000000);
1513 spr_register(env, SPR_SPRG6, "SPRG6",
1514 SPR_NOACCESS, SPR_NOACCESS,
1515 &spr_read_generic, &spr_write_generic,
1516 0x00000000);
1517 spr_register(env, SPR_USPRG6, "USPRG6",
1518 &spr_read_ureg, SPR_NOACCESS,
1519 &spr_read_ureg, SPR_NOACCESS,
1520 0x00000000);
1521 spr_register(env, SPR_SPRG7, "SPRG7",
1522 SPR_NOACCESS, SPR_NOACCESS,
1523 &spr_read_generic, &spr_write_generic,
1524 0x00000000);
1525 spr_register(env, SPR_USPRG7, "USPRG7",
1526 &spr_read_ureg, SPR_NOACCESS,
1527 &spr_read_ureg, SPR_NOACCESS,
1528 0x00000000);
1529}
1530
363be49c
JM
1531/* FSL storage control registers */
1532static void gen_spr_BookE_FSL (CPUPPCState *env)
1533{
f2e63a42 1534#if !defined(CONFIG_USER_ONLY)
363be49c 1535 /* TLB assist registers */
578bb252 1536 /* XXX : not implemented */
363be49c
JM
1537 spr_register(env, SPR_BOOKE_MAS0, "MAS0",
1538 SPR_NOACCESS, SPR_NOACCESS,
1539 &spr_read_generic, &spr_write_generic,
1540 0x00000000);
578bb252 1541 /* XXX : not implemented */
363be49c
JM
1542 spr_register(env, SPR_BOOKE_MAS1, "MAS2",
1543 SPR_NOACCESS, SPR_NOACCESS,
1544 &spr_read_generic, &spr_write_generic,
1545 0x00000000);
578bb252 1546 /* XXX : not implemented */
363be49c
JM
1547 spr_register(env, SPR_BOOKE_MAS2, "MAS3",
1548 SPR_NOACCESS, SPR_NOACCESS,
1549 &spr_read_generic, &spr_write_generic,
1550 0x00000000);
578bb252 1551 /* XXX : not implemented */
363be49c
JM
1552 spr_register(env, SPR_BOOKE_MAS3, "MAS4",
1553 SPR_NOACCESS, SPR_NOACCESS,
1554 &spr_read_generic, &spr_write_generic,
1555 0x00000000);
578bb252 1556 /* XXX : not implemented */
363be49c
JM
1557 spr_register(env, SPR_BOOKE_MAS4, "MAS5",
1558 SPR_NOACCESS, SPR_NOACCESS,
1559 &spr_read_generic, &spr_write_generic,
1560 0x00000000);
578bb252 1561 /* XXX : not implemented */
363be49c
JM
1562 spr_register(env, SPR_BOOKE_MAS6, "MAS6",
1563 SPR_NOACCESS, SPR_NOACCESS,
1564 &spr_read_generic, &spr_write_generic,
1565 0x00000000);
578bb252 1566 /* XXX : not implemented */
363be49c
JM
1567 spr_register(env, SPR_BOOKE_MAS7, "MAS7",
1568 SPR_NOACCESS, SPR_NOACCESS,
1569 &spr_read_generic, &spr_write_generic,
1570 0x00000000);
1571 if (env->nb_pids > 1) {
578bb252 1572 /* XXX : not implemented */
363be49c
JM
1573 spr_register(env, SPR_BOOKE_PID1, "PID1",
1574 SPR_NOACCESS, SPR_NOACCESS,
1575 &spr_read_generic, &spr_write_generic,
1576 0x00000000);
1577 }
1578 if (env->nb_pids > 2) {
578bb252 1579 /* XXX : not implemented */
363be49c
JM
1580 spr_register(env, SPR_BOOKE_PID2, "PID2",
1581 SPR_NOACCESS, SPR_NOACCESS,
1582 &spr_read_generic, &spr_write_generic,
1583 0x00000000);
1584 }
578bb252 1585 /* XXX : not implemented */
65f9ee8d 1586 spr_register(env, SPR_MMUCFG, "MMUCFG",
363be49c
JM
1587 SPR_NOACCESS, SPR_NOACCESS,
1588 &spr_read_generic, SPR_NOACCESS,
1589 0x00000000); /* TOFIX */
578bb252 1590 /* XXX : not implemented */
65f9ee8d 1591 spr_register(env, SPR_MMUCSR0, "MMUCSR0",
363be49c
JM
1592 SPR_NOACCESS, SPR_NOACCESS,
1593 &spr_read_generic, &spr_write_generic,
1594 0x00000000); /* TOFIX */
1595 switch (env->nb_ways) {
1596 case 4:
578bb252 1597 /* XXX : not implemented */
363be49c
JM
1598 spr_register(env, SPR_BOOKE_TLB3CFG, "TLB3CFG",
1599 SPR_NOACCESS, SPR_NOACCESS,
1600 &spr_read_generic, SPR_NOACCESS,
1601 0x00000000); /* TOFIX */
1602 /* Fallthru */
1603 case 3:
578bb252 1604 /* XXX : not implemented */
363be49c
JM
1605 spr_register(env, SPR_BOOKE_TLB2CFG, "TLB2CFG",
1606 SPR_NOACCESS, SPR_NOACCESS,
1607 &spr_read_generic, SPR_NOACCESS,
1608 0x00000000); /* TOFIX */
1609 /* Fallthru */
1610 case 2:
578bb252 1611 /* XXX : not implemented */
363be49c
JM
1612 spr_register(env, SPR_BOOKE_TLB1CFG, "TLB1CFG",
1613 SPR_NOACCESS, SPR_NOACCESS,
1614 &spr_read_generic, SPR_NOACCESS,
1615 0x00000000); /* TOFIX */
1616 /* Fallthru */
1617 case 1:
578bb252 1618 /* XXX : not implemented */
363be49c
JM
1619 spr_register(env, SPR_BOOKE_TLB0CFG, "TLB0CFG",
1620 SPR_NOACCESS, SPR_NOACCESS,
1621 &spr_read_generic, SPR_NOACCESS,
1622 0x00000000); /* TOFIX */
1623 /* Fallthru */
1624 case 0:
1625 default:
1626 break;
1627 }
f2e63a42 1628#endif
363be49c
JM
1629}
1630
76a66253
JM
1631/* SPR specific to PowerPC 440 implementation */
1632static void gen_spr_440 (CPUPPCState *env)
1633{
1634 /* Cache control */
1635 /* XXX : not implemented */
1636 spr_register(env, SPR_440_DNV0, "DNV0",
1637 SPR_NOACCESS, SPR_NOACCESS,
1638 &spr_read_generic, &spr_write_generic,
1639 0x00000000);
1640 /* XXX : not implemented */
1641 spr_register(env, SPR_440_DNV1, "DNV1",
1642 SPR_NOACCESS, SPR_NOACCESS,
1643 &spr_read_generic, &spr_write_generic,
1644 0x00000000);
1645 /* XXX : not implemented */
1646 spr_register(env, SPR_440_DNV2, "DNV2",
1647 SPR_NOACCESS, SPR_NOACCESS,
1648 &spr_read_generic, &spr_write_generic,
1649 0x00000000);
1650 /* XXX : not implemented */
1651 spr_register(env, SPR_440_DNV3, "DNV3",
1652 SPR_NOACCESS, SPR_NOACCESS,
1653 &spr_read_generic, &spr_write_generic,
1654 0x00000000);
1655 /* XXX : not implemented */
2662a059 1656 spr_register(env, SPR_440_DTV0, "DTV0",
76a66253
JM
1657 SPR_NOACCESS, SPR_NOACCESS,
1658 &spr_read_generic, &spr_write_generic,
1659 0x00000000);
1660 /* XXX : not implemented */
2662a059 1661 spr_register(env, SPR_440_DTV1, "DTV1",
76a66253
JM
1662 SPR_NOACCESS, SPR_NOACCESS,
1663 &spr_read_generic, &spr_write_generic,
1664 0x00000000);
1665 /* XXX : not implemented */
2662a059 1666 spr_register(env, SPR_440_DTV2, "DTV2",
76a66253
JM
1667 SPR_NOACCESS, SPR_NOACCESS,
1668 &spr_read_generic, &spr_write_generic,
1669 0x00000000);
1670 /* XXX : not implemented */
2662a059 1671 spr_register(env, SPR_440_DTV3, "DTV3",
76a66253
JM
1672 SPR_NOACCESS, SPR_NOACCESS,
1673 &spr_read_generic, &spr_write_generic,
1674 0x00000000);
1675 /* XXX : not implemented */
1676 spr_register(env, SPR_440_DVLIM, "DVLIM",
1677 SPR_NOACCESS, SPR_NOACCESS,
1678 &spr_read_generic, &spr_write_generic,
1679 0x00000000);
1680 /* XXX : not implemented */
1681 spr_register(env, SPR_440_INV0, "INV0",
1682 SPR_NOACCESS, SPR_NOACCESS,
1683 &spr_read_generic, &spr_write_generic,
1684 0x00000000);
1685 /* XXX : not implemented */
1686 spr_register(env, SPR_440_INV1, "INV1",
1687 SPR_NOACCESS, SPR_NOACCESS,
1688 &spr_read_generic, &spr_write_generic,
1689 0x00000000);
1690 /* XXX : not implemented */
1691 spr_register(env, SPR_440_INV2, "INV2",
1692 SPR_NOACCESS, SPR_NOACCESS,
1693 &spr_read_generic, &spr_write_generic,
1694 0x00000000);
1695 /* XXX : not implemented */
1696 spr_register(env, SPR_440_INV3, "INV3",
1697 SPR_NOACCESS, SPR_NOACCESS,
1698 &spr_read_generic, &spr_write_generic,
1699 0x00000000);
1700 /* XXX : not implemented */
2662a059 1701 spr_register(env, SPR_440_ITV0, "ITV0",
76a66253
JM
1702 SPR_NOACCESS, SPR_NOACCESS,
1703 &spr_read_generic, &spr_write_generic,
1704 0x00000000);
1705 /* XXX : not implemented */
2662a059 1706 spr_register(env, SPR_440_ITV1, "ITV1",
76a66253
JM
1707 SPR_NOACCESS, SPR_NOACCESS,
1708 &spr_read_generic, &spr_write_generic,
1709 0x00000000);
1710 /* XXX : not implemented */
2662a059 1711 spr_register(env, SPR_440_ITV2, "ITV2",
76a66253
JM
1712 SPR_NOACCESS, SPR_NOACCESS,
1713 &spr_read_generic, &spr_write_generic,
1714 0x00000000);
1715 /* XXX : not implemented */
2662a059 1716 spr_register(env, SPR_440_ITV3, "ITV3",
76a66253
JM
1717 SPR_NOACCESS, SPR_NOACCESS,
1718 &spr_read_generic, &spr_write_generic,
1719 0x00000000);
1720 /* XXX : not implemented */
1721 spr_register(env, SPR_440_IVLIM, "IVLIM",
1722 SPR_NOACCESS, SPR_NOACCESS,
1723 &spr_read_generic, &spr_write_generic,
1724 0x00000000);
1725 /* Cache debug */
1726 /* XXX : not implemented */
2662a059 1727 spr_register(env, SPR_BOOKE_DCDBTRH, "DCDBTRH",
76a66253
JM
1728 SPR_NOACCESS, SPR_NOACCESS,
1729 &spr_read_generic, SPR_NOACCESS,
1730 0x00000000);
1731 /* XXX : not implemented */
2662a059 1732 spr_register(env, SPR_BOOKE_DCDBTRL, "DCDBTRL",
76a66253
JM
1733 SPR_NOACCESS, SPR_NOACCESS,
1734 &spr_read_generic, SPR_NOACCESS,
1735 0x00000000);
1736 /* XXX : not implemented */
2662a059 1737 spr_register(env, SPR_BOOKE_ICDBDR, "ICDBDR",
76a66253
JM
1738 SPR_NOACCESS, SPR_NOACCESS,
1739 &spr_read_generic, SPR_NOACCESS,
1740 0x00000000);
1741 /* XXX : not implemented */
2662a059 1742 spr_register(env, SPR_BOOKE_ICDBTRH, "ICDBTRH",
76a66253
JM
1743 SPR_NOACCESS, SPR_NOACCESS,
1744 &spr_read_generic, SPR_NOACCESS,
1745 0x00000000);
1746 /* XXX : not implemented */
2662a059 1747 spr_register(env, SPR_BOOKE_ICDBTRL, "ICDBTRL",
76a66253
JM
1748 SPR_NOACCESS, SPR_NOACCESS,
1749 &spr_read_generic, SPR_NOACCESS,
1750 0x00000000);
1751 /* XXX : not implemented */
1752 spr_register(env, SPR_440_DBDR, "DBDR",
1753 SPR_NOACCESS, SPR_NOACCESS,
1754 &spr_read_generic, &spr_write_generic,
1755 0x00000000);
1756 /* Processor control */
1757 spr_register(env, SPR_4xx_CCR0, "CCR0",
1758 SPR_NOACCESS, SPR_NOACCESS,
1759 &spr_read_generic, &spr_write_generic,
1760 0x00000000);
1761 spr_register(env, SPR_440_RSTCFG, "RSTCFG",
1762 SPR_NOACCESS, SPR_NOACCESS,
1763 &spr_read_generic, SPR_NOACCESS,
1764 0x00000000);
1765 /* Storage control */
1766 spr_register(env, SPR_440_MMUCR, "MMUCR",
1767 SPR_NOACCESS, SPR_NOACCESS,
1768 &spr_read_generic, &spr_write_generic,
1769 0x00000000);
1770}
1771
1772/* SPR shared between PowerPC 40x implementations */
1773static void gen_spr_40x (CPUPPCState *env)
1774{
1775 /* Cache */
035feb88 1776 /* not emulated, as Qemu do not emulate caches */
76a66253
JM
1777 spr_register(env, SPR_40x_DCCR, "DCCR",
1778 SPR_NOACCESS, SPR_NOACCESS,
1779 &spr_read_generic, &spr_write_generic,
1780 0x00000000);
035feb88 1781 /* not emulated, as Qemu do not emulate caches */
76a66253
JM
1782 spr_register(env, SPR_40x_ICCR, "ICCR",
1783 SPR_NOACCESS, SPR_NOACCESS,
1784 &spr_read_generic, &spr_write_generic,
1785 0x00000000);
578bb252 1786 /* not emulated, as Qemu do not emulate caches */
2662a059 1787 spr_register(env, SPR_BOOKE_ICDBDR, "ICDBDR",
76a66253
JM
1788 SPR_NOACCESS, SPR_NOACCESS,
1789 &spr_read_generic, SPR_NOACCESS,
1790 0x00000000);
76a66253
JM
1791 /* Exception */
1792 spr_register(env, SPR_40x_DEAR, "DEAR",
1793 SPR_NOACCESS, SPR_NOACCESS,
1794 &spr_read_generic, &spr_write_generic,
1795 0x00000000);
1796 spr_register(env, SPR_40x_ESR, "ESR",
1797 SPR_NOACCESS, SPR_NOACCESS,
1798 &spr_read_generic, &spr_write_generic,
1799 0x00000000);
1800 spr_register(env, SPR_40x_EVPR, "EVPR",
1801 SPR_NOACCESS, SPR_NOACCESS,
6f5d427d 1802 &spr_read_generic, &spr_write_excp_prefix,
76a66253
JM
1803 0x00000000);
1804 spr_register(env, SPR_40x_SRR2, "SRR2",
1805 &spr_read_generic, &spr_write_generic,
1806 &spr_read_generic, &spr_write_generic,
1807 0x00000000);
1808 spr_register(env, SPR_40x_SRR3, "SRR3",
1809 &spr_read_generic, &spr_write_generic,
1810 &spr_read_generic, &spr_write_generic,
1811 0x00000000);
1812 /* Timers */
1813 spr_register(env, SPR_40x_PIT, "PIT",
1814 SPR_NOACCESS, SPR_NOACCESS,
1815 &spr_read_40x_pit, &spr_write_40x_pit,
1816 0x00000000);
1817 spr_register(env, SPR_40x_TCR, "TCR",
1818 SPR_NOACCESS, SPR_NOACCESS,
1819 &spr_read_generic, &spr_write_booke_tcr,
1820 0x00000000);
1821 spr_register(env, SPR_40x_TSR, "TSR",
1822 SPR_NOACCESS, SPR_NOACCESS,
1823 &spr_read_generic, &spr_write_booke_tsr,
1824 0x00000000);
2662a059
JM
1825}
1826
1827/* SPR specific to PowerPC 405 implementation */
1828static void gen_spr_405 (CPUPPCState *env)
1829{
1830 /* MMU */
1831 spr_register(env, SPR_40x_PID, "PID",
76a66253
JM
1832 SPR_NOACCESS, SPR_NOACCESS,
1833 &spr_read_generic, &spr_write_generic,
1834 0x00000000);
2662a059 1835 spr_register(env, SPR_4xx_CCR0, "CCR0",
76a66253
JM
1836 SPR_NOACCESS, SPR_NOACCESS,
1837 &spr_read_generic, &spr_write_generic,
2662a059
JM
1838 0x00700000);
1839 /* Debug interface */
76a66253
JM
1840 /* XXX : not implemented */
1841 spr_register(env, SPR_40x_DBCR0, "DBCR0",
1842 SPR_NOACCESS, SPR_NOACCESS,
8ecc7913 1843 &spr_read_generic, &spr_write_40x_dbcr0,
76a66253
JM
1844 0x00000000);
1845 /* XXX : not implemented */
2662a059
JM
1846 spr_register(env, SPR_405_DBCR1, "DBCR1",
1847 SPR_NOACCESS, SPR_NOACCESS,
1848 &spr_read_generic, &spr_write_generic,
1849 0x00000000);
1850 /* XXX : not implemented */
76a66253
JM
1851 spr_register(env, SPR_40x_DBSR, "DBSR",
1852 SPR_NOACCESS, SPR_NOACCESS,
8ecc7913
JM
1853 &spr_read_generic, &spr_write_clear,
1854 /* Last reset was system reset */
76a66253
JM
1855 0x00000300);
1856 /* XXX : not implemented */
2662a059 1857 spr_register(env, SPR_40x_DAC1, "DAC1",
76a66253
JM
1858 SPR_NOACCESS, SPR_NOACCESS,
1859 &spr_read_generic, &spr_write_generic,
1860 0x00000000);
2662a059 1861 spr_register(env, SPR_40x_DAC2, "DAC2",
76a66253
JM
1862 SPR_NOACCESS, SPR_NOACCESS,
1863 &spr_read_generic, &spr_write_generic,
1864 0x00000000);
2662a059
JM
1865 /* XXX : not implemented */
1866 spr_register(env, SPR_405_DVC1, "DVC1",
76a66253
JM
1867 SPR_NOACCESS, SPR_NOACCESS,
1868 &spr_read_generic, &spr_write_generic,
2662a059 1869 0x00000000);
76a66253 1870 /* XXX : not implemented */
2662a059 1871 spr_register(env, SPR_405_DVC2, "DVC2",
76a66253
JM
1872 SPR_NOACCESS, SPR_NOACCESS,
1873 &spr_read_generic, &spr_write_generic,
1874 0x00000000);
1875 /* XXX : not implemented */
2662a059 1876 spr_register(env, SPR_40x_IAC1, "IAC1",
76a66253
JM
1877 SPR_NOACCESS, SPR_NOACCESS,
1878 &spr_read_generic, &spr_write_generic,
1879 0x00000000);
2662a059 1880 spr_register(env, SPR_40x_IAC2, "IAC2",
76a66253
JM
1881 SPR_NOACCESS, SPR_NOACCESS,
1882 &spr_read_generic, &spr_write_generic,
1883 0x00000000);
1884 /* XXX : not implemented */
1885 spr_register(env, SPR_405_IAC3, "IAC3",
1886 SPR_NOACCESS, SPR_NOACCESS,
1887 &spr_read_generic, &spr_write_generic,
1888 0x00000000);
1889 /* XXX : not implemented */
1890 spr_register(env, SPR_405_IAC4, "IAC4",
1891 SPR_NOACCESS, SPR_NOACCESS,
1892 &spr_read_generic, &spr_write_generic,
1893 0x00000000);
1894 /* Storage control */
035feb88 1895 /* XXX: TODO: not implemented */
76a66253
JM
1896 spr_register(env, SPR_405_SLER, "SLER",
1897 SPR_NOACCESS, SPR_NOACCESS,
c294fc58 1898 &spr_read_generic, &spr_write_40x_sler,
76a66253 1899 0x00000000);
2662a059
JM
1900 spr_register(env, SPR_40x_ZPR, "ZPR",
1901 SPR_NOACCESS, SPR_NOACCESS,
1902 &spr_read_generic, &spr_write_generic,
1903 0x00000000);
76a66253
JM
1904 /* XXX : not implemented */
1905 spr_register(env, SPR_405_SU0R, "SU0R",
1906 SPR_NOACCESS, SPR_NOACCESS,
1907 &spr_read_generic, &spr_write_generic,
1908 0x00000000);
1909 /* SPRG */
1910 spr_register(env, SPR_USPRG0, "USPRG0",
1911 &spr_read_ureg, SPR_NOACCESS,
1912 &spr_read_ureg, SPR_NOACCESS,
1913 0x00000000);
1914 spr_register(env, SPR_SPRG4, "SPRG4",
1915 SPR_NOACCESS, SPR_NOACCESS,
04f20795 1916 &spr_read_generic, &spr_write_generic,
76a66253
JM
1917 0x00000000);
1918 spr_register(env, SPR_USPRG4, "USPRG4",
1919 &spr_read_ureg, SPR_NOACCESS,
1920 &spr_read_ureg, SPR_NOACCESS,
1921 0x00000000);
1922 spr_register(env, SPR_SPRG5, "SPRG5",
1923 SPR_NOACCESS, SPR_NOACCESS,
04f20795 1924 spr_read_generic, &spr_write_generic,
76a66253
JM
1925 0x00000000);
1926 spr_register(env, SPR_USPRG5, "USPRG5",
1927 &spr_read_ureg, SPR_NOACCESS,
1928 &spr_read_ureg, SPR_NOACCESS,
1929 0x00000000);
1930 spr_register(env, SPR_SPRG6, "SPRG6",
1931 SPR_NOACCESS, SPR_NOACCESS,
04f20795 1932 spr_read_generic, &spr_write_generic,
76a66253
JM
1933 0x00000000);
1934 spr_register(env, SPR_USPRG6, "USPRG6",
1935 &spr_read_ureg, SPR_NOACCESS,
1936 &spr_read_ureg, SPR_NOACCESS,
1937 0x00000000);
1938 spr_register(env, SPR_SPRG7, "SPRG7",
1939 SPR_NOACCESS, SPR_NOACCESS,
04f20795 1940 spr_read_generic, &spr_write_generic,
76a66253
JM
1941 0x00000000);
1942 spr_register(env, SPR_USPRG7, "USPRG7",
1943 &spr_read_ureg, SPR_NOACCESS,
1944 &spr_read_ureg, SPR_NOACCESS,
1945 0x00000000);
76a66253
JM
1946}
1947
1948/* SPR shared between PowerPC 401 & 403 implementations */
1949static void gen_spr_401_403 (CPUPPCState *env)
1950{
1951 /* Time base */
1952 spr_register(env, SPR_403_VTBL, "TBL",
1953 &spr_read_tbl, SPR_NOACCESS,
1954 &spr_read_tbl, SPR_NOACCESS,
1955 0x00000000);
1956 spr_register(env, SPR_403_TBL, "TBL",
1957 SPR_NOACCESS, SPR_NOACCESS,
1958 SPR_NOACCESS, &spr_write_tbl,
1959 0x00000000);
1960 spr_register(env, SPR_403_VTBU, "TBU",
1961 &spr_read_tbu, SPR_NOACCESS,
1962 &spr_read_tbu, SPR_NOACCESS,
1963 0x00000000);
1964 spr_register(env, SPR_403_TBU, "TBU",
1965 SPR_NOACCESS, SPR_NOACCESS,
1966 SPR_NOACCESS, &spr_write_tbu,
1967 0x00000000);
1968 /* Debug */
578bb252 1969 /* not emulated, as Qemu do not emulate caches */
76a66253
JM
1970 spr_register(env, SPR_403_CDBCR, "CDBCR",
1971 SPR_NOACCESS, SPR_NOACCESS,
1972 &spr_read_generic, &spr_write_generic,
1973 0x00000000);
1974}
1975
2662a059
JM
1976/* SPR specific to PowerPC 401 implementation */
1977static void gen_spr_401 (CPUPPCState *env)
1978{
1979 /* Debug interface */
1980 /* XXX : not implemented */
1981 spr_register(env, SPR_40x_DBCR0, "DBCR",
1982 SPR_NOACCESS, SPR_NOACCESS,
1983 &spr_read_generic, &spr_write_40x_dbcr0,
1984 0x00000000);
1985 /* XXX : not implemented */
1986 spr_register(env, SPR_40x_DBSR, "DBSR",
1987 SPR_NOACCESS, SPR_NOACCESS,
1988 &spr_read_generic, &spr_write_clear,
1989 /* Last reset was system reset */
1990 0x00000300);
1991 /* XXX : not implemented */
1992 spr_register(env, SPR_40x_DAC1, "DAC",
1993 SPR_NOACCESS, SPR_NOACCESS,
1994 &spr_read_generic, &spr_write_generic,
1995 0x00000000);
1996 /* XXX : not implemented */
1997 spr_register(env, SPR_40x_IAC1, "IAC",
1998 SPR_NOACCESS, SPR_NOACCESS,
1999 &spr_read_generic, &spr_write_generic,
2000 0x00000000);
2001 /* Storage control */
035feb88 2002 /* XXX: TODO: not implemented */
2662a059
JM
2003 spr_register(env, SPR_405_SLER, "SLER",
2004 SPR_NOACCESS, SPR_NOACCESS,
2005 &spr_read_generic, &spr_write_40x_sler,
2006 0x00000000);
035feb88
JM
2007 /* not emulated, as Qemu never does speculative access */
2008 spr_register(env, SPR_40x_SGR, "SGR",
2009 SPR_NOACCESS, SPR_NOACCESS,
2010 &spr_read_generic, &spr_write_generic,
2011 0xFFFFFFFF);
2012 /* not emulated, as Qemu do not emulate caches */
2013 spr_register(env, SPR_40x_DCWR, "DCWR",
2014 SPR_NOACCESS, SPR_NOACCESS,
2015 &spr_read_generic, &spr_write_generic,
2016 0x00000000);
2662a059
JM
2017}
2018
a750fc0b
JM
2019static void gen_spr_401x2 (CPUPPCState *env)
2020{
2021 gen_spr_401(env);
2022 spr_register(env, SPR_40x_PID, "PID",
2023 SPR_NOACCESS, SPR_NOACCESS,
2024 &spr_read_generic, &spr_write_generic,
2025 0x00000000);
2026 spr_register(env, SPR_40x_ZPR, "ZPR",
2027 SPR_NOACCESS, SPR_NOACCESS,
2028 &spr_read_generic, &spr_write_generic,
2029 0x00000000);
2030}
2031
76a66253
JM
2032/* SPR specific to PowerPC 403 implementation */
2033static void gen_spr_403 (CPUPPCState *env)
2034{
2662a059
JM
2035 /* Debug interface */
2036 /* XXX : not implemented */
2037 spr_register(env, SPR_40x_DBCR0, "DBCR0",
2038 SPR_NOACCESS, SPR_NOACCESS,
2039 &spr_read_generic, &spr_write_40x_dbcr0,
2040 0x00000000);
2041 /* XXX : not implemented */
2042 spr_register(env, SPR_40x_DBSR, "DBSR",
2043 SPR_NOACCESS, SPR_NOACCESS,
2044 &spr_read_generic, &spr_write_clear,
2045 /* Last reset was system reset */
2046 0x00000300);
2047 /* XXX : not implemented */
2048 spr_register(env, SPR_40x_DAC1, "DAC1",
2049 SPR_NOACCESS, SPR_NOACCESS,
2050 &spr_read_generic, &spr_write_generic,
2051 0x00000000);
578bb252 2052 /* XXX : not implemented */
2662a059
JM
2053 spr_register(env, SPR_40x_DAC2, "DAC2",
2054 SPR_NOACCESS, SPR_NOACCESS,
2055 &spr_read_generic, &spr_write_generic,
2056 0x00000000);
2057 /* XXX : not implemented */
2058 spr_register(env, SPR_40x_IAC1, "IAC1",
2059 SPR_NOACCESS, SPR_NOACCESS,
2060 &spr_read_generic, &spr_write_generic,
2061 0x00000000);
578bb252 2062 /* XXX : not implemented */
2662a059
JM
2063 spr_register(env, SPR_40x_IAC2, "IAC2",
2064 SPR_NOACCESS, SPR_NOACCESS,
2065 &spr_read_generic, &spr_write_generic,
2066 0x00000000);
a750fc0b
JM
2067}
2068
2069static void gen_spr_403_real (CPUPPCState *env)
2070{
76a66253
JM
2071 spr_register(env, SPR_403_PBL1, "PBL1",
2072 SPR_NOACCESS, SPR_NOACCESS,
2073 &spr_read_403_pbr, &spr_write_403_pbr,
2074 0x00000000);
2075 spr_register(env, SPR_403_PBU1, "PBU1",
2076 SPR_NOACCESS, SPR_NOACCESS,
2077 &spr_read_403_pbr, &spr_write_403_pbr,
2078 0x00000000);
2079 spr_register(env, SPR_403_PBL2, "PBL2",
2080 SPR_NOACCESS, SPR_NOACCESS,
2081 &spr_read_403_pbr, &spr_write_403_pbr,
2082 0x00000000);
2083 spr_register(env, SPR_403_PBU2, "PBU2",
2084 SPR_NOACCESS, SPR_NOACCESS,
2085 &spr_read_403_pbr, &spr_write_403_pbr,
2086 0x00000000);
a750fc0b
JM
2087}
2088
2089static void gen_spr_403_mmu (CPUPPCState *env)
2090{
2091 /* MMU */
2092 spr_register(env, SPR_40x_PID, "PID",
2093 SPR_NOACCESS, SPR_NOACCESS,
2094 &spr_read_generic, &spr_write_generic,
2095 0x00000000);
2662a059 2096 spr_register(env, SPR_40x_ZPR, "ZPR",
76a66253
JM
2097 SPR_NOACCESS, SPR_NOACCESS,
2098 &spr_read_generic, &spr_write_generic,
2099 0x00000000);
2100}
2101
2102/* SPR specific to PowerPC compression coprocessor extension */
76a66253
JM
2103static void gen_spr_compress (CPUPPCState *env)
2104{
578bb252 2105 /* XXX : not implemented */
76a66253
JM
2106 spr_register(env, SPR_401_SKR, "SKR",
2107 SPR_NOACCESS, SPR_NOACCESS,
2108 &spr_read_generic, &spr_write_generic,
2109 0x00000000);
2110}
a750fc0b
JM
2111
2112#if defined (TARGET_PPC64)
a750fc0b
JM
2113/* SPR specific to PowerPC 620 */
2114static void gen_spr_620 (CPUPPCState *env)
2115{
578bb252 2116 /* XXX : not implemented */
a750fc0b
JM
2117 spr_register(env, SPR_620_PMR0, "PMR0",
2118 SPR_NOACCESS, SPR_NOACCESS,
2119 &spr_read_generic, &spr_write_generic,
2120 0x00000000);
578bb252 2121 /* XXX : not implemented */
a750fc0b
JM
2122 spr_register(env, SPR_620_PMR1, "PMR1",
2123 SPR_NOACCESS, SPR_NOACCESS,
2124 &spr_read_generic, &spr_write_generic,
2125 0x00000000);
578bb252 2126 /* XXX : not implemented */
a750fc0b
JM
2127 spr_register(env, SPR_620_PMR2, "PMR2",
2128 SPR_NOACCESS, SPR_NOACCESS,
2129 &spr_read_generic, &spr_write_generic,
2130 0x00000000);
578bb252 2131 /* XXX : not implemented */
a750fc0b
JM
2132 spr_register(env, SPR_620_PMR3, "PMR3",
2133 SPR_NOACCESS, SPR_NOACCESS,
2134 &spr_read_generic, &spr_write_generic,
2135 0x00000000);
578bb252 2136 /* XXX : not implemented */
a750fc0b
JM
2137 spr_register(env, SPR_620_PMR4, "PMR4",
2138 SPR_NOACCESS, SPR_NOACCESS,
2139 &spr_read_generic, &spr_write_generic,
2140 0x00000000);
578bb252 2141 /* XXX : not implemented */
a750fc0b
JM
2142 spr_register(env, SPR_620_PMR5, "PMR5",
2143 SPR_NOACCESS, SPR_NOACCESS,
2144 &spr_read_generic, &spr_write_generic,
2145 0x00000000);
578bb252 2146 /* XXX : not implemented */
a750fc0b
JM
2147 spr_register(env, SPR_620_PMR6, "PMR6",
2148 SPR_NOACCESS, SPR_NOACCESS,
2149 &spr_read_generic, &spr_write_generic,
2150 0x00000000);
578bb252 2151 /* XXX : not implemented */
a750fc0b
JM
2152 spr_register(env, SPR_620_PMR7, "PMR7",
2153 SPR_NOACCESS, SPR_NOACCESS,
2154 &spr_read_generic, &spr_write_generic,
2155 0x00000000);
578bb252 2156 /* XXX : not implemented */
a750fc0b
JM
2157 spr_register(env, SPR_620_PMR8, "PMR8",
2158 SPR_NOACCESS, SPR_NOACCESS,
2159 &spr_read_generic, &spr_write_generic,
2160 0x00000000);
578bb252 2161 /* XXX : not implemented */
a750fc0b
JM
2162 spr_register(env, SPR_620_PMR9, "PMR9",
2163 SPR_NOACCESS, SPR_NOACCESS,
2164 &spr_read_generic, &spr_write_generic,
2165 0x00000000);
578bb252 2166 /* XXX : not implemented */
a750fc0b
JM
2167 spr_register(env, SPR_620_PMRA, "PMR10",
2168 SPR_NOACCESS, SPR_NOACCESS,
2169 &spr_read_generic, &spr_write_generic,
2170 0x00000000);
578bb252 2171 /* XXX : not implemented */
a750fc0b
JM
2172 spr_register(env, SPR_620_PMRB, "PMR11",
2173 SPR_NOACCESS, SPR_NOACCESS,
2174 &spr_read_generic, &spr_write_generic,
2175 0x00000000);
578bb252 2176 /* XXX : not implemented */
a750fc0b
JM
2177 spr_register(env, SPR_620_PMRC, "PMR12",
2178 SPR_NOACCESS, SPR_NOACCESS,
2179 &spr_read_generic, &spr_write_generic,
2180 0x00000000);
578bb252 2181 /* XXX : not implemented */
a750fc0b
JM
2182 spr_register(env, SPR_620_PMRD, "PMR13",
2183 SPR_NOACCESS, SPR_NOACCESS,
2184 &spr_read_generic, &spr_write_generic,
2185 0x00000000);
578bb252 2186 /* XXX : not implemented */
a750fc0b
JM
2187 spr_register(env, SPR_620_PMRE, "PMR14",
2188 SPR_NOACCESS, SPR_NOACCESS,
2189 &spr_read_generic, &spr_write_generic,
2190 0x00000000);
578bb252 2191 /* XXX : not implemented */
a750fc0b
JM
2192 spr_register(env, SPR_620_PMRF, "PMR15",
2193 SPR_NOACCESS, SPR_NOACCESS,
2194 &spr_read_generic, &spr_write_generic,
2195 0x00000000);
578bb252 2196 /* XXX : not implemented */
a750fc0b
JM
2197 spr_register(env, SPR_620_HID8, "HID8",
2198 SPR_NOACCESS, SPR_NOACCESS,
2199 &spr_read_generic, &spr_write_generic,
2200 0x00000000);
578bb252 2201 /* XXX : not implemented */
a750fc0b
JM
2202 spr_register(env, SPR_620_HID9, "HID9",
2203 SPR_NOACCESS, SPR_NOACCESS,
2204 &spr_read_generic, &spr_write_generic,
2205 0x00000000);
2206}
a750fc0b 2207#endif /* defined (TARGET_PPC64) */
76a66253 2208
2662a059 2209// XXX: TODO
76a66253 2210/*
2662a059
JM
2211 * AMR => SPR 29 (Power 2.04)
2212 * CTRL => SPR 136 (Power 2.04)
2213 * CTRL => SPR 152 (Power 2.04)
2662a059
JM
2214 * SCOMC => SPR 276 (64 bits ?)
2215 * SCOMD => SPR 277 (64 bits ?)
2662a059
JM
2216 * TBU40 => SPR 286 (Power 2.04 hypv)
2217 * HSPRG0 => SPR 304 (Power 2.04 hypv)
2218 * HSPRG1 => SPR 305 (Power 2.04 hypv)
2219 * HDSISR => SPR 306 (Power 2.04 hypv)
2220 * HDAR => SPR 307 (Power 2.04 hypv)
2221 * PURR => SPR 309 (Power 2.04 hypv)
2222 * HDEC => SPR 310 (Power 2.04 hypv)
2223 * HIOR => SPR 311 (hypv)
2224 * RMOR => SPR 312 (970)
2225 * HRMOR => SPR 313 (Power 2.04 hypv)
2226 * HSRR0 => SPR 314 (Power 2.04 hypv)
2227 * HSRR1 => SPR 315 (Power 2.04 hypv)
2228 * LPCR => SPR 316 (970)
2229 * LPIDR => SPR 317 (970)
2230 * SPEFSCR => SPR 512 (Power 2.04 emb)
2662a059
JM
2231 * EPR => SPR 702 (Power 2.04 emb)
2232 * perf => 768-783 (Power 2.04)
2233 * perf => 784-799 (Power 2.04)
2234 * PPR => SPR 896 (Power 2.04)
2235 * EPLC => SPR 947 (Power 2.04 emb)
2236 * EPSC => SPR 948 (Power 2.04 emb)
2237 * DABRX => 1015 (Power 2.04 hypv)
2238 * FPECR => SPR 1022 (?)
76a66253
JM
2239 * ... and more (thermal management, performance counters, ...)
2240 */
2241
e1833e1f
JM
2242/*****************************************************************************/
2243/* Exception vectors models */
2244static void init_excp_4xx_real (CPUPPCState *env)
2245{
2246#if !defined(CONFIG_USER_ONLY)
2247 env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000100;
2248 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2249 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2250 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2251 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2252 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2253 env->excp_vectors[POWERPC_EXCP_PIT] = 0x00001000;
2254 env->excp_vectors[POWERPC_EXCP_FIT] = 0x00001010;
2255 env->excp_vectors[POWERPC_EXCP_WDT] = 0x00001020;
2256 env->excp_vectors[POWERPC_EXCP_DEBUG] = 0x00002000;
faadf50e
JM
2257 env->excp_prefix = 0x00000000UL;
2258 env->ivor_mask = 0x0000FFF0UL;
2259 env->ivpr_mask = 0xFFFF0000UL;
1c27f8fb
JM
2260 /* Hardware reset vector */
2261 env->hreset_vector = 0xFFFFFFFCUL;
e1833e1f
JM
2262#endif
2263}
2264
2265static void init_excp_4xx_softmmu (CPUPPCState *env)
2266{
2267#if !defined(CONFIG_USER_ONLY)
2268 env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000100;
2269 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2270 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
2271 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
2272 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2273 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2274 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2275 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2276 env->excp_vectors[POWERPC_EXCP_PIT] = 0x00001000;
2277 env->excp_vectors[POWERPC_EXCP_FIT] = 0x00001010;
2278 env->excp_vectors[POWERPC_EXCP_WDT] = 0x00001020;
2279 env->excp_vectors[POWERPC_EXCP_DTLB] = 0x00001100;
2280 env->excp_vectors[POWERPC_EXCP_ITLB] = 0x00001200;
2281 env->excp_vectors[POWERPC_EXCP_DEBUG] = 0x00002000;
faadf50e
JM
2282 env->excp_prefix = 0x00000000UL;
2283 env->ivor_mask = 0x0000FFF0UL;
2284 env->ivpr_mask = 0xFFFF0000UL;
1c27f8fb
JM
2285 /* Hardware reset vector */
2286 env->hreset_vector = 0xFFFFFFFCUL;
e1833e1f
JM
2287#endif
2288}
2289
2290static void init_excp_BookE (CPUPPCState *env)
2291{
2292#if !defined(CONFIG_USER_ONLY)
2293 env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000000;
2294 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000000;
2295 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000000;
2296 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000000;
2297 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000000;
2298 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000000;
2299 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000000;
2300 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000000;
2301 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000000;
2302 env->excp_vectors[POWERPC_EXCP_APU] = 0x00000000;
2303 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000000;
2304 env->excp_vectors[POWERPC_EXCP_FIT] = 0x00000000;
2305 env->excp_vectors[POWERPC_EXCP_WDT] = 0x00000000;
2306 env->excp_vectors[POWERPC_EXCP_DTLB] = 0x00000000;
2307 env->excp_vectors[POWERPC_EXCP_ITLB] = 0x00000000;
2308 env->excp_vectors[POWERPC_EXCP_DEBUG] = 0x00000000;
faadf50e
JM
2309 env->excp_prefix = 0x00000000UL;
2310 env->ivor_mask = 0x0000FFE0UL;
2311 env->ivpr_mask = 0xFFFF0000UL;
1c27f8fb
JM
2312 /* Hardware reset vector */
2313 env->hreset_vector = 0xFFFFFFFCUL;
e1833e1f
JM
2314#endif
2315}
2316
2317static void init_excp_601 (CPUPPCState *env)
2318{
2319#if !defined(CONFIG_USER_ONLY)
2320 env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;
2321 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2322 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
2323 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
2324 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2325 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2326 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2327 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;
2328 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;
2329 env->excp_vectors[POWERPC_EXCP_IO] = 0x00000A00;
2330 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2331 env->excp_vectors[POWERPC_EXCP_RUNM] = 0x00002000;
faadf50e 2332 env->excp_prefix = 0xFFF00000UL;
1c27f8fb 2333 /* Hardware reset vector */
4e80effc 2334 env->hreset_vector = 0x00000100UL;
e1833e1f
JM
2335#endif
2336}
2337
2338static void init_excp_602 (CPUPPCState *env)
2339{
2340#if !defined(CONFIG_USER_ONLY)
2341 env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;
2342 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2343 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
2344 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
2345 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2346 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2347 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2348 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;
2349 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;
2350 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2351 env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00;
2352 env->excp_vectors[POWERPC_EXCP_FPA] = 0x00000E00;
2353 env->excp_vectors[POWERPC_EXCP_IFTLB] = 0x00001000;
2354 env->excp_vectors[POWERPC_EXCP_DLTLB] = 0x00001100;
2355 env->excp_vectors[POWERPC_EXCP_DSTLB] = 0x00001200;
2356 env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300;
2357 env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400;
2358 env->excp_vectors[POWERPC_EXCP_WDT] = 0x00001500;
2359 env->excp_vectors[POWERPC_EXCP_EMUL] = 0x00001600;
faadf50e 2360 env->excp_prefix = 0xFFF00000UL;
1c27f8fb
JM
2361 /* Hardware reset vector */
2362 env->hreset_vector = 0xFFFFFFFCUL;
e1833e1f
JM
2363#endif
2364}
2365
2366static void init_excp_603 (CPUPPCState *env)
2367{
2368#if !defined(CONFIG_USER_ONLY)
2369 env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;
2370 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2371 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
2372 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
2373 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2374 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2375 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2376 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;
2377 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;
2378 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2379 env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00;
2380 env->excp_vectors[POWERPC_EXCP_IFTLB] = 0x00001000;
2381 env->excp_vectors[POWERPC_EXCP_DLTLB] = 0x00001100;
2382 env->excp_vectors[POWERPC_EXCP_DSTLB] = 0x00001200;
2383 env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300;
2384 env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400;
faadf50e 2385 env->excp_prefix = 0x00000000UL;
1c27f8fb
JM
2386 /* Hardware reset vector */
2387 env->hreset_vector = 0xFFFFFFFCUL;
e1833e1f
JM
2388#endif
2389}
2390
2391static void init_excp_G2 (CPUPPCState *env)
2392{
2393#if !defined(CONFIG_USER_ONLY)
2394 env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;
2395 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2396 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
2397 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
2398 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2399 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2400 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2401 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;
2402 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;
2403 env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000A00;
2404 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2405 env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00;
2406 env->excp_vectors[POWERPC_EXCP_IFTLB] = 0x00001000;
2407 env->excp_vectors[POWERPC_EXCP_DLTLB] = 0x00001100;
2408 env->excp_vectors[POWERPC_EXCP_DSTLB] = 0x00001200;
2409 env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300;
2410 env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400;
faadf50e 2411 env->excp_prefix = 0x00000000UL;
1c27f8fb
JM
2412 /* Hardware reset vector */
2413 env->hreset_vector = 0xFFFFFFFCUL;
e1833e1f
JM
2414#endif
2415}
2416
2417static void init_excp_604 (CPUPPCState *env)
2418{
2419#if !defined(CONFIG_USER_ONLY)
2420 env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;
2421 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2422 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
2423 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
2424 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2425 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2426 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2427 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;
2428 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;
2429 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2430 env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00;
2431 env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00;
2432 env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300;
2433 env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400;
faadf50e 2434 env->excp_prefix = 0x00000000UL;
1c27f8fb
JM
2435 /* Hardware reset vector */
2436 env->hreset_vector = 0xFFFFFFFCUL;
e1833e1f
JM
2437#endif
2438}
2439
578bb252 2440#if defined(TARGET_PPC64)
e1833e1f
JM
2441static void init_excp_620 (CPUPPCState *env)
2442{
2443#if !defined(CONFIG_USER_ONLY)
2444 env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;
2445 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2446 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
faadf50e 2447 env->excp_vectors[POWERPC_EXCP_DSEG] = 0x00000380;
e1833e1f 2448 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
faadf50e 2449 env->excp_vectors[POWERPC_EXCP_ISEG] = 0x00000480;
e1833e1f
JM
2450 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2451 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2452 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2453 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;
2454 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;
2455 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2456 env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00;
2457 env->excp_vectors[POWERPC_EXCP_FPA] = 0x00000E00;
2458 env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00;
2459 env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300;
2460 env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400;
faadf50e 2461 env->excp_prefix = 0xFFF00000UL;
1c27f8fb 2462 /* Hardware reset vector */
faadf50e 2463 env->hreset_vector = 0x0000000000000100ULL;
e1833e1f
JM
2464#endif
2465}
578bb252 2466#endif /* defined(TARGET_PPC64) */
e1833e1f
JM
2467
2468static void init_excp_7x0 (CPUPPCState *env)
2469{
2470#if !defined(CONFIG_USER_ONLY)
2471 env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;
2472 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2473 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
2474 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
2475 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2476 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2477 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2478 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;
2479 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;
2480 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2481 env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00;
2482 env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00;
2483 env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300;
2484 env->excp_vectors[POWERPC_EXCP_THERM] = 0x00001700;
faadf50e 2485 env->excp_prefix = 0x00000000UL;
1c27f8fb
JM
2486 /* Hardware reset vector */
2487 env->hreset_vector = 0xFFFFFFFCUL;
e1833e1f
JM
2488#endif
2489}
2490
2491static void init_excp_750FX (CPUPPCState *env)
2492{
2493#if !defined(CONFIG_USER_ONLY)
2494 env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;
2495 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2496 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
2497 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
2498 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2499 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2500 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2501 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;
2502 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;
2503 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2504 env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00;
2505 env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00;
2506 env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300;
2507 env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400;
2508 env->excp_vectors[POWERPC_EXCP_THERM] = 0x00001700;
faadf50e 2509 env->excp_prefix = 0x00000000UL;
1c27f8fb
JM
2510 /* Hardware reset vector */
2511 env->hreset_vector = 0xFFFFFFFCUL;
e1833e1f
JM
2512#endif
2513}
2514
7a3a6927
JM
2515/* XXX: Check if this is correct */
2516static void init_excp_7x5 (CPUPPCState *env)
2517{
2518#if !defined(CONFIG_USER_ONLY)
2519 env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;
2520 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2521 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
2522 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
2523 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2524 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2525 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2526 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;
2527 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;
2528 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2529 env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00;
2530 env->excp_vectors[POWERPC_EXCP_IFTLB] = 0x00001000;
2531 env->excp_vectors[POWERPC_EXCP_DLTLB] = 0x00001100;
2532 env->excp_vectors[POWERPC_EXCP_DSTLB] = 0x00001200;
2533 env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00;
2534 env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300;
2535 env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400;
faadf50e 2536 env->excp_prefix = 0x00000000UL;
7a3a6927
JM
2537 /* Hardware reset vector */
2538 env->hreset_vector = 0xFFFFFFFCUL;
2539#endif
2540}
2541
e1833e1f
JM
2542static void init_excp_7400 (CPUPPCState *env)
2543{
2544#if !defined(CONFIG_USER_ONLY)
2545 env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;
2546 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2547 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
2548 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
2549 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2550 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2551 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2552 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;
2553 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;
2554 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2555 env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00;
2556 env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00;
2557 env->excp_vectors[POWERPC_EXCP_VPU] = 0x00000F20;
2558 env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300;
2559 env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400;
2560 env->excp_vectors[POWERPC_EXCP_VPUA] = 0x00001600;
2561 env->excp_vectors[POWERPC_EXCP_THERM] = 0x00001700;
faadf50e 2562 env->excp_prefix = 0x00000000UL;
1c27f8fb
JM
2563 /* Hardware reset vector */
2564 env->hreset_vector = 0xFFFFFFFCUL;
e1833e1f
JM
2565#endif
2566}
2567
e1833e1f
JM
2568static void init_excp_7450 (CPUPPCState *env)
2569{
2570#if !defined(CONFIG_USER_ONLY)
2571 env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;
2572 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2573 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
2574 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
2575 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2576 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2577 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2578 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;
2579 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;
2580 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2581 env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00;
2582 env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00;
2583 env->excp_vectors[POWERPC_EXCP_VPU] = 0x00000F20;
2584 env->excp_vectors[POWERPC_EXCP_IFTLB] = 0x00001000;
2585 env->excp_vectors[POWERPC_EXCP_DLTLB] = 0x00001100;
2586 env->excp_vectors[POWERPC_EXCP_DSTLB] = 0x00001200;
2587 env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300;
2588 env->excp_vectors[POWERPC_EXCP_SMI] = 0x00001400;
2589 env->excp_vectors[POWERPC_EXCP_VPUA] = 0x00001600;
faadf50e 2590 env->excp_prefix = 0x00000000UL;
1c27f8fb
JM
2591 /* Hardware reset vector */
2592 env->hreset_vector = 0xFFFFFFFCUL;
e1833e1f
JM
2593#endif
2594}
e1833e1f
JM
2595
2596#if defined (TARGET_PPC64)
2597static void init_excp_970 (CPUPPCState *env)
2598{
2599#if !defined(CONFIG_USER_ONLY)
2600 env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100;
2601 env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200;
2602 env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300;
2603 env->excp_vectors[POWERPC_EXCP_DSEG] = 0x00000380;
2604 env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400;
2605 env->excp_vectors[POWERPC_EXCP_ISEG] = 0x00000480;
2606 env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
2607 env->excp_vectors[POWERPC_EXCP_ALIGN] = 0x00000600;
2608 env->excp_vectors[POWERPC_EXCP_PROGRAM] = 0x00000700;
2609 env->excp_vectors[POWERPC_EXCP_FPU] = 0x00000800;
2610 env->excp_vectors[POWERPC_EXCP_DECR] = 0x00000900;
e1833e1f 2611 env->excp_vectors[POWERPC_EXCP_HDECR] = 0x00000980;
e1833e1f
JM
2612 env->excp_vectors[POWERPC_EXCP_SYSCALL] = 0x00000C00;
2613 env->excp_vectors[POWERPC_EXCP_TRACE] = 0x00000D00;
2614 env->excp_vectors[POWERPC_EXCP_PERFM] = 0x00000F00;
2615 env->excp_vectors[POWERPC_EXCP_VPU] = 0x00000F20;
2616 env->excp_vectors[POWERPC_EXCP_IABR] = 0x00001300;
2617 env->excp_vectors[POWERPC_EXCP_MAINT] = 0x00001600;
2618 env->excp_vectors[POWERPC_EXCP_VPUA] = 0x00001700;
2619 env->excp_vectors[POWERPC_EXCP_THERM] = 0x00001800;
faadf50e 2620 env->excp_prefix = 0x00000000FFF00000ULL;
1c27f8fb
JM
2621 /* Hardware reset vector */
2622 env->hreset_vector = 0x0000000000000100ULL;
e1833e1f
JM
2623#endif
2624}
2625#endif
2626
2f462816
JM
2627/*****************************************************************************/
2628/* Power management enable checks */
2629static int check_pow_none (CPUPPCState *env)
2630{
2631 return 0;
2632}
2633
2634static int check_pow_nocheck (CPUPPCState *env)
2635{
2636 return 1;
2637}
2638
2639static int check_pow_hid0 (CPUPPCState *env)
2640{
2641 if (env->spr[SPR_HID0] & 0x00E00000)
2642 return 1;
2643
2644 return 0;
2645}
2646
a750fc0b
JM
2647/*****************************************************************************/
2648/* PowerPC implementations definitions */
76a66253 2649
a750fc0b 2650/* PowerPC 40x instruction set */
05332d70 2651#define POWERPC_INSNS_EMB (PPC_INSNS_BASE | PPC_WRTEE | \
1b413d55 2652 PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ)
76a66253 2653
a750fc0b 2654/* PowerPC 401 */
05332d70 2655#define POWERPC_INSNS_401 (POWERPC_INSNS_EMB | PPC_STRING | PPC_DCR | \
a750fc0b
JM
2656 PPC_MEM_SYNC | PPC_MEM_EIEIO | \
2657 PPC_4xx_COMMON | PPC_40x_EXCP | PPC_40x_ICBT)
2658#define POWERPC_MSRM_401 (0x00000000000FD201ULL)
2659#define POWERPC_MMU_401 (POWERPC_MMU_REAL_4xx)
2660#define POWERPC_EXCP_401 (POWERPC_EXCP_40x)
2661#define POWERPC_INPUT_401 (PPC_FLAGS_INPUT_401)
237c0af0 2662#define POWERPC_BFDM_401 (bfd_mach_ppc_403)
25ba3a68 2663#define POWERPC_FLAG_401 (POWERPC_FLAG_CE | POWERPC_FLAG_DE)
2f462816 2664#define check_pow_401 check_pow_nocheck
76a66253 2665
a750fc0b
JM
2666static void init_proc_401 (CPUPPCState *env)
2667{
2668 gen_spr_40x(env);
2669 gen_spr_401_403(env);
2670 gen_spr_401(env);
e1833e1f 2671 init_excp_4xx_real(env);
d63001d1
JM
2672 env->dcache_line_size = 32;
2673 env->icache_line_size = 32;
4e290a0b
JM
2674 /* Allocate hardware IRQ controller */
2675 ppc40x_irq_init(env);
a750fc0b 2676}
76a66253 2677
a750fc0b 2678/* PowerPC 401x2 */
05332d70 2679#define POWERPC_INSNS_401x2 (POWERPC_INSNS_EMB | PPC_STRING | PPC_DCR | \
a750fc0b
JM
2680 PPC_MEM_SYNC | PPC_MEM_EIEIO | \
2681 PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | \
2682 PPC_CACHE_DCBA | PPC_MFTB | \
2683 PPC_4xx_COMMON | PPC_40x_EXCP | PPC_40x_ICBT)
2684#define POWERPC_MSRM_401x2 (0x00000000001FD231ULL)
2685#define POWERPC_MMU_401x2 (POWERPC_MMU_SOFT_4xx_Z)
2686#define POWERPC_EXCP_401x2 (POWERPC_EXCP_40x)
2687#define POWERPC_INPUT_401x2 (PPC_FLAGS_INPUT_401)
237c0af0 2688#define POWERPC_BFDM_401x2 (bfd_mach_ppc_403)
25ba3a68 2689#define POWERPC_FLAG_401x2 (POWERPC_FLAG_CE | POWERPC_FLAG_DE)
2f462816 2690#define check_pow_401x2 check_pow_nocheck
a750fc0b
JM
2691
2692static void init_proc_401x2 (CPUPPCState *env)
2693{
2694 gen_spr_40x(env);
2695 gen_spr_401_403(env);
2696 gen_spr_401x2(env);
2697 gen_spr_compress(env);
a750fc0b 2698 /* Memory management */
f2e63a42 2699#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
2700 env->nb_tlb = 64;
2701 env->nb_ways = 1;
2702 env->id_tlbs = 0;
f2e63a42 2703#endif
e1833e1f 2704 init_excp_4xx_softmmu(env);
d63001d1
JM
2705 env->dcache_line_size = 32;
2706 env->icache_line_size = 32;
4e290a0b
JM
2707 /* Allocate hardware IRQ controller */
2708 ppc40x_irq_init(env);
76a66253
JM
2709}
2710
a750fc0b 2711/* PowerPC 401x3 */
05332d70 2712#define POWERPC_INSNS_401x3 (POWERPC_INSNS_EMB | PPC_STRING | PPC_DCR | \
a750fc0b
JM
2713 PPC_MEM_SYNC | PPC_MEM_EIEIO | \
2714 PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | \
2715 PPC_CACHE_DCBA | PPC_MFTB | \
2716 PPC_4xx_COMMON | PPC_40x_EXCP | PPC_40x_ICBT)
2717#define POWERPC_MSRM_401x3 (0x00000000001FD631ULL)
2718#define POWERPC_MMU_401x3 (POWERPC_MMU_SOFT_4xx_Z)
2719#define POWERPC_EXCP_401x3 (POWERPC_EXCP_40x)
2720#define POWERPC_INPUT_401x3 (PPC_FLAGS_INPUT_401)
237c0af0 2721#define POWERPC_BFDM_401x3 (bfd_mach_ppc_403)
25ba3a68 2722#define POWERPC_FLAG_401x3 (POWERPC_FLAG_CE | POWERPC_FLAG_DE)
2f462816 2723#define check_pow_401x3 check_pow_nocheck
a750fc0b 2724
578bb252 2725__attribute__ (( unused ))
e1833e1f 2726static void init_proc_401x3 (CPUPPCState *env)
76a66253 2727{
4e290a0b
JM
2728 gen_spr_40x(env);
2729 gen_spr_401_403(env);
2730 gen_spr_401(env);
2731 gen_spr_401x2(env);
2732 gen_spr_compress(env);
e1833e1f 2733 init_excp_4xx_softmmu(env);
d63001d1
JM
2734 env->dcache_line_size = 32;
2735 env->icache_line_size = 32;
4e290a0b
JM
2736 /* Allocate hardware IRQ controller */
2737 ppc40x_irq_init(env);
3fc6c082 2738}
a750fc0b
JM
2739
2740/* IOP480 */
05332d70 2741#define POWERPC_INSNS_IOP480 (POWERPC_INSNS_EMB | PPC_STRING | PPC_DCR | \
a750fc0b
JM
2742 PPC_MEM_SYNC | PPC_MEM_EIEIO | \
2743 PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | \
2744 PPC_CACHE_DCBA | \
2745 PPC_4xx_COMMON | PPC_40x_EXCP | PPC_40x_ICBT)
2746#define POWERPC_MSRM_IOP480 (0x00000000001FD231ULL)
2747#define POWERPC_MMU_IOP480 (POWERPC_MMU_SOFT_4xx_Z)
2748#define POWERPC_EXCP_IOP480 (POWERPC_EXCP_40x)
2749#define POWERPC_INPUT_IOP480 (PPC_FLAGS_INPUT_401)
237c0af0 2750#define POWERPC_BFDM_IOP480 (bfd_mach_ppc_403)
25ba3a68 2751#define POWERPC_FLAG_IOP480 (POWERPC_FLAG_CE | POWERPC_FLAG_DE)
2f462816 2752#define check_pow_IOP480 check_pow_nocheck
a750fc0b
JM
2753
2754static void init_proc_IOP480 (CPUPPCState *env)
3fc6c082 2755{
a750fc0b
JM
2756 gen_spr_40x(env);
2757 gen_spr_401_403(env);
2758 gen_spr_401x2(env);
2759 gen_spr_compress(env);
a750fc0b 2760 /* Memory management */
f2e63a42 2761#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
2762 env->nb_tlb = 64;
2763 env->nb_ways = 1;
2764 env->id_tlbs = 0;
f2e63a42 2765#endif
e1833e1f 2766 init_excp_4xx_softmmu(env);
d63001d1
JM
2767 env->dcache_line_size = 32;
2768 env->icache_line_size = 32;
4e290a0b
JM
2769 /* Allocate hardware IRQ controller */
2770 ppc40x_irq_init(env);
3fc6c082
FB
2771}
2772
a750fc0b 2773/* PowerPC 403 */
05332d70 2774#define POWERPC_INSNS_403 (POWERPC_INSNS_EMB | PPC_STRING | PPC_DCR | \
a750fc0b 2775 PPC_MEM_SYNC | PPC_MEM_EIEIO | \
a750fc0b
JM
2776 PPC_4xx_COMMON | PPC_40x_EXCP | PPC_40x_ICBT)
2777#define POWERPC_MSRM_403 (0x000000000007D00DULL)
2778#define POWERPC_MMU_403 (POWERPC_MMU_REAL_4xx)
2779#define POWERPC_EXCP_403 (POWERPC_EXCP_40x)
2780#define POWERPC_INPUT_403 (PPC_FLAGS_INPUT_401)
237c0af0 2781#define POWERPC_BFDM_403 (bfd_mach_ppc_403)
25ba3a68 2782#define POWERPC_FLAG_403 (POWERPC_FLAG_CE | POWERPC_FLAG_PX)
2f462816 2783#define check_pow_403 check_pow_nocheck
a750fc0b
JM
2784
2785static void init_proc_403 (CPUPPCState *env)
3fc6c082 2786{
a750fc0b
JM
2787 gen_spr_40x(env);
2788 gen_spr_401_403(env);
2789 gen_spr_403(env);
2790 gen_spr_403_real(env);
e1833e1f 2791 init_excp_4xx_real(env);
d63001d1
JM
2792 env->dcache_line_size = 32;
2793 env->icache_line_size = 32;
4e290a0b
JM
2794 /* Allocate hardware IRQ controller */
2795 ppc40x_irq_init(env);
d63001d1
JM
2796#if !defined(CONFIG_USER_ONLY)
2797 /* Hardware reset vector */
2798 env->hreset_vector = 0xFFFFFFFCUL;
2799#endif
3fc6c082
FB
2800}
2801
a750fc0b 2802/* PowerPC 403 GCX */
05332d70 2803#define POWERPC_INSNS_403GCX (POWERPC_INSNS_EMB | PPC_STRING | PPC_DCR | \
a750fc0b
JM
2804 PPC_MEM_SYNC | PPC_MEM_EIEIO | \
2805 PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | \
2806 PPC_4xx_COMMON | PPC_40x_EXCP | PPC_40x_ICBT)
2807#define POWERPC_MSRM_403GCX (0x000000000007D00DULL)
2808#define POWERPC_MMU_403GCX (POWERPC_MMU_SOFT_4xx_Z)
2809#define POWERPC_EXCP_403GCX (POWERPC_EXCP_40x)
2810#define POWERPC_INPUT_403GCX (PPC_FLAGS_INPUT_401)
237c0af0 2811#define POWERPC_BFDM_403GCX (bfd_mach_ppc_403)
25ba3a68 2812#define POWERPC_FLAG_403GCX (POWERPC_FLAG_CE | POWERPC_FLAG_PX)
2f462816 2813#define check_pow_403GCX check_pow_nocheck
a750fc0b
JM
2814
2815static void init_proc_403GCX (CPUPPCState *env)
3fc6c082 2816{
a750fc0b
JM
2817 gen_spr_40x(env);
2818 gen_spr_401_403(env);
2819 gen_spr_403(env);
2820 gen_spr_403_real(env);
2821 gen_spr_403_mmu(env);
2822 /* Bus access control */
035feb88 2823 /* not emulated, as Qemu never does speculative access */
a750fc0b
JM
2824 spr_register(env, SPR_40x_SGR, "SGR",
2825 SPR_NOACCESS, SPR_NOACCESS,
2826 &spr_read_generic, &spr_write_generic,
2827 0xFFFFFFFF);
035feb88 2828 /* not emulated, as Qemu do not emulate caches */
a750fc0b
JM
2829 spr_register(env, SPR_40x_DCWR, "DCWR",
2830 SPR_NOACCESS, SPR_NOACCESS,
2831 &spr_read_generic, &spr_write_generic,
2832 0x00000000);
2833 /* Memory management */
f2e63a42 2834#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
2835 env->nb_tlb = 64;
2836 env->nb_ways = 1;
2837 env->id_tlbs = 0;
f2e63a42 2838#endif
e1833e1f 2839 init_excp_4xx_softmmu(env);
d63001d1
JM
2840 env->dcache_line_size = 32;
2841 env->icache_line_size = 32;
4e290a0b
JM
2842 /* Allocate hardware IRQ controller */
2843 ppc40x_irq_init(env);
3fc6c082
FB
2844}
2845
a750fc0b 2846/* PowerPC 405 */
05332d70
JM
2847#define POWERPC_INSNS_405 (POWERPC_INSNS_EMB | PPC_STRING | PPC_DCR | \
2848 PPC_MFTB | \
a750fc0b
JM
2849 PPC_MEM_SYNC | PPC_MEM_EIEIO | PPC_CACHE_DCBA | \
2850 PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | \
2851 PPC_4xx_COMMON | PPC_40x_EXCP | PPC_40x_ICBT | \
2852 PPC_405_MAC)
2853#define POWERPC_MSRM_405 (0x000000000006E630ULL)
2854#define POWERPC_MMU_405 (POWERPC_MMU_SOFT_4xx)
2855#define POWERPC_EXCP_405 (POWERPC_EXCP_40x)
2856#define POWERPC_INPUT_405 (PPC_FLAGS_INPUT_405)
237c0af0 2857#define POWERPC_BFDM_405 (bfd_mach_ppc_403)
25ba3a68
JM
2858#define POWERPC_FLAG_405 (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
2859 POWERPC_FLAG_DE)
2f462816 2860#define check_pow_405 check_pow_nocheck
a750fc0b
JM
2861
2862static void init_proc_405 (CPUPPCState *env)
3fc6c082 2863{
a750fc0b
JM
2864 /* Time base */
2865 gen_tbl(env);
2866 gen_spr_40x(env);
2867 gen_spr_405(env);
2868 /* Bus access control */
035feb88 2869 /* not emulated, as Qemu never does speculative access */
a750fc0b
JM
2870 spr_register(env, SPR_40x_SGR, "SGR",
2871 SPR_NOACCESS, SPR_NOACCESS,
2872 &spr_read_generic, &spr_write_generic,
2873 0xFFFFFFFF);
035feb88 2874 /* not emulated, as Qemu do not emulate caches */
a750fc0b
JM
2875 spr_register(env, SPR_40x_DCWR, "DCWR",
2876 SPR_NOACCESS, SPR_NOACCESS,
2877 &spr_read_generic, &spr_write_generic,
2878 0x00000000);
2879 /* Memory management */
f2e63a42 2880#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
2881 env->nb_tlb = 64;
2882 env->nb_ways = 1;
2883 env->id_tlbs = 0;
f2e63a42 2884#endif
e1833e1f 2885 init_excp_4xx_softmmu(env);
d63001d1
JM
2886 env->dcache_line_size = 32;
2887 env->icache_line_size = 32;
a750fc0b 2888 /* Allocate hardware IRQ controller */
4e290a0b 2889 ppc40x_irq_init(env);
3fc6c082
FB
2890}
2891
a750fc0b 2892/* PowerPC 440 EP */
05332d70 2893#define POWERPC_INSNS_440EP (POWERPC_INSNS_EMB | PPC_STRING | PPC_DCR | \
a750fc0b
JM
2894 PPC_CACHE_DCBA | PPC_MEM_TLBSYNC | \
2895 PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC | \
2896 PPC_440_SPEC | PPC_RFMCI)
2897#define POWERPC_MSRM_440EP (0x000000000006D630ULL)
2898#define POWERPC_MMU_440EP (POWERPC_MMU_BOOKE)
2899#define POWERPC_EXCP_440EP (POWERPC_EXCP_BOOKE)
2900#define POWERPC_INPUT_440EP (PPC_FLAGS_INPUT_BookE)
237c0af0 2901#define POWERPC_BFDM_440EP (bfd_mach_ppc_403)
25ba3a68
JM
2902#define POWERPC_FLAG_440EP (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
2903 POWERPC_FLAG_DE)
2f462816 2904#define check_pow_440EP check_pow_nocheck
a750fc0b
JM
2905
2906static void init_proc_440EP (CPUPPCState *env)
3fc6c082 2907{
a750fc0b
JM
2908 /* Time base */
2909 gen_tbl(env);
2910 gen_spr_BookE(env);
2911 gen_spr_440(env);
578bb252 2912 /* XXX : not implemented */
a750fc0b
JM
2913 spr_register(env, SPR_BOOKE_MCSR, "MCSR",
2914 SPR_NOACCESS, SPR_NOACCESS,
2915 &spr_read_generic, &spr_write_generic,
2916 0x00000000);
2917 spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
2918 SPR_NOACCESS, SPR_NOACCESS,
2919 &spr_read_generic, &spr_write_generic,
2920 0x00000000);
2921 spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
2922 SPR_NOACCESS, SPR_NOACCESS,
2923 &spr_read_generic, &spr_write_generic,
2924 0x00000000);
578bb252 2925 /* XXX : not implemented */
a750fc0b
JM
2926 spr_register(env, SPR_440_CCR1, "CCR1",
2927 SPR_NOACCESS, SPR_NOACCESS,
2928 &spr_read_generic, &spr_write_generic,
2929 0x00000000);
2930 /* Memory management */
f2e63a42 2931#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
2932 env->nb_tlb = 64;
2933 env->nb_ways = 1;
2934 env->id_tlbs = 0;
f2e63a42 2935#endif
e1833e1f 2936 init_excp_BookE(env);
d63001d1
JM
2937 env->dcache_line_size = 32;
2938 env->icache_line_size = 32;
a750fc0b 2939 /* XXX: TODO: allocate internal IRQ controller */
3fc6c082
FB
2940}
2941
a750fc0b 2942/* PowerPC 440 GP */
05332d70
JM
2943#define POWERPC_INSNS_440GP (POWERPC_INSNS_EMB | PPC_STRING | \
2944 PPC_DCR | PPC_DCRX | \
a750fc0b 2945 PPC_CACHE_DCBA | PPC_MEM_TLBSYNC | \
05332d70
JM
2946 PPC_BOOKE | PPC_MFAPIDI | PPC_TLBIVA | \
2947 PPC_4xx_COMMON | PPC_405_MAC | PPC_440_SPEC)
a750fc0b
JM
2948#define POWERPC_MSRM_440GP (0x000000000006FF30ULL)
2949#define POWERPC_MMU_440GP (POWERPC_MMU_BOOKE)
2950#define POWERPC_EXCP_440GP (POWERPC_EXCP_BOOKE)
2951#define POWERPC_INPUT_440GP (PPC_FLAGS_INPUT_BookE)
237c0af0 2952#define POWERPC_BFDM_440GP (bfd_mach_ppc_403)
25ba3a68
JM
2953#define POWERPC_FLAG_440GP (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
2954 POWERPC_FLAG_DE)
2f462816 2955#define check_pow_440GP check_pow_nocheck
a750fc0b
JM
2956
2957static void init_proc_440GP (CPUPPCState *env)
3fc6c082 2958{
a750fc0b
JM
2959 /* Time base */
2960 gen_tbl(env);
2961 gen_spr_BookE(env);
2962 gen_spr_440(env);
2963 /* Memory management */
f2e63a42 2964#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
2965 env->nb_tlb = 64;
2966 env->nb_ways = 1;
2967 env->id_tlbs = 0;
f2e63a42 2968#endif
e1833e1f 2969 init_excp_BookE(env);
d63001d1
JM
2970 env->dcache_line_size = 32;
2971 env->icache_line_size = 32;
a750fc0b 2972 /* XXX: TODO: allocate internal IRQ controller */
3fc6c082
FB
2973}
2974
a750fc0b 2975/* PowerPC 440x4 */
05332d70 2976#define POWERPC_INSNS_440x4 (POWERPC_INSNS_EMB | PPC_STRING | PPC_DCR | \
a750fc0b
JM
2977 PPC_CACHE_DCBA | PPC_MEM_TLBSYNC | \
2978 PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC | \
2979 PPC_440_SPEC)
2980#define POWERPC_MSRM_440x4 (0x000000000006FF30ULL)
2981#define POWERPC_MMU_440x4 (POWERPC_MMU_BOOKE)
2982#define POWERPC_EXCP_440x4 (POWERPC_EXCP_BOOKE)
2983#define POWERPC_INPUT_440x4 (PPC_FLAGS_INPUT_BookE)
237c0af0 2984#define POWERPC_BFDM_440x4 (bfd_mach_ppc_403)
25ba3a68
JM
2985#define POWERPC_FLAG_440x4 (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
2986 POWERPC_FLAG_DE)
2f462816 2987#define check_pow_440x4 check_pow_nocheck
a750fc0b 2988
578bb252 2989__attribute__ (( unused ))
a750fc0b 2990static void init_proc_440x4 (CPUPPCState *env)
3fc6c082 2991{
a750fc0b
JM
2992 /* Time base */
2993 gen_tbl(env);
2994 gen_spr_BookE(env);
2995 gen_spr_440(env);
2996 /* Memory management */
f2e63a42 2997#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
2998 env->nb_tlb = 64;
2999 env->nb_ways = 1;
3000 env->id_tlbs = 0;
f2e63a42 3001#endif
e1833e1f 3002 init_excp_BookE(env);
d63001d1
JM
3003 env->dcache_line_size = 32;
3004 env->icache_line_size = 32;
a750fc0b 3005 /* XXX: TODO: allocate internal IRQ controller */
3fc6c082 3006}
a750fc0b
JM
3007
3008/* PowerPC 440x5 */
05332d70 3009#define POWERPC_INSNS_440x5 (POWERPC_INSNS_EMB | PPC_STRING | PPC_DCR | \
a750fc0b
JM
3010 PPC_CACHE_DCBA | PPC_MEM_TLBSYNC | \
3011 PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC | \
3012 PPC_440_SPEC | PPC_RFMCI)
3013#define POWERPC_MSRM_440x5 (0x000000000006FF30ULL)
3014#define POWERPC_MMU_440x5 (POWERPC_MMU_BOOKE)
3015#define POWERPC_EXCP_440x5 (POWERPC_EXCP_BOOKE)
3016#define POWERPC_INPUT_440x5 (PPC_FLAGS_INPUT_BookE)
237c0af0 3017#define POWERPC_BFDM_440x5 (bfd_mach_ppc_403)
25ba3a68
JM
3018#define POWERPC_FLAG_440x5 (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
3019 POWERPC_FLAG_DE)
2f462816 3020#define check_pow_440x5 check_pow_nocheck
a750fc0b
JM
3021
3022static void init_proc_440x5 (CPUPPCState *env)
3fc6c082 3023{
a750fc0b
JM
3024 /* Time base */
3025 gen_tbl(env);
3026 gen_spr_BookE(env);
3027 gen_spr_440(env);
578bb252 3028 /* XXX : not implemented */
a750fc0b
JM
3029 spr_register(env, SPR_BOOKE_MCSR, "MCSR",
3030 SPR_NOACCESS, SPR_NOACCESS,
3031 &spr_read_generic, &spr_write_generic,
3032 0x00000000);
3033 spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
3034 SPR_NOACCESS, SPR_NOACCESS,
3035 &spr_read_generic, &spr_write_generic,
3036 0x00000000);
3037 spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
3038 SPR_NOACCESS, SPR_NOACCESS,
3039 &spr_read_generic, &spr_write_generic,
3040 0x00000000);
578bb252 3041 /* XXX : not implemented */
a750fc0b
JM
3042 spr_register(env, SPR_440_CCR1, "CCR1",
3043 SPR_NOACCESS, SPR_NOACCESS,
3044 &spr_read_generic, &spr_write_generic,
3045 0x00000000);
3046 /* Memory management */
f2e63a42 3047#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
3048 env->nb_tlb = 64;
3049 env->nb_ways = 1;
3050 env->id_tlbs = 0;
f2e63a42 3051#endif
e1833e1f 3052 init_excp_BookE(env);
d63001d1
JM
3053 env->dcache_line_size = 32;
3054 env->icache_line_size = 32;
a750fc0b 3055 /* XXX: TODO: allocate internal IRQ controller */
3fc6c082
FB
3056}
3057
a750fc0b 3058/* PowerPC 460 (guessed) */
05332d70
JM
3059#define POWERPC_INSNS_460 (POWERPC_INSNS_EMB | PPC_STRING | \
3060 PPC_DCR | PPC_DCRX | PPC_DCRUX | \
a750fc0b 3061 PPC_CACHE_DCBA | PPC_MEM_TLBSYNC | \
05332d70
JM
3062 PPC_BOOKE | PPC_MFAPIDI | PPC_TLBIVA | \
3063 PPC_4xx_COMMON | PPC_405_MAC | PPC_440_SPEC)
a750fc0b
JM
3064#define POWERPC_MSRM_460 (0x000000000006FF30ULL)
3065#define POWERPC_MMU_460 (POWERPC_MMU_BOOKE)
3066#define POWERPC_EXCP_460 (POWERPC_EXCP_BOOKE)
3067#define POWERPC_INPUT_460 (PPC_FLAGS_INPUT_BookE)
237c0af0 3068#define POWERPC_BFDM_460 (bfd_mach_ppc_403)
25ba3a68
JM
3069#define POWERPC_FLAG_460 (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
3070 POWERPC_FLAG_DE)
2f462816 3071#define check_pow_460 check_pow_nocheck
a750fc0b 3072
578bb252 3073__attribute__ (( unused ))
a750fc0b 3074static void init_proc_460 (CPUPPCState *env)
3fc6c082 3075{
e1833e1f
JM
3076 /* Time base */
3077 gen_tbl(env);
3078 gen_spr_BookE(env);
3079 gen_spr_440(env);
578bb252 3080 /* XXX : not implemented */
e1833e1f
JM
3081 spr_register(env, SPR_BOOKE_MCSR, "MCSR",
3082 SPR_NOACCESS, SPR_NOACCESS,
3083 &spr_read_generic, &spr_write_generic,
3084 0x00000000);
3085 spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
3086 SPR_NOACCESS, SPR_NOACCESS,
3087 &spr_read_generic, &spr_write_generic,
3088 0x00000000);
3089 spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
3090 SPR_NOACCESS, SPR_NOACCESS,
3091 &spr_read_generic, &spr_write_generic,
3092 0x00000000);
578bb252 3093 /* XXX : not implemented */
e1833e1f
JM
3094 spr_register(env, SPR_440_CCR1, "CCR1",
3095 SPR_NOACCESS, SPR_NOACCESS,
3096 &spr_read_generic, &spr_write_generic,
3097 0x00000000);
578bb252 3098 /* XXX : not implemented */
e1833e1f
JM
3099 spr_register(env, SPR_DCRIPR, "SPR_DCRIPR",
3100 &spr_read_generic, &spr_write_generic,
3101 &spr_read_generic, &spr_write_generic,
3102 0x00000000);
3103 /* Memory management */
f2e63a42 3104#if !defined(CONFIG_USER_ONLY)
e1833e1f
JM
3105 env->nb_tlb = 64;
3106 env->nb_ways = 1;
3107 env->id_tlbs = 0;
f2e63a42 3108#endif
e1833e1f 3109 init_excp_BookE(env);
d63001d1
JM
3110 env->dcache_line_size = 32;
3111 env->icache_line_size = 32;
e1833e1f 3112 /* XXX: TODO: allocate internal IRQ controller */
3fc6c082 3113}
a750fc0b
JM
3114
3115/* PowerPC 460F (guessed) */
05332d70
JM
3116#define POWERPC_INSNS_460F (POWERPC_INSNS_EMB | PPC_STRING | \
3117 PPC_DCR | PPC_DCRX | PPC_DCRUX | \
a750fc0b
JM
3118 PPC_CACHE_DCBA | PPC_MEM_TLBSYNC | \
3119 PPC_FLOAT | PPC_FLOAT_FSQRT | PPC_FLOAT_FRES | \
3120 PPC_FLOAT_FRSQRTE | PPC_FLOAT_FSEL | \
3121 PPC_FLOAT_STFIWX | \
05332d70
JM
3122 PPC_BOOKE | PPC_MFAPIDI | PPC_TLBIVA | \
3123 PPC_4xx_COMMON | PPC_405_MAC | PPC_440_SPEC)
a750fc0b
JM
3124#define POWERPC_MSRM_460 (0x000000000006FF30ULL)
3125#define POWERPC_MMU_460F (POWERPC_MMU_BOOKE)
3126#define POWERPC_EXCP_460F (POWERPC_EXCP_BOOKE)
3127#define POWERPC_INPUT_460F (PPC_FLAGS_INPUT_BookE)
237c0af0 3128#define POWERPC_BFDM_460F (bfd_mach_ppc_403)
25ba3a68
JM
3129#define POWERPC_FLAG_460F (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
3130 POWERPC_FLAG_DE)
2f462816 3131#define check_pow_460F check_pow_nocheck
a750fc0b 3132
578bb252 3133__attribute__ (( unused ))
e1833e1f 3134static void init_proc_460F (CPUPPCState *env)
3fc6c082 3135{
a750fc0b
JM
3136 /* Time base */
3137 gen_tbl(env);
3138 gen_spr_BookE(env);
3139 gen_spr_440(env);
578bb252 3140 /* XXX : not implemented */
a750fc0b
JM
3141 spr_register(env, SPR_BOOKE_MCSR, "MCSR",
3142 SPR_NOACCESS, SPR_NOACCESS,
3143 &spr_read_generic, &spr_write_generic,
3144 0x00000000);
3145 spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
3146 SPR_NOACCESS, SPR_NOACCESS,
3147 &spr_read_generic, &spr_write_generic,
3148 0x00000000);
3149 spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
3150 SPR_NOACCESS, SPR_NOACCESS,
3151 &spr_read_generic, &spr_write_generic,
3152 0x00000000);
578bb252 3153 /* XXX : not implemented */
a750fc0b
JM
3154 spr_register(env, SPR_440_CCR1, "CCR1",
3155 SPR_NOACCESS, SPR_NOACCESS,
3156 &spr_read_generic, &spr_write_generic,
3157 0x00000000);
578bb252 3158 /* XXX : not implemented */
a750fc0b
JM
3159 spr_register(env, SPR_DCRIPR, "SPR_DCRIPR",
3160 &spr_read_generic, &spr_write_generic,
3161 &spr_read_generic, &spr_write_generic,
3162 0x00000000);
3163 /* Memory management */
f2e63a42 3164#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
3165 env->nb_tlb = 64;
3166 env->nb_ways = 1;
3167 env->id_tlbs = 0;
f2e63a42 3168#endif
e1833e1f 3169 init_excp_BookE(env);
d63001d1
JM
3170 env->dcache_line_size = 32;
3171 env->icache_line_size = 32;
a750fc0b 3172 /* XXX: TODO: allocate internal IRQ controller */
3fc6c082 3173}
a750fc0b
JM
3174
3175/* Generic BookE PowerPC */
a750fc0b
JM
3176#define POWERPC_INSNS_BookE (POWERPC_INSNS_EMB | \
3177 PPC_MEM_EIEIO | PPC_MEM_TLBSYNC | \
3178 PPC_CACHE_DCBA | \
3179 PPC_FLOAT | PPC_FLOAT_FSQRT | \
3180 PPC_FLOAT_FRES | PPC_FLOAT_FRSQRTE | \
1b413d55 3181 PPC_FLOAT_FSEL | PPC_FLOAT_STFIWX | \
a750fc0b
JM
3182 PPC_BOOKE)
3183#define POWERPC_MSRM_BookE (0x000000000006D630ULL)
3184#define POWERPC_MMU_BookE (POWERPC_MMU_BOOKE)
3185#define POWERPC_EXCP_BookE (POWERPC_EXCP_BOOKE)
3186#define POWERPC_INPUT_BookE (PPC_FLAGS_INPUT_BookE)
237c0af0 3187#define POWERPC_BFDM_BookE (bfd_mach_ppc_403)
d26bfc9a 3188#define POWERPC_FLAG_BookE (POWERPC_FLAG_NONE)
2f462816 3189#define check_pow_BookE check_pow_nocheck
a750fc0b 3190
578bb252 3191__attribute__ (( unused ))
a750fc0b 3192static void init_proc_BookE (CPUPPCState *env)
3fc6c082 3193{
e1833e1f 3194 init_excp_BookE(env);
d63001d1
JM
3195 env->dcache_line_size = 32;
3196 env->icache_line_size = 32;
3fc6c082 3197}
a750fc0b
JM
3198
3199/* e200 core */
a750fc0b
JM
3200
3201/* e300 core */
a750fc0b
JM
3202
3203/* e500 core */
a750fc0b
JM
3204#define POWERPC_INSNS_e500 (POWERPC_INSNS_EMB | \
3205 PPC_MEM_EIEIO | PPC_MEM_TLBSYNC | \
3206 PPC_CACHE_DCBA | \
3207 PPC_BOOKE | PPC_E500_VECTOR)
3208#define POWERPC_MMU_e500 (POWERPC_MMU_SOFT_4xx)
3209#define POWERPC_EXCP_e500 (POWERPC_EXCP_40x)
3210#define POWERPC_INPUT_e500 (PPC_FLAGS_INPUT_BookE)
237c0af0 3211#define POWERPC_BFDM_e500 (bfd_mach_ppc_403)
d26bfc9a 3212#define POWERPC_FLAG_e500 (POWERPC_FLAG_SPE)
2f462816 3213#define check_pow_e500 check_pow_hid0
a750fc0b 3214
578bb252 3215__attribute__ (( unused ))
a750fc0b 3216static void init_proc_e500 (CPUPPCState *env)
3fc6c082 3217{
a750fc0b
JM
3218 /* Time base */
3219 gen_tbl(env);
3220 gen_spr_BookE(env);
3221 /* Memory management */
3222 gen_spr_BookE_FSL(env);
f2e63a42 3223#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
3224 env->nb_tlb = 64;
3225 env->nb_ways = 1;
3226 env->id_tlbs = 0;
f2e63a42 3227#endif
e1833e1f 3228 init_excp_BookE(env);
d63001d1
JM
3229 env->dcache_line_size = 32;
3230 env->icache_line_size = 32;
a750fc0b 3231 /* XXX: TODO: allocate internal IRQ controller */
3fc6c082 3232}
a750fc0b
JM
3233
3234/* e600 core */
a750fc0b
JM
3235
3236/* Non-embedded PowerPC */
3237/* Base instructions set for all 6xx/7xx/74xx/970 PowerPC */
05332d70 3238#define POWERPC_INSNS_6xx (PPC_INSNS_BASE | PPC_STRING | PPC_FLOAT | \
1b413d55
JM
3239 PPC_CACHE | PPC_CACHE_ICBI | \
3240 PPC_MEM_SYNC | PPC_MEM_EIEIO | PPC_MEM_TLBIE)
a750fc0b
JM
3241/* Instructions common to all 6xx/7xx/74xx/970 PowerPC except 601 & 602 */
3242#define POWERPC_INSNS_WORKS (POWERPC_INSNS_6xx | PPC_FLOAT_FSQRT | \
3243 PPC_FLOAT_FRES | PPC_FLOAT_FRSQRTE | \
3244 PPC_FLOAT_FSEL | PPC_FLOAT_STFIWX | \
12de9a39
JM
3245 PPC_MEM_TLBSYNC | PPC_CACHE_DCBZ | PPC_MFTB | \
3246 PPC_SEGMENT)
a750fc0b
JM
3247
3248/* POWER : same as 601, without mfmsr, mfsr */
3249#if defined(TODO)
3250#define POWERPC_INSNS_POWER (XXX_TODO)
3251/* POWER RSC (from RAD6000) */
3252#define POWERPC_MSRM_POWER (0x00000000FEF0ULL)
3253#endif /* TODO */
3254
3255/* PowerPC 601 */
d63001d1 3256#define POWERPC_INSNS_601 (POWERPC_INSNS_6xx | PPC_CACHE_DCBZ | \
12de9a39 3257 PPC_SEGMENT | PPC_EXTERN | PPC_POWER_BR)
25ba3a68 3258#define POWERPC_MSRM_601 (0x000000000000FD70ULL)
faadf50e 3259//#define POWERPC_MMU_601 (POWERPC_MMU_601)
a750fc0b
JM
3260//#define POWERPC_EXCP_601 (POWERPC_EXCP_601)
3261#define POWERPC_INPUT_601 (PPC_FLAGS_INPUT_6xx)
237c0af0 3262#define POWERPC_BFDM_601 (bfd_mach_ppc_601)
25ba3a68 3263#define POWERPC_FLAG_601 (POWERPC_FLAG_SE)
2f462816 3264#define check_pow_601 check_pow_none
a750fc0b
JM
3265
3266static void init_proc_601 (CPUPPCState *env)
3fc6c082 3267{
a750fc0b
JM
3268 gen_spr_ne_601(env);
3269 gen_spr_601(env);
3270 /* Hardware implementation registers */
3271 /* XXX : not implemented */
3272 spr_register(env, SPR_HID0, "HID0",
3273 SPR_NOACCESS, SPR_NOACCESS,
056401ea 3274 &spr_read_generic, &spr_write_hid0_601,
faadf50e 3275 0x80010080);
a750fc0b
JM
3276 /* XXX : not implemented */
3277 spr_register(env, SPR_HID1, "HID1",
3278 SPR_NOACCESS, SPR_NOACCESS,
3279 &spr_read_generic, &spr_write_generic,
3280 0x00000000);
3281 /* XXX : not implemented */
3282 spr_register(env, SPR_601_HID2, "HID2",
3283 SPR_NOACCESS, SPR_NOACCESS,
3284 &spr_read_generic, &spr_write_generic,
3285 0x00000000);
3286 /* XXX : not implemented */
3287 spr_register(env, SPR_601_HID5, "HID5",
3288 SPR_NOACCESS, SPR_NOACCESS,
3289 &spr_read_generic, &spr_write_generic,
3290 0x00000000);
3291 /* XXX : not implemented */
3292 spr_register(env, SPR_601_HID15, "HID15",
3293 SPR_NOACCESS, SPR_NOACCESS,
3294 &spr_read_generic, &spr_write_generic,
3295 0x00000000);
3296 /* Memory management */
f2e63a42 3297#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
3298 env->nb_tlb = 64;
3299 env->nb_ways = 2;
3300 env->id_tlbs = 0;
f2e63a42 3301#endif
e1833e1f 3302 init_excp_601(env);
d63001d1
JM
3303 env->dcache_line_size = 64;
3304 env->icache_line_size = 64;
faadf50e
JM
3305 /* Allocate hardware IRQ controller */
3306 ppc6xx_irq_init(env);
3fc6c082
FB
3307}
3308
a750fc0b
JM
3309/* PowerPC 602 */
3310#define POWERPC_INSNS_602 (POWERPC_INSNS_6xx | PPC_MFTB | \
3311 PPC_FLOAT_FRES | PPC_FLOAT_FRSQRTE | \
3312 PPC_FLOAT_FSEL | PPC_FLOAT_STFIWX | \
d63001d1 3313 PPC_6xx_TLB | PPC_MEM_TLBSYNC | PPC_CACHE_DCBZ |\
12de9a39 3314 PPC_SEGMENT | PPC_602_SPEC)
a750fc0b
JM
3315#define POWERPC_MSRM_602 (0x000000000033FF73ULL)
3316#define POWERPC_MMU_602 (POWERPC_MMU_SOFT_6xx)
3317//#define POWERPC_EXCP_602 (POWERPC_EXCP_602)
3318#define POWERPC_INPUT_602 (PPC_FLAGS_INPUT_6xx)
237c0af0 3319#define POWERPC_BFDM_602 (bfd_mach_ppc_602)
25ba3a68
JM
3320#define POWERPC_FLAG_602 (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | \
3321 POWERPC_FLAG_BE)
2f462816 3322#define check_pow_602 check_pow_hid0
a750fc0b
JM
3323
3324static void init_proc_602 (CPUPPCState *env)
3fc6c082 3325{
a750fc0b
JM
3326 gen_spr_ne_601(env);
3327 gen_spr_602(env);
3328 /* Time base */
3329 gen_tbl(env);
3330 /* hardware implementation registers */
3331 /* XXX : not implemented */
3332 spr_register(env, SPR_HID0, "HID0",
3333 SPR_NOACCESS, SPR_NOACCESS,
3334 &spr_read_generic, &spr_write_generic,
3335 0x00000000);
3336 /* XXX : not implemented */
3337 spr_register(env, SPR_HID1, "HID1",
3338 SPR_NOACCESS, SPR_NOACCESS,
3339 &spr_read_generic, &spr_write_generic,
3340 0x00000000);
3341 /* Memory management */
3342 gen_low_BATs(env);
3343 gen_6xx_7xx_soft_tlb(env, 64, 2);
e1833e1f 3344 init_excp_602(env);
d63001d1
JM
3345 env->dcache_line_size = 32;
3346 env->icache_line_size = 32;
a750fc0b
JM
3347 /* Allocate hardware IRQ controller */
3348 ppc6xx_irq_init(env);
3349}
3fc6c082 3350
a750fc0b
JM
3351/* PowerPC 603 */
3352#define POWERPC_INSNS_603 (POWERPC_INSNS_WORKS | PPC_6xx_TLB | PPC_EXTERN)
25ba3a68 3353#define POWERPC_MSRM_603 (0x000000000007FF73ULL)
a750fc0b
JM
3354#define POWERPC_MMU_603 (POWERPC_MMU_SOFT_6xx)
3355//#define POWERPC_EXCP_603 (POWERPC_EXCP_603)
3356#define POWERPC_INPUT_603 (PPC_FLAGS_INPUT_6xx)
237c0af0 3357#define POWERPC_BFDM_603 (bfd_mach_ppc_603)
25ba3a68
JM
3358#define POWERPC_FLAG_603 (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | \
3359 POWERPC_FLAG_BE)
2f462816 3360#define check_pow_603 check_pow_hid0
a750fc0b
JM
3361
3362static void init_proc_603 (CPUPPCState *env)
3363{
3364 gen_spr_ne_601(env);
3365 gen_spr_603(env);
3366 /* Time base */
3367 gen_tbl(env);
3368 /* hardware implementation registers */
3369 /* XXX : not implemented */
3370 spr_register(env, SPR_HID0, "HID0",
3371 SPR_NOACCESS, SPR_NOACCESS,
3372 &spr_read_generic, &spr_write_generic,
3373 0x00000000);
3374 /* XXX : not implemented */
3375 spr_register(env, SPR_HID1, "HID1",
3376 SPR_NOACCESS, SPR_NOACCESS,
3377 &spr_read_generic, &spr_write_generic,
3378 0x00000000);
3379 /* Memory management */
3380 gen_low_BATs(env);
3381 gen_6xx_7xx_soft_tlb(env, 64, 2);
e1833e1f 3382 init_excp_603(env);
d63001d1
JM
3383 env->dcache_line_size = 32;
3384 env->icache_line_size = 32;
a750fc0b
JM
3385 /* Allocate hardware IRQ controller */
3386 ppc6xx_irq_init(env);
3fc6c082
FB
3387}
3388
a750fc0b
JM
3389/* PowerPC 603e */
3390#define POWERPC_INSNS_603E (POWERPC_INSNS_WORKS | PPC_6xx_TLB | PPC_EXTERN)
3391#define POWERPC_MSRM_603E (0x000000000007FF73ULL)
3392#define POWERPC_MMU_603E (POWERPC_MMU_SOFT_6xx)
3393//#define POWERPC_EXCP_603E (POWERPC_EXCP_603E)
3394#define POWERPC_INPUT_603E (PPC_FLAGS_INPUT_6xx)
237c0af0 3395#define POWERPC_BFDM_603E (bfd_mach_ppc_ec603e)
25ba3a68
JM
3396#define POWERPC_FLAG_603E (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | \
3397 POWERPC_FLAG_BE)
2f462816 3398#define check_pow_603E check_pow_hid0
a750fc0b
JM
3399
3400static void init_proc_603E (CPUPPCState *env)
3401{
3402 gen_spr_ne_601(env);
3403 gen_spr_603(env);
3404 /* Time base */
3405 gen_tbl(env);
3406 /* hardware implementation registers */
3407 /* XXX : not implemented */
3408 spr_register(env, SPR_HID0, "HID0",
3409 SPR_NOACCESS, SPR_NOACCESS,
3410 &spr_read_generic, &spr_write_generic,
3411 0x00000000);
3412 /* XXX : not implemented */
3413 spr_register(env, SPR_HID1, "HID1",
3414 SPR_NOACCESS, SPR_NOACCESS,
3415 &spr_read_generic, &spr_write_generic,
3416 0x00000000);
3417 /* XXX : not implemented */
3418 spr_register(env, SPR_IABR, "IABR",
3419 SPR_NOACCESS, SPR_NOACCESS,
3420 &spr_read_generic, &spr_write_generic,
3421 0x00000000);
3422 /* Memory management */
3423 gen_low_BATs(env);
3424 gen_6xx_7xx_soft_tlb(env, 64, 2);
e1833e1f 3425 init_excp_603(env);
d63001d1
JM
3426 env->dcache_line_size = 32;
3427 env->icache_line_size = 32;
a750fc0b
JM
3428 /* Allocate hardware IRQ controller */
3429 ppc6xx_irq_init(env);
3430}
3431
3432/* PowerPC G2 */
3433#define POWERPC_INSNS_G2 (POWERPC_INSNS_WORKS | PPC_6xx_TLB | PPC_EXTERN)
3434#define POWERPC_MSRM_G2 (0x000000000006FFF2ULL)
3435#define POWERPC_MMU_G2 (POWERPC_MMU_SOFT_6xx)
3436//#define POWERPC_EXCP_G2 (POWERPC_EXCP_G2)
3437#define POWERPC_INPUT_G2 (PPC_FLAGS_INPUT_6xx)
237c0af0 3438#define POWERPC_BFDM_G2 (bfd_mach_ppc_ec603e)
25ba3a68
JM
3439#define POWERPC_FLAG_G2 (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | \
3440 POWERPC_FLAG_BE)
2f462816 3441#define check_pow_G2 check_pow_hid0
a750fc0b
JM
3442
3443static void init_proc_G2 (CPUPPCState *env)
3444{
3445 gen_spr_ne_601(env);
3446 gen_spr_G2_755(env);
3447 gen_spr_G2(env);
3448 /* Time base */
3449 gen_tbl(env);
3450 /* Hardware implementation register */
3451 /* XXX : not implemented */
3452 spr_register(env, SPR_HID0, "HID0",
3453 SPR_NOACCESS, SPR_NOACCESS,
3454 &spr_read_generic, &spr_write_generic,
3455 0x00000000);
3456 /* XXX : not implemented */
3457 spr_register(env, SPR_HID1, "HID1",
3458 SPR_NOACCESS, SPR_NOACCESS,
3459 &spr_read_generic, &spr_write_generic,
3460 0x00000000);
3461 /* XXX : not implemented */
3462 spr_register(env, SPR_HID2, "HID2",
3463 SPR_NOACCESS, SPR_NOACCESS,
3464 &spr_read_generic, &spr_write_generic,
3465 0x00000000);
3466 /* Memory management */
3467 gen_low_BATs(env);
3468 gen_high_BATs(env);
3469 gen_6xx_7xx_soft_tlb(env, 64, 2);
e1833e1f 3470 init_excp_G2(env);
d63001d1
JM
3471 env->dcache_line_size = 32;
3472 env->icache_line_size = 32;
a750fc0b
JM
3473 /* Allocate hardware IRQ controller */
3474 ppc6xx_irq_init(env);
3475}
3476
3477/* PowerPC G2LE */
3478#define POWERPC_INSNS_G2LE (POWERPC_INSNS_WORKS | PPC_6xx_TLB | PPC_EXTERN)
3479#define POWERPC_MSRM_G2LE (0x000000000007FFF3ULL)
3480#define POWERPC_MMU_G2LE (POWERPC_MMU_SOFT_6xx)
3481#define POWERPC_EXCP_G2LE (POWERPC_EXCP_G2)
3482#define POWERPC_INPUT_G2LE (PPC_FLAGS_INPUT_6xx)
237c0af0 3483#define POWERPC_BFDM_G2LE (bfd_mach_ppc_ec603e)
25ba3a68
JM
3484#define POWERPC_FLAG_G2LE (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | \
3485 POWERPC_FLAG_BE)
2f462816 3486#define check_pow_G2LE check_pow_hid0
a750fc0b
JM
3487
3488static void init_proc_G2LE (CPUPPCState *env)
3489{
3490 gen_spr_ne_601(env);
3491 gen_spr_G2_755(env);
3492 gen_spr_G2(env);
3493 /* Time base */
3494 gen_tbl(env);
3495 /* Hardware implementation register */
3496 /* XXX : not implemented */
3497 spr_register(env, SPR_HID0, "HID0",
3498 SPR_NOACCESS, SPR_NOACCESS,
3499 &spr_read_generic, &spr_write_generic,
3500 0x00000000);
3501 /* XXX : not implemented */
3502 spr_register(env, SPR_HID1, "HID1",
3503 SPR_NOACCESS, SPR_NOACCESS,
3504 &spr_read_generic, &spr_write_generic,
3505 0x00000000);
3506 /* XXX : not implemented */
3507 spr_register(env, SPR_HID2, "HID2",
3508 SPR_NOACCESS, SPR_NOACCESS,
3509 &spr_read_generic, &spr_write_generic,
3510 0x00000000);
3511 /* Memory management */
3512 gen_low_BATs(env);
3513 gen_high_BATs(env);
3514 gen_6xx_7xx_soft_tlb(env, 64, 2);
e1833e1f 3515 init_excp_G2(env);
d63001d1
JM
3516 env->dcache_line_size = 32;
3517 env->icache_line_size = 32;
a750fc0b
JM
3518 /* Allocate hardware IRQ controller */
3519 ppc6xx_irq_init(env);
3520}
3521
3522/* PowerPC 604 */
3523#define POWERPC_INSNS_604 (POWERPC_INSNS_WORKS | PPC_EXTERN)
3524#define POWERPC_MSRM_604 (0x000000000005FF77ULL)
3525#define POWERPC_MMU_604 (POWERPC_MMU_32B)
3526//#define POWERPC_EXCP_604 (POWERPC_EXCP_604)
3527#define POWERPC_INPUT_604 (PPC_FLAGS_INPUT_6xx)
237c0af0 3528#define POWERPC_BFDM_604 (bfd_mach_ppc_604)
25ba3a68
JM
3529#define POWERPC_FLAG_604 (POWERPC_FLAG_SE | POWERPC_FLAG_BE | \
3530 POWERPC_FLAG_PMM)
2f462816 3531#define check_pow_604 check_pow_nocheck
a750fc0b
JM
3532
3533static void init_proc_604 (CPUPPCState *env)
3534{
3535 gen_spr_ne_601(env);
3536 gen_spr_604(env);
3537 /* Time base */
3538 gen_tbl(env);
3539 /* Hardware implementation registers */
3540 /* XXX : not implemented */
3541 spr_register(env, SPR_HID0, "HID0",
3542 SPR_NOACCESS, SPR_NOACCESS,
3543 &spr_read_generic, &spr_write_generic,
3544 0x00000000);
3545 /* XXX : not implemented */
3546 spr_register(env, SPR_HID1, "HID1",
3547 SPR_NOACCESS, SPR_NOACCESS,
3548 &spr_read_generic, &spr_write_generic,
3549 0x00000000);
3550 /* Memory management */
3551 gen_low_BATs(env);
e1833e1f 3552 init_excp_604(env);
d63001d1
JM
3553 env->dcache_line_size = 32;
3554 env->icache_line_size = 32;
a750fc0b
JM
3555 /* Allocate hardware IRQ controller */
3556 ppc6xx_irq_init(env);
3557}
3558
3559/* PowerPC 740/750 (aka G3) */
3560#define POWERPC_INSNS_7x0 (POWERPC_INSNS_WORKS | PPC_EXTERN)
25ba3a68 3561#define POWERPC_MSRM_7x0 (0x000000000005FF77ULL)
a750fc0b
JM
3562#define POWERPC_MMU_7x0 (POWERPC_MMU_32B)
3563//#define POWERPC_EXCP_7x0 (POWERPC_EXCP_7x0)
3564#define POWERPC_INPUT_7x0 (PPC_FLAGS_INPUT_6xx)
237c0af0 3565#define POWERPC_BFDM_7x0 (bfd_mach_ppc_750)
25ba3a68
JM
3566#define POWERPC_FLAG_7x0 (POWERPC_FLAG_SE | POWERPC_FLAG_BE | \
3567 POWERPC_FLAG_PMM)
2f462816 3568#define check_pow_7x0 check_pow_hid0
a750fc0b
JM
3569
3570static void init_proc_7x0 (CPUPPCState *env)
3571{
3572 gen_spr_ne_601(env);
3573 gen_spr_7xx(env);
3574 /* Time base */
3575 gen_tbl(env);
3576 /* Thermal management */
3577 gen_spr_thrm(env);
3578 /* Hardware implementation registers */
3579 /* XXX : not implemented */
3580 spr_register(env, SPR_HID0, "HID0",
3581 SPR_NOACCESS, SPR_NOACCESS,
3582 &spr_read_generic, &spr_write_generic,
3583 0x00000000);
3584 /* XXX : not implemented */
3585 spr_register(env, SPR_HID1, "HID1",
3586 SPR_NOACCESS, SPR_NOACCESS,
3587 &spr_read_generic, &spr_write_generic,
3588 0x00000000);
3589 /* Memory management */
3590 gen_low_BATs(env);
e1833e1f 3591 init_excp_7x0(env);
d63001d1
JM
3592 env->dcache_line_size = 32;
3593 env->icache_line_size = 32;
a750fc0b
JM
3594 /* Allocate hardware IRQ controller */
3595 ppc6xx_irq_init(env);
3596}
3597
3598/* PowerPC 750FX/GX */
3599#define POWERPC_INSNS_750fx (POWERPC_INSNS_WORKS | PPC_EXTERN)
25ba3a68 3600#define POWERPC_MSRM_750fx (0x000000000005FF77ULL)
a750fc0b
JM
3601#define POWERPC_MMU_750fx (POWERPC_MMU_32B)
3602#define POWERPC_EXCP_750fx (POWERPC_EXCP_7x0)
3603#define POWERPC_INPUT_750fx (PPC_FLAGS_INPUT_6xx)
237c0af0 3604#define POWERPC_BFDM_750fx (bfd_mach_ppc_750)
25ba3a68
JM
3605#define POWERPC_FLAG_750fx (POWERPC_FLAG_SE | POWERPC_FLAG_BE | \
3606 POWERPC_FLAG_PMM)
2f462816 3607#define check_pow_750fx check_pow_hid0
a750fc0b
JM
3608
3609static void init_proc_750fx (CPUPPCState *env)
3610{
3611 gen_spr_ne_601(env);
3612 gen_spr_7xx(env);
3613 /* Time base */
3614 gen_tbl(env);
3615 /* Thermal management */
3616 gen_spr_thrm(env);
3617 /* Hardware implementation registers */
3618 /* XXX : not implemented */
3619 spr_register(env, SPR_HID0, "HID0",
3620 SPR_NOACCESS, SPR_NOACCESS,
3621 &spr_read_generic, &spr_write_generic,
3622 0x00000000);
3623 /* XXX : not implemented */
3624 spr_register(env, SPR_HID1, "HID1",
3625 SPR_NOACCESS, SPR_NOACCESS,
3626 &spr_read_generic, &spr_write_generic,
3627 0x00000000);
3628 /* XXX : not implemented */
3629 spr_register(env, SPR_750_HID2, "HID2",
3630 SPR_NOACCESS, SPR_NOACCESS,
3631 &spr_read_generic, &spr_write_generic,
3632 0x00000000);
3633 /* Memory management */
3634 gen_low_BATs(env);
3635 /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
3636 gen_high_BATs(env);
e1833e1f 3637 init_excp_750FX(env);
d63001d1
JM
3638 env->dcache_line_size = 32;
3639 env->icache_line_size = 32;
a750fc0b
JM
3640 /* Allocate hardware IRQ controller */
3641 ppc6xx_irq_init(env);
3642}
3643
3644/* PowerPC 745/755 */
3645#define POWERPC_INSNS_7x5 (POWERPC_INSNS_WORKS | PPC_EXTERN | PPC_6xx_TLB)
25ba3a68 3646#define POWERPC_MSRM_7x5 (0x000000000005FF77ULL)
a750fc0b
JM
3647#define POWERPC_MMU_7x5 (POWERPC_MMU_SOFT_6xx)
3648//#define POWERPC_EXCP_7x5 (POWERPC_EXCP_7x5)
3649#define POWERPC_INPUT_7x5 (PPC_FLAGS_INPUT_6xx)
237c0af0 3650#define POWERPC_BFDM_7x5 (bfd_mach_ppc_750)
25ba3a68
JM
3651#define POWERPC_FLAG_7x5 (POWERPC_FLAG_SE | POWERPC_FLAG_BE | \
3652 POWERPC_FLAG_PMM)
2f462816 3653#define check_pow_7x5 check_pow_hid0
a750fc0b
JM
3654
3655static void init_proc_7x5 (CPUPPCState *env)
3656{
3657 gen_spr_ne_601(env);
3658 gen_spr_G2_755(env);
3659 /* Time base */
3660 gen_tbl(env);
3661 /* L2 cache control */
3662 /* XXX : not implemented */
3663 spr_register(env, SPR_ICTC, "ICTC",
3664 SPR_NOACCESS, SPR_NOACCESS,
3665 &spr_read_generic, &spr_write_generic,
3666 0x00000000);
3667 /* XXX : not implemented */
3668 spr_register(env, SPR_L2PMCR, "L2PMCR",
3669 SPR_NOACCESS, SPR_NOACCESS,
3670 &spr_read_generic, &spr_write_generic,
3671 0x00000000);
3672 /* Hardware implementation registers */
3673 /* XXX : not implemented */
3674 spr_register(env, SPR_HID0, "HID0",
3675 SPR_NOACCESS, SPR_NOACCESS,
3676 &spr_read_generic, &spr_write_generic,
3677 0x00000000);
3678 /* XXX : not implemented */
3679 spr_register(env, SPR_HID1, "HID1",
3680 SPR_NOACCESS, SPR_NOACCESS,
3681 &spr_read_generic, &spr_write_generic,
3682 0x00000000);
3683 /* XXX : not implemented */
3684 spr_register(env, SPR_HID2, "HID2",
3685 SPR_NOACCESS, SPR_NOACCESS,
3686 &spr_read_generic, &spr_write_generic,
3687 0x00000000);
3688 /* Memory management */
3689 gen_low_BATs(env);
3690 gen_high_BATs(env);
3691 gen_6xx_7xx_soft_tlb(env, 64, 2);
7a3a6927 3692 init_excp_7x5(env);
d63001d1
JM
3693 env->dcache_line_size = 32;
3694 env->icache_line_size = 32;
a750fc0b
JM
3695 /* Allocate hardware IRQ controller */
3696 ppc6xx_irq_init(env);
d63001d1
JM
3697#if !defined(CONFIG_USER_ONLY)
3698 /* Hardware reset vector */
3699 env->hreset_vector = 0xFFFFFFFCUL;
3700#endif
a750fc0b
JM
3701}
3702
3703/* PowerPC 7400 (aka G4) */
3704#define POWERPC_INSNS_7400 (POWERPC_INSNS_WORKS | PPC_CACHE_DCBA | \
3705 PPC_EXTERN | PPC_MEM_TLBIA | \
3706 PPC_ALTIVEC)
3707#define POWERPC_MSRM_7400 (0x000000000205FF77ULL)
3708#define POWERPC_MMU_7400 (POWERPC_MMU_32B)
3709#define POWERPC_EXCP_7400 (POWERPC_EXCP_74xx)
3710#define POWERPC_INPUT_7400 (PPC_FLAGS_INPUT_6xx)
237c0af0 3711#define POWERPC_BFDM_7400 (bfd_mach_ppc_7400)
25ba3a68
JM
3712#define POWERPC_FLAG_7400 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
3713 POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
2f462816 3714#define check_pow_7400 check_pow_hid0
a750fc0b
JM
3715
3716static void init_proc_7400 (CPUPPCState *env)
3717{
3718 gen_spr_ne_601(env);
3719 gen_spr_7xx(env);
3720 /* Time base */
3721 gen_tbl(env);
3722 /* 74xx specific SPR */
3723 gen_spr_74xx(env);
3724 /* Thermal management */
3725 gen_spr_thrm(env);
3726 /* Memory management */
3727 gen_low_BATs(env);
e1833e1f 3728 init_excp_7400(env);
d63001d1
JM
3729 env->dcache_line_size = 32;
3730 env->icache_line_size = 32;
a750fc0b
JM
3731 /* Allocate hardware IRQ controller */
3732 ppc6xx_irq_init(env);
3733}
3734
3735/* PowerPC 7410 (aka G4) */
3736#define POWERPC_INSNS_7410 (POWERPC_INSNS_WORKS | PPC_CACHE_DCBA | \
3737 PPC_EXTERN | PPC_MEM_TLBIA | \
3738 PPC_ALTIVEC)
3739#define POWERPC_MSRM_7410 (0x000000000205FF77ULL)
3740#define POWERPC_MMU_7410 (POWERPC_MMU_32B)
3741#define POWERPC_EXCP_7410 (POWERPC_EXCP_74xx)
3742#define POWERPC_INPUT_7410 (PPC_FLAGS_INPUT_6xx)
237c0af0 3743#define POWERPC_BFDM_7410 (bfd_mach_ppc_7400)
25ba3a68
JM
3744#define POWERPC_FLAG_7410 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
3745 POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
2f462816 3746#define check_pow_7410 check_pow_hid0
a750fc0b
JM
3747
3748static void init_proc_7410 (CPUPPCState *env)
3749{
3750 gen_spr_ne_601(env);
3751 gen_spr_7xx(env);
3752 /* Time base */
3753 gen_tbl(env);
3754 /* 74xx specific SPR */
3755 gen_spr_74xx(env);
3756 /* Thermal management */
3757 gen_spr_thrm(env);
3758 /* L2PMCR */
3759 /* XXX : not implemented */
3760 spr_register(env, SPR_L2PMCR, "L2PMCR",
3761 SPR_NOACCESS, SPR_NOACCESS,
3762 &spr_read_generic, &spr_write_generic,
3763 0x00000000);
3764 /* LDSTDB */
3765 /* XXX : not implemented */
3766 spr_register(env, SPR_LDSTDB, "LDSTDB",
3767 SPR_NOACCESS, SPR_NOACCESS,
3768 &spr_read_generic, &spr_write_generic,
3769 0x00000000);
3770 /* Memory management */
3771 gen_low_BATs(env);
e1833e1f 3772 init_excp_7400(env);
d63001d1
JM
3773 env->dcache_line_size = 32;
3774 env->icache_line_size = 32;
a750fc0b
JM
3775 /* Allocate hardware IRQ controller */
3776 ppc6xx_irq_init(env);
3777}
3778
3779/* PowerPC 7440 (aka G4) */
a750fc0b
JM
3780#define POWERPC_INSNS_7440 (POWERPC_INSNS_WORKS | PPC_CACHE_DCBA | \
3781 PPC_EXTERN | PPC_74xx_TLB | PPC_MEM_TLBIA | \
3782 PPC_ALTIVEC)
3783#define POWERPC_MSRM_7440 (0x000000000205FF77ULL)
3784#define POWERPC_MMU_7440 (POWERPC_MMU_SOFT_74xx)
3785#define POWERPC_EXCP_7440 (POWERPC_EXCP_74xx)
3786#define POWERPC_INPUT_7440 (PPC_FLAGS_INPUT_6xx)
237c0af0 3787#define POWERPC_BFDM_7440 (bfd_mach_ppc_7400)
25ba3a68
JM
3788#define POWERPC_FLAG_7440 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
3789 POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
2f462816 3790#define check_pow_7440 check_pow_hid0
a750fc0b 3791
578bb252 3792__attribute__ (( unused ))
a750fc0b
JM
3793static void init_proc_7440 (CPUPPCState *env)
3794{
3795 gen_spr_ne_601(env);
3796 gen_spr_7xx(env);
3797 /* Time base */
3798 gen_tbl(env);
3799 /* 74xx specific SPR */
3800 gen_spr_74xx(env);
3801 /* LDSTCR */
3802 /* XXX : not implemented */
3803 spr_register(env, SPR_LDSTCR, "LDSTCR",
3804 SPR_NOACCESS, SPR_NOACCESS,
3805 &spr_read_generic, &spr_write_generic,
3806 0x00000000);
3807 /* ICTRL */
3808 /* XXX : not implemented */
3809 spr_register(env, SPR_ICTRL, "ICTRL",
3810 SPR_NOACCESS, SPR_NOACCESS,
3811 &spr_read_generic, &spr_write_generic,
3812 0x00000000);
3813 /* MSSSR0 */
578bb252 3814 /* XXX : not implemented */
a750fc0b
JM
3815 spr_register(env, SPR_MSSSR0, "MSSSR0",
3816 SPR_NOACCESS, SPR_NOACCESS,
3817 &spr_read_generic, &spr_write_generic,
3818 0x00000000);
3819 /* PMC */
3820 /* XXX : not implemented */
3821 spr_register(env, SPR_PMC5, "PMC5",
3822 SPR_NOACCESS, SPR_NOACCESS,
3823 &spr_read_generic, &spr_write_generic,
3824 0x00000000);
578bb252 3825 /* XXX : not implemented */
a750fc0b
JM
3826 spr_register(env, SPR_UPMC5, "UPMC5",
3827 &spr_read_ureg, SPR_NOACCESS,
3828 &spr_read_ureg, SPR_NOACCESS,
3829 0x00000000);
578bb252 3830 /* XXX : not implemented */
a750fc0b
JM
3831 spr_register(env, SPR_PMC6, "PMC6",
3832 SPR_NOACCESS, SPR_NOACCESS,
3833 &spr_read_generic, &spr_write_generic,
3834 0x00000000);
578bb252 3835 /* XXX : not implemented */
a750fc0b
JM
3836 spr_register(env, SPR_UPMC6, "UPMC6",
3837 &spr_read_ureg, SPR_NOACCESS,
3838 &spr_read_ureg, SPR_NOACCESS,
3839 0x00000000);
3840 /* Memory management */
3841 gen_low_BATs(env);
578bb252 3842 gen_74xx_soft_tlb(env, 128, 2);
1c27f8fb 3843 init_excp_7450(env);
d63001d1
JM
3844 env->dcache_line_size = 32;
3845 env->icache_line_size = 32;
a750fc0b
JM
3846 /* Allocate hardware IRQ controller */
3847 ppc6xx_irq_init(env);
3848}
a750fc0b
JM
3849
3850/* PowerPC 7450 (aka G4) */
a750fc0b
JM
3851#define POWERPC_INSNS_7450 (POWERPC_INSNS_WORKS | PPC_CACHE_DCBA | \
3852 PPC_EXTERN | PPC_74xx_TLB | PPC_MEM_TLBIA | \
3853 PPC_ALTIVEC)
3854#define POWERPC_MSRM_7450 (0x000000000205FF77ULL)
3855#define POWERPC_MMU_7450 (POWERPC_MMU_SOFT_74xx)
3856#define POWERPC_EXCP_7450 (POWERPC_EXCP_74xx)
3857#define POWERPC_INPUT_7450 (PPC_FLAGS_INPUT_6xx)
237c0af0 3858#define POWERPC_BFDM_7450 (bfd_mach_ppc_7400)
25ba3a68
JM
3859#define POWERPC_FLAG_7450 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
3860 POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
2f462816 3861#define check_pow_7450 check_pow_hid0
a750fc0b 3862
578bb252 3863__attribute__ (( unused ))
a750fc0b
JM
3864static void init_proc_7450 (CPUPPCState *env)
3865{
3866 gen_spr_ne_601(env);
3867 gen_spr_7xx(env);
3868 /* Time base */
3869 gen_tbl(env);
3870 /* 74xx specific SPR */
3871 gen_spr_74xx(env);
3872 /* Level 3 cache control */
3873 gen_l3_ctrl(env);
3874 /* LDSTCR */
3875 /* XXX : not implemented */
3876 spr_register(env, SPR_LDSTCR, "LDSTCR",
3877 SPR_NOACCESS, SPR_NOACCESS,
3878 &spr_read_generic, &spr_write_generic,
3879 0x00000000);
3880 /* ICTRL */
3881 /* XXX : not implemented */
3882 spr_register(env, SPR_ICTRL, "ICTRL",
3883 SPR_NOACCESS, SPR_NOACCESS,
3884 &spr_read_generic, &spr_write_generic,
3885 0x00000000);
3886 /* MSSSR0 */
578bb252 3887 /* XXX : not implemented */
a750fc0b
JM
3888 spr_register(env, SPR_MSSSR0, "MSSSR0",
3889 SPR_NOACCESS, SPR_NOACCESS,
3890 &spr_read_generic, &spr_write_generic,
3891 0x00000000);
3892 /* PMC */
3893 /* XXX : not implemented */
3894 spr_register(env, SPR_PMC5, "PMC5",
3895 SPR_NOACCESS, SPR_NOACCESS,
3896 &spr_read_generic, &spr_write_generic,
3897 0x00000000);
578bb252 3898 /* XXX : not implemented */
a750fc0b
JM
3899 spr_register(env, SPR_UPMC5, "UPMC5",
3900 &spr_read_ureg, SPR_NOACCESS,
3901 &spr_read_ureg, SPR_NOACCESS,
3902 0x00000000);
578bb252 3903 /* XXX : not implemented */
a750fc0b
JM
3904 spr_register(env, SPR_PMC6, "PMC6",
3905 SPR_NOACCESS, SPR_NOACCESS,
3906 &spr_read_generic, &spr_write_generic,
3907 0x00000000);
578bb252 3908 /* XXX : not implemented */
a750fc0b
JM
3909 spr_register(env, SPR_UPMC6, "UPMC6",
3910 &spr_read_ureg, SPR_NOACCESS,
3911 &spr_read_ureg, SPR_NOACCESS,
3912 0x00000000);
3913 /* Memory management */
3914 gen_low_BATs(env);
578bb252 3915 gen_74xx_soft_tlb(env, 128, 2);
e1833e1f 3916 init_excp_7450(env);
d63001d1
JM
3917 env->dcache_line_size = 32;
3918 env->icache_line_size = 32;
a750fc0b
JM
3919 /* Allocate hardware IRQ controller */
3920 ppc6xx_irq_init(env);
3921}
a750fc0b
JM
3922
3923/* PowerPC 7445 (aka G4) */
a750fc0b
JM
3924#define POWERPC_INSNS_7445 (POWERPC_INSNS_WORKS | PPC_CACHE_DCBA | \
3925 PPC_EXTERN | PPC_74xx_TLB | PPC_MEM_TLBIA | \
3926 PPC_ALTIVEC)
3927#define POWERPC_MSRM_7445 (0x000000000205FF77ULL)
3928#define POWERPC_MMU_7445 (POWERPC_MMU_SOFT_74xx)
3929#define POWERPC_EXCP_7445 (POWERPC_EXCP_74xx)
3930#define POWERPC_INPUT_7445 (PPC_FLAGS_INPUT_6xx)
237c0af0 3931#define POWERPC_BFDM_7445 (bfd_mach_ppc_7400)
25ba3a68
JM
3932#define POWERPC_FLAG_7445 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
3933 POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
2f462816 3934#define check_pow_7445 check_pow_hid0
a750fc0b 3935
578bb252 3936__attribute__ (( unused ))
a750fc0b
JM
3937static void init_proc_7445 (CPUPPCState *env)
3938{
3939 gen_spr_ne_601(env);
3940 gen_spr_7xx(env);
3941 /* Time base */
3942 gen_tbl(env);
3943 /* 74xx specific SPR */
3944 gen_spr_74xx(env);
3945 /* LDSTCR */
3946 /* XXX : not implemented */
3947 spr_register(env, SPR_LDSTCR, "LDSTCR",
3948 SPR_NOACCESS, SPR_NOACCESS,
3949 &spr_read_generic, &spr_write_generic,
3950 0x00000000);
3951 /* ICTRL */
3952 /* XXX : not implemented */
3953 spr_register(env, SPR_ICTRL, "ICTRL",
3954 SPR_NOACCESS, SPR_NOACCESS,
3955 &spr_read_generic, &spr_write_generic,
3956 0x00000000);
3957 /* MSSSR0 */
578bb252 3958 /* XXX : not implemented */
a750fc0b
JM
3959 spr_register(env, SPR_MSSSR0, "MSSSR0",
3960 SPR_NOACCESS, SPR_NOACCESS,
3961 &spr_read_generic, &spr_write_generic,
3962 0x00000000);
3963 /* PMC */
3964 /* XXX : not implemented */
3965 spr_register(env, SPR_PMC5, "PMC5",
3966 SPR_NOACCESS, SPR_NOACCESS,
3967 &spr_read_generic, &spr_write_generic,
3968 0x00000000);
578bb252 3969 /* XXX : not implemented */
a750fc0b
JM
3970 spr_register(env, SPR_UPMC5, "UPMC5",
3971 &spr_read_ureg, SPR_NOACCESS,
3972 &spr_read_ureg, SPR_NOACCESS,
3973 0x00000000);
578bb252 3974 /* XXX : not implemented */
a750fc0b
JM
3975 spr_register(env, SPR_PMC6, "PMC6",
3976 SPR_NOACCESS, SPR_NOACCESS,
3977 &spr_read_generic, &spr_write_generic,
3978 0x00000000);
578bb252 3979 /* XXX : not implemented */
a750fc0b
JM
3980 spr_register(env, SPR_UPMC6, "UPMC6",
3981 &spr_read_ureg, SPR_NOACCESS,
3982 &spr_read_ureg, SPR_NOACCESS,
3983 0x00000000);
3984 /* SPRGs */
3985 spr_register(env, SPR_SPRG4, "SPRG4",
3986 SPR_NOACCESS, SPR_NOACCESS,
3987 &spr_read_generic, &spr_write_generic,
3988 0x00000000);
3989 spr_register(env, SPR_USPRG4, "USPRG4",
3990 &spr_read_ureg, SPR_NOACCESS,
3991 &spr_read_ureg, SPR_NOACCESS,
3992 0x00000000);
3993 spr_register(env, SPR_SPRG5, "SPRG5",
3994 SPR_NOACCESS, SPR_NOACCESS,
3995 &spr_read_generic, &spr_write_generic,
3996 0x00000000);
3997 spr_register(env, SPR_USPRG5, "USPRG5",
3998 &spr_read_ureg, SPR_NOACCESS,
3999 &spr_read_ureg, SPR_NOACCESS,
4000 0x00000000);
4001 spr_register(env, SPR_SPRG6, "SPRG6",
4002 SPR_NOACCESS, SPR_NOACCESS,
4003 &spr_read_generic, &spr_write_generic,
4004 0x00000000);
4005 spr_register(env, SPR_USPRG6, "USPRG6",
4006 &spr_read_ureg, SPR_NOACCESS,
4007 &spr_read_ureg, SPR_NOACCESS,
4008 0x00000000);
4009 spr_register(env, SPR_SPRG7, "SPRG7",
4010 SPR_NOACCESS, SPR_NOACCESS,
4011 &spr_read_generic, &spr_write_generic,
4012 0x00000000);
4013 spr_register(env, SPR_USPRG7, "USPRG7",
4014 &spr_read_ureg, SPR_NOACCESS,
4015 &spr_read_ureg, SPR_NOACCESS,
4016 0x00000000);
4017 /* Memory management */
4018 gen_low_BATs(env);
4019 gen_high_BATs(env);
578bb252 4020 gen_74xx_soft_tlb(env, 128, 2);
e1833e1f 4021 init_excp_7450(env);
d63001d1
JM
4022 env->dcache_line_size = 32;
4023 env->icache_line_size = 32;
a750fc0b
JM
4024 /* Allocate hardware IRQ controller */
4025 ppc6xx_irq_init(env);
4026}
a750fc0b
JM
4027
4028/* PowerPC 7455 (aka G4) */
a750fc0b
JM
4029#define POWERPC_INSNS_7455 (POWERPC_INSNS_WORKS | PPC_CACHE_DCBA | \
4030 PPC_EXTERN | PPC_74xx_TLB | PPC_MEM_TLBIA | \
4031 PPC_ALTIVEC)
4032#define POWERPC_MSRM_7455 (0x000000000205FF77ULL)
4033#define POWERPC_MMU_7455 (POWERPC_MMU_SOFT_74xx)
4034#define POWERPC_EXCP_7455 (POWERPC_EXCP_74xx)
4035#define POWERPC_INPUT_7455 (PPC_FLAGS_INPUT_6xx)
237c0af0 4036#define POWERPC_BFDM_7455 (bfd_mach_ppc_7400)
25ba3a68
JM
4037#define POWERPC_FLAG_7455 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
4038 POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
2f462816 4039#define check_pow_7455 check_pow_hid0
a750fc0b 4040
578bb252 4041__attribute__ (( unused ))
a750fc0b
JM
4042static void init_proc_7455 (CPUPPCState *env)
4043{
4044 gen_spr_ne_601(env);
4045 gen_spr_7xx(env);
4046 /* Time base */
4047 gen_tbl(env);
4048 /* 74xx specific SPR */
4049 gen_spr_74xx(env);
4050 /* Level 3 cache control */
4051 gen_l3_ctrl(env);
4052 /* LDSTCR */
4053 /* XXX : not implemented */
4054 spr_register(env, SPR_LDSTCR, "LDSTCR",
4055 SPR_NOACCESS, SPR_NOACCESS,
4056 &spr_read_generic, &spr_write_generic,
4057 0x00000000);
4058 /* ICTRL */
4059 /* XXX : not implemented */
4060 spr_register(env, SPR_ICTRL, "ICTRL",
4061 SPR_NOACCESS, SPR_NOACCESS,
4062 &spr_read_generic, &spr_write_generic,
4063 0x00000000);
4064 /* MSSSR0 */
578bb252 4065 /* XXX : not implemented */
a750fc0b
JM
4066 spr_register(env, SPR_MSSSR0, "MSSSR0",
4067 SPR_NOACCESS, SPR_NOACCESS,
4068 &spr_read_generic, &spr_write_generic,
4069 0x00000000);
4070 /* PMC */
4071 /* XXX : not implemented */
4072 spr_register(env, SPR_PMC5, "PMC5",
4073 SPR_NOACCESS, SPR_NOACCESS,
4074 &spr_read_generic, &spr_write_generic,
4075 0x00000000);
578bb252 4076 /* XXX : not implemented */
a750fc0b
JM
4077 spr_register(env, SPR_UPMC5, "UPMC5",
4078 &spr_read_ureg, SPR_NOACCESS,
4079 &spr_read_ureg, SPR_NOACCESS,
4080 0x00000000);
578bb252 4081 /* XXX : not implemented */
a750fc0b
JM
4082 spr_register(env, SPR_PMC6, "PMC6",
4083 SPR_NOACCESS, SPR_NOACCESS,
4084 &spr_read_generic, &spr_write_generic,
4085 0x00000000);
578bb252 4086 /* XXX : not implemented */
a750fc0b
JM
4087 spr_register(env, SPR_UPMC6, "UPMC6",
4088 &spr_read_ureg, SPR_NOACCESS,
4089 &spr_read_ureg, SPR_NOACCESS,
4090 0x00000000);
4091 /* SPRGs */
4092 spr_register(env, SPR_SPRG4, "SPRG4",
4093 SPR_NOACCESS, SPR_NOACCESS,
4094 &spr_read_generic, &spr_write_generic,
4095 0x00000000);
4096 spr_register(env, SPR_USPRG4, "USPRG4",
4097 &spr_read_ureg, SPR_NOACCESS,
4098 &spr_read_ureg, SPR_NOACCESS,
4099 0x00000000);
4100 spr_register(env, SPR_SPRG5, "SPRG5",
4101 SPR_NOACCESS, SPR_NOACCESS,
4102 &spr_read_generic, &spr_write_generic,
4103 0x00000000);
4104 spr_register(env, SPR_USPRG5, "USPRG5",
4105 &spr_read_ureg, SPR_NOACCESS,
4106 &spr_read_ureg, SPR_NOACCESS,
4107 0x00000000);
4108 spr_register(env, SPR_SPRG6, "SPRG6",
4109 SPR_NOACCESS, SPR_NOACCESS,
4110 &spr_read_generic, &spr_write_generic,
4111 0x00000000);
4112 spr_register(env, SPR_USPRG6, "USPRG6",
4113 &spr_read_ureg, SPR_NOACCESS,
4114 &spr_read_ureg, SPR_NOACCESS,
4115 0x00000000);
4116 spr_register(env, SPR_SPRG7, "SPRG7",
4117 SPR_NOACCESS, SPR_NOACCESS,
4118 &spr_read_generic, &spr_write_generic,
4119 0x00000000);
4120 spr_register(env, SPR_USPRG7, "USPRG7",
4121 &spr_read_ureg, SPR_NOACCESS,
4122 &spr_read_ureg, SPR_NOACCESS,
4123 0x00000000);
4124 /* Memory management */
4125 gen_low_BATs(env);
4126 gen_high_BATs(env);
578bb252 4127 gen_74xx_soft_tlb(env, 128, 2);
e1833e1f 4128 init_excp_7450(env);
d63001d1
JM
4129 env->dcache_line_size = 32;
4130 env->icache_line_size = 32;
a750fc0b
JM
4131 /* Allocate hardware IRQ controller */
4132 ppc6xx_irq_init(env);
4133}
a750fc0b
JM
4134
4135#if defined (TARGET_PPC64)
d63001d1 4136#define POWERPC_INSNS_WORK64 (POWERPC_INSNS_6xx | PPC_FLOAT_FSQRT | \
12de9a39
JM
4137 PPC_FLOAT_FRES | PPC_FLOAT_FRSQRTE | \
4138 PPC_FLOAT_FSEL | PPC_FLOAT_STFIWX | \
4139 PPC_MEM_TLBSYNC | PPC_CACHE_DCBZT | PPC_MFTB)
a750fc0b 4140/* PowerPC 970 */
d63001d1 4141#define POWERPC_INSNS_970 (POWERPC_INSNS_WORK64 | PPC_FLOAT_FSQRT | \
a750fc0b 4142 PPC_64B | PPC_ALTIVEC | \
12de9a39 4143 PPC_SEGMENT_64B | PPC_SLBI)
a750fc0b 4144#define POWERPC_MSRM_970 (0x900000000204FF36ULL)
12de9a39 4145#define POWERPC_MMU_970 (POWERPC_MMU_64B)
a750fc0b
JM
4146//#define POWERPC_EXCP_970 (POWERPC_EXCP_970)
4147#define POWERPC_INPUT_970 (PPC_FLAGS_INPUT_970)
237c0af0 4148#define POWERPC_BFDM_970 (bfd_mach_ppc64)
25ba3a68
JM
4149#define POWERPC_FLAG_970 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
4150 POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
a750fc0b 4151
417bf010
JM
4152#if defined(CONFIG_USER_ONLY)
4153#define POWERPC970_HID5_INIT 0x00000080
4154#else
4155#define POWERPC970_HID5_INIT 0x00000000
4156#endif
4157
2f462816
JM
4158static int check_pow_970 (CPUPPCState *env)
4159{
4160 if (env->spr[SPR_HID0] & 0x00600000)
4161 return 1;
4162
4163 return 0;
4164}
4165
a750fc0b
JM
4166static void init_proc_970 (CPUPPCState *env)
4167{
4168 gen_spr_ne_601(env);
4169 gen_spr_7xx(env);
4170 /* Time base */
4171 gen_tbl(env);
4172 /* Hardware implementation registers */
4173 /* XXX : not implemented */
4174 spr_register(env, SPR_HID0, "HID0",
4175 SPR_NOACCESS, SPR_NOACCESS,
06403421 4176 &spr_read_generic, &spr_write_clear,
d63001d1 4177 0x60000000);
a750fc0b
JM
4178 /* XXX : not implemented */
4179 spr_register(env, SPR_HID1, "HID1",
4180 SPR_NOACCESS, SPR_NOACCESS,
4181 &spr_read_generic, &spr_write_generic,
4182 0x00000000);
4183 /* XXX : not implemented */
4184 spr_register(env, SPR_750_HID2, "HID2",
4185 SPR_NOACCESS, SPR_NOACCESS,
4186 &spr_read_generic, &spr_write_generic,
4187 0x00000000);
e57448f1
JM
4188 /* XXX : not implemented */
4189 spr_register(env, SPR_970_HID5, "HID5",
4190 SPR_NOACCESS, SPR_NOACCESS,
4191 &spr_read_generic, &spr_write_generic,
417bf010 4192 POWERPC970_HID5_INIT);
a750fc0b
JM
4193 /* Memory management */
4194 /* XXX: not correct */
4195 gen_low_BATs(env);
12de9a39
JM
4196 /* XXX : not implemented */
4197 spr_register(env, SPR_MMUCFG, "MMUCFG",
4198 SPR_NOACCESS, SPR_NOACCESS,
4199 &spr_read_generic, SPR_NOACCESS,
4200 0x00000000); /* TOFIX */
4201 /* XXX : not implemented */
4202 spr_register(env, SPR_MMUCSR0, "MMUCSR0",
4203 SPR_NOACCESS, SPR_NOACCESS,
4204 &spr_read_generic, &spr_write_generic,
4205 0x00000000); /* TOFIX */
4206 spr_register(env, SPR_HIOR, "SPR_HIOR",
4207 SPR_NOACCESS, SPR_NOACCESS,
4208 &spr_read_generic, &spr_write_generic,
4209 0xFFF00000); /* XXX: This is a hack */
f2e63a42 4210#if !defined(CONFIG_USER_ONLY)
12de9a39 4211 env->slb_nr = 32;
f2e63a42 4212#endif
e1833e1f 4213 init_excp_970(env);
d63001d1
JM
4214 env->dcache_line_size = 128;
4215 env->icache_line_size = 128;
a750fc0b
JM
4216 /* Allocate hardware IRQ controller */
4217 ppc970_irq_init(env);
4218}
a750fc0b
JM
4219
4220/* PowerPC 970FX (aka G5) */
d63001d1 4221#define POWERPC_INSNS_970FX (POWERPC_INSNS_WORK64 | PPC_FLOAT_FSQRT | \
a750fc0b 4222 PPC_64B | PPC_ALTIVEC | \
12de9a39 4223 PPC_SEGMENT_64B | PPC_SLBI)
a750fc0b 4224#define POWERPC_MSRM_970FX (0x800000000204FF36ULL)
12de9a39 4225#define POWERPC_MMU_970FX (POWERPC_MMU_64B)
a750fc0b
JM
4226#define POWERPC_EXCP_970FX (POWERPC_EXCP_970)
4227#define POWERPC_INPUT_970FX (PPC_FLAGS_INPUT_970)
237c0af0 4228#define POWERPC_BFDM_970FX (bfd_mach_ppc64)
25ba3a68
JM
4229#define POWERPC_FLAG_970FX (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
4230 POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
a750fc0b 4231
2f462816
JM
4232static int check_pow_970FX (CPUPPCState *env)
4233{
4234 if (env->spr[SPR_HID0] & 0x00600000)
4235 return 1;
4236
4237 return 0;
4238}
4239
a750fc0b
JM
4240static void init_proc_970FX (CPUPPCState *env)
4241{
4242 gen_spr_ne_601(env);
4243 gen_spr_7xx(env);
4244 /* Time base */
4245 gen_tbl(env);
4246 /* Hardware implementation registers */
4247 /* XXX : not implemented */
4248 spr_register(env, SPR_HID0, "HID0",
4249 SPR_NOACCESS, SPR_NOACCESS,
06403421 4250 &spr_read_generic, &spr_write_clear,
d63001d1 4251 0x60000000);
a750fc0b
JM
4252 /* XXX : not implemented */
4253 spr_register(env, SPR_HID1, "HID1",
4254 SPR_NOACCESS, SPR_NOACCESS,
4255 &spr_read_generic, &spr_write_generic,
4256 0x00000000);
4257 /* XXX : not implemented */
4258 spr_register(env, SPR_750_HID2, "HID2",
4259 SPR_NOACCESS, SPR_NOACCESS,
4260 &spr_read_generic, &spr_write_generic,
4261 0x00000000);
d63001d1
JM
4262 /* XXX : not implemented */
4263 spr_register(env, SPR_970_HID5, "HID5",
4264 SPR_NOACCESS, SPR_NOACCESS,
4265 &spr_read_generic, &spr_write_generic,
417bf010 4266 POWERPC970_HID5_INIT);
a750fc0b
JM
4267 /* Memory management */
4268 /* XXX: not correct */
4269 gen_low_BATs(env);
12de9a39
JM
4270 /* XXX : not implemented */
4271 spr_register(env, SPR_MMUCFG, "MMUCFG",
4272 SPR_NOACCESS, SPR_NOACCESS,
4273 &spr_read_generic, SPR_NOACCESS,
4274 0x00000000); /* TOFIX */
4275 /* XXX : not implemented */
4276 spr_register(env, SPR_MMUCSR0, "MMUCSR0",
4277 SPR_NOACCESS, SPR_NOACCESS,
4278 &spr_read_generic, &spr_write_generic,
4279 0x00000000); /* TOFIX */
4280 spr_register(env, SPR_HIOR, "SPR_HIOR",
4281 SPR_NOACCESS, SPR_NOACCESS,
4282 &spr_read_generic, &spr_write_generic,
4283 0xFFF00000); /* XXX: This is a hack */
f2e63a42 4284#if !defined(CONFIG_USER_ONLY)
12de9a39 4285 env->slb_nr = 32;
f2e63a42 4286#endif
e1833e1f 4287 init_excp_970(env);
d63001d1
JM
4288 env->dcache_line_size = 128;
4289 env->icache_line_size = 128;
a750fc0b
JM
4290 /* Allocate hardware IRQ controller */
4291 ppc970_irq_init(env);
4292}
a750fc0b
JM
4293
4294/* PowerPC 970 GX */
d63001d1 4295#define POWERPC_INSNS_970GX (POWERPC_INSNS_WORK64 | PPC_FLOAT_FSQRT | \
a750fc0b 4296 PPC_64B | PPC_ALTIVEC | \
12de9a39 4297 PPC_SEGMENT_64B | PPC_SLBI)
a750fc0b 4298#define POWERPC_MSRM_970GX (0x800000000204FF36ULL)
12de9a39 4299#define POWERPC_MMU_970GX (POWERPC_MMU_64B)
a750fc0b
JM
4300#define POWERPC_EXCP_970GX (POWERPC_EXCP_970)
4301#define POWERPC_INPUT_970GX (PPC_FLAGS_INPUT_970)
237c0af0 4302#define POWERPC_BFDM_970GX (bfd_mach_ppc64)
25ba3a68
JM
4303#define POWERPC_FLAG_970GX (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
4304 POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
a750fc0b 4305
2f462816
JM
4306static int check_pow_970GX (CPUPPCState *env)
4307{
4308 if (env->spr[SPR_HID0] & 0x00600000)
4309 return 1;
4310
4311 return 0;
4312}
4313
a750fc0b
JM
4314static void init_proc_970GX (CPUPPCState *env)
4315{
4316 gen_spr_ne_601(env);
4317 gen_spr_7xx(env);
4318 /* Time base */
4319 gen_tbl(env);
4320 /* Hardware implementation registers */
4321 /* XXX : not implemented */
4322 spr_register(env, SPR_HID0, "HID0",
4323 SPR_NOACCESS, SPR_NOACCESS,
06403421 4324 &spr_read_generic, &spr_write_clear,
d63001d1 4325 0x60000000);
a750fc0b
JM
4326 /* XXX : not implemented */
4327 spr_register(env, SPR_HID1, "HID1",
4328 SPR_NOACCESS, SPR_NOACCESS,
4329 &spr_read_generic, &spr_write_generic,
4330 0x00000000);
4331 /* XXX : not implemented */
4332 spr_register(env, SPR_750_HID2, "HID2",
4333 SPR_NOACCESS, SPR_NOACCESS,
4334 &spr_read_generic, &spr_write_generic,
4335 0x00000000);
d63001d1
JM
4336 /* XXX : not implemented */
4337 spr_register(env, SPR_970_HID5, "HID5",
4338 SPR_NOACCESS, SPR_NOACCESS,
4339 &spr_read_generic, &spr_write_generic,
417bf010 4340 POWERPC970_HID5_INIT);
a750fc0b
JM
4341 /* Memory management */
4342 /* XXX: not correct */
4343 gen_low_BATs(env);
12de9a39
JM
4344 /* XXX : not implemented */
4345 spr_register(env, SPR_MMUCFG, "MMUCFG",
4346 SPR_NOACCESS, SPR_NOACCESS,
4347 &spr_read_generic, SPR_NOACCESS,
4348 0x00000000); /* TOFIX */
4349 /* XXX : not implemented */
4350 spr_register(env, SPR_MMUCSR0, "MMUCSR0",
4351 SPR_NOACCESS, SPR_NOACCESS,
4352 &spr_read_generic, &spr_write_generic,
4353 0x00000000); /* TOFIX */
4354 spr_register(env, SPR_HIOR, "SPR_HIOR",
4355 SPR_NOACCESS, SPR_NOACCESS,
4356 &spr_read_generic, &spr_write_generic,
4357 0xFFF00000); /* XXX: This is a hack */
f2e63a42 4358#if !defined(CONFIG_USER_ONLY)
12de9a39 4359 env->slb_nr = 32;
f2e63a42 4360#endif
e1833e1f 4361 init_excp_970(env);
d63001d1
JM
4362 env->dcache_line_size = 128;
4363 env->icache_line_size = 128;
a750fc0b
JM
4364 /* Allocate hardware IRQ controller */
4365 ppc970_irq_init(env);
4366}
a750fc0b 4367
2f462816
JM
4368/* PowerPC 970 MP */
4369#define POWERPC_INSNS_970MP (POWERPC_INSNS_WORK64 | PPC_FLOAT_FSQRT | \
4370 PPC_64B | PPC_ALTIVEC | \
4371 PPC_SEGMENT_64B | PPC_SLBI)
4372#define POWERPC_MSRM_970MP (0x900000000204FF36ULL)
4373#define POWERPC_MMU_970MP (POWERPC_MMU_64B)
4374#define POWERPC_EXCP_970MP (POWERPC_EXCP_970)
4375#define POWERPC_INPUT_970MP (PPC_FLAGS_INPUT_970)
4376#define POWERPC_BFDM_970MP (bfd_mach_ppc64)
4377#define POWERPC_FLAG_970MP (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
4378 POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
4379
4380static int check_pow_970MP (CPUPPCState *env)
4381{
4382 if (env->spr[SPR_HID0] & 0x01C00000)
4383 return 1;
4384
4385 return 0;
4386}
4387
4388static void init_proc_970MP (CPUPPCState *env)
4389{
4390 gen_spr_ne_601(env);
4391 gen_spr_7xx(env);
4392 /* Time base */
4393 gen_tbl(env);
4394 /* Hardware implementation registers */
4395 /* XXX : not implemented */
4396 spr_register(env, SPR_HID0, "HID0",
4397 SPR_NOACCESS, SPR_NOACCESS,
4398 &spr_read_generic, &spr_write_clear,
4399 0x60000000);
4400 /* XXX : not implemented */
4401 spr_register(env, SPR_HID1, "HID1",
4402 SPR_NOACCESS, SPR_NOACCESS,
4403 &spr_read_generic, &spr_write_generic,
4404 0x00000000);
4405 /* XXX : not implemented */
4406 spr_register(env, SPR_750_HID2, "HID2",
4407 SPR_NOACCESS, SPR_NOACCESS,
4408 &spr_read_generic, &spr_write_generic,
4409 0x00000000);
4410 /* XXX : not implemented */
4411 spr_register(env, SPR_970_HID5, "HID5",
4412 SPR_NOACCESS, SPR_NOACCESS,
4413 &spr_read_generic, &spr_write_generic,
4414 POWERPC970_HID5_INIT);
4415 /* Memory management */
4416 /* XXX: not correct */
4417 gen_low_BATs(env);
4418 /* XXX : not implemented */
4419 spr_register(env, SPR_MMUCFG, "MMUCFG",
4420 SPR_NOACCESS, SPR_NOACCESS,
4421 &spr_read_generic, SPR_NOACCESS,
4422 0x00000000); /* TOFIX */
4423 /* XXX : not implemented */
4424 spr_register(env, SPR_MMUCSR0, "MMUCSR0",
4425 SPR_NOACCESS, SPR_NOACCESS,
4426 &spr_read_generic, &spr_write_generic,
4427 0x00000000); /* TOFIX */
4428 spr_register(env, SPR_HIOR, "SPR_HIOR",
4429 SPR_NOACCESS, SPR_NOACCESS,
4430 &spr_read_generic, &spr_write_generic,
4431 0xFFF00000); /* XXX: This is a hack */
2f462816
JM
4432#if !defined(CONFIG_USER_ONLY)
4433 env->slb_nr = 32;
4434#endif
4435 init_excp_970(env);
4436 env->dcache_line_size = 128;
4437 env->icache_line_size = 128;
4438 /* Allocate hardware IRQ controller */
4439 ppc970_irq_init(env);
4440}
4441
a750fc0b 4442/* PowerPC 620 */
a750fc0b
JM
4443#define POWERPC_INSNS_620 (POWERPC_INSNS_WORKS | PPC_FLOAT_FSQRT | \
4444 PPC_64B | PPC_SLBI)
4445#define POWERPC_MSRM_620 (0x800000000005FF73ULL)
4446#define POWERPC_MMU_620 (POWERPC_MMU_64B)
4447#define POWERPC_EXCP_620 (POWERPC_EXCP_970)
faadf50e 4448#define POWERPC_INPUT_620 (PPC_FLAGS_INPUT_6xx)
237c0af0 4449#define POWERPC_BFDM_620 (bfd_mach_ppc64)
25ba3a68 4450#define POWERPC_FLAG_620 (POWERPC_FLAG_SE | POWERPC_FLAG_BE)
2f462816 4451#define check_pow_620 check_pow_nocheck /* Check this */
a750fc0b 4452
578bb252 4453__attribute__ (( unused ))
a750fc0b
JM
4454static void init_proc_620 (CPUPPCState *env)
4455{
4456 gen_spr_ne_601(env);
4457 gen_spr_620(env);
4458 /* Time base */
4459 gen_tbl(env);
4460 /* Hardware implementation registers */
4461 /* XXX : not implemented */
4462 spr_register(env, SPR_HID0, "HID0",
4463 SPR_NOACCESS, SPR_NOACCESS,
4464 &spr_read_generic, &spr_write_generic,
4465 0x00000000);
4466 /* Memory management */
4467 gen_low_BATs(env);
4468 gen_high_BATs(env);
e1833e1f 4469 init_excp_620(env);
d63001d1
JM
4470 env->dcache_line_size = 64;
4471 env->icache_line_size = 64;
faadf50e
JM
4472 /* Allocate hardware IRQ controller */
4473 ppc6xx_irq_init(env);
a750fc0b 4474}
a750fc0b
JM
4475#endif /* defined (TARGET_PPC64) */
4476
4477/* Default 32 bits PowerPC target will be 604 */
4478#define CPU_POWERPC_PPC32 CPU_POWERPC_604
4479#define POWERPC_INSNS_PPC32 POWERPC_INSNS_604
4480#define POWERPC_MSRM_PPC32 POWERPC_MSRM_604
4481#define POWERPC_MMU_PPC32 POWERPC_MMU_604
4482#define POWERPC_EXCP_PPC32 POWERPC_EXCP_604
4483#define POWERPC_INPUT_PPC32 POWERPC_INPUT_604
237c0af0 4484#define POWERPC_BFDM_PPC32 POWERPC_BFDM_604
d26bfc9a 4485#define POWERPC_FLAG_PPC32 POWERPC_FLAG_604
2f462816
JM
4486#define check_pow_PPC32 check_pow_604
4487#define init_proc_PPC32 init_proc_604
a750fc0b
JM
4488
4489/* Default 64 bits PowerPC target will be 970 FX */
4490#define CPU_POWERPC_PPC64 CPU_POWERPC_970FX
4491#define POWERPC_INSNS_PPC64 POWERPC_INSNS_970FX
4492#define POWERPC_MSRM_PPC64 POWERPC_MSRM_970FX
4493#define POWERPC_MMU_PPC64 POWERPC_MMU_970FX
4494#define POWERPC_EXCP_PPC64 POWERPC_EXCP_970FX
4495#define POWERPC_INPUT_PPC64 POWERPC_INPUT_970FX
237c0af0 4496#define POWERPC_BFDM_PPC64 POWERPC_BFDM_970FX
d26bfc9a 4497#define POWERPC_FLAG_PPC64 POWERPC_FLAG_970FX
2f462816
JM
4498#define check_pow_PPC64 check_pow_970FX
4499#define init_proc_PPC64 init_proc_970FX
a750fc0b
JM
4500
4501/* Default PowerPC target will be PowerPC 32 */
4502#if defined (TARGET_PPC64) && 0 // XXX: TODO
d12f4c38
JM
4503#define CPU_POWERPC_DEFAULT CPU_POWERPC_PPC64
4504#define POWERPC_INSNS_DEFAULT POWERPC_INSNS_PPC64
4505#define POWERPC_MSRM_DEFAULT POWERPC_MSRM_PPC64
4506#define POWERPC_MMU_DEFAULT POWERPC_MMU_PPC64
4507#define POWERPC_EXCP_DEFAULT POWERPC_EXCP_PPC64
4508#define POWERPC_INPUT_DEFAULT POWERPC_INPUT_PPC64
237c0af0 4509#define POWERPC_BFDM_DEFAULT POWERPC_BFDM_PPC64
d26bfc9a 4510#define POWERPC_FLAG_DEFAULT POWERPC_FLAG_PPC64
2f462816
JM
4511#define check_pow_DEFAULT check_pow_PPC64
4512#define init_proc_DEFAULT init_proc_PPC64
a750fc0b 4513#else
d12f4c38
JM
4514#define CPU_POWERPC_DEFAULT CPU_POWERPC_PPC32
4515#define POWERPC_INSNS_DEFAULT POWERPC_INSNS_PPC32
4516#define POWERPC_MSRM_DEFAULT POWERPC_MSRM_PPC32
4517#define POWERPC_MMU_DEFAULT POWERPC_MMU_PPC32
4518#define POWERPC_EXCP_DEFAULT POWERPC_EXCP_PPC32
4519#define POWERPC_INPUT_DEFAULT POWERPC_INPUT_PPC32
237c0af0 4520#define POWERPC_BFDM_DEFAULT POWERPC_BFDM_PPC32
d26bfc9a 4521#define POWERPC_FLAG_DEFAULT POWERPC_FLAG_PPC32
2f462816
JM
4522#define check_pow_DEFAULT check_pow_PPC32
4523#define init_proc_DEFAULT init_proc_PPC32
a750fc0b
JM
4524#endif
4525
4526/*****************************************************************************/
4527/* PVR definitions for most known PowerPC */
4528enum {
4529 /* PowerPC 401 family */
4530 /* Generic PowerPC 401 */
4531#define CPU_POWERPC_401 CPU_POWERPC_401G2
4532 /* PowerPC 401 cores */
4533 CPU_POWERPC_401A1 = 0x00210000,
4534 CPU_POWERPC_401B2 = 0x00220000,
4535#if 0
4536 CPU_POWERPC_401B3 = xxx,
4537#endif
4538 CPU_POWERPC_401C2 = 0x00230000,
4539 CPU_POWERPC_401D2 = 0x00240000,
4540 CPU_POWERPC_401E2 = 0x00250000,
4541 CPU_POWERPC_401F2 = 0x00260000,
4542 CPU_POWERPC_401G2 = 0x00270000,
4543 /* PowerPC 401 microcontrolers */
4544#if 0
4545 CPU_POWERPC_401GF = xxx,
4546#endif
4547#define CPU_POWERPC_IOP480 CPU_POWERPC_401B2
4548 /* IBM Processor for Network Resources */
4549 CPU_POWERPC_COBRA = 0x10100000, /* XXX: 405 ? */
4550#if 0
4551 CPU_POWERPC_XIPCHIP = xxx,
4552#endif
4553 /* PowerPC 403 family */
4554 /* Generic PowerPC 403 */
4555#define CPU_POWERPC_403 CPU_POWERPC_403GC
4556 /* PowerPC 403 microcontrollers */
4557 CPU_POWERPC_403GA = 0x00200011,
4558 CPU_POWERPC_403GB = 0x00200100,
4559 CPU_POWERPC_403GC = 0x00200200,
4560 CPU_POWERPC_403GCX = 0x00201400,
4561#if 0
4562 CPU_POWERPC_403GP = xxx,
4563#endif
4564 /* PowerPC 405 family */
4565 /* Generic PowerPC 405 */
4566#define CPU_POWERPC_405 CPU_POWERPC_405D4
4567 /* PowerPC 405 cores */
4568#if 0
4569 CPU_POWERPC_405A3 = xxx,
4570#endif
4571#if 0
4572 CPU_POWERPC_405A4 = xxx,
4573#endif
4574#if 0
4575 CPU_POWERPC_405B3 = xxx,
4576#endif
4577#if 0
4578 CPU_POWERPC_405B4 = xxx,
4579#endif
4580#if 0
4581 CPU_POWERPC_405C3 = xxx,
4582#endif
4583#if 0
4584 CPU_POWERPC_405C4 = xxx,
4585#endif
4586 CPU_POWERPC_405D2 = 0x20010000,
4587#if 0
4588 CPU_POWERPC_405D3 = xxx,
4589#endif
4590 CPU_POWERPC_405D4 = 0x41810000,
4591#if 0
4592 CPU_POWERPC_405D5 = xxx,
4593#endif
4594#if 0
4595 CPU_POWERPC_405E4 = xxx,
4596#endif
4597#if 0
4598 CPU_POWERPC_405F4 = xxx,
4599#endif
4600#if 0
4601 CPU_POWERPC_405F5 = xxx,
4602#endif
4603#if 0
4604 CPU_POWERPC_405F6 = xxx,
4605#endif
4606 /* PowerPC 405 microcontrolers */
4607 /* XXX: missing 0x200108a0 */
4608#define CPU_POWERPC_405CR CPU_POWERPC_405CRc
4609 CPU_POWERPC_405CRa = 0x40110041,
4610 CPU_POWERPC_405CRb = 0x401100C5,
4611 CPU_POWERPC_405CRc = 0x40110145,
4612 CPU_POWERPC_405EP = 0x51210950,
4613#if 0
4614 CPU_POWERPC_405EXr = xxx,
4615#endif
4616 CPU_POWERPC_405EZ = 0x41511460, /* 0x51210950 ? */
4617#if 0
4618 CPU_POWERPC_405FX = xxx,
4619#endif
4620#define CPU_POWERPC_405GP CPU_POWERPC_405GPd
4621 CPU_POWERPC_405GPa = 0x40110000,
4622 CPU_POWERPC_405GPb = 0x40110040,
4623 CPU_POWERPC_405GPc = 0x40110082,
4624 CPU_POWERPC_405GPd = 0x401100C4,
4625#define CPU_POWERPC_405GPe CPU_POWERPC_405CRc
4626 CPU_POWERPC_405GPR = 0x50910951,
4627#if 0
4628 CPU_POWERPC_405H = xxx,
4629#endif
4630#if 0
4631 CPU_POWERPC_405L = xxx,
4632#endif
4633 CPU_POWERPC_405LP = 0x41F10000,
4634#if 0
4635 CPU_POWERPC_405PM = xxx,
4636#endif
4637#if 0
4638 CPU_POWERPC_405PS = xxx,
4639#endif
4640#if 0
4641 CPU_POWERPC_405S = xxx,
4642#endif
4643 /* IBM network processors */
4644 CPU_POWERPC_NPE405H = 0x414100C0,
4645 CPU_POWERPC_NPE405H2 = 0x41410140,
4646 CPU_POWERPC_NPE405L = 0x416100C0,
4647 CPU_POWERPC_NPE4GS3 = 0x40B10000,
4648#if 0
4649 CPU_POWERPC_NPCxx1 = xxx,
4650#endif
4651#if 0
4652 CPU_POWERPC_NPR161 = xxx,
4653#endif
4654#if 0
4655 CPU_POWERPC_LC77700 = xxx,
4656#endif
4657 /* IBM STBxxx (PowerPC 401/403/405 core based microcontrollers) */
4658#if 0
4659 CPU_POWERPC_STB01000 = xxx,
4660#endif
4661#if 0
4662 CPU_POWERPC_STB01010 = xxx,
4663#endif
4664#if 0
4665 CPU_POWERPC_STB0210 = xxx, /* 401B3 */
4666#endif
4667 CPU_POWERPC_STB03 = 0x40310000, /* 0x40130000 ? */
4668#if 0
4669 CPU_POWERPC_STB043 = xxx,
4670#endif
4671#if 0
4672 CPU_POWERPC_STB045 = xxx,
4673#endif
4674 CPU_POWERPC_STB04 = 0x41810000,
4675 CPU_POWERPC_STB25 = 0x51510950,
4676#if 0
4677 CPU_POWERPC_STB130 = xxx,
4678#endif
4679 /* Xilinx cores */
4680 CPU_POWERPC_X2VP4 = 0x20010820,
4681#define CPU_POWERPC_X2VP7 CPU_POWERPC_X2VP4
4682 CPU_POWERPC_X2VP20 = 0x20010860,
4683#define CPU_POWERPC_X2VP50 CPU_POWERPC_X2VP20
4684#if 0
4685 CPU_POWERPC_ZL10310 = xxx,
4686#endif
4687#if 0
4688 CPU_POWERPC_ZL10311 = xxx,
4689#endif
4690#if 0
4691 CPU_POWERPC_ZL10320 = xxx,
4692#endif
4693#if 0
4694 CPU_POWERPC_ZL10321 = xxx,
4695#endif
4696 /* PowerPC 440 family */
4697 /* Generic PowerPC 440 */
4698#define CPU_POWERPC_440 CPU_POWERPC_440GXf
4699 /* PowerPC 440 cores */
4700#if 0
4701 CPU_POWERPC_440A4 = xxx,
4702#endif
4703#if 0
4704 CPU_POWERPC_440A5 = xxx,
4705#endif
4706#if 0
4707 CPU_POWERPC_440B4 = xxx,
4708#endif
4709#if 0
4710 CPU_POWERPC_440F5 = xxx,
4711#endif
4712#if 0
4713 CPU_POWERPC_440G5 = xxx,
4714#endif
4715#if 0
4716 CPU_POWERPC_440H4 = xxx,
4717#endif
4718#if 0
4719 CPU_POWERPC_440H6 = xxx,
4720#endif
4721 /* PowerPC 440 microcontrolers */
4722#define CPU_POWERPC_440EP CPU_POWERPC_440EPb
4723 CPU_POWERPC_440EPa = 0x42221850,
4724 CPU_POWERPC_440EPb = 0x422218D3,
4725#define CPU_POWERPC_440GP CPU_POWERPC_440GPc
4726 CPU_POWERPC_440GPb = 0x40120440,
4727 CPU_POWERPC_440GPc = 0x40120481,
4728#define CPU_POWERPC_440GR CPU_POWERPC_440GRa
4729#define CPU_POWERPC_440GRa CPU_POWERPC_440EPb
4730 CPU_POWERPC_440GRX = 0x200008D0,
4731#define CPU_POWERPC_440EPX CPU_POWERPC_440GRX
4732#define CPU_POWERPC_440GX CPU_POWERPC_440GXf
4733 CPU_POWERPC_440GXa = 0x51B21850,
4734 CPU_POWERPC_440GXb = 0x51B21851,
4735 CPU_POWERPC_440GXc = 0x51B21892,
4736 CPU_POWERPC_440GXf = 0x51B21894,
4737#if 0
4738 CPU_POWERPC_440S = xxx,
4739#endif
4740 CPU_POWERPC_440SP = 0x53221850,
4741 CPU_POWERPC_440SP2 = 0x53221891,
4742 CPU_POWERPC_440SPE = 0x53421890,
4743 /* PowerPC 460 family */
4744#if 0
4745 /* Generic PowerPC 464 */
4746#define CPU_POWERPC_464 CPU_POWERPC_464H90
4747#endif
4748 /* PowerPC 464 microcontrolers */
4749#if 0
4750 CPU_POWERPC_464H90 = xxx,
4751#endif
4752#if 0
4753 CPU_POWERPC_464H90FP = xxx,
4754#endif
4755 /* Freescale embedded PowerPC cores */
c3e36823
JM
4756 /* PowerPC MPC 5xx cores (aka RCPU) */
4757 CPU_POWERPC_5xx = 0x00020020,
4758#define CPU_POWERPC_509 CPU_POWERPC_5xx
4759#define CPU_POWERPC_533 CPU_POWERPC_5xx
4760#define CPU_POWERPC_534 CPU_POWERPC_5xx
4761#define CPU_POWERPC_555 CPU_POWERPC_5xx
4762#define CPU_POWERPC_556 CPU_POWERPC_5xx
4763#define CPU_POWERPC_560 CPU_POWERPC_5xx
4764#define CPU_POWERPC_561 CPU_POWERPC_5xx
4765#define CPU_POWERPC_562 CPU_POWERPC_5xx
4766#define CPU_POWERPC_563 CPU_POWERPC_5xx
4767#define CPU_POWERPC_564 CPU_POWERPC_5xx
4768#define CPU_POWERPC_565 CPU_POWERPC_5xx
4769#define CPU_POWERPC_566 CPU_POWERPC_5xx
4770 /* PowerPC MPC 8xx cores (aka PowerQUICC) */
4771 CPU_POWERPC_8xx = 0x00500000,
4772#define CPU_POWERPC_821 CPU_POWERPC_8xx
4773#define CPU_POWERPC_823 CPU_POWERPC_8xx
4774#define CPU_POWERPC_850 CPU_POWERPC_8xx
4775#define CPU_POWERPC_852T CPU_POWERPC_8xx
4776#define CPU_POWERPC_855T CPU_POWERPC_8xx
4777#define CPU_POWERPC_859 CPU_POWERPC_8xx
4778#define CPU_POWERPC_860 CPU_POWERPC_8xx
4779#define CPU_POWERPC_862 CPU_POWERPC_8xx
4780#define CPU_POWERPC_866 CPU_POWERPC_8xx
4781#define CPU_POWERPC_857 CPU_POWERPC_8xx
4782#define CPU_POWERPC_870 CPU_POWERPC_8xx
4783#define CPU_POWERPC_875 CPU_POWERPC_8xx
4784#define CPU_POWERPC_880 CPU_POWERPC_8xx
4785#define CPU_POWERPC_885 CPU_POWERPC_8xx
4786 /* G2 cores (aka PowerQUICC-II) */
4787 CPU_POWERPC_G2 = 0x00810011,
4788 CPU_POWERPC_G2H4 = 0x80811010,
4789 CPU_POWERPC_G2gp = 0x80821010,
4790 CPU_POWERPC_G2ls = 0x90810010,
4791 CPU_POWERPC_MPC603 = 0x00810100,
4792#define CPU_POWERPC_MPC8240 CPU_POWERPC_MPC603
4793 CPU_POWERPC_G2_HIP3 = 0x00810101,
4794#define CPU_POWERPC_MPC8250_HiP3 CPU_POWERPC_G2_HIP3
4795#define CPU_POWERPC_MPC8255_HiP3 CPU_POWERPC_G2_HIP3
4796#define CPU_POWERPC_MPC8260_HiP3 CPU_POWERPC_G2_HIP3
4797#define CPU_POWERPC_MPC8264_HiP3 CPU_POWERPC_G2_HIP3
4798#define CPU_POWERPC_MPC8265_HiP3 CPU_POWERPC_G2_HIP3
4799#define CPU_POWERPC_MPC8266_HiP3 CPU_POWERPC_G2_HIP3
4800 CPU_POWERPC_G2_HIP4 = 0x80811014,
4801#define CPU_POWERPC_MPC8241 CPU_POWERPC_G2_HIP4
4802#define CPU_POWERPC_MPC8245 CPU_POWERPC_G2_HIP4
4803#define CPU_POWERPC_MPC8250_HiP4 CPU_POWERPC_G2_HIP4
4804#define CPU_POWERPC_MPC8255_HiP4 CPU_POWERPC_G2_HIP4
4805#define CPU_POWERPC_MPC8260_HiP4 CPU_POWERPC_G2_HIP4
4806#define CPU_POWERPC_MPC8264_HiP4 CPU_POWERPC_G2_HIP4
4807#define CPU_POWERPC_MPC8265_HiP4 CPU_POWERPC_G2_HIP4
4808#define CPU_POWERPC_MPC8266_HiP4 CPU_POWERPC_G2_HIP4
4809 /* G2_LE core (aka PowerQUICC-II) */
4810 CPU_POWERPC_G2LE = 0x80820010,
4811 CPU_POWERPC_G2LEgp = 0x80822010,
4812 CPU_POWERPC_G2LEls = 0xA0822010,
4813 CPU_POWERPC_G2LEgp1 = 0x80822011,
4814 /* XXX: MPC 5121 ? */
4815#define CPU_POWERPC_MPC5200 CPU_POWERPC_G2LEgp1
4816 CPU_POWERPC_G2LEgp3 = 0x80822013,
4817#define CPU_POWERPC_MPC8247 CPU_POWERPC_G2LEgp3
4818#define CPU_POWERPC_MPC8248 CPU_POWERPC_G2LEgp3
4819#define CPU_POWERPC_MPC8270 CPU_POWERPC_G2LEgp3
4820#define CPU_POWERPC_MPC8271 CPU_POWERPC_G2LEgp3
4821#define CPU_POWERPC_MPC8272 CPU_POWERPC_G2LEgp3
4822#define CPU_POWERPC_MPC8275 CPU_POWERPC_G2LEgp3
4823#define CPU_POWERPC_MPC8280 CPU_POWERPC_G2LEgp3
a750fc0b
JM
4824 /* e200 family */
4825#define CPU_POWERPC_e200 CPU_POWERPC_e200z6
4826#if 0
4827 CPU_POWERPC_e200z0 = xxx,
c3e36823
JM
4828#define CPU_POWERPC_MPC5514E_v0 CPU_POWERPC_e200z0
4829#define CPU_POWERPC_MPC5514G_v0 CPU_POWERPC_e200z0
4830#define CPU_POWERPC_MPC5516E_v0 CPU_POWERPC_e200z0
4831#define CPU_POWERPC_MPC5516G_v0 CPU_POWERPC_e200z0
a750fc0b
JM
4832#endif
4833#if 0
c3e36823
JM
4834 CPU_POWERPC_e200z1 = xxx,
4835#define CPU_POWERPC_MPC5514E_v1 CPU_POWERPC_e200z1
4836#define CPU_POWERPC_MPC5514G_v1 CPU_POWERPC_e200z1
4837#define CPU_POWERPC_MPC5515S CPU_POWERPC_e200z1
4838#define CPU_POWERPC_MPC5516E_v1 CPU_POWERPC_e200z1
4839#define CPU_POWERPC_MPC5516G_v1 CPU_POWERPC_e200z1
4840#define CPU_POWERPC_MPC5516S CPU_POWERPC_e200z1
4841#endif
4842#if 0 /* ? */
4843 CPU_POWERPC_e200z3 = 0x81120000,
4844#define CPU_POWERPC_MPC5533 CPU_POWERPC_e200z3
4845#define CPU_POWERPC_MPC5534 CPU_POWERPC_e200z3
a750fc0b
JM
4846#endif
4847 CPU_POWERPC_e200z5 = 0x81000000,
4848 CPU_POWERPC_e200z6 = 0x81120000,
c3e36823
JM
4849#define CPU_POWERPC_MPC5553 CPU_POWERPC_e200z6
4850#define CPU_POWERPC_MPC5554 CPU_POWERPC_e200z6
4851#define CPU_POWERPC_MPC5561 CPU_POWERPC_e200z6
4852#define CPU_POWERPC_MPC5565 CPU_POWERPC_e200z6
4853#define CPU_POWERPC_MPC5566 CPU_POWERPC_e200z6
4854#define CPU_POWERPC_MPC5567 CPU_POWERPC_e200z6
a750fc0b
JM
4855 /* e300 family */
4856#define CPU_POWERPC_e300 CPU_POWERPC_e300c3
4857 CPU_POWERPC_e300c1 = 0x00830000,
c3e36823
JM
4858#define CPU_POWERPC_MPC8343A CPU_POWERPC_e300c1
4859#define CPU_POWERPC_MPC8343EA CPU_POWERPC_e300c1
4860#define CPU_POWERPC_MPC8347A CPU_POWERPC_e300c1
4861#define CPU_POWERPC_MPC8347EA CPU_POWERPC_e300c1
4862#define CPU_POWERPC_MPC8349 CPU_POWERPC_e300c1
4863#define CPU_POWERPC_MPC8349E CPU_POWERPC_e300c1
4864#define CPU_POWERPC_MPC8358E CPU_POWERPC_e300c1
4865#define CPU_POWERPC_MPC8360E CPU_POWERPC_e300c1
a750fc0b 4866 CPU_POWERPC_e300c2 = 0x00840000,
c3e36823
JM
4867#define CPU_POWERPC_MPC8321 CPU_POWERPC_e300c2
4868#define CPU_POWERPC_MPC8321E CPU_POWERPC_e300c2
4869#define CPU_POWERPC_MPC8323 CPU_POWERPC_e300c2
4870#define CPU_POWERPC_MPC8323E CPU_POWERPC_e300c2
a750fc0b 4871 CPU_POWERPC_e300c3 = 0x00850000,
c3e36823
JM
4872#define CPU_POWERPC_MPC8313 CPU_POWERPC_e300c3
4873#define CPU_POWERPC_MPC8313E CPU_POWERPC_e300c3
4874#define CPU_POWERPC_MPC8314 CPU_POWERPC_e300c3
4875#define CPU_POWERPC_MPC8314E CPU_POWERPC_e300c3
4876#define CPU_POWERPC_MPC8315 CPU_POWERPC_e300c3
4877#define CPU_POWERPC_MPC8315E CPU_POWERPC_e300c3
4878 CPU_POWERPC_e300c4 = 0x00860000,
4879#define CPU_POWERPC_MPC8377 CPU_POWERPC_e300c4
4880#define CPU_POWERPC_MPC8377E CPU_POWERPC_e300c4
4881#define CPU_POWERPC_MPC8378 CPU_POWERPC_e300c4
4882#define CPU_POWERPC_MPC8378E CPU_POWERPC_e300c4
4883#define CPU_POWERPC_MPC8379 CPU_POWERPC_e300c4
4884#define CPU_POWERPC_MPC8379E CPU_POWERPC_e300c4
a750fc0b
JM
4885 /* e500 family */
4886#define CPU_POWERPC_e500 CPU_POWERPC_e500_v22
c3e36823
JM
4887 CPU_POWERPC_e500_v10 = 0x80200010,
4888#define CPU_POWERPC_MPC8540_v1 CPU_POWERPC_e500_v10
4889 CPU_POWERPC_e500_v20 = 0x80200020,
4890#define CPU_POWERPC_MPC8540_v2 CPU_POWERPC_e500_v20
4891#define CPU_POWERPC_MPC8541 CPU_POWERPC_e500_v20
4892#define CPU_POWERPC_MPC8541E CPU_POWERPC_e500_v20
4893#define CPU_POWERPC_MPC8555 CPU_POWERPC_e500_v20
4894#define CPU_POWERPC_MPC8555E CPU_POWERPC_e500_v20
4895#define CPU_POWERPC_MPC8560 CPU_POWERPC_e500_v20
4896 CPU_POWERPC_e500v2_v10 = 0x80210010,
4897#define CPU_POWERPC_MPC8543 CPU_POWERPC_e500v2_v10
4898#define CPU_POWERPC_MPC8543E CPU_POWERPC_e500v2_v10
4899#define CPU_POWERPC_MPC8545 CPU_POWERPC_e500v2_v10
4900#define CPU_POWERPC_MPC8545E CPU_POWERPC_e500v2_v10
4901#define CPU_POWERPC_MPC8547E CPU_POWERPC_e500v2_v10
4902#define CPU_POWERPC_MPC8548 CPU_POWERPC_e500v2_v10
4903#define CPU_POWERPC_MPC8548E CPU_POWERPC_e500v2_v10
4904 CPU_POWERPC_e500v2_v20 = 0x80210020,
4905 CPU_POWERPC_e500v2_v21 = 0x80210021,
4906#define CPU_POWERPC_MPC8533_v10 CPU_POWERPC_e500v2_v21
4907#define CPU_POWERPC_MPC8533E_v10 CPU_POWERPC_e500v2_v21
4908#define CPU_POWERPC_MPC8544_v10 CPU_POWERPC_e500v2_v21
4909#define CPU_POWERPC_MPC8544E_v10 CPU_POWERPC_e500v2_v21
4910 CPU_POWERPC_e500v2_v22 = 0x80210022,
4911#define CPU_POWERPC_MPC8533_v11 CPU_POWERPC_e500v2_v22
4912#define CPU_POWERPC_MPC8533E_v11 CPU_POWERPC_e500v2_v22
4913#define CPU_POWERPC_MPC8544_v11 CPU_POWERPC_e500v2_v22
4914#define CPU_POWERPC_MPC8544E_v11 CPU_POWERPC_e500v2_v22
4915#define CPU_POWERPC_MPC8567 CPU_POWERPC_e500v2_v22
4916#define CPU_POWERPC_MPC8568 CPU_POWERPC_e500v2_v22
4917 CPU_POWERPC_e500v2_v30 = 0x80210030,
4918#define CPU_POWERPC_MPC8572 CPU_POWERPC_e500v2_v30
a750fc0b
JM
4919 /* e600 family */
4920 CPU_POWERPC_e600 = 0x80040010,
c3e36823
JM
4921#define CPU_POWERPC_MPC8610 CPU_POWERPC_e600
4922#define CPU_POWERPC_MPC8641 CPU_POWERPC_e600
4923#define CPU_POWERPC_MPC8641D CPU_POWERPC_e600
a750fc0b 4924 /* PowerPC 6xx cores */
c3e36823
JM
4925#define CPU_POWERPC_601 CPU_POWERPC_601_v2
4926 CPU_POWERPC_601_v0 = 0x00010001,
4927 CPU_POWERPC_601_v1 = 0x00010001,
4928 CPU_POWERPC_601_v2 = 0x00010002,
a750fc0b
JM
4929 CPU_POWERPC_602 = 0x00050100,
4930 CPU_POWERPC_603 = 0x00030100,
4931#define CPU_POWERPC_603E CPU_POWERPC_603E_v41
4932 CPU_POWERPC_603E_v11 = 0x00060101,
4933 CPU_POWERPC_603E_v12 = 0x00060102,
4934 CPU_POWERPC_603E_v13 = 0x00060103,
4935 CPU_POWERPC_603E_v14 = 0x00060104,
4936 CPU_POWERPC_603E_v22 = 0x00060202,
4937 CPU_POWERPC_603E_v3 = 0x00060300,
4938 CPU_POWERPC_603E_v4 = 0x00060400,
4939 CPU_POWERPC_603E_v41 = 0x00060401,
4940 CPU_POWERPC_603E7t = 0x00071201,
4941 CPU_POWERPC_603E7v = 0x00070100,
4942 CPU_POWERPC_603E7v1 = 0x00070101,
4943 CPU_POWERPC_603E7v2 = 0x00070201,
4944 CPU_POWERPC_603E7 = 0x00070200,
4945 CPU_POWERPC_603P = 0x00070000,
4946#define CPU_POWERPC_603R CPU_POWERPC_603E7t
c3e36823 4947 /* XXX: missing 0x00040303 (604) */
a750fc0b
JM
4948 CPU_POWERPC_604 = 0x00040103,
4949#define CPU_POWERPC_604E CPU_POWERPC_604E_v24
c3e36823
JM
4950 /* XXX: missing 0x00091203 */
4951 /* XXX: missing 0x00092110 */
4952 /* XXX: missing 0x00092120 */
4953 CPU_POWERPC_604E_v10 = 0x00090100,
a750fc0b
JM
4954 CPU_POWERPC_604E_v22 = 0x00090202,
4955 CPU_POWERPC_604E_v24 = 0x00090204,
c3e36823
JM
4956 /* XXX: missing 0x000a0100 */
4957 /* XXX: missing 0x00093102 */
4958 CPU_POWERPC_604R = 0x000a0101,
a750fc0b 4959#if 0
c3e36823 4960 CPU_POWERPC_604EV = xxx, /* XXX: same as 604R ? */
a750fc0b
JM
4961#endif
4962 /* PowerPC 740/750 cores (aka G3) */
4963 /* XXX: missing 0x00084202 */
4964#define CPU_POWERPC_7x0 CPU_POWERPC_7x0_v31
4965 CPU_POWERPC_7x0_v20 = 0x00080200,
4966 CPU_POWERPC_7x0_v21 = 0x00080201,
4967 CPU_POWERPC_7x0_v22 = 0x00080202,
4968 CPU_POWERPC_7x0_v30 = 0x00080300,
4969 CPU_POWERPC_7x0_v31 = 0x00080301,
4970 CPU_POWERPC_740E = 0x00080100,
4971 CPU_POWERPC_7x0P = 0x10080000,
4972 /* XXX: missing 0x00087010 (CL ?) */
4973 CPU_POWERPC_750CL = 0x00087200,
4974#define CPU_POWERPC_750CX CPU_POWERPC_750CX_v22
4975 CPU_POWERPC_750CX_v21 = 0x00082201,
4976 CPU_POWERPC_750CX_v22 = 0x00082202,
4977#define CPU_POWERPC_750CXE CPU_POWERPC_750CXE_v31b
4978 CPU_POWERPC_750CXE_v21 = 0x00082211,
4979 CPU_POWERPC_750CXE_v22 = 0x00082212,
4980 CPU_POWERPC_750CXE_v23 = 0x00082213,
4981 CPU_POWERPC_750CXE_v24 = 0x00082214,
4982 CPU_POWERPC_750CXE_v24b = 0x00083214,
4983 CPU_POWERPC_750CXE_v31 = 0x00083211,
4984 CPU_POWERPC_750CXE_v31b = 0x00083311,
4985 CPU_POWERPC_750CXR = 0x00083410,
4986 CPU_POWERPC_750E = 0x00080200,
4987 CPU_POWERPC_750FL = 0x700A0203,
4988#define CPU_POWERPC_750FX CPU_POWERPC_750FX_v23
4989 CPU_POWERPC_750FX_v10 = 0x70000100,
4990 CPU_POWERPC_750FX_v20 = 0x70000200,
4991 CPU_POWERPC_750FX_v21 = 0x70000201,
4992 CPU_POWERPC_750FX_v22 = 0x70000202,
4993 CPU_POWERPC_750FX_v23 = 0x70000203,
4994 CPU_POWERPC_750GL = 0x70020102,
4995#define CPU_POWERPC_750GX CPU_POWERPC_750GX_v12
4996 CPU_POWERPC_750GX_v10 = 0x70020100,
4997 CPU_POWERPC_750GX_v11 = 0x70020101,
4998 CPU_POWERPC_750GX_v12 = 0x70020102,
4999#define CPU_POWERPC_750L CPU_POWERPC_750L_v32 /* Aka LoneStar */
5000 CPU_POWERPC_750L_v22 = 0x00088202,
5001 CPU_POWERPC_750L_v30 = 0x00088300,
5002 CPU_POWERPC_750L_v32 = 0x00088302,
5003 /* PowerPC 745/755 cores */
5004#define CPU_POWERPC_7x5 CPU_POWERPC_7x5_v28
5005 CPU_POWERPC_7x5_v10 = 0x00083100,
5006 CPU_POWERPC_7x5_v11 = 0x00083101,
5007 CPU_POWERPC_7x5_v20 = 0x00083200,
5008 CPU_POWERPC_7x5_v21 = 0x00083201,
5009 CPU_POWERPC_7x5_v22 = 0x00083202, /* aka D */
5010 CPU_POWERPC_7x5_v23 = 0x00083203, /* aka E */
5011 CPU_POWERPC_7x5_v24 = 0x00083204,
5012 CPU_POWERPC_7x5_v25 = 0x00083205,
5013 CPU_POWERPC_7x5_v26 = 0x00083206,
5014 CPU_POWERPC_7x5_v27 = 0x00083207,
5015 CPU_POWERPC_7x5_v28 = 0x00083208,
5016#if 0
5017 CPU_POWERPC_7x5P = xxx,
5018#endif
5019 /* PowerPC 74xx cores (aka G4) */
5020 /* XXX: missing 0x000C1101 */
5021#define CPU_POWERPC_7400 CPU_POWERPC_7400_v29
5022 CPU_POWERPC_7400_v10 = 0x000C0100,
5023 CPU_POWERPC_7400_v11 = 0x000C0101,
5024 CPU_POWERPC_7400_v20 = 0x000C0200,
5025 CPU_POWERPC_7400_v22 = 0x000C0202,
5026 CPU_POWERPC_7400_v26 = 0x000C0206,
5027 CPU_POWERPC_7400_v27 = 0x000C0207,
5028 CPU_POWERPC_7400_v28 = 0x000C0208,
5029 CPU_POWERPC_7400_v29 = 0x000C0209,
5030#define CPU_POWERPC_7410 CPU_POWERPC_7410_v14
5031 CPU_POWERPC_7410_v10 = 0x800C1100,
5032 CPU_POWERPC_7410_v11 = 0x800C1101,
5033 CPU_POWERPC_7410_v12 = 0x800C1102, /* aka C */
5034 CPU_POWERPC_7410_v13 = 0x800C1103, /* aka D */
5035 CPU_POWERPC_7410_v14 = 0x800C1104, /* aka E */
5036#define CPU_POWERPC_7448 CPU_POWERPC_7448_v21
5037 CPU_POWERPC_7448_v10 = 0x80040100,
5038 CPU_POWERPC_7448_v11 = 0x80040101,
5039 CPU_POWERPC_7448_v20 = 0x80040200,
5040 CPU_POWERPC_7448_v21 = 0x80040201,
5041#define CPU_POWERPC_7450 CPU_POWERPC_7450_v21
5042 CPU_POWERPC_7450_v10 = 0x80000100,
5043 CPU_POWERPC_7450_v11 = 0x80000101,
5044 CPU_POWERPC_7450_v12 = 0x80000102,
5045 CPU_POWERPC_7450_v20 = 0x80000200, /* aka D: 2.04 */
5046 CPU_POWERPC_7450_v21 = 0x80000201, /* aka E */
5047 CPU_POWERPC_74x1 = 0x80000203,
5048 CPU_POWERPC_74x1G = 0x80000210, /* aka G: 2.3 */
a750fc0b
JM
5049#define CPU_POWERPC_74x5 CPU_POWERPC_74x5_v32
5050 CPU_POWERPC_74x5_v10 = 0x80010100,
c3e36823 5051 /* XXX: missing 0x80010200 */
a750fc0b
JM
5052 CPU_POWERPC_74x5_v21 = 0x80010201, /* aka C: 2.1 */
5053 CPU_POWERPC_74x5_v32 = 0x80010302,
5054 CPU_POWERPC_74x5_v33 = 0x80010303, /* aka F: 3.3 */
5055 CPU_POWERPC_74x5_v34 = 0x80010304, /* aka G: 3.4 */
5056#define CPU_POWERPC_74x7 CPU_POWERPC_74x7_v12
c3e36823
JM
5057 /* XXX: is 0x8002xxxx 7447 and 0x8003xxxx 7457 ? */
5058 /* XXX: missing 0x80030102 */
5059 /* XXX: missing 0x80020101 */
a750fc0b
JM
5060 CPU_POWERPC_74x7_v10 = 0x80020100, /* aka A: 1.0 */
5061 CPU_POWERPC_74x7_v11 = 0x80030101, /* aka B: 1.1 */
5062 CPU_POWERPC_74x7_v12 = 0x80020102, /* aka C: 1.2 */
5063 /* 64 bits PowerPC */
00af685f 5064#if defined(TARGET_PPC64)
a750fc0b
JM
5065 CPU_POWERPC_620 = 0x00140000,
5066 CPU_POWERPC_630 = 0x00400000,
5067 CPU_POWERPC_631 = 0x00410104,
5068 CPU_POWERPC_POWER4 = 0x00350000,
5069 CPU_POWERPC_POWER4P = 0x00380000,
c3e36823 5070 /* XXX: missing 0x003A0201 */
a750fc0b
JM
5071 CPU_POWERPC_POWER5 = 0x003A0203,
5072#define CPU_POWERPC_POWER5GR CPU_POWERPC_POWER5
5073 CPU_POWERPC_POWER5P = 0x003B0000,
5074#define CPU_POWERPC_POWER5GS CPU_POWERPC_POWER5P
5075 CPU_POWERPC_POWER6 = 0x003E0000,
5076 CPU_POWERPC_POWER6_5 = 0x0F000001, /* POWER6 running POWER5 mode */
5077 CPU_POWERPC_POWER6A = 0x0F000002,
5078 CPU_POWERPC_970 = 0x00390202,
5079#define CPU_POWERPC_970FX CPU_POWERPC_970FX_v31
5080 CPU_POWERPC_970FX_v10 = 0x00391100,
5081 CPU_POWERPC_970FX_v20 = 0x003C0200,
5082 CPU_POWERPC_970FX_v21 = 0x003C0201,
5083 CPU_POWERPC_970FX_v30 = 0x003C0300,
5084 CPU_POWERPC_970FX_v31 = 0x003C0301,
5085 CPU_POWERPC_970GX = 0x00450000,
5086#define CPU_POWERPC_970MP CPU_POWERPC_970MP_v11
5087 CPU_POWERPC_970MP_v10 = 0x00440100,
5088 CPU_POWERPC_970MP_v11 = 0x00440101,
5089#define CPU_POWERPC_CELL CPU_POWERPC_CELL_v32
5090 CPU_POWERPC_CELL_v10 = 0x00700100,
5091 CPU_POWERPC_CELL_v20 = 0x00700400,
5092 CPU_POWERPC_CELL_v30 = 0x00700500,
5093 CPU_POWERPC_CELL_v31 = 0x00700501,
5094#define CPU_POWERPC_CELL_v32 CPU_POWERPC_CELL_v31
5095 CPU_POWERPC_RS64 = 0x00330000,
5096 CPU_POWERPC_RS64II = 0x00340000,
5097 CPU_POWERPC_RS64III = 0x00360000,
5098 CPU_POWERPC_RS64IV = 0x00370000,
00af685f 5099#endif /* defined(TARGET_PPC64) */
a750fc0b
JM
5100 /* Original POWER */
5101 /* XXX: should be POWER (RIOS), RSC3308, RSC4608,
5102 * POWER2 (RIOS2) & RSC2 (P2SC) here
5103 */
5104#if 0
5105 CPU_POWER = xxx, /* 0x20000 ? 0x30000 for RSC ? */
5106#endif
5107#if 0
5108 CPU_POWER2 = xxx, /* 0x40000 ? */
5109#endif
5110 /* PA Semi core */
5111 CPU_POWERPC_PA6T = 0x00900000,
5112};
5113
5114/* System version register (used on MPC 8xxx) */
5115enum {
c3e36823
JM
5116 PPC_SVR_5200_v10 = 0x80110010,
5117 PPC_SVR_5200_v11 = 0x80110011,
5118 PPC_SVR_5200_v12 = 0x80110012,
5119 PPC_SVR_5200B_v20 = 0x80110020,
5120 PPC_SVR_5200B_v21 = 0x80110021,
5121#if 0
5122 PPC_SVR_5533 = xxx,
5123#endif
5124#if 0
5125 PPC_SVR_5534 = xxx,
5126#endif
5127#if 0
5128 PPC_SVR_5553 = xxx,
5129#endif
5130#if 0
5131 PPC_SVR_5554 = xxx,
5132#endif
5133#if 0
5134 PPC_SVR_5561 = xxx,
5135#endif
5136#if 0
5137 PPC_SVR_5565 = xxx,
5138#endif
5139#if 0
5140 PPC_SVR_5566 = xxx,
5141#endif
5142#if 0
5143 PPC_SVR_5567 = xxx,
5144#endif
5145#if 0
5146 PPC_SVR_8313 = xxx,
5147#endif
5148#if 0
5149 PPC_SVR_8313E = xxx,
5150#endif
5151#if 0
5152 PPC_SVR_8314 = xxx,
5153#endif
5154#if 0
5155 PPC_SVR_8314E = xxx,
5156#endif
5157#if 0
5158 PPC_SVR_8315 = xxx,
5159#endif
5160#if 0
5161 PPC_SVR_8315E = xxx,
5162#endif
5163#if 0
5164 PPC_SVR_8321 = xxx,
5165#endif
5166#if 0
5167 PPC_SVR_8321E = xxx,
5168#endif
5169#if 0
5170 PPC_SVR_8323 = xxx,
5171#endif
5172#if 0
5173 PPC_SVR_8323E = xxx,
5174#endif
5175 PPC_SVR_8343A = 0x80570030,
5176 PPC_SVR_8343EA = 0x80560030,
5177 PPC_SVR_8347AP = 0x80550030, /* PBGA package */
5178 PPC_SVR_8347AT = 0x80530030, /* TBGA package */
5179 PPC_SVR_8347EAP = 0x80540030, /* PBGA package */
5180 PPC_SVR_8347EAT = 0x80520030, /* TBGA package */
5181 PPC_SVR_8349 = 0x80510010,
5182 PPC_SVR_8349A = 0x80510030,
5183 PPC_SVR_8349E = 0x80500010,
5184 PPC_SVR_8349EA = 0x80500030,
5185#if 0
5186 PPC_SVR_8358E = xxx,
5187#endif
5188#if 0
5189 PPC_SVR_8360E = xxx,
5190#endif
5191 PPC_SVR_8377 = 0x80C70010,
5192 PPC_SVR_8377E = 0x80C60010,
5193 PPC_SVR_8378 = 0x80C50010,
5194 PPC_SVR_8378E = 0x80C40010,
5195 PPC_SVR_8379 = 0x80C30010,
5196 PPC_SVR_8379E = 0x80C00010,
5197 PPC_SVR_8533_v10 = 0x80340010,
5198 PPC_SVR_8533_v11 = 0x80340011,
5199 PPC_SVR_8533E_v10 = 0x803C0010,
5200 PPC_SVR_8533E_v11 = 0x803C0011,
5201 PPC_SVR_8540_v10 = 0x80300010,
5202 PPC_SVR_8540_v20 = 0x80300020,
5203 PPC_SVR_8540_v21 = 0x80300021,
5204 PPC_SVR_8541_v10 = 0x80720010,
5205 PPC_SVR_8541_v11 = 0x80720011,
5206 PPC_SVR_8541E_v10 = 0x807A0010,
5207 PPC_SVR_8541E_v11 = 0x807A0011,
5208 PPC_SVR_8543_v10 = 0x80320010,
5209 PPC_SVR_8543_v11 = 0x80320011,
5210 PPC_SVR_8543_v20 = 0x80320020,
5211 PPC_SVR_8543_v21 = 0x80320021,
5212 PPC_SVR_8543E_v10 = 0x803A0010,
5213 PPC_SVR_8543E_v11 = 0x803A0011,
5214 PPC_SVR_8543E_v20 = 0x803A0020,
5215 PPC_SVR_8543E_v21 = 0x803A0021,
5216 PPC_SVR_8544_v10 = 0x80340110,
5217 PPC_SVR_8544_v11 = 0x80340111,
5218 PPC_SVR_8544E_v10 = 0x803C0110,
5219 PPC_SVR_8544E_v11 = 0x803C0111,
5220 PPC_SVR_8545_v20 = 0x80310220,
5221 PPC_SVR_8545_v21 = 0x80310221,
5222 PPC_SVR_8545E_v20 = 0x80390220,
5223 PPC_SVR_8545E_v21 = 0x80390221,
5224 PPC_SVR_8547E_v20 = 0x80390120,
5225 PPC_SVR_8547E_v21 = 0x80390121,
5226 PPC_SCR_8548_v10 = 0x80310010,
5227 PPC_SCR_8548_v11 = 0x80310011,
5228 PPC_SCR_8548_v20 = 0x80310020,
5229 PPC_SCR_8548_v21 = 0x80310021,
5230 PPC_SVR_8548E_v10 = 0x80390010,
5231 PPC_SVR_8548E_v11 = 0x80390011,
5232 PPC_SVR_8548E_v20 = 0x80390020,
5233 PPC_SVR_8548E_v21 = 0x80390021,
5234 PPC_SVR_8555_v10 = 0x80710010,
5235 PPC_SVR_8555_v11 = 0x80710011,
5236 PPC_SVR_8555E_v10 = 0x80790010,
5237 PPC_SVR_8555E_v11 = 0x80790011,
5238 PPC_SVR_8560_v10 = 0x80700010,
5239 PPC_SVR_8560_v20 = 0x80700020,
5240 PPC_SVR_8560_v21 = 0x80700021,
5241 PPC_SVR_8567 = 0x80750111,
5242 PPC_SVR_8567E = 0x807D0111,
5243 PPC_SVR_8568 = 0x80750011,
5244 PPC_SVR_8568E = 0x807D0011,
5245 PPC_SVR_8572 = 0x80E00010,
5246 PPC_SVR_8572E = 0x80E80010,
5247#if 0
5248 PPC_SVR_8610 = xxx,
5249#endif
5250 PPC_SVR_8641 = 0x80900021,
5251 PPC_SVR_8641D = 0x80900121,
a750fc0b
JM
5252};
5253
3fc6c082 5254/*****************************************************************************/
a750fc0b 5255/* PowerPC CPU definitions */
ee4e83ed 5256#define POWERPC_DEF(_name, _pvr, _type) \
a750fc0b
JM
5257 { \
5258 .name = _name, \
5259 .pvr = _pvr, \
a750fc0b
JM
5260 .insns_flags = glue(POWERPC_INSNS_,_type), \
5261 .msr_mask = glue(POWERPC_MSRM_,_type), \
5262 .mmu_model = glue(POWERPC_MMU_,_type), \
5263 .excp_model = glue(POWERPC_EXCP_,_type), \
5264 .bus_model = glue(POWERPC_INPUT_,_type), \
237c0af0 5265 .bfd_mach = glue(POWERPC_BFDM_,_type), \
d26bfc9a 5266 .flags = glue(POWERPC_FLAG_,_type), \
a750fc0b 5267 .init_proc = &glue(init_proc_,_type), \
2f462816 5268 .check_pow = &glue(check_pow_,_type), \
a750fc0b
JM
5269 }
5270
ee4e83ed 5271static const ppc_def_t ppc_defs[] = {
a750fc0b
JM
5272 /* Embedded PowerPC */
5273 /* PowerPC 401 family */
2662a059 5274 /* Generic PowerPC 401 */
ee4e83ed 5275 POWERPC_DEF("401", CPU_POWERPC_401, 401),
a750fc0b 5276 /* PowerPC 401 cores */
2662a059 5277 /* PowerPC 401A1 */
ee4e83ed 5278 POWERPC_DEF("401A1", CPU_POWERPC_401A1, 401),
a750fc0b 5279 /* PowerPC 401B2 */
ee4e83ed 5280 POWERPC_DEF("401B2", CPU_POWERPC_401B2, 401x2),
2662a059 5281#if defined (TODO)
a750fc0b 5282 /* PowerPC 401B3 */
ee4e83ed 5283 POWERPC_DEF("401B3", CPU_POWERPC_401B3, 401x3),
a750fc0b
JM
5284#endif
5285 /* PowerPC 401C2 */
ee4e83ed 5286 POWERPC_DEF("401C2", CPU_POWERPC_401C2, 401x2),
a750fc0b 5287 /* PowerPC 401D2 */
ee4e83ed 5288 POWERPC_DEF("401D2", CPU_POWERPC_401D2, 401x2),
a750fc0b 5289 /* PowerPC 401E2 */
ee4e83ed 5290 POWERPC_DEF("401E2", CPU_POWERPC_401E2, 401x2),
a750fc0b 5291 /* PowerPC 401F2 */
ee4e83ed 5292 POWERPC_DEF("401F2", CPU_POWERPC_401F2, 401x2),
a750fc0b
JM
5293 /* PowerPC 401G2 */
5294 /* XXX: to be checked */
ee4e83ed 5295 POWERPC_DEF("401G2", CPU_POWERPC_401G2, 401x2),
a750fc0b 5296 /* PowerPC 401 microcontrolers */
2662a059 5297#if defined (TODO)
a750fc0b 5298 /* PowerPC 401GF */
ee4e83ed 5299 POWERPC_DEF("401GF", CPU_POWERPC_401GF, 401),
3fc6c082 5300#endif
a750fc0b 5301 /* IOP480 (401 microcontroler) */
ee4e83ed 5302 POWERPC_DEF("IOP480", CPU_POWERPC_IOP480, IOP480),
a750fc0b 5303 /* IBM Processor for Network Resources */
ee4e83ed 5304 POWERPC_DEF("Cobra", CPU_POWERPC_COBRA, 401),
3fc6c082 5305#if defined (TODO)
ee4e83ed 5306 POWERPC_DEF("Xipchip", CPU_POWERPC_XIPCHIP, 401),
3fc6c082 5307#endif
a750fc0b
JM
5308 /* PowerPC 403 family */
5309 /* Generic PowerPC 403 */
ee4e83ed 5310 POWERPC_DEF("403", CPU_POWERPC_403, 403),
a750fc0b
JM
5311 /* PowerPC 403 microcontrolers */
5312 /* PowerPC 403 GA */
ee4e83ed 5313 POWERPC_DEF("403GA", CPU_POWERPC_403GA, 403),
a750fc0b 5314 /* PowerPC 403 GB */
ee4e83ed 5315 POWERPC_DEF("403GB", CPU_POWERPC_403GB, 403),
a750fc0b 5316 /* PowerPC 403 GC */
ee4e83ed 5317 POWERPC_DEF("403GC", CPU_POWERPC_403GC, 403),
a750fc0b 5318 /* PowerPC 403 GCX */
ee4e83ed 5319 POWERPC_DEF("403GCX", CPU_POWERPC_403GCX, 403GCX),
3fc6c082 5320#if defined (TODO)
a750fc0b 5321 /* PowerPC 403 GP */
ee4e83ed 5322 POWERPC_DEF("403GP", CPU_POWERPC_403GP, 403),
3fc6c082 5323#endif
a750fc0b
JM
5324 /* PowerPC 405 family */
5325 /* Generic PowerPC 405 */
ee4e83ed 5326 POWERPC_DEF("405", CPU_POWERPC_405, 405),
a750fc0b 5327 /* PowerPC 405 cores */
2662a059 5328#if defined (TODO)
a750fc0b 5329 /* PowerPC 405 A3 */
ee4e83ed 5330 POWERPC_DEF("405A3", CPU_POWERPC_405A3, 405),
3a607854 5331#endif
3a607854 5332#if defined (TODO)
a750fc0b 5333 /* PowerPC 405 A4 */
ee4e83ed 5334 POWERPC_DEF("405A4", CPU_POWERPC_405A4, 405),
3a607854 5335#endif
3a607854 5336#if defined (TODO)
a750fc0b 5337 /* PowerPC 405 B3 */
ee4e83ed 5338 POWERPC_DEF("405B3", CPU_POWERPC_405B3, 405),
3fc6c082
FB
5339#endif
5340#if defined (TODO)
a750fc0b 5341 /* PowerPC 405 B4 */
ee4e83ed 5342 POWERPC_DEF("405B4", CPU_POWERPC_405B4, 405),
a750fc0b
JM
5343#endif
5344#if defined (TODO)
5345 /* PowerPC 405 C3 */
ee4e83ed 5346 POWERPC_DEF("405C3", CPU_POWERPC_405C3, 405),
a750fc0b
JM
5347#endif
5348#if defined (TODO)
5349 /* PowerPC 405 C4 */
ee4e83ed 5350 POWERPC_DEF("405C4", CPU_POWERPC_405C4, 405),
a750fc0b
JM
5351#endif
5352 /* PowerPC 405 D2 */
ee4e83ed 5353 POWERPC_DEF("405D2", CPU_POWERPC_405D2, 405),
a750fc0b
JM
5354#if defined (TODO)
5355 /* PowerPC 405 D3 */
ee4e83ed 5356 POWERPC_DEF("405D3", CPU_POWERPC_405D3, 405),
a750fc0b
JM
5357#endif
5358 /* PowerPC 405 D4 */
ee4e83ed 5359 POWERPC_DEF("405D4", CPU_POWERPC_405D4, 405),
a750fc0b
JM
5360#if defined (TODO)
5361 /* PowerPC 405 D5 */
ee4e83ed 5362 POWERPC_DEF("405D5", CPU_POWERPC_405D5, 405),
a750fc0b
JM
5363#endif
5364#if defined (TODO)
5365 /* PowerPC 405 E4 */
ee4e83ed 5366 POWERPC_DEF("405E4", CPU_POWERPC_405E4, 405),
a750fc0b
JM
5367#endif
5368#if defined (TODO)
5369 /* PowerPC 405 F4 */
ee4e83ed 5370 POWERPC_DEF("405F4", CPU_POWERPC_405F4, 405),
a750fc0b
JM
5371#endif
5372#if defined (TODO)
5373 /* PowerPC 405 F5 */
ee4e83ed 5374 POWERPC_DEF("405F5", CPU_POWERPC_405F5, 405),
a750fc0b
JM
5375#endif
5376#if defined (TODO)
5377 /* PowerPC 405 F6 */
ee4e83ed 5378 POWERPC_DEF("405F6", CPU_POWERPC_405F6, 405),
a750fc0b
JM
5379#endif
5380 /* PowerPC 405 microcontrolers */
5381 /* PowerPC 405 CR */
ee4e83ed 5382 POWERPC_DEF("405CR", CPU_POWERPC_405CR, 405),
a750fc0b 5383 /* PowerPC 405 CRa */
ee4e83ed 5384 POWERPC_DEF("405CRa", CPU_POWERPC_405CRa, 405),
a750fc0b 5385 /* PowerPC 405 CRb */
ee4e83ed 5386 POWERPC_DEF("405CRb", CPU_POWERPC_405CRb, 405),
a750fc0b 5387 /* PowerPC 405 CRc */
ee4e83ed 5388 POWERPC_DEF("405CRc", CPU_POWERPC_405CRc, 405),
a750fc0b 5389 /* PowerPC 405 EP */
ee4e83ed 5390 POWERPC_DEF("405EP", CPU_POWERPC_405EP, 405),
a750fc0b
JM
5391#if defined(TODO)
5392 /* PowerPC 405 EXr */
ee4e83ed 5393 POWERPC_DEF("405EXr", CPU_POWERPC_405EXr, 405),
a750fc0b
JM
5394#endif
5395 /* PowerPC 405 EZ */
ee4e83ed 5396 POWERPC_DEF("405EZ", CPU_POWERPC_405EZ, 405),
a750fc0b
JM
5397#if defined(TODO)
5398 /* PowerPC 405 FX */
ee4e83ed 5399 POWERPC_DEF("405FX", CPU_POWERPC_405FX, 405),
a750fc0b
JM
5400#endif
5401 /* PowerPC 405 GP */
ee4e83ed 5402 POWERPC_DEF("405GP", CPU_POWERPC_405GP, 405),
a750fc0b 5403 /* PowerPC 405 GPa */
ee4e83ed 5404 POWERPC_DEF("405GPa", CPU_POWERPC_405GPa, 405),
a750fc0b 5405 /* PowerPC 405 GPb */
ee4e83ed 5406 POWERPC_DEF("405GPb", CPU_POWERPC_405GPb, 405),
a750fc0b 5407 /* PowerPC 405 GPc */
ee4e83ed 5408 POWERPC_DEF("405GPc", CPU_POWERPC_405GPc, 405),
a750fc0b 5409 /* PowerPC 405 GPd */
ee4e83ed 5410 POWERPC_DEF("405GPd", CPU_POWERPC_405GPd, 405),
a750fc0b 5411 /* PowerPC 405 GPe */
ee4e83ed 5412 POWERPC_DEF("405GPe", CPU_POWERPC_405GPe, 405),
a750fc0b 5413 /* PowerPC 405 GPR */
ee4e83ed 5414 POWERPC_DEF("405GPR", CPU_POWERPC_405GPR, 405),
a750fc0b
JM
5415#if defined(TODO)
5416 /* PowerPC 405 H */
ee4e83ed 5417 POWERPC_DEF("405H", CPU_POWERPC_405H, 405),
a750fc0b
JM
5418#endif
5419#if defined(TODO)
5420 /* PowerPC 405 L */
ee4e83ed 5421 POWERPC_DEF("405L", CPU_POWERPC_405L, 405),
a750fc0b
JM
5422#endif
5423 /* PowerPC 405 LP */
ee4e83ed 5424 POWERPC_DEF("405LP", CPU_POWERPC_405LP, 405),
a750fc0b
JM
5425#if defined(TODO)
5426 /* PowerPC 405 PM */
ee4e83ed 5427 POWERPC_DEF("405PM", CPU_POWERPC_405PM, 405),
a750fc0b
JM
5428#endif
5429#if defined(TODO)
5430 /* PowerPC 405 PS */
ee4e83ed 5431 POWERPC_DEF("405PS", CPU_POWERPC_405PS, 405),
a750fc0b
JM
5432#endif
5433#if defined(TODO)
5434 /* PowerPC 405 S */
ee4e83ed 5435 POWERPC_DEF("405S", CPU_POWERPC_405S, 405),
a750fc0b
JM
5436#endif
5437 /* Npe405 H */
ee4e83ed 5438 POWERPC_DEF("Npe405H", CPU_POWERPC_NPE405H, 405),
a750fc0b 5439 /* Npe405 H2 */
ee4e83ed 5440 POWERPC_DEF("Npe405H2", CPU_POWERPC_NPE405H2, 405),
a750fc0b 5441 /* Npe405 L */
ee4e83ed 5442 POWERPC_DEF("Npe405L", CPU_POWERPC_NPE405L, 405),
a750fc0b 5443 /* Npe4GS3 */
ee4e83ed 5444 POWERPC_DEF("Npe4GS3", CPU_POWERPC_NPE4GS3, 405),
a750fc0b 5445#if defined (TODO)
ee4e83ed 5446 POWERPC_DEF("Npcxx1", CPU_POWERPC_NPCxx1, 405),
a750fc0b
JM
5447#endif
5448#if defined (TODO)
ee4e83ed 5449 POWERPC_DEF("Npr161", CPU_POWERPC_NPR161, 405),
a750fc0b
JM
5450#endif
5451#if defined (TODO)
5452 /* PowerPC LC77700 (Sanyo) */
ee4e83ed 5453 POWERPC_DEF("LC77700", CPU_POWERPC_LC77700, 405),
a750fc0b
JM
5454#endif
5455 /* PowerPC 401/403/405 based set-top-box microcontrolers */
5456#if defined (TODO)
5457 /* STB010000 */
ee4e83ed 5458 POWERPC_DEF("STB01000", CPU_POWERPC_STB01000, 401x2),
a750fc0b
JM
5459#endif
5460#if defined (TODO)
5461 /* STB01010 */
ee4e83ed 5462 POWERPC_DEF("STB01010", CPU_POWERPC_STB01010, 401x2),
a750fc0b
JM
5463#endif
5464#if defined (TODO)
5465 /* STB0210 */
ee4e83ed 5466 POWERPC_DEF("STB0210", CPU_POWERPC_STB0210, 401x3),
a750fc0b
JM
5467#endif
5468 /* STB03xx */
ee4e83ed 5469 POWERPC_DEF("STB03", CPU_POWERPC_STB03, 405),
a750fc0b
JM
5470#if defined (TODO)
5471 /* STB043x */
ee4e83ed 5472 POWERPC_DEF("STB043", CPU_POWERPC_STB043, 405),
a750fc0b
JM
5473#endif
5474#if defined (TODO)
5475 /* STB045x */
ee4e83ed 5476 POWERPC_DEF("STB045", CPU_POWERPC_STB045, 405),
a750fc0b
JM
5477#endif
5478 /* STB04xx */
ee4e83ed 5479 POWERPC_DEF("STB04", CPU_POWERPC_STB04, 405),
a750fc0b 5480 /* STB25xx */
ee4e83ed 5481 POWERPC_DEF("STB25", CPU_POWERPC_STB25, 405),
a750fc0b
JM
5482#if defined (TODO)
5483 /* STB130 */
ee4e83ed 5484 POWERPC_DEF("STB130", CPU_POWERPC_STB130, 405),
a750fc0b
JM
5485#endif
5486 /* Xilinx PowerPC 405 cores */
ee4e83ed
JM
5487 POWERPC_DEF("x2vp4", CPU_POWERPC_X2VP4, 405),
5488 POWERPC_DEF("x2vp7", CPU_POWERPC_X2VP7, 405),
5489 POWERPC_DEF("x2vp20", CPU_POWERPC_X2VP20, 405),
5490 POWERPC_DEF("x2vp50", CPU_POWERPC_X2VP50, 405),
a750fc0b
JM
5491#if defined (TODO)
5492 /* Zarlink ZL10310 */
ee4e83ed 5493 POWERPC_DEF("zl10310", CPU_POWERPC_ZL10310, 405),
a750fc0b
JM
5494#endif
5495#if defined (TODO)
5496 /* Zarlink ZL10311 */
ee4e83ed 5497 POWERPC_DEF("zl10311", CPU_POWERPC_ZL10311, 405),
a750fc0b
JM
5498#endif
5499#if defined (TODO)
5500 /* Zarlink ZL10320 */
ee4e83ed 5501 POWERPC_DEF("zl10320", CPU_POWERPC_ZL10320, 405),
a750fc0b
JM
5502#endif
5503#if defined (TODO)
5504 /* Zarlink ZL10321 */
ee4e83ed 5505 POWERPC_DEF("zl10321", CPU_POWERPC_ZL10321, 405),
a750fc0b
JM
5506#endif
5507 /* PowerPC 440 family */
5508 /* Generic PowerPC 440 */
ee4e83ed 5509 POWERPC_DEF("440", CPU_POWERPC_440, 440GP),
a750fc0b
JM
5510 /* PowerPC 440 cores */
5511#if defined (TODO)
5512 /* PowerPC 440 A4 */
ee4e83ed 5513 POWERPC_DEF("440A4", CPU_POWERPC_440A4, 440x4),
a750fc0b
JM
5514#endif
5515#if defined (TODO)
5516 /* PowerPC 440 A5 */
ee4e83ed 5517 POWERPC_DEF("440A5", CPU_POWERPC_440A5, 440x5),
a750fc0b
JM
5518#endif
5519#if defined (TODO)
5520 /* PowerPC 440 B4 */
ee4e83ed 5521 POWERPC_DEF("440B4", CPU_POWERPC_440B4, 440x4),
a750fc0b
JM
5522#endif
5523#if defined (TODO)
5524 /* PowerPC 440 G4 */
ee4e83ed 5525 POWERPC_DEF("440G4", CPU_POWERPC_440G4, 440x4),
a750fc0b
JM
5526#endif
5527#if defined (TODO)
5528 /* PowerPC 440 F5 */
ee4e83ed 5529 POWERPC_DEF("440F5", CPU_POWERPC_440F5, 440x5),
a750fc0b
JM
5530#endif
5531#if defined (TODO)
5532 /* PowerPC 440 G5 */
ee4e83ed 5533 POWERPC_DEF("440G5", CPU_POWERPC_440G5, 440x5),
a750fc0b
JM
5534#endif
5535#if defined (TODO)
5536 /* PowerPC 440H4 */
ee4e83ed 5537 POWERPC_DEF("440H4", CPU_POWERPC_440H4, 440x4),
a750fc0b
JM
5538#endif
5539#if defined (TODO)
5540 /* PowerPC 440H6 */
ee4e83ed 5541 POWERPC_DEF("440H6", CPU_POWERPC_440H6, 440Gx5),
a750fc0b
JM
5542#endif
5543 /* PowerPC 440 microcontrolers */
5544 /* PowerPC 440 EP */
ee4e83ed 5545 POWERPC_DEF("440EP", CPU_POWERPC_440EP, 440EP),
a750fc0b 5546 /* PowerPC 440 EPa */
ee4e83ed 5547 POWERPC_DEF("440EPa", CPU_POWERPC_440EPa, 440EP),
a750fc0b 5548 /* PowerPC 440 EPb */
ee4e83ed 5549 POWERPC_DEF("440EPb", CPU_POWERPC_440EPb, 440EP),
a750fc0b 5550 /* PowerPC 440 EPX */
ee4e83ed 5551 POWERPC_DEF("440EPX", CPU_POWERPC_440EPX, 440EP),
a750fc0b 5552 /* PowerPC 440 GP */
ee4e83ed 5553 POWERPC_DEF("440GP", CPU_POWERPC_440GP, 440GP),
a750fc0b 5554 /* PowerPC 440 GPb */
ee4e83ed 5555 POWERPC_DEF("440GPb", CPU_POWERPC_440GPb, 440GP),
a750fc0b 5556 /* PowerPC 440 GPc */
ee4e83ed 5557 POWERPC_DEF("440GPc", CPU_POWERPC_440GPc, 440GP),
a750fc0b 5558 /* PowerPC 440 GR */
ee4e83ed 5559 POWERPC_DEF("440GR", CPU_POWERPC_440GR, 440x5),
a750fc0b 5560 /* PowerPC 440 GRa */
ee4e83ed 5561 POWERPC_DEF("440GRa", CPU_POWERPC_440GRa, 440x5),
a750fc0b 5562 /* PowerPC 440 GRX */
ee4e83ed 5563 POWERPC_DEF("440GRX", CPU_POWERPC_440GRX, 440x5),
a750fc0b 5564 /* PowerPC 440 GX */
ee4e83ed 5565 POWERPC_DEF("440GX", CPU_POWERPC_440GX, 440EP),
a750fc0b 5566 /* PowerPC 440 GXa */
ee4e83ed 5567 POWERPC_DEF("440GXa", CPU_POWERPC_440GXa, 440EP),
a750fc0b 5568 /* PowerPC 440 GXb */
ee4e83ed 5569 POWERPC_DEF("440GXb", CPU_POWERPC_440GXb, 440EP),
a750fc0b 5570 /* PowerPC 440 GXc */
ee4e83ed 5571 POWERPC_DEF("440GXc", CPU_POWERPC_440GXc, 440EP),
a750fc0b 5572 /* PowerPC 440 GXf */
ee4e83ed 5573 POWERPC_DEF("440GXf", CPU_POWERPC_440GXf, 440EP),
a750fc0b
JM
5574#if defined(TODO)
5575 /* PowerPC 440 S */
ee4e83ed 5576 POWERPC_DEF("440S", CPU_POWERPC_440S, 440),
a750fc0b
JM
5577#endif
5578 /* PowerPC 440 SP */
ee4e83ed 5579 POWERPC_DEF("440SP", CPU_POWERPC_440SP, 440EP),
a750fc0b 5580 /* PowerPC 440 SP2 */
ee4e83ed 5581 POWERPC_DEF("440SP2", CPU_POWERPC_440SP2, 440EP),
a750fc0b 5582 /* PowerPC 440 SPE */
ee4e83ed 5583 POWERPC_DEF("440SPE", CPU_POWERPC_440SPE, 440EP),
a750fc0b
JM
5584 /* PowerPC 460 family */
5585#if defined (TODO)
5586 /* Generic PowerPC 464 */
ee4e83ed 5587 POWERPC_DEF("464", CPU_POWERPC_464, 460),
a750fc0b
JM
5588#endif
5589 /* PowerPC 464 microcontrolers */
5590#if defined (TODO)
5591 /* PowerPC 464H90 */
ee4e83ed 5592 POWERPC_DEF("464H90", CPU_POWERPC_464H90, 460),
a750fc0b
JM
5593#endif
5594#if defined (TODO)
5595 /* PowerPC 464H90F */
ee4e83ed 5596 POWERPC_DEF("464H90F", CPU_POWERPC_464H90F, 460F),
a750fc0b
JM
5597#endif
5598 /* Freescale embedded PowerPC cores */
5599 /* e200 family */
5600#if defined (TODO)
5601 /* Generic PowerPC e200 core */
ee4e83ed 5602 POWERPC_DEF("e200", CPU_POWERPC_e200, e200),
a750fc0b
JM
5603#endif
5604#if defined (TODO)
5605 /* PowerPC e200z5 core */
ee4e83ed 5606 POWERPC_DEF("e200z5", CPU_POWERPC_e200z5, e200),
a750fc0b
JM
5607#endif
5608#if defined (TODO)
5609 /* PowerPC e200z6 core */
ee4e83ed 5610 POWERPC_DEF("e200z6", CPU_POWERPC_e200z6, e200),
a750fc0b
JM
5611#endif
5612 /* e300 family */
5613#if defined (TODO)
5614 /* Generic PowerPC e300 core */
ee4e83ed 5615 POWERPC_DEF("e300", CPU_POWERPC_e300, e300),
a750fc0b
JM
5616#endif
5617#if defined (TODO)
5618 /* PowerPC e300c1 core */
ee4e83ed 5619 POWERPC_DEF("e300c1", CPU_POWERPC_e300c1, e300),
a750fc0b
JM
5620#endif
5621#if defined (TODO)
5622 /* PowerPC e300c2 core */
ee4e83ed 5623 POWERPC_DEF("e300c2", CPU_POWERPC_e300c2, e300),
a750fc0b
JM
5624#endif
5625#if defined (TODO)
5626 /* PowerPC e300c3 core */
ee4e83ed 5627 POWERPC_DEF("e300c3", CPU_POWERPC_e300c3, e300),
a750fc0b
JM
5628#endif
5629 /* e500 family */
5630#if defined (TODO)
5631 /* PowerPC e500 core */
ee4e83ed 5632 POWERPC_DEF("e500", CPU_POWERPC_e500, e500),
a750fc0b
JM
5633#endif
5634#if defined (TODO)
5635 /* PowerPC e500 v1.1 core */
ee4e83ed 5636 POWERPC_DEF("e500v1.1", CPU_POWERPC_e500_v11, e500),
a750fc0b
JM
5637#endif
5638#if defined (TODO)
5639 /* PowerPC e500 v1.2 core */
ee4e83ed 5640 POWERPC_DEF("e500v1.2", CPU_POWERPC_e500_v12, e500),
a750fc0b
JM
5641#endif
5642#if defined (TODO)
5643 /* PowerPC e500 v2.1 core */
ee4e83ed 5644 POWERPC_DEF("e500v2.1", CPU_POWERPC_e500_v21, e500),
a750fc0b
JM
5645#endif
5646#if defined (TODO)
5647 /* PowerPC e500 v2.2 core */
ee4e83ed 5648 POWERPC_DEF("e500v2.2", CPU_POWERPC_e500_v22, e500),
a750fc0b
JM
5649#endif
5650 /* e600 family */
5651#if defined (TODO)
5652 /* PowerPC e600 core */
ee4e83ed 5653 POWERPC_DEF("e600", CPU_POWERPC_e600, e600),
a750fc0b
JM
5654#endif
5655 /* PowerPC MPC 5xx cores */
5656#if defined (TODO)
5657 /* PowerPC MPC 5xx */
ee4e83ed 5658 POWERPC_DEF("mpc5xx", CPU_POWERPC_5xx, 5xx),
a750fc0b
JM
5659#endif
5660 /* PowerPC MPC 8xx cores */
5661#if defined (TODO)
5662 /* PowerPC MPC 8xx */
ee4e83ed 5663 POWERPC_DEF("mpc8xx", CPU_POWERPC_8xx, 8xx),
a750fc0b
JM
5664#endif
5665 /* PowerPC MPC 8xxx cores */
5666#if defined (TODO)
5667 /* PowerPC MPC 82xx HIP3 */
ee4e83ed 5668 POWERPC_DEF("mpc82xxhip3", CPU_POWERPC_82xx_HIP3, 82xx),
a750fc0b
JM
5669#endif
5670#if defined (TODO)
5671 /* PowerPC MPC 82xx HIP4 */
ee4e83ed 5672 POWERPC_DEF("mpc82xxhip4", CPU_POWERPC_82xx_HIP4, 82xx),
a750fc0b
JM
5673#endif
5674#if defined (TODO)
5675 /* PowerPC MPC 827x */
ee4e83ed 5676 POWERPC_DEF("mpc827x", CPU_POWERPC_827x, 827x),
a750fc0b
JM
5677#endif
5678
5679 /* 32 bits "classic" PowerPC */
5680 /* PowerPC 6xx family */
5681 /* PowerPC 601 */
ee4e83ed 5682 POWERPC_DEF("601", CPU_POWERPC_601, 601),
c3e36823
JM
5683 /* PowerPC 601v0 */
5684 POWERPC_DEF("601v0", CPU_POWERPC_601_v0, 601),
5685 /* PowerPC 601v1 */
5686 POWERPC_DEF("601v1", CPU_POWERPC_601_v1, 601),
a750fc0b 5687 /* PowerPC 601v2 */
c3e36823 5688 POWERPC_DEF("601v2", CPU_POWERPC_601_v2, 601),
a750fc0b 5689 /* PowerPC 602 */
ee4e83ed 5690 POWERPC_DEF("602", CPU_POWERPC_602, 602),
a750fc0b 5691 /* PowerPC 603 */
ee4e83ed 5692 POWERPC_DEF("603", CPU_POWERPC_603, 603),
a750fc0b 5693 /* Code name for PowerPC 603 */
ee4e83ed 5694 POWERPC_DEF("Vanilla", CPU_POWERPC_603, 603),
a750fc0b 5695 /* PowerPC 603e */
ee4e83ed 5696 POWERPC_DEF("603e", CPU_POWERPC_603E, 603E),
a750fc0b 5697 /* Code name for PowerPC 603e */
ee4e83ed 5698 POWERPC_DEF("Stretch", CPU_POWERPC_603E, 603E),
a750fc0b 5699 /* PowerPC 603e v1.1 */
ee4e83ed 5700 POWERPC_DEF("603e1.1", CPU_POWERPC_603E_v11, 603E),
a750fc0b 5701 /* PowerPC 603e v1.2 */
ee4e83ed 5702 POWERPC_DEF("603e1.2", CPU_POWERPC_603E_v12, 603E),
a750fc0b 5703 /* PowerPC 603e v1.3 */
ee4e83ed 5704 POWERPC_DEF("603e1.3", CPU_POWERPC_603E_v13, 603E),
a750fc0b 5705 /* PowerPC 603e v1.4 */
ee4e83ed 5706 POWERPC_DEF("603e1.4", CPU_POWERPC_603E_v14, 603E),
a750fc0b 5707 /* PowerPC 603e v2.2 */
ee4e83ed 5708 POWERPC_DEF("603e2.2", CPU_POWERPC_603E_v22, 603E),
a750fc0b 5709 /* PowerPC 603e v3 */
ee4e83ed 5710 POWERPC_DEF("603e3", CPU_POWERPC_603E_v3, 603E),
a750fc0b 5711 /* PowerPC 603e v4 */
ee4e83ed 5712 POWERPC_DEF("603e4", CPU_POWERPC_603E_v4, 603E),
a750fc0b 5713 /* PowerPC 603e v4.1 */
ee4e83ed 5714 POWERPC_DEF("603e4.1", CPU_POWERPC_603E_v41, 603E),
a750fc0b 5715 /* PowerPC 603e */
ee4e83ed 5716 POWERPC_DEF("603e7", CPU_POWERPC_603E7, 603E),
a750fc0b 5717 /* PowerPC 603e7t */
ee4e83ed 5718 POWERPC_DEF("603e7t", CPU_POWERPC_603E7t, 603E),
a750fc0b 5719 /* PowerPC 603e7v */
ee4e83ed 5720 POWERPC_DEF("603e7v", CPU_POWERPC_603E7v, 603E),
a750fc0b 5721 /* Code name for PowerPC 603ev */
ee4e83ed 5722 POWERPC_DEF("Vaillant", CPU_POWERPC_603E7v, 603E),
a750fc0b 5723 /* PowerPC 603e7v1 */
ee4e83ed 5724 POWERPC_DEF("603e7v1", CPU_POWERPC_603E7v1, 603E),
a750fc0b 5725 /* PowerPC 603e7v2 */
ee4e83ed 5726 POWERPC_DEF("603e7v2", CPU_POWERPC_603E7v2, 603E),
a750fc0b
JM
5727 /* PowerPC 603p */
5728 /* to be checked */
ee4e83ed 5729 POWERPC_DEF("603p", CPU_POWERPC_603P, 603),
a750fc0b 5730 /* PowerPC 603r */
ee4e83ed 5731 POWERPC_DEF("603r", CPU_POWERPC_603R, 603E),
a750fc0b 5732 /* Code name for PowerPC 603r */
ee4e83ed 5733 POWERPC_DEF("Goldeneye", CPU_POWERPC_603R, 603E),
a750fc0b 5734 /* PowerPC G2 core */
ee4e83ed 5735 POWERPC_DEF("G2", CPU_POWERPC_G2, G2),
a750fc0b 5736 /* PowerPC G2 H4 */
ee4e83ed 5737 POWERPC_DEF("G2H4", CPU_POWERPC_G2H4, G2),
a750fc0b 5738 /* PowerPC G2 GP */
ee4e83ed 5739 POWERPC_DEF("G2GP", CPU_POWERPC_G2gp, G2),
a750fc0b 5740 /* PowerPC G2 LS */
ee4e83ed 5741 POWERPC_DEF("G2LS", CPU_POWERPC_G2ls, G2),
a750fc0b
JM
5742 /* PowerPC G2LE */
5743 /* Same as G2, with little-endian mode support */
ee4e83ed 5744 POWERPC_DEF("G2le", CPU_POWERPC_G2LE, G2LE),
a750fc0b 5745 /* PowerPC G2LE GP */
ee4e83ed 5746 POWERPC_DEF("G2leGP", CPU_POWERPC_G2LEgp, G2LE),
a750fc0b 5747 /* PowerPC G2LE LS */
ee4e83ed 5748 POWERPC_DEF("G2leLS", CPU_POWERPC_G2LEls, G2LE),
a750fc0b 5749 /* PowerPC 604 */
ee4e83ed 5750 POWERPC_DEF("604", CPU_POWERPC_604, 604),
a750fc0b 5751 /* PowerPC 604e */
ee4e83ed
JM
5752 /* XXX: code names "Sirocco" "Mach 5" */
5753 POWERPC_DEF("604e", CPU_POWERPC_604E, 604),
a750fc0b 5754 /* PowerPC 604e v1.0 */
ee4e83ed 5755 POWERPC_DEF("604e1.0", CPU_POWERPC_604E_v10, 604),
a750fc0b 5756 /* PowerPC 604e v2.2 */
ee4e83ed 5757 POWERPC_DEF("604e2.2", CPU_POWERPC_604E_v22, 604),
a750fc0b 5758 /* PowerPC 604e v2.4 */
ee4e83ed 5759 POWERPC_DEF("604e2.4", CPU_POWERPC_604E_v24, 604),
a750fc0b 5760 /* PowerPC 604r */
ee4e83ed 5761 POWERPC_DEF("604r", CPU_POWERPC_604R, 604),
a750fc0b
JM
5762#if defined(TODO)
5763 /* PowerPC 604ev */
ee4e83ed 5764 POWERPC_DEF("604ev", CPU_POWERPC_604EV, 604),
a750fc0b
JM
5765#endif
5766 /* PowerPC 7xx family */
5767 /* Generic PowerPC 740 (G3) */
ee4e83ed 5768 POWERPC_DEF("740", CPU_POWERPC_7x0, 7x0),
a750fc0b 5769 /* Generic PowerPC 750 (G3) */
ee4e83ed 5770 POWERPC_DEF("750", CPU_POWERPC_7x0, 7x0),
a750fc0b 5771 /* Code name for generic PowerPC 740/750 (G3) */
ee4e83ed
JM
5772 POWERPC_DEF("Arthur", CPU_POWERPC_7x0, 7x0),
5773 /* XXX: 750 codename "Typhoon" */
a750fc0b 5774 /* PowerPC 740/750 is also known as G3 */
ee4e83ed 5775 POWERPC_DEF("G3", CPU_POWERPC_7x0, 7x0),
a750fc0b 5776 /* PowerPC 740 v2.0 (G3) */
ee4e83ed 5777 POWERPC_DEF("740v2.0", CPU_POWERPC_7x0_v20, 7x0),
a750fc0b 5778 /* PowerPC 750 v2.0 (G3) */
ee4e83ed 5779 POWERPC_DEF("750v2.0", CPU_POWERPC_7x0_v20, 7x0),
a750fc0b 5780 /* PowerPC 740 v2.1 (G3) */
ee4e83ed 5781 POWERPC_DEF("740v2.1", CPU_POWERPC_7x0_v21, 7x0),
a750fc0b 5782 /* PowerPC 750 v2.1 (G3) */
ee4e83ed 5783 POWERPC_DEF("750v2.1", CPU_POWERPC_7x0_v21, 7x0),
a750fc0b 5784 /* PowerPC 740 v2.2 (G3) */
ee4e83ed 5785 POWERPC_DEF("740v2.2", CPU_POWERPC_7x0_v22, 7x0),
a750fc0b 5786 /* PowerPC 750 v2.2 (G3) */
ee4e83ed 5787 POWERPC_DEF("750v2.2", CPU_POWERPC_7x0_v22, 7x0),
a750fc0b 5788 /* PowerPC 740 v3.0 (G3) */
ee4e83ed 5789 POWERPC_DEF("740v3.0", CPU_POWERPC_7x0_v30, 7x0),
a750fc0b 5790 /* PowerPC 750 v3.0 (G3) */
ee4e83ed 5791 POWERPC_DEF("750v3.0", CPU_POWERPC_7x0_v30, 7x0),
a750fc0b 5792 /* PowerPC 740 v3.1 (G3) */
ee4e83ed 5793 POWERPC_DEF("740v3.1", CPU_POWERPC_7x0_v31, 7x0),
a750fc0b 5794 /* PowerPC 750 v3.1 (G3) */
ee4e83ed 5795 POWERPC_DEF("750v3.1", CPU_POWERPC_7x0_v31, 7x0),
a750fc0b 5796 /* PowerPC 740E (G3) */
ee4e83ed 5797 POWERPC_DEF("740e", CPU_POWERPC_740E, 7x0),
a750fc0b 5798 /* PowerPC 740P (G3) */
ee4e83ed 5799 POWERPC_DEF("740p", CPU_POWERPC_7x0P, 7x0),
a750fc0b 5800 /* PowerPC 750P (G3) */
ee4e83ed 5801 POWERPC_DEF("750p", CPU_POWERPC_7x0P, 7x0),
a750fc0b 5802 /* Code name for PowerPC 740P/750P (G3) */
ee4e83ed 5803 POWERPC_DEF("Conan/Doyle", CPU_POWERPC_7x0P, 7x0),
a750fc0b 5804 /* PowerPC 750CL (G3 embedded) */
ee4e83ed 5805 POWERPC_DEF("750cl", CPU_POWERPC_750CL, 7x0),
a750fc0b 5806 /* PowerPC 750CX (G3 embedded) */
ee4e83ed 5807 POWERPC_DEF("750cx", CPU_POWERPC_750CX, 7x0),
a750fc0b 5808 /* PowerPC 750CX v2.1 (G3 embedded) */
ee4e83ed 5809 POWERPC_DEF("750cx2.1", CPU_POWERPC_750CX_v21, 7x0),
a750fc0b 5810 /* PowerPC 750CX v2.2 (G3 embedded) */
ee4e83ed 5811 POWERPC_DEF("750cx2.2", CPU_POWERPC_750CX_v22, 7x0),
a750fc0b 5812 /* PowerPC 750CXe (G3 embedded) */
ee4e83ed 5813 POWERPC_DEF("750cxe", CPU_POWERPC_750CXE, 7x0),
a750fc0b 5814 /* PowerPC 750CXe v2.1 (G3 embedded) */
ee4e83ed 5815 POWERPC_DEF("750cxe21", CPU_POWERPC_750CXE_v21, 7x0),
a750fc0b 5816 /* PowerPC 750CXe v2.2 (G3 embedded) */
ee4e83ed 5817 POWERPC_DEF("750cxe22", CPU_POWERPC_750CXE_v22, 7x0),
a750fc0b 5818 /* PowerPC 750CXe v2.3 (G3 embedded) */
ee4e83ed 5819 POWERPC_DEF("750cxe23", CPU_POWERPC_750CXE_v23, 7x0),
a750fc0b 5820 /* PowerPC 750CXe v2.4 (G3 embedded) */
ee4e83ed 5821 POWERPC_DEF("750cxe24", CPU_POWERPC_750CXE_v24, 7x0),
a750fc0b 5822 /* PowerPC 750CXe v2.4b (G3 embedded) */
ee4e83ed 5823 POWERPC_DEF("750cxe24b", CPU_POWERPC_750CXE_v24b, 7x0),
a750fc0b 5824 /* PowerPC 750CXe v3.1 (G3 embedded) */
ee4e83ed 5825 POWERPC_DEF("750cxe31", CPU_POWERPC_750CXE_v31, 7x0),
a750fc0b 5826 /* PowerPC 750CXe v3.1b (G3 embedded) */
ee4e83ed 5827 POWERPC_DEF("750cxe3.1b", CPU_POWERPC_750CXE_v31b, 7x0),
a750fc0b 5828 /* PowerPC 750CXr (G3 embedded) */
ee4e83ed 5829 POWERPC_DEF("750cxr", CPU_POWERPC_750CXR, 7x0),
a750fc0b 5830 /* PowerPC 750E (G3) */
ee4e83ed 5831 POWERPC_DEF("750e", CPU_POWERPC_750E, 7x0),
a750fc0b 5832 /* PowerPC 750FL (G3 embedded) */
ee4e83ed 5833 POWERPC_DEF("750fl", CPU_POWERPC_750FL, 750fx),
a750fc0b 5834 /* PowerPC 750FX (G3 embedded) */
ee4e83ed 5835 POWERPC_DEF("750fx", CPU_POWERPC_750FX, 750fx),
a750fc0b 5836 /* PowerPC 750FX v1.0 (G3 embedded) */
ee4e83ed 5837 POWERPC_DEF("750fx1.0", CPU_POWERPC_750FX_v10, 750fx),
a750fc0b 5838 /* PowerPC 750FX v2.0 (G3 embedded) */
ee4e83ed 5839 POWERPC_DEF("750fx2.0", CPU_POWERPC_750FX_v20, 750fx),
a750fc0b 5840 /* PowerPC 750FX v2.1 (G3 embedded) */
ee4e83ed 5841 POWERPC_DEF("750fx2.1", CPU_POWERPC_750FX_v21, 750fx),
a750fc0b 5842 /* PowerPC 750FX v2.2 (G3 embedded) */
ee4e83ed 5843 POWERPC_DEF("750fx2.2", CPU_POWERPC_750FX_v22, 750fx),
a750fc0b 5844 /* PowerPC 750FX v2.3 (G3 embedded) */
ee4e83ed 5845 POWERPC_DEF("750fx2.3", CPU_POWERPC_750FX_v23, 750fx),
a750fc0b 5846 /* PowerPC 750GL (G3 embedded) */
ee4e83ed 5847 POWERPC_DEF("750gl", CPU_POWERPC_750GL, 750fx),
a750fc0b 5848 /* PowerPC 750GX (G3 embedded) */
ee4e83ed 5849 POWERPC_DEF("750gx", CPU_POWERPC_750GX, 750fx),
a750fc0b 5850 /* PowerPC 750GX v1.0 (G3 embedded) */
ee4e83ed 5851 POWERPC_DEF("750gx1.0", CPU_POWERPC_750GX_v10, 750fx),
a750fc0b 5852 /* PowerPC 750GX v1.1 (G3 embedded) */
ee4e83ed 5853 POWERPC_DEF("750gx1.1", CPU_POWERPC_750GX_v11, 750fx),
a750fc0b 5854 /* PowerPC 750GX v1.2 (G3 embedded) */
ee4e83ed 5855 POWERPC_DEF("750gx1.2", CPU_POWERPC_750GX_v12, 750fx),
a750fc0b 5856 /* PowerPC 750L (G3 embedded) */
ee4e83ed 5857 POWERPC_DEF("750l", CPU_POWERPC_750L, 7x0),
a750fc0b 5858 /* Code name for PowerPC 750L (G3 embedded) */
ee4e83ed 5859 POWERPC_DEF("LoneStar", CPU_POWERPC_750L, 7x0),
a750fc0b 5860 /* PowerPC 750L v2.2 (G3 embedded) */
ee4e83ed 5861 POWERPC_DEF("750l2.2", CPU_POWERPC_750L_v22, 7x0),
a750fc0b 5862 /* PowerPC 750L v3.0 (G3 embedded) */
ee4e83ed 5863 POWERPC_DEF("750l3.0", CPU_POWERPC_750L_v30, 7x0),
a750fc0b 5864 /* PowerPC 750L v3.2 (G3 embedded) */
ee4e83ed 5865 POWERPC_DEF("750l3.2", CPU_POWERPC_750L_v32, 7x0),
a750fc0b 5866 /* Generic PowerPC 745 */
ee4e83ed 5867 POWERPC_DEF("745", CPU_POWERPC_7x5, 7x5),
a750fc0b 5868 /* Generic PowerPC 755 */
ee4e83ed 5869 POWERPC_DEF("755", CPU_POWERPC_7x5, 7x5),
a750fc0b 5870 /* Code name for PowerPC 745/755 */
ee4e83ed 5871 POWERPC_DEF("Goldfinger", CPU_POWERPC_7x5, 7x5),
a750fc0b 5872 /* PowerPC 745 v1.0 */
ee4e83ed 5873 POWERPC_DEF("745v1.0", CPU_POWERPC_7x5_v10, 7x5),
a750fc0b 5874 /* PowerPC 755 v1.0 */
ee4e83ed 5875 POWERPC_DEF("755v1.0", CPU_POWERPC_7x5_v10, 7x5),
a750fc0b 5876 /* PowerPC 745 v1.1 */
ee4e83ed 5877 POWERPC_DEF("745v1.1", CPU_POWERPC_7x5_v11, 7x5),
a750fc0b 5878 /* PowerPC 755 v1.1 */
ee4e83ed 5879 POWERPC_DEF("755v1.1", CPU_POWERPC_7x5_v11, 7x5),
a750fc0b 5880 /* PowerPC 745 v2.0 */
ee4e83ed 5881 POWERPC_DEF("745v2.0", CPU_POWERPC_7x5_v20, 7x5),
a750fc0b 5882 /* PowerPC 755 v2.0 */
ee4e83ed 5883 POWERPC_DEF("755v2.0", CPU_POWERPC_7x5_v20, 7x5),
a750fc0b 5884 /* PowerPC 745 v2.1 */
ee4e83ed 5885 POWERPC_DEF("745v2.1", CPU_POWERPC_7x5_v21, 7x5),
a750fc0b 5886 /* PowerPC 755 v2.1 */
ee4e83ed 5887 POWERPC_DEF("755v2.1", CPU_POWERPC_7x5_v21, 7x5),
a750fc0b 5888 /* PowerPC 745 v2.2 */
ee4e83ed 5889 POWERPC_DEF("745v2.2", CPU_POWERPC_7x5_v22, 7x5),
a750fc0b 5890 /* PowerPC 755 v2.2 */
ee4e83ed 5891 POWERPC_DEF("755v2.2", CPU_POWERPC_7x5_v22, 7x5),
a750fc0b 5892 /* PowerPC 745 v2.3 */
ee4e83ed 5893 POWERPC_DEF("745v2.3", CPU_POWERPC_7x5_v23, 7x5),
a750fc0b 5894 /* PowerPC 755 v2.3 */
ee4e83ed 5895 POWERPC_DEF("755v2.3", CPU_POWERPC_7x5_v23, 7x5),
a750fc0b 5896 /* PowerPC 745 v2.4 */
ee4e83ed 5897 POWERPC_DEF("745v2.4", CPU_POWERPC_7x5_v24, 7x5),
a750fc0b 5898 /* PowerPC 755 v2.4 */
ee4e83ed 5899 POWERPC_DEF("755v2.4", CPU_POWERPC_7x5_v24, 7x5),
a750fc0b 5900 /* PowerPC 745 v2.5 */
ee4e83ed 5901 POWERPC_DEF("745v2.5", CPU_POWERPC_7x5_v25, 7x5),
a750fc0b 5902 /* PowerPC 755 v2.5 */
ee4e83ed 5903 POWERPC_DEF("755v2.5", CPU_POWERPC_7x5_v25, 7x5),
a750fc0b 5904 /* PowerPC 745 v2.6 */
ee4e83ed 5905 POWERPC_DEF("745v2.6", CPU_POWERPC_7x5_v26, 7x5),
a750fc0b 5906 /* PowerPC 755 v2.6 */
ee4e83ed 5907 POWERPC_DEF("755v2.6", CPU_POWERPC_7x5_v26, 7x5),
a750fc0b 5908 /* PowerPC 745 v2.7 */
ee4e83ed 5909 POWERPC_DEF("745v2.7", CPU_POWERPC_7x5_v27, 7x5),
a750fc0b 5910 /* PowerPC 755 v2.7 */
ee4e83ed 5911 POWERPC_DEF("755v2.7", CPU_POWERPC_7x5_v27, 7x5),
a750fc0b 5912 /* PowerPC 745 v2.8 */
ee4e83ed 5913 POWERPC_DEF("745v2.8", CPU_POWERPC_7x5_v28, 7x5),
a750fc0b 5914 /* PowerPC 755 v2.8 */
ee4e83ed 5915 POWERPC_DEF("755v2.8", CPU_POWERPC_7x5_v28, 7x5),
a750fc0b
JM
5916#if defined (TODO)
5917 /* PowerPC 745P (G3) */
ee4e83ed 5918 POWERPC_DEF("745p", CPU_POWERPC_7x5P, 7x5),
a750fc0b 5919 /* PowerPC 755P (G3) */
ee4e83ed 5920 POWERPC_DEF("755p", CPU_POWERPC_7x5P, 7x5),
a750fc0b
JM
5921#endif
5922 /* PowerPC 74xx family */
5923 /* PowerPC 7400 (G4) */
ee4e83ed 5924 POWERPC_DEF("7400", CPU_POWERPC_7400, 7400),
a750fc0b 5925 /* Code name for PowerPC 7400 */
ee4e83ed 5926 POWERPC_DEF("Max", CPU_POWERPC_7400, 7400),
a750fc0b 5927 /* PowerPC 74xx is also well known as G4 */
ee4e83ed 5928 POWERPC_DEF("G4", CPU_POWERPC_7400, 7400),
a750fc0b 5929 /* PowerPC 7400 v1.0 (G4) */
ee4e83ed 5930 POWERPC_DEF("7400v1.0", CPU_POWERPC_7400_v10, 7400),
a750fc0b 5931 /* PowerPC 7400 v1.1 (G4) */
ee4e83ed 5932 POWERPC_DEF("7400v1.1", CPU_POWERPC_7400_v11, 7400),
a750fc0b 5933 /* PowerPC 7400 v2.0 (G4) */
ee4e83ed 5934 POWERPC_DEF("7400v2.0", CPU_POWERPC_7400_v20, 7400),
a750fc0b 5935 /* PowerPC 7400 v2.2 (G4) */
ee4e83ed 5936 POWERPC_DEF("7400v2.2", CPU_POWERPC_7400_v22, 7400),
a750fc0b 5937 /* PowerPC 7400 v2.6 (G4) */
ee4e83ed 5938 POWERPC_DEF("7400v2.6", CPU_POWERPC_7400_v26, 7400),
a750fc0b 5939 /* PowerPC 7400 v2.7 (G4) */
ee4e83ed 5940 POWERPC_DEF("7400v2.7", CPU_POWERPC_7400_v27, 7400),
a750fc0b 5941 /* PowerPC 7400 v2.8 (G4) */
ee4e83ed 5942 POWERPC_DEF("7400v2.8", CPU_POWERPC_7400_v28, 7400),
a750fc0b 5943 /* PowerPC 7400 v2.9 (G4) */
ee4e83ed 5944 POWERPC_DEF("7400v2.9", CPU_POWERPC_7400_v29, 7400),
a750fc0b 5945 /* PowerPC 7410 (G4) */
ee4e83ed 5946 POWERPC_DEF("7410", CPU_POWERPC_7410, 7410),
a750fc0b 5947 /* Code name for PowerPC 7410 */
ee4e83ed 5948 POWERPC_DEF("Nitro", CPU_POWERPC_7410, 7410),
a750fc0b 5949 /* PowerPC 7410 v1.0 (G4) */
ee4e83ed 5950 POWERPC_DEF("7410v1.0", CPU_POWERPC_7410_v10, 7410),
a750fc0b 5951 /* PowerPC 7410 v1.1 (G4) */
ee4e83ed 5952 POWERPC_DEF("7410v1.1", CPU_POWERPC_7410_v11, 7410),
a750fc0b 5953 /* PowerPC 7410 v1.2 (G4) */
ee4e83ed 5954 POWERPC_DEF("7410v1.2", CPU_POWERPC_7410_v12, 7410),
a750fc0b 5955 /* PowerPC 7410 v1.3 (G4) */
ee4e83ed 5956 POWERPC_DEF("7410v1.3", CPU_POWERPC_7410_v13, 7410),
a750fc0b 5957 /* PowerPC 7410 v1.4 (G4) */
ee4e83ed 5958 POWERPC_DEF("7410v1.4", CPU_POWERPC_7410_v14, 7410),
a750fc0b 5959 /* PowerPC 7448 (G4) */
ee4e83ed 5960 POWERPC_DEF("7448", CPU_POWERPC_7448, 7400),
a750fc0b 5961 /* PowerPC 7448 v1.0 (G4) */
ee4e83ed 5962 POWERPC_DEF("7448v1.0", CPU_POWERPC_7448_v10, 7400),
a750fc0b 5963 /* PowerPC 7448 v1.1 (G4) */
ee4e83ed 5964 POWERPC_DEF("7448v1.1", CPU_POWERPC_7448_v11, 7400),
a750fc0b 5965 /* PowerPC 7448 v2.0 (G4) */
ee4e83ed 5966 POWERPC_DEF("7448v2.0", CPU_POWERPC_7448_v20, 7400),
a750fc0b 5967 /* PowerPC 7448 v2.1 (G4) */
ee4e83ed 5968 POWERPC_DEF("7448v2.1", CPU_POWERPC_7448_v21, 7400),
a750fc0b 5969 /* PowerPC 7450 (G4) */
ee4e83ed 5970 POWERPC_DEF("7450", CPU_POWERPC_7450, 7450),
a750fc0b 5971 /* Code name for PowerPC 7450 */
ee4e83ed 5972 POWERPC_DEF("Vger", CPU_POWERPC_7450, 7450),
a750fc0b 5973 /* PowerPC 7450 v1.0 (G4) */
ee4e83ed 5974 POWERPC_DEF("7450v1.0", CPU_POWERPC_7450_v10, 7450),
a750fc0b 5975 /* PowerPC 7450 v1.1 (G4) */
ee4e83ed 5976 POWERPC_DEF("7450v1.1", CPU_POWERPC_7450_v11, 7450),
a750fc0b 5977 /* PowerPC 7450 v1.2 (G4) */
ee4e83ed 5978 POWERPC_DEF("7450v1.2", CPU_POWERPC_7450_v12, 7450),
a750fc0b 5979 /* PowerPC 7450 v2.0 (G4) */
ee4e83ed 5980 POWERPC_DEF("7450v2.0", CPU_POWERPC_7450_v20, 7450),
a750fc0b 5981 /* PowerPC 7450 v2.1 (G4) */
ee4e83ed 5982 POWERPC_DEF("7450v2.1", CPU_POWERPC_7450_v21, 7450),
a750fc0b 5983 /* PowerPC 7441 (G4) */
ee4e83ed 5984 POWERPC_DEF("7441", CPU_POWERPC_74x1, 7440),
a750fc0b 5985 /* PowerPC 7451 (G4) */
ee4e83ed 5986 POWERPC_DEF("7451", CPU_POWERPC_74x1, 7450),
a750fc0b 5987 /* PowerPC 7441g (G4) */
ee4e83ed 5988 POWERPC_DEF("7441g", CPU_POWERPC_74x1G, 7440),
a750fc0b 5989 /* PowerPC 7451g (G4) */
ee4e83ed 5990 POWERPC_DEF("7451g", CPU_POWERPC_74x1G, 7450),
a750fc0b 5991 /* PowerPC 7445 (G4) */
ee4e83ed 5992 POWERPC_DEF("7445", CPU_POWERPC_74x5, 7445),
a750fc0b 5993 /* PowerPC 7455 (G4) */
ee4e83ed 5994 POWERPC_DEF("7455", CPU_POWERPC_74x5, 7455),
a750fc0b 5995 /* Code name for PowerPC 7445/7455 */
ee4e83ed 5996 POWERPC_DEF("Apollo6", CPU_POWERPC_74x5, 7455),
a750fc0b 5997 /* PowerPC 7445 v1.0 (G4) */
ee4e83ed 5998 POWERPC_DEF("7445v1.0", CPU_POWERPC_74x5_v10, 7445),
a750fc0b 5999 /* PowerPC 7455 v1.0 (G4) */
ee4e83ed 6000 POWERPC_DEF("7455v1.0", CPU_POWERPC_74x5_v10, 7455),
a750fc0b 6001 /* PowerPC 7445 v2.1 (G4) */
ee4e83ed 6002 POWERPC_DEF("7445v2.1", CPU_POWERPC_74x5_v21, 7445),
a750fc0b 6003 /* PowerPC 7455 v2.1 (G4) */
ee4e83ed 6004 POWERPC_DEF("7455v2.1", CPU_POWERPC_74x5_v21, 7455),
a750fc0b 6005 /* PowerPC 7445 v3.2 (G4) */
ee4e83ed 6006 POWERPC_DEF("7445v3.2", CPU_POWERPC_74x5_v32, 7445),
a750fc0b 6007 /* PowerPC 7455 v3.2 (G4) */
ee4e83ed 6008 POWERPC_DEF("7455v3.2", CPU_POWERPC_74x5_v32, 7455),
a750fc0b 6009 /* PowerPC 7445 v3.3 (G4) */
ee4e83ed 6010 POWERPC_DEF("7445v3.3", CPU_POWERPC_74x5_v33, 7445),
a750fc0b 6011 /* PowerPC 7455 v3.3 (G4) */
ee4e83ed 6012 POWERPC_DEF("7455v3.3", CPU_POWERPC_74x5_v33, 7455),
a750fc0b 6013 /* PowerPC 7445 v3.4 (G4) */
ee4e83ed 6014 POWERPC_DEF("7445v3.4", CPU_POWERPC_74x5_v34, 7445),
a750fc0b 6015 /* PowerPC 7455 v3.4 (G4) */
ee4e83ed 6016 POWERPC_DEF("7455v3.4", CPU_POWERPC_74x5_v34, 7455),
a750fc0b 6017 /* PowerPC 7447 (G4) */
ee4e83ed 6018 POWERPC_DEF("7447", CPU_POWERPC_74x7, 7445),
a750fc0b 6019 /* PowerPC 7457 (G4) */
ee4e83ed 6020 POWERPC_DEF("7457", CPU_POWERPC_74x7, 7455),
a750fc0b 6021 /* Code name for PowerPC 7447/7457 */
ee4e83ed 6022 POWERPC_DEF("Apollo7", CPU_POWERPC_74x7, 7455),
a750fc0b 6023 /* PowerPC 7447 v1.0 (G4) */
ee4e83ed 6024 POWERPC_DEF("7447v1.0", CPU_POWERPC_74x7_v10, 7445),
a750fc0b 6025 /* PowerPC 7457 v1.0 (G4) */
ee4e83ed 6026 POWERPC_DEF("7457v1.0", CPU_POWERPC_74x7_v10, 7455),
a750fc0b 6027 /* Code name for PowerPC 7447A/7457A */
ee4e83ed 6028 POWERPC_DEF("Apollo7PM", CPU_POWERPC_74x7_v10, 7455),
a750fc0b 6029 /* PowerPC 7447 v1.1 (G4) */
ee4e83ed 6030 POWERPC_DEF("7447v1.1", CPU_POWERPC_74x7_v11, 7445),
a750fc0b 6031 /* PowerPC 7457 v1.1 (G4) */
ee4e83ed 6032 POWERPC_DEF("7457v1.1", CPU_POWERPC_74x7_v11, 7455),
a750fc0b 6033 /* PowerPC 7447 v1.2 (G4) */
ee4e83ed 6034 POWERPC_DEF("7447v1.2", CPU_POWERPC_74x7_v12, 7445),
a750fc0b 6035 /* PowerPC 7457 v1.2 (G4) */
ee4e83ed 6036 POWERPC_DEF("7457v1.2", CPU_POWERPC_74x7_v12, 7455),
a750fc0b
JM
6037 /* 64 bits PowerPC */
6038#if defined (TARGET_PPC64)
a750fc0b 6039 /* PowerPC 620 */
ee4e83ed
JM
6040 /* XXX: code name "Trident" */
6041 POWERPC_DEF("620", CPU_POWERPC_620, 620),
3fc6c082 6042#if defined (TODO)
a750fc0b 6043 /* PowerPC 630 (POWER3) */
ee4e83ed
JM
6044 /* XXX: code names: "Boxer" "Dino" */
6045 POWERPC_DEF("630", CPU_POWERPC_630, 630),
6046 POWERPC_DEF("POWER3", CPU_POWERPC_630, 630),
a750fc0b 6047#endif
3a607854 6048#if defined (TODO)
a750fc0b 6049 /* PowerPC 631 (Power 3+) */
ee4e83ed
JM
6050 POWERPC_DEF("631", CPU_POWERPC_631, 631),
6051 POWERPC_DEF("POWER3+", CPU_POWERPC_631, 631),
3a607854
JM
6052#endif
6053#if defined (TODO)
a750fc0b 6054 /* POWER4 */
ee4e83ed 6055 POWERPC_DEF("POWER4", CPU_POWERPC_POWER4, POWER4),
a750fc0b 6056#endif
3a607854 6057#if defined (TODO)
a750fc0b 6058 /* POWER4p */
ee4e83ed 6059 POWERPC_DEF("POWER4+", CPU_POWERPC_POWER4P, POWER4P),
a750fc0b 6060#endif
2662a059 6061#if defined (TODO)
a750fc0b 6062 /* POWER5 */
ee4e83ed 6063 POWERPC_DEF("POWER5", CPU_POWERPC_POWER5, POWER5),
a750fc0b 6064 /* POWER5GR */
ee4e83ed 6065 POWERPC_DEF("POWER5gr", CPU_POWERPC_POWER5GR, POWER5),
2662a059 6066#endif
3a607854 6067#if defined (TODO)
a750fc0b 6068 /* POWER5+ */
ee4e83ed 6069 POWERPC_DEF("POWER5+", CPU_POWERPC_POWER5P, POWER5P),
a750fc0b 6070 /* POWER5GS */
ee4e83ed 6071 POWERPC_DEF("POWER5gs", CPU_POWERPC_POWER5GS, POWER5P),
a750fc0b 6072#endif
2662a059 6073#if defined (TODO)
a750fc0b 6074 /* POWER6 */
ee4e83ed 6075 POWERPC_DEF("POWER6", CPU_POWERPC_POWER6, POWER6),
a750fc0b 6076 /* POWER6 running in POWER5 mode */
ee4e83ed 6077 POWERPC_DEF("POWER6_5", CPU_POWERPC_POWER6_5, POWER5),
a750fc0b 6078 /* POWER6A */
ee4e83ed 6079 POWERPC_DEF("POWER6A", CPU_POWERPC_POWER6A, POWER6),
2662a059 6080#endif
a750fc0b 6081 /* PowerPC 970 */
ee4e83ed 6082 POWERPC_DEF("970", CPU_POWERPC_970, 970),
a750fc0b 6083 /* PowerPC 970FX (G5) */
ee4e83ed 6084 POWERPC_DEF("970fx", CPU_POWERPC_970FX, 970FX),
a750fc0b 6085 /* PowerPC 970FX v1.0 (G5) */
ee4e83ed 6086 POWERPC_DEF("970fx1.0", CPU_POWERPC_970FX_v10, 970FX),
a750fc0b 6087 /* PowerPC 970FX v2.0 (G5) */
ee4e83ed 6088 POWERPC_DEF("970fx2.0", CPU_POWERPC_970FX_v20, 970FX),
a750fc0b 6089 /* PowerPC 970FX v2.1 (G5) */
ee4e83ed 6090 POWERPC_DEF("970fx2.1", CPU_POWERPC_970FX_v21, 970FX),
a750fc0b 6091 /* PowerPC 970FX v3.0 (G5) */
ee4e83ed 6092 POWERPC_DEF("970fx3.0", CPU_POWERPC_970FX_v30, 970FX),
a750fc0b 6093 /* PowerPC 970FX v3.1 (G5) */
ee4e83ed 6094 POWERPC_DEF("970fx3.1", CPU_POWERPC_970FX_v31, 970FX),
a750fc0b 6095 /* PowerPC 970GX (G5) */
ee4e83ed 6096 POWERPC_DEF("970gx", CPU_POWERPC_970GX, 970GX),
a750fc0b 6097 /* PowerPC 970MP */
ee4e83ed 6098 POWERPC_DEF("970mp", CPU_POWERPC_970MP, 970MP),
a750fc0b 6099 /* PowerPC 970MP v1.0 */
ee4e83ed 6100 POWERPC_DEF("970mp1.0", CPU_POWERPC_970MP_v10, 970MP),
a750fc0b 6101 /* PowerPC 970MP v1.1 */
ee4e83ed 6102 POWERPC_DEF("970mp1.1", CPU_POWERPC_970MP_v11, 970MP),
3a607854 6103#if defined (TODO)
a750fc0b 6104 /* PowerPC Cell */
ee4e83ed 6105 POWERPC_DEF("Cell", CPU_POWERPC_CELL, 970),
2662a059
JM
6106#endif
6107#if defined (TODO)
a750fc0b 6108 /* PowerPC Cell v1.0 */
ee4e83ed 6109 POWERPC_DEF("Cell1.0", CPU_POWERPC_CELL_v10, 970),
2662a059
JM
6110#endif
6111#if defined (TODO)
a750fc0b 6112 /* PowerPC Cell v2.0 */
ee4e83ed 6113 POWERPC_DEF("Cell2.0", CPU_POWERPC_CELL_v20, 970),
2662a059
JM
6114#endif
6115#if defined (TODO)
a750fc0b 6116 /* PowerPC Cell v3.0 */
ee4e83ed 6117 POWERPC_DEF("Cell3.0", CPU_POWERPC_CELL_v30, 970),
3a607854 6118#endif
3a607854 6119#if defined (TODO)
a750fc0b 6120 /* PowerPC Cell v3.1 */
ee4e83ed 6121 POWERPC_DEF("Cell3.1", CPU_POWERPC_CELL_v31, 970),
2662a059
JM
6122#endif
6123#if defined (TODO)
a750fc0b 6124 /* PowerPC Cell v3.2 */
ee4e83ed 6125 POWERPC_DEF("Cell3.2", CPU_POWERPC_CELL_v32, 970),
2662a059
JM
6126#endif
6127#if defined (TODO)
a750fc0b
JM
6128 /* RS64 (Apache/A35) */
6129 /* This one seems to support the whole POWER2 instruction set
6130 * and the PowerPC 64 one.
6131 */
6132 /* What about A10 & A30 ? */
ee4e83ed
JM
6133 POWERPC_DEF("RS64", CPU_POWERPC_RS64, RS64),
6134 POWERPC_DEF("Apache", CPU_POWERPC_RS64, RS64),
6135 POWERPC_DEF("A35", CPU_POWERPC_RS64, RS64),
3a607854
JM
6136#endif
6137#if defined (TODO)
a750fc0b 6138 /* RS64-II (NorthStar/A50) */
ee4e83ed
JM
6139 POWERPC_DEF("RS64-II", CPU_POWERPC_RS64II, RS64),
6140 POWERPC_DEF("NorthStar", CPU_POWERPC_RS64II, RS64),
6141 POWERPC_DEF("A50", CPU_POWERPC_RS64II, RS64),
3a607854
JM
6142#endif
6143#if defined (TODO)
a750fc0b 6144 /* RS64-III (Pulsar) */
ee4e83ed
JM
6145 POWERPC_DEF("RS64-III", CPU_POWERPC_RS64III, RS64),
6146 POWERPC_DEF("Pulsar", CPU_POWERPC_RS64III, RS64),
2662a059
JM
6147#endif
6148#if defined (TODO)
a750fc0b 6149 /* RS64-IV (IceStar/IStar/SStar) */
ee4e83ed
JM
6150 POWERPC_DEF("RS64-IV", CPU_POWERPC_RS64IV, RS64),
6151 POWERPC_DEF("IceStar", CPU_POWERPC_RS64IV, RS64),
6152 POWERPC_DEF("IStar", CPU_POWERPC_RS64IV, RS64),
6153 POWERPC_DEF("SStar", CPU_POWERPC_RS64IV, RS64),
3a607854 6154#endif
a750fc0b
JM
6155#endif /* defined (TARGET_PPC64) */
6156 /* POWER */
3fc6c082 6157#if defined (TODO)
a750fc0b 6158 /* Original POWER */
ee4e83ed
JM
6159 POWERPC_DEF("POWER", CPU_POWERPC_POWER, POWER),
6160 POWERPC_DEF("RIOS", CPU_POWERPC_POWER, POWER),
6161 POWERPC_DEF("RSC", CPU_POWERPC_POWER, POWER),
6162 POWERPC_DEF("RSC3308", CPU_POWERPC_POWER, POWER),
6163 POWERPC_DEF("RSC4608", CPU_POWERPC_POWER, POWER),
76a66253
JM
6164#endif
6165#if defined (TODO)
a750fc0b 6166 /* POWER2 */
ee4e83ed
JM
6167 POWERPC_DEF("POWER2", CPU_POWERPC_POWER2, POWER),
6168 POWERPC_DEF("RSC2", CPU_POWERPC_POWER2, POWER),
6169 POWERPC_DEF("P2SC", CPU_POWERPC_POWER2, POWER),
a750fc0b
JM
6170#endif
6171 /* PA semi cores */
6172#if defined (TODO)
6173 /* PA PA6T */
ee4e83ed 6174 POWERPC_DEF("PA6T", CPU_POWERPC_PA6T, PA6T),
a750fc0b
JM
6175#endif
6176 /* Generic PowerPCs */
6177#if defined (TARGET_PPC64)
6178#if defined (TODO)
ee4e83ed 6179 POWERPC_DEF("ppc64", CPU_POWERPC_PPC64, PPC64),
a750fc0b
JM
6180#endif
6181#endif
ee4e83ed
JM
6182 POWERPC_DEF("ppc32", CPU_POWERPC_PPC32, PPC32),
6183 POWERPC_DEF("ppc", CPU_POWERPC_DEFAULT, DEFAULT),
a750fc0b 6184 /* Fallback */
ee4e83ed 6185 POWERPC_DEF("default", CPU_POWERPC_DEFAULT, DEFAULT),
a750fc0b
JM
6186};
6187
6188/*****************************************************************************/
6189/* Generic CPU instanciation routine */
aaed909a 6190static void init_ppc_proc (CPUPPCState *env, const ppc_def_t *def)
a750fc0b
JM
6191{
6192#if !defined(CONFIG_USER_ONLY)
e1833e1f
JM
6193 int i;
6194
a750fc0b 6195 env->irq_inputs = NULL;
e1833e1f
JM
6196 /* Set all exception vectors to an invalid address */
6197 for (i = 0; i < POWERPC_EXCP_NB; i++)
6198 env->excp_vectors[i] = (target_ulong)(-1ULL);
6199 env->excp_prefix = 0x00000000;
6200 env->ivor_mask = 0x00000000;
6201 env->ivpr_mask = 0x00000000;
a750fc0b
JM
6202 /* Default MMU definitions */
6203 env->nb_BATs = 0;
6204 env->nb_tlb = 0;
6205 env->nb_ways = 0;
f2e63a42 6206#endif
a750fc0b
JM
6207 /* Register SPR common to all PowerPC implementations */
6208 gen_spr_generic(env);
6209 spr_register(env, SPR_PVR, "PVR",
6210 SPR_NOACCESS, SPR_NOACCESS,
6211 &spr_read_generic, SPR_NOACCESS,
6212 def->pvr);
6213 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
6214 (*def->init_proc)(env);
25ba3a68
JM
6215 /* MSR bits & flags consistency checks */
6216 if (env->msr_mask & (1 << 25)) {
6217 switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {
6218 case POWERPC_FLAG_SPE:
6219 case POWERPC_FLAG_VRE:
6220 break;
6221 default:
6222 fprintf(stderr, "PowerPC MSR definition inconsistency\n"
6223 "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
6224 exit(1);
6225 }
6226 } else if (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {
6227 fprintf(stderr, "PowerPC MSR definition inconsistency\n"
6228 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
6229 exit(1);
6230 }
6231 if (env->msr_mask & (1 << 17)) {
6232 switch (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) {
6233 case POWERPC_FLAG_TGPR:
6234 case POWERPC_FLAG_CE:
6235 break;
6236 default:
6237 fprintf(stderr, "PowerPC MSR definition inconsistency\n"
6238 "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
6239 exit(1);
6240 }
6241 } else if (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) {
6242 fprintf(stderr, "PowerPC MSR definition inconsistency\n"
6243 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
6244 exit(1);
6245 }
6246 if (env->msr_mask & (1 << 10)) {
6247 switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |
6248 POWERPC_FLAG_UBLE)) {
6249 case POWERPC_FLAG_SE:
6250 case POWERPC_FLAG_DWE:
6251 case POWERPC_FLAG_UBLE:
6252 break;
6253 default:
6254 fprintf(stderr, "PowerPC MSR definition inconsistency\n"
6255 "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
6256 "POWERPC_FLAG_UBLE\n");
6257 exit(1);
6258 }
6259 } else if (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |
6260 POWERPC_FLAG_UBLE)) {
6261 fprintf(stderr, "PowerPC MSR definition inconsistency\n"
6262 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
6263 "POWERPC_FLAG_UBLE\n");
6264 exit(1);
6265 }
6266 if (env->msr_mask & (1 << 9)) {
6267 switch (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) {
6268 case POWERPC_FLAG_BE:
6269 case POWERPC_FLAG_DE:
6270 break;
6271 default:
6272 fprintf(stderr, "PowerPC MSR definition inconsistency\n"
6273 "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
6274 exit(1);
6275 }
6276 } else if (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) {
6277 fprintf(stderr, "PowerPC MSR definition inconsistency\n"
6278 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
6279 exit(1);
6280 }
6281 if (env->msr_mask & (1 << 2)) {
6282 switch (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {
6283 case POWERPC_FLAG_PX:
6284 case POWERPC_FLAG_PMM:
6285 break;
6286 default:
6287 fprintf(stderr, "PowerPC MSR definition inconsistency\n"
6288 "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
6289 exit(1);
6290 }
6291 } else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {
6292 fprintf(stderr, "PowerPC MSR definition inconsistency\n"
6293 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
6294 exit(1);
6295 }
a750fc0b 6296 /* Allocate TLBs buffer when needed */
f2e63a42 6297#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
6298 if (env->nb_tlb != 0) {
6299 int nb_tlb = env->nb_tlb;
6300 if (env->id_tlbs != 0)
6301 nb_tlb *= 2;
6302 env->tlb = qemu_mallocz(nb_tlb * sizeof(ppc_tlb_t));
6303 /* Pre-compute some useful values */
6304 env->tlb_per_way = env->nb_tlb / env->nb_ways;
6305 }
a750fc0b
JM
6306 if (env->irq_inputs == NULL) {
6307 fprintf(stderr, "WARNING: no internal IRQ controller registered.\n"
6308 " Attempt Qemu to crash very soon !\n");
6309 }
6310#endif
2f462816
JM
6311 if (env->check_pow == NULL) {
6312 fprintf(stderr, "WARNING: no power management check handler "
6313 "registered.\n"
6314 " Attempt Qemu to crash very soon !\n");
6315 }
a750fc0b
JM
6316}
6317
6318#if defined(PPC_DUMP_CPU)
6319static void dump_ppc_sprs (CPUPPCState *env)
6320{
6321 ppc_spr_t *spr;
6322#if !defined(CONFIG_USER_ONLY)
6323 uint32_t sr, sw;
6324#endif
6325 uint32_t ur, uw;
6326 int i, j, n;
6327
6328 printf("Special purpose registers:\n");
6329 for (i = 0; i < 32; i++) {
6330 for (j = 0; j < 32; j++) {
6331 n = (i << 5) | j;
6332 spr = &env->spr_cb[n];
6333 uw = spr->uea_write != NULL && spr->uea_write != SPR_NOACCESS;
6334 ur = spr->uea_read != NULL && spr->uea_read != SPR_NOACCESS;
6335#if !defined(CONFIG_USER_ONLY)
6336 sw = spr->oea_write != NULL && spr->oea_write != SPR_NOACCESS;
6337 sr = spr->oea_read != NULL && spr->oea_read != SPR_NOACCESS;
6338 if (sw || sr || uw || ur) {
6339 printf("SPR: %4d (%03x) %-8s s%c%c u%c%c\n",
6340 (i << 5) | j, (i << 5) | j, spr->name,
6341 sw ? 'w' : '-', sr ? 'r' : '-',
6342 uw ? 'w' : '-', ur ? 'r' : '-');
6343 }
6344#else
6345 if (uw || ur) {
6346 printf("SPR: %4d (%03x) %-8s u%c%c\n",
6347 (i << 5) | j, (i << 5) | j, spr->name,
6348 uw ? 'w' : '-', ur ? 'r' : '-');
6349 }
6350#endif
6351 }
6352 }
6353 fflush(stdout);
6354 fflush(stderr);
6355}
6356#endif
6357
6358/*****************************************************************************/
6359#include <stdlib.h>
6360#include <string.h>
6361
6362int fflush (FILE *stream);
6363
6364/* Opcode types */
6365enum {
6366 PPC_DIRECT = 0, /* Opcode routine */
6367 PPC_INDIRECT = 1, /* Indirect opcode table */
6368};
6369
6370static inline int is_indirect_opcode (void *handler)
6371{
6372 return ((unsigned long)handler & 0x03) == PPC_INDIRECT;
6373}
6374
6375static inline opc_handler_t **ind_table(void *handler)
6376{
6377 return (opc_handler_t **)((unsigned long)handler & ~3);
6378}
6379
6380/* Instruction table creation */
6381/* Opcodes tables creation */
6382static void fill_new_table (opc_handler_t **table, int len)
6383{
6384 int i;
6385
6386 for (i = 0; i < len; i++)
6387 table[i] = &invalid_handler;
6388}
6389
6390static int create_new_table (opc_handler_t **table, unsigned char idx)
6391{
6392 opc_handler_t **tmp;
6393
6394 tmp = malloc(0x20 * sizeof(opc_handler_t));
6395 if (tmp == NULL)
6396 return -1;
6397 fill_new_table(tmp, 0x20);
6398 table[idx] = (opc_handler_t *)((unsigned long)tmp | PPC_INDIRECT);
6399
6400 return 0;
6401}
6402
6403static int insert_in_table (opc_handler_t **table, unsigned char idx,
6404 opc_handler_t *handler)
6405{
6406 if (table[idx] != &invalid_handler)
6407 return -1;
6408 table[idx] = handler;
6409
6410 return 0;
6411}
6412
6413static int register_direct_insn (opc_handler_t **ppc_opcodes,
6414 unsigned char idx, opc_handler_t *handler)
6415{
6416 if (insert_in_table(ppc_opcodes, idx, handler) < 0) {
6417 printf("*** ERROR: opcode %02x already assigned in main "
6418 "opcode table\n", idx);
6419 return -1;
6420 }
6421
6422 return 0;
6423}
6424
6425static int register_ind_in_table (opc_handler_t **table,
6426 unsigned char idx1, unsigned char idx2,
6427 opc_handler_t *handler)
6428{
6429 if (table[idx1] == &invalid_handler) {
6430 if (create_new_table(table, idx1) < 0) {
6431 printf("*** ERROR: unable to create indirect table "
6432 "idx=%02x\n", idx1);
6433 return -1;
6434 }
6435 } else {
6436 if (!is_indirect_opcode(table[idx1])) {
6437 printf("*** ERROR: idx %02x already assigned to a direct "
6438 "opcode\n", idx1);
6439 return -1;
6440 }
3a607854 6441 }
a750fc0b
JM
6442 if (handler != NULL &&
6443 insert_in_table(ind_table(table[idx1]), idx2, handler) < 0) {
6444 printf("*** ERROR: opcode %02x already assigned in "
6445 "opcode table %02x\n", idx2, idx1);
6446 return -1;
3a607854 6447 }
a750fc0b
JM
6448
6449 return 0;
6450}
6451
6452static int register_ind_insn (opc_handler_t **ppc_opcodes,
6453 unsigned char idx1, unsigned char idx2,
6454 opc_handler_t *handler)
6455{
6456 int ret;
6457
6458 ret = register_ind_in_table(ppc_opcodes, idx1, idx2, handler);
6459
6460 return ret;
6461}
6462
6463static int register_dblind_insn (opc_handler_t **ppc_opcodes,
6464 unsigned char idx1, unsigned char idx2,
6465 unsigned char idx3, opc_handler_t *handler)
6466{
6467 if (register_ind_in_table(ppc_opcodes, idx1, idx2, NULL) < 0) {
6468 printf("*** ERROR: unable to join indirect table idx "
6469 "[%02x-%02x]\n", idx1, idx2);
6470 return -1;
6471 }
6472 if (register_ind_in_table(ind_table(ppc_opcodes[idx1]), idx2, idx3,
6473 handler) < 0) {
6474 printf("*** ERROR: unable to insert opcode "
6475 "[%02x-%02x-%02x]\n", idx1, idx2, idx3);
6476 return -1;
6477 }
6478
6479 return 0;
6480}
6481
6482static int register_insn (opc_handler_t **ppc_opcodes, opcode_t *insn)
6483{
6484 if (insn->opc2 != 0xFF) {
6485 if (insn->opc3 != 0xFF) {
6486 if (register_dblind_insn(ppc_opcodes, insn->opc1, insn->opc2,
6487 insn->opc3, &insn->handler) < 0)
6488 return -1;
6489 } else {
6490 if (register_ind_insn(ppc_opcodes, insn->opc1,
6491 insn->opc2, &insn->handler) < 0)
6492 return -1;
6493 }
6494 } else {
6495 if (register_direct_insn(ppc_opcodes, insn->opc1, &insn->handler) < 0)
6496 return -1;
6497 }
6498
6499 return 0;
6500}
6501
6502static int test_opcode_table (opc_handler_t **table, int len)
6503{
6504 int i, count, tmp;
6505
6506 for (i = 0, count = 0; i < len; i++) {
6507 /* Consistency fixup */
6508 if (table[i] == NULL)
6509 table[i] = &invalid_handler;
6510 if (table[i] != &invalid_handler) {
6511 if (is_indirect_opcode(table[i])) {
6512 tmp = test_opcode_table(ind_table(table[i]), 0x20);
6513 if (tmp == 0) {
6514 free(table[i]);
6515 table[i] = &invalid_handler;
6516 } else {
6517 count++;
6518 }
6519 } else {
6520 count++;
6521 }
6522 }
6523 }
6524
6525 return count;
6526}
6527
6528static void fix_opcode_tables (opc_handler_t **ppc_opcodes)
6529{
6530 if (test_opcode_table(ppc_opcodes, 0x40) == 0)
6531 printf("*** WARNING: no opcode defined !\n");
6532}
6533
6534/*****************************************************************************/
aaed909a 6535static int create_ppc_opcodes (CPUPPCState *env, const ppc_def_t *def)
a750fc0b
JM
6536{
6537 opcode_t *opc, *start, *end;
6538
6539 fill_new_table(env->opcodes, 0x40);
6540 if (&opc_start < &opc_end) {
6541 start = &opc_start;
6542 end = &opc_end;
6543 } else {
6544 start = &opc_end;
6545 end = &opc_start;
6546 }
6547 for (opc = start + 1; opc != end; opc++) {
6548 if ((opc->handler.type & def->insns_flags) != 0) {
6549 if (register_insn(env->opcodes, opc) < 0) {
6550 printf("*** ERROR initializing PowerPC instruction "
6551 "0x%02x 0x%02x 0x%02x\n", opc->opc1, opc->opc2,
6552 opc->opc3);
6553 return -1;
6554 }
6555 }
6556 }
6557 fix_opcode_tables(env->opcodes);
6558 fflush(stdout);
6559 fflush(stderr);
6560
6561 return 0;
6562}
6563
6564#if defined(PPC_DUMP_CPU)
25ba3a68 6565static void dump_ppc_insns (CPUPPCState *env)
a750fc0b
JM
6566{
6567 opc_handler_t **table, *handler;
6568 uint8_t opc1, opc2, opc3;
6569
6570 printf("Instructions set:\n");
6571 /* opc1 is 6 bits long */
6572 for (opc1 = 0x00; opc1 < 0x40; opc1++) {
6573 table = env->opcodes;
6574 handler = table[opc1];
6575 if (is_indirect_opcode(handler)) {
6576 /* opc2 is 5 bits long */
6577 for (opc2 = 0; opc2 < 0x20; opc2++) {
6578 table = env->opcodes;
6579 handler = env->opcodes[opc1];
6580 table = ind_table(handler);
6581 handler = table[opc2];
6582 if (is_indirect_opcode(handler)) {
6583 table = ind_table(handler);
6584 /* opc3 is 5 bits long */
6585 for (opc3 = 0; opc3 < 0x20; opc3++) {
6586 handler = table[opc3];
6587 if (handler->handler != &gen_invalid) {
6588 printf("INSN: %02x %02x %02x (%02d %04d) : %s\n",
6589 opc1, opc2, opc3, opc1, (opc3 << 5) | opc2,
6590 handler->oname);
6591 }
6592 }
6593 } else {
6594 if (handler->handler != &gen_invalid) {
6595 printf("INSN: %02x %02x -- (%02d %04d) : %s\n",
6596 opc1, opc2, opc1, opc2, handler->oname);
6597 }
6598 }
6599 }
6600 } else {
6601 if (handler->handler != &gen_invalid) {
6602 printf("INSN: %02x -- -- (%02d ----) : %s\n",
6603 opc1, opc1, handler->oname);
6604 }
6605 }
6606 }
6607}
3a607854 6608#endif
a750fc0b 6609
aaed909a 6610int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def)
a750fc0b
JM
6611{
6612 env->msr_mask = def->msr_mask;
6613 env->mmu_model = def->mmu_model;
6614 env->excp_model = def->excp_model;
6615 env->bus_model = def->bus_model;
d26bfc9a 6616 env->flags = def->flags;
237c0af0 6617 env->bfd_mach = def->bfd_mach;
2f462816 6618 env->check_pow = def->check_pow;
a750fc0b
JM
6619 if (create_ppc_opcodes(env, def) < 0)
6620 return -1;
6621 init_ppc_proc(env, def);
6622#if defined(PPC_DUMP_CPU)
3a607854 6623 {
a750fc0b
JM
6624 const unsigned char *mmu_model, *excp_model, *bus_model;
6625 switch (env->mmu_model) {
6626 case POWERPC_MMU_32B:
6627 mmu_model = "PowerPC 32";
6628 break;
a750fc0b
JM
6629 case POWERPC_MMU_SOFT_6xx:
6630 mmu_model = "PowerPC 6xx/7xx with software driven TLBs";
6631 break;
6632 case POWERPC_MMU_SOFT_74xx:
6633 mmu_model = "PowerPC 74xx with software driven TLBs";
6634 break;
6635 case POWERPC_MMU_SOFT_4xx:
6636 mmu_model = "PowerPC 4xx with software driven TLBs";
6637 break;
6638 case POWERPC_MMU_SOFT_4xx_Z:
6639 mmu_model = "PowerPC 4xx with software driven TLBs "
6640 "and zones protections";
6641 break;
6642 case POWERPC_MMU_REAL_4xx:
6643 mmu_model = "PowerPC 4xx real mode only";
6644 break;
6645 case POWERPC_MMU_BOOKE:
6646 mmu_model = "PowerPC BookE";
6647 break;
6648 case POWERPC_MMU_BOOKE_FSL:
6649 mmu_model = "PowerPC BookE FSL";
6650 break;
00af685f
JM
6651#if defined (TARGET_PPC64)
6652 case POWERPC_MMU_64B:
6653 mmu_model = "PowerPC 64";
6654 break;
00af685f 6655#endif
a750fc0b
JM
6656 default:
6657 mmu_model = "Unknown or invalid";
6658 break;
6659 }
6660 switch (env->excp_model) {
6661 case POWERPC_EXCP_STD:
6662 excp_model = "PowerPC";
6663 break;
6664 case POWERPC_EXCP_40x:
6665 excp_model = "PowerPC 40x";
6666 break;
6667 case POWERPC_EXCP_601:
6668 excp_model = "PowerPC 601";
6669 break;
6670 case POWERPC_EXCP_602:
6671 excp_model = "PowerPC 602";
6672 break;
6673 case POWERPC_EXCP_603:
6674 excp_model = "PowerPC 603";
6675 break;
6676 case POWERPC_EXCP_603E:
6677 excp_model = "PowerPC 603e";
6678 break;
6679 case POWERPC_EXCP_604:
6680 excp_model = "PowerPC 604";
6681 break;
6682 case POWERPC_EXCP_7x0:
6683 excp_model = "PowerPC 740/750";
6684 break;
6685 case POWERPC_EXCP_7x5:
6686 excp_model = "PowerPC 745/755";
6687 break;
6688 case POWERPC_EXCP_74xx:
6689 excp_model = "PowerPC 74xx";
6690 break;
a750fc0b
JM
6691 case POWERPC_EXCP_BOOKE:
6692 excp_model = "PowerPC BookE";
6693 break;
00af685f
JM
6694#if defined (TARGET_PPC64)
6695 case POWERPC_EXCP_970:
6696 excp_model = "PowerPC 970";
6697 break;
6698#endif
a750fc0b
JM
6699 default:
6700 excp_model = "Unknown or invalid";
6701 break;
6702 }
6703 switch (env->bus_model) {
6704 case PPC_FLAGS_INPUT_6xx:
6705 bus_model = "PowerPC 6xx";
6706 break;
6707 case PPC_FLAGS_INPUT_BookE:
6708 bus_model = "PowerPC BookE";
6709 break;
6710 case PPC_FLAGS_INPUT_405:
6711 bus_model = "PowerPC 405";
6712 break;
a750fc0b
JM
6713 case PPC_FLAGS_INPUT_401:
6714 bus_model = "PowerPC 401/403";
6715 break;
00af685f
JM
6716#if defined (TARGET_PPC64)
6717 case PPC_FLAGS_INPUT_970:
6718 bus_model = "PowerPC 970";
6719 break;
6720#endif
a750fc0b
JM
6721 default:
6722 bus_model = "Unknown or invalid";
6723 break;
6724 }
6725 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64 "\n"
6726 " MMU model : %s\n",
6727 def->name, def->pvr, def->msr_mask, mmu_model);
f2e63a42 6728#if !defined(CONFIG_USER_ONLY)
a750fc0b
JM
6729 if (env->tlb != NULL) {
6730 printf(" %d %s TLB in %d ways\n",
6731 env->nb_tlb, env->id_tlbs ? "splitted" : "merged",
6732 env->nb_ways);
6733 }
f2e63a42 6734#endif
a750fc0b
JM
6735 printf(" Exceptions model : %s\n"
6736 " Bus model : %s\n",
6737 excp_model, bus_model);
25ba3a68
JM
6738 printf(" MSR features :\n");
6739 if (env->flags & POWERPC_FLAG_SPE)
6740 printf(" signal processing engine enable"
6741 "\n");
6742 else if (env->flags & POWERPC_FLAG_VRE)
6743 printf(" vector processor enable\n");
6744 if (env->flags & POWERPC_FLAG_TGPR)
6745 printf(" temporary GPRs\n");
6746 else if (env->flags & POWERPC_FLAG_CE)
6747 printf(" critical input enable\n");
6748 if (env->flags & POWERPC_FLAG_SE)
6749 printf(" single-step trace mode\n");
6750 else if (env->flags & POWERPC_FLAG_DWE)
6751 printf(" debug wait enable\n");
6752 else if (env->flags & POWERPC_FLAG_UBLE)
6753 printf(" user BTB lock enable\n");
6754 if (env->flags & POWERPC_FLAG_BE)
6755 printf(" branch-step trace mode\n");
6756 else if (env->flags & POWERPC_FLAG_DE)
6757 printf(" debug interrupt enable\n");
6758 if (env->flags & POWERPC_FLAG_PX)
6759 printf(" inclusive protection\n");
6760 else if (env->flags & POWERPC_FLAG_PMM)
6761 printf(" performance monitor mark\n");
6762 if (env->flags == POWERPC_FLAG_NONE)
6763 printf(" none\n");
a750fc0b
JM
6764 }
6765 dump_ppc_insns(env);
6766 dump_ppc_sprs(env);
6767 fflush(stdout);
3a607854 6768#endif
a750fc0b
JM
6769
6770 return 0;
6771}
3fc6c082 6772
ee4e83ed 6773static const ppc_def_t *ppc_find_by_pvr (uint32_t pvr)
3fc6c082 6774{
ee4e83ed
JM
6775 const ppc_def_t *ret;
6776 uint32_t pvr_rev;
6777 int i, best, match, best_match, max;
3fc6c082 6778
ee4e83ed 6779 ret = NULL;
068abdc8 6780 max = sizeof(ppc_defs) / sizeof(ppc_def_t);
ee4e83ed
JM
6781 best = -1;
6782 pvr_rev = pvr & 0xFFFF;
6783 /* We want all specified bits to match */
6784 best_match = 32 - ctz32(pvr_rev);
068abdc8 6785 for (i = 0; i < max; i++) {
ee4e83ed
JM
6786 /* We check that the 16 higher bits are the same to ensure the CPU
6787 * model will be the choosen one.
6788 */
6789 if (((pvr ^ ppc_defs[i].pvr) >> 16) == 0) {
6790 /* We want as much as possible of the low-level 16 bits
6791 * to be the same but we allow inexact matches.
6792 */
6793 match = clz32(pvr_rev ^ (ppc_defs[i].pvr & 0xFFFF));
6794 /* We check '>=' instead of '>' because the PPC_defs table
6795 * is ordered by increasing revision.
6796 * Then, we will match the higher revision compatible
6797 * with the requested PVR
6798 */
6799 if (match >= best_match) {
6800 best = i;
6801 best_match = match;
6802 }
3fc6c082
FB
6803 }
6804 }
ee4e83ed
JM
6805 if (best != -1)
6806 ret = &ppc_defs[best];
6807
6808 return ret;
3fc6c082
FB
6809}
6810
ee4e83ed 6811#include <ctype.h>
3fc6c082 6812
ee4e83ed
JM
6813const ppc_def_t *cpu_ppc_find_by_name (const unsigned char *name)
6814{
6815 const ppc_def_t *ret;
6816 const unsigned char *p;
6817 int i, max, len;
6818
6819 /* Check if the given name is a PVR */
6820 len = strlen(name);
6821 if (len == 10 && name[0] == '0' && name[1] == 'x') {
6822 p = name + 2;
6823 goto check_pvr;
6824 } else if (len == 8) {
6825 p = name;
6826 check_pvr:
6827 for (i = 0; i < 8; i++) {
6828 if (!isxdigit(*p++))
6829 break;
6830 }
6831 if (i == 8)
6832 return ppc_find_by_pvr(strtoul(name, NULL, 16));
6833 }
6834 ret = NULL;
068abdc8
JM
6835 max = sizeof(ppc_defs) / sizeof(ppc_def_t);
6836 for (i = 0; i < max; i++) {
ee4e83ed
JM
6837 if (strcasecmp(name, ppc_defs[i].name) == 0) {
6838 ret = &ppc_defs[i];
6839 break;
3fc6c082
FB
6840 }
6841 }
ee4e83ed
JM
6842
6843 return ret;
3fc6c082
FB
6844}
6845
6846void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
6847{
068abdc8 6848 int i, max;
3fc6c082 6849
068abdc8
JM
6850 max = sizeof(ppc_defs) / sizeof(ppc_def_t);
6851 for (i = 0; i < max; i++) {
a750fc0b
JM
6852 (*cpu_fprintf)(f, "PowerPC %-16s PVR %08x\n",
6853 ppc_defs[i].name, ppc_defs[i].pvr);
3fc6c082
FB
6854 }
6855}