symbian-qemu-0.9.1-12/qemu-symbian-svp/target-ppc/translate_init.c
changeset 1 2fb8b9db1c86
equal deleted inserted replaced
0:ffa851df0825 1:2fb8b9db1c86
       
     1 /*
       
     2  *  PowerPC CPU initialization for qemu.
       
     3  *
       
     4  *  Copyright (c) 2003-2007 Jocelyn Mayer
       
     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 
       
    26 #include "dis-asm.h"
       
    27 #include "host-utils.h"
       
    28 
       
    29 //#define PPC_DUMP_CPU
       
    30 //#define PPC_DEBUG_SPR
       
    31 //#define PPC_DUMP_SPR_ACCESSES
       
    32 #if defined(CONFIG_USER_ONLY)
       
    33 #define TODO_USER_ONLY 1
       
    34 #endif
       
    35 
       
    36 struct ppc_def_t {
       
    37     const char *name;
       
    38     uint32_t pvr;
       
    39     uint32_t svr;
       
    40     uint64_t insns_flags;
       
    41     uint64_t msr_mask;
       
    42     powerpc_mmu_t   mmu_model;
       
    43     powerpc_excp_t  excp_model;
       
    44     powerpc_input_t bus_model;
       
    45     uint32_t flags;
       
    46     int bfd_mach;
       
    47     void (*init_proc)(CPUPPCState *env);
       
    48     int  (*check_pow)(CPUPPCState *env);
       
    49 };
       
    50 
       
    51 /* For user-mode emulation, we don't emulate any IRQ controller */
       
    52 #if defined(CONFIG_USER_ONLY)
       
    53 #define PPC_IRQ_INIT_FN(name)                                                 \
       
    54 static inline void glue(glue(ppc, name),_irq_init) (CPUPPCState *env)         \
       
    55 {                                                                             \
       
    56 }
       
    57 #else
       
    58 #define PPC_IRQ_INIT_FN(name)                                                 \
       
    59 void glue(glue(ppc, name),_irq_init) (CPUPPCState *env);
       
    60 #endif
       
    61 
       
    62 PPC_IRQ_INIT_FN(40x);
       
    63 PPC_IRQ_INIT_FN(6xx);
       
    64 PPC_IRQ_INIT_FN(970);
       
    65 
       
    66 /* Generic callbacks:
       
    67  * do nothing but store/retrieve spr value
       
    68  */
       
    69 static void spr_read_generic (void *opaque, int gprn, int sprn)
       
    70 {
       
    71     gen_load_spr(cpu_gpr[gprn], sprn);
       
    72 #ifdef PPC_DUMP_SPR_ACCESSES
       
    73     {
       
    74         TCGv t0 = tcg_const_i32(sprn);
       
    75         gen_helper_load_dump_spr(t0);
       
    76         tcg_temp_free_i32(t0);
       
    77     }
       
    78 #endif
       
    79 }
       
    80 
       
    81 static void spr_write_generic (void *opaque, int sprn, int gprn)
       
    82 {
       
    83     gen_store_spr(sprn, cpu_gpr[gprn]);
       
    84 #ifdef PPC_DUMP_SPR_ACCESSES
       
    85     {
       
    86         TCGv t0 = tcg_const_i32(sprn);
       
    87         gen_helper_store_dump_spr(t0);
       
    88         tcg_temp_free_i32(t0);
       
    89     }
       
    90 #endif
       
    91 }
       
    92 
       
    93 #if !defined(CONFIG_USER_ONLY)
       
    94 static void spr_write_clear (void *opaque, int sprn, int gprn)
       
    95 {
       
    96     TCGv t0 = tcg_temp_new();
       
    97     TCGv t1 = tcg_temp_new();
       
    98     gen_load_spr(t0, sprn);
       
    99     tcg_gen_neg_tl(t1, cpu_gpr[gprn]);
       
   100     tcg_gen_and_tl(t0, t0, t1);
       
   101     gen_store_spr(sprn, t0);
       
   102     tcg_temp_free(t0);
       
   103     tcg_temp_free(t1);
       
   104 }
       
   105 #endif
       
   106 
       
   107 /* SPR common to all PowerPC */
       
   108 /* XER */
       
   109 static void spr_read_xer (void *opaque, int gprn, int sprn)
       
   110 {
       
   111     tcg_gen_mov_tl(cpu_gpr[gprn], cpu_xer);
       
   112 }
       
   113 
       
   114 static void spr_write_xer (void *opaque, int sprn, int gprn)
       
   115 {
       
   116     tcg_gen_mov_tl(cpu_xer, cpu_gpr[gprn]);
       
   117 }
       
   118 
       
   119 /* LR */
       
   120 static void spr_read_lr (void *opaque, int gprn, int sprn)
       
   121 {
       
   122     tcg_gen_mov_tl(cpu_gpr[gprn], cpu_lr);
       
   123 }
       
   124 
       
   125 static void spr_write_lr (void *opaque, int sprn, int gprn)
       
   126 {
       
   127     tcg_gen_mov_tl(cpu_lr, cpu_gpr[gprn]);
       
   128 }
       
   129 
       
   130 /* CTR */
       
   131 static void spr_read_ctr (void *opaque, int gprn, int sprn)
       
   132 {
       
   133     tcg_gen_mov_tl(cpu_gpr[gprn], cpu_ctr);
       
   134 }
       
   135 
       
   136 static void spr_write_ctr (void *opaque, int sprn, int gprn)
       
   137 {
       
   138     tcg_gen_mov_tl(cpu_ctr, cpu_gpr[gprn]);
       
   139 }
       
   140 
       
   141 /* User read access to SPR */
       
   142 /* USPRx */
       
   143 /* UMMCRx */
       
   144 /* UPMCx */
       
   145 /* USIA */
       
   146 /* UDECR */
       
   147 static void spr_read_ureg (void *opaque, int gprn, int sprn)
       
   148 {
       
   149     gen_load_spr(cpu_gpr[gprn], sprn + 0x10);
       
   150 }
       
   151 
       
   152 /* SPR common to all non-embedded PowerPC */
       
   153 /* DECR */
       
   154 #if !defined(CONFIG_USER_ONLY)
       
   155 static void spr_read_decr (void *opaque, int gprn, int sprn)
       
   156 {
       
   157     gen_helper_load_decr(cpu_gpr[gprn]);
       
   158 }
       
   159 
       
   160 static void spr_write_decr (void *opaque, int sprn, int gprn)
       
   161 {
       
   162     gen_helper_store_decr(cpu_gpr[gprn]);
       
   163 }
       
   164 #endif
       
   165 
       
   166 /* SPR common to all non-embedded PowerPC, except 601 */
       
   167 /* Time base */
       
   168 static void spr_read_tbl (void *opaque, int gprn, int sprn)
       
   169 {
       
   170     gen_helper_load_tbl(cpu_gpr[gprn]);
       
   171 }
       
   172 
       
   173 static void spr_read_tbu (void *opaque, int gprn, int sprn)
       
   174 {
       
   175     gen_helper_load_tbu(cpu_gpr[gprn]);
       
   176 }
       
   177 
       
   178 __attribute__ (( unused ))
       
   179 static void spr_read_atbl (void *opaque, int gprn, int sprn)
       
   180 {
       
   181     gen_helper_load_atbl(cpu_gpr[gprn]);
       
   182 }
       
   183 
       
   184 __attribute__ (( unused ))
       
   185 static void spr_read_atbu (void *opaque, int gprn, int sprn)
       
   186 {
       
   187     gen_helper_load_atbu(cpu_gpr[gprn]);
       
   188 }
       
   189 
       
   190 #if !defined(CONFIG_USER_ONLY)
       
   191 static void spr_write_tbl (void *opaque, int sprn, int gprn)
       
   192 {
       
   193     gen_helper_store_tbl(cpu_gpr[gprn]);
       
   194 }
       
   195 
       
   196 static void spr_write_tbu (void *opaque, int sprn, int gprn)
       
   197 {
       
   198     gen_helper_store_tbu(cpu_gpr[gprn]);
       
   199 }
       
   200 
       
   201 __attribute__ (( unused ))
       
   202 static void spr_write_atbl (void *opaque, int sprn, int gprn)
       
   203 {
       
   204     gen_helper_store_atbl(cpu_gpr[gprn]);
       
   205 }
       
   206 
       
   207 __attribute__ (( unused ))
       
   208 static void spr_write_atbu (void *opaque, int sprn, int gprn)
       
   209 {
       
   210     gen_helper_store_atbu(cpu_gpr[gprn]);
       
   211 }
       
   212 #endif
       
   213 
       
   214 #if !defined(CONFIG_USER_ONLY)
       
   215 /* IBAT0U...IBAT0U */
       
   216 /* IBAT0L...IBAT7L */
       
   217 static void spr_read_ibat (void *opaque, int gprn, int sprn)
       
   218 {
       
   219     tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, IBAT[sprn & 1][(sprn - SPR_IBAT0U) / 2]));
       
   220 }
       
   221 
       
   222 static void spr_read_ibat_h (void *opaque, int gprn, int sprn)
       
   223 {
       
   224     tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, IBAT[sprn & 1][(sprn - SPR_IBAT4U) / 2]));
       
   225 }
       
   226 
       
   227 static void spr_write_ibatu (void *opaque, int sprn, int gprn)
       
   228 {
       
   229     TCGv_i32 t0 = tcg_const_i32((sprn - SPR_IBAT0U) / 2);
       
   230     gen_helper_store_ibatu(t0, cpu_gpr[gprn]);
       
   231     tcg_temp_free_i32(t0);
       
   232 }
       
   233 
       
   234 static void spr_write_ibatu_h (void *opaque, int sprn, int gprn)
       
   235 {
       
   236     TCGv_i32 t0 = tcg_const_i32((sprn - SPR_IBAT4U) / 2);
       
   237     gen_helper_store_ibatu(t0, cpu_gpr[gprn]);
       
   238     tcg_temp_free_i32(t0);
       
   239 }
       
   240 
       
   241 static void spr_write_ibatl (void *opaque, int sprn, int gprn)
       
   242 {
       
   243     TCGv_i32 t0 = tcg_const_i32((sprn - SPR_IBAT0L) / 2);
       
   244     gen_helper_store_ibatl(t0, cpu_gpr[gprn]);
       
   245     tcg_temp_free_i32(t0);
       
   246 }
       
   247 
       
   248 static void spr_write_ibatl_h (void *opaque, int sprn, int gprn)
       
   249 {
       
   250     TCGv_i32 t0 = tcg_const_i32((sprn - SPR_IBAT4L) / 2);
       
   251     gen_helper_store_ibatl(t0, cpu_gpr[gprn]);
       
   252     tcg_temp_free_i32(t0);
       
   253 }
       
   254 
       
   255 /* DBAT0U...DBAT7U */
       
   256 /* DBAT0L...DBAT7L */
       
   257 static void spr_read_dbat (void *opaque, int gprn, int sprn)
       
   258 {
       
   259     tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, DBAT[sprn & 1][(sprn - SPR_DBAT0U) / 2]));
       
   260 }
       
   261 
       
   262 static void spr_read_dbat_h (void *opaque, int gprn, int sprn)
       
   263 {
       
   264     tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, DBAT[sprn & 1][((sprn - SPR_DBAT4U) / 2) + 4]));
       
   265 }
       
   266 
       
   267 static void spr_write_dbatu (void *opaque, int sprn, int gprn)
       
   268 {
       
   269     TCGv_i32 t0 = tcg_const_i32((sprn - SPR_DBAT0U) / 2);
       
   270     gen_helper_store_dbatu(t0, cpu_gpr[gprn]);
       
   271     tcg_temp_free_i32(t0);
       
   272 }
       
   273 
       
   274 static void spr_write_dbatu_h (void *opaque, int sprn, int gprn)
       
   275 {
       
   276     TCGv_i32 t0 = tcg_const_i32(((sprn - SPR_DBAT4U) / 2) + 4);
       
   277     gen_helper_store_dbatu(t0, cpu_gpr[gprn]);
       
   278     tcg_temp_free_i32(t0);
       
   279 }
       
   280 
       
   281 static void spr_write_dbatl (void *opaque, int sprn, int gprn)
       
   282 {
       
   283     TCGv_i32 t0 = tcg_const_i32((sprn - SPR_DBAT0L) / 2);
       
   284     gen_helper_store_dbatl(t0, cpu_gpr[gprn]);
       
   285     tcg_temp_free_i32(t0);
       
   286 }
       
   287 
       
   288 static void spr_write_dbatl_h (void *opaque, int sprn, int gprn)
       
   289 {
       
   290     TCGv_i32 t0 = tcg_const_i32(((sprn - SPR_DBAT4L) / 2) + 4);
       
   291     gen_helper_store_dbatl(t0, cpu_gpr[gprn]);
       
   292     tcg_temp_free_i32(t0);
       
   293 }
       
   294 
       
   295 /* SDR1 */
       
   296 static void spr_read_sdr1 (void *opaque, int gprn, int sprn)
       
   297 {
       
   298     tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, sdr1));
       
   299 }
       
   300 
       
   301 static void spr_write_sdr1 (void *opaque, int sprn, int gprn)
       
   302 {
       
   303     gen_helper_store_sdr1(cpu_gpr[gprn]);
       
   304 }
       
   305 
       
   306 /* 64 bits PowerPC specific SPRs */
       
   307 /* ASR */
       
   308 #if defined(TARGET_PPC64)
       
   309 static void spr_read_asr (void *opaque, int gprn, int sprn)
       
   310 {
       
   311     tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, asr));
       
   312 }
       
   313 
       
   314 static void spr_write_asr (void *opaque, int sprn, int gprn)
       
   315 {
       
   316     gen_helper_store_asr(cpu_gpr[gprn]);
       
   317 }
       
   318 #endif
       
   319 #endif
       
   320 
       
   321 /* PowerPC 601 specific registers */
       
   322 /* RTC */
       
   323 static void spr_read_601_rtcl (void *opaque, int gprn, int sprn)
       
   324 {
       
   325     gen_helper_load_601_rtcl(cpu_gpr[gprn]);
       
   326 }
       
   327 
       
   328 static void spr_read_601_rtcu (void *opaque, int gprn, int sprn)
       
   329 {
       
   330     gen_helper_load_601_rtcu(cpu_gpr[gprn]);
       
   331 }
       
   332 
       
   333 #if !defined(CONFIG_USER_ONLY)
       
   334 static void spr_write_601_rtcu (void *opaque, int sprn, int gprn)
       
   335 {
       
   336     gen_helper_store_601_rtcu(cpu_gpr[gprn]);
       
   337 }
       
   338 
       
   339 static void spr_write_601_rtcl (void *opaque, int sprn, int gprn)
       
   340 {
       
   341     gen_helper_store_601_rtcl(cpu_gpr[gprn]);
       
   342 }
       
   343 
       
   344 static void spr_write_hid0_601 (void *opaque, int sprn, int gprn)
       
   345 {
       
   346     DisasContext *ctx = opaque;
       
   347 
       
   348     gen_helper_store_hid0_601(cpu_gpr[gprn]);
       
   349     /* Must stop the translation as endianness may have changed */
       
   350     gen_stop_exception(ctx);
       
   351 }
       
   352 #endif
       
   353 
       
   354 /* Unified bats */
       
   355 #if !defined(CONFIG_USER_ONLY)
       
   356 static void spr_read_601_ubat (void *opaque, int gprn, int sprn)
       
   357 {
       
   358     tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, IBAT[sprn & 1][(sprn - SPR_IBAT0U) / 2]));
       
   359 }
       
   360 
       
   361 static void spr_write_601_ubatu (void *opaque, int sprn, int gprn)
       
   362 {
       
   363     TCGv_i32 t0 = tcg_const_i32((sprn - SPR_IBAT0U) / 2);
       
   364     gen_helper_store_601_batl(t0, cpu_gpr[gprn]);
       
   365     tcg_temp_free_i32(t0);
       
   366 }
       
   367 
       
   368 static void spr_write_601_ubatl (void *opaque, int sprn, int gprn)
       
   369 {
       
   370     TCGv_i32 t0 = tcg_const_i32((sprn - SPR_IBAT0U) / 2);
       
   371     gen_helper_store_601_batu(t0, cpu_gpr[gprn]);
       
   372     tcg_temp_free_i32(t0);
       
   373 }
       
   374 #endif
       
   375 
       
   376 /* PowerPC 40x specific registers */
       
   377 #if !defined(CONFIG_USER_ONLY)
       
   378 static void spr_read_40x_pit (void *opaque, int gprn, int sprn)
       
   379 {
       
   380     gen_helper_load_40x_pit(cpu_gpr[gprn]);
       
   381 }
       
   382 
       
   383 static void spr_write_40x_pit (void *opaque, int sprn, int gprn)
       
   384 {
       
   385     gen_helper_store_40x_pit(cpu_gpr[gprn]);
       
   386 }
       
   387 
       
   388 static void spr_write_40x_dbcr0 (void *opaque, int sprn, int gprn)
       
   389 {
       
   390     DisasContext *ctx = opaque;
       
   391 
       
   392     gen_helper_store_40x_dbcr0(cpu_gpr[gprn]);
       
   393     /* We must stop translation as we may have rebooted */
       
   394     gen_stop_exception(ctx);
       
   395 }
       
   396 
       
   397 static void spr_write_40x_sler (void *opaque, int sprn, int gprn)
       
   398 {
       
   399     gen_helper_store_40x_sler(cpu_gpr[gprn]);
       
   400 }
       
   401 
       
   402 static void spr_write_booke_tcr (void *opaque, int sprn, int gprn)
       
   403 {
       
   404     gen_helper_store_booke_tcr(cpu_gpr[gprn]);
       
   405 }
       
   406 
       
   407 static void spr_write_booke_tsr (void *opaque, int sprn, int gprn)
       
   408 {
       
   409     gen_helper_store_booke_tsr(cpu_gpr[gprn]);
       
   410 }
       
   411 #endif
       
   412 
       
   413 /* PowerPC 403 specific registers */
       
   414 /* PBL1 / PBU1 / PBL2 / PBU2 */
       
   415 #if !defined(CONFIG_USER_ONLY)
       
   416 static void spr_read_403_pbr (void *opaque, int gprn, int sprn)
       
   417 {
       
   418     tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, pb[sprn - SPR_403_PBL1]));
       
   419 }
       
   420 
       
   421 static void spr_write_403_pbr (void *opaque, int sprn, int gprn)
       
   422 {
       
   423     TCGv_i32 t0 = tcg_const_i32(sprn - SPR_403_PBL1);
       
   424     gen_helper_store_403_pbr(t0, cpu_gpr[gprn]);
       
   425     tcg_temp_free_i32(t0);
       
   426 }
       
   427 
       
   428 static void spr_write_pir (void *opaque, int sprn, int gprn)
       
   429 {
       
   430     TCGv t0 = tcg_temp_new();
       
   431     tcg_gen_andi_tl(t0, cpu_gpr[gprn], 0xF);
       
   432     gen_store_spr(SPR_PIR, t0);
       
   433     tcg_temp_free(t0);
       
   434 }
       
   435 #endif
       
   436 
       
   437 /* E500 specific registers */
       
   438 static void spr_read_spefscr (void *opaque, int gprn, int sprn)
       
   439 {
       
   440     TCGv_i32 tmp = tcg_temp_new_i32();
       
   441     tcg_gen_trunc_tl_i32(tmp, cpu_gpr[gprn]);
       
   442     tcg_gen_ld_i32(tmp, cpu_env, offsetof(CPUState, spe_fscr));
       
   443     tcg_temp_free_i32(tmp);
       
   444 }
       
   445 
       
   446 static void spr_write_spefscr (void *opaque, int sprn, int gprn)
       
   447 {
       
   448     TCGv_i32 tmp = tcg_temp_new_i32();
       
   449     tcg_gen_st_i32(tmp, cpu_env, offsetof(CPUState, spe_fscr));
       
   450     tcg_gen_extu_i32_tl(cpu_gpr[gprn], tmp);
       
   451     tcg_temp_free_i32(tmp);
       
   452 }
       
   453 
       
   454 #if !defined(CONFIG_USER_ONLY)
       
   455 /* Callback used to write the exception vector base */
       
   456 static void spr_write_excp_prefix (void *opaque, int sprn, int gprn)
       
   457 {
       
   458     TCGv t0 = tcg_temp_new();
       
   459     tcg_gen_ld_tl(t0, cpu_env, offsetof(CPUState, ivpr_mask));
       
   460     tcg_gen_and_tl(t0, t0, cpu_gpr[gprn]);
       
   461     tcg_gen_st_tl(t0, cpu_env, offsetof(CPUState, excp_prefix));
       
   462     gen_store_spr(sprn, t0);
       
   463 }
       
   464 
       
   465 static void spr_write_excp_vector (void *opaque, int sprn, int gprn)
       
   466 {
       
   467     DisasContext *ctx = opaque;
       
   468 
       
   469     if (sprn >= SPR_BOOKE_IVOR0 && sprn <= SPR_BOOKE_IVOR15) {
       
   470         TCGv t0 = tcg_temp_new();
       
   471         tcg_gen_ld_tl(t0, cpu_env, offsetof(CPUState, ivor_mask));
       
   472         tcg_gen_and_tl(t0, t0, cpu_gpr[gprn]);
       
   473         tcg_gen_st_tl(t0, cpu_env, offsetof(CPUState, excp_vectors[sprn - SPR_BOOKE_IVOR0]));
       
   474         gen_store_spr(sprn, t0);
       
   475         tcg_temp_free(t0);
       
   476     } else if (sprn >= SPR_BOOKE_IVOR32 && sprn <= SPR_BOOKE_IVOR37) {
       
   477         TCGv t0 = tcg_temp_new();
       
   478         tcg_gen_ld_tl(t0, cpu_env, offsetof(CPUState, ivor_mask));
       
   479         tcg_gen_and_tl(t0, t0, cpu_gpr[gprn]);
       
   480         tcg_gen_st_tl(t0, cpu_env, offsetof(CPUState, excp_vectors[sprn - SPR_BOOKE_IVOR32 + 32]));
       
   481         gen_store_spr(sprn, t0);
       
   482         tcg_temp_free(t0);
       
   483     } else {
       
   484         printf("Trying to write an unknown exception vector %d %03x\n",
       
   485                sprn, sprn);
       
   486         gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);
       
   487     }
       
   488 }
       
   489 #endif
       
   490 
       
   491 #if defined(CONFIG_USER_ONLY)
       
   492 #define spr_register(env, num, name, uea_read, uea_write,                     \
       
   493                      oea_read, oea_write, initial_value)                      \
       
   494 do {                                                                          \
       
   495      _spr_register(env, num, name, uea_read, uea_write, initial_value);       \
       
   496 } while (0)
       
   497 static inline void _spr_register (CPUPPCState *env, int num,
       
   498                                   const char *name,
       
   499                                   void (*uea_read)(void *opaque, int gprn, int sprn),
       
   500                                   void (*uea_write)(void *opaque, int sprn, int gprn),
       
   501                                   target_ulong initial_value)
       
   502 #else
       
   503 static inline void spr_register (CPUPPCState *env, int num,
       
   504                                  const char *name,
       
   505                                  void (*uea_read)(void *opaque, int gprn, int sprn),
       
   506                                  void (*uea_write)(void *opaque, int sprn, int gprn),
       
   507                                  void (*oea_read)(void *opaque, int gprn, int sprn),
       
   508                                  void (*oea_write)(void *opaque, int sprn, int gprn),
       
   509                                  target_ulong initial_value)
       
   510 #endif
       
   511 {
       
   512     ppc_spr_t *spr;
       
   513 
       
   514     spr = &env->spr_cb[num];
       
   515     if (spr->name != NULL ||env-> spr[num] != 0x00000000 ||
       
   516 #if !defined(CONFIG_USER_ONLY)
       
   517         spr->oea_read != NULL || spr->oea_write != NULL ||
       
   518 #endif
       
   519         spr->uea_read != NULL || spr->uea_write != NULL) {
       
   520         printf("Error: Trying to register SPR %d (%03x) twice !\n", num, num);
       
   521         exit(1);
       
   522     }
       
   523 #if defined(PPC_DEBUG_SPR)
       
   524     printf("*** register spr %d (%03x) %s val " ADDRX "\n", num, num, name,
       
   525            initial_value);
       
   526 #endif
       
   527     spr->name = name;
       
   528     spr->uea_read = uea_read;
       
   529     spr->uea_write = uea_write;
       
   530 #if !defined(CONFIG_USER_ONLY)
       
   531     spr->oea_read = oea_read;
       
   532     spr->oea_write = oea_write;
       
   533 #endif
       
   534     env->spr[num] = initial_value;
       
   535 }
       
   536 
       
   537 /* Generic PowerPC SPRs */
       
   538 static void gen_spr_generic (CPUPPCState *env)
       
   539 {
       
   540     /* Integer processing */
       
   541     spr_register(env, SPR_XER, "XER",
       
   542                  &spr_read_xer, &spr_write_xer,
       
   543                  &spr_read_xer, &spr_write_xer,
       
   544                  0x00000000);
       
   545     /* Branch contol */
       
   546     spr_register(env, SPR_LR, "LR",
       
   547                  &spr_read_lr, &spr_write_lr,
       
   548                  &spr_read_lr, &spr_write_lr,
       
   549                  0x00000000);
       
   550     spr_register(env, SPR_CTR, "CTR",
       
   551                  &spr_read_ctr, &spr_write_ctr,
       
   552                  &spr_read_ctr, &spr_write_ctr,
       
   553                  0x00000000);
       
   554     /* Interrupt processing */
       
   555     spr_register(env, SPR_SRR0, "SRR0",
       
   556                  SPR_NOACCESS, SPR_NOACCESS,
       
   557                  &spr_read_generic, &spr_write_generic,
       
   558                  0x00000000);
       
   559     spr_register(env, SPR_SRR1, "SRR1",
       
   560                  SPR_NOACCESS, SPR_NOACCESS,
       
   561                  &spr_read_generic, &spr_write_generic,
       
   562                  0x00000000);
       
   563     /* Processor control */
       
   564     spr_register(env, SPR_SPRG0, "SPRG0",
       
   565                  SPR_NOACCESS, SPR_NOACCESS,
       
   566                  &spr_read_generic, &spr_write_generic,
       
   567                  0x00000000);
       
   568     spr_register(env, SPR_SPRG1, "SPRG1",
       
   569                  SPR_NOACCESS, SPR_NOACCESS,
       
   570                  &spr_read_generic, &spr_write_generic,
       
   571                  0x00000000);
       
   572     spr_register(env, SPR_SPRG2, "SPRG2",
       
   573                  SPR_NOACCESS, SPR_NOACCESS,
       
   574                  &spr_read_generic, &spr_write_generic,
       
   575                  0x00000000);
       
   576     spr_register(env, SPR_SPRG3, "SPRG3",
       
   577                  SPR_NOACCESS, SPR_NOACCESS,
       
   578                  &spr_read_generic, &spr_write_generic,
       
   579                  0x00000000);
       
   580 }
       
   581 
       
   582 /* SPR common to all non-embedded PowerPC, including 601 */
       
   583 static void gen_spr_ne_601 (CPUPPCState *env)
       
   584 {
       
   585     /* Exception processing */
       
   586     spr_register(env, SPR_DSISR, "DSISR",
       
   587                  SPR_NOACCESS, SPR_NOACCESS,
       
   588                  &spr_read_generic, &spr_write_generic,
       
   589                  0x00000000);
       
   590     spr_register(env, SPR_DAR, "DAR",
       
   591                  SPR_NOACCESS, SPR_NOACCESS,
       
   592                  &spr_read_generic, &spr_write_generic,
       
   593                  0x00000000);
       
   594     /* Timer */
       
   595     spr_register(env, SPR_DECR, "DECR",
       
   596                  SPR_NOACCESS, SPR_NOACCESS,
       
   597                  &spr_read_decr, &spr_write_decr,
       
   598                  0x00000000);
       
   599     /* Memory management */
       
   600     spr_register(env, SPR_SDR1, "SDR1",
       
   601                  SPR_NOACCESS, SPR_NOACCESS,
       
   602                  &spr_read_sdr1, &spr_write_sdr1,
       
   603                  0x00000000);
       
   604 }
       
   605 
       
   606 /* BATs 0-3 */
       
   607 static void gen_low_BATs (CPUPPCState *env)
       
   608 {
       
   609 #if !defined(CONFIG_USER_ONLY)
       
   610     spr_register(env, SPR_IBAT0U, "IBAT0U",
       
   611                  SPR_NOACCESS, SPR_NOACCESS,
       
   612                  &spr_read_ibat, &spr_write_ibatu,
       
   613                  0x00000000);
       
   614     spr_register(env, SPR_IBAT0L, "IBAT0L",
       
   615                  SPR_NOACCESS, SPR_NOACCESS,
       
   616                  &spr_read_ibat, &spr_write_ibatl,
       
   617                  0x00000000);
       
   618     spr_register(env, SPR_IBAT1U, "IBAT1U",
       
   619                  SPR_NOACCESS, SPR_NOACCESS,
       
   620                  &spr_read_ibat, &spr_write_ibatu,
       
   621                  0x00000000);
       
   622     spr_register(env, SPR_IBAT1L, "IBAT1L",
       
   623                  SPR_NOACCESS, SPR_NOACCESS,
       
   624                  &spr_read_ibat, &spr_write_ibatl,
       
   625                  0x00000000);
       
   626     spr_register(env, SPR_IBAT2U, "IBAT2U",
       
   627                  SPR_NOACCESS, SPR_NOACCESS,
       
   628                  &spr_read_ibat, &spr_write_ibatu,
       
   629                  0x00000000);
       
   630     spr_register(env, SPR_IBAT2L, "IBAT2L",
       
   631                  SPR_NOACCESS, SPR_NOACCESS,
       
   632                  &spr_read_ibat, &spr_write_ibatl,
       
   633                  0x00000000);
       
   634     spr_register(env, SPR_IBAT3U, "IBAT3U",
       
   635                  SPR_NOACCESS, SPR_NOACCESS,
       
   636                  &spr_read_ibat, &spr_write_ibatu,
       
   637                  0x00000000);
       
   638     spr_register(env, SPR_IBAT3L, "IBAT3L",
       
   639                  SPR_NOACCESS, SPR_NOACCESS,
       
   640                  &spr_read_ibat, &spr_write_ibatl,
       
   641                  0x00000000);
       
   642     spr_register(env, SPR_DBAT0U, "DBAT0U",
       
   643                  SPR_NOACCESS, SPR_NOACCESS,
       
   644                  &spr_read_dbat, &spr_write_dbatu,
       
   645                  0x00000000);
       
   646     spr_register(env, SPR_DBAT0L, "DBAT0L",
       
   647                  SPR_NOACCESS, SPR_NOACCESS,
       
   648                  &spr_read_dbat, &spr_write_dbatl,
       
   649                  0x00000000);
       
   650     spr_register(env, SPR_DBAT1U, "DBAT1U",
       
   651                  SPR_NOACCESS, SPR_NOACCESS,
       
   652                  &spr_read_dbat, &spr_write_dbatu,
       
   653                  0x00000000);
       
   654     spr_register(env, SPR_DBAT1L, "DBAT1L",
       
   655                  SPR_NOACCESS, SPR_NOACCESS,
       
   656                  &spr_read_dbat, &spr_write_dbatl,
       
   657                  0x00000000);
       
   658     spr_register(env, SPR_DBAT2U, "DBAT2U",
       
   659                  SPR_NOACCESS, SPR_NOACCESS,
       
   660                  &spr_read_dbat, &spr_write_dbatu,
       
   661                  0x00000000);
       
   662     spr_register(env, SPR_DBAT2L, "DBAT2L",
       
   663                  SPR_NOACCESS, SPR_NOACCESS,
       
   664                  &spr_read_dbat, &spr_write_dbatl,
       
   665                  0x00000000);
       
   666     spr_register(env, SPR_DBAT3U, "DBAT3U",
       
   667                  SPR_NOACCESS, SPR_NOACCESS,
       
   668                  &spr_read_dbat, &spr_write_dbatu,
       
   669                  0x00000000);
       
   670     spr_register(env, SPR_DBAT3L, "DBAT3L",
       
   671                  SPR_NOACCESS, SPR_NOACCESS,
       
   672                  &spr_read_dbat, &spr_write_dbatl,
       
   673                  0x00000000);
       
   674     env->nb_BATs += 4;
       
   675 #endif
       
   676 }
       
   677 
       
   678 /* BATs 4-7 */
       
   679 static void gen_high_BATs (CPUPPCState *env)
       
   680 {
       
   681 #if !defined(CONFIG_USER_ONLY)
       
   682     spr_register(env, SPR_IBAT4U, "IBAT4U",
       
   683                  SPR_NOACCESS, SPR_NOACCESS,
       
   684                  &spr_read_ibat_h, &spr_write_ibatu_h,
       
   685                  0x00000000);
       
   686     spr_register(env, SPR_IBAT4L, "IBAT4L",
       
   687                  SPR_NOACCESS, SPR_NOACCESS,
       
   688                  &spr_read_ibat_h, &spr_write_ibatl_h,
       
   689                  0x00000000);
       
   690     spr_register(env, SPR_IBAT5U, "IBAT5U",
       
   691                  SPR_NOACCESS, SPR_NOACCESS,
       
   692                  &spr_read_ibat_h, &spr_write_ibatu_h,
       
   693                  0x00000000);
       
   694     spr_register(env, SPR_IBAT5L, "IBAT5L",
       
   695                  SPR_NOACCESS, SPR_NOACCESS,
       
   696                  &spr_read_ibat_h, &spr_write_ibatl_h,
       
   697                  0x00000000);
       
   698     spr_register(env, SPR_IBAT6U, "IBAT6U",
       
   699                  SPR_NOACCESS, SPR_NOACCESS,
       
   700                  &spr_read_ibat_h, &spr_write_ibatu_h,
       
   701                  0x00000000);
       
   702     spr_register(env, SPR_IBAT6L, "IBAT6L",
       
   703                  SPR_NOACCESS, SPR_NOACCESS,
       
   704                  &spr_read_ibat_h, &spr_write_ibatl_h,
       
   705                  0x00000000);
       
   706     spr_register(env, SPR_IBAT7U, "IBAT7U",
       
   707                  SPR_NOACCESS, SPR_NOACCESS,
       
   708                  &spr_read_ibat_h, &spr_write_ibatu_h,
       
   709                  0x00000000);
       
   710     spr_register(env, SPR_IBAT7L, "IBAT7L",
       
   711                  SPR_NOACCESS, SPR_NOACCESS,
       
   712                  &spr_read_ibat_h, &spr_write_ibatl_h,
       
   713                  0x00000000);
       
   714     spr_register(env, SPR_DBAT4U, "DBAT4U",
       
   715                  SPR_NOACCESS, SPR_NOACCESS,
       
   716                  &spr_read_dbat_h, &spr_write_dbatu_h,
       
   717                  0x00000000);
       
   718     spr_register(env, SPR_DBAT4L, "DBAT4L",
       
   719                  SPR_NOACCESS, SPR_NOACCESS,
       
   720                  &spr_read_dbat_h, &spr_write_dbatl_h,
       
   721                  0x00000000);
       
   722     spr_register(env, SPR_DBAT5U, "DBAT5U",
       
   723                  SPR_NOACCESS, SPR_NOACCESS,
       
   724                  &spr_read_dbat_h, &spr_write_dbatu_h,
       
   725                  0x00000000);
       
   726     spr_register(env, SPR_DBAT5L, "DBAT5L",
       
   727                  SPR_NOACCESS, SPR_NOACCESS,
       
   728                  &spr_read_dbat_h, &spr_write_dbatl_h,
       
   729                  0x00000000);
       
   730     spr_register(env, SPR_DBAT6U, "DBAT6U",
       
   731                  SPR_NOACCESS, SPR_NOACCESS,
       
   732                  &spr_read_dbat_h, &spr_write_dbatu_h,
       
   733                  0x00000000);
       
   734     spr_register(env, SPR_DBAT6L, "DBAT6L",
       
   735                  SPR_NOACCESS, SPR_NOACCESS,
       
   736                  &spr_read_dbat_h, &spr_write_dbatl_h,
       
   737                  0x00000000);
       
   738     spr_register(env, SPR_DBAT7U, "DBAT7U",
       
   739                  SPR_NOACCESS, SPR_NOACCESS,
       
   740                  &spr_read_dbat_h, &spr_write_dbatu_h,
       
   741                  0x00000000);
       
   742     spr_register(env, SPR_DBAT7L, "DBAT7L",
       
   743                  SPR_NOACCESS, SPR_NOACCESS,
       
   744                  &spr_read_dbat_h, &spr_write_dbatl_h,
       
   745                  0x00000000);
       
   746     env->nb_BATs += 4;
       
   747 #endif
       
   748 }
       
   749 
       
   750 /* Generic PowerPC time base */
       
   751 static void gen_tbl (CPUPPCState *env)
       
   752 {
       
   753     spr_register(env, SPR_VTBL,  "TBL",
       
   754                  &spr_read_tbl, SPR_NOACCESS,
       
   755                  &spr_read_tbl, SPR_NOACCESS,
       
   756                  0x00000000);
       
   757     spr_register(env, SPR_TBL,   "TBL",
       
   758                  SPR_NOACCESS, SPR_NOACCESS,
       
   759                  SPR_NOACCESS, &spr_write_tbl,
       
   760                  0x00000000);
       
   761     spr_register(env, SPR_VTBU,  "TBU",
       
   762                  &spr_read_tbu, SPR_NOACCESS,
       
   763                  &spr_read_tbu, SPR_NOACCESS,
       
   764                  0x00000000);
       
   765     spr_register(env, SPR_TBU,   "TBU",
       
   766                  SPR_NOACCESS, SPR_NOACCESS,
       
   767                  SPR_NOACCESS, &spr_write_tbu,
       
   768                  0x00000000);
       
   769 }
       
   770 
       
   771 /* Softare table search registers */
       
   772 static void gen_6xx_7xx_soft_tlb (CPUPPCState *env, int nb_tlbs, int nb_ways)
       
   773 {
       
   774 #if !defined(CONFIG_USER_ONLY)
       
   775     env->nb_tlb = nb_tlbs;
       
   776     env->nb_ways = nb_ways;
       
   777     env->id_tlbs = 1;
       
   778     spr_register(env, SPR_DMISS, "DMISS",
       
   779                  SPR_NOACCESS, SPR_NOACCESS,
       
   780                  &spr_read_generic, SPR_NOACCESS,
       
   781                  0x00000000);
       
   782     spr_register(env, SPR_DCMP, "DCMP",
       
   783                  SPR_NOACCESS, SPR_NOACCESS,
       
   784                  &spr_read_generic, SPR_NOACCESS,
       
   785                  0x00000000);
       
   786     spr_register(env, SPR_HASH1, "HASH1",
       
   787                  SPR_NOACCESS, SPR_NOACCESS,
       
   788                  &spr_read_generic, SPR_NOACCESS,
       
   789                  0x00000000);
       
   790     spr_register(env, SPR_HASH2, "HASH2",
       
   791                  SPR_NOACCESS, SPR_NOACCESS,
       
   792                  &spr_read_generic, SPR_NOACCESS,
       
   793                  0x00000000);
       
   794     spr_register(env, SPR_IMISS, "IMISS",
       
   795                  SPR_NOACCESS, SPR_NOACCESS,
       
   796                  &spr_read_generic, SPR_NOACCESS,
       
   797                  0x00000000);
       
   798     spr_register(env, SPR_ICMP, "ICMP",
       
   799                  SPR_NOACCESS, SPR_NOACCESS,
       
   800                  &spr_read_generic, SPR_NOACCESS,
       
   801                  0x00000000);
       
   802     spr_register(env, SPR_RPA, "RPA",
       
   803                  SPR_NOACCESS, SPR_NOACCESS,
       
   804                  &spr_read_generic, &spr_write_generic,
       
   805                  0x00000000);
       
   806 #endif
       
   807 }
       
   808 
       
   809 /* SPR common to MPC755 and G2 */
       
   810 static void gen_spr_G2_755 (CPUPPCState *env)
       
   811 {
       
   812     /* SGPRs */
       
   813     spr_register(env, SPR_SPRG4, "SPRG4",
       
   814                  SPR_NOACCESS, SPR_NOACCESS,
       
   815                  &spr_read_generic, &spr_write_generic,
       
   816                  0x00000000);
       
   817     spr_register(env, SPR_SPRG5, "SPRG5",
       
   818                  SPR_NOACCESS, SPR_NOACCESS,
       
   819                  &spr_read_generic, &spr_write_generic,
       
   820                  0x00000000);
       
   821     spr_register(env, SPR_SPRG6, "SPRG6",
       
   822                  SPR_NOACCESS, SPR_NOACCESS,
       
   823                  &spr_read_generic, &spr_write_generic,
       
   824                  0x00000000);
       
   825     spr_register(env, SPR_SPRG7, "SPRG7",
       
   826                  SPR_NOACCESS, SPR_NOACCESS,
       
   827                  &spr_read_generic, &spr_write_generic,
       
   828                  0x00000000);
       
   829 }
       
   830 
       
   831 /* SPR common to all 7xx PowerPC implementations */
       
   832 static void gen_spr_7xx (CPUPPCState *env)
       
   833 {
       
   834     /* Breakpoints */
       
   835     /* XXX : not implemented */
       
   836     spr_register(env, SPR_DABR, "DABR",
       
   837                  SPR_NOACCESS, SPR_NOACCESS,
       
   838                  &spr_read_generic, &spr_write_generic,
       
   839                  0x00000000);
       
   840     /* XXX : not implemented */
       
   841     spr_register(env, SPR_IABR, "IABR",
       
   842                  SPR_NOACCESS, SPR_NOACCESS,
       
   843                  &spr_read_generic, &spr_write_generic,
       
   844                  0x00000000);
       
   845     /* Cache management */
       
   846     /* XXX : not implemented */
       
   847     spr_register(env, SPR_ICTC, "ICTC",
       
   848                  SPR_NOACCESS, SPR_NOACCESS,
       
   849                  &spr_read_generic, &spr_write_generic,
       
   850                  0x00000000);
       
   851     /* Performance monitors */
       
   852     /* XXX : not implemented */
       
   853     spr_register(env, SPR_MMCR0, "MMCR0",
       
   854                  SPR_NOACCESS, SPR_NOACCESS,
       
   855                  &spr_read_generic, &spr_write_generic,
       
   856                  0x00000000);
       
   857     /* XXX : not implemented */
       
   858     spr_register(env, SPR_MMCR1, "MMCR1",
       
   859                  SPR_NOACCESS, SPR_NOACCESS,
       
   860                  &spr_read_generic, &spr_write_generic,
       
   861                  0x00000000);
       
   862     /* XXX : not implemented */
       
   863     spr_register(env, SPR_PMC1, "PMC1",
       
   864                  SPR_NOACCESS, SPR_NOACCESS,
       
   865                  &spr_read_generic, &spr_write_generic,
       
   866                  0x00000000);
       
   867     /* XXX : not implemented */
       
   868     spr_register(env, SPR_PMC2, "PMC2",
       
   869                  SPR_NOACCESS, SPR_NOACCESS,
       
   870                  &spr_read_generic, &spr_write_generic,
       
   871                  0x00000000);
       
   872     /* XXX : not implemented */
       
   873     spr_register(env, SPR_PMC3, "PMC3",
       
   874                  SPR_NOACCESS, SPR_NOACCESS,
       
   875                  &spr_read_generic, &spr_write_generic,
       
   876                  0x00000000);
       
   877     /* XXX : not implemented */
       
   878     spr_register(env, SPR_PMC4, "PMC4",
       
   879                  SPR_NOACCESS, SPR_NOACCESS,
       
   880                  &spr_read_generic, &spr_write_generic,
       
   881                  0x00000000);
       
   882     /* XXX : not implemented */
       
   883     spr_register(env, SPR_SIAR, "SIAR",
       
   884                  SPR_NOACCESS, SPR_NOACCESS,
       
   885                  &spr_read_generic, SPR_NOACCESS,
       
   886                  0x00000000);
       
   887     /* XXX : not implemented */
       
   888     spr_register(env, SPR_UMMCR0, "UMMCR0",
       
   889                  &spr_read_ureg, SPR_NOACCESS,
       
   890                  &spr_read_ureg, SPR_NOACCESS,
       
   891                  0x00000000);
       
   892     /* XXX : not implemented */
       
   893     spr_register(env, SPR_UMMCR1, "UMMCR1",
       
   894                  &spr_read_ureg, SPR_NOACCESS,
       
   895                  &spr_read_ureg, SPR_NOACCESS,
       
   896                  0x00000000);
       
   897     /* XXX : not implemented */
       
   898     spr_register(env, SPR_UPMC1, "UPMC1",
       
   899                  &spr_read_ureg, SPR_NOACCESS,
       
   900                  &spr_read_ureg, SPR_NOACCESS,
       
   901                  0x00000000);
       
   902     /* XXX : not implemented */
       
   903     spr_register(env, SPR_UPMC2, "UPMC2",
       
   904                  &spr_read_ureg, SPR_NOACCESS,
       
   905                  &spr_read_ureg, SPR_NOACCESS,
       
   906                  0x00000000);
       
   907     /* XXX : not implemented */
       
   908     spr_register(env, SPR_UPMC3, "UPMC3",
       
   909                  &spr_read_ureg, SPR_NOACCESS,
       
   910                  &spr_read_ureg, SPR_NOACCESS,
       
   911                  0x00000000);
       
   912     /* XXX : not implemented */
       
   913     spr_register(env, SPR_UPMC4, "UPMC4",
       
   914                  &spr_read_ureg, SPR_NOACCESS,
       
   915                  &spr_read_ureg, SPR_NOACCESS,
       
   916                  0x00000000);
       
   917     /* XXX : not implemented */
       
   918     spr_register(env, SPR_USIAR, "USIAR",
       
   919                  &spr_read_ureg, SPR_NOACCESS,
       
   920                  &spr_read_ureg, SPR_NOACCESS,
       
   921                  0x00000000);
       
   922     /* External access control */
       
   923     /* XXX : not implemented */
       
   924     spr_register(env, SPR_EAR, "EAR",
       
   925                  SPR_NOACCESS, SPR_NOACCESS,
       
   926                  &spr_read_generic, &spr_write_generic,
       
   927                  0x00000000);
       
   928 }
       
   929 
       
   930 static void gen_spr_thrm (CPUPPCState *env)
       
   931 {
       
   932     /* Thermal management */
       
   933     /* XXX : not implemented */
       
   934     spr_register(env, SPR_THRM1, "THRM1",
       
   935                  SPR_NOACCESS, SPR_NOACCESS,
       
   936                  &spr_read_generic, &spr_write_generic,
       
   937                  0x00000000);
       
   938     /* XXX : not implemented */
       
   939     spr_register(env, SPR_THRM2, "THRM2",
       
   940                  SPR_NOACCESS, SPR_NOACCESS,
       
   941                  &spr_read_generic, &spr_write_generic,
       
   942                  0x00000000);
       
   943     /* XXX : not implemented */
       
   944     spr_register(env, SPR_THRM3, "THRM3",
       
   945                  SPR_NOACCESS, SPR_NOACCESS,
       
   946                  &spr_read_generic, &spr_write_generic,
       
   947                  0x00000000);
       
   948 }
       
   949 
       
   950 /* SPR specific to PowerPC 604 implementation */
       
   951 static void gen_spr_604 (CPUPPCState *env)
       
   952 {
       
   953     /* Processor identification */
       
   954     spr_register(env, SPR_PIR, "PIR",
       
   955                  SPR_NOACCESS, SPR_NOACCESS,
       
   956                  &spr_read_generic, &spr_write_pir,
       
   957                  0x00000000);
       
   958     /* Breakpoints */
       
   959     /* XXX : not implemented */
       
   960     spr_register(env, SPR_IABR, "IABR",
       
   961                  SPR_NOACCESS, SPR_NOACCESS,
       
   962                  &spr_read_generic, &spr_write_generic,
       
   963                  0x00000000);
       
   964     /* XXX : not implemented */
       
   965     spr_register(env, SPR_DABR, "DABR",
       
   966                  SPR_NOACCESS, SPR_NOACCESS,
       
   967                  &spr_read_generic, &spr_write_generic,
       
   968                  0x00000000);
       
   969     /* Performance counters */
       
   970     /* XXX : not implemented */
       
   971     spr_register(env, SPR_MMCR0, "MMCR0",
       
   972                  SPR_NOACCESS, SPR_NOACCESS,
       
   973                  &spr_read_generic, &spr_write_generic,
       
   974                  0x00000000);
       
   975     /* XXX : not implemented */
       
   976     spr_register(env, SPR_PMC1, "PMC1",
       
   977                  SPR_NOACCESS, SPR_NOACCESS,
       
   978                  &spr_read_generic, &spr_write_generic,
       
   979                  0x00000000);
       
   980     /* XXX : not implemented */
       
   981     spr_register(env, SPR_PMC2, "PMC2",
       
   982                  SPR_NOACCESS, SPR_NOACCESS,
       
   983                  &spr_read_generic, &spr_write_generic,
       
   984                  0x00000000);
       
   985     /* XXX : not implemented */
       
   986     spr_register(env, SPR_SIAR, "SIAR",
       
   987                  SPR_NOACCESS, SPR_NOACCESS,
       
   988                  &spr_read_generic, SPR_NOACCESS,
       
   989                  0x00000000);
       
   990     /* XXX : not implemented */
       
   991     spr_register(env, SPR_SDA, "SDA",
       
   992                  SPR_NOACCESS, SPR_NOACCESS,
       
   993                  &spr_read_generic, SPR_NOACCESS,
       
   994                  0x00000000);
       
   995     /* External access control */
       
   996     /* XXX : not implemented */
       
   997     spr_register(env, SPR_EAR, "EAR",
       
   998                  SPR_NOACCESS, SPR_NOACCESS,
       
   999                  &spr_read_generic, &spr_write_generic,
       
  1000                  0x00000000);
       
  1001 }
       
  1002 
       
  1003 /* SPR specific to PowerPC 603 implementation */
       
  1004 static void gen_spr_603 (CPUPPCState *env)
       
  1005 {
       
  1006     /* External access control */
       
  1007     /* XXX : not implemented */
       
  1008     spr_register(env, SPR_EAR, "EAR",
       
  1009                  SPR_NOACCESS, SPR_NOACCESS,
       
  1010                  &spr_read_generic, &spr_write_generic,
       
  1011                  0x00000000);
       
  1012 }
       
  1013 
       
  1014 /* SPR specific to PowerPC G2 implementation */
       
  1015 static void gen_spr_G2 (CPUPPCState *env)
       
  1016 {
       
  1017     /* Memory base address */
       
  1018     /* MBAR */
       
  1019     /* XXX : not implemented */
       
  1020     spr_register(env, SPR_MBAR, "MBAR",
       
  1021                  SPR_NOACCESS, SPR_NOACCESS,
       
  1022                  &spr_read_generic, &spr_write_generic,
       
  1023                  0x00000000);
       
  1024     /* Exception processing */
       
  1025     spr_register(env, SPR_BOOKE_CSRR0, "CSRR0",
       
  1026                  SPR_NOACCESS, SPR_NOACCESS,
       
  1027                  &spr_read_generic, &spr_write_generic,
       
  1028                  0x00000000);
       
  1029     spr_register(env, SPR_BOOKE_CSRR1, "CSRR1",
       
  1030                  SPR_NOACCESS, SPR_NOACCESS,
       
  1031                  &spr_read_generic, &spr_write_generic,
       
  1032                  0x00000000);
       
  1033     /* Breakpoints */
       
  1034     /* XXX : not implemented */
       
  1035     spr_register(env, SPR_DABR, "DABR",
       
  1036                  SPR_NOACCESS, SPR_NOACCESS,
       
  1037                  &spr_read_generic, &spr_write_generic,
       
  1038                  0x00000000);
       
  1039     /* XXX : not implemented */
       
  1040     spr_register(env, SPR_DABR2, "DABR2",
       
  1041                  SPR_NOACCESS, SPR_NOACCESS,
       
  1042                  &spr_read_generic, &spr_write_generic,
       
  1043                  0x00000000);
       
  1044     /* XXX : not implemented */
       
  1045     spr_register(env, SPR_IABR, "IABR",
       
  1046                  SPR_NOACCESS, SPR_NOACCESS,
       
  1047                  &spr_read_generic, &spr_write_generic,
       
  1048                  0x00000000);
       
  1049     /* XXX : not implemented */
       
  1050     spr_register(env, SPR_IABR2, "IABR2",
       
  1051                  SPR_NOACCESS, SPR_NOACCESS,
       
  1052                  &spr_read_generic, &spr_write_generic,
       
  1053                  0x00000000);
       
  1054     /* XXX : not implemented */
       
  1055     spr_register(env, SPR_IBCR, "IBCR",
       
  1056                  SPR_NOACCESS, SPR_NOACCESS,
       
  1057                  &spr_read_generic, &spr_write_generic,
       
  1058                  0x00000000);
       
  1059     /* XXX : not implemented */
       
  1060     spr_register(env, SPR_DBCR, "DBCR",
       
  1061                  SPR_NOACCESS, SPR_NOACCESS,
       
  1062                  &spr_read_generic, &spr_write_generic,
       
  1063                  0x00000000);
       
  1064 }
       
  1065 
       
  1066 /* SPR specific to PowerPC 602 implementation */
       
  1067 static void gen_spr_602 (CPUPPCState *env)
       
  1068 {
       
  1069     /* ESA registers */
       
  1070     /* XXX : not implemented */
       
  1071     spr_register(env, SPR_SER, "SER",
       
  1072                  SPR_NOACCESS, SPR_NOACCESS,
       
  1073                  &spr_read_generic, &spr_write_generic,
       
  1074                  0x00000000);
       
  1075     /* XXX : not implemented */
       
  1076     spr_register(env, SPR_SEBR, "SEBR",
       
  1077                  SPR_NOACCESS, SPR_NOACCESS,
       
  1078                  &spr_read_generic, &spr_write_generic,
       
  1079                  0x00000000);
       
  1080     /* XXX : not implemented */
       
  1081     spr_register(env, SPR_ESASRR, "ESASRR",
       
  1082                  SPR_NOACCESS, SPR_NOACCESS,
       
  1083                  &spr_read_generic, &spr_write_generic,
       
  1084                  0x00000000);
       
  1085     /* Floating point status */
       
  1086     /* XXX : not implemented */
       
  1087     spr_register(env, SPR_SP, "SP",
       
  1088                  SPR_NOACCESS, SPR_NOACCESS,
       
  1089                  &spr_read_generic, &spr_write_generic,
       
  1090                  0x00000000);
       
  1091     /* XXX : not implemented */
       
  1092     spr_register(env, SPR_LT, "LT",
       
  1093                  SPR_NOACCESS, SPR_NOACCESS,
       
  1094                  &spr_read_generic, &spr_write_generic,
       
  1095                  0x00000000);
       
  1096     /* Watchdog timer */
       
  1097     /* XXX : not implemented */
       
  1098     spr_register(env, SPR_TCR, "TCR",
       
  1099                  SPR_NOACCESS, SPR_NOACCESS,
       
  1100                  &spr_read_generic, &spr_write_generic,
       
  1101                  0x00000000);
       
  1102     /* Interrupt base */
       
  1103     spr_register(env, SPR_IBR, "IBR",
       
  1104                  SPR_NOACCESS, SPR_NOACCESS,
       
  1105                  &spr_read_generic, &spr_write_generic,
       
  1106                  0x00000000);
       
  1107     /* XXX : not implemented */
       
  1108     spr_register(env, SPR_IABR, "IABR",
       
  1109                  SPR_NOACCESS, SPR_NOACCESS,
       
  1110                  &spr_read_generic, &spr_write_generic,
       
  1111                  0x00000000);
       
  1112 }
       
  1113 
       
  1114 /* SPR specific to PowerPC 601 implementation */
       
  1115 static void gen_spr_601 (CPUPPCState *env)
       
  1116 {
       
  1117     /* Multiplication/division register */
       
  1118     /* MQ */
       
  1119     spr_register(env, SPR_MQ, "MQ",
       
  1120                  &spr_read_generic, &spr_write_generic,
       
  1121                  &spr_read_generic, &spr_write_generic,
       
  1122                  0x00000000);
       
  1123     /* RTC registers */
       
  1124     spr_register(env, SPR_601_RTCU, "RTCU",
       
  1125                  SPR_NOACCESS, SPR_NOACCESS,
       
  1126                  SPR_NOACCESS, &spr_write_601_rtcu,
       
  1127                  0x00000000);
       
  1128     spr_register(env, SPR_601_VRTCU, "RTCU",
       
  1129                  &spr_read_601_rtcu, SPR_NOACCESS,
       
  1130                  &spr_read_601_rtcu, SPR_NOACCESS,
       
  1131                  0x00000000);
       
  1132     spr_register(env, SPR_601_RTCL, "RTCL",
       
  1133                  SPR_NOACCESS, SPR_NOACCESS,
       
  1134                  SPR_NOACCESS, &spr_write_601_rtcl,
       
  1135                  0x00000000);
       
  1136     spr_register(env, SPR_601_VRTCL, "RTCL",
       
  1137                  &spr_read_601_rtcl, SPR_NOACCESS,
       
  1138                  &spr_read_601_rtcl, SPR_NOACCESS,
       
  1139                  0x00000000);
       
  1140     /* Timer */
       
  1141 #if 0 /* ? */
       
  1142     spr_register(env, SPR_601_UDECR, "UDECR",
       
  1143                  &spr_read_decr, SPR_NOACCESS,
       
  1144                  &spr_read_decr, SPR_NOACCESS,
       
  1145                  0x00000000);
       
  1146 #endif
       
  1147     /* External access control */
       
  1148     /* XXX : not implemented */
       
  1149     spr_register(env, SPR_EAR, "EAR",
       
  1150                  SPR_NOACCESS, SPR_NOACCESS,
       
  1151                  &spr_read_generic, &spr_write_generic,
       
  1152                  0x00000000);
       
  1153     /* Memory management */
       
  1154 #if !defined(CONFIG_USER_ONLY)
       
  1155     spr_register(env, SPR_IBAT0U, "IBAT0U",
       
  1156                  SPR_NOACCESS, SPR_NOACCESS,
       
  1157                  &spr_read_601_ubat, &spr_write_601_ubatu,
       
  1158                  0x00000000);
       
  1159     spr_register(env, SPR_IBAT0L, "IBAT0L",
       
  1160                  SPR_NOACCESS, SPR_NOACCESS,
       
  1161                  &spr_read_601_ubat, &spr_write_601_ubatl,
       
  1162                  0x00000000);
       
  1163     spr_register(env, SPR_IBAT1U, "IBAT1U",
       
  1164                  SPR_NOACCESS, SPR_NOACCESS,
       
  1165                  &spr_read_601_ubat, &spr_write_601_ubatu,
       
  1166                  0x00000000);
       
  1167     spr_register(env, SPR_IBAT1L, "IBAT1L",
       
  1168                  SPR_NOACCESS, SPR_NOACCESS,
       
  1169                  &spr_read_601_ubat, &spr_write_601_ubatl,
       
  1170                  0x00000000);
       
  1171     spr_register(env, SPR_IBAT2U, "IBAT2U",
       
  1172                  SPR_NOACCESS, SPR_NOACCESS,
       
  1173                  &spr_read_601_ubat, &spr_write_601_ubatu,
       
  1174                  0x00000000);
       
  1175     spr_register(env, SPR_IBAT2L, "IBAT2L",
       
  1176                  SPR_NOACCESS, SPR_NOACCESS,
       
  1177                  &spr_read_601_ubat, &spr_write_601_ubatl,
       
  1178                  0x00000000);
       
  1179     spr_register(env, SPR_IBAT3U, "IBAT3U",
       
  1180                  SPR_NOACCESS, SPR_NOACCESS,
       
  1181                  &spr_read_601_ubat, &spr_write_601_ubatu,
       
  1182                  0x00000000);
       
  1183     spr_register(env, SPR_IBAT3L, "IBAT3L",
       
  1184                  SPR_NOACCESS, SPR_NOACCESS,
       
  1185                  &spr_read_601_ubat, &spr_write_601_ubatl,
       
  1186                  0x00000000);
       
  1187     env->nb_BATs = 4;
       
  1188 #endif
       
  1189 }
       
  1190 
       
  1191 static void gen_spr_74xx (CPUPPCState *env)
       
  1192 {
       
  1193     /* Processor identification */
       
  1194     spr_register(env, SPR_PIR, "PIR",
       
  1195                  SPR_NOACCESS, SPR_NOACCESS,
       
  1196                  &spr_read_generic, &spr_write_pir,
       
  1197                  0x00000000);
       
  1198     /* XXX : not implemented */
       
  1199     spr_register(env, SPR_MMCR2, "MMCR2",
       
  1200                  SPR_NOACCESS, SPR_NOACCESS,
       
  1201                  &spr_read_generic, &spr_write_generic,
       
  1202                  0x00000000);
       
  1203     /* XXX : not implemented */
       
  1204     spr_register(env, SPR_UMMCR2, "UMMCR2",
       
  1205                  &spr_read_ureg, SPR_NOACCESS,
       
  1206                  &spr_read_ureg, SPR_NOACCESS,
       
  1207                  0x00000000);
       
  1208     /* XXX: not implemented */
       
  1209     spr_register(env, SPR_BAMR, "BAMR",
       
  1210                  SPR_NOACCESS, SPR_NOACCESS,
       
  1211                  &spr_read_generic, &spr_write_generic,
       
  1212                  0x00000000);
       
  1213     /* XXX : not implemented */
       
  1214     spr_register(env, SPR_MSSCR0, "MSSCR0",
       
  1215                  SPR_NOACCESS, SPR_NOACCESS,
       
  1216                  &spr_read_generic, &spr_write_generic,
       
  1217                  0x00000000);
       
  1218     /* Hardware implementation registers */
       
  1219     /* XXX : not implemented */
       
  1220     spr_register(env, SPR_HID0, "HID0",
       
  1221                  SPR_NOACCESS, SPR_NOACCESS,
       
  1222                  &spr_read_generic, &spr_write_generic,
       
  1223                  0x00000000);
       
  1224     /* XXX : not implemented */
       
  1225     spr_register(env, SPR_HID1, "HID1",
       
  1226                  SPR_NOACCESS, SPR_NOACCESS,
       
  1227                  &spr_read_generic, &spr_write_generic,
       
  1228                  0x00000000);
       
  1229     /* Altivec */
       
  1230     spr_register(env, SPR_VRSAVE, "VRSAVE",
       
  1231                  &spr_read_generic, &spr_write_generic,
       
  1232                  &spr_read_generic, &spr_write_generic,
       
  1233                  0x00000000);
       
  1234     /* XXX : not implemented */
       
  1235     spr_register(env, SPR_L2CR, "L2CR",
       
  1236                  SPR_NOACCESS, SPR_NOACCESS,
       
  1237                  &spr_read_generic, &spr_write_generic,
       
  1238                  0x00000000);
       
  1239 }
       
  1240 
       
  1241 static void gen_l3_ctrl (CPUPPCState *env)
       
  1242 {
       
  1243     /* L3CR */
       
  1244     /* XXX : not implemented */
       
  1245     spr_register(env, SPR_L3CR, "L3CR",
       
  1246                  SPR_NOACCESS, SPR_NOACCESS,
       
  1247                  &spr_read_generic, &spr_write_generic,
       
  1248                  0x00000000);
       
  1249     /* L3ITCR0 */
       
  1250     /* XXX : not implemented */
       
  1251     spr_register(env, SPR_L3ITCR0, "L3ITCR0",
       
  1252                  SPR_NOACCESS, SPR_NOACCESS,
       
  1253                  &spr_read_generic, &spr_write_generic,
       
  1254                  0x00000000);
       
  1255     /* L3PM */
       
  1256     /* XXX : not implemented */
       
  1257     spr_register(env, SPR_L3PM, "L3PM",
       
  1258                  SPR_NOACCESS, SPR_NOACCESS,
       
  1259                  &spr_read_generic, &spr_write_generic,
       
  1260                  0x00000000);
       
  1261 }
       
  1262 
       
  1263 static void gen_74xx_soft_tlb (CPUPPCState *env, int nb_tlbs, int nb_ways)
       
  1264 {
       
  1265 #if !defined(CONFIG_USER_ONLY)
       
  1266     env->nb_tlb = nb_tlbs;
       
  1267     env->nb_ways = nb_ways;
       
  1268     env->id_tlbs = 1;
       
  1269     /* XXX : not implemented */
       
  1270     spr_register(env, SPR_PTEHI, "PTEHI",
       
  1271                  SPR_NOACCESS, SPR_NOACCESS,
       
  1272                  &spr_read_generic, &spr_write_generic,
       
  1273                  0x00000000);
       
  1274     /* XXX : not implemented */
       
  1275     spr_register(env, SPR_PTELO, "PTELO",
       
  1276                  SPR_NOACCESS, SPR_NOACCESS,
       
  1277                  &spr_read_generic, &spr_write_generic,
       
  1278                  0x00000000);
       
  1279     /* XXX : not implemented */
       
  1280     spr_register(env, SPR_TLBMISS, "TLBMISS",
       
  1281                  SPR_NOACCESS, SPR_NOACCESS,
       
  1282                  &spr_read_generic, &spr_write_generic,
       
  1283                  0x00000000);
       
  1284 #endif
       
  1285 }
       
  1286 
       
  1287 static void gen_spr_usprgh (CPUPPCState *env)
       
  1288 {
       
  1289     spr_register(env, SPR_USPRG4, "USPRG4",
       
  1290                  &spr_read_ureg, SPR_NOACCESS,
       
  1291                  &spr_read_ureg, SPR_NOACCESS,
       
  1292                  0x00000000);
       
  1293     spr_register(env, SPR_USPRG5, "USPRG5",
       
  1294                  &spr_read_ureg, SPR_NOACCESS,
       
  1295                  &spr_read_ureg, SPR_NOACCESS,
       
  1296                  0x00000000);
       
  1297     spr_register(env, SPR_USPRG6, "USPRG6",
       
  1298                  &spr_read_ureg, SPR_NOACCESS,
       
  1299                  &spr_read_ureg, SPR_NOACCESS,
       
  1300                  0x00000000);
       
  1301     spr_register(env, SPR_USPRG7, "USPRG7",
       
  1302                  &spr_read_ureg, SPR_NOACCESS,
       
  1303                  &spr_read_ureg, SPR_NOACCESS,
       
  1304                  0x00000000);
       
  1305 }
       
  1306 
       
  1307 /* PowerPC BookE SPR */
       
  1308 static void gen_spr_BookE (CPUPPCState *env, uint64_t ivor_mask)
       
  1309 {
       
  1310     const char *ivor_names[64] = {
       
  1311         "IVOR0",  "IVOR1",  "IVOR2",  "IVOR3",
       
  1312         "IVOR4",  "IVOR5",  "IVOR6",  "IVOR7",
       
  1313         "IVOR8",  "IVOR9",  "IVOR10", "IVOR11",
       
  1314         "IVOR12", "IVOR13", "IVOR14", "IVOR15",
       
  1315         "IVOR16", "IVOR17", "IVOR18", "IVOR19",
       
  1316         "IVOR20", "IVOR21", "IVOR22", "IVOR23",
       
  1317         "IVOR24", "IVOR25", "IVOR26", "IVOR27",
       
  1318         "IVOR28", "IVOR29", "IVOR30", "IVOR31",
       
  1319         "IVOR32", "IVOR33", "IVOR34", "IVOR35",
       
  1320         "IVOR36", "IVOR37", "IVOR38", "IVOR39",
       
  1321         "IVOR40", "IVOR41", "IVOR42", "IVOR43",
       
  1322         "IVOR44", "IVOR45", "IVOR46", "IVOR47",
       
  1323         "IVOR48", "IVOR49", "IVOR50", "IVOR51",
       
  1324         "IVOR52", "IVOR53", "IVOR54", "IVOR55",
       
  1325         "IVOR56", "IVOR57", "IVOR58", "IVOR59",
       
  1326         "IVOR60", "IVOR61", "IVOR62", "IVOR63",
       
  1327     };
       
  1328 #define SPR_BOOKE_IVORxx (-1)
       
  1329     int ivor_sprn[64] = {
       
  1330         SPR_BOOKE_IVOR0,  SPR_BOOKE_IVOR1,  SPR_BOOKE_IVOR2,  SPR_BOOKE_IVOR3,
       
  1331         SPR_BOOKE_IVOR4,  SPR_BOOKE_IVOR5,  SPR_BOOKE_IVOR6,  SPR_BOOKE_IVOR7,
       
  1332         SPR_BOOKE_IVOR8,  SPR_BOOKE_IVOR9,  SPR_BOOKE_IVOR10, SPR_BOOKE_IVOR11,
       
  1333         SPR_BOOKE_IVOR12, SPR_BOOKE_IVOR13, SPR_BOOKE_IVOR14, SPR_BOOKE_IVOR15,
       
  1334         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
       
  1335         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
       
  1336         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
       
  1337         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
       
  1338         SPR_BOOKE_IVOR32, SPR_BOOKE_IVOR33, SPR_BOOKE_IVOR34, SPR_BOOKE_IVOR35,
       
  1339         SPR_BOOKE_IVOR36, SPR_BOOKE_IVOR37, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
       
  1340         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
       
  1341         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
       
  1342         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
       
  1343         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
       
  1344         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
       
  1345         SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx, SPR_BOOKE_IVORxx,
       
  1346     };
       
  1347     int i;
       
  1348 
       
  1349     /* Interrupt processing */
       
  1350     spr_register(env, SPR_BOOKE_CSRR0, "CSRR0",
       
  1351                  SPR_NOACCESS, SPR_NOACCESS,
       
  1352                  &spr_read_generic, &spr_write_generic,
       
  1353                  0x00000000);
       
  1354     spr_register(env, SPR_BOOKE_CSRR1, "CSRR1",
       
  1355                  SPR_NOACCESS, SPR_NOACCESS,
       
  1356                  &spr_read_generic, &spr_write_generic,
       
  1357                  0x00000000);
       
  1358     /* Debug */
       
  1359     /* XXX : not implemented */
       
  1360     spr_register(env, SPR_BOOKE_IAC1, "IAC1",
       
  1361                  SPR_NOACCESS, SPR_NOACCESS,
       
  1362                  &spr_read_generic, &spr_write_generic,
       
  1363                  0x00000000);
       
  1364     /* XXX : not implemented */
       
  1365     spr_register(env, SPR_BOOKE_IAC2, "IAC2",
       
  1366                  SPR_NOACCESS, SPR_NOACCESS,
       
  1367                  &spr_read_generic, &spr_write_generic,
       
  1368                  0x00000000);
       
  1369     /* XXX : not implemented */
       
  1370     spr_register(env, SPR_BOOKE_DAC1, "DAC1",
       
  1371                  SPR_NOACCESS, SPR_NOACCESS,
       
  1372                  &spr_read_generic, &spr_write_generic,
       
  1373                  0x00000000);
       
  1374     /* XXX : not implemented */
       
  1375     spr_register(env, SPR_BOOKE_DAC2, "DAC2",
       
  1376                  SPR_NOACCESS, SPR_NOACCESS,
       
  1377                  &spr_read_generic, &spr_write_generic,
       
  1378                  0x00000000);
       
  1379     /* XXX : not implemented */
       
  1380     spr_register(env, SPR_BOOKE_DBCR0, "DBCR0",
       
  1381                  SPR_NOACCESS, SPR_NOACCESS,
       
  1382                  &spr_read_generic, &spr_write_generic,
       
  1383                  0x00000000);
       
  1384     /* XXX : not implemented */
       
  1385     spr_register(env, SPR_BOOKE_DBCR1, "DBCR1",
       
  1386                  SPR_NOACCESS, SPR_NOACCESS,
       
  1387                  &spr_read_generic, &spr_write_generic,
       
  1388                  0x00000000);
       
  1389     /* XXX : not implemented */
       
  1390     spr_register(env, SPR_BOOKE_DBCR2, "DBCR2",
       
  1391                  SPR_NOACCESS, SPR_NOACCESS,
       
  1392                  &spr_read_generic, &spr_write_generic,
       
  1393                  0x00000000);
       
  1394     /* XXX : not implemented */
       
  1395     spr_register(env, SPR_BOOKE_DBSR, "DBSR",
       
  1396                  SPR_NOACCESS, SPR_NOACCESS,
       
  1397                  &spr_read_generic, &spr_write_clear,
       
  1398                  0x00000000);
       
  1399     spr_register(env, SPR_BOOKE_DEAR, "DEAR",
       
  1400                  SPR_NOACCESS, SPR_NOACCESS,
       
  1401                  &spr_read_generic, &spr_write_generic,
       
  1402                  0x00000000);
       
  1403     spr_register(env, SPR_BOOKE_ESR, "ESR",
       
  1404                  SPR_NOACCESS, SPR_NOACCESS,
       
  1405                  &spr_read_generic, &spr_write_generic,
       
  1406                  0x00000000);
       
  1407     spr_register(env, SPR_BOOKE_IVPR, "IVPR",
       
  1408                  SPR_NOACCESS, SPR_NOACCESS,
       
  1409                  &spr_read_generic, &spr_write_excp_prefix,
       
  1410                  0x00000000);
       
  1411     /* Exception vectors */
       
  1412     for (i = 0; i < 64; i++) {
       
  1413         if (ivor_mask & (1ULL << i)) {
       
  1414             if (ivor_sprn[i] == SPR_BOOKE_IVORxx) {
       
  1415                 fprintf(stderr, "ERROR: IVOR %d SPR is not defined\n", i);
       
  1416                 exit(1);
       
  1417             }
       
  1418             spr_register(env, ivor_sprn[i], ivor_names[i],
       
  1419                          SPR_NOACCESS, SPR_NOACCESS,
       
  1420                          &spr_read_generic, &spr_write_excp_vector,
       
  1421                          0x00000000);
       
  1422         }
       
  1423     }
       
  1424     spr_register(env, SPR_BOOKE_PID, "PID",
       
  1425                  SPR_NOACCESS, SPR_NOACCESS,
       
  1426                  &spr_read_generic, &spr_write_generic,
       
  1427                  0x00000000);
       
  1428     spr_register(env, SPR_BOOKE_TCR, "TCR",
       
  1429                  SPR_NOACCESS, SPR_NOACCESS,
       
  1430                  &spr_read_generic, &spr_write_booke_tcr,
       
  1431                  0x00000000);
       
  1432     spr_register(env, SPR_BOOKE_TSR, "TSR",
       
  1433                  SPR_NOACCESS, SPR_NOACCESS,
       
  1434                  &spr_read_generic, &spr_write_booke_tsr,
       
  1435                  0x00000000);
       
  1436     /* Timer */
       
  1437     spr_register(env, SPR_DECR, "DECR",
       
  1438                  SPR_NOACCESS, SPR_NOACCESS,
       
  1439                  &spr_read_decr, &spr_write_decr,
       
  1440                  0x00000000);
       
  1441     spr_register(env, SPR_BOOKE_DECAR, "DECAR",
       
  1442                  SPR_NOACCESS, SPR_NOACCESS,
       
  1443                  SPR_NOACCESS, &spr_write_generic,
       
  1444                  0x00000000);
       
  1445     /* SPRGs */
       
  1446     spr_register(env, SPR_USPRG0, "USPRG0",
       
  1447                  &spr_read_generic, &spr_write_generic,
       
  1448                  &spr_read_generic, &spr_write_generic,
       
  1449                  0x00000000);
       
  1450     spr_register(env, SPR_SPRG4, "SPRG4",
       
  1451                  SPR_NOACCESS, SPR_NOACCESS,
       
  1452                  &spr_read_generic, &spr_write_generic,
       
  1453                  0x00000000);
       
  1454     spr_register(env, SPR_SPRG5, "SPRG5",
       
  1455                  SPR_NOACCESS, SPR_NOACCESS,
       
  1456                  &spr_read_generic, &spr_write_generic,
       
  1457                  0x00000000);
       
  1458     spr_register(env, SPR_SPRG6, "SPRG6",
       
  1459                  SPR_NOACCESS, SPR_NOACCESS,
       
  1460                  &spr_read_generic, &spr_write_generic,
       
  1461                  0x00000000);
       
  1462     spr_register(env, SPR_SPRG7, "SPRG7",
       
  1463                  SPR_NOACCESS, SPR_NOACCESS,
       
  1464                  &spr_read_generic, &spr_write_generic,
       
  1465                  0x00000000);
       
  1466 }
       
  1467 
       
  1468 /* FSL storage control registers */
       
  1469 static void gen_spr_BookE_FSL (CPUPPCState *env, uint32_t mas_mask)
       
  1470 {
       
  1471 #if !defined(CONFIG_USER_ONLY)
       
  1472     const char *mas_names[8] = {
       
  1473         "MAS0", "MAS1", "MAS2", "MAS3", "MAS4", "MAS5", "MAS6", "MAS7",
       
  1474     };
       
  1475     int mas_sprn[8] = {
       
  1476         SPR_BOOKE_MAS0, SPR_BOOKE_MAS1, SPR_BOOKE_MAS2, SPR_BOOKE_MAS3,
       
  1477         SPR_BOOKE_MAS4, SPR_BOOKE_MAS5, SPR_BOOKE_MAS6, SPR_BOOKE_MAS7,
       
  1478     };
       
  1479     int i;
       
  1480 
       
  1481     /* TLB assist registers */
       
  1482     /* XXX : not implemented */
       
  1483     for (i = 0; i < 8; i++) {
       
  1484         if (mas_mask & (1 << i)) {
       
  1485             spr_register(env, mas_sprn[i], mas_names[i],
       
  1486                          SPR_NOACCESS, SPR_NOACCESS,
       
  1487                          &spr_read_generic, &spr_write_generic,
       
  1488                          0x00000000);
       
  1489         }
       
  1490     }
       
  1491     if (env->nb_pids > 1) {
       
  1492         /* XXX : not implemented */
       
  1493         spr_register(env, SPR_BOOKE_PID1, "PID1",
       
  1494                      SPR_NOACCESS, SPR_NOACCESS,
       
  1495                      &spr_read_generic, &spr_write_generic,
       
  1496                      0x00000000);
       
  1497     }
       
  1498     if (env->nb_pids > 2) {
       
  1499         /* XXX : not implemented */
       
  1500         spr_register(env, SPR_BOOKE_PID2, "PID2",
       
  1501                      SPR_NOACCESS, SPR_NOACCESS,
       
  1502                      &spr_read_generic, &spr_write_generic,
       
  1503                      0x00000000);
       
  1504     }
       
  1505     /* XXX : not implemented */
       
  1506     spr_register(env, SPR_MMUCFG, "MMUCFG",
       
  1507                  SPR_NOACCESS, SPR_NOACCESS,
       
  1508                  &spr_read_generic, SPR_NOACCESS,
       
  1509                  0x00000000); /* TOFIX */
       
  1510     /* XXX : not implemented */
       
  1511     spr_register(env, SPR_MMUCSR0, "MMUCSR0",
       
  1512                  SPR_NOACCESS, SPR_NOACCESS,
       
  1513                  &spr_read_generic, &spr_write_generic,
       
  1514                  0x00000000); /* TOFIX */
       
  1515     switch (env->nb_ways) {
       
  1516     case 4:
       
  1517         /* XXX : not implemented */
       
  1518         spr_register(env, SPR_BOOKE_TLB3CFG, "TLB3CFG",
       
  1519                      SPR_NOACCESS, SPR_NOACCESS,
       
  1520                      &spr_read_generic, SPR_NOACCESS,
       
  1521                      0x00000000); /* TOFIX */
       
  1522         /* Fallthru */
       
  1523     case 3:
       
  1524         /* XXX : not implemented */
       
  1525         spr_register(env, SPR_BOOKE_TLB2CFG, "TLB2CFG",
       
  1526                      SPR_NOACCESS, SPR_NOACCESS,
       
  1527                      &spr_read_generic, SPR_NOACCESS,
       
  1528                      0x00000000); /* TOFIX */
       
  1529         /* Fallthru */
       
  1530     case 2:
       
  1531         /* XXX : not implemented */
       
  1532         spr_register(env, SPR_BOOKE_TLB1CFG, "TLB1CFG",
       
  1533                      SPR_NOACCESS, SPR_NOACCESS,
       
  1534                      &spr_read_generic, SPR_NOACCESS,
       
  1535                      0x00000000); /* TOFIX */
       
  1536         /* Fallthru */
       
  1537     case 1:
       
  1538         /* XXX : not implemented */
       
  1539         spr_register(env, SPR_BOOKE_TLB0CFG, "TLB0CFG",
       
  1540                      SPR_NOACCESS, SPR_NOACCESS,
       
  1541                      &spr_read_generic, SPR_NOACCESS,
       
  1542                      0x00000000); /* TOFIX */
       
  1543         /* Fallthru */
       
  1544     case 0:
       
  1545     default:
       
  1546         break;
       
  1547     }
       
  1548 #endif
       
  1549 }
       
  1550 
       
  1551 /* SPR specific to PowerPC 440 implementation */
       
  1552 static void gen_spr_440 (CPUPPCState *env)
       
  1553 {
       
  1554     /* Cache control */
       
  1555     /* XXX : not implemented */
       
  1556     spr_register(env, SPR_440_DNV0, "DNV0",
       
  1557                  SPR_NOACCESS, SPR_NOACCESS,
       
  1558                  &spr_read_generic, &spr_write_generic,
       
  1559                  0x00000000);
       
  1560     /* XXX : not implemented */
       
  1561     spr_register(env, SPR_440_DNV1, "DNV1",
       
  1562                  SPR_NOACCESS, SPR_NOACCESS,
       
  1563                  &spr_read_generic, &spr_write_generic,
       
  1564                  0x00000000);
       
  1565     /* XXX : not implemented */
       
  1566     spr_register(env, SPR_440_DNV2, "DNV2",
       
  1567                  SPR_NOACCESS, SPR_NOACCESS,
       
  1568                  &spr_read_generic, &spr_write_generic,
       
  1569                  0x00000000);
       
  1570     /* XXX : not implemented */
       
  1571     spr_register(env, SPR_440_DNV3, "DNV3",
       
  1572                  SPR_NOACCESS, SPR_NOACCESS,
       
  1573                  &spr_read_generic, &spr_write_generic,
       
  1574                  0x00000000);
       
  1575     /* XXX : not implemented */
       
  1576     spr_register(env, SPR_440_DTV0, "DTV0",
       
  1577                  SPR_NOACCESS, SPR_NOACCESS,
       
  1578                  &spr_read_generic, &spr_write_generic,
       
  1579                  0x00000000);
       
  1580     /* XXX : not implemented */
       
  1581     spr_register(env, SPR_440_DTV1, "DTV1",
       
  1582                  SPR_NOACCESS, SPR_NOACCESS,
       
  1583                  &spr_read_generic, &spr_write_generic,
       
  1584                  0x00000000);
       
  1585     /* XXX : not implemented */
       
  1586     spr_register(env, SPR_440_DTV2, "DTV2",
       
  1587                  SPR_NOACCESS, SPR_NOACCESS,
       
  1588                  &spr_read_generic, &spr_write_generic,
       
  1589                  0x00000000);
       
  1590     /* XXX : not implemented */
       
  1591     spr_register(env, SPR_440_DTV3, "DTV3",
       
  1592                  SPR_NOACCESS, SPR_NOACCESS,
       
  1593                  &spr_read_generic, &spr_write_generic,
       
  1594                  0x00000000);
       
  1595     /* XXX : not implemented */
       
  1596     spr_register(env, SPR_440_DVLIM, "DVLIM",
       
  1597                  SPR_NOACCESS, SPR_NOACCESS,
       
  1598                  &spr_read_generic, &spr_write_generic,
       
  1599                  0x00000000);
       
  1600     /* XXX : not implemented */
       
  1601     spr_register(env, SPR_440_INV0, "INV0",
       
  1602                  SPR_NOACCESS, SPR_NOACCESS,
       
  1603                  &spr_read_generic, &spr_write_generic,
       
  1604                  0x00000000);
       
  1605     /* XXX : not implemented */
       
  1606     spr_register(env, SPR_440_INV1, "INV1",
       
  1607                  SPR_NOACCESS, SPR_NOACCESS,
       
  1608                  &spr_read_generic, &spr_write_generic,
       
  1609                  0x00000000);
       
  1610     /* XXX : not implemented */
       
  1611     spr_register(env, SPR_440_INV2, "INV2",
       
  1612                  SPR_NOACCESS, SPR_NOACCESS,
       
  1613                  &spr_read_generic, &spr_write_generic,
       
  1614                  0x00000000);
       
  1615     /* XXX : not implemented */
       
  1616     spr_register(env, SPR_440_INV3, "INV3",
       
  1617                  SPR_NOACCESS, SPR_NOACCESS,
       
  1618                  &spr_read_generic, &spr_write_generic,
       
  1619                  0x00000000);
       
  1620     /* XXX : not implemented */
       
  1621     spr_register(env, SPR_440_ITV0, "ITV0",
       
  1622                  SPR_NOACCESS, SPR_NOACCESS,
       
  1623                  &spr_read_generic, &spr_write_generic,
       
  1624                  0x00000000);
       
  1625     /* XXX : not implemented */
       
  1626     spr_register(env, SPR_440_ITV1, "ITV1",
       
  1627                  SPR_NOACCESS, SPR_NOACCESS,
       
  1628                  &spr_read_generic, &spr_write_generic,
       
  1629                  0x00000000);
       
  1630     /* XXX : not implemented */
       
  1631     spr_register(env, SPR_440_ITV2, "ITV2",
       
  1632                  SPR_NOACCESS, SPR_NOACCESS,
       
  1633                  &spr_read_generic, &spr_write_generic,
       
  1634                  0x00000000);
       
  1635     /* XXX : not implemented */
       
  1636     spr_register(env, SPR_440_ITV3, "ITV3",
       
  1637                  SPR_NOACCESS, SPR_NOACCESS,
       
  1638                  &spr_read_generic, &spr_write_generic,
       
  1639                  0x00000000);
       
  1640     /* XXX : not implemented */
       
  1641     spr_register(env, SPR_440_IVLIM, "IVLIM",
       
  1642                  SPR_NOACCESS, SPR_NOACCESS,
       
  1643                  &spr_read_generic, &spr_write_generic,
       
  1644                  0x00000000);
       
  1645     /* Cache debug */
       
  1646     /* XXX : not implemented */
       
  1647     spr_register(env, SPR_BOOKE_DCDBTRH, "DCDBTRH",
       
  1648                  SPR_NOACCESS, SPR_NOACCESS,
       
  1649                  &spr_read_generic, SPR_NOACCESS,
       
  1650                  0x00000000);
       
  1651     /* XXX : not implemented */
       
  1652     spr_register(env, SPR_BOOKE_DCDBTRL, "DCDBTRL",
       
  1653                  SPR_NOACCESS, SPR_NOACCESS,
       
  1654                  &spr_read_generic, SPR_NOACCESS,
       
  1655                  0x00000000);
       
  1656     /* XXX : not implemented */
       
  1657     spr_register(env, SPR_BOOKE_ICDBDR, "ICDBDR",
       
  1658                  SPR_NOACCESS, SPR_NOACCESS,
       
  1659                  &spr_read_generic, SPR_NOACCESS,
       
  1660                  0x00000000);
       
  1661     /* XXX : not implemented */
       
  1662     spr_register(env, SPR_BOOKE_ICDBTRH, "ICDBTRH",
       
  1663                  SPR_NOACCESS, SPR_NOACCESS,
       
  1664                  &spr_read_generic, SPR_NOACCESS,
       
  1665                  0x00000000);
       
  1666     /* XXX : not implemented */
       
  1667     spr_register(env, SPR_BOOKE_ICDBTRL, "ICDBTRL",
       
  1668                  SPR_NOACCESS, SPR_NOACCESS,
       
  1669                  &spr_read_generic, SPR_NOACCESS,
       
  1670                  0x00000000);
       
  1671     /* XXX : not implemented */
       
  1672     spr_register(env, SPR_440_DBDR, "DBDR",
       
  1673                  SPR_NOACCESS, SPR_NOACCESS,
       
  1674                  &spr_read_generic, &spr_write_generic,
       
  1675                  0x00000000);
       
  1676     /* Processor control */
       
  1677     spr_register(env, SPR_4xx_CCR0, "CCR0",
       
  1678                  SPR_NOACCESS, SPR_NOACCESS,
       
  1679                  &spr_read_generic, &spr_write_generic,
       
  1680                  0x00000000);
       
  1681     spr_register(env, SPR_440_RSTCFG, "RSTCFG",
       
  1682                  SPR_NOACCESS, SPR_NOACCESS,
       
  1683                  &spr_read_generic, SPR_NOACCESS,
       
  1684                  0x00000000);
       
  1685     /* Storage control */
       
  1686     spr_register(env, SPR_440_MMUCR, "MMUCR",
       
  1687                  SPR_NOACCESS, SPR_NOACCESS,
       
  1688                  &spr_read_generic, &spr_write_generic,
       
  1689                  0x00000000);
       
  1690 }
       
  1691 
       
  1692 /* SPR shared between PowerPC 40x implementations */
       
  1693 static void gen_spr_40x (CPUPPCState *env)
       
  1694 {
       
  1695     /* Cache */
       
  1696     /* not emulated, as Qemu do not emulate caches */
       
  1697     spr_register(env, SPR_40x_DCCR, "DCCR",
       
  1698                  SPR_NOACCESS, SPR_NOACCESS,
       
  1699                  &spr_read_generic, &spr_write_generic,
       
  1700                  0x00000000);
       
  1701     /* not emulated, as Qemu do not emulate caches */
       
  1702     spr_register(env, SPR_40x_ICCR, "ICCR",
       
  1703                  SPR_NOACCESS, SPR_NOACCESS,
       
  1704                  &spr_read_generic, &spr_write_generic,
       
  1705                  0x00000000);
       
  1706     /* not emulated, as Qemu do not emulate caches */
       
  1707     spr_register(env, SPR_BOOKE_ICDBDR, "ICDBDR",
       
  1708                  SPR_NOACCESS, SPR_NOACCESS,
       
  1709                  &spr_read_generic, SPR_NOACCESS,
       
  1710                  0x00000000);
       
  1711     /* Exception */
       
  1712     spr_register(env, SPR_40x_DEAR, "DEAR",
       
  1713                  SPR_NOACCESS, SPR_NOACCESS,
       
  1714                  &spr_read_generic, &spr_write_generic,
       
  1715                  0x00000000);
       
  1716     spr_register(env, SPR_40x_ESR, "ESR",
       
  1717                  SPR_NOACCESS, SPR_NOACCESS,
       
  1718                  &spr_read_generic, &spr_write_generic,
       
  1719                  0x00000000);
       
  1720     spr_register(env, SPR_40x_EVPR, "EVPR",
       
  1721                  SPR_NOACCESS, SPR_NOACCESS,
       
  1722                  &spr_read_generic, &spr_write_excp_prefix,
       
  1723                  0x00000000);
       
  1724     spr_register(env, SPR_40x_SRR2, "SRR2",
       
  1725                  &spr_read_generic, &spr_write_generic,
       
  1726                  &spr_read_generic, &spr_write_generic,
       
  1727                  0x00000000);
       
  1728     spr_register(env, SPR_40x_SRR3, "SRR3",
       
  1729                  &spr_read_generic, &spr_write_generic,
       
  1730                  &spr_read_generic, &spr_write_generic,
       
  1731                  0x00000000);
       
  1732     /* Timers */
       
  1733     spr_register(env, SPR_40x_PIT, "PIT",
       
  1734                  SPR_NOACCESS, SPR_NOACCESS,
       
  1735                  &spr_read_40x_pit, &spr_write_40x_pit,
       
  1736                  0x00000000);
       
  1737     spr_register(env, SPR_40x_TCR, "TCR",
       
  1738                  SPR_NOACCESS, SPR_NOACCESS,
       
  1739                  &spr_read_generic, &spr_write_booke_tcr,
       
  1740                  0x00000000);
       
  1741     spr_register(env, SPR_40x_TSR, "TSR",
       
  1742                  SPR_NOACCESS, SPR_NOACCESS,
       
  1743                  &spr_read_generic, &spr_write_booke_tsr,
       
  1744                  0x00000000);
       
  1745 }
       
  1746 
       
  1747 /* SPR specific to PowerPC 405 implementation */
       
  1748 static void gen_spr_405 (CPUPPCState *env)
       
  1749 {
       
  1750     /* MMU */
       
  1751     spr_register(env, SPR_40x_PID, "PID",
       
  1752                  SPR_NOACCESS, SPR_NOACCESS,
       
  1753                  &spr_read_generic, &spr_write_generic,
       
  1754                  0x00000000);
       
  1755     spr_register(env, SPR_4xx_CCR0, "CCR0",
       
  1756                  SPR_NOACCESS, SPR_NOACCESS,
       
  1757                  &spr_read_generic, &spr_write_generic,
       
  1758                  0x00700000);
       
  1759     /* Debug interface */
       
  1760     /* XXX : not implemented */
       
  1761     spr_register(env, SPR_40x_DBCR0, "DBCR0",
       
  1762                  SPR_NOACCESS, SPR_NOACCESS,
       
  1763                  &spr_read_generic, &spr_write_40x_dbcr0,
       
  1764                  0x00000000);
       
  1765     /* XXX : not implemented */
       
  1766     spr_register(env, SPR_405_DBCR1, "DBCR1",
       
  1767                  SPR_NOACCESS, SPR_NOACCESS,
       
  1768                  &spr_read_generic, &spr_write_generic,
       
  1769                  0x00000000);
       
  1770     /* XXX : not implemented */
       
  1771     spr_register(env, SPR_40x_DBSR, "DBSR",
       
  1772                  SPR_NOACCESS, SPR_NOACCESS,
       
  1773                  &spr_read_generic, &spr_write_clear,
       
  1774                  /* Last reset was system reset */
       
  1775                  0x00000300);
       
  1776     /* XXX : not implemented */
       
  1777     spr_register(env, SPR_40x_DAC1, "DAC1",
       
  1778                  SPR_NOACCESS, SPR_NOACCESS,
       
  1779                  &spr_read_generic, &spr_write_generic,
       
  1780                  0x00000000);
       
  1781     spr_register(env, SPR_40x_DAC2, "DAC2",
       
  1782                  SPR_NOACCESS, SPR_NOACCESS,
       
  1783                  &spr_read_generic, &spr_write_generic,
       
  1784                  0x00000000);
       
  1785     /* XXX : not implemented */
       
  1786     spr_register(env, SPR_405_DVC1, "DVC1",
       
  1787                  SPR_NOACCESS, SPR_NOACCESS,
       
  1788                  &spr_read_generic, &spr_write_generic,
       
  1789                  0x00000000);
       
  1790     /* XXX : not implemented */
       
  1791     spr_register(env, SPR_405_DVC2, "DVC2",
       
  1792                  SPR_NOACCESS, SPR_NOACCESS,
       
  1793                  &spr_read_generic, &spr_write_generic,
       
  1794                  0x00000000);
       
  1795     /* XXX : not implemented */
       
  1796     spr_register(env, SPR_40x_IAC1, "IAC1",
       
  1797                  SPR_NOACCESS, SPR_NOACCESS,
       
  1798                  &spr_read_generic, &spr_write_generic,
       
  1799                  0x00000000);
       
  1800     spr_register(env, SPR_40x_IAC2, "IAC2",
       
  1801                  SPR_NOACCESS, SPR_NOACCESS,
       
  1802                  &spr_read_generic, &spr_write_generic,
       
  1803                  0x00000000);
       
  1804     /* XXX : not implemented */
       
  1805     spr_register(env, SPR_405_IAC3, "IAC3",
       
  1806                  SPR_NOACCESS, SPR_NOACCESS,
       
  1807                  &spr_read_generic, &spr_write_generic,
       
  1808                  0x00000000);
       
  1809     /* XXX : not implemented */
       
  1810     spr_register(env, SPR_405_IAC4, "IAC4",
       
  1811                  SPR_NOACCESS, SPR_NOACCESS,
       
  1812                  &spr_read_generic, &spr_write_generic,
       
  1813                  0x00000000);
       
  1814     /* Storage control */
       
  1815     /* XXX: TODO: not implemented */
       
  1816     spr_register(env, SPR_405_SLER, "SLER",
       
  1817                  SPR_NOACCESS, SPR_NOACCESS,
       
  1818                  &spr_read_generic, &spr_write_40x_sler,
       
  1819                  0x00000000);
       
  1820     spr_register(env, SPR_40x_ZPR, "ZPR",
       
  1821                  SPR_NOACCESS, SPR_NOACCESS,
       
  1822                  &spr_read_generic, &spr_write_generic,
       
  1823                  0x00000000);
       
  1824     /* XXX : not implemented */
       
  1825     spr_register(env, SPR_405_SU0R, "SU0R",
       
  1826                  SPR_NOACCESS, SPR_NOACCESS,
       
  1827                  &spr_read_generic, &spr_write_generic,
       
  1828                  0x00000000);
       
  1829     /* SPRG */
       
  1830     spr_register(env, SPR_USPRG0, "USPRG0",
       
  1831                  &spr_read_ureg, SPR_NOACCESS,
       
  1832                  &spr_read_ureg, SPR_NOACCESS,
       
  1833                  0x00000000);
       
  1834     spr_register(env, SPR_SPRG4, "SPRG4",
       
  1835                  SPR_NOACCESS, SPR_NOACCESS,
       
  1836                  &spr_read_generic, &spr_write_generic,
       
  1837                  0x00000000);
       
  1838     spr_register(env, SPR_SPRG5, "SPRG5",
       
  1839                  SPR_NOACCESS, SPR_NOACCESS,
       
  1840                  spr_read_generic, &spr_write_generic,
       
  1841                  0x00000000);
       
  1842     spr_register(env, SPR_SPRG6, "SPRG6",
       
  1843                  SPR_NOACCESS, SPR_NOACCESS,
       
  1844                  spr_read_generic, &spr_write_generic,
       
  1845                  0x00000000);
       
  1846     spr_register(env, SPR_SPRG7, "SPRG7",
       
  1847                  SPR_NOACCESS, SPR_NOACCESS,
       
  1848                  spr_read_generic, &spr_write_generic,
       
  1849                  0x00000000);
       
  1850     gen_spr_usprgh(env);
       
  1851 }
       
  1852 
       
  1853 /* SPR shared between PowerPC 401 & 403 implementations */
       
  1854 static void gen_spr_401_403 (CPUPPCState *env)
       
  1855 {
       
  1856     /* Time base */
       
  1857     spr_register(env, SPR_403_VTBL,  "TBL",
       
  1858                  &spr_read_tbl, SPR_NOACCESS,
       
  1859                  &spr_read_tbl, SPR_NOACCESS,
       
  1860                  0x00000000);
       
  1861     spr_register(env, SPR_403_TBL,   "TBL",
       
  1862                  SPR_NOACCESS, SPR_NOACCESS,
       
  1863                  SPR_NOACCESS, &spr_write_tbl,
       
  1864                  0x00000000);
       
  1865     spr_register(env, SPR_403_VTBU,  "TBU",
       
  1866                  &spr_read_tbu, SPR_NOACCESS,
       
  1867                  &spr_read_tbu, SPR_NOACCESS,
       
  1868                  0x00000000);
       
  1869     spr_register(env, SPR_403_TBU,   "TBU",
       
  1870                  SPR_NOACCESS, SPR_NOACCESS,
       
  1871                  SPR_NOACCESS, &spr_write_tbu,
       
  1872                  0x00000000);
       
  1873     /* Debug */
       
  1874     /* not emulated, as Qemu do not emulate caches */
       
  1875     spr_register(env, SPR_403_CDBCR, "CDBCR",
       
  1876                  SPR_NOACCESS, SPR_NOACCESS,
       
  1877                  &spr_read_generic, &spr_write_generic,
       
  1878                  0x00000000);
       
  1879 }
       
  1880 
       
  1881 /* SPR specific to PowerPC 401 implementation */
       
  1882 static void gen_spr_401 (CPUPPCState *env)
       
  1883 {
       
  1884     /* Debug interface */
       
  1885     /* XXX : not implemented */
       
  1886     spr_register(env, SPR_40x_DBCR0, "DBCR",
       
  1887                  SPR_NOACCESS, SPR_NOACCESS,
       
  1888                  &spr_read_generic, &spr_write_40x_dbcr0,
       
  1889                  0x00000000);
       
  1890     /* XXX : not implemented */
       
  1891     spr_register(env, SPR_40x_DBSR, "DBSR",
       
  1892                  SPR_NOACCESS, SPR_NOACCESS,
       
  1893                  &spr_read_generic, &spr_write_clear,
       
  1894                  /* Last reset was system reset */
       
  1895                  0x00000300);
       
  1896     /* XXX : not implemented */
       
  1897     spr_register(env, SPR_40x_DAC1, "DAC",
       
  1898                  SPR_NOACCESS, SPR_NOACCESS,
       
  1899                  &spr_read_generic, &spr_write_generic,
       
  1900                  0x00000000);
       
  1901     /* XXX : not implemented */
       
  1902     spr_register(env, SPR_40x_IAC1, "IAC",
       
  1903                  SPR_NOACCESS, SPR_NOACCESS,
       
  1904                  &spr_read_generic, &spr_write_generic,
       
  1905                  0x00000000);
       
  1906     /* Storage control */
       
  1907     /* XXX: TODO: not implemented */
       
  1908     spr_register(env, SPR_405_SLER, "SLER",
       
  1909                  SPR_NOACCESS, SPR_NOACCESS,
       
  1910                  &spr_read_generic, &spr_write_40x_sler,
       
  1911                  0x00000000);
       
  1912     /* not emulated, as Qemu never does speculative access */
       
  1913     spr_register(env, SPR_40x_SGR, "SGR",
       
  1914                  SPR_NOACCESS, SPR_NOACCESS,
       
  1915                  &spr_read_generic, &spr_write_generic,
       
  1916                  0xFFFFFFFF);
       
  1917     /* not emulated, as Qemu do not emulate caches */
       
  1918     spr_register(env, SPR_40x_DCWR, "DCWR",
       
  1919                  SPR_NOACCESS, SPR_NOACCESS,
       
  1920                  &spr_read_generic, &spr_write_generic,
       
  1921                  0x00000000);
       
  1922 }
       
  1923 
       
  1924 static void gen_spr_401x2 (CPUPPCState *env)
       
  1925 {
       
  1926     gen_spr_401(env);
       
  1927     spr_register(env, SPR_40x_PID, "PID",
       
  1928                  SPR_NOACCESS, SPR_NOACCESS,
       
  1929                  &spr_read_generic, &spr_write_generic,
       
  1930                  0x00000000);
       
  1931     spr_register(env, SPR_40x_ZPR, "ZPR",
       
  1932                  SPR_NOACCESS, SPR_NOACCESS,
       
  1933                  &spr_read_generic, &spr_write_generic,
       
  1934                  0x00000000);
       
  1935 }
       
  1936 
       
  1937 /* SPR specific to PowerPC 403 implementation */
       
  1938 static void gen_spr_403 (CPUPPCState *env)
       
  1939 {
       
  1940     /* Debug interface */
       
  1941     /* XXX : not implemented */
       
  1942     spr_register(env, SPR_40x_DBCR0, "DBCR0",
       
  1943                  SPR_NOACCESS, SPR_NOACCESS,
       
  1944                  &spr_read_generic, &spr_write_40x_dbcr0,
       
  1945                  0x00000000);
       
  1946     /* XXX : not implemented */
       
  1947     spr_register(env, SPR_40x_DBSR, "DBSR",
       
  1948                  SPR_NOACCESS, SPR_NOACCESS,
       
  1949                  &spr_read_generic, &spr_write_clear,
       
  1950                  /* Last reset was system reset */
       
  1951                  0x00000300);
       
  1952     /* XXX : not implemented */
       
  1953     spr_register(env, SPR_40x_DAC1, "DAC1",
       
  1954                  SPR_NOACCESS, SPR_NOACCESS,
       
  1955                  &spr_read_generic, &spr_write_generic,
       
  1956                  0x00000000);
       
  1957     /* XXX : not implemented */
       
  1958     spr_register(env, SPR_40x_DAC2, "DAC2",
       
  1959                  SPR_NOACCESS, SPR_NOACCESS,
       
  1960                  &spr_read_generic, &spr_write_generic,
       
  1961                  0x00000000);
       
  1962     /* XXX : not implemented */
       
  1963     spr_register(env, SPR_40x_IAC1, "IAC1",
       
  1964                  SPR_NOACCESS, SPR_NOACCESS,
       
  1965                  &spr_read_generic, &spr_write_generic,
       
  1966                  0x00000000);
       
  1967     /* XXX : not implemented */
       
  1968     spr_register(env, SPR_40x_IAC2, "IAC2",
       
  1969                  SPR_NOACCESS, SPR_NOACCESS,
       
  1970                  &spr_read_generic, &spr_write_generic,
       
  1971                  0x00000000);
       
  1972 }
       
  1973 
       
  1974 static void gen_spr_403_real (CPUPPCState *env)
       
  1975 {
       
  1976     spr_register(env, SPR_403_PBL1,  "PBL1",
       
  1977                  SPR_NOACCESS, SPR_NOACCESS,
       
  1978                  &spr_read_403_pbr, &spr_write_403_pbr,
       
  1979                  0x00000000);
       
  1980     spr_register(env, SPR_403_PBU1,  "PBU1",
       
  1981                  SPR_NOACCESS, SPR_NOACCESS,
       
  1982                  &spr_read_403_pbr, &spr_write_403_pbr,
       
  1983                  0x00000000);
       
  1984     spr_register(env, SPR_403_PBL2,  "PBL2",
       
  1985                  SPR_NOACCESS, SPR_NOACCESS,
       
  1986                  &spr_read_403_pbr, &spr_write_403_pbr,
       
  1987                  0x00000000);
       
  1988     spr_register(env, SPR_403_PBU2,  "PBU2",
       
  1989                  SPR_NOACCESS, SPR_NOACCESS,
       
  1990                  &spr_read_403_pbr, &spr_write_403_pbr,
       
  1991                  0x00000000);
       
  1992 }
       
  1993 
       
  1994 static void gen_spr_403_mmu (CPUPPCState *env)
       
  1995 {
       
  1996     /* MMU */
       
  1997     spr_register(env, SPR_40x_PID, "PID",
       
  1998                  SPR_NOACCESS, SPR_NOACCESS,
       
  1999                  &spr_read_generic, &spr_write_generic,
       
  2000                  0x00000000);
       
  2001     spr_register(env, SPR_40x_ZPR, "ZPR",
       
  2002                  SPR_NOACCESS, SPR_NOACCESS,
       
  2003                  &spr_read_generic, &spr_write_generic,
       
  2004                  0x00000000);
       
  2005 }
       
  2006 
       
  2007 /* SPR specific to PowerPC compression coprocessor extension */
       
  2008 static void gen_spr_compress (CPUPPCState *env)
       
  2009 {
       
  2010     /* XXX : not implemented */
       
  2011     spr_register(env, SPR_401_SKR, "SKR",
       
  2012                  SPR_NOACCESS, SPR_NOACCESS,
       
  2013                  &spr_read_generic, &spr_write_generic,
       
  2014                  0x00000000);
       
  2015 }
       
  2016 
       
  2017 #if defined (TARGET_PPC64)
       
  2018 /* SPR specific to PowerPC 620 */
       
  2019 static void gen_spr_620 (CPUPPCState *env)
       
  2020 {
       
  2021     /* Processor identification */
       
  2022     spr_register(env, SPR_PIR, "PIR",
       
  2023                  SPR_NOACCESS, SPR_NOACCESS,
       
  2024                  &spr_read_generic, &spr_write_pir,
       
  2025                  0x00000000);
       
  2026     spr_register(env, SPR_ASR, "ASR",
       
  2027                  SPR_NOACCESS, SPR_NOACCESS,
       
  2028                  &spr_read_asr, &spr_write_asr,
       
  2029                  0x00000000);
       
  2030     /* Breakpoints */
       
  2031     /* XXX : not implemented */
       
  2032     spr_register(env, SPR_IABR, "IABR",
       
  2033                  SPR_NOACCESS, SPR_NOACCESS,
       
  2034                  &spr_read_generic, &spr_write_generic,
       
  2035                  0x00000000);
       
  2036     /* XXX : not implemented */
       
  2037     spr_register(env, SPR_DABR, "DABR",
       
  2038                  SPR_NOACCESS, SPR_NOACCESS,
       
  2039                  &spr_read_generic, &spr_write_generic,
       
  2040                  0x00000000);
       
  2041     /* XXX : not implemented */
       
  2042     spr_register(env, SPR_SIAR, "SIAR",
       
  2043                  SPR_NOACCESS, SPR_NOACCESS,
       
  2044                  &spr_read_generic, SPR_NOACCESS,
       
  2045                  0x00000000);
       
  2046     /* XXX : not implemented */
       
  2047     spr_register(env, SPR_SDA, "SDA",
       
  2048                  SPR_NOACCESS, SPR_NOACCESS,
       
  2049                  &spr_read_generic, SPR_NOACCESS,
       
  2050                  0x00000000);
       
  2051     /* XXX : not implemented */
       
  2052     spr_register(env, SPR_620_PMC1R, "PMC1",
       
  2053                  SPR_NOACCESS, SPR_NOACCESS,
       
  2054                  &spr_read_generic, SPR_NOACCESS,
       
  2055                  0x00000000);
       
  2056     spr_register(env, SPR_620_PMC1W, "PMC1",
       
  2057                  SPR_NOACCESS, SPR_NOACCESS,
       
  2058                   SPR_NOACCESS, &spr_write_generic,
       
  2059                  0x00000000);
       
  2060     /* XXX : not implemented */
       
  2061     spr_register(env, SPR_620_PMC2R, "PMC2",
       
  2062                  SPR_NOACCESS, SPR_NOACCESS,
       
  2063                  &spr_read_generic, SPR_NOACCESS,
       
  2064                  0x00000000);
       
  2065     spr_register(env, SPR_620_PMC2W, "PMC2",
       
  2066                  SPR_NOACCESS, SPR_NOACCESS,
       
  2067                   SPR_NOACCESS, &spr_write_generic,
       
  2068                  0x00000000);
       
  2069     /* XXX : not implemented */
       
  2070     spr_register(env, SPR_620_MMCR0R, "MMCR0",
       
  2071                  SPR_NOACCESS, SPR_NOACCESS,
       
  2072                  &spr_read_generic, SPR_NOACCESS,
       
  2073                  0x00000000);
       
  2074     spr_register(env, SPR_620_MMCR0W, "MMCR0",
       
  2075                  SPR_NOACCESS, SPR_NOACCESS,
       
  2076                   SPR_NOACCESS, &spr_write_generic,
       
  2077                  0x00000000);
       
  2078     /* External access control */
       
  2079     /* XXX : not implemented */
       
  2080     spr_register(env, SPR_EAR, "EAR",
       
  2081                  SPR_NOACCESS, SPR_NOACCESS,
       
  2082                  &spr_read_generic, &spr_write_generic,
       
  2083                  0x00000000);
       
  2084 #if 0 // XXX: check this
       
  2085     /* XXX : not implemented */
       
  2086     spr_register(env, SPR_620_PMR0, "PMR0",
       
  2087                  SPR_NOACCESS, SPR_NOACCESS,
       
  2088                  &spr_read_generic, &spr_write_generic,
       
  2089                  0x00000000);
       
  2090     /* XXX : not implemented */
       
  2091     spr_register(env, SPR_620_PMR1, "PMR1",
       
  2092                  SPR_NOACCESS, SPR_NOACCESS,
       
  2093                  &spr_read_generic, &spr_write_generic,
       
  2094                  0x00000000);
       
  2095     /* XXX : not implemented */
       
  2096     spr_register(env, SPR_620_PMR2, "PMR2",
       
  2097                  SPR_NOACCESS, SPR_NOACCESS,
       
  2098                  &spr_read_generic, &spr_write_generic,
       
  2099                  0x00000000);
       
  2100     /* XXX : not implemented */
       
  2101     spr_register(env, SPR_620_PMR3, "PMR3",
       
  2102                  SPR_NOACCESS, SPR_NOACCESS,
       
  2103                  &spr_read_generic, &spr_write_generic,
       
  2104                  0x00000000);
       
  2105     /* XXX : not implemented */
       
  2106     spr_register(env, SPR_620_PMR4, "PMR4",
       
  2107                  SPR_NOACCESS, SPR_NOACCESS,
       
  2108                  &spr_read_generic, &spr_write_generic,
       
  2109                  0x00000000);
       
  2110     /* XXX : not implemented */
       
  2111     spr_register(env, SPR_620_PMR5, "PMR5",
       
  2112                  SPR_NOACCESS, SPR_NOACCESS,
       
  2113                  &spr_read_generic, &spr_write_generic,
       
  2114                  0x00000000);
       
  2115     /* XXX : not implemented */
       
  2116     spr_register(env, SPR_620_PMR6, "PMR6",
       
  2117                  SPR_NOACCESS, SPR_NOACCESS,
       
  2118                  &spr_read_generic, &spr_write_generic,
       
  2119                  0x00000000);
       
  2120     /* XXX : not implemented */
       
  2121     spr_register(env, SPR_620_PMR7, "PMR7",
       
  2122                  SPR_NOACCESS, SPR_NOACCESS,
       
  2123                  &spr_read_generic, &spr_write_generic,
       
  2124                  0x00000000);
       
  2125     /* XXX : not implemented */
       
  2126     spr_register(env, SPR_620_PMR8, "PMR8",
       
  2127                  SPR_NOACCESS, SPR_NOACCESS,
       
  2128                  &spr_read_generic, &spr_write_generic,
       
  2129                  0x00000000);
       
  2130     /* XXX : not implemented */
       
  2131     spr_register(env, SPR_620_PMR9, "PMR9",
       
  2132                  SPR_NOACCESS, SPR_NOACCESS,
       
  2133                  &spr_read_generic, &spr_write_generic,
       
  2134                  0x00000000);
       
  2135     /* XXX : not implemented */
       
  2136     spr_register(env, SPR_620_PMRA, "PMR10",
       
  2137                  SPR_NOACCESS, SPR_NOACCESS,
       
  2138                  &spr_read_generic, &spr_write_generic,
       
  2139                  0x00000000);
       
  2140     /* XXX : not implemented */
       
  2141     spr_register(env, SPR_620_PMRB, "PMR11",
       
  2142                  SPR_NOACCESS, SPR_NOACCESS,
       
  2143                  &spr_read_generic, &spr_write_generic,
       
  2144                  0x00000000);
       
  2145     /* XXX : not implemented */
       
  2146     spr_register(env, SPR_620_PMRC, "PMR12",
       
  2147                  SPR_NOACCESS, SPR_NOACCESS,
       
  2148                  &spr_read_generic, &spr_write_generic,
       
  2149                  0x00000000);
       
  2150     /* XXX : not implemented */
       
  2151     spr_register(env, SPR_620_PMRD, "PMR13",
       
  2152                  SPR_NOACCESS, SPR_NOACCESS,
       
  2153                  &spr_read_generic, &spr_write_generic,
       
  2154                  0x00000000);
       
  2155     /* XXX : not implemented */
       
  2156     spr_register(env, SPR_620_PMRE, "PMR14",
       
  2157                  SPR_NOACCESS, SPR_NOACCESS,
       
  2158                  &spr_read_generic, &spr_write_generic,
       
  2159                  0x00000000);
       
  2160     /* XXX : not implemented */
       
  2161     spr_register(env, SPR_620_PMRF, "PMR15",
       
  2162                  SPR_NOACCESS, SPR_NOACCESS,
       
  2163                  &spr_read_generic, &spr_write_generic,
       
  2164                  0x00000000);
       
  2165 #endif
       
  2166     /* XXX : not implemented */
       
  2167     spr_register(env, SPR_620_BUSCSR, "BUSCSR",
       
  2168                  SPR_NOACCESS, SPR_NOACCESS,
       
  2169                  &spr_read_generic, &spr_write_generic,
       
  2170                  0x00000000);
       
  2171     /* XXX : not implemented */
       
  2172     spr_register(env, SPR_620_L2CR, "L2CR",
       
  2173                  SPR_NOACCESS, SPR_NOACCESS,
       
  2174                  &spr_read_generic, &spr_write_generic,
       
  2175                  0x00000000);
       
  2176     /* XXX : not implemented */
       
  2177     spr_register(env, SPR_620_L2SR, "L2SR",
       
  2178                  SPR_NOACCESS, SPR_NOACCESS,
       
  2179                  &spr_read_generic, &spr_write_generic,
       
  2180                  0x00000000);
       
  2181 }
       
  2182 #endif /* defined (TARGET_PPC64) */
       
  2183 
       
  2184 static void gen_spr_5xx_8xx (CPUPPCState *env)
       
  2185 {
       
  2186     /* Exception processing */
       
  2187     spr_register(env, SPR_DSISR, "DSISR",
       
  2188                  SPR_NOACCESS, SPR_NOACCESS,
       
  2189                  &spr_read_generic, &spr_write_generic,
       
  2190                  0x00000000);
       
  2191     spr_register(env, SPR_DAR, "DAR",
       
  2192                  SPR_NOACCESS, SPR_NOACCESS,
       
  2193                  &spr_read_generic, &spr_write_generic,
       
  2194                  0x00000000);
       
  2195     /* Timer */
       
  2196     spr_register(env, SPR_DECR, "DECR",
       
  2197                  SPR_NOACCESS, SPR_NOACCESS,
       
  2198                  &spr_read_decr, &spr_write_decr,
       
  2199                  0x00000000);
       
  2200     /* XXX : not implemented */
       
  2201     spr_register(env, SPR_MPC_EIE, "EIE",
       
  2202                  SPR_NOACCESS, SPR_NOACCESS,
       
  2203                  &spr_read_generic, &spr_write_generic,
       
  2204                  0x00000000);
       
  2205     /* XXX : not implemented */
       
  2206     spr_register(env, SPR_MPC_EID, "EID",
       
  2207                  SPR_NOACCESS, SPR_NOACCESS,
       
  2208                  &spr_read_generic, &spr_write_generic,
       
  2209                  0x00000000);
       
  2210     /* XXX : not implemented */
       
  2211     spr_register(env, SPR_MPC_NRI, "NRI",
       
  2212                  SPR_NOACCESS, SPR_NOACCESS,
       
  2213                  &spr_read_generic, &spr_write_generic,
       
  2214                  0x00000000);
       
  2215     /* XXX : not implemented */
       
  2216     spr_register(env, SPR_MPC_CMPA, "CMPA",
       
  2217                  SPR_NOACCESS, SPR_NOACCESS,
       
  2218                  &spr_read_generic, &spr_write_generic,
       
  2219                  0x00000000);
       
  2220     /* XXX : not implemented */
       
  2221     spr_register(env, SPR_MPC_CMPB, "CMPB",
       
  2222                  SPR_NOACCESS, SPR_NOACCESS,
       
  2223                  &spr_read_generic, &spr_write_generic,
       
  2224                  0x00000000);
       
  2225     /* XXX : not implemented */
       
  2226     spr_register(env, SPR_MPC_CMPC, "CMPC",
       
  2227                  SPR_NOACCESS, SPR_NOACCESS,
       
  2228                  &spr_read_generic, &spr_write_generic,
       
  2229                  0x00000000);
       
  2230     /* XXX : not implemented */
       
  2231     spr_register(env, SPR_MPC_CMPD, "CMPD",
       
  2232                  SPR_NOACCESS, SPR_NOACCESS,
       
  2233                  &spr_read_generic, &spr_write_generic,
       
  2234                  0x00000000);
       
  2235     /* XXX : not implemented */
       
  2236     spr_register(env, SPR_MPC_ECR, "ECR",
       
  2237                  SPR_NOACCESS, SPR_NOACCESS,
       
  2238                  &spr_read_generic, &spr_write_generic,
       
  2239                  0x00000000);
       
  2240     /* XXX : not implemented */
       
  2241     spr_register(env, SPR_MPC_DER, "DER",
       
  2242                  SPR_NOACCESS, SPR_NOACCESS,
       
  2243                  &spr_read_generic, &spr_write_generic,
       
  2244                  0x00000000);
       
  2245     /* XXX : not implemented */
       
  2246     spr_register(env, SPR_MPC_COUNTA, "COUNTA",
       
  2247                  SPR_NOACCESS, SPR_NOACCESS,
       
  2248                  &spr_read_generic, &spr_write_generic,
       
  2249                  0x00000000);
       
  2250     /* XXX : not implemented */
       
  2251     spr_register(env, SPR_MPC_COUNTB, "COUNTB",
       
  2252                  SPR_NOACCESS, SPR_NOACCESS,
       
  2253                  &spr_read_generic, &spr_write_generic,
       
  2254                  0x00000000);
       
  2255     /* XXX : not implemented */
       
  2256     spr_register(env, SPR_MPC_CMPE, "CMPE",
       
  2257                  SPR_NOACCESS, SPR_NOACCESS,
       
  2258                  &spr_read_generic, &spr_write_generic,
       
  2259                  0x00000000);
       
  2260     /* XXX : not implemented */
       
  2261     spr_register(env, SPR_MPC_CMPF, "CMPF",
       
  2262                  SPR_NOACCESS, SPR_NOACCESS,
       
  2263                  &spr_read_generic, &spr_write_generic,
       
  2264                  0x00000000);
       
  2265     /* XXX : not implemented */
       
  2266     spr_register(env, SPR_MPC_CMPG, "CMPG",
       
  2267                  SPR_NOACCESS, SPR_NOACCESS,
       
  2268                  &spr_read_generic, &spr_write_generic,
       
  2269                  0x00000000);
       
  2270     /* XXX : not implemented */
       
  2271     spr_register(env, SPR_MPC_CMPH, "CMPH",
       
  2272                  SPR_NOACCESS, SPR_NOACCESS,
       
  2273                  &spr_read_generic, &spr_write_generic,
       
  2274                  0x00000000);
       
  2275     /* XXX : not implemented */
       
  2276     spr_register(env, SPR_MPC_LCTRL1, "LCTRL1",
       
  2277                  SPR_NOACCESS, SPR_NOACCESS,
       
  2278                  &spr_read_generic, &spr_write_generic,
       
  2279                  0x00000000);
       
  2280     /* XXX : not implemented */
       
  2281     spr_register(env, SPR_MPC_LCTRL2, "LCTRL2",
       
  2282                  SPR_NOACCESS, SPR_NOACCESS,
       
  2283                  &spr_read_generic, &spr_write_generic,
       
  2284                  0x00000000);
       
  2285     /* XXX : not implemented */
       
  2286     spr_register(env, SPR_MPC_BAR, "BAR",
       
  2287                  SPR_NOACCESS, SPR_NOACCESS,
       
  2288                  &spr_read_generic, &spr_write_generic,
       
  2289                  0x00000000);
       
  2290     /* XXX : not implemented */
       
  2291     spr_register(env, SPR_MPC_DPDR, "DPDR",
       
  2292                  SPR_NOACCESS, SPR_NOACCESS,
       
  2293                  &spr_read_generic, &spr_write_generic,
       
  2294                  0x00000000);
       
  2295     /* XXX : not implemented */
       
  2296     spr_register(env, SPR_MPC_IMMR, "IMMR",
       
  2297                  SPR_NOACCESS, SPR_NOACCESS,
       
  2298                  &spr_read_generic, &spr_write_generic,
       
  2299                  0x00000000);
       
  2300 }
       
  2301 
       
  2302 static void gen_spr_5xx (CPUPPCState *env)
       
  2303 {
       
  2304     /* XXX : not implemented */
       
  2305     spr_register(env, SPR_RCPU_MI_GRA, "MI_GRA",
       
  2306                  SPR_NOACCESS, SPR_NOACCESS,
       
  2307                  &spr_read_generic, &spr_write_generic,
       
  2308                  0x00000000);
       
  2309     /* XXX : not implemented */
       
  2310     spr_register(env, SPR_RCPU_L2U_GRA, "L2U_GRA",
       
  2311                  SPR_NOACCESS, SPR_NOACCESS,
       
  2312                  &spr_read_generic, &spr_write_generic,
       
  2313                  0x00000000);
       
  2314     /* XXX : not implemented */
       
  2315     spr_register(env, SPR_RPCU_BBCMCR, "L2U_BBCMCR",
       
  2316                  SPR_NOACCESS, SPR_NOACCESS,
       
  2317                  &spr_read_generic, &spr_write_generic,
       
  2318                  0x00000000);
       
  2319     /* XXX : not implemented */
       
  2320     spr_register(env, SPR_RCPU_L2U_MCR, "L2U_MCR",
       
  2321                  SPR_NOACCESS, SPR_NOACCESS,
       
  2322                  &spr_read_generic, &spr_write_generic,
       
  2323                  0x00000000);
       
  2324     /* XXX : not implemented */
       
  2325     spr_register(env, SPR_RCPU_MI_RBA0, "MI_RBA0",
       
  2326                  SPR_NOACCESS, SPR_NOACCESS,
       
  2327                  &spr_read_generic, &spr_write_generic,
       
  2328                  0x00000000);
       
  2329     /* XXX : not implemented */
       
  2330     spr_register(env, SPR_RCPU_MI_RBA1, "MI_RBA1",
       
  2331                  SPR_NOACCESS, SPR_NOACCESS,
       
  2332                  &spr_read_generic, &spr_write_generic,
       
  2333                  0x00000000);
       
  2334     /* XXX : not implemented */
       
  2335     spr_register(env, SPR_RCPU_MI_RBA2, "MI_RBA2",
       
  2336                  SPR_NOACCESS, SPR_NOACCESS,
       
  2337                  &spr_read_generic, &spr_write_generic,
       
  2338                  0x00000000);
       
  2339     /* XXX : not implemented */
       
  2340     spr_register(env, SPR_RCPU_MI_RBA3, "MI_RBA3",
       
  2341                  SPR_NOACCESS, SPR_NOACCESS,
       
  2342                  &spr_read_generic, &spr_write_generic,
       
  2343                  0x00000000);
       
  2344     /* XXX : not implemented */
       
  2345     spr_register(env, SPR_RCPU_L2U_RBA0, "L2U_RBA0",
       
  2346                  SPR_NOACCESS, SPR_NOACCESS,
       
  2347                  &spr_read_generic, &spr_write_generic,
       
  2348                  0x00000000);
       
  2349     /* XXX : not implemented */
       
  2350     spr_register(env, SPR_RCPU_L2U_RBA1, "L2U_RBA1",
       
  2351                  SPR_NOACCESS, SPR_NOACCESS,
       
  2352                  &spr_read_generic, &spr_write_generic,
       
  2353                  0x00000000);
       
  2354     /* XXX : not implemented */
       
  2355     spr_register(env, SPR_RCPU_L2U_RBA2, "L2U_RBA2",
       
  2356                  SPR_NOACCESS, SPR_NOACCESS,
       
  2357                  &spr_read_generic, &spr_write_generic,
       
  2358                  0x00000000);
       
  2359     /* XXX : not implemented */
       
  2360     spr_register(env, SPR_RCPU_L2U_RBA3, "L2U_RBA3",
       
  2361                  SPR_NOACCESS, SPR_NOACCESS,
       
  2362                  &spr_read_generic, &spr_write_generic,
       
  2363                  0x00000000);
       
  2364     /* XXX : not implemented */
       
  2365     spr_register(env, SPR_RCPU_MI_RA0, "MI_RA0",
       
  2366                  SPR_NOACCESS, SPR_NOACCESS,
       
  2367                  &spr_read_generic, &spr_write_generic,
       
  2368                  0x00000000);
       
  2369     /* XXX : not implemented */
       
  2370     spr_register(env, SPR_RCPU_MI_RA1, "MI_RA1",
       
  2371                  SPR_NOACCESS, SPR_NOACCESS,
       
  2372                  &spr_read_generic, &spr_write_generic,
       
  2373                  0x00000000);
       
  2374     /* XXX : not implemented */
       
  2375     spr_register(env, SPR_RCPU_MI_RA2, "MI_RA2",
       
  2376                  SPR_NOACCESS, SPR_NOACCESS,
       
  2377                  &spr_read_generic, &spr_write_generic,
       
  2378                  0x00000000);
       
  2379     /* XXX : not implemented */
       
  2380     spr_register(env, SPR_RCPU_MI_RA3, "MI_RA3",
       
  2381                  SPR_NOACCESS, SPR_NOACCESS,
       
  2382                  &spr_read_generic, &spr_write_generic,
       
  2383                  0x00000000);
       
  2384     /* XXX : not implemented */
       
  2385     spr_register(env, SPR_RCPU_L2U_RA0, "L2U_RA0",
       
  2386                  SPR_NOACCESS, SPR_NOACCESS,
       
  2387                  &spr_read_generic, &spr_write_generic,
       
  2388                  0x00000000);
       
  2389     /* XXX : not implemented */
       
  2390     spr_register(env, SPR_RCPU_L2U_RA1, "L2U_RA1",
       
  2391                  SPR_NOACCESS, SPR_NOACCESS,
       
  2392                  &spr_read_generic, &spr_write_generic,
       
  2393                  0x00000000);
       
  2394     /* XXX : not implemented */
       
  2395     spr_register(env, SPR_RCPU_L2U_RA2, "L2U_RA2",
       
  2396                  SPR_NOACCESS, SPR_NOACCESS,
       
  2397                  &spr_read_generic, &spr_write_generic,
       
  2398                  0x00000000);
       
  2399     /* XXX : not implemented */
       
  2400     spr_register(env, SPR_RCPU_L2U_RA3, "L2U_RA3",
       
  2401                  SPR_NOACCESS, SPR_NOACCESS,
       
  2402                  &spr_read_generic, &spr_write_generic,
       
  2403                  0x00000000);
       
  2404     /* XXX : not implemented */
       
  2405     spr_register(env, SPR_RCPU_FPECR, "FPECR",
       
  2406                  SPR_NOACCESS, SPR_NOACCESS,
       
  2407                  &spr_read_generic, &spr_write_generic,
       
  2408                  0x00000000);
       
  2409 }
       
  2410 
       
  2411 static void gen_spr_8xx (CPUPPCState *env)
       
  2412 {
       
  2413     /* XXX : not implemented */
       
  2414     spr_register(env, SPR_MPC_IC_CST, "IC_CST",
       
  2415                  SPR_NOACCESS, SPR_NOACCESS,
       
  2416                  &spr_read_generic, &spr_write_generic,
       
  2417                  0x00000000);
       
  2418     /* XXX : not implemented */
       
  2419     spr_register(env, SPR_MPC_IC_ADR, "IC_ADR",
       
  2420                  SPR_NOACCESS, SPR_NOACCESS,
       
  2421                  &spr_read_generic, &spr_write_generic,
       
  2422                  0x00000000);
       
  2423     /* XXX : not implemented */
       
  2424     spr_register(env, SPR_MPC_IC_DAT, "IC_DAT",
       
  2425                  SPR_NOACCESS, SPR_NOACCESS,
       
  2426                  &spr_read_generic, &spr_write_generic,
       
  2427                  0x00000000);
       
  2428     /* XXX : not implemented */
       
  2429     spr_register(env, SPR_MPC_DC_CST, "DC_CST",
       
  2430                  SPR_NOACCESS, SPR_NOACCESS,
       
  2431                  &spr_read_generic, &spr_write_generic,
       
  2432                  0x00000000);
       
  2433     /* XXX : not implemented */
       
  2434     spr_register(env, SPR_MPC_DC_ADR, "DC_ADR",
       
  2435                  SPR_NOACCESS, SPR_NOACCESS,
       
  2436                  &spr_read_generic, &spr_write_generic,
       
  2437                  0x00000000);
       
  2438     /* XXX : not implemented */
       
  2439     spr_register(env, SPR_MPC_DC_DAT, "DC_DAT",
       
  2440                  SPR_NOACCESS, SPR_NOACCESS,
       
  2441                  &spr_read_generic, &spr_write_generic,
       
  2442                  0x00000000);
       
  2443     /* XXX : not implemented */
       
  2444     spr_register(env, SPR_MPC_MI_CTR, "MI_CTR",
       
  2445                  SPR_NOACCESS, SPR_NOACCESS,
       
  2446                  &spr_read_generic, &spr_write_generic,
       
  2447                  0x00000000);
       
  2448     /* XXX : not implemented */
       
  2449     spr_register(env, SPR_MPC_MI_AP, "MI_AP",
       
  2450                  SPR_NOACCESS, SPR_NOACCESS,
       
  2451                  &spr_read_generic, &spr_write_generic,
       
  2452                  0x00000000);
       
  2453     /* XXX : not implemented */
       
  2454     spr_register(env, SPR_MPC_MI_EPN, "MI_EPN",
       
  2455                  SPR_NOACCESS, SPR_NOACCESS,
       
  2456                  &spr_read_generic, &spr_write_generic,
       
  2457                  0x00000000);
       
  2458     /* XXX : not implemented */
       
  2459     spr_register(env, SPR_MPC_MI_TWC, "MI_TWC",
       
  2460                  SPR_NOACCESS, SPR_NOACCESS,
       
  2461                  &spr_read_generic, &spr_write_generic,
       
  2462                  0x00000000);
       
  2463     /* XXX : not implemented */
       
  2464     spr_register(env, SPR_MPC_MI_RPN, "MI_RPN",
       
  2465                  SPR_NOACCESS, SPR_NOACCESS,
       
  2466                  &spr_read_generic, &spr_write_generic,
       
  2467                  0x00000000);
       
  2468     /* XXX : not implemented */
       
  2469     spr_register(env, SPR_MPC_MI_DBCAM, "MI_DBCAM",
       
  2470                  SPR_NOACCESS, SPR_NOACCESS,
       
  2471                  &spr_read_generic, &spr_write_generic,
       
  2472                  0x00000000);
       
  2473     /* XXX : not implemented */
       
  2474     spr_register(env, SPR_MPC_MI_DBRAM0, "MI_DBRAM0",
       
  2475                  SPR_NOACCESS, SPR_NOACCESS,
       
  2476                  &spr_read_generic, &spr_write_generic,
       
  2477                  0x00000000);
       
  2478     /* XXX : not implemented */
       
  2479     spr_register(env, SPR_MPC_MI_DBRAM1, "MI_DBRAM1",
       
  2480                  SPR_NOACCESS, SPR_NOACCESS,
       
  2481                  &spr_read_generic, &spr_write_generic,
       
  2482                  0x00000000);
       
  2483     /* XXX : not implemented */
       
  2484     spr_register(env, SPR_MPC_MD_CTR, "MD_CTR",
       
  2485                  SPR_NOACCESS, SPR_NOACCESS,
       
  2486                  &spr_read_generic, &spr_write_generic,
       
  2487                  0x00000000);
       
  2488     /* XXX : not implemented */
       
  2489     spr_register(env, SPR_MPC_MD_CASID, "MD_CASID",
       
  2490                  SPR_NOACCESS, SPR_NOACCESS,
       
  2491                  &spr_read_generic, &spr_write_generic,
       
  2492                  0x00000000);
       
  2493     /* XXX : not implemented */
       
  2494     spr_register(env, SPR_MPC_MD_AP, "MD_AP",
       
  2495                  SPR_NOACCESS, SPR_NOACCESS,
       
  2496                  &spr_read_generic, &spr_write_generic,
       
  2497                  0x00000000);
       
  2498     /* XXX : not implemented */
       
  2499     spr_register(env, SPR_MPC_MD_EPN, "MD_EPN",
       
  2500                  SPR_NOACCESS, SPR_NOACCESS,
       
  2501                  &spr_read_generic, &spr_write_generic,
       
  2502                  0x00000000);
       
  2503     /* XXX : not implemented */
       
  2504     spr_register(env, SPR_MPC_MD_TWB, "MD_TWB",
       
  2505                  SPR_NOACCESS, SPR_NOACCESS,
       
  2506                  &spr_read_generic, &spr_write_generic,
       
  2507                  0x00000000);
       
  2508     /* XXX : not implemented */
       
  2509     spr_register(env, SPR_MPC_MD_TWC, "MD_TWC",
       
  2510                  SPR_NOACCESS, SPR_NOACCESS,
       
  2511                  &spr_read_generic, &spr_write_generic,
       
  2512                  0x00000000);
       
  2513     /* XXX : not implemented */
       
  2514     spr_register(env, SPR_MPC_MD_RPN, "MD_RPN",
       
  2515                  SPR_NOACCESS, SPR_NOACCESS,
       
  2516                  &spr_read_generic, &spr_write_generic,
       
  2517                  0x00000000);
       
  2518     /* XXX : not implemented */
       
  2519     spr_register(env, SPR_MPC_MD_TW, "MD_TW",
       
  2520                  SPR_NOACCESS, SPR_NOACCESS,
       
  2521                  &spr_read_generic, &spr_write_generic,
       
  2522                  0x00000000);
       
  2523     /* XXX : not implemented */
       
  2524     spr_register(env, SPR_MPC_MD_DBCAM, "MD_DBCAM",
       
  2525                  SPR_NOACCESS, SPR_NOACCESS,
       
  2526                  &spr_read_generic, &spr_write_generic,
       
  2527                  0x00000000);
       
  2528     /* XXX : not implemented */
       
  2529     spr_register(env, SPR_MPC_MD_DBRAM0, "MD_DBRAM0",
       
  2530                  SPR_NOACCESS, SPR_NOACCESS,
       
  2531                  &spr_read_generic, &spr_write_generic,
       
  2532                  0x00000000);
       
  2533     /* XXX : not implemented */
       
  2534     spr_register(env, SPR_MPC_MD_DBRAM1, "MD_DBRAM1",
       
  2535                  SPR_NOACCESS, SPR_NOACCESS,
       
  2536                  &spr_read_generic, &spr_write_generic,
       
  2537                  0x00000000);
       
  2538 }
       
  2539 
       
  2540 // XXX: TODO
       
  2541 /*
       
  2542  * AMR     => SPR 29 (Power 2.04)
       
  2543  * CTRL    => SPR 136 (Power 2.04)
       
  2544  * CTRL    => SPR 152 (Power 2.04)
       
  2545  * SCOMC   => SPR 276 (64 bits ?)
       
  2546  * SCOMD   => SPR 277 (64 bits ?)
       
  2547  * TBU40   => SPR 286 (Power 2.04 hypv)
       
  2548  * HSPRG0  => SPR 304 (Power 2.04 hypv)
       
  2549  * HSPRG1  => SPR 305 (Power 2.04 hypv)
       
  2550  * HDSISR  => SPR 306 (Power 2.04 hypv)
       
  2551  * HDAR    => SPR 307 (Power 2.04 hypv)
       
  2552  * PURR    => SPR 309 (Power 2.04 hypv)
       
  2553  * HDEC    => SPR 310 (Power 2.04 hypv)
       
  2554  * HIOR    => SPR 311 (hypv)
       
  2555  * RMOR    => SPR 312 (970)
       
  2556  * HRMOR   => SPR 313 (Power 2.04 hypv)
       
  2557  * HSRR0   => SPR 314 (Power 2.04 hypv)
       
  2558  * HSRR1   => SPR 315 (Power 2.04 hypv)
       
  2559  * LPCR    => SPR 316 (970)
       
  2560  * LPIDR   => SPR 317 (970)
       
  2561  * SPEFSCR => SPR 512 (Power 2.04 emb)
       
  2562  * EPR     => SPR 702 (Power 2.04 emb)
       
  2563  * perf    => 768-783 (Power 2.04)
       
  2564  * perf    => 784-799 (Power 2.04)
       
  2565  * PPR     => SPR 896 (Power 2.04)
       
  2566  * EPLC    => SPR 947 (Power 2.04 emb)
       
  2567  * EPSC    => SPR 948 (Power 2.04 emb)
       
  2568  * DABRX   => 1015    (Power 2.04 hypv)
       
  2569  * FPECR   => SPR 1022 (?)
       
  2570  * ... and more (thermal management, performance counters, ...)
       
  2571  */
       
  2572 
       
  2573 /*****************************************************************************/
       
  2574 /* Exception vectors models                                                  */
       
  2575 static void init_excp_4xx_real (CPUPPCState *env)
       
  2576 {
       
  2577 #if !defined(CONFIG_USER_ONLY)
       
  2578     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000100;
       
  2579     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2580     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2581     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2582     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2583     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2584     env->excp_vectors[POWERPC_EXCP_PIT]      = 0x00001000;
       
  2585     env->excp_vectors[POWERPC_EXCP_FIT]      = 0x00001010;
       
  2586     env->excp_vectors[POWERPC_EXCP_WDT]      = 0x00001020;
       
  2587     env->excp_vectors[POWERPC_EXCP_DEBUG]    = 0x00002000;
       
  2588     env->excp_prefix = 0x00000000UL;
       
  2589     env->ivor_mask = 0x0000FFF0UL;
       
  2590     env->ivpr_mask = 0xFFFF0000UL;
       
  2591     /* Hardware reset vector */
       
  2592     env->hreset_vector = 0xFFFFFFFCUL;
       
  2593 #endif
       
  2594 }
       
  2595 
       
  2596 static void init_excp_4xx_softmmu (CPUPPCState *env)
       
  2597 {
       
  2598 #if !defined(CONFIG_USER_ONLY)
       
  2599     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000100;
       
  2600     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2601     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2602     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2603     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2604     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2605     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2606     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2607     env->excp_vectors[POWERPC_EXCP_PIT]      = 0x00001000;
       
  2608     env->excp_vectors[POWERPC_EXCP_FIT]      = 0x00001010;
       
  2609     env->excp_vectors[POWERPC_EXCP_WDT]      = 0x00001020;
       
  2610     env->excp_vectors[POWERPC_EXCP_DTLB]     = 0x00001100;
       
  2611     env->excp_vectors[POWERPC_EXCP_ITLB]     = 0x00001200;
       
  2612     env->excp_vectors[POWERPC_EXCP_DEBUG]    = 0x00002000;
       
  2613     env->excp_prefix = 0x00000000UL;
       
  2614     env->ivor_mask = 0x0000FFF0UL;
       
  2615     env->ivpr_mask = 0xFFFF0000UL;
       
  2616     /* Hardware reset vector */
       
  2617     env->hreset_vector = 0xFFFFFFFCUL;
       
  2618 #endif
       
  2619 }
       
  2620 
       
  2621 static void init_excp_MPC5xx (CPUPPCState *env)
       
  2622 {
       
  2623 #if !defined(CONFIG_USER_ONLY)
       
  2624     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2625     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2626     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2627     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2628     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2629     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000900;
       
  2630     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2631     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2632     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  2633     env->excp_vectors[POWERPC_EXCP_FPA]      = 0x00000E00;
       
  2634     env->excp_vectors[POWERPC_EXCP_EMUL]     = 0x00001000;
       
  2635     env->excp_vectors[POWERPC_EXCP_DABR]     = 0x00001C00;
       
  2636     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001C00;
       
  2637     env->excp_vectors[POWERPC_EXCP_MEXTBR]   = 0x00001E00;
       
  2638     env->excp_vectors[POWERPC_EXCP_NMEXTBR]  = 0x00001F00;
       
  2639     env->excp_prefix = 0x00000000UL;
       
  2640     env->ivor_mask = 0x0000FFF0UL;
       
  2641     env->ivpr_mask = 0xFFFF0000UL;
       
  2642     /* Hardware reset vector */
       
  2643     env->hreset_vector = 0xFFFFFFFCUL;
       
  2644 #endif
       
  2645 }
       
  2646 
       
  2647 static void init_excp_MPC8xx (CPUPPCState *env)
       
  2648 {
       
  2649 #if !defined(CONFIG_USER_ONLY)
       
  2650     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2651     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2652     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2653     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2654     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2655     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2656     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2657     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000900;
       
  2658     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2659     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2660     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  2661     env->excp_vectors[POWERPC_EXCP_FPA]      = 0x00000E00;
       
  2662     env->excp_vectors[POWERPC_EXCP_EMUL]     = 0x00001000;
       
  2663     env->excp_vectors[POWERPC_EXCP_ITLB]     = 0x00001100;
       
  2664     env->excp_vectors[POWERPC_EXCP_DTLB]     = 0x00001200;
       
  2665     env->excp_vectors[POWERPC_EXCP_ITLBE]    = 0x00001300;
       
  2666     env->excp_vectors[POWERPC_EXCP_DTLBE]    = 0x00001400;
       
  2667     env->excp_vectors[POWERPC_EXCP_DABR]     = 0x00001C00;
       
  2668     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001C00;
       
  2669     env->excp_vectors[POWERPC_EXCP_MEXTBR]   = 0x00001E00;
       
  2670     env->excp_vectors[POWERPC_EXCP_NMEXTBR]  = 0x00001F00;
       
  2671     env->excp_prefix = 0x00000000UL;
       
  2672     env->ivor_mask = 0x0000FFF0UL;
       
  2673     env->ivpr_mask = 0xFFFF0000UL;
       
  2674     /* Hardware reset vector */
       
  2675     env->hreset_vector = 0xFFFFFFFCUL;
       
  2676 #endif
       
  2677 }
       
  2678 
       
  2679 static void init_excp_G2 (CPUPPCState *env)
       
  2680 {
       
  2681 #if !defined(CONFIG_USER_ONLY)
       
  2682     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2683     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2684     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2685     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2686     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2687     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2688     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2689     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  2690     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2691     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000A00;
       
  2692     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2693     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  2694     env->excp_vectors[POWERPC_EXCP_IFTLB]    = 0x00001000;
       
  2695     env->excp_vectors[POWERPC_EXCP_DLTLB]    = 0x00001100;
       
  2696     env->excp_vectors[POWERPC_EXCP_DSTLB]    = 0x00001200;
       
  2697     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
       
  2698     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
       
  2699     env->excp_prefix = 0x00000000UL;
       
  2700     /* Hardware reset vector */
       
  2701     env->hreset_vector = 0xFFFFFFFCUL;
       
  2702 #endif
       
  2703 }
       
  2704 
       
  2705 static void init_excp_e200 (CPUPPCState *env)
       
  2706 {
       
  2707 #if !defined(CONFIG_USER_ONLY)
       
  2708     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000FFC;
       
  2709     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000000;
       
  2710     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000000;
       
  2711     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000000;
       
  2712     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000000;
       
  2713     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000000;
       
  2714     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000000;
       
  2715     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000000;
       
  2716     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000000;
       
  2717     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000000;
       
  2718     env->excp_vectors[POWERPC_EXCP_APU]      = 0x00000000;
       
  2719     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000000;
       
  2720     env->excp_vectors[POWERPC_EXCP_FIT]      = 0x00000000;
       
  2721     env->excp_vectors[POWERPC_EXCP_WDT]      = 0x00000000;
       
  2722     env->excp_vectors[POWERPC_EXCP_DTLB]     = 0x00000000;
       
  2723     env->excp_vectors[POWERPC_EXCP_ITLB]     = 0x00000000;
       
  2724     env->excp_vectors[POWERPC_EXCP_DEBUG]    = 0x00000000;
       
  2725     env->excp_vectors[POWERPC_EXCP_SPEU]     = 0x00000000;
       
  2726     env->excp_vectors[POWERPC_EXCP_EFPDI]    = 0x00000000;
       
  2727     env->excp_vectors[POWERPC_EXCP_EFPRI]    = 0x00000000;
       
  2728     env->excp_prefix = 0x00000000UL;
       
  2729     env->ivor_mask = 0x0000FFF7UL;
       
  2730     env->ivpr_mask = 0xFFFF0000UL;
       
  2731     /* Hardware reset vector */
       
  2732     env->hreset_vector = 0xFFFFFFFCUL;
       
  2733 #endif
       
  2734 }
       
  2735 
       
  2736 static void init_excp_BookE (CPUPPCState *env)
       
  2737 {
       
  2738 #if !defined(CONFIG_USER_ONLY)
       
  2739     env->excp_vectors[POWERPC_EXCP_CRITICAL] = 0x00000000;
       
  2740     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000000;
       
  2741     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000000;
       
  2742     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000000;
       
  2743     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000000;
       
  2744     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000000;
       
  2745     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000000;
       
  2746     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000000;
       
  2747     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000000;
       
  2748     env->excp_vectors[POWERPC_EXCP_APU]      = 0x00000000;
       
  2749     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000000;
       
  2750     env->excp_vectors[POWERPC_EXCP_FIT]      = 0x00000000;
       
  2751     env->excp_vectors[POWERPC_EXCP_WDT]      = 0x00000000;
       
  2752     env->excp_vectors[POWERPC_EXCP_DTLB]     = 0x00000000;
       
  2753     env->excp_vectors[POWERPC_EXCP_ITLB]     = 0x00000000;
       
  2754     env->excp_vectors[POWERPC_EXCP_DEBUG]    = 0x00000000;
       
  2755     env->excp_prefix = 0x00000000UL;
       
  2756     env->ivor_mask = 0x0000FFE0UL;
       
  2757     env->ivpr_mask = 0xFFFF0000UL;
       
  2758     /* Hardware reset vector */
       
  2759     env->hreset_vector = 0xFFFFFFFCUL;
       
  2760 #endif
       
  2761 }
       
  2762 
       
  2763 static void init_excp_601 (CPUPPCState *env)
       
  2764 {
       
  2765 #if !defined(CONFIG_USER_ONLY)
       
  2766     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2767     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2768     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2769     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2770     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2771     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2772     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2773     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  2774     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2775     env->excp_vectors[POWERPC_EXCP_IO]       = 0x00000A00;
       
  2776     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2777     env->excp_vectors[POWERPC_EXCP_RUNM]     = 0x00002000;
       
  2778     env->excp_prefix = 0xFFF00000UL;
       
  2779     /* Hardware reset vector */
       
  2780     env->hreset_vector = 0x00000100UL;
       
  2781 #endif
       
  2782 }
       
  2783 
       
  2784 static void init_excp_602 (CPUPPCState *env)
       
  2785 {
       
  2786 #if !defined(CONFIG_USER_ONLY)
       
  2787     /* XXX: exception prefix has a special behavior on 602 */
       
  2788     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2789     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2790     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2791     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2792     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2793     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2794     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2795     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  2796     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2797     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2798     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  2799     env->excp_vectors[POWERPC_EXCP_IFTLB]    = 0x00001000;
       
  2800     env->excp_vectors[POWERPC_EXCP_DLTLB]    = 0x00001100;
       
  2801     env->excp_vectors[POWERPC_EXCP_DSTLB]    = 0x00001200;
       
  2802     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
       
  2803     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
       
  2804     env->excp_vectors[POWERPC_EXCP_WDT]      = 0x00001500;
       
  2805     env->excp_vectors[POWERPC_EXCP_EMUL]     = 0x00001600;
       
  2806     env->excp_prefix = 0xFFF00000UL;
       
  2807     /* Hardware reset vector */
       
  2808     env->hreset_vector = 0xFFFFFFFCUL;
       
  2809 #endif
       
  2810 }
       
  2811 
       
  2812 static void init_excp_603 (CPUPPCState *env)
       
  2813 {
       
  2814 #if !defined(CONFIG_USER_ONLY)
       
  2815     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2816     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2817     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2818     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2819     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2820     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2821     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2822     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  2823     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2824     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2825     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  2826     env->excp_vectors[POWERPC_EXCP_IFTLB]    = 0x00001000;
       
  2827     env->excp_vectors[POWERPC_EXCP_DLTLB]    = 0x00001100;
       
  2828     env->excp_vectors[POWERPC_EXCP_DSTLB]    = 0x00001200;
       
  2829     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
       
  2830     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
       
  2831     env->excp_prefix = 0x00000000UL;
       
  2832     /* Hardware reset vector */
       
  2833     env->hreset_vector = 0xFFFFFFFCUL;
       
  2834 #endif
       
  2835 }
       
  2836 
       
  2837 static void init_excp_604 (CPUPPCState *env)
       
  2838 {
       
  2839 #if !defined(CONFIG_USER_ONLY)
       
  2840     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2841     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2842     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2843     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2844     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2845     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2846     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2847     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  2848     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2849     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2850     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  2851     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
       
  2852     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
       
  2853     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
       
  2854     env->excp_prefix = 0x00000000UL;
       
  2855     /* Hardware reset vector */
       
  2856     env->hreset_vector = 0xFFFFFFFCUL;
       
  2857 #endif
       
  2858 }
       
  2859 
       
  2860 #if defined(TARGET_PPC64)
       
  2861 static void init_excp_620 (CPUPPCState *env)
       
  2862 {
       
  2863 #if !defined(CONFIG_USER_ONLY)
       
  2864     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2865     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2866     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2867     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2868     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2869     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2870     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2871     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  2872     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2873     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2874     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  2875     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
       
  2876     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
       
  2877     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
       
  2878     env->excp_prefix = 0xFFF00000UL;
       
  2879     /* Hardware reset vector */
       
  2880     env->hreset_vector = 0x0000000000000100ULL;
       
  2881 #endif
       
  2882 }
       
  2883 #endif /* defined(TARGET_PPC64) */
       
  2884 
       
  2885 static void init_excp_7x0 (CPUPPCState *env)
       
  2886 {
       
  2887 #if !defined(CONFIG_USER_ONLY)
       
  2888     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2889     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2890     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2891     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2892     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2893     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2894     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2895     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  2896     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2897     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2898     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  2899     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
       
  2900     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
       
  2901     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
       
  2902     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001700;
       
  2903     env->excp_prefix = 0x00000000UL;
       
  2904     /* Hardware reset vector */
       
  2905     env->hreset_vector = 0xFFFFFFFCUL;
       
  2906 #endif
       
  2907 }
       
  2908 
       
  2909 static void init_excp_750cl (CPUPPCState *env)
       
  2910 {
       
  2911 #if !defined(CONFIG_USER_ONLY)
       
  2912     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2913     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2914     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2915     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2916     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2917     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2918     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2919     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  2920     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2921     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2922     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  2923     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
       
  2924     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
       
  2925     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
       
  2926     env->excp_prefix = 0x00000000UL;
       
  2927     /* Hardware reset vector */
       
  2928     env->hreset_vector = 0xFFFFFFFCUL;
       
  2929 #endif
       
  2930 }
       
  2931 
       
  2932 static void init_excp_750cx (CPUPPCState *env)
       
  2933 {
       
  2934 #if !defined(CONFIG_USER_ONLY)
       
  2935     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2936     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2937     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2938     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2939     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2940     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2941     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2942     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  2943     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2944     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2945     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  2946     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
       
  2947     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
       
  2948     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001700;
       
  2949     env->excp_prefix = 0x00000000UL;
       
  2950     /* Hardware reset vector */
       
  2951     env->hreset_vector = 0xFFFFFFFCUL;
       
  2952 #endif
       
  2953 }
       
  2954 
       
  2955 /* XXX: Check if this is correct */
       
  2956 static void init_excp_7x5 (CPUPPCState *env)
       
  2957 {
       
  2958 #if !defined(CONFIG_USER_ONLY)
       
  2959     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2960     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2961     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2962     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2963     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2964     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2965     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2966     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  2967     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2968     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2969     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  2970     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
       
  2971     env->excp_vectors[POWERPC_EXCP_IFTLB]    = 0x00001000;
       
  2972     env->excp_vectors[POWERPC_EXCP_DLTLB]    = 0x00001100;
       
  2973     env->excp_vectors[POWERPC_EXCP_DSTLB]    = 0x00001200;
       
  2974     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
       
  2975     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
       
  2976     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001700;
       
  2977     env->excp_prefix = 0x00000000UL;
       
  2978     /* Hardware reset vector */
       
  2979     env->hreset_vector = 0xFFFFFFFCUL;
       
  2980 #endif
       
  2981 }
       
  2982 
       
  2983 static void init_excp_7400 (CPUPPCState *env)
       
  2984 {
       
  2985 #if !defined(CONFIG_USER_ONLY)
       
  2986     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  2987     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  2988     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  2989     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  2990     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  2991     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  2992     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  2993     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  2994     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  2995     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  2996     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  2997     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
       
  2998     env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;
       
  2999     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
       
  3000     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
       
  3001     env->excp_vectors[POWERPC_EXCP_VPUA]     = 0x00001600;
       
  3002     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001700;
       
  3003     env->excp_prefix = 0x00000000UL;
       
  3004     /* Hardware reset vector */
       
  3005     env->hreset_vector = 0xFFFFFFFCUL;
       
  3006 #endif
       
  3007 }
       
  3008 
       
  3009 static void init_excp_7450 (CPUPPCState *env)
       
  3010 {
       
  3011 #if !defined(CONFIG_USER_ONLY)
       
  3012     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  3013     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  3014     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  3015     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  3016     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  3017     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  3018     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  3019     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  3020     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  3021     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  3022     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  3023     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
       
  3024     env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;
       
  3025     env->excp_vectors[POWERPC_EXCP_IFTLB]    = 0x00001000;
       
  3026     env->excp_vectors[POWERPC_EXCP_DLTLB]    = 0x00001100;
       
  3027     env->excp_vectors[POWERPC_EXCP_DSTLB]    = 0x00001200;
       
  3028     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
       
  3029     env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;
       
  3030     env->excp_vectors[POWERPC_EXCP_VPUA]     = 0x00001600;
       
  3031     env->excp_prefix = 0x00000000UL;
       
  3032     /* Hardware reset vector */
       
  3033     env->hreset_vector = 0xFFFFFFFCUL;
       
  3034 #endif
       
  3035 }
       
  3036 
       
  3037 #if defined (TARGET_PPC64)
       
  3038 static void init_excp_970 (CPUPPCState *env)
       
  3039 {
       
  3040 #if !defined(CONFIG_USER_ONLY)
       
  3041     env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;
       
  3042     env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;
       
  3043     env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;
       
  3044     env->excp_vectors[POWERPC_EXCP_DSEG]     = 0x00000380;
       
  3045     env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;
       
  3046     env->excp_vectors[POWERPC_EXCP_ISEG]     = 0x00000480;
       
  3047     env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;
       
  3048     env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;
       
  3049     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;
       
  3050     env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;
       
  3051     env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;
       
  3052     env->excp_vectors[POWERPC_EXCP_HDECR]    = 0x00000980;
       
  3053     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;
       
  3054     env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;
       
  3055     env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;
       
  3056     env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;
       
  3057     env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;
       
  3058     env->excp_vectors[POWERPC_EXCP_MAINT]    = 0x00001600;
       
  3059     env->excp_vectors[POWERPC_EXCP_VPUA]     = 0x00001700;
       
  3060     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001800;
       
  3061     env->excp_prefix   = 0x00000000FFF00000ULL;
       
  3062     /* Hardware reset vector */
       
  3063     env->hreset_vector = 0x0000000000000100ULL;
       
  3064 #endif
       
  3065 }
       
  3066 #endif
       
  3067 
       
  3068 /*****************************************************************************/
       
  3069 /* Power management enable checks                                            */
       
  3070 static int check_pow_none (CPUPPCState *env)
       
  3071 {
       
  3072     return 0;
       
  3073 }
       
  3074 
       
  3075 static int check_pow_nocheck (CPUPPCState *env)
       
  3076 {
       
  3077     return 1;
       
  3078 }
       
  3079 
       
  3080 static int check_pow_hid0 (CPUPPCState *env)
       
  3081 {
       
  3082     if (env->spr[SPR_HID0] & 0x00E00000)
       
  3083         return 1;
       
  3084 
       
  3085     return 0;
       
  3086 }
       
  3087 
       
  3088 static int check_pow_hid0_74xx (CPUPPCState *env)
       
  3089 {
       
  3090     if (env->spr[SPR_HID0] & 0x00600000)
       
  3091         return 1;
       
  3092 
       
  3093     return 0;
       
  3094 }
       
  3095 
       
  3096 /*****************************************************************************/
       
  3097 /* PowerPC implementations definitions                                       */
       
  3098 
       
  3099 /* PowerPC 401                                                               */
       
  3100 #define POWERPC_INSNS_401    (PPC_INSNS_BASE | PPC_STRING |                   \
       
  3101                               PPC_WRTEE | PPC_DCR |                           \
       
  3102                               PPC_CACHE | PPC_CACHE_ICBI | PPC_40x_ICBT |     \
       
  3103                               PPC_CACHE_DCBZ |                                \
       
  3104                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  3105                               PPC_4xx_COMMON | PPC_40x_EXCP)
       
  3106 #define POWERPC_MSRM_401     (0x00000000000FD201ULL)
       
  3107 #define POWERPC_MMU_401      (POWERPC_MMU_REAL)
       
  3108 #define POWERPC_EXCP_401     (POWERPC_EXCP_40x)
       
  3109 #define POWERPC_INPUT_401    (PPC_FLAGS_INPUT_401)
       
  3110 #define POWERPC_BFDM_401     (bfd_mach_ppc_403)
       
  3111 #define POWERPC_FLAG_401     (POWERPC_FLAG_CE | POWERPC_FLAG_DE |             \
       
  3112                               POWERPC_FLAG_BUS_CLK)
       
  3113 #define check_pow_401        check_pow_nocheck
       
  3114 
       
  3115 static void init_proc_401 (CPUPPCState *env)
       
  3116 {
       
  3117     gen_spr_40x(env);
       
  3118     gen_spr_401_403(env);
       
  3119     gen_spr_401(env);
       
  3120     init_excp_4xx_real(env);
       
  3121     env->dcache_line_size = 32;
       
  3122     env->icache_line_size = 32;
       
  3123     /* Allocate hardware IRQ controller */
       
  3124     ppc40x_irq_init(env);
       
  3125 }
       
  3126 
       
  3127 /* PowerPC 401x2                                                             */
       
  3128 #define POWERPC_INSNS_401x2  (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  3129                               PPC_DCR | PPC_WRTEE |                           \
       
  3130                               PPC_CACHE | PPC_CACHE_ICBI | PPC_40x_ICBT |     \
       
  3131                               PPC_CACHE_DCBZ | PPC_CACHE_DCBA |               \
       
  3132                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  3133                               PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | \
       
  3134                               PPC_4xx_COMMON | PPC_40x_EXCP)
       
  3135 #define POWERPC_MSRM_401x2   (0x00000000001FD231ULL)
       
  3136 #define POWERPC_MMU_401x2    (POWERPC_MMU_SOFT_4xx_Z)
       
  3137 #define POWERPC_EXCP_401x2   (POWERPC_EXCP_40x)
       
  3138 #define POWERPC_INPUT_401x2  (PPC_FLAGS_INPUT_401)
       
  3139 #define POWERPC_BFDM_401x2   (bfd_mach_ppc_403)
       
  3140 #define POWERPC_FLAG_401x2   (POWERPC_FLAG_CE | POWERPC_FLAG_DE |             \
       
  3141                               POWERPC_FLAG_BUS_CLK)
       
  3142 #define check_pow_401x2      check_pow_nocheck
       
  3143 
       
  3144 static void init_proc_401x2 (CPUPPCState *env)
       
  3145 {
       
  3146     gen_spr_40x(env);
       
  3147     gen_spr_401_403(env);
       
  3148     gen_spr_401x2(env);
       
  3149     gen_spr_compress(env);
       
  3150     /* Memory management */
       
  3151 #if !defined(CONFIG_USER_ONLY)
       
  3152     env->nb_tlb = 64;
       
  3153     env->nb_ways = 1;
       
  3154     env->id_tlbs = 0;
       
  3155 #endif
       
  3156     init_excp_4xx_softmmu(env);
       
  3157     env->dcache_line_size = 32;
       
  3158     env->icache_line_size = 32;
       
  3159     /* Allocate hardware IRQ controller */
       
  3160     ppc40x_irq_init(env);
       
  3161 }
       
  3162 
       
  3163 /* PowerPC 401x3                                                             */
       
  3164 #define POWERPC_INSNS_401x3  (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  3165                               PPC_DCR | PPC_WRTEE |                           \
       
  3166                               PPC_CACHE | PPC_CACHE_ICBI | PPC_40x_ICBT |     \
       
  3167                               PPC_CACHE_DCBZ | PPC_CACHE_DCBA |               \
       
  3168                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  3169                               PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | \
       
  3170                               PPC_4xx_COMMON | PPC_40x_EXCP)
       
  3171 #define POWERPC_MSRM_401x3   (0x00000000001FD631ULL)
       
  3172 #define POWERPC_MMU_401x3    (POWERPC_MMU_SOFT_4xx_Z)
       
  3173 #define POWERPC_EXCP_401x3   (POWERPC_EXCP_40x)
       
  3174 #define POWERPC_INPUT_401x3  (PPC_FLAGS_INPUT_401)
       
  3175 #define POWERPC_BFDM_401x3   (bfd_mach_ppc_403)
       
  3176 #define POWERPC_FLAG_401x3   (POWERPC_FLAG_CE | POWERPC_FLAG_DE |             \
       
  3177                               POWERPC_FLAG_BUS_CLK)
       
  3178 #define check_pow_401x3      check_pow_nocheck
       
  3179 
       
  3180 __attribute__ (( unused ))
       
  3181 static void init_proc_401x3 (CPUPPCState *env)
       
  3182 {
       
  3183     gen_spr_40x(env);
       
  3184     gen_spr_401_403(env);
       
  3185     gen_spr_401(env);
       
  3186     gen_spr_401x2(env);
       
  3187     gen_spr_compress(env);
       
  3188     init_excp_4xx_softmmu(env);
       
  3189     env->dcache_line_size = 32;
       
  3190     env->icache_line_size = 32;
       
  3191     /* Allocate hardware IRQ controller */
       
  3192     ppc40x_irq_init(env);
       
  3193 }
       
  3194 
       
  3195 /* IOP480                                                                    */
       
  3196 #define POWERPC_INSNS_IOP480 (PPC_INSNS_BASE | PPC_STRING |                   \
       
  3197                               PPC_DCR | PPC_WRTEE |                           \
       
  3198                               PPC_CACHE | PPC_CACHE_ICBI |  PPC_40x_ICBT |    \
       
  3199                               PPC_CACHE_DCBZ | PPC_CACHE_DCBA |               \
       
  3200                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  3201                               PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | \
       
  3202                               PPC_4xx_COMMON | PPC_40x_EXCP)
       
  3203 #define POWERPC_MSRM_IOP480  (0x00000000001FD231ULL)
       
  3204 #define POWERPC_MMU_IOP480   (POWERPC_MMU_SOFT_4xx_Z)
       
  3205 #define POWERPC_EXCP_IOP480  (POWERPC_EXCP_40x)
       
  3206 #define POWERPC_INPUT_IOP480 (PPC_FLAGS_INPUT_401)
       
  3207 #define POWERPC_BFDM_IOP480  (bfd_mach_ppc_403)
       
  3208 #define POWERPC_FLAG_IOP480  (POWERPC_FLAG_CE | POWERPC_FLAG_DE |             \
       
  3209                               POWERPC_FLAG_BUS_CLK)
       
  3210 #define check_pow_IOP480     check_pow_nocheck
       
  3211 
       
  3212 static void init_proc_IOP480 (CPUPPCState *env)
       
  3213 {
       
  3214     gen_spr_40x(env);
       
  3215     gen_spr_401_403(env);
       
  3216     gen_spr_401x2(env);
       
  3217     gen_spr_compress(env);
       
  3218     /* Memory management */
       
  3219 #if !defined(CONFIG_USER_ONLY)
       
  3220     env->nb_tlb = 64;
       
  3221     env->nb_ways = 1;
       
  3222     env->id_tlbs = 0;
       
  3223 #endif
       
  3224     init_excp_4xx_softmmu(env);
       
  3225     env->dcache_line_size = 32;
       
  3226     env->icache_line_size = 32;
       
  3227     /* Allocate hardware IRQ controller */
       
  3228     ppc40x_irq_init(env);
       
  3229 }
       
  3230 
       
  3231 /* PowerPC 403                                                               */
       
  3232 #define POWERPC_INSNS_403    (PPC_INSNS_BASE | PPC_STRING |                   \
       
  3233                               PPC_DCR | PPC_WRTEE |                           \
       
  3234                               PPC_CACHE | PPC_CACHE_ICBI | PPC_40x_ICBT |     \
       
  3235                               PPC_CACHE_DCBZ |                                \
       
  3236                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  3237                               PPC_4xx_COMMON | PPC_40x_EXCP)
       
  3238 #define POWERPC_MSRM_403     (0x000000000007D00DULL)
       
  3239 #define POWERPC_MMU_403      (POWERPC_MMU_REAL)
       
  3240 #define POWERPC_EXCP_403     (POWERPC_EXCP_40x)
       
  3241 #define POWERPC_INPUT_403    (PPC_FLAGS_INPUT_401)
       
  3242 #define POWERPC_BFDM_403     (bfd_mach_ppc_403)
       
  3243 #define POWERPC_FLAG_403     (POWERPC_FLAG_CE | POWERPC_FLAG_PX |             \
       
  3244                               POWERPC_FLAG_BUS_CLK)
       
  3245 #define check_pow_403        check_pow_nocheck
       
  3246 
       
  3247 static void init_proc_403 (CPUPPCState *env)
       
  3248 {
       
  3249     gen_spr_40x(env);
       
  3250     gen_spr_401_403(env);
       
  3251     gen_spr_403(env);
       
  3252     gen_spr_403_real(env);
       
  3253     init_excp_4xx_real(env);
       
  3254     env->dcache_line_size = 32;
       
  3255     env->icache_line_size = 32;
       
  3256     /* Allocate hardware IRQ controller */
       
  3257     ppc40x_irq_init(env);
       
  3258 }
       
  3259 
       
  3260 /* PowerPC 403 GCX                                                           */
       
  3261 #define POWERPC_INSNS_403GCX (PPC_INSNS_BASE | PPC_STRING |                   \
       
  3262                               PPC_DCR | PPC_WRTEE |                           \
       
  3263                               PPC_CACHE | PPC_CACHE_ICBI | PPC_40x_ICBT |     \
       
  3264                               PPC_CACHE_DCBZ |                                \
       
  3265                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  3266                               PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | \
       
  3267                               PPC_4xx_COMMON | PPC_40x_EXCP)
       
  3268 #define POWERPC_MSRM_403GCX  (0x000000000007D00DULL)
       
  3269 #define POWERPC_MMU_403GCX   (POWERPC_MMU_SOFT_4xx_Z)
       
  3270 #define POWERPC_EXCP_403GCX  (POWERPC_EXCP_40x)
       
  3271 #define POWERPC_INPUT_403GCX (PPC_FLAGS_INPUT_401)
       
  3272 #define POWERPC_BFDM_403GCX  (bfd_mach_ppc_403)
       
  3273 #define POWERPC_FLAG_403GCX  (POWERPC_FLAG_CE | POWERPC_FLAG_PX |             \
       
  3274                               POWERPC_FLAG_BUS_CLK)
       
  3275 #define check_pow_403GCX     check_pow_nocheck
       
  3276 
       
  3277 static void init_proc_403GCX (CPUPPCState *env)
       
  3278 {
       
  3279     gen_spr_40x(env);
       
  3280     gen_spr_401_403(env);
       
  3281     gen_spr_403(env);
       
  3282     gen_spr_403_real(env);
       
  3283     gen_spr_403_mmu(env);
       
  3284     /* Bus access control */
       
  3285     /* not emulated, as Qemu never does speculative access */
       
  3286     spr_register(env, SPR_40x_SGR, "SGR",
       
  3287                  SPR_NOACCESS, SPR_NOACCESS,
       
  3288                  &spr_read_generic, &spr_write_generic,
       
  3289                  0xFFFFFFFF);
       
  3290     /* not emulated, as Qemu do not emulate caches */
       
  3291     spr_register(env, SPR_40x_DCWR, "DCWR",
       
  3292                  SPR_NOACCESS, SPR_NOACCESS,
       
  3293                  &spr_read_generic, &spr_write_generic,
       
  3294                  0x00000000);
       
  3295     /* Memory management */
       
  3296 #if !defined(CONFIG_USER_ONLY)
       
  3297     env->nb_tlb = 64;
       
  3298     env->nb_ways = 1;
       
  3299     env->id_tlbs = 0;
       
  3300 #endif
       
  3301     init_excp_4xx_softmmu(env);
       
  3302     env->dcache_line_size = 32;
       
  3303     env->icache_line_size = 32;
       
  3304     /* Allocate hardware IRQ controller */
       
  3305     ppc40x_irq_init(env);
       
  3306 }
       
  3307 
       
  3308 /* PowerPC 405                                                               */
       
  3309 #define POWERPC_INSNS_405    (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  3310                               PPC_DCR | PPC_WRTEE |                           \
       
  3311                               PPC_CACHE | PPC_CACHE_ICBI | PPC_40x_ICBT |     \
       
  3312                               PPC_CACHE_DCBZ | PPC_CACHE_DCBA |               \
       
  3313                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  3314                               PPC_40x_TLB | PPC_MEM_TLBIA | PPC_MEM_TLBSYNC | \
       
  3315                               PPC_4xx_COMMON | PPC_405_MAC | PPC_40x_EXCP)
       
  3316 #define POWERPC_MSRM_405     (0x000000000006E630ULL)
       
  3317 #define POWERPC_MMU_405      (POWERPC_MMU_SOFT_4xx)
       
  3318 #define POWERPC_EXCP_405     (POWERPC_EXCP_40x)
       
  3319 #define POWERPC_INPUT_405    (PPC_FLAGS_INPUT_405)
       
  3320 #define POWERPC_BFDM_405     (bfd_mach_ppc_403)
       
  3321 #define POWERPC_FLAG_405     (POWERPC_FLAG_CE | POWERPC_FLAG_DWE |            \
       
  3322                               POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
       
  3323 #define check_pow_405        check_pow_nocheck
       
  3324 
       
  3325 static void init_proc_405 (CPUPPCState *env)
       
  3326 {
       
  3327     /* Time base */
       
  3328     gen_tbl(env);
       
  3329     gen_spr_40x(env);
       
  3330     gen_spr_405(env);
       
  3331     /* Bus access control */
       
  3332     /* not emulated, as Qemu never does speculative access */
       
  3333     spr_register(env, SPR_40x_SGR, "SGR",
       
  3334                  SPR_NOACCESS, SPR_NOACCESS,
       
  3335                  &spr_read_generic, &spr_write_generic,
       
  3336                  0xFFFFFFFF);
       
  3337     /* not emulated, as Qemu do not emulate caches */
       
  3338     spr_register(env, SPR_40x_DCWR, "DCWR",
       
  3339                  SPR_NOACCESS, SPR_NOACCESS,
       
  3340                  &spr_read_generic, &spr_write_generic,
       
  3341                  0x00000000);
       
  3342     /* Memory management */
       
  3343 #if !defined(CONFIG_USER_ONLY)
       
  3344     env->nb_tlb = 64;
       
  3345     env->nb_ways = 1;
       
  3346     env->id_tlbs = 0;
       
  3347 #endif
       
  3348     init_excp_4xx_softmmu(env);
       
  3349     env->dcache_line_size = 32;
       
  3350     env->icache_line_size = 32;
       
  3351     /* Allocate hardware IRQ controller */
       
  3352     ppc40x_irq_init(env);
       
  3353 }
       
  3354 
       
  3355 /* PowerPC 440 EP                                                            */
       
  3356 #define POWERPC_INSNS_440EP  (PPC_INSNS_BASE | PPC_STRING |                   \
       
  3357                               PPC_DCR | PPC_WRTEE | PPC_RFMCI |               \
       
  3358                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  3359                               PPC_CACHE_DCBZ | PPC_CACHE_DCBA |               \
       
  3360                               PPC_MEM_TLBSYNC |                               \
       
  3361                               PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |      \
       
  3362                               PPC_440_SPEC)
       
  3363 #define POWERPC_MSRM_440EP   (0x000000000006D630ULL)
       
  3364 #define POWERPC_MMU_440EP    (POWERPC_MMU_BOOKE)
       
  3365 #define POWERPC_EXCP_440EP   (POWERPC_EXCP_BOOKE)
       
  3366 #define POWERPC_INPUT_440EP  (PPC_FLAGS_INPUT_BookE)
       
  3367 #define POWERPC_BFDM_440EP   (bfd_mach_ppc_403)
       
  3368 #define POWERPC_FLAG_440EP   (POWERPC_FLAG_CE | POWERPC_FLAG_DWE |            \
       
  3369                               POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
       
  3370 #define check_pow_440EP      check_pow_nocheck
       
  3371 
       
  3372 __attribute__ (( unused ))
       
  3373 static void init_proc_440EP (CPUPPCState *env)
       
  3374 {
       
  3375     /* Time base */
       
  3376     gen_tbl(env);
       
  3377     gen_spr_BookE(env, 0x000000000000FFFFULL);
       
  3378     gen_spr_440(env);
       
  3379     gen_spr_usprgh(env);
       
  3380     /* Processor identification */
       
  3381     spr_register(env, SPR_BOOKE_PIR, "PIR",
       
  3382                  SPR_NOACCESS, SPR_NOACCESS,
       
  3383                  &spr_read_generic, &spr_write_pir,
       
  3384                  0x00000000);
       
  3385     /* XXX : not implemented */
       
  3386     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
       
  3387                  SPR_NOACCESS, SPR_NOACCESS,
       
  3388                  &spr_read_generic, &spr_write_generic,
       
  3389                  0x00000000);
       
  3390     /* XXX : not implemented */
       
  3391     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
       
  3392                  SPR_NOACCESS, SPR_NOACCESS,
       
  3393                  &spr_read_generic, &spr_write_generic,
       
  3394                  0x00000000);
       
  3395     /* XXX : not implemented */
       
  3396     spr_register(env, SPR_BOOKE_DVC1, "DVC1",
       
  3397                  SPR_NOACCESS, SPR_NOACCESS,
       
  3398                  &spr_read_generic, &spr_write_generic,
       
  3399                  0x00000000);
       
  3400     /* XXX : not implemented */
       
  3401     spr_register(env, SPR_BOOKE_DVC2, "DVC2",
       
  3402                  SPR_NOACCESS, SPR_NOACCESS,
       
  3403                  &spr_read_generic, &spr_write_generic,
       
  3404                  0x00000000);
       
  3405     /* XXX : not implemented */
       
  3406     spr_register(env, SPR_BOOKE_MCSR, "MCSR",
       
  3407                  SPR_NOACCESS, SPR_NOACCESS,
       
  3408                  &spr_read_generic, &spr_write_generic,
       
  3409                  0x00000000);
       
  3410     spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
       
  3411                  SPR_NOACCESS, SPR_NOACCESS,
       
  3412                  &spr_read_generic, &spr_write_generic,
       
  3413                  0x00000000);
       
  3414     spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
       
  3415                  SPR_NOACCESS, SPR_NOACCESS,
       
  3416                  &spr_read_generic, &spr_write_generic,
       
  3417                  0x00000000);
       
  3418     /* XXX : not implemented */
       
  3419     spr_register(env, SPR_440_CCR1, "CCR1",
       
  3420                  SPR_NOACCESS, SPR_NOACCESS,
       
  3421                  &spr_read_generic, &spr_write_generic,
       
  3422                  0x00000000);
       
  3423     /* Memory management */
       
  3424 #if !defined(CONFIG_USER_ONLY)
       
  3425     env->nb_tlb = 64;
       
  3426     env->nb_ways = 1;
       
  3427     env->id_tlbs = 0;
       
  3428 #endif
       
  3429     init_excp_BookE(env);
       
  3430     env->dcache_line_size = 32;
       
  3431     env->icache_line_size = 32;
       
  3432     /* XXX: TODO: allocate internal IRQ controller */
       
  3433 }
       
  3434 
       
  3435 /* PowerPC 440 GP                                                            */
       
  3436 #define POWERPC_INSNS_440GP  (PPC_INSNS_BASE | PPC_STRING |                   \
       
  3437                               PPC_DCR | PPC_DCRX | PPC_WRTEE | PPC_MFAPIDI |  \
       
  3438                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  3439                               PPC_CACHE_DCBZ | PPC_CACHE_DCBA |               \
       
  3440                               PPC_MEM_TLBSYNC | PPC_TLBIVA |                  \
       
  3441                               PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |      \
       
  3442                               PPC_440_SPEC)
       
  3443 #define POWERPC_MSRM_440GP   (0x000000000006FF30ULL)
       
  3444 #define POWERPC_MMU_440GP    (POWERPC_MMU_BOOKE)
       
  3445 #define POWERPC_EXCP_440GP   (POWERPC_EXCP_BOOKE)
       
  3446 #define POWERPC_INPUT_440GP  (PPC_FLAGS_INPUT_BookE)
       
  3447 #define POWERPC_BFDM_440GP   (bfd_mach_ppc_403)
       
  3448 #define POWERPC_FLAG_440GP   (POWERPC_FLAG_CE | POWERPC_FLAG_DWE |            \
       
  3449                               POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
       
  3450 #define check_pow_440GP      check_pow_nocheck
       
  3451 
       
  3452 __attribute__ (( unused ))
       
  3453 static void init_proc_440GP (CPUPPCState *env)
       
  3454 {
       
  3455     /* Time base */
       
  3456     gen_tbl(env);
       
  3457     gen_spr_BookE(env, 0x000000000000FFFFULL);
       
  3458     gen_spr_440(env);
       
  3459     gen_spr_usprgh(env);
       
  3460     /* Processor identification */
       
  3461     spr_register(env, SPR_BOOKE_PIR, "PIR",
       
  3462                  SPR_NOACCESS, SPR_NOACCESS,
       
  3463                  &spr_read_generic, &spr_write_pir,
       
  3464                  0x00000000);
       
  3465     /* XXX : not implemented */
       
  3466     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
       
  3467                  SPR_NOACCESS, SPR_NOACCESS,
       
  3468                  &spr_read_generic, &spr_write_generic,
       
  3469                  0x00000000);
       
  3470     /* XXX : not implemented */
       
  3471     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
       
  3472                  SPR_NOACCESS, SPR_NOACCESS,
       
  3473                  &spr_read_generic, &spr_write_generic,
       
  3474                  0x00000000);
       
  3475     /* XXX : not implemented */
       
  3476     spr_register(env, SPR_BOOKE_DVC1, "DVC1",
       
  3477                  SPR_NOACCESS, SPR_NOACCESS,
       
  3478                  &spr_read_generic, &spr_write_generic,
       
  3479                  0x00000000);
       
  3480     /* XXX : not implemented */
       
  3481     spr_register(env, SPR_BOOKE_DVC2, "DVC2",
       
  3482                  SPR_NOACCESS, SPR_NOACCESS,
       
  3483                  &spr_read_generic, &spr_write_generic,
       
  3484                  0x00000000);
       
  3485     /* Memory management */
       
  3486 #if !defined(CONFIG_USER_ONLY)
       
  3487     env->nb_tlb = 64;
       
  3488     env->nb_ways = 1;
       
  3489     env->id_tlbs = 0;
       
  3490 #endif
       
  3491     init_excp_BookE(env);
       
  3492     env->dcache_line_size = 32;
       
  3493     env->icache_line_size = 32;
       
  3494     /* XXX: TODO: allocate internal IRQ controller */
       
  3495 }
       
  3496 
       
  3497 /* PowerPC 440x4                                                             */
       
  3498 #define POWERPC_INSNS_440x4  (PPC_INSNS_BASE | PPC_STRING |                   \
       
  3499                               PPC_DCR | PPC_WRTEE |                           \
       
  3500                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  3501                               PPC_CACHE_DCBZ | PPC_CACHE_DCBA |               \
       
  3502                               PPC_MEM_TLBSYNC |                               \
       
  3503                               PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |      \
       
  3504                               PPC_440_SPEC)
       
  3505 #define POWERPC_MSRM_440x4   (0x000000000006FF30ULL)
       
  3506 #define POWERPC_MMU_440x4    (POWERPC_MMU_BOOKE)
       
  3507 #define POWERPC_EXCP_440x4   (POWERPC_EXCP_BOOKE)
       
  3508 #define POWERPC_INPUT_440x4  (PPC_FLAGS_INPUT_BookE)
       
  3509 #define POWERPC_BFDM_440x4   (bfd_mach_ppc_403)
       
  3510 #define POWERPC_FLAG_440x4   (POWERPC_FLAG_CE | POWERPC_FLAG_DWE |            \
       
  3511                               POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
       
  3512 #define check_pow_440x4      check_pow_nocheck
       
  3513 
       
  3514 __attribute__ (( unused ))
       
  3515 static void init_proc_440x4 (CPUPPCState *env)
       
  3516 {
       
  3517     /* Time base */
       
  3518     gen_tbl(env);
       
  3519     gen_spr_BookE(env, 0x000000000000FFFFULL);
       
  3520     gen_spr_440(env);
       
  3521     gen_spr_usprgh(env);
       
  3522     /* Processor identification */
       
  3523     spr_register(env, SPR_BOOKE_PIR, "PIR",
       
  3524                  SPR_NOACCESS, SPR_NOACCESS,
       
  3525                  &spr_read_generic, &spr_write_pir,
       
  3526                  0x00000000);
       
  3527     /* XXX : not implemented */
       
  3528     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
       
  3529                  SPR_NOACCESS, SPR_NOACCESS,
       
  3530                  &spr_read_generic, &spr_write_generic,
       
  3531                  0x00000000);
       
  3532     /* XXX : not implemented */
       
  3533     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
       
  3534                  SPR_NOACCESS, SPR_NOACCESS,
       
  3535                  &spr_read_generic, &spr_write_generic,
       
  3536                  0x00000000);
       
  3537     /* XXX : not implemented */
       
  3538     spr_register(env, SPR_BOOKE_DVC1, "DVC1",
       
  3539                  SPR_NOACCESS, SPR_NOACCESS,
       
  3540                  &spr_read_generic, &spr_write_generic,
       
  3541                  0x00000000);
       
  3542     /* XXX : not implemented */
       
  3543     spr_register(env, SPR_BOOKE_DVC2, "DVC2",
       
  3544                  SPR_NOACCESS, SPR_NOACCESS,
       
  3545                  &spr_read_generic, &spr_write_generic,
       
  3546                  0x00000000);
       
  3547     /* Memory management */
       
  3548 #if !defined(CONFIG_USER_ONLY)
       
  3549     env->nb_tlb = 64;
       
  3550     env->nb_ways = 1;
       
  3551     env->id_tlbs = 0;
       
  3552 #endif
       
  3553     init_excp_BookE(env);
       
  3554     env->dcache_line_size = 32;
       
  3555     env->icache_line_size = 32;
       
  3556     /* XXX: TODO: allocate internal IRQ controller */
       
  3557 }
       
  3558 
       
  3559 /* PowerPC 440x5                                                             */
       
  3560 #define POWERPC_INSNS_440x5  (PPC_INSNS_BASE | PPC_STRING |                   \
       
  3561                               PPC_DCR | PPC_WRTEE | PPC_RFMCI |               \
       
  3562                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  3563                               PPC_CACHE_DCBZ | PPC_CACHE_DCBA |               \
       
  3564                               PPC_MEM_TLBSYNC |                               \
       
  3565                               PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |      \
       
  3566                               PPC_440_SPEC)
       
  3567 #define POWERPC_MSRM_440x5   (0x000000000006FF30ULL)
       
  3568 #define POWERPC_MMU_440x5    (POWERPC_MMU_BOOKE)
       
  3569 #define POWERPC_EXCP_440x5   (POWERPC_EXCP_BOOKE)
       
  3570 #define POWERPC_INPUT_440x5  (PPC_FLAGS_INPUT_BookE)
       
  3571 #define POWERPC_BFDM_440x5   (bfd_mach_ppc_403)
       
  3572 #define POWERPC_FLAG_440x5   (POWERPC_FLAG_CE | POWERPC_FLAG_DWE |           \
       
  3573                               POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
       
  3574 #define check_pow_440x5      check_pow_nocheck
       
  3575 
       
  3576 __attribute__ (( unused ))
       
  3577 static void init_proc_440x5 (CPUPPCState *env)
       
  3578 {
       
  3579     /* Time base */
       
  3580     gen_tbl(env);
       
  3581     gen_spr_BookE(env, 0x000000000000FFFFULL);
       
  3582     gen_spr_440(env);
       
  3583     gen_spr_usprgh(env);
       
  3584     /* Processor identification */
       
  3585     spr_register(env, SPR_BOOKE_PIR, "PIR",
       
  3586                  SPR_NOACCESS, SPR_NOACCESS,
       
  3587                  &spr_read_generic, &spr_write_pir,
       
  3588                  0x00000000);
       
  3589     /* XXX : not implemented */
       
  3590     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
       
  3591                  SPR_NOACCESS, SPR_NOACCESS,
       
  3592                  &spr_read_generic, &spr_write_generic,
       
  3593                  0x00000000);
       
  3594     /* XXX : not implemented */
       
  3595     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
       
  3596                  SPR_NOACCESS, SPR_NOACCESS,
       
  3597                  &spr_read_generic, &spr_write_generic,
       
  3598                  0x00000000);
       
  3599     /* XXX : not implemented */
       
  3600     spr_register(env, SPR_BOOKE_DVC1, "DVC1",
       
  3601                  SPR_NOACCESS, SPR_NOACCESS,
       
  3602                  &spr_read_generic, &spr_write_generic,
       
  3603                  0x00000000);
       
  3604     /* XXX : not implemented */
       
  3605     spr_register(env, SPR_BOOKE_DVC2, "DVC2",
       
  3606                  SPR_NOACCESS, SPR_NOACCESS,
       
  3607                  &spr_read_generic, &spr_write_generic,
       
  3608                  0x00000000);
       
  3609     /* XXX : not implemented */
       
  3610     spr_register(env, SPR_BOOKE_MCSR, "MCSR",
       
  3611                  SPR_NOACCESS, SPR_NOACCESS,
       
  3612                  &spr_read_generic, &spr_write_generic,
       
  3613                  0x00000000);
       
  3614     spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
       
  3615                  SPR_NOACCESS, SPR_NOACCESS,
       
  3616                  &spr_read_generic, &spr_write_generic,
       
  3617                  0x00000000);
       
  3618     spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
       
  3619                  SPR_NOACCESS, SPR_NOACCESS,
       
  3620                  &spr_read_generic, &spr_write_generic,
       
  3621                  0x00000000);
       
  3622     /* XXX : not implemented */
       
  3623     spr_register(env, SPR_440_CCR1, "CCR1",
       
  3624                  SPR_NOACCESS, SPR_NOACCESS,
       
  3625                  &spr_read_generic, &spr_write_generic,
       
  3626                  0x00000000);
       
  3627     /* Memory management */
       
  3628 #if !defined(CONFIG_USER_ONLY)
       
  3629     env->nb_tlb = 64;
       
  3630     env->nb_ways = 1;
       
  3631     env->id_tlbs = 0;
       
  3632 #endif
       
  3633     init_excp_BookE(env);
       
  3634     env->dcache_line_size = 32;
       
  3635     env->icache_line_size = 32;
       
  3636     /* XXX: TODO: allocate internal IRQ controller */
       
  3637 }
       
  3638 
       
  3639 /* PowerPC 460 (guessed)                                                     */
       
  3640 #define POWERPC_INSNS_460    (PPC_INSNS_BASE | PPC_STRING |                   \
       
  3641                               PPC_DCR | PPC_DCRX  | PPC_DCRUX |               \
       
  3642                               PPC_WRTEE | PPC_MFAPIDI |                       \
       
  3643                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  3644                               PPC_CACHE_DCBZ | PPC_CACHE_DCBA |               \
       
  3645                               PPC_MEM_TLBSYNC | PPC_TLBIVA |                  \
       
  3646                               PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |      \
       
  3647                               PPC_440_SPEC)
       
  3648 #define POWERPC_MSRM_460     (0x000000000006FF30ULL)
       
  3649 #define POWERPC_MMU_460      (POWERPC_MMU_BOOKE)
       
  3650 #define POWERPC_EXCP_460     (POWERPC_EXCP_BOOKE)
       
  3651 #define POWERPC_INPUT_460    (PPC_FLAGS_INPUT_BookE)
       
  3652 #define POWERPC_BFDM_460     (bfd_mach_ppc_403)
       
  3653 #define POWERPC_FLAG_460     (POWERPC_FLAG_CE | POWERPC_FLAG_DWE |            \
       
  3654                               POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
       
  3655 #define check_pow_460        check_pow_nocheck
       
  3656 
       
  3657 __attribute__ (( unused ))
       
  3658 static void init_proc_460 (CPUPPCState *env)
       
  3659 {
       
  3660     /* Time base */
       
  3661     gen_tbl(env);
       
  3662     gen_spr_BookE(env, 0x000000000000FFFFULL);
       
  3663     gen_spr_440(env);
       
  3664     gen_spr_usprgh(env);
       
  3665     /* Processor identification */
       
  3666     spr_register(env, SPR_BOOKE_PIR, "PIR",
       
  3667                  SPR_NOACCESS, SPR_NOACCESS,
       
  3668                  &spr_read_generic, &spr_write_pir,
       
  3669                  0x00000000);
       
  3670     /* XXX : not implemented */
       
  3671     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
       
  3672                  SPR_NOACCESS, SPR_NOACCESS,
       
  3673                  &spr_read_generic, &spr_write_generic,
       
  3674                  0x00000000);
       
  3675     /* XXX : not implemented */
       
  3676     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
       
  3677                  SPR_NOACCESS, SPR_NOACCESS,
       
  3678                  &spr_read_generic, &spr_write_generic,
       
  3679                  0x00000000);
       
  3680     /* XXX : not implemented */
       
  3681     spr_register(env, SPR_BOOKE_DVC1, "DVC1",
       
  3682                  SPR_NOACCESS, SPR_NOACCESS,
       
  3683                  &spr_read_generic, &spr_write_generic,
       
  3684                  0x00000000);
       
  3685     /* XXX : not implemented */
       
  3686     spr_register(env, SPR_BOOKE_DVC2, "DVC2",
       
  3687                  SPR_NOACCESS, SPR_NOACCESS,
       
  3688                  &spr_read_generic, &spr_write_generic,
       
  3689                  0x00000000);
       
  3690     /* XXX : not implemented */
       
  3691     spr_register(env, SPR_BOOKE_MCSR, "MCSR",
       
  3692                  SPR_NOACCESS, SPR_NOACCESS,
       
  3693                  &spr_read_generic, &spr_write_generic,
       
  3694                  0x00000000);
       
  3695     spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
       
  3696                  SPR_NOACCESS, SPR_NOACCESS,
       
  3697                  &spr_read_generic, &spr_write_generic,
       
  3698                  0x00000000);
       
  3699     spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
       
  3700                  SPR_NOACCESS, SPR_NOACCESS,
       
  3701                  &spr_read_generic, &spr_write_generic,
       
  3702                  0x00000000);
       
  3703     /* XXX : not implemented */
       
  3704     spr_register(env, SPR_440_CCR1, "CCR1",
       
  3705                  SPR_NOACCESS, SPR_NOACCESS,
       
  3706                  &spr_read_generic, &spr_write_generic,
       
  3707                  0x00000000);
       
  3708     /* XXX : not implemented */
       
  3709     spr_register(env, SPR_DCRIPR, "SPR_DCRIPR",
       
  3710                  &spr_read_generic, &spr_write_generic,
       
  3711                  &spr_read_generic, &spr_write_generic,
       
  3712                  0x00000000);
       
  3713     /* Memory management */
       
  3714 #if !defined(CONFIG_USER_ONLY)
       
  3715     env->nb_tlb = 64;
       
  3716     env->nb_ways = 1;
       
  3717     env->id_tlbs = 0;
       
  3718 #endif
       
  3719     init_excp_BookE(env);
       
  3720     env->dcache_line_size = 32;
       
  3721     env->icache_line_size = 32;
       
  3722     /* XXX: TODO: allocate internal IRQ controller */
       
  3723 }
       
  3724 
       
  3725 /* PowerPC 460F (guessed)                                                    */
       
  3726 #define POWERPC_INSNS_460F   (PPC_INSNS_BASE | PPC_STRING |                   \
       
  3727                               PPC_FLOAT | PPC_FLOAT_FRES | PPC_FLOAT_FSEL |   \
       
  3728                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  3729                               PPC_FLOAT_STFIWX |                              \
       
  3730                               PPC_DCR | PPC_DCRX | PPC_DCRUX |                \
       
  3731                               PPC_WRTEE | PPC_MFAPIDI |                       \
       
  3732                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  3733                               PPC_CACHE_DCBZ | PPC_CACHE_DCBA |               \
       
  3734                               PPC_MEM_TLBSYNC | PPC_TLBIVA |                  \
       
  3735                               PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |      \
       
  3736                               PPC_440_SPEC)
       
  3737 #define POWERPC_MSRM_460     (0x000000000006FF30ULL)
       
  3738 #define POWERPC_MMU_460F     (POWERPC_MMU_BOOKE)
       
  3739 #define POWERPC_EXCP_460F    (POWERPC_EXCP_BOOKE)
       
  3740 #define POWERPC_INPUT_460F   (PPC_FLAGS_INPUT_BookE)
       
  3741 #define POWERPC_BFDM_460F    (bfd_mach_ppc_403)
       
  3742 #define POWERPC_FLAG_460F    (POWERPC_FLAG_CE | POWERPC_FLAG_DWE |            \
       
  3743                               POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
       
  3744 #define check_pow_460F       check_pow_nocheck
       
  3745 
       
  3746 __attribute__ (( unused ))
       
  3747 static void init_proc_460F (CPUPPCState *env)
       
  3748 {
       
  3749     /* Time base */
       
  3750     gen_tbl(env);
       
  3751     gen_spr_BookE(env, 0x000000000000FFFFULL);
       
  3752     gen_spr_440(env);
       
  3753     gen_spr_usprgh(env);
       
  3754     /* Processor identification */
       
  3755     spr_register(env, SPR_BOOKE_PIR, "PIR",
       
  3756                  SPR_NOACCESS, SPR_NOACCESS,
       
  3757                  &spr_read_generic, &spr_write_pir,
       
  3758                  0x00000000);
       
  3759     /* XXX : not implemented */
       
  3760     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
       
  3761                  SPR_NOACCESS, SPR_NOACCESS,
       
  3762                  &spr_read_generic, &spr_write_generic,
       
  3763                  0x00000000);
       
  3764     /* XXX : not implemented */
       
  3765     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
       
  3766                  SPR_NOACCESS, SPR_NOACCESS,
       
  3767                  &spr_read_generic, &spr_write_generic,
       
  3768                  0x00000000);
       
  3769     /* XXX : not implemented */
       
  3770     spr_register(env, SPR_BOOKE_DVC1, "DVC1",
       
  3771                  SPR_NOACCESS, SPR_NOACCESS,
       
  3772                  &spr_read_generic, &spr_write_generic,
       
  3773                  0x00000000);
       
  3774     /* XXX : not implemented */
       
  3775     spr_register(env, SPR_BOOKE_DVC2, "DVC2",
       
  3776                  SPR_NOACCESS, SPR_NOACCESS,
       
  3777                  &spr_read_generic, &spr_write_generic,
       
  3778                  0x00000000);
       
  3779     /* XXX : not implemented */
       
  3780     spr_register(env, SPR_BOOKE_MCSR, "MCSR",
       
  3781                  SPR_NOACCESS, SPR_NOACCESS,
       
  3782                  &spr_read_generic, &spr_write_generic,
       
  3783                  0x00000000);
       
  3784     spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
       
  3785                  SPR_NOACCESS, SPR_NOACCESS,
       
  3786                  &spr_read_generic, &spr_write_generic,
       
  3787                  0x00000000);
       
  3788     spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
       
  3789                  SPR_NOACCESS, SPR_NOACCESS,
       
  3790                  &spr_read_generic, &spr_write_generic,
       
  3791                  0x00000000);
       
  3792     /* XXX : not implemented */
       
  3793     spr_register(env, SPR_440_CCR1, "CCR1",
       
  3794                  SPR_NOACCESS, SPR_NOACCESS,
       
  3795                  &spr_read_generic, &spr_write_generic,
       
  3796                  0x00000000);
       
  3797     /* XXX : not implemented */
       
  3798     spr_register(env, SPR_DCRIPR, "SPR_DCRIPR",
       
  3799                  &spr_read_generic, &spr_write_generic,
       
  3800                  &spr_read_generic, &spr_write_generic,
       
  3801                  0x00000000);
       
  3802     /* Memory management */
       
  3803 #if !defined(CONFIG_USER_ONLY)
       
  3804     env->nb_tlb = 64;
       
  3805     env->nb_ways = 1;
       
  3806     env->id_tlbs = 0;
       
  3807 #endif
       
  3808     init_excp_BookE(env);
       
  3809     env->dcache_line_size = 32;
       
  3810     env->icache_line_size = 32;
       
  3811     /* XXX: TODO: allocate internal IRQ controller */
       
  3812 }
       
  3813 
       
  3814 /* Freescale 5xx cores (aka RCPU) */
       
  3815 #define POWERPC_INSNS_MPC5xx (PPC_INSNS_BASE | PPC_STRING |                   \
       
  3816                               PPC_MEM_EIEIO | PPC_MEM_SYNC |                  \
       
  3817                               PPC_CACHE_ICBI | PPC_FLOAT | PPC_FLOAT_STFIWX | \
       
  3818                               PPC_MFTB)
       
  3819 #define POWERPC_MSRM_MPC5xx  (0x000000000001FF43ULL)
       
  3820 #define POWERPC_MMU_MPC5xx   (POWERPC_MMU_REAL)
       
  3821 #define POWERPC_EXCP_MPC5xx  (POWERPC_EXCP_603)
       
  3822 #define POWERPC_INPUT_MPC5xx (PPC_FLAGS_INPUT_RCPU)
       
  3823 #define POWERPC_BFDM_MPC5xx  (bfd_mach_ppc_505)
       
  3824 #define POWERPC_FLAG_MPC5xx  (POWERPC_FLAG_SE | POWERPC_FLAG_BE |             \
       
  3825                               POWERPC_FLAG_BUS_CLK)
       
  3826 #define check_pow_MPC5xx     check_pow_none
       
  3827 
       
  3828 __attribute__ (( unused ))
       
  3829 static void init_proc_MPC5xx (CPUPPCState *env)
       
  3830 {
       
  3831     /* Time base */
       
  3832     gen_tbl(env);
       
  3833     gen_spr_5xx_8xx(env);
       
  3834     gen_spr_5xx(env);
       
  3835     init_excp_MPC5xx(env);
       
  3836     env->dcache_line_size = 32;
       
  3837     env->icache_line_size = 32;
       
  3838     /* XXX: TODO: allocate internal IRQ controller */
       
  3839 }
       
  3840 
       
  3841 /* Freescale 8xx cores (aka PowerQUICC) */
       
  3842 #define POWERPC_INSNS_MPC8xx (PPC_INSNS_BASE | PPC_STRING  |                  \
       
  3843                               PPC_MEM_EIEIO | PPC_MEM_SYNC |                  \
       
  3844                               PPC_CACHE_ICBI | PPC_MFTB)
       
  3845 #define POWERPC_MSRM_MPC8xx  (0x000000000001F673ULL)
       
  3846 #define POWERPC_MMU_MPC8xx   (POWERPC_MMU_MPC8xx)
       
  3847 #define POWERPC_EXCP_MPC8xx  (POWERPC_EXCP_603)
       
  3848 #define POWERPC_INPUT_MPC8xx (PPC_FLAGS_INPUT_RCPU)
       
  3849 #define POWERPC_BFDM_MPC8xx  (bfd_mach_ppc_860)
       
  3850 #define POWERPC_FLAG_MPC8xx  (POWERPC_FLAG_SE | POWERPC_FLAG_BE |             \
       
  3851                               POWERPC_FLAG_BUS_CLK)
       
  3852 #define check_pow_MPC8xx     check_pow_none
       
  3853 
       
  3854 __attribute__ (( unused ))
       
  3855 static void init_proc_MPC8xx (CPUPPCState *env)
       
  3856 {
       
  3857     /* Time base */
       
  3858     gen_tbl(env);
       
  3859     gen_spr_5xx_8xx(env);
       
  3860     gen_spr_8xx(env);
       
  3861     init_excp_MPC8xx(env);
       
  3862     env->dcache_line_size = 32;
       
  3863     env->icache_line_size = 32;
       
  3864     /* XXX: TODO: allocate internal IRQ controller */
       
  3865 }
       
  3866 
       
  3867 /* Freescale 82xx cores (aka PowerQUICC-II)                                  */
       
  3868 /* PowerPC G2                                                                */
       
  3869 #define POWERPC_INSNS_G2     (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  3870                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  3871                               PPC_FLOAT_STFIWX |                              \
       
  3872                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  3873                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  3874                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | \
       
  3875                               PPC_SEGMENT | PPC_EXTERN)
       
  3876 #define POWERPC_MSRM_G2      (0x000000000006FFF2ULL)
       
  3877 #define POWERPC_MMU_G2       (POWERPC_MMU_SOFT_6xx)
       
  3878 //#define POWERPC_EXCP_G2      (POWERPC_EXCP_G2)
       
  3879 #define POWERPC_INPUT_G2     (PPC_FLAGS_INPUT_6xx)
       
  3880 #define POWERPC_BFDM_G2      (bfd_mach_ppc_ec603e)
       
  3881 #define POWERPC_FLAG_G2      (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |           \
       
  3882                               POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK)
       
  3883 #define check_pow_G2         check_pow_hid0
       
  3884 
       
  3885 static void init_proc_G2 (CPUPPCState *env)
       
  3886 {
       
  3887     gen_spr_ne_601(env);
       
  3888     gen_spr_G2_755(env);
       
  3889     gen_spr_G2(env);
       
  3890     /* Time base */
       
  3891     gen_tbl(env);
       
  3892     /* External access control */
       
  3893     /* XXX : not implemented */
       
  3894     spr_register(env, SPR_EAR, "EAR",
       
  3895                  SPR_NOACCESS, SPR_NOACCESS,
       
  3896                  &spr_read_generic, &spr_write_generic,
       
  3897                  0x00000000);
       
  3898     /* Hardware implementation register */
       
  3899     /* XXX : not implemented */
       
  3900     spr_register(env, SPR_HID0, "HID0",
       
  3901                  SPR_NOACCESS, SPR_NOACCESS,
       
  3902                  &spr_read_generic, &spr_write_generic,
       
  3903                  0x00000000);
       
  3904     /* XXX : not implemented */
       
  3905     spr_register(env, SPR_HID1, "HID1",
       
  3906                  SPR_NOACCESS, SPR_NOACCESS,
       
  3907                  &spr_read_generic, &spr_write_generic,
       
  3908                  0x00000000);
       
  3909     /* XXX : not implemented */
       
  3910     spr_register(env, SPR_HID2, "HID2",
       
  3911                  SPR_NOACCESS, SPR_NOACCESS,
       
  3912                  &spr_read_generic, &spr_write_generic,
       
  3913                  0x00000000);
       
  3914     /* Memory management */
       
  3915     gen_low_BATs(env);
       
  3916     gen_high_BATs(env);
       
  3917     gen_6xx_7xx_soft_tlb(env, 64, 2);
       
  3918     init_excp_G2(env);
       
  3919     env->dcache_line_size = 32;
       
  3920     env->icache_line_size = 32;
       
  3921     /* Allocate hardware IRQ controller */
       
  3922     ppc6xx_irq_init(env);
       
  3923 }
       
  3924 
       
  3925 /* PowerPC G2LE                                                              */
       
  3926 #define POWERPC_INSNS_G2LE   (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  3927                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  3928                               PPC_FLOAT_STFIWX |                              \
       
  3929                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  3930                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  3931                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | \
       
  3932                               PPC_SEGMENT | PPC_EXTERN)
       
  3933 #define POWERPC_MSRM_G2LE    (0x000000000007FFF3ULL)
       
  3934 #define POWERPC_MMU_G2LE     (POWERPC_MMU_SOFT_6xx)
       
  3935 #define POWERPC_EXCP_G2LE    (POWERPC_EXCP_G2)
       
  3936 #define POWERPC_INPUT_G2LE   (PPC_FLAGS_INPUT_6xx)
       
  3937 #define POWERPC_BFDM_G2LE    (bfd_mach_ppc_ec603e)
       
  3938 #define POWERPC_FLAG_G2LE    (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |           \
       
  3939                               POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK)
       
  3940 #define check_pow_G2LE       check_pow_hid0
       
  3941 
       
  3942 static void init_proc_G2LE (CPUPPCState *env)
       
  3943 {
       
  3944     gen_spr_ne_601(env);
       
  3945     gen_spr_G2_755(env);
       
  3946     gen_spr_G2(env);
       
  3947     /* Time base */
       
  3948     gen_tbl(env);
       
  3949     /* External access control */
       
  3950     /* XXX : not implemented */
       
  3951     spr_register(env, SPR_EAR, "EAR",
       
  3952                  SPR_NOACCESS, SPR_NOACCESS,
       
  3953                  &spr_read_generic, &spr_write_generic,
       
  3954                  0x00000000);
       
  3955     /* Hardware implementation register */
       
  3956     /* XXX : not implemented */
       
  3957     spr_register(env, SPR_HID0, "HID0",
       
  3958                  SPR_NOACCESS, SPR_NOACCESS,
       
  3959                  &spr_read_generic, &spr_write_generic,
       
  3960                  0x00000000);
       
  3961     /* XXX : not implemented */
       
  3962     spr_register(env, SPR_HID1, "HID1",
       
  3963                  SPR_NOACCESS, SPR_NOACCESS,
       
  3964                  &spr_read_generic, &spr_write_generic,
       
  3965                  0x00000000);
       
  3966     /* XXX : not implemented */
       
  3967     spr_register(env, SPR_HID2, "HID2",
       
  3968                  SPR_NOACCESS, SPR_NOACCESS,
       
  3969                  &spr_read_generic, &spr_write_generic,
       
  3970                  0x00000000);
       
  3971     /* Memory management */
       
  3972     gen_low_BATs(env);
       
  3973     gen_high_BATs(env);
       
  3974     gen_6xx_7xx_soft_tlb(env, 64, 2);
       
  3975     init_excp_G2(env);
       
  3976     env->dcache_line_size = 32;
       
  3977     env->icache_line_size = 32;
       
  3978     /* Allocate hardware IRQ controller */
       
  3979     ppc6xx_irq_init(env);
       
  3980 }
       
  3981 
       
  3982 /* e200 core                                                                 */
       
  3983 /* XXX: unimplemented instructions:
       
  3984  * dcblc
       
  3985  * dcbtlst
       
  3986  * dcbtstls
       
  3987  * icblc
       
  3988  * icbtls
       
  3989  * tlbivax
       
  3990  * all SPE multiply-accumulate instructions
       
  3991  */
       
  3992 #define POWERPC_INSNS_e200   (PPC_INSNS_BASE | PPC_ISEL |                     \
       
  3993                               PPC_SPE | PPC_SPEFPU |                          \
       
  3994                               PPC_WRTEE | PPC_RFDI |                          \
       
  3995                               PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |   \
       
  3996                               PPC_CACHE_DCBZ | PPC_CACHE_DCBA |               \
       
  3997                               PPC_MEM_TLBSYNC | PPC_TLBIVAX |                 \
       
  3998                               PPC_BOOKE)
       
  3999 #define POWERPC_MSRM_e200    (0x000000000606FF30ULL)
       
  4000 #define POWERPC_MMU_e200     (POWERPC_MMU_BOOKE_FSL)
       
  4001 #define POWERPC_EXCP_e200    (POWERPC_EXCP_BOOKE)
       
  4002 #define POWERPC_INPUT_e200   (PPC_FLAGS_INPUT_BookE)
       
  4003 #define POWERPC_BFDM_e200    (bfd_mach_ppc_860)
       
  4004 #define POWERPC_FLAG_e200    (POWERPC_FLAG_SPE | POWERPC_FLAG_CE |            \
       
  4005                               POWERPC_FLAG_UBLE | POWERPC_FLAG_DE |           \
       
  4006                               POWERPC_FLAG_BUS_CLK)
       
  4007 #define check_pow_e200       check_pow_hid0
       
  4008 
       
  4009 __attribute__ (( unused ))
       
  4010 static void init_proc_e200 (CPUPPCState *env)
       
  4011 {
       
  4012     /* Time base */
       
  4013     gen_tbl(env);
       
  4014     gen_spr_BookE(env, 0x000000070000FFFFULL);
       
  4015     spr_register(env, SPR_BOOKE_SPEFSCR, "SPEFSCR",
       
  4016                  &spr_read_spefscr, &spr_write_spefscr,
       
  4017                  &spr_read_spefscr, &spr_write_spefscr,
       
  4018                  0x00000000);
       
  4019     /* Memory management */
       
  4020     gen_spr_BookE_FSL(env, 0x0000005D);
       
  4021     /* XXX : not implemented */
       
  4022     spr_register(env, SPR_HID0, "HID0",
       
  4023                  SPR_NOACCESS, SPR_NOACCESS,
       
  4024                  &spr_read_generic, &spr_write_generic,
       
  4025                  0x00000000);
       
  4026     /* XXX : not implemented */
       
  4027     spr_register(env, SPR_HID1, "HID1",
       
  4028                  SPR_NOACCESS, SPR_NOACCESS,
       
  4029                  &spr_read_generic, &spr_write_generic,
       
  4030                  0x00000000);
       
  4031     /* XXX : not implemented */
       
  4032     spr_register(env, SPR_Exxx_ALTCTXCR, "ALTCTXCR",
       
  4033                  SPR_NOACCESS, SPR_NOACCESS,
       
  4034                  &spr_read_generic, &spr_write_generic,
       
  4035                  0x00000000);
       
  4036     /* XXX : not implemented */
       
  4037     spr_register(env, SPR_Exxx_BUCSR, "BUCSR",
       
  4038                  SPR_NOACCESS, SPR_NOACCESS,
       
  4039                  &spr_read_generic, &spr_write_generic,
       
  4040                  0x00000000);
       
  4041     /* XXX : not implemented */
       
  4042     spr_register(env, SPR_Exxx_CTXCR, "CTXCR",
       
  4043                  SPR_NOACCESS, SPR_NOACCESS,
       
  4044                  &spr_read_generic, &spr_write_generic,
       
  4045                  0x00000000);
       
  4046     /* XXX : not implemented */
       
  4047     spr_register(env, SPR_Exxx_DBCNT, "DBCNT",
       
  4048                  SPR_NOACCESS, SPR_NOACCESS,
       
  4049                  &spr_read_generic, &spr_write_generic,
       
  4050                  0x00000000);
       
  4051     /* XXX : not implemented */
       
  4052     spr_register(env, SPR_Exxx_DBCR3, "DBCR3",
       
  4053                  SPR_NOACCESS, SPR_NOACCESS,
       
  4054                  &spr_read_generic, &spr_write_generic,
       
  4055                  0x00000000);
       
  4056     /* XXX : not implemented */
       
  4057     spr_register(env, SPR_Exxx_L1CFG0, "L1CFG0",
       
  4058                  SPR_NOACCESS, SPR_NOACCESS,
       
  4059                  &spr_read_generic, &spr_write_generic,
       
  4060                  0x00000000);
       
  4061     /* XXX : not implemented */
       
  4062     spr_register(env, SPR_Exxx_L1CSR0, "L1CSR0",
       
  4063                  SPR_NOACCESS, SPR_NOACCESS,
       
  4064                  &spr_read_generic, &spr_write_generic,
       
  4065                  0x00000000);
       
  4066     /* XXX : not implemented */
       
  4067     spr_register(env, SPR_Exxx_L1FINV0, "L1FINV0",
       
  4068                  SPR_NOACCESS, SPR_NOACCESS,
       
  4069                  &spr_read_generic, &spr_write_generic,
       
  4070                  0x00000000);
       
  4071     /* XXX : not implemented */
       
  4072     spr_register(env, SPR_BOOKE_TLB0CFG, "TLB0CFG",
       
  4073                  SPR_NOACCESS, SPR_NOACCESS,
       
  4074                  &spr_read_generic, &spr_write_generic,
       
  4075                  0x00000000);
       
  4076     /* XXX : not implemented */
       
  4077     spr_register(env, SPR_BOOKE_TLB1CFG, "TLB1CFG",
       
  4078                  SPR_NOACCESS, SPR_NOACCESS,
       
  4079                  &spr_read_generic, &spr_write_generic,
       
  4080                  0x00000000);
       
  4081     /* XXX : not implemented */
       
  4082     spr_register(env, SPR_BOOKE_IAC3, "IAC3",
       
  4083                  SPR_NOACCESS, SPR_NOACCESS,
       
  4084                  &spr_read_generic, &spr_write_generic,
       
  4085                  0x00000000);
       
  4086     /* XXX : not implemented */
       
  4087     spr_register(env, SPR_BOOKE_IAC4, "IAC4",
       
  4088                  SPR_NOACCESS, SPR_NOACCESS,
       
  4089                  &spr_read_generic, &spr_write_generic,
       
  4090                  0x00000000);
       
  4091     spr_register(env, SPR_BOOKE_DSRR0, "DSRR0",
       
  4092                  SPR_NOACCESS, SPR_NOACCESS,
       
  4093                  &spr_read_generic, &spr_write_generic,
       
  4094                  0x00000000);
       
  4095     spr_register(env, SPR_BOOKE_DSRR1, "DSRR1",
       
  4096                  SPR_NOACCESS, SPR_NOACCESS,
       
  4097                  &spr_read_generic, &spr_write_generic,
       
  4098                  0x00000000);
       
  4099 #if !defined(CONFIG_USER_ONLY)
       
  4100     env->nb_tlb = 64;
       
  4101     env->nb_ways = 1;
       
  4102     env->id_tlbs = 0;
       
  4103 #endif
       
  4104     init_excp_e200(env);
       
  4105     env->dcache_line_size = 32;
       
  4106     env->icache_line_size = 32;
       
  4107     /* XXX: TODO: allocate internal IRQ controller */
       
  4108 }
       
  4109 
       
  4110 /* e300 core                                                                 */
       
  4111 #define POWERPC_INSNS_e300   (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  4112                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  4113                               PPC_FLOAT_STFIWX |                              \
       
  4114                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4115                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  4116                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | \
       
  4117                               PPC_SEGMENT | PPC_EXTERN)
       
  4118 #define POWERPC_MSRM_e300    (0x000000000007FFF3ULL)
       
  4119 #define POWERPC_MMU_e300     (POWERPC_MMU_SOFT_6xx)
       
  4120 #define POWERPC_EXCP_e300    (POWERPC_EXCP_603)
       
  4121 #define POWERPC_INPUT_e300   (PPC_FLAGS_INPUT_6xx)
       
  4122 #define POWERPC_BFDM_e300    (bfd_mach_ppc_603)
       
  4123 #define POWERPC_FLAG_e300    (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |           \
       
  4124                               POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK)
       
  4125 #define check_pow_e300       check_pow_hid0
       
  4126 
       
  4127 __attribute__ (( unused ))
       
  4128 static void init_proc_e300 (CPUPPCState *env)
       
  4129 {
       
  4130     gen_spr_ne_601(env);
       
  4131     gen_spr_603(env);
       
  4132     /* Time base */
       
  4133     gen_tbl(env);
       
  4134     /* hardware implementation registers */
       
  4135     /* XXX : not implemented */
       
  4136     spr_register(env, SPR_HID0, "HID0",
       
  4137                  SPR_NOACCESS, SPR_NOACCESS,
       
  4138                  &spr_read_generic, &spr_write_generic,
       
  4139                  0x00000000);
       
  4140     /* XXX : not implemented */
       
  4141     spr_register(env, SPR_HID1, "HID1",
       
  4142                  SPR_NOACCESS, SPR_NOACCESS,
       
  4143                  &spr_read_generic, &spr_write_generic,
       
  4144                  0x00000000);
       
  4145     /* Memory management */
       
  4146     gen_low_BATs(env);
       
  4147     gen_6xx_7xx_soft_tlb(env, 64, 2);
       
  4148     init_excp_603(env);
       
  4149     env->dcache_line_size = 32;
       
  4150     env->icache_line_size = 32;
       
  4151     /* Allocate hardware IRQ controller */
       
  4152     ppc6xx_irq_init(env);
       
  4153 }
       
  4154 
       
  4155 /* e500 core                                                                 */
       
  4156 #define POWERPC_INSNS_e500   (PPC_INSNS_BASE | PPC_ISEL |                     \
       
  4157                               PPC_SPE | PPC_SPEFPU |                          \
       
  4158                               PPC_WRTEE | PPC_RFDI |                          \
       
  4159                               PPC_CACHE | PPC_CACHE_LOCK | PPC_CACHE_ICBI |   \
       
  4160                               PPC_CACHE_DCBZ | PPC_CACHE_DCBA |               \
       
  4161                               PPC_MEM_TLBSYNC | PPC_TLBIVAX |                 \
       
  4162                               PPC_BOOKE)
       
  4163 #define POWERPC_MSRM_e500    (0x000000000606FF30ULL)
       
  4164 #define POWERPC_MMU_e500     (POWERPC_MMU_BOOKE_FSL)
       
  4165 #define POWERPC_EXCP_e500    (POWERPC_EXCP_BOOKE)
       
  4166 #define POWERPC_INPUT_e500   (PPC_FLAGS_INPUT_BookE)
       
  4167 #define POWERPC_BFDM_e500    (bfd_mach_ppc_860)
       
  4168 #define POWERPC_FLAG_e500    (POWERPC_FLAG_SPE | POWERPC_FLAG_CE |            \
       
  4169                               POWERPC_FLAG_UBLE | POWERPC_FLAG_DE |           \
       
  4170                               POWERPC_FLAG_BUS_CLK)
       
  4171 #define check_pow_e500       check_pow_hid0
       
  4172 
       
  4173 __attribute__ (( unused ))
       
  4174 static void init_proc_e500 (CPUPPCState *env)
       
  4175 {
       
  4176     /* Time base */
       
  4177     gen_tbl(env);
       
  4178     gen_spr_BookE(env, 0x0000000F0000FD7FULL);
       
  4179     /* Processor identification */
       
  4180     spr_register(env, SPR_BOOKE_PIR, "PIR",
       
  4181                  SPR_NOACCESS, SPR_NOACCESS,
       
  4182                  &spr_read_generic, &spr_write_pir,
       
  4183                  0x00000000);
       
  4184     spr_register(env, SPR_BOOKE_SPEFSCR, "SPEFSCR",
       
  4185                  &spr_read_spefscr, &spr_write_spefscr,
       
  4186                  &spr_read_spefscr, &spr_write_spefscr,
       
  4187                  0x00000000);
       
  4188     /* Memory management */
       
  4189 #if !defined(CONFIG_USER_ONLY)
       
  4190     env->nb_pids = 3;
       
  4191 #endif
       
  4192     gen_spr_BookE_FSL(env, 0x0000005F);
       
  4193     /* XXX : not implemented */
       
  4194     spr_register(env, SPR_HID0, "HID0",
       
  4195                  SPR_NOACCESS, SPR_NOACCESS,
       
  4196                  &spr_read_generic, &spr_write_generic,
       
  4197                  0x00000000);
       
  4198     /* XXX : not implemented */
       
  4199     spr_register(env, SPR_HID1, "HID1",
       
  4200                  SPR_NOACCESS, SPR_NOACCESS,
       
  4201                  &spr_read_generic, &spr_write_generic,
       
  4202                  0x00000000);
       
  4203     /* XXX : not implemented */
       
  4204     spr_register(env, SPR_Exxx_BBEAR, "BBEAR",
       
  4205                  SPR_NOACCESS, SPR_NOACCESS,
       
  4206                  &spr_read_generic, &spr_write_generic,
       
  4207                  0x00000000);
       
  4208     /* XXX : not implemented */
       
  4209     spr_register(env, SPR_Exxx_BBTAR, "BBTAR",
       
  4210                  SPR_NOACCESS, SPR_NOACCESS,
       
  4211                  &spr_read_generic, &spr_write_generic,
       
  4212                  0x00000000);
       
  4213     /* XXX : not implemented */
       
  4214     spr_register(env, SPR_Exxx_MCAR, "MCAR",
       
  4215                  SPR_NOACCESS, SPR_NOACCESS,
       
  4216                  &spr_read_generic, &spr_write_generic,
       
  4217                  0x00000000);
       
  4218     /* XXX : not implemented */
       
  4219     spr_register(env, SPR_BOOKE_MCSR, "MCSR",
       
  4220                  SPR_NOACCESS, SPR_NOACCESS,
       
  4221                  &spr_read_generic, &spr_write_generic,
       
  4222                  0x00000000);
       
  4223     /* XXX : not implemented */
       
  4224     spr_register(env, SPR_Exxx_NPIDR, "NPIDR",
       
  4225                  SPR_NOACCESS, SPR_NOACCESS,
       
  4226                  &spr_read_generic, &spr_write_generic,
       
  4227                  0x00000000);
       
  4228     /* XXX : not implemented */
       
  4229     spr_register(env, SPR_Exxx_BUCSR, "BUCSR",
       
  4230                  SPR_NOACCESS, SPR_NOACCESS,
       
  4231                  &spr_read_generic, &spr_write_generic,
       
  4232                  0x00000000);
       
  4233     /* XXX : not implemented */
       
  4234     spr_register(env, SPR_Exxx_L1CFG0, "L1CFG0",
       
  4235                  SPR_NOACCESS, SPR_NOACCESS,
       
  4236                  &spr_read_generic, &spr_write_generic,
       
  4237                  0x00000000);
       
  4238     /* XXX : not implemented */
       
  4239     spr_register(env, SPR_Exxx_L1CSR0, "L1CSR0",
       
  4240                  SPR_NOACCESS, SPR_NOACCESS,
       
  4241                  &spr_read_generic, &spr_write_generic,
       
  4242                  0x00000000);
       
  4243     /* XXX : not implemented */
       
  4244     spr_register(env, SPR_Exxx_L1CSR1, "L1CSR1",
       
  4245                  SPR_NOACCESS, SPR_NOACCESS,
       
  4246                  &spr_read_generic, &spr_write_generic,
       
  4247                  0x00000000);
       
  4248     /* XXX : not implemented */
       
  4249     spr_register(env, SPR_BOOKE_TLB0CFG, "TLB0CFG",
       
  4250                  SPR_NOACCESS, SPR_NOACCESS,
       
  4251                  &spr_read_generic, &spr_write_generic,
       
  4252                  0x00000000);
       
  4253     /* XXX : not implemented */
       
  4254     spr_register(env, SPR_BOOKE_TLB1CFG, "TLB1CFG",
       
  4255                  SPR_NOACCESS, SPR_NOACCESS,
       
  4256                  &spr_read_generic, &spr_write_generic,
       
  4257                  0x00000000);
       
  4258     spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
       
  4259                  SPR_NOACCESS, SPR_NOACCESS,
       
  4260                  &spr_read_generic, &spr_write_generic,
       
  4261                  0x00000000);
       
  4262     spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
       
  4263                  SPR_NOACCESS, SPR_NOACCESS,
       
  4264                  &spr_read_generic, &spr_write_generic,
       
  4265                  0x00000000);
       
  4266 #if !defined(CONFIG_USER_ONLY)
       
  4267     env->nb_tlb = 64;
       
  4268     env->nb_ways = 1;
       
  4269     env->id_tlbs = 0;
       
  4270 #endif
       
  4271     init_excp_e200(env);
       
  4272     env->dcache_line_size = 32;
       
  4273     env->icache_line_size = 32;
       
  4274     /* XXX: TODO: allocate internal IRQ controller */
       
  4275 }
       
  4276 
       
  4277 /* Non-embedded PowerPC                                                      */
       
  4278 
       
  4279 /* POWER : same as 601, without mfmsr, mfsr                                  */
       
  4280 #if defined(TODO)
       
  4281 #define POWERPC_INSNS_POWER  (XXX_TODO)
       
  4282 /* POWER RSC (from RAD6000) */
       
  4283 #define POWERPC_MSRM_POWER   (0x00000000FEF0ULL)
       
  4284 #endif /* TODO */
       
  4285 
       
  4286 /* PowerPC 601                                                               */
       
  4287 #define POWERPC_INSNS_601    (PPC_INSNS_BASE | PPC_STRING | PPC_POWER_BR |    \
       
  4288                               PPC_FLOAT |                                     \
       
  4289                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4290                               PPC_MEM_SYNC | PPC_MEM_EIEIO | PPC_MEM_TLBIE |  \
       
  4291                               PPC_SEGMENT | PPC_EXTERN)
       
  4292 #define POWERPC_MSRM_601     (0x000000000000FD70ULL)
       
  4293 #define POWERPC_MSRR_601     (0x0000000000001040ULL)
       
  4294 //#define POWERPC_MMU_601      (POWERPC_MMU_601)
       
  4295 //#define POWERPC_EXCP_601     (POWERPC_EXCP_601)
       
  4296 #define POWERPC_INPUT_601    (PPC_FLAGS_INPUT_6xx)
       
  4297 #define POWERPC_BFDM_601     (bfd_mach_ppc_601)
       
  4298 #define POWERPC_FLAG_601     (POWERPC_FLAG_SE | POWERPC_FLAG_RTC_CLK)
       
  4299 #define check_pow_601        check_pow_none
       
  4300 
       
  4301 static void init_proc_601 (CPUPPCState *env)
       
  4302 {
       
  4303     gen_spr_ne_601(env);
       
  4304     gen_spr_601(env);
       
  4305     /* Hardware implementation registers */
       
  4306     /* XXX : not implemented */
       
  4307     spr_register(env, SPR_HID0, "HID0",
       
  4308                  SPR_NOACCESS, SPR_NOACCESS,
       
  4309                  &spr_read_generic, &spr_write_hid0_601,
       
  4310                  0x80010080);
       
  4311     /* XXX : not implemented */
       
  4312     spr_register(env, SPR_HID1, "HID1",
       
  4313                  SPR_NOACCESS, SPR_NOACCESS,
       
  4314                  &spr_read_generic, &spr_write_generic,
       
  4315                  0x00000000);
       
  4316     /* XXX : not implemented */
       
  4317     spr_register(env, SPR_601_HID2, "HID2",
       
  4318                  SPR_NOACCESS, SPR_NOACCESS,
       
  4319                  &spr_read_generic, &spr_write_generic,
       
  4320                  0x00000000);
       
  4321     /* XXX : not implemented */
       
  4322     spr_register(env, SPR_601_HID5, "HID5",
       
  4323                  SPR_NOACCESS, SPR_NOACCESS,
       
  4324                  &spr_read_generic, &spr_write_generic,
       
  4325                  0x00000000);
       
  4326     /* Memory management */
       
  4327     init_excp_601(env);
       
  4328     /* XXX: beware that dcache line size is 64 
       
  4329      *      but dcbz uses 32 bytes "sectors"
       
  4330      * XXX: this breaks clcs instruction !
       
  4331      */
       
  4332     env->dcache_line_size = 32;
       
  4333     env->icache_line_size = 64;
       
  4334     /* Allocate hardware IRQ controller */
       
  4335     ppc6xx_irq_init(env);
       
  4336 }
       
  4337 
       
  4338 /* PowerPC 601v                                                              */
       
  4339 #define POWERPC_INSNS_601v   (PPC_INSNS_BASE | PPC_STRING | PPC_POWER_BR |    \
       
  4340                               PPC_FLOAT |                                     \
       
  4341                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4342                               PPC_MEM_SYNC | PPC_MEM_EIEIO | PPC_MEM_TLBIE |  \
       
  4343                               PPC_SEGMENT | PPC_EXTERN)
       
  4344 #define POWERPC_MSRM_601v    (0x000000000000FD70ULL)
       
  4345 #define POWERPC_MSRR_601v    (0x0000000000001040ULL)
       
  4346 #define POWERPC_MMU_601v     (POWERPC_MMU_601)
       
  4347 #define POWERPC_EXCP_601v    (POWERPC_EXCP_601)
       
  4348 #define POWERPC_INPUT_601v   (PPC_FLAGS_INPUT_6xx)
       
  4349 #define POWERPC_BFDM_601v    (bfd_mach_ppc_601)
       
  4350 #define POWERPC_FLAG_601v    (POWERPC_FLAG_SE | POWERPC_FLAG_RTC_CLK)
       
  4351 #define check_pow_601v       check_pow_none
       
  4352 
       
  4353 static void init_proc_601v (CPUPPCState *env)
       
  4354 {
       
  4355     init_proc_601(env);
       
  4356     /* XXX : not implemented */
       
  4357     spr_register(env, SPR_601_HID15, "HID15",
       
  4358                  SPR_NOACCESS, SPR_NOACCESS,
       
  4359                  &spr_read_generic, &spr_write_generic,
       
  4360                  0x00000000);
       
  4361 }
       
  4362 
       
  4363 /* PowerPC 602                                                               */
       
  4364 #define POWERPC_INSNS_602    (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  4365                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  4366                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  4367                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4368                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  4369                               PPC_MEM_TLBIE | PPC_6xx_TLB | PPC_MEM_TLBSYNC | \
       
  4370                               PPC_SEGMENT | PPC_602_SPEC)
       
  4371 #define POWERPC_MSRM_602     (0x0000000000C7FF73ULL)
       
  4372 /* XXX: 602 MMU is quite specific. Should add a special case */
       
  4373 #define POWERPC_MMU_602      (POWERPC_MMU_SOFT_6xx)
       
  4374 //#define POWERPC_EXCP_602     (POWERPC_EXCP_602)
       
  4375 #define POWERPC_INPUT_602    (PPC_FLAGS_INPUT_6xx)
       
  4376 #define POWERPC_BFDM_602     (bfd_mach_ppc_602)
       
  4377 #define POWERPC_FLAG_602     (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |           \
       
  4378                               POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK)
       
  4379 #define check_pow_602        check_pow_hid0
       
  4380 
       
  4381 static void init_proc_602 (CPUPPCState *env)
       
  4382 {
       
  4383     gen_spr_ne_601(env);
       
  4384     gen_spr_602(env);
       
  4385     /* Time base */
       
  4386     gen_tbl(env);
       
  4387     /* hardware implementation registers */
       
  4388     /* XXX : not implemented */
       
  4389     spr_register(env, SPR_HID0, "HID0",
       
  4390                  SPR_NOACCESS, SPR_NOACCESS,
       
  4391                  &spr_read_generic, &spr_write_generic,
       
  4392                  0x00000000);
       
  4393     /* XXX : not implemented */
       
  4394     spr_register(env, SPR_HID1, "HID1",
       
  4395                  SPR_NOACCESS, SPR_NOACCESS,
       
  4396                  &spr_read_generic, &spr_write_generic,
       
  4397                  0x00000000);
       
  4398     /* Memory management */
       
  4399     gen_low_BATs(env);
       
  4400     gen_6xx_7xx_soft_tlb(env, 64, 2);
       
  4401     init_excp_602(env);
       
  4402     env->dcache_line_size = 32;
       
  4403     env->icache_line_size = 32;
       
  4404     /* Allocate hardware IRQ controller */
       
  4405     ppc6xx_irq_init(env);
       
  4406 }
       
  4407 
       
  4408 /* PowerPC 603                                                               */
       
  4409 #define POWERPC_INSNS_603    (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  4410                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  4411                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  4412                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4413                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  4414                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | \
       
  4415                               PPC_SEGMENT | PPC_EXTERN)
       
  4416 #define POWERPC_MSRM_603     (0x000000000007FF73ULL)
       
  4417 #define POWERPC_MMU_603      (POWERPC_MMU_SOFT_6xx)
       
  4418 //#define POWERPC_EXCP_603     (POWERPC_EXCP_603)
       
  4419 #define POWERPC_INPUT_603    (PPC_FLAGS_INPUT_6xx)
       
  4420 #define POWERPC_BFDM_603     (bfd_mach_ppc_603)
       
  4421 #define POWERPC_FLAG_603     (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |           \
       
  4422                               POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK)
       
  4423 #define check_pow_603        check_pow_hid0
       
  4424 
       
  4425 static void init_proc_603 (CPUPPCState *env)
       
  4426 {
       
  4427     gen_spr_ne_601(env);
       
  4428     gen_spr_603(env);
       
  4429     /* Time base */
       
  4430     gen_tbl(env);
       
  4431     /* hardware implementation registers */
       
  4432     /* XXX : not implemented */
       
  4433     spr_register(env, SPR_HID0, "HID0",
       
  4434                  SPR_NOACCESS, SPR_NOACCESS,
       
  4435                  &spr_read_generic, &spr_write_generic,
       
  4436                  0x00000000);
       
  4437     /* XXX : not implemented */
       
  4438     spr_register(env, SPR_HID1, "HID1",
       
  4439                  SPR_NOACCESS, SPR_NOACCESS,
       
  4440                  &spr_read_generic, &spr_write_generic,
       
  4441                  0x00000000);
       
  4442     /* Memory management */
       
  4443     gen_low_BATs(env);
       
  4444     gen_6xx_7xx_soft_tlb(env, 64, 2);
       
  4445     init_excp_603(env);
       
  4446     env->dcache_line_size = 32;
       
  4447     env->icache_line_size = 32;
       
  4448     /* Allocate hardware IRQ controller */
       
  4449     ppc6xx_irq_init(env);
       
  4450 }
       
  4451 
       
  4452 /* PowerPC 603e                                                              */
       
  4453 #define POWERPC_INSNS_603E   (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  4454                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  4455                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  4456                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4457                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  4458                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | \
       
  4459                               PPC_SEGMENT | PPC_EXTERN)
       
  4460 #define POWERPC_MSRM_603E    (0x000000000007FF73ULL)
       
  4461 #define POWERPC_MMU_603E     (POWERPC_MMU_SOFT_6xx)
       
  4462 //#define POWERPC_EXCP_603E    (POWERPC_EXCP_603E)
       
  4463 #define POWERPC_INPUT_603E   (PPC_FLAGS_INPUT_6xx)
       
  4464 #define POWERPC_BFDM_603E    (bfd_mach_ppc_ec603e)
       
  4465 #define POWERPC_FLAG_603E    (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE |           \
       
  4466                               POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK)
       
  4467 #define check_pow_603E       check_pow_hid0
       
  4468 
       
  4469 static void init_proc_603E (CPUPPCState *env)
       
  4470 {
       
  4471     gen_spr_ne_601(env);
       
  4472     gen_spr_603(env);
       
  4473     /* Time base */
       
  4474     gen_tbl(env);
       
  4475     /* hardware implementation registers */
       
  4476     /* XXX : not implemented */
       
  4477     spr_register(env, SPR_HID0, "HID0",
       
  4478                  SPR_NOACCESS, SPR_NOACCESS,
       
  4479                  &spr_read_generic, &spr_write_generic,
       
  4480                  0x00000000);
       
  4481     /* XXX : not implemented */
       
  4482     spr_register(env, SPR_HID1, "HID1",
       
  4483                  SPR_NOACCESS, SPR_NOACCESS,
       
  4484                  &spr_read_generic, &spr_write_generic,
       
  4485                  0x00000000);
       
  4486     /* XXX : not implemented */
       
  4487     spr_register(env, SPR_IABR, "IABR",
       
  4488                  SPR_NOACCESS, SPR_NOACCESS,
       
  4489                  &spr_read_generic, &spr_write_generic,
       
  4490                  0x00000000);
       
  4491     /* Memory management */
       
  4492     gen_low_BATs(env);
       
  4493     gen_6xx_7xx_soft_tlb(env, 64, 2);
       
  4494     init_excp_603(env);
       
  4495     env->dcache_line_size = 32;
       
  4496     env->icache_line_size = 32;
       
  4497     /* Allocate hardware IRQ controller */
       
  4498     ppc6xx_irq_init(env);
       
  4499 }
       
  4500 
       
  4501 /* PowerPC 604                                                               */
       
  4502 #define POWERPC_INSNS_604    (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  4503                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  4504                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  4505                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4506                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  4507                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  4508                               PPC_SEGMENT | PPC_EXTERN)
       
  4509 #define POWERPC_MSRM_604     (0x000000000005FF77ULL)
       
  4510 #define POWERPC_MMU_604      (POWERPC_MMU_32B)
       
  4511 //#define POWERPC_EXCP_604     (POWERPC_EXCP_604)
       
  4512 #define POWERPC_INPUT_604    (PPC_FLAGS_INPUT_6xx)
       
  4513 #define POWERPC_BFDM_604     (bfd_mach_ppc_604)
       
  4514 #define POWERPC_FLAG_604     (POWERPC_FLAG_SE | POWERPC_FLAG_BE |             \
       
  4515                               POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
       
  4516 #define check_pow_604        check_pow_nocheck
       
  4517 
       
  4518 static void init_proc_604 (CPUPPCState *env)
       
  4519 {
       
  4520     gen_spr_ne_601(env);
       
  4521     gen_spr_604(env);
       
  4522     /* Time base */
       
  4523     gen_tbl(env);
       
  4524     /* Hardware implementation registers */
       
  4525     /* XXX : not implemented */
       
  4526     spr_register(env, SPR_HID0, "HID0",
       
  4527                  SPR_NOACCESS, SPR_NOACCESS,
       
  4528                  &spr_read_generic, &spr_write_generic,
       
  4529                  0x00000000);
       
  4530     /* Memory management */
       
  4531     gen_low_BATs(env);
       
  4532     init_excp_604(env);
       
  4533     env->dcache_line_size = 32;
       
  4534     env->icache_line_size = 32;
       
  4535     /* Allocate hardware IRQ controller */
       
  4536     ppc6xx_irq_init(env);
       
  4537 }
       
  4538 
       
  4539 /* PowerPC 604E                                                              */
       
  4540 #define POWERPC_INSNS_604E   (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  4541                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  4542                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  4543                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4544                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  4545                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  4546                               PPC_SEGMENT | PPC_EXTERN)
       
  4547 #define POWERPC_MSRM_604E    (0x000000000005FF77ULL)
       
  4548 #define POWERPC_MMU_604E     (POWERPC_MMU_32B)
       
  4549 #define POWERPC_EXCP_604E    (POWERPC_EXCP_604)
       
  4550 #define POWERPC_INPUT_604E   (PPC_FLAGS_INPUT_6xx)
       
  4551 #define POWERPC_BFDM_604E    (bfd_mach_ppc_604)
       
  4552 #define POWERPC_FLAG_604E    (POWERPC_FLAG_SE | POWERPC_FLAG_BE |             \
       
  4553                               POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
       
  4554 #define check_pow_604E       check_pow_nocheck
       
  4555 
       
  4556 static void init_proc_604E (CPUPPCState *env)
       
  4557 {
       
  4558     gen_spr_ne_601(env);
       
  4559     gen_spr_604(env);
       
  4560     /* XXX : not implemented */
       
  4561     spr_register(env, SPR_MMCR1, "MMCR1",
       
  4562                  SPR_NOACCESS, SPR_NOACCESS,
       
  4563                  &spr_read_generic, &spr_write_generic,
       
  4564                  0x00000000);
       
  4565     /* XXX : not implemented */
       
  4566     spr_register(env, SPR_PMC3, "PMC3",
       
  4567                  SPR_NOACCESS, SPR_NOACCESS,
       
  4568                  &spr_read_generic, &spr_write_generic,
       
  4569                  0x00000000);
       
  4570     /* XXX : not implemented */
       
  4571     spr_register(env, SPR_PMC4, "PMC4",
       
  4572                  SPR_NOACCESS, SPR_NOACCESS,
       
  4573                  &spr_read_generic, &spr_write_generic,
       
  4574                  0x00000000);
       
  4575     /* Time base */
       
  4576     gen_tbl(env);
       
  4577     /* Hardware implementation registers */
       
  4578     /* XXX : not implemented */
       
  4579     spr_register(env, SPR_HID0, "HID0",
       
  4580                  SPR_NOACCESS, SPR_NOACCESS,
       
  4581                  &spr_read_generic, &spr_write_generic,
       
  4582                  0x00000000);
       
  4583     /* XXX : not implemented */
       
  4584     spr_register(env, SPR_HID1, "HID1",
       
  4585                  SPR_NOACCESS, SPR_NOACCESS,
       
  4586                  &spr_read_generic, &spr_write_generic,
       
  4587                  0x00000000);
       
  4588     /* Memory management */
       
  4589     gen_low_BATs(env);
       
  4590     init_excp_604(env);
       
  4591     env->dcache_line_size = 32;
       
  4592     env->icache_line_size = 32;
       
  4593     /* Allocate hardware IRQ controller */
       
  4594     ppc6xx_irq_init(env);
       
  4595 }
       
  4596 
       
  4597 /* PowerPC 740                                                               */
       
  4598 #define POWERPC_INSNS_740    (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  4599                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  4600                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  4601                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4602                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  4603                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  4604                               PPC_SEGMENT | PPC_EXTERN)
       
  4605 #define POWERPC_MSRM_740     (0x000000000005FF77ULL)
       
  4606 #define POWERPC_MMU_740      (POWERPC_MMU_32B)
       
  4607 #define POWERPC_EXCP_740     (POWERPC_EXCP_7x0)
       
  4608 #define POWERPC_INPUT_740    (PPC_FLAGS_INPUT_6xx)
       
  4609 #define POWERPC_BFDM_740     (bfd_mach_ppc_750)
       
  4610 #define POWERPC_FLAG_740     (POWERPC_FLAG_SE | POWERPC_FLAG_BE |             \
       
  4611                               POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
       
  4612 #define check_pow_740        check_pow_hid0
       
  4613 
       
  4614 static void init_proc_740 (CPUPPCState *env)
       
  4615 {
       
  4616     gen_spr_ne_601(env);
       
  4617     gen_spr_7xx(env);
       
  4618     /* Time base */
       
  4619     gen_tbl(env);
       
  4620     /* Thermal management */
       
  4621     gen_spr_thrm(env);
       
  4622     /* Hardware implementation registers */
       
  4623     /* XXX : not implemented */
       
  4624     spr_register(env, SPR_HID0, "HID0",
       
  4625                  SPR_NOACCESS, SPR_NOACCESS,
       
  4626                  &spr_read_generic, &spr_write_generic,
       
  4627                  0x00000000);
       
  4628     /* XXX : not implemented */
       
  4629     spr_register(env, SPR_HID1, "HID1",
       
  4630                  SPR_NOACCESS, SPR_NOACCESS,
       
  4631                  &spr_read_generic, &spr_write_generic,
       
  4632                  0x00000000);
       
  4633     /* Memory management */
       
  4634     gen_low_BATs(env);
       
  4635     init_excp_7x0(env);
       
  4636     env->dcache_line_size = 32;
       
  4637     env->icache_line_size = 32;
       
  4638     /* Allocate hardware IRQ controller */
       
  4639     ppc6xx_irq_init(env);
       
  4640 }
       
  4641 
       
  4642 /* PowerPC 750                                                               */
       
  4643 #define POWERPC_INSNS_750    (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  4644                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  4645                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  4646                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4647                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  4648                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  4649                               PPC_SEGMENT | PPC_EXTERN)
       
  4650 #define POWERPC_MSRM_750     (0x000000000005FF77ULL)
       
  4651 #define POWERPC_MMU_750      (POWERPC_MMU_32B)
       
  4652 #define POWERPC_EXCP_750     (POWERPC_EXCP_7x0)
       
  4653 #define POWERPC_INPUT_750    (PPC_FLAGS_INPUT_6xx)
       
  4654 #define POWERPC_BFDM_750     (bfd_mach_ppc_750)
       
  4655 #define POWERPC_FLAG_750     (POWERPC_FLAG_SE | POWERPC_FLAG_BE |             \
       
  4656                               POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
       
  4657 #define check_pow_750        check_pow_hid0
       
  4658 
       
  4659 static void init_proc_750 (CPUPPCState *env)
       
  4660 {
       
  4661     gen_spr_ne_601(env);
       
  4662     gen_spr_7xx(env);
       
  4663     /* XXX : not implemented */
       
  4664     spr_register(env, SPR_L2CR, "L2CR",
       
  4665                  SPR_NOACCESS, SPR_NOACCESS,
       
  4666                  &spr_read_generic, &spr_write_generic,
       
  4667                  0x00000000);
       
  4668     /* Time base */
       
  4669     gen_tbl(env);
       
  4670     /* Thermal management */
       
  4671     gen_spr_thrm(env);
       
  4672     /* Hardware implementation registers */
       
  4673     /* XXX : not implemented */
       
  4674     spr_register(env, SPR_HID0, "HID0",
       
  4675                  SPR_NOACCESS, SPR_NOACCESS,
       
  4676                  &spr_read_generic, &spr_write_generic,
       
  4677                  0x00000000);
       
  4678     /* XXX : not implemented */
       
  4679     spr_register(env, SPR_HID1, "HID1",
       
  4680                  SPR_NOACCESS, SPR_NOACCESS,
       
  4681                  &spr_read_generic, &spr_write_generic,
       
  4682                  0x00000000);
       
  4683     /* Memory management */
       
  4684     gen_low_BATs(env);
       
  4685     /* XXX: high BATs are also present but are known to be bugged on
       
  4686      *      die version 1.x
       
  4687      */
       
  4688     init_excp_7x0(env);
       
  4689     env->dcache_line_size = 32;
       
  4690     env->icache_line_size = 32;
       
  4691     /* Allocate hardware IRQ controller */
       
  4692     ppc6xx_irq_init(env);
       
  4693 }
       
  4694 
       
  4695 /* PowerPC 750 CL                                                            */
       
  4696 /* XXX: not implemented:
       
  4697  * cache lock instructions:
       
  4698  * dcbz_l
       
  4699  * floating point paired instructions
       
  4700  * psq_lux
       
  4701  * psq_lx
       
  4702  * psq_stux
       
  4703  * psq_stx
       
  4704  * ps_abs
       
  4705  * ps_add
       
  4706  * ps_cmpo0
       
  4707  * ps_cmpo1
       
  4708  * ps_cmpu0
       
  4709  * ps_cmpu1
       
  4710  * ps_div
       
  4711  * ps_madd
       
  4712  * ps_madds0
       
  4713  * ps_madds1
       
  4714  * ps_merge00
       
  4715  * ps_merge01
       
  4716  * ps_merge10
       
  4717  * ps_merge11
       
  4718  * ps_mr
       
  4719  * ps_msub
       
  4720  * ps_mul
       
  4721  * ps_muls0
       
  4722  * ps_muls1
       
  4723  * ps_nabs
       
  4724  * ps_neg
       
  4725  * ps_nmadd
       
  4726  * ps_nmsub
       
  4727  * ps_res
       
  4728  * ps_rsqrte
       
  4729  * ps_sel
       
  4730  * ps_sub
       
  4731  * ps_sum0
       
  4732  * ps_sum1
       
  4733  */
       
  4734 #define POWERPC_INSNS_750cl  (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  4735                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  4736                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  4737                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4738                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  4739                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  4740                               PPC_SEGMENT | PPC_EXTERN)
       
  4741 #define POWERPC_MSRM_750cl   (0x000000000005FF77ULL)
       
  4742 #define POWERPC_MMU_750cl    (POWERPC_MMU_32B)
       
  4743 #define POWERPC_EXCP_750cl   (POWERPC_EXCP_7x0)
       
  4744 #define POWERPC_INPUT_750cl  (PPC_FLAGS_INPUT_6xx)
       
  4745 #define POWERPC_BFDM_750cl   (bfd_mach_ppc_750)
       
  4746 #define POWERPC_FLAG_750cl   (POWERPC_FLAG_SE | POWERPC_FLAG_BE |             \
       
  4747                               POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
       
  4748 #define check_pow_750cl      check_pow_hid0
       
  4749 
       
  4750 static void init_proc_750cl (CPUPPCState *env)
       
  4751 {
       
  4752     gen_spr_ne_601(env);
       
  4753     gen_spr_7xx(env);
       
  4754     /* XXX : not implemented */
       
  4755     spr_register(env, SPR_L2CR, "L2CR",
       
  4756                  SPR_NOACCESS, SPR_NOACCESS,
       
  4757                  &spr_read_generic, &spr_write_generic,
       
  4758                  0x00000000);
       
  4759     /* Time base */
       
  4760     gen_tbl(env);
       
  4761     /* Thermal management */
       
  4762     /* Those registers are fake on 750CL */
       
  4763     spr_register(env, SPR_THRM1, "THRM1",
       
  4764                  SPR_NOACCESS, SPR_NOACCESS,
       
  4765                  &spr_read_generic, &spr_write_generic,
       
  4766                  0x00000000);
       
  4767     spr_register(env, SPR_THRM2, "THRM2",
       
  4768                  SPR_NOACCESS, SPR_NOACCESS,
       
  4769                  &spr_read_generic, &spr_write_generic,
       
  4770                  0x00000000);
       
  4771     spr_register(env, SPR_THRM3, "THRM3",
       
  4772                  SPR_NOACCESS, SPR_NOACCESS,
       
  4773                  &spr_read_generic, &spr_write_generic,
       
  4774                  0x00000000);
       
  4775     /* XXX: not implemented */
       
  4776     spr_register(env, SPR_750_TDCL, "TDCL",
       
  4777                  SPR_NOACCESS, SPR_NOACCESS,
       
  4778                  &spr_read_generic, &spr_write_generic,
       
  4779                  0x00000000);
       
  4780     spr_register(env, SPR_750_TDCH, "TDCH",
       
  4781                  SPR_NOACCESS, SPR_NOACCESS,
       
  4782                  &spr_read_generic, &spr_write_generic,
       
  4783                  0x00000000);
       
  4784     /* DMA */
       
  4785     /* XXX : not implemented */
       
  4786     spr_register(env, SPR_750_WPAR, "WPAR",
       
  4787                  SPR_NOACCESS, SPR_NOACCESS,
       
  4788                  &spr_read_generic, &spr_write_generic,
       
  4789                  0x00000000);
       
  4790     spr_register(env, SPR_750_DMAL, "DMAL",
       
  4791                  SPR_NOACCESS, SPR_NOACCESS,
       
  4792                  &spr_read_generic, &spr_write_generic,
       
  4793                  0x00000000);
       
  4794     spr_register(env, SPR_750_DMAU, "DMAU",
       
  4795                  SPR_NOACCESS, SPR_NOACCESS,
       
  4796                  &spr_read_generic, &spr_write_generic,
       
  4797                  0x00000000);
       
  4798     /* Hardware implementation registers */
       
  4799     /* XXX : not implemented */
       
  4800     spr_register(env, SPR_HID0, "HID0",
       
  4801                  SPR_NOACCESS, SPR_NOACCESS,
       
  4802                  &spr_read_generic, &spr_write_generic,
       
  4803                  0x00000000);
       
  4804     /* XXX : not implemented */
       
  4805     spr_register(env, SPR_HID1, "HID1",
       
  4806                  SPR_NOACCESS, SPR_NOACCESS,
       
  4807                  &spr_read_generic, &spr_write_generic,
       
  4808                  0x00000000);
       
  4809     /* XXX : not implemented */
       
  4810     spr_register(env, SPR_750CL_HID2, "HID2",
       
  4811                  SPR_NOACCESS, SPR_NOACCESS,
       
  4812                  &spr_read_generic, &spr_write_generic,
       
  4813                  0x00000000);
       
  4814     /* XXX : not implemented */
       
  4815     spr_register(env, SPR_750CL_HID4, "HID4",
       
  4816                  SPR_NOACCESS, SPR_NOACCESS,
       
  4817                  &spr_read_generic, &spr_write_generic,
       
  4818                  0x00000000);
       
  4819     /* Quantization registers */
       
  4820     /* XXX : not implemented */
       
  4821     spr_register(env, SPR_750_GQR0, "GQR0",
       
  4822                  SPR_NOACCESS, SPR_NOACCESS,
       
  4823                  &spr_read_generic, &spr_write_generic,
       
  4824                  0x00000000);
       
  4825     /* XXX : not implemented */
       
  4826     spr_register(env, SPR_750_GQR1, "GQR1",
       
  4827                  SPR_NOACCESS, SPR_NOACCESS,
       
  4828                  &spr_read_generic, &spr_write_generic,
       
  4829                  0x00000000);
       
  4830     /* XXX : not implemented */
       
  4831     spr_register(env, SPR_750_GQR2, "GQR2",
       
  4832                  SPR_NOACCESS, SPR_NOACCESS,
       
  4833                  &spr_read_generic, &spr_write_generic,
       
  4834                  0x00000000);
       
  4835     /* XXX : not implemented */
       
  4836     spr_register(env, SPR_750_GQR3, "GQR3",
       
  4837                  SPR_NOACCESS, SPR_NOACCESS,
       
  4838                  &spr_read_generic, &spr_write_generic,
       
  4839                  0x00000000);
       
  4840     /* XXX : not implemented */
       
  4841     spr_register(env, SPR_750_GQR4, "GQR4",
       
  4842                  SPR_NOACCESS, SPR_NOACCESS,
       
  4843                  &spr_read_generic, &spr_write_generic,
       
  4844                  0x00000000);
       
  4845     /* XXX : not implemented */
       
  4846     spr_register(env, SPR_750_GQR5, "GQR5",
       
  4847                  SPR_NOACCESS, SPR_NOACCESS,
       
  4848                  &spr_read_generic, &spr_write_generic,
       
  4849                  0x00000000);
       
  4850     /* XXX : not implemented */
       
  4851     spr_register(env, SPR_750_GQR6, "GQR6",
       
  4852                  SPR_NOACCESS, SPR_NOACCESS,
       
  4853                  &spr_read_generic, &spr_write_generic,
       
  4854                  0x00000000);
       
  4855     /* XXX : not implemented */
       
  4856     spr_register(env, SPR_750_GQR7, "GQR7",
       
  4857                  SPR_NOACCESS, SPR_NOACCESS,
       
  4858                  &spr_read_generic, &spr_write_generic,
       
  4859                  0x00000000);
       
  4860     /* Memory management */
       
  4861     gen_low_BATs(env);
       
  4862     /* PowerPC 750cl has 8 DBATs and 8 IBATs */
       
  4863     gen_high_BATs(env);
       
  4864     init_excp_750cl(env);
       
  4865     env->dcache_line_size = 32;
       
  4866     env->icache_line_size = 32;
       
  4867     /* Allocate hardware IRQ controller */
       
  4868     ppc6xx_irq_init(env);
       
  4869 }
       
  4870 
       
  4871 /* PowerPC 750CX                                                             */
       
  4872 #define POWERPC_INSNS_750cx  (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  4873                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  4874                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  4875                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4876                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  4877                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  4878                               PPC_SEGMENT | PPC_EXTERN)
       
  4879 #define POWERPC_MSRM_750cx   (0x000000000005FF77ULL)
       
  4880 #define POWERPC_MMU_750cx    (POWERPC_MMU_32B)
       
  4881 #define POWERPC_EXCP_750cx   (POWERPC_EXCP_7x0)
       
  4882 #define POWERPC_INPUT_750cx  (PPC_FLAGS_INPUT_6xx)
       
  4883 #define POWERPC_BFDM_750cx   (bfd_mach_ppc_750)
       
  4884 #define POWERPC_FLAG_750cx   (POWERPC_FLAG_SE | POWERPC_FLAG_BE |             \
       
  4885                               POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
       
  4886 #define check_pow_750cx      check_pow_hid0
       
  4887 
       
  4888 static void init_proc_750cx (CPUPPCState *env)
       
  4889 {
       
  4890     gen_spr_ne_601(env);
       
  4891     gen_spr_7xx(env);
       
  4892     /* XXX : not implemented */
       
  4893     spr_register(env, SPR_L2CR, "L2CR",
       
  4894                  SPR_NOACCESS, SPR_NOACCESS,
       
  4895                  &spr_read_generic, &spr_write_generic,
       
  4896                  0x00000000);
       
  4897     /* Time base */
       
  4898     gen_tbl(env);
       
  4899     /* Thermal management */
       
  4900     gen_spr_thrm(env);
       
  4901     /* This register is not implemented but is present for compatibility */
       
  4902     spr_register(env, SPR_SDA, "SDA",
       
  4903                  SPR_NOACCESS, SPR_NOACCESS,
       
  4904                  &spr_read_generic, &spr_write_generic,
       
  4905                  0x00000000);
       
  4906     /* Hardware implementation registers */
       
  4907     /* XXX : not implemented */
       
  4908     spr_register(env, SPR_HID0, "HID0",
       
  4909                  SPR_NOACCESS, SPR_NOACCESS,
       
  4910                  &spr_read_generic, &spr_write_generic,
       
  4911                  0x00000000);
       
  4912     /* XXX : not implemented */
       
  4913     spr_register(env, SPR_HID1, "HID1",
       
  4914                  SPR_NOACCESS, SPR_NOACCESS,
       
  4915                  &spr_read_generic, &spr_write_generic,
       
  4916                  0x00000000);
       
  4917     /* Memory management */
       
  4918     gen_low_BATs(env);
       
  4919     /* PowerPC 750cx has 8 DBATs and 8 IBATs */
       
  4920     gen_high_BATs(env);
       
  4921     init_excp_750cx(env);
       
  4922     env->dcache_line_size = 32;
       
  4923     env->icache_line_size = 32;
       
  4924     /* Allocate hardware IRQ controller */
       
  4925     ppc6xx_irq_init(env);
       
  4926 }
       
  4927 
       
  4928 /* PowerPC 750FX                                                             */
       
  4929 #define POWERPC_INSNS_750fx  (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  4930                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  4931                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  4932                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4933                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  4934                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  4935                               PPC_SEGMENT  | PPC_EXTERN)
       
  4936 #define POWERPC_MSRM_750fx   (0x000000000005FF77ULL)
       
  4937 #define POWERPC_MMU_750fx    (POWERPC_MMU_32B)
       
  4938 #define POWERPC_EXCP_750fx   (POWERPC_EXCP_7x0)
       
  4939 #define POWERPC_INPUT_750fx  (PPC_FLAGS_INPUT_6xx)
       
  4940 #define POWERPC_BFDM_750fx   (bfd_mach_ppc_750)
       
  4941 #define POWERPC_FLAG_750fx   (POWERPC_FLAG_SE | POWERPC_FLAG_BE |             \
       
  4942                               POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
       
  4943 #define check_pow_750fx      check_pow_hid0
       
  4944 
       
  4945 static void init_proc_750fx (CPUPPCState *env)
       
  4946 {
       
  4947     gen_spr_ne_601(env);
       
  4948     gen_spr_7xx(env);
       
  4949     /* XXX : not implemented */
       
  4950     spr_register(env, SPR_L2CR, "L2CR",
       
  4951                  SPR_NOACCESS, SPR_NOACCESS,
       
  4952                  &spr_read_generic, &spr_write_generic,
       
  4953                  0x00000000);
       
  4954     /* Time base */
       
  4955     gen_tbl(env);
       
  4956     /* Thermal management */
       
  4957     gen_spr_thrm(env);
       
  4958     /* XXX : not implemented */
       
  4959     spr_register(env, SPR_750_THRM4, "THRM4",
       
  4960                  SPR_NOACCESS, SPR_NOACCESS,
       
  4961                  &spr_read_generic, &spr_write_generic,
       
  4962                  0x00000000);
       
  4963     /* Hardware implementation registers */
       
  4964     /* XXX : not implemented */
       
  4965     spr_register(env, SPR_HID0, "HID0",
       
  4966                  SPR_NOACCESS, SPR_NOACCESS,
       
  4967                  &spr_read_generic, &spr_write_generic,
       
  4968                  0x00000000);
       
  4969     /* XXX : not implemented */
       
  4970     spr_register(env, SPR_HID1, "HID1",
       
  4971                  SPR_NOACCESS, SPR_NOACCESS,
       
  4972                  &spr_read_generic, &spr_write_generic,
       
  4973                  0x00000000);
       
  4974     /* XXX : not implemented */
       
  4975     spr_register(env, SPR_750FX_HID2, "HID2",
       
  4976                  SPR_NOACCESS, SPR_NOACCESS,
       
  4977                  &spr_read_generic, &spr_write_generic,
       
  4978                  0x00000000);
       
  4979     /* Memory management */
       
  4980     gen_low_BATs(env);
       
  4981     /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
       
  4982     gen_high_BATs(env);
       
  4983     init_excp_7x0(env);
       
  4984     env->dcache_line_size = 32;
       
  4985     env->icache_line_size = 32;
       
  4986     /* Allocate hardware IRQ controller */
       
  4987     ppc6xx_irq_init(env);
       
  4988 }
       
  4989 
       
  4990 /* PowerPC 750GX                                                             */
       
  4991 #define POWERPC_INSNS_750gx  (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  4992                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  4993                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  4994                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  4995                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  4996                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  4997                               PPC_SEGMENT  | PPC_EXTERN)
       
  4998 #define POWERPC_MSRM_750gx   (0x000000000005FF77ULL)
       
  4999 #define POWERPC_MMU_750gx    (POWERPC_MMU_32B)
       
  5000 #define POWERPC_EXCP_750gx   (POWERPC_EXCP_7x0)
       
  5001 #define POWERPC_INPUT_750gx  (PPC_FLAGS_INPUT_6xx)
       
  5002 #define POWERPC_BFDM_750gx   (bfd_mach_ppc_750)
       
  5003 #define POWERPC_FLAG_750gx   (POWERPC_FLAG_SE | POWERPC_FLAG_BE |             \
       
  5004                               POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
       
  5005 #define check_pow_750gx      check_pow_hid0
       
  5006 
       
  5007 static void init_proc_750gx (CPUPPCState *env)
       
  5008 {
       
  5009     gen_spr_ne_601(env);
       
  5010     gen_spr_7xx(env);
       
  5011     /* XXX : not implemented (XXX: different from 750fx) */
       
  5012     spr_register(env, SPR_L2CR, "L2CR",
       
  5013                  SPR_NOACCESS, SPR_NOACCESS,
       
  5014                  &spr_read_generic, &spr_write_generic,
       
  5015                  0x00000000);
       
  5016     /* Time base */
       
  5017     gen_tbl(env);
       
  5018     /* Thermal management */
       
  5019     gen_spr_thrm(env);
       
  5020     /* XXX : not implemented */
       
  5021     spr_register(env, SPR_750_THRM4, "THRM4",
       
  5022                  SPR_NOACCESS, SPR_NOACCESS,
       
  5023                  &spr_read_generic, &spr_write_generic,
       
  5024                  0x00000000);
       
  5025     /* Hardware implementation registers */
       
  5026     /* XXX : not implemented (XXX: different from 750fx) */
       
  5027     spr_register(env, SPR_HID0, "HID0",
       
  5028                  SPR_NOACCESS, SPR_NOACCESS,
       
  5029                  &spr_read_generic, &spr_write_generic,
       
  5030                  0x00000000);
       
  5031     /* XXX : not implemented */
       
  5032     spr_register(env, SPR_HID1, "HID1",
       
  5033                  SPR_NOACCESS, SPR_NOACCESS,
       
  5034                  &spr_read_generic, &spr_write_generic,
       
  5035                  0x00000000);
       
  5036     /* XXX : not implemented (XXX: different from 750fx) */
       
  5037     spr_register(env, SPR_750FX_HID2, "HID2",
       
  5038                  SPR_NOACCESS, SPR_NOACCESS,
       
  5039                  &spr_read_generic, &spr_write_generic,
       
  5040                  0x00000000);
       
  5041     /* Memory management */
       
  5042     gen_low_BATs(env);
       
  5043     /* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
       
  5044     gen_high_BATs(env);
       
  5045     init_excp_7x0(env);
       
  5046     env->dcache_line_size = 32;
       
  5047     env->icache_line_size = 32;
       
  5048     /* Allocate hardware IRQ controller */
       
  5049     ppc6xx_irq_init(env);
       
  5050 }
       
  5051 
       
  5052 /* PowerPC 745                                                               */
       
  5053 #define POWERPC_INSNS_745    (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  5054                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  5055                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  5056                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  5057                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  5058                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | \
       
  5059                               PPC_SEGMENT | PPC_EXTERN)
       
  5060 #define POWERPC_MSRM_745     (0x000000000005FF77ULL)
       
  5061 #define POWERPC_MMU_745      (POWERPC_MMU_SOFT_6xx)
       
  5062 #define POWERPC_EXCP_745     (POWERPC_EXCP_7x5)
       
  5063 #define POWERPC_INPUT_745    (PPC_FLAGS_INPUT_6xx)
       
  5064 #define POWERPC_BFDM_745     (bfd_mach_ppc_750)
       
  5065 #define POWERPC_FLAG_745     (POWERPC_FLAG_SE | POWERPC_FLAG_BE |             \
       
  5066                               POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
       
  5067 #define check_pow_745        check_pow_hid0
       
  5068 
       
  5069 static void init_proc_745 (CPUPPCState *env)
       
  5070 {
       
  5071     gen_spr_ne_601(env);
       
  5072     gen_spr_7xx(env);
       
  5073     gen_spr_G2_755(env);
       
  5074     /* Time base */
       
  5075     gen_tbl(env);
       
  5076     /* Thermal management */
       
  5077     gen_spr_thrm(env);
       
  5078     /* Hardware implementation registers */
       
  5079     /* XXX : not implemented */
       
  5080     spr_register(env, SPR_HID0, "HID0",
       
  5081                  SPR_NOACCESS, SPR_NOACCESS,
       
  5082                  &spr_read_generic, &spr_write_generic,
       
  5083                  0x00000000);
       
  5084     /* XXX : not implemented */
       
  5085     spr_register(env, SPR_HID1, "HID1",
       
  5086                  SPR_NOACCESS, SPR_NOACCESS,
       
  5087                  &spr_read_generic, &spr_write_generic,
       
  5088                  0x00000000);
       
  5089     /* XXX : not implemented */
       
  5090     spr_register(env, SPR_HID2, "HID2",
       
  5091                  SPR_NOACCESS, SPR_NOACCESS,
       
  5092                  &spr_read_generic, &spr_write_generic,
       
  5093                  0x00000000);
       
  5094     /* Memory management */
       
  5095     gen_low_BATs(env);
       
  5096     gen_high_BATs(env);
       
  5097     gen_6xx_7xx_soft_tlb(env, 64, 2);
       
  5098     init_excp_7x5(env);
       
  5099     env->dcache_line_size = 32;
       
  5100     env->icache_line_size = 32;
       
  5101     /* Allocate hardware IRQ controller */
       
  5102     ppc6xx_irq_init(env);
       
  5103 }
       
  5104 
       
  5105 /* PowerPC 755                                                               */
       
  5106 #define POWERPC_INSNS_755    (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  5107                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  5108                               PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX |          \
       
  5109                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  5110                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  5111                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_6xx_TLB | \
       
  5112                               PPC_SEGMENT | PPC_EXTERN)
       
  5113 #define POWERPC_MSRM_755     (0x000000000005FF77ULL)
       
  5114 #define POWERPC_MMU_755      (POWERPC_MMU_SOFT_6xx)
       
  5115 #define POWERPC_EXCP_755     (POWERPC_EXCP_7x5)
       
  5116 #define POWERPC_INPUT_755    (PPC_FLAGS_INPUT_6xx)
       
  5117 #define POWERPC_BFDM_755     (bfd_mach_ppc_750)
       
  5118 #define POWERPC_FLAG_755     (POWERPC_FLAG_SE | POWERPC_FLAG_BE |             \
       
  5119                               POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
       
  5120 #define check_pow_755        check_pow_hid0
       
  5121 
       
  5122 static void init_proc_755 (CPUPPCState *env)
       
  5123 {
       
  5124     gen_spr_ne_601(env);
       
  5125     gen_spr_7xx(env);
       
  5126     gen_spr_G2_755(env);
       
  5127     /* Time base */
       
  5128     gen_tbl(env);
       
  5129     /* L2 cache control */
       
  5130     /* XXX : not implemented */
       
  5131     spr_register(env, SPR_L2CR, "L2CR",
       
  5132                  SPR_NOACCESS, SPR_NOACCESS,
       
  5133                  &spr_read_generic, &spr_write_generic,
       
  5134                  0x00000000);
       
  5135     /* XXX : not implemented */
       
  5136     spr_register(env, SPR_L2PMCR, "L2PMCR",
       
  5137                  SPR_NOACCESS, SPR_NOACCESS,
       
  5138                  &spr_read_generic, &spr_write_generic,
       
  5139                  0x00000000);
       
  5140     /* Thermal management */
       
  5141     gen_spr_thrm(env);
       
  5142     /* Hardware implementation registers */
       
  5143     /* XXX : not implemented */
       
  5144     spr_register(env, SPR_HID0, "HID0",
       
  5145                  SPR_NOACCESS, SPR_NOACCESS,
       
  5146                  &spr_read_generic, &spr_write_generic,
       
  5147                  0x00000000);
       
  5148     /* XXX : not implemented */
       
  5149     spr_register(env, SPR_HID1, "HID1",
       
  5150                  SPR_NOACCESS, SPR_NOACCESS,
       
  5151                  &spr_read_generic, &spr_write_generic,
       
  5152                  0x00000000);
       
  5153     /* XXX : not implemented */
       
  5154     spr_register(env, SPR_HID2, "HID2",
       
  5155                  SPR_NOACCESS, SPR_NOACCESS,
       
  5156                  &spr_read_generic, &spr_write_generic,
       
  5157                  0x00000000);
       
  5158     /* Memory management */
       
  5159     gen_low_BATs(env);
       
  5160     gen_high_BATs(env);
       
  5161     gen_6xx_7xx_soft_tlb(env, 64, 2);
       
  5162     init_excp_7x5(env);
       
  5163     env->dcache_line_size = 32;
       
  5164     env->icache_line_size = 32;
       
  5165     /* Allocate hardware IRQ controller */
       
  5166     ppc6xx_irq_init(env);
       
  5167 }
       
  5168 
       
  5169 /* PowerPC 7400 (aka G4)                                                     */
       
  5170 #define POWERPC_INSNS_7400   (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  5171                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  5172                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  5173                               PPC_FLOAT_STFIWX |                              \
       
  5174                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  5175                               PPC_CACHE_DCBA | PPC_CACHE_DCBZ |               \
       
  5176                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  5177                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  5178                               PPC_MEM_TLBIA |                                 \
       
  5179                               PPC_SEGMENT | PPC_EXTERN |                      \
       
  5180                               PPC_ALTIVEC)
       
  5181 #define POWERPC_MSRM_7400    (0x000000000205FF77ULL)
       
  5182 #define POWERPC_MMU_7400     (POWERPC_MMU_32B)
       
  5183 #define POWERPC_EXCP_7400    (POWERPC_EXCP_74xx)
       
  5184 #define POWERPC_INPUT_7400   (PPC_FLAGS_INPUT_6xx)
       
  5185 #define POWERPC_BFDM_7400    (bfd_mach_ppc_7400)
       
  5186 #define POWERPC_FLAG_7400    (POWERPC_FLAG_VRE | POWERPC_FLAG_SE |            \
       
  5187                               POWERPC_FLAG_BE | POWERPC_FLAG_PMM |            \
       
  5188                               POWERPC_FLAG_BUS_CLK)
       
  5189 #define check_pow_7400       check_pow_hid0_74xx
       
  5190 
       
  5191 static void init_proc_7400 (CPUPPCState *env)
       
  5192 {
       
  5193     gen_spr_ne_601(env);
       
  5194     gen_spr_7xx(env);
       
  5195     /* Time base */
       
  5196     gen_tbl(env);
       
  5197     /* 74xx specific SPR */
       
  5198     gen_spr_74xx(env);
       
  5199     /* XXX : not implemented */
       
  5200     spr_register(env, SPR_UBAMR, "UBAMR",
       
  5201                  &spr_read_ureg, SPR_NOACCESS,
       
  5202                  &spr_read_ureg, SPR_NOACCESS,
       
  5203                  0x00000000);
       
  5204     /* XXX: this seems not implemented on all revisions. */
       
  5205     /* XXX : not implemented */
       
  5206     spr_register(env, SPR_MSSCR1, "MSSCR1",
       
  5207                  SPR_NOACCESS, SPR_NOACCESS,
       
  5208                  &spr_read_generic, &spr_write_generic,
       
  5209                  0x00000000);
       
  5210     /* Thermal management */
       
  5211     gen_spr_thrm(env);
       
  5212     /* Memory management */
       
  5213     gen_low_BATs(env);
       
  5214     init_excp_7400(env);
       
  5215     env->dcache_line_size = 32;
       
  5216     env->icache_line_size = 32;
       
  5217     /* Allocate hardware IRQ controller */
       
  5218     ppc6xx_irq_init(env);
       
  5219 }
       
  5220 
       
  5221 /* PowerPC 7410 (aka G4)                                                     */
       
  5222 #define POWERPC_INSNS_7410   (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  5223                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  5224                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  5225                               PPC_FLOAT_STFIWX |                              \
       
  5226                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  5227                               PPC_CACHE_DCBA | PPC_CACHE_DCBZ |               \
       
  5228                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  5229                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  5230                               PPC_MEM_TLBIA |                                 \
       
  5231                               PPC_SEGMENT | PPC_EXTERN |                      \
       
  5232                               PPC_ALTIVEC)
       
  5233 #define POWERPC_MSRM_7410    (0x000000000205FF77ULL)
       
  5234 #define POWERPC_MMU_7410     (POWERPC_MMU_32B)
       
  5235 #define POWERPC_EXCP_7410    (POWERPC_EXCP_74xx)
       
  5236 #define POWERPC_INPUT_7410   (PPC_FLAGS_INPUT_6xx)
       
  5237 #define POWERPC_BFDM_7410    (bfd_mach_ppc_7400)
       
  5238 #define POWERPC_FLAG_7410    (POWERPC_FLAG_VRE | POWERPC_FLAG_SE |            \
       
  5239                               POWERPC_FLAG_BE | POWERPC_FLAG_PMM |            \
       
  5240                               POWERPC_FLAG_BUS_CLK)
       
  5241 #define check_pow_7410       check_pow_hid0_74xx
       
  5242 
       
  5243 static void init_proc_7410 (CPUPPCState *env)
       
  5244 {
       
  5245     gen_spr_ne_601(env);
       
  5246     gen_spr_7xx(env);
       
  5247     /* Time base */
       
  5248     gen_tbl(env);
       
  5249     /* 74xx specific SPR */
       
  5250     gen_spr_74xx(env);
       
  5251     /* XXX : not implemented */
       
  5252     spr_register(env, SPR_UBAMR, "UBAMR",
       
  5253                  &spr_read_ureg, SPR_NOACCESS,
       
  5254                  &spr_read_ureg, SPR_NOACCESS,
       
  5255                  0x00000000);
       
  5256     /* Thermal management */
       
  5257     gen_spr_thrm(env);
       
  5258     /* L2PMCR */
       
  5259     /* XXX : not implemented */
       
  5260     spr_register(env, SPR_L2PMCR, "L2PMCR",
       
  5261                  SPR_NOACCESS, SPR_NOACCESS,
       
  5262                  &spr_read_generic, &spr_write_generic,
       
  5263                  0x00000000);
       
  5264     /* LDSTDB */
       
  5265     /* XXX : not implemented */
       
  5266     spr_register(env, SPR_LDSTDB, "LDSTDB",
       
  5267                  SPR_NOACCESS, SPR_NOACCESS,
       
  5268                  &spr_read_generic, &spr_write_generic,
       
  5269                  0x00000000);
       
  5270     /* Memory management */
       
  5271     gen_low_BATs(env);
       
  5272     init_excp_7400(env);
       
  5273     env->dcache_line_size = 32;
       
  5274     env->icache_line_size = 32;
       
  5275     /* Allocate hardware IRQ controller */
       
  5276     ppc6xx_irq_init(env);
       
  5277 }
       
  5278 
       
  5279 /* PowerPC 7440 (aka G4)                                                     */
       
  5280 #define POWERPC_INSNS_7440   (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  5281                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  5282                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  5283                               PPC_FLOAT_STFIWX |                              \
       
  5284                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  5285                               PPC_CACHE_DCBA | PPC_CACHE_DCBZ |               \
       
  5286                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  5287                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  5288                               PPC_MEM_TLBIA | PPC_74xx_TLB |                  \
       
  5289                               PPC_SEGMENT | PPC_EXTERN |                      \
       
  5290                               PPC_ALTIVEC)
       
  5291 #define POWERPC_MSRM_7440    (0x000000000205FF77ULL)
       
  5292 #define POWERPC_MMU_7440     (POWERPC_MMU_SOFT_74xx)
       
  5293 #define POWERPC_EXCP_7440    (POWERPC_EXCP_74xx)
       
  5294 #define POWERPC_INPUT_7440   (PPC_FLAGS_INPUT_6xx)
       
  5295 #define POWERPC_BFDM_7440    (bfd_mach_ppc_7400)
       
  5296 #define POWERPC_FLAG_7440    (POWERPC_FLAG_VRE | POWERPC_FLAG_SE |            \
       
  5297                               POWERPC_FLAG_BE | POWERPC_FLAG_PMM |            \
       
  5298                               POWERPC_FLAG_BUS_CLK)
       
  5299 #define check_pow_7440       check_pow_hid0_74xx
       
  5300 
       
  5301 __attribute__ (( unused ))
       
  5302 static void init_proc_7440 (CPUPPCState *env)
       
  5303 {
       
  5304     gen_spr_ne_601(env);
       
  5305     gen_spr_7xx(env);
       
  5306     /* Time base */
       
  5307     gen_tbl(env);
       
  5308     /* 74xx specific SPR */
       
  5309     gen_spr_74xx(env);
       
  5310     /* XXX : not implemented */
       
  5311     spr_register(env, SPR_UBAMR, "UBAMR",
       
  5312                  &spr_read_ureg, SPR_NOACCESS,
       
  5313                  &spr_read_ureg, SPR_NOACCESS,
       
  5314                  0x00000000);
       
  5315     /* LDSTCR */
       
  5316     /* XXX : not implemented */
       
  5317     spr_register(env, SPR_LDSTCR, "LDSTCR",
       
  5318                  SPR_NOACCESS, SPR_NOACCESS,
       
  5319                  &spr_read_generic, &spr_write_generic,
       
  5320                  0x00000000);
       
  5321     /* ICTRL */
       
  5322     /* XXX : not implemented */
       
  5323     spr_register(env, SPR_ICTRL, "ICTRL",
       
  5324                  SPR_NOACCESS, SPR_NOACCESS,
       
  5325                  &spr_read_generic, &spr_write_generic,
       
  5326                  0x00000000);
       
  5327     /* MSSSR0 */
       
  5328     /* XXX : not implemented */
       
  5329     spr_register(env, SPR_MSSSR0, "MSSSR0",
       
  5330                  SPR_NOACCESS, SPR_NOACCESS,
       
  5331                  &spr_read_generic, &spr_write_generic,
       
  5332                  0x00000000);
       
  5333     /* PMC */
       
  5334     /* XXX : not implemented */
       
  5335     spr_register(env, SPR_PMC5, "PMC5",
       
  5336                  SPR_NOACCESS, SPR_NOACCESS,
       
  5337                  &spr_read_generic, &spr_write_generic,
       
  5338                  0x00000000);
       
  5339     /* XXX : not implemented */
       
  5340     spr_register(env, SPR_UPMC5, "UPMC5",
       
  5341                  &spr_read_ureg, SPR_NOACCESS,
       
  5342                  &spr_read_ureg, SPR_NOACCESS,
       
  5343                  0x00000000);
       
  5344     /* XXX : not implemented */
       
  5345     spr_register(env, SPR_PMC6, "PMC6",
       
  5346                  SPR_NOACCESS, SPR_NOACCESS,
       
  5347                  &spr_read_generic, &spr_write_generic,
       
  5348                  0x00000000);
       
  5349     /* XXX : not implemented */
       
  5350     spr_register(env, SPR_UPMC6, "UPMC6",
       
  5351                  &spr_read_ureg, SPR_NOACCESS,
       
  5352                  &spr_read_ureg, SPR_NOACCESS,
       
  5353                  0x00000000);
       
  5354     /* Memory management */
       
  5355     gen_low_BATs(env);
       
  5356     gen_74xx_soft_tlb(env, 128, 2);
       
  5357     init_excp_7450(env);
       
  5358     env->dcache_line_size = 32;
       
  5359     env->icache_line_size = 32;
       
  5360     /* Allocate hardware IRQ controller */
       
  5361     ppc6xx_irq_init(env);
       
  5362 }
       
  5363 
       
  5364 /* PowerPC 7450 (aka G4)                                                     */
       
  5365 #define POWERPC_INSNS_7450   (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  5366                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  5367                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  5368                               PPC_FLOAT_STFIWX |                              \
       
  5369                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  5370                               PPC_CACHE_DCBA | PPC_CACHE_DCBZ |               \
       
  5371                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  5372                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  5373                               PPC_MEM_TLBIA | PPC_74xx_TLB |                  \
       
  5374                               PPC_SEGMENT | PPC_EXTERN |                      \
       
  5375                               PPC_ALTIVEC)
       
  5376 #define POWERPC_MSRM_7450    (0x000000000205FF77ULL)
       
  5377 #define POWERPC_MMU_7450     (POWERPC_MMU_SOFT_74xx)
       
  5378 #define POWERPC_EXCP_7450    (POWERPC_EXCP_74xx)
       
  5379 #define POWERPC_INPUT_7450   (PPC_FLAGS_INPUT_6xx)
       
  5380 #define POWERPC_BFDM_7450    (bfd_mach_ppc_7400)
       
  5381 #define POWERPC_FLAG_7450    (POWERPC_FLAG_VRE | POWERPC_FLAG_SE |            \
       
  5382                               POWERPC_FLAG_BE | POWERPC_FLAG_PMM |            \
       
  5383                               POWERPC_FLAG_BUS_CLK)
       
  5384 #define check_pow_7450       check_pow_hid0_74xx
       
  5385 
       
  5386 __attribute__ (( unused ))
       
  5387 static void init_proc_7450 (CPUPPCState *env)
       
  5388 {
       
  5389     gen_spr_ne_601(env);
       
  5390     gen_spr_7xx(env);
       
  5391     /* Time base */
       
  5392     gen_tbl(env);
       
  5393     /* 74xx specific SPR */
       
  5394     gen_spr_74xx(env);
       
  5395     /* Level 3 cache control */
       
  5396     gen_l3_ctrl(env);
       
  5397     /* L3ITCR1 */
       
  5398     /* XXX : not implemented */
       
  5399     spr_register(env, SPR_L3ITCR1, "L3ITCR1",
       
  5400                  SPR_NOACCESS, SPR_NOACCESS,
       
  5401                  &spr_read_generic, &spr_write_generic,
       
  5402                  0x00000000);
       
  5403     /* L3ITCR2 */
       
  5404     /* XXX : not implemented */
       
  5405     spr_register(env, SPR_L3ITCR2, "L3ITCR2",
       
  5406                  SPR_NOACCESS, SPR_NOACCESS,
       
  5407                  &spr_read_generic, &spr_write_generic,
       
  5408                  0x00000000);
       
  5409     /* L3ITCR3 */
       
  5410     /* XXX : not implemented */
       
  5411     spr_register(env, SPR_L3ITCR3, "L3ITCR3",
       
  5412                  SPR_NOACCESS, SPR_NOACCESS,
       
  5413                  &spr_read_generic, &spr_write_generic,
       
  5414                  0x00000000);
       
  5415     /* L3OHCR */
       
  5416     /* XXX : not implemented */
       
  5417     spr_register(env, SPR_L3OHCR, "L3OHCR",
       
  5418                  SPR_NOACCESS, SPR_NOACCESS,
       
  5419                  &spr_read_generic, &spr_write_generic,
       
  5420                  0x00000000);
       
  5421     /* XXX : not implemented */
       
  5422     spr_register(env, SPR_UBAMR, "UBAMR",
       
  5423                  &spr_read_ureg, SPR_NOACCESS,
       
  5424                  &spr_read_ureg, SPR_NOACCESS,
       
  5425                  0x00000000);
       
  5426     /* LDSTCR */
       
  5427     /* XXX : not implemented */
       
  5428     spr_register(env, SPR_LDSTCR, "LDSTCR",
       
  5429                  SPR_NOACCESS, SPR_NOACCESS,
       
  5430                  &spr_read_generic, &spr_write_generic,
       
  5431                  0x00000000);
       
  5432     /* ICTRL */
       
  5433     /* XXX : not implemented */
       
  5434     spr_register(env, SPR_ICTRL, "ICTRL",
       
  5435                  SPR_NOACCESS, SPR_NOACCESS,
       
  5436                  &spr_read_generic, &spr_write_generic,
       
  5437                  0x00000000);
       
  5438     /* MSSSR0 */
       
  5439     /* XXX : not implemented */
       
  5440     spr_register(env, SPR_MSSSR0, "MSSSR0",
       
  5441                  SPR_NOACCESS, SPR_NOACCESS,
       
  5442                  &spr_read_generic, &spr_write_generic,
       
  5443                  0x00000000);
       
  5444     /* PMC */
       
  5445     /* XXX : not implemented */
       
  5446     spr_register(env, SPR_PMC5, "PMC5",
       
  5447                  SPR_NOACCESS, SPR_NOACCESS,
       
  5448                  &spr_read_generic, &spr_write_generic,
       
  5449                  0x00000000);
       
  5450     /* XXX : not implemented */
       
  5451     spr_register(env, SPR_UPMC5, "UPMC5",
       
  5452                  &spr_read_ureg, SPR_NOACCESS,
       
  5453                  &spr_read_ureg, SPR_NOACCESS,
       
  5454                  0x00000000);
       
  5455     /* XXX : not implemented */
       
  5456     spr_register(env, SPR_PMC6, "PMC6",
       
  5457                  SPR_NOACCESS, SPR_NOACCESS,
       
  5458                  &spr_read_generic, &spr_write_generic,
       
  5459                  0x00000000);
       
  5460     /* XXX : not implemented */
       
  5461     spr_register(env, SPR_UPMC6, "UPMC6",
       
  5462                  &spr_read_ureg, SPR_NOACCESS,
       
  5463                  &spr_read_ureg, SPR_NOACCESS,
       
  5464                  0x00000000);
       
  5465     /* Memory management */
       
  5466     gen_low_BATs(env);
       
  5467     gen_74xx_soft_tlb(env, 128, 2);
       
  5468     init_excp_7450(env);
       
  5469     env->dcache_line_size = 32;
       
  5470     env->icache_line_size = 32;
       
  5471     /* Allocate hardware IRQ controller */
       
  5472     ppc6xx_irq_init(env);
       
  5473 }
       
  5474 
       
  5475 /* PowerPC 7445 (aka G4)                                                     */
       
  5476 #define POWERPC_INSNS_7445   (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  5477                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  5478                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  5479                               PPC_FLOAT_STFIWX |                              \
       
  5480                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  5481                               PPC_CACHE_DCBA | PPC_CACHE_DCBZ |               \
       
  5482                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  5483                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  5484                               PPC_MEM_TLBIA | PPC_74xx_TLB |                  \
       
  5485                               PPC_SEGMENT | PPC_EXTERN |                      \
       
  5486                               PPC_ALTIVEC)
       
  5487 #define POWERPC_MSRM_7445    (0x000000000205FF77ULL)
       
  5488 #define POWERPC_MMU_7445     (POWERPC_MMU_SOFT_74xx)
       
  5489 #define POWERPC_EXCP_7445    (POWERPC_EXCP_74xx)
       
  5490 #define POWERPC_INPUT_7445   (PPC_FLAGS_INPUT_6xx)
       
  5491 #define POWERPC_BFDM_7445    (bfd_mach_ppc_7400)
       
  5492 #define POWERPC_FLAG_7445    (POWERPC_FLAG_VRE | POWERPC_FLAG_SE |            \
       
  5493                               POWERPC_FLAG_BE | POWERPC_FLAG_PMM |            \
       
  5494                               POWERPC_FLAG_BUS_CLK)
       
  5495 #define check_pow_7445       check_pow_hid0_74xx
       
  5496 
       
  5497 __attribute__ (( unused ))
       
  5498 static void init_proc_7445 (CPUPPCState *env)
       
  5499 {
       
  5500     gen_spr_ne_601(env);
       
  5501     gen_spr_7xx(env);
       
  5502     /* Time base */
       
  5503     gen_tbl(env);
       
  5504     /* 74xx specific SPR */
       
  5505     gen_spr_74xx(env);
       
  5506     /* LDSTCR */
       
  5507     /* XXX : not implemented */
       
  5508     spr_register(env, SPR_LDSTCR, "LDSTCR",
       
  5509                  SPR_NOACCESS, SPR_NOACCESS,
       
  5510                  &spr_read_generic, &spr_write_generic,
       
  5511                  0x00000000);
       
  5512     /* ICTRL */
       
  5513     /* XXX : not implemented */
       
  5514     spr_register(env, SPR_ICTRL, "ICTRL",
       
  5515                  SPR_NOACCESS, SPR_NOACCESS,
       
  5516                  &spr_read_generic, &spr_write_generic,
       
  5517                  0x00000000);
       
  5518     /* MSSSR0 */
       
  5519     /* XXX : not implemented */
       
  5520     spr_register(env, SPR_MSSSR0, "MSSSR0",
       
  5521                  SPR_NOACCESS, SPR_NOACCESS,
       
  5522                  &spr_read_generic, &spr_write_generic,
       
  5523                  0x00000000);
       
  5524     /* PMC */
       
  5525     /* XXX : not implemented */
       
  5526     spr_register(env, SPR_PMC5, "PMC5",
       
  5527                  SPR_NOACCESS, SPR_NOACCESS,
       
  5528                  &spr_read_generic, &spr_write_generic,
       
  5529                  0x00000000);
       
  5530     /* XXX : not implemented */
       
  5531     spr_register(env, SPR_UPMC5, "UPMC5",
       
  5532                  &spr_read_ureg, SPR_NOACCESS,
       
  5533                  &spr_read_ureg, SPR_NOACCESS,
       
  5534                  0x00000000);
       
  5535     /* XXX : not implemented */
       
  5536     spr_register(env, SPR_PMC6, "PMC6",
       
  5537                  SPR_NOACCESS, SPR_NOACCESS,
       
  5538                  &spr_read_generic, &spr_write_generic,
       
  5539                  0x00000000);
       
  5540     /* XXX : not implemented */
       
  5541     spr_register(env, SPR_UPMC6, "UPMC6",
       
  5542                  &spr_read_ureg, SPR_NOACCESS,
       
  5543                  &spr_read_ureg, SPR_NOACCESS,
       
  5544                  0x00000000);
       
  5545     /* SPRGs */
       
  5546     spr_register(env, SPR_SPRG4, "SPRG4",
       
  5547                  SPR_NOACCESS, SPR_NOACCESS,
       
  5548                  &spr_read_generic, &spr_write_generic,
       
  5549                  0x00000000);
       
  5550     spr_register(env, SPR_USPRG4, "USPRG4",
       
  5551                  &spr_read_ureg, SPR_NOACCESS,
       
  5552                  &spr_read_ureg, SPR_NOACCESS,
       
  5553                  0x00000000);
       
  5554     spr_register(env, SPR_SPRG5, "SPRG5",
       
  5555                  SPR_NOACCESS, SPR_NOACCESS,
       
  5556                  &spr_read_generic, &spr_write_generic,
       
  5557                  0x00000000);
       
  5558     spr_register(env, SPR_USPRG5, "USPRG5",
       
  5559                  &spr_read_ureg, SPR_NOACCESS,
       
  5560                  &spr_read_ureg, SPR_NOACCESS,
       
  5561                  0x00000000);
       
  5562     spr_register(env, SPR_SPRG6, "SPRG6",
       
  5563                  SPR_NOACCESS, SPR_NOACCESS,
       
  5564                  &spr_read_generic, &spr_write_generic,
       
  5565                  0x00000000);
       
  5566     spr_register(env, SPR_USPRG6, "USPRG6",
       
  5567                  &spr_read_ureg, SPR_NOACCESS,
       
  5568                  &spr_read_ureg, SPR_NOACCESS,
       
  5569                  0x00000000);
       
  5570     spr_register(env, SPR_SPRG7, "SPRG7",
       
  5571                  SPR_NOACCESS, SPR_NOACCESS,
       
  5572                  &spr_read_generic, &spr_write_generic,
       
  5573                  0x00000000);
       
  5574     spr_register(env, SPR_USPRG7, "USPRG7",
       
  5575                  &spr_read_ureg, SPR_NOACCESS,
       
  5576                  &spr_read_ureg, SPR_NOACCESS,
       
  5577                  0x00000000);
       
  5578     /* Memory management */
       
  5579     gen_low_BATs(env);
       
  5580     gen_high_BATs(env);
       
  5581     gen_74xx_soft_tlb(env, 128, 2);
       
  5582     init_excp_7450(env);
       
  5583     env->dcache_line_size = 32;
       
  5584     env->icache_line_size = 32;
       
  5585     /* Allocate hardware IRQ controller */
       
  5586     ppc6xx_irq_init(env);
       
  5587 }
       
  5588 
       
  5589 /* PowerPC 7455 (aka G4)                                                     */
       
  5590 #define POWERPC_INSNS_7455   (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  5591                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  5592                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  5593                               PPC_FLOAT_STFIWX |                              \
       
  5594                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  5595                               PPC_CACHE_DCBA | PPC_CACHE_DCBZ |               \
       
  5596                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  5597                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  5598                               PPC_MEM_TLBIA | PPC_74xx_TLB |                  \
       
  5599                               PPC_SEGMENT | PPC_EXTERN |                      \
       
  5600                               PPC_ALTIVEC)
       
  5601 #define POWERPC_MSRM_7455    (0x000000000205FF77ULL)
       
  5602 #define POWERPC_MMU_7455     (POWERPC_MMU_SOFT_74xx)
       
  5603 #define POWERPC_EXCP_7455    (POWERPC_EXCP_74xx)
       
  5604 #define POWERPC_INPUT_7455   (PPC_FLAGS_INPUT_6xx)
       
  5605 #define POWERPC_BFDM_7455    (bfd_mach_ppc_7400)
       
  5606 #define POWERPC_FLAG_7455    (POWERPC_FLAG_VRE | POWERPC_FLAG_SE |            \
       
  5607                               POWERPC_FLAG_BE | POWERPC_FLAG_PMM |            \
       
  5608                               POWERPC_FLAG_BUS_CLK)
       
  5609 #define check_pow_7455       check_pow_hid0_74xx
       
  5610 
       
  5611 __attribute__ (( unused ))
       
  5612 static void init_proc_7455 (CPUPPCState *env)
       
  5613 {
       
  5614     gen_spr_ne_601(env);
       
  5615     gen_spr_7xx(env);
       
  5616     /* Time base */
       
  5617     gen_tbl(env);
       
  5618     /* 74xx specific SPR */
       
  5619     gen_spr_74xx(env);
       
  5620     /* Level 3 cache control */
       
  5621     gen_l3_ctrl(env);
       
  5622     /* LDSTCR */
       
  5623     /* XXX : not implemented */
       
  5624     spr_register(env, SPR_LDSTCR, "LDSTCR",
       
  5625                  SPR_NOACCESS, SPR_NOACCESS,
       
  5626                  &spr_read_generic, &spr_write_generic,
       
  5627                  0x00000000);
       
  5628     /* ICTRL */
       
  5629     /* XXX : not implemented */
       
  5630     spr_register(env, SPR_ICTRL, "ICTRL",
       
  5631                  SPR_NOACCESS, SPR_NOACCESS,
       
  5632                  &spr_read_generic, &spr_write_generic,
       
  5633                  0x00000000);
       
  5634     /* MSSSR0 */
       
  5635     /* XXX : not implemented */
       
  5636     spr_register(env, SPR_MSSSR0, "MSSSR0",
       
  5637                  SPR_NOACCESS, SPR_NOACCESS,
       
  5638                  &spr_read_generic, &spr_write_generic,
       
  5639                  0x00000000);
       
  5640     /* PMC */
       
  5641     /* XXX : not implemented */
       
  5642     spr_register(env, SPR_PMC5, "PMC5",
       
  5643                  SPR_NOACCESS, SPR_NOACCESS,
       
  5644                  &spr_read_generic, &spr_write_generic,
       
  5645                  0x00000000);
       
  5646     /* XXX : not implemented */
       
  5647     spr_register(env, SPR_UPMC5, "UPMC5",
       
  5648                  &spr_read_ureg, SPR_NOACCESS,
       
  5649                  &spr_read_ureg, SPR_NOACCESS,
       
  5650                  0x00000000);
       
  5651     /* XXX : not implemented */
       
  5652     spr_register(env, SPR_PMC6, "PMC6",
       
  5653                  SPR_NOACCESS, SPR_NOACCESS,
       
  5654                  &spr_read_generic, &spr_write_generic,
       
  5655                  0x00000000);
       
  5656     /* XXX : not implemented */
       
  5657     spr_register(env, SPR_UPMC6, "UPMC6",
       
  5658                  &spr_read_ureg, SPR_NOACCESS,
       
  5659                  &spr_read_ureg, SPR_NOACCESS,
       
  5660                  0x00000000);
       
  5661     /* SPRGs */
       
  5662     spr_register(env, SPR_SPRG4, "SPRG4",
       
  5663                  SPR_NOACCESS, SPR_NOACCESS,
       
  5664                  &spr_read_generic, &spr_write_generic,
       
  5665                  0x00000000);
       
  5666     spr_register(env, SPR_USPRG4, "USPRG4",
       
  5667                  &spr_read_ureg, SPR_NOACCESS,
       
  5668                  &spr_read_ureg, SPR_NOACCESS,
       
  5669                  0x00000000);
       
  5670     spr_register(env, SPR_SPRG5, "SPRG5",
       
  5671                  SPR_NOACCESS, SPR_NOACCESS,
       
  5672                  &spr_read_generic, &spr_write_generic,
       
  5673                  0x00000000);
       
  5674     spr_register(env, SPR_USPRG5, "USPRG5",
       
  5675                  &spr_read_ureg, SPR_NOACCESS,
       
  5676                  &spr_read_ureg, SPR_NOACCESS,
       
  5677                  0x00000000);
       
  5678     spr_register(env, SPR_SPRG6, "SPRG6",
       
  5679                  SPR_NOACCESS, SPR_NOACCESS,
       
  5680                  &spr_read_generic, &spr_write_generic,
       
  5681                  0x00000000);
       
  5682     spr_register(env, SPR_USPRG6, "USPRG6",
       
  5683                  &spr_read_ureg, SPR_NOACCESS,
       
  5684                  &spr_read_ureg, SPR_NOACCESS,
       
  5685                  0x00000000);
       
  5686     spr_register(env, SPR_SPRG7, "SPRG7",
       
  5687                  SPR_NOACCESS, SPR_NOACCESS,
       
  5688                  &spr_read_generic, &spr_write_generic,
       
  5689                  0x00000000);
       
  5690     spr_register(env, SPR_USPRG7, "USPRG7",
       
  5691                  &spr_read_ureg, SPR_NOACCESS,
       
  5692                  &spr_read_ureg, SPR_NOACCESS,
       
  5693                  0x00000000);
       
  5694     /* Memory management */
       
  5695     gen_low_BATs(env);
       
  5696     gen_high_BATs(env);
       
  5697     gen_74xx_soft_tlb(env, 128, 2);
       
  5698     init_excp_7450(env);
       
  5699     env->dcache_line_size = 32;
       
  5700     env->icache_line_size = 32;
       
  5701     /* Allocate hardware IRQ controller */
       
  5702     ppc6xx_irq_init(env);
       
  5703 }
       
  5704 
       
  5705 /* PowerPC 7457 (aka G4)                                                     */
       
  5706 #define POWERPC_INSNS_7457   (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  5707                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  5708                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  5709                               PPC_FLOAT_STFIWX |                              \
       
  5710                               PPC_CACHE | PPC_CACHE_ICBI |                    \
       
  5711                               PPC_CACHE_DCBA | PPC_CACHE_DCBZ |               \
       
  5712                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  5713                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  5714                               PPC_MEM_TLBIA | PPC_74xx_TLB |                  \
       
  5715                               PPC_SEGMENT | PPC_EXTERN |                      \
       
  5716                               PPC_ALTIVEC)
       
  5717 #define POWERPC_MSRM_7457    (0x000000000205FF77ULL)
       
  5718 #define POWERPC_MMU_7457     (POWERPC_MMU_SOFT_74xx)
       
  5719 #define POWERPC_EXCP_7457    (POWERPC_EXCP_74xx)
       
  5720 #define POWERPC_INPUT_7457   (PPC_FLAGS_INPUT_6xx)
       
  5721 #define POWERPC_BFDM_7457    (bfd_mach_ppc_7400)
       
  5722 #define POWERPC_FLAG_7457    (POWERPC_FLAG_VRE | POWERPC_FLAG_SE |            \
       
  5723                               POWERPC_FLAG_BE | POWERPC_FLAG_PMM |            \
       
  5724                               POWERPC_FLAG_BUS_CLK)
       
  5725 #define check_pow_7457       check_pow_hid0_74xx
       
  5726 
       
  5727 __attribute__ (( unused ))
       
  5728 static void init_proc_7457 (CPUPPCState *env)
       
  5729 {
       
  5730     gen_spr_ne_601(env);
       
  5731     gen_spr_7xx(env);
       
  5732     /* Time base */
       
  5733     gen_tbl(env);
       
  5734     /* 74xx specific SPR */
       
  5735     gen_spr_74xx(env);
       
  5736     /* Level 3 cache control */
       
  5737     gen_l3_ctrl(env);
       
  5738     /* L3ITCR1 */
       
  5739     /* XXX : not implemented */
       
  5740     spr_register(env, SPR_L3ITCR1, "L3ITCR1",
       
  5741                  SPR_NOACCESS, SPR_NOACCESS,
       
  5742                  &spr_read_generic, &spr_write_generic,
       
  5743                  0x00000000);
       
  5744     /* L3ITCR2 */
       
  5745     /* XXX : not implemented */
       
  5746     spr_register(env, SPR_L3ITCR2, "L3ITCR2",
       
  5747                  SPR_NOACCESS, SPR_NOACCESS,
       
  5748                  &spr_read_generic, &spr_write_generic,
       
  5749                  0x00000000);
       
  5750     /* L3ITCR3 */
       
  5751     /* XXX : not implemented */
       
  5752     spr_register(env, SPR_L3ITCR3, "L3ITCR3",
       
  5753                  SPR_NOACCESS, SPR_NOACCESS,
       
  5754                  &spr_read_generic, &spr_write_generic,
       
  5755                  0x00000000);
       
  5756     /* L3OHCR */
       
  5757     /* XXX : not implemented */
       
  5758     spr_register(env, SPR_L3OHCR, "L3OHCR",
       
  5759                  SPR_NOACCESS, SPR_NOACCESS,
       
  5760                  &spr_read_generic, &spr_write_generic,
       
  5761                  0x00000000);
       
  5762     /* LDSTCR */
       
  5763     /* XXX : not implemented */
       
  5764     spr_register(env, SPR_LDSTCR, "LDSTCR",
       
  5765                  SPR_NOACCESS, SPR_NOACCESS,
       
  5766                  &spr_read_generic, &spr_write_generic,
       
  5767                  0x00000000);
       
  5768     /* ICTRL */
       
  5769     /* XXX : not implemented */
       
  5770     spr_register(env, SPR_ICTRL, "ICTRL",
       
  5771                  SPR_NOACCESS, SPR_NOACCESS,
       
  5772                  &spr_read_generic, &spr_write_generic,
       
  5773                  0x00000000);
       
  5774     /* MSSSR0 */
       
  5775     /* XXX : not implemented */
       
  5776     spr_register(env, SPR_MSSSR0, "MSSSR0",
       
  5777                  SPR_NOACCESS, SPR_NOACCESS,
       
  5778                  &spr_read_generic, &spr_write_generic,
       
  5779                  0x00000000);
       
  5780     /* PMC */
       
  5781     /* XXX : not implemented */
       
  5782     spr_register(env, SPR_PMC5, "PMC5",
       
  5783                  SPR_NOACCESS, SPR_NOACCESS,
       
  5784                  &spr_read_generic, &spr_write_generic,
       
  5785                  0x00000000);
       
  5786     /* XXX : not implemented */
       
  5787     spr_register(env, SPR_UPMC5, "UPMC5",
       
  5788                  &spr_read_ureg, SPR_NOACCESS,
       
  5789                  &spr_read_ureg, SPR_NOACCESS,
       
  5790                  0x00000000);
       
  5791     /* XXX : not implemented */
       
  5792     spr_register(env, SPR_PMC6, "PMC6",
       
  5793                  SPR_NOACCESS, SPR_NOACCESS,
       
  5794                  &spr_read_generic, &spr_write_generic,
       
  5795                  0x00000000);
       
  5796     /* XXX : not implemented */
       
  5797     spr_register(env, SPR_UPMC6, "UPMC6",
       
  5798                  &spr_read_ureg, SPR_NOACCESS,
       
  5799                  &spr_read_ureg, SPR_NOACCESS,
       
  5800                  0x00000000);
       
  5801     /* SPRGs */
       
  5802     spr_register(env, SPR_SPRG4, "SPRG4",
       
  5803                  SPR_NOACCESS, SPR_NOACCESS,
       
  5804                  &spr_read_generic, &spr_write_generic,
       
  5805                  0x00000000);
       
  5806     spr_register(env, SPR_USPRG4, "USPRG4",
       
  5807                  &spr_read_ureg, SPR_NOACCESS,
       
  5808                  &spr_read_ureg, SPR_NOACCESS,
       
  5809                  0x00000000);
       
  5810     spr_register(env, SPR_SPRG5, "SPRG5",
       
  5811                  SPR_NOACCESS, SPR_NOACCESS,
       
  5812                  &spr_read_generic, &spr_write_generic,
       
  5813                  0x00000000);
       
  5814     spr_register(env, SPR_USPRG5, "USPRG5",
       
  5815                  &spr_read_ureg, SPR_NOACCESS,
       
  5816                  &spr_read_ureg, SPR_NOACCESS,
       
  5817                  0x00000000);
       
  5818     spr_register(env, SPR_SPRG6, "SPRG6",
       
  5819                  SPR_NOACCESS, SPR_NOACCESS,
       
  5820                  &spr_read_generic, &spr_write_generic,
       
  5821                  0x00000000);
       
  5822     spr_register(env, SPR_USPRG6, "USPRG6",
       
  5823                  &spr_read_ureg, SPR_NOACCESS,
       
  5824                  &spr_read_ureg, SPR_NOACCESS,
       
  5825                  0x00000000);
       
  5826     spr_register(env, SPR_SPRG7, "SPRG7",
       
  5827                  SPR_NOACCESS, SPR_NOACCESS,
       
  5828                  &spr_read_generic, &spr_write_generic,
       
  5829                  0x00000000);
       
  5830     spr_register(env, SPR_USPRG7, "USPRG7",
       
  5831                  &spr_read_ureg, SPR_NOACCESS,
       
  5832                  &spr_read_ureg, SPR_NOACCESS,
       
  5833                  0x00000000);
       
  5834     /* Memory management */
       
  5835     gen_low_BATs(env);
       
  5836     gen_high_BATs(env);
       
  5837     gen_74xx_soft_tlb(env, 128, 2);
       
  5838     init_excp_7450(env);
       
  5839     env->dcache_line_size = 32;
       
  5840     env->icache_line_size = 32;
       
  5841     /* Allocate hardware IRQ controller */
       
  5842     ppc6xx_irq_init(env);
       
  5843 }
       
  5844 
       
  5845 #if defined (TARGET_PPC64)
       
  5846 /* PowerPC 970                                                               */
       
  5847 #define POWERPC_INSNS_970    (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  5848                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  5849                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  5850                               PPC_FLOAT_STFIWX |                              \
       
  5851                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZT |  \
       
  5852                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  5853                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  5854                               PPC_64B | PPC_ALTIVEC |                         \
       
  5855                               PPC_SEGMENT_64B | PPC_SLBI)
       
  5856 #define POWERPC_MSRM_970     (0x900000000204FF36ULL)
       
  5857 #define POWERPC_MMU_970      (POWERPC_MMU_64B)
       
  5858 //#define POWERPC_EXCP_970     (POWERPC_EXCP_970)
       
  5859 #define POWERPC_INPUT_970    (PPC_FLAGS_INPUT_970)
       
  5860 #define POWERPC_BFDM_970     (bfd_mach_ppc64)
       
  5861 #define POWERPC_FLAG_970     (POWERPC_FLAG_VRE | POWERPC_FLAG_SE |            \
       
  5862                               POWERPC_FLAG_BE | POWERPC_FLAG_PMM |            \
       
  5863                               POWERPC_FLAG_BUS_CLK)
       
  5864 
       
  5865 #if defined(CONFIG_USER_ONLY)
       
  5866 #define POWERPC970_HID5_INIT 0x00000080
       
  5867 #else
       
  5868 #define POWERPC970_HID5_INIT 0x00000000
       
  5869 #endif
       
  5870 
       
  5871 static int check_pow_970 (CPUPPCState *env)
       
  5872 {
       
  5873     if (env->spr[SPR_HID0] & 0x00600000)
       
  5874         return 1;
       
  5875 
       
  5876     return 0;
       
  5877 }
       
  5878 
       
  5879 static void init_proc_970 (CPUPPCState *env)
       
  5880 {
       
  5881     gen_spr_ne_601(env);
       
  5882     gen_spr_7xx(env);
       
  5883     /* Time base */
       
  5884     gen_tbl(env);
       
  5885     /* Hardware implementation registers */
       
  5886     /* XXX : not implemented */
       
  5887     spr_register(env, SPR_HID0, "HID0",
       
  5888                  SPR_NOACCESS, SPR_NOACCESS,
       
  5889                  &spr_read_generic, &spr_write_clear,
       
  5890                  0x60000000);
       
  5891     /* XXX : not implemented */
       
  5892     spr_register(env, SPR_HID1, "HID1",
       
  5893                  SPR_NOACCESS, SPR_NOACCESS,
       
  5894                  &spr_read_generic, &spr_write_generic,
       
  5895                  0x00000000);
       
  5896     /* XXX : not implemented */
       
  5897     spr_register(env, SPR_750FX_HID2, "HID2",
       
  5898                  SPR_NOACCESS, SPR_NOACCESS,
       
  5899                  &spr_read_generic, &spr_write_generic,
       
  5900                  0x00000000);
       
  5901     /* XXX : not implemented */
       
  5902     spr_register(env, SPR_970_HID5, "HID5",
       
  5903                  SPR_NOACCESS, SPR_NOACCESS,
       
  5904                  &spr_read_generic, &spr_write_generic,
       
  5905                  POWERPC970_HID5_INIT);
       
  5906     /* XXX : not implemented */
       
  5907     spr_register(env, SPR_L2CR, "L2CR",
       
  5908                  SPR_NOACCESS, SPR_NOACCESS,
       
  5909                  &spr_read_generic, &spr_write_generic,
       
  5910                  0x00000000);
       
  5911     /* Memory management */
       
  5912     /* XXX: not correct */
       
  5913     gen_low_BATs(env);
       
  5914     /* XXX : not implemented */
       
  5915     spr_register(env, SPR_MMUCFG, "MMUCFG",
       
  5916                  SPR_NOACCESS, SPR_NOACCESS,
       
  5917                  &spr_read_generic, SPR_NOACCESS,
       
  5918                  0x00000000); /* TOFIX */
       
  5919     /* XXX : not implemented */
       
  5920     spr_register(env, SPR_MMUCSR0, "MMUCSR0",
       
  5921                  SPR_NOACCESS, SPR_NOACCESS,
       
  5922                  &spr_read_generic, &spr_write_generic,
       
  5923                  0x00000000); /* TOFIX */
       
  5924     spr_register(env, SPR_HIOR, "SPR_HIOR",
       
  5925                  SPR_NOACCESS, SPR_NOACCESS,
       
  5926                  &spr_read_generic, &spr_write_generic,
       
  5927                  0xFFF00000); /* XXX: This is a hack */
       
  5928 #if !defined(CONFIG_USER_ONLY)
       
  5929     env->slb_nr = 32;
       
  5930 #endif
       
  5931     init_excp_970(env);
       
  5932     env->dcache_line_size = 128;
       
  5933     env->icache_line_size = 128;
       
  5934     /* Allocate hardware IRQ controller */
       
  5935     ppc970_irq_init(env);
       
  5936 }
       
  5937 
       
  5938 /* PowerPC 970FX (aka G5)                                                    */
       
  5939 #define POWERPC_INSNS_970FX  (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  5940                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  5941                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  5942                               PPC_FLOAT_STFIWX |                              \
       
  5943                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZT |  \
       
  5944                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  5945                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  5946                               PPC_64B | PPC_ALTIVEC |                         \
       
  5947                               PPC_SEGMENT_64B | PPC_SLBI)
       
  5948 #define POWERPC_MSRM_970FX   (0x800000000204FF36ULL)
       
  5949 #define POWERPC_MMU_970FX    (POWERPC_MMU_64B)
       
  5950 #define POWERPC_EXCP_970FX   (POWERPC_EXCP_970)
       
  5951 #define POWERPC_INPUT_970FX  (PPC_FLAGS_INPUT_970)
       
  5952 #define POWERPC_BFDM_970FX   (bfd_mach_ppc64)
       
  5953 #define POWERPC_FLAG_970FX   (POWERPC_FLAG_VRE | POWERPC_FLAG_SE |            \
       
  5954                               POWERPC_FLAG_BE | POWERPC_FLAG_PMM |            \
       
  5955                               POWERPC_FLAG_BUS_CLK)
       
  5956 
       
  5957 static int check_pow_970FX (CPUPPCState *env)
       
  5958 {
       
  5959     if (env->spr[SPR_HID0] & 0x00600000)
       
  5960         return 1;
       
  5961 
       
  5962     return 0;
       
  5963 }
       
  5964 
       
  5965 static void init_proc_970FX (CPUPPCState *env)
       
  5966 {
       
  5967     gen_spr_ne_601(env);
       
  5968     gen_spr_7xx(env);
       
  5969     /* Time base */
       
  5970     gen_tbl(env);
       
  5971     /* Hardware implementation registers */
       
  5972     /* XXX : not implemented */
       
  5973     spr_register(env, SPR_HID0, "HID0",
       
  5974                  SPR_NOACCESS, SPR_NOACCESS,
       
  5975                  &spr_read_generic, &spr_write_clear,
       
  5976                  0x60000000);
       
  5977     /* XXX : not implemented */
       
  5978     spr_register(env, SPR_HID1, "HID1",
       
  5979                  SPR_NOACCESS, SPR_NOACCESS,
       
  5980                  &spr_read_generic, &spr_write_generic,
       
  5981                  0x00000000);
       
  5982     /* XXX : not implemented */
       
  5983     spr_register(env, SPR_750FX_HID2, "HID2",
       
  5984                  SPR_NOACCESS, SPR_NOACCESS,
       
  5985                  &spr_read_generic, &spr_write_generic,
       
  5986                  0x00000000);
       
  5987     /* XXX : not implemented */
       
  5988     spr_register(env, SPR_970_HID5, "HID5",
       
  5989                  SPR_NOACCESS, SPR_NOACCESS,
       
  5990                  &spr_read_generic, &spr_write_generic,
       
  5991                  POWERPC970_HID5_INIT);
       
  5992     /* XXX : not implemented */
       
  5993     spr_register(env, SPR_L2CR, "L2CR",
       
  5994                  SPR_NOACCESS, SPR_NOACCESS,
       
  5995                  &spr_read_generic, &spr_write_generic,
       
  5996                  0x00000000);
       
  5997     /* Memory management */
       
  5998     /* XXX: not correct */
       
  5999     gen_low_BATs(env);
       
  6000     /* XXX : not implemented */
       
  6001     spr_register(env, SPR_MMUCFG, "MMUCFG",
       
  6002                  SPR_NOACCESS, SPR_NOACCESS,
       
  6003                  &spr_read_generic, SPR_NOACCESS,
       
  6004                  0x00000000); /* TOFIX */
       
  6005     /* XXX : not implemented */
       
  6006     spr_register(env, SPR_MMUCSR0, "MMUCSR0",
       
  6007                  SPR_NOACCESS, SPR_NOACCESS,
       
  6008                  &spr_read_generic, &spr_write_generic,
       
  6009                  0x00000000); /* TOFIX */
       
  6010     spr_register(env, SPR_HIOR, "SPR_HIOR",
       
  6011                  SPR_NOACCESS, SPR_NOACCESS,
       
  6012                  &spr_read_generic, &spr_write_generic,
       
  6013                  0xFFF00000); /* XXX: This is a hack */
       
  6014 #if !defined(CONFIG_USER_ONLY)
       
  6015     env->slb_nr = 32;
       
  6016 #endif
       
  6017     init_excp_970(env);
       
  6018     env->dcache_line_size = 128;
       
  6019     env->icache_line_size = 128;
       
  6020     /* Allocate hardware IRQ controller */
       
  6021     ppc970_irq_init(env);
       
  6022 }
       
  6023 
       
  6024 /* PowerPC 970 GX                                                            */
       
  6025 #define POWERPC_INSNS_970GX  (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  6026                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  6027                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  6028                               PPC_FLOAT_STFIWX |                              \
       
  6029                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZT |  \
       
  6030                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  6031                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  6032                               PPC_64B | PPC_ALTIVEC |                         \
       
  6033                               PPC_SEGMENT_64B | PPC_SLBI)
       
  6034 #define POWERPC_MSRM_970GX   (0x800000000204FF36ULL)
       
  6035 #define POWERPC_MMU_970GX    (POWERPC_MMU_64B)
       
  6036 #define POWERPC_EXCP_970GX   (POWERPC_EXCP_970)
       
  6037 #define POWERPC_INPUT_970GX  (PPC_FLAGS_INPUT_970)
       
  6038 #define POWERPC_BFDM_970GX   (bfd_mach_ppc64)
       
  6039 #define POWERPC_FLAG_970GX   (POWERPC_FLAG_VRE | POWERPC_FLAG_SE |            \
       
  6040                               POWERPC_FLAG_BE | POWERPC_FLAG_PMM |            \
       
  6041                               POWERPC_FLAG_BUS_CLK)
       
  6042 
       
  6043 static int check_pow_970GX (CPUPPCState *env)
       
  6044 {
       
  6045     if (env->spr[SPR_HID0] & 0x00600000)
       
  6046         return 1;
       
  6047 
       
  6048     return 0;
       
  6049 }
       
  6050 
       
  6051 static void init_proc_970GX (CPUPPCState *env)
       
  6052 {
       
  6053     gen_spr_ne_601(env);
       
  6054     gen_spr_7xx(env);
       
  6055     /* Time base */
       
  6056     gen_tbl(env);
       
  6057     /* Hardware implementation registers */
       
  6058     /* XXX : not implemented */
       
  6059     spr_register(env, SPR_HID0, "HID0",
       
  6060                  SPR_NOACCESS, SPR_NOACCESS,
       
  6061                  &spr_read_generic, &spr_write_clear,
       
  6062                  0x60000000);
       
  6063     /* XXX : not implemented */
       
  6064     spr_register(env, SPR_HID1, "HID1",
       
  6065                  SPR_NOACCESS, SPR_NOACCESS,
       
  6066                  &spr_read_generic, &spr_write_generic,
       
  6067                  0x00000000);
       
  6068     /* XXX : not implemented */
       
  6069     spr_register(env, SPR_750FX_HID2, "HID2",
       
  6070                  SPR_NOACCESS, SPR_NOACCESS,
       
  6071                  &spr_read_generic, &spr_write_generic,
       
  6072                  0x00000000);
       
  6073     /* XXX : not implemented */
       
  6074     spr_register(env, SPR_970_HID5, "HID5",
       
  6075                  SPR_NOACCESS, SPR_NOACCESS,
       
  6076                  &spr_read_generic, &spr_write_generic,
       
  6077                  POWERPC970_HID5_INIT);
       
  6078     /* XXX : not implemented */
       
  6079     spr_register(env, SPR_L2CR, "L2CR",
       
  6080                  SPR_NOACCESS, SPR_NOACCESS,
       
  6081                  &spr_read_generic, &spr_write_generic,
       
  6082                  0x00000000);
       
  6083     /* Memory management */
       
  6084     /* XXX: not correct */
       
  6085     gen_low_BATs(env);
       
  6086     /* XXX : not implemented */
       
  6087     spr_register(env, SPR_MMUCFG, "MMUCFG",
       
  6088                  SPR_NOACCESS, SPR_NOACCESS,
       
  6089                  &spr_read_generic, SPR_NOACCESS,
       
  6090                  0x00000000); /* TOFIX */
       
  6091     /* XXX : not implemented */
       
  6092     spr_register(env, SPR_MMUCSR0, "MMUCSR0",
       
  6093                  SPR_NOACCESS, SPR_NOACCESS,
       
  6094                  &spr_read_generic, &spr_write_generic,
       
  6095                  0x00000000); /* TOFIX */
       
  6096     spr_register(env, SPR_HIOR, "SPR_HIOR",
       
  6097                  SPR_NOACCESS, SPR_NOACCESS,
       
  6098                  &spr_read_generic, &spr_write_generic,
       
  6099                  0xFFF00000); /* XXX: This is a hack */
       
  6100 #if !defined(CONFIG_USER_ONLY)
       
  6101     env->slb_nr = 32;
       
  6102 #endif
       
  6103     init_excp_970(env);
       
  6104     env->dcache_line_size = 128;
       
  6105     env->icache_line_size = 128;
       
  6106     /* Allocate hardware IRQ controller */
       
  6107     ppc970_irq_init(env);
       
  6108 }
       
  6109 
       
  6110 /* PowerPC 970 MP                                                            */
       
  6111 #define POWERPC_INSNS_970MP  (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  6112                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  6113                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  6114                               PPC_FLOAT_STFIWX |                              \
       
  6115                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZT |  \
       
  6116                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  6117                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  6118                               PPC_64B | PPC_ALTIVEC |                         \
       
  6119                               PPC_SEGMENT_64B | PPC_SLBI)
       
  6120 #define POWERPC_MSRM_970MP   (0x900000000204FF36ULL)
       
  6121 #define POWERPC_MMU_970MP    (POWERPC_MMU_64B)
       
  6122 #define POWERPC_EXCP_970MP   (POWERPC_EXCP_970)
       
  6123 #define POWERPC_INPUT_970MP  (PPC_FLAGS_INPUT_970)
       
  6124 #define POWERPC_BFDM_970MP   (bfd_mach_ppc64)
       
  6125 #define POWERPC_FLAG_970MP   (POWERPC_FLAG_VRE | POWERPC_FLAG_SE |            \
       
  6126                               POWERPC_FLAG_BE | POWERPC_FLAG_PMM |            \
       
  6127                               POWERPC_FLAG_BUS_CLK)
       
  6128 
       
  6129 static int check_pow_970MP (CPUPPCState *env)
       
  6130 {
       
  6131     if (env->spr[SPR_HID0] & 0x01C00000)
       
  6132         return 1;
       
  6133 
       
  6134     return 0;
       
  6135 }
       
  6136 
       
  6137 static void init_proc_970MP (CPUPPCState *env)
       
  6138 {
       
  6139     gen_spr_ne_601(env);
       
  6140     gen_spr_7xx(env);
       
  6141     /* Time base */
       
  6142     gen_tbl(env);
       
  6143     /* Hardware implementation registers */
       
  6144     /* XXX : not implemented */
       
  6145     spr_register(env, SPR_HID0, "HID0",
       
  6146                  SPR_NOACCESS, SPR_NOACCESS,
       
  6147                  &spr_read_generic, &spr_write_clear,
       
  6148                  0x60000000);
       
  6149     /* XXX : not implemented */
       
  6150     spr_register(env, SPR_HID1, "HID1",
       
  6151                  SPR_NOACCESS, SPR_NOACCESS,
       
  6152                  &spr_read_generic, &spr_write_generic,
       
  6153                  0x00000000);
       
  6154     /* XXX : not implemented */
       
  6155     spr_register(env, SPR_750FX_HID2, "HID2",
       
  6156                  SPR_NOACCESS, SPR_NOACCESS,
       
  6157                  &spr_read_generic, &spr_write_generic,
       
  6158                  0x00000000);
       
  6159     /* XXX : not implemented */
       
  6160     spr_register(env, SPR_970_HID5, "HID5",
       
  6161                  SPR_NOACCESS, SPR_NOACCESS,
       
  6162                  &spr_read_generic, &spr_write_generic,
       
  6163                  POWERPC970_HID5_INIT);
       
  6164     /* XXX : not implemented */
       
  6165     spr_register(env, SPR_L2CR, "L2CR",
       
  6166                  SPR_NOACCESS, SPR_NOACCESS,
       
  6167                  &spr_read_generic, &spr_write_generic,
       
  6168                  0x00000000);
       
  6169     /* Memory management */
       
  6170     /* XXX: not correct */
       
  6171     gen_low_BATs(env);
       
  6172     /* XXX : not implemented */
       
  6173     spr_register(env, SPR_MMUCFG, "MMUCFG",
       
  6174                  SPR_NOACCESS, SPR_NOACCESS,
       
  6175                  &spr_read_generic, SPR_NOACCESS,
       
  6176                  0x00000000); /* TOFIX */
       
  6177     /* XXX : not implemented */
       
  6178     spr_register(env, SPR_MMUCSR0, "MMUCSR0",
       
  6179                  SPR_NOACCESS, SPR_NOACCESS,
       
  6180                  &spr_read_generic, &spr_write_generic,
       
  6181                  0x00000000); /* TOFIX */
       
  6182     spr_register(env, SPR_HIOR, "SPR_HIOR",
       
  6183                  SPR_NOACCESS, SPR_NOACCESS,
       
  6184                  &spr_read_generic, &spr_write_generic,
       
  6185                  0xFFF00000); /* XXX: This is a hack */
       
  6186 #if !defined(CONFIG_USER_ONLY)
       
  6187     env->slb_nr = 32;
       
  6188 #endif
       
  6189     init_excp_970(env);
       
  6190     env->dcache_line_size = 128;
       
  6191     env->icache_line_size = 128;
       
  6192     /* Allocate hardware IRQ controller */
       
  6193     ppc970_irq_init(env);
       
  6194 }
       
  6195 
       
  6196 /* PowerPC 620                                                               */
       
  6197 #define POWERPC_INSNS_620    (PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |        \
       
  6198                               PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |   \
       
  6199                               PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |           \
       
  6200                               PPC_FLOAT_STFIWX |                              \
       
  6201                               PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |   \
       
  6202                               PPC_MEM_SYNC | PPC_MEM_EIEIO |                  \
       
  6203                               PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |               \
       
  6204                               PPC_SEGMENT | PPC_EXTERN |                      \
       
  6205                               PPC_64B | PPC_SLBI)
       
  6206 #define POWERPC_MSRM_620     (0x800000000005FF77ULL)
       
  6207 //#define POWERPC_MMU_620      (POWERPC_MMU_620)
       
  6208 #define POWERPC_EXCP_620     (POWERPC_EXCP_970)
       
  6209 #define POWERPC_INPUT_620    (PPC_FLAGS_INPUT_6xx)
       
  6210 #define POWERPC_BFDM_620     (bfd_mach_ppc64)
       
  6211 #define POWERPC_FLAG_620     (POWERPC_FLAG_SE | POWERPC_FLAG_BE |            \
       
  6212                               POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
       
  6213 #define check_pow_620        check_pow_nocheck /* Check this */
       
  6214 
       
  6215 __attribute__ (( unused ))
       
  6216 static void init_proc_620 (CPUPPCState *env)
       
  6217 {
       
  6218     gen_spr_ne_601(env);
       
  6219     gen_spr_620(env);
       
  6220     /* Time base */
       
  6221     gen_tbl(env);
       
  6222     /* Hardware implementation registers */
       
  6223     /* XXX : not implemented */
       
  6224     spr_register(env, SPR_HID0, "HID0",
       
  6225                  SPR_NOACCESS, SPR_NOACCESS,
       
  6226                  &spr_read_generic, &spr_write_generic,
       
  6227                  0x00000000);
       
  6228     /* Memory management */
       
  6229     gen_low_BATs(env);
       
  6230     init_excp_620(env);
       
  6231     env->dcache_line_size = 64;
       
  6232     env->icache_line_size = 64;
       
  6233     /* Allocate hardware IRQ controller */
       
  6234     ppc6xx_irq_init(env);
       
  6235 }
       
  6236 #endif /* defined (TARGET_PPC64) */
       
  6237 
       
  6238 /* Default 32 bits PowerPC target will be 604 */
       
  6239 #define CPU_POWERPC_PPC32     CPU_POWERPC_604
       
  6240 #define POWERPC_INSNS_PPC32   POWERPC_INSNS_604
       
  6241 #define POWERPC_MSRM_PPC32    POWERPC_MSRM_604
       
  6242 #define POWERPC_MMU_PPC32     POWERPC_MMU_604
       
  6243 #define POWERPC_EXCP_PPC32    POWERPC_EXCP_604
       
  6244 #define POWERPC_INPUT_PPC32   POWERPC_INPUT_604
       
  6245 #define POWERPC_BFDM_PPC32    POWERPC_BFDM_604
       
  6246 #define POWERPC_FLAG_PPC32    POWERPC_FLAG_604
       
  6247 #define check_pow_PPC32       check_pow_604
       
  6248 #define init_proc_PPC32       init_proc_604
       
  6249 
       
  6250 /* Default 64 bits PowerPC target will be 970 FX */
       
  6251 #define CPU_POWERPC_PPC64     CPU_POWERPC_970FX
       
  6252 #define POWERPC_INSNS_PPC64   POWERPC_INSNS_970FX
       
  6253 #define POWERPC_MSRM_PPC64    POWERPC_MSRM_970FX
       
  6254 #define POWERPC_MMU_PPC64     POWERPC_MMU_970FX
       
  6255 #define POWERPC_EXCP_PPC64    POWERPC_EXCP_970FX
       
  6256 #define POWERPC_INPUT_PPC64   POWERPC_INPUT_970FX
       
  6257 #define POWERPC_BFDM_PPC64    POWERPC_BFDM_970FX
       
  6258 #define POWERPC_FLAG_PPC64    POWERPC_FLAG_970FX
       
  6259 #define check_pow_PPC64       check_pow_970FX
       
  6260 #define init_proc_PPC64       init_proc_970FX
       
  6261 
       
  6262 /* Default PowerPC target will be PowerPC 32 */
       
  6263 #if defined (TARGET_PPC64) && 0 // XXX: TODO
       
  6264 #define CPU_POWERPC_DEFAULT   CPU_POWERPC_PPC64
       
  6265 #define POWERPC_INSNS_DEFAULT POWERPC_INSNS_PPC64
       
  6266 #define POWERPC_MSRM_DEFAULT  POWERPC_MSRM_PPC64
       
  6267 #define POWERPC_MMU_DEFAULT   POWERPC_MMU_PPC64
       
  6268 #define POWERPC_EXCP_DEFAULT  POWERPC_EXCP_PPC64
       
  6269 #define POWERPC_INPUT_DEFAULT POWERPC_INPUT_PPC64
       
  6270 #define POWERPC_BFDM_DEFAULT  POWERPC_BFDM_PPC64
       
  6271 #define POWERPC_FLAG_DEFAULT  POWERPC_FLAG_PPC64
       
  6272 #define check_pow_DEFAULT     check_pow_PPC64
       
  6273 #define init_proc_DEFAULT     init_proc_PPC64
       
  6274 #else
       
  6275 #define CPU_POWERPC_DEFAULT   CPU_POWERPC_PPC32
       
  6276 #define POWERPC_INSNS_DEFAULT POWERPC_INSNS_PPC32
       
  6277 #define POWERPC_MSRM_DEFAULT  POWERPC_MSRM_PPC32
       
  6278 #define POWERPC_MMU_DEFAULT   POWERPC_MMU_PPC32
       
  6279 #define POWERPC_EXCP_DEFAULT  POWERPC_EXCP_PPC32
       
  6280 #define POWERPC_INPUT_DEFAULT POWERPC_INPUT_PPC32
       
  6281 #define POWERPC_BFDM_DEFAULT  POWERPC_BFDM_PPC32
       
  6282 #define POWERPC_FLAG_DEFAULT  POWERPC_FLAG_PPC32
       
  6283 #define check_pow_DEFAULT     check_pow_PPC32
       
  6284 #define init_proc_DEFAULT     init_proc_PPC32
       
  6285 #endif
       
  6286 
       
  6287 /*****************************************************************************/
       
  6288 /* PVR definitions for most known PowerPC                                    */
       
  6289 enum {
       
  6290     /* PowerPC 401 family */
       
  6291     /* Generic PowerPC 401 */
       
  6292 #define CPU_POWERPC_401              CPU_POWERPC_401G2
       
  6293     /* PowerPC 401 cores */
       
  6294     CPU_POWERPC_401A1              = 0x00210000,
       
  6295     CPU_POWERPC_401B2              = 0x00220000,
       
  6296 #if 0
       
  6297     CPU_POWERPC_401B3              = xxx,
       
  6298 #endif
       
  6299     CPU_POWERPC_401C2              = 0x00230000,
       
  6300     CPU_POWERPC_401D2              = 0x00240000,
       
  6301     CPU_POWERPC_401E2              = 0x00250000,
       
  6302     CPU_POWERPC_401F2              = 0x00260000,
       
  6303     CPU_POWERPC_401G2              = 0x00270000,
       
  6304     /* PowerPC 401 microcontrolers */
       
  6305 #if 0
       
  6306     CPU_POWERPC_401GF              = xxx,
       
  6307 #endif
       
  6308 #define CPU_POWERPC_IOP480           CPU_POWERPC_401B2
       
  6309     /* IBM Processor for Network Resources */
       
  6310     CPU_POWERPC_COBRA              = 0x10100000, /* XXX: 405 ? */
       
  6311 #if 0
       
  6312     CPU_POWERPC_XIPCHIP            = xxx,
       
  6313 #endif
       
  6314     /* PowerPC 403 family */
       
  6315     /* Generic PowerPC 403 */
       
  6316 #define CPU_POWERPC_403              CPU_POWERPC_403GC
       
  6317     /* PowerPC 403 microcontrollers */
       
  6318     CPU_POWERPC_403GA              = 0x00200011,
       
  6319     CPU_POWERPC_403GB              = 0x00200100,
       
  6320     CPU_POWERPC_403GC              = 0x00200200,
       
  6321     CPU_POWERPC_403GCX             = 0x00201400,
       
  6322 #if 0
       
  6323     CPU_POWERPC_403GP              = xxx,
       
  6324 #endif
       
  6325     /* PowerPC 405 family */
       
  6326     /* Generic PowerPC 405 */
       
  6327 #define CPU_POWERPC_405              CPU_POWERPC_405D4
       
  6328     /* PowerPC 405 cores */
       
  6329 #if 0
       
  6330     CPU_POWERPC_405A3              = xxx,
       
  6331 #endif
       
  6332 #if 0
       
  6333     CPU_POWERPC_405A4              = xxx,
       
  6334 #endif
       
  6335 #if 0
       
  6336     CPU_POWERPC_405B3              = xxx,
       
  6337 #endif
       
  6338 #if 0
       
  6339     CPU_POWERPC_405B4              = xxx,
       
  6340 #endif
       
  6341 #if 0
       
  6342     CPU_POWERPC_405C3              = xxx,
       
  6343 #endif
       
  6344 #if 0
       
  6345     CPU_POWERPC_405C4              = xxx,
       
  6346 #endif
       
  6347     CPU_POWERPC_405D2              = 0x20010000,
       
  6348 #if 0
       
  6349     CPU_POWERPC_405D3              = xxx,
       
  6350 #endif
       
  6351     CPU_POWERPC_405D4              = 0x41810000,
       
  6352 #if 0
       
  6353     CPU_POWERPC_405D5              = xxx,
       
  6354 #endif
       
  6355 #if 0
       
  6356     CPU_POWERPC_405E4              = xxx,
       
  6357 #endif
       
  6358 #if 0
       
  6359     CPU_POWERPC_405F4              = xxx,
       
  6360 #endif
       
  6361 #if 0
       
  6362     CPU_POWERPC_405F5              = xxx,
       
  6363 #endif
       
  6364 #if 0
       
  6365     CPU_POWERPC_405F6              = xxx,
       
  6366 #endif
       
  6367     /* PowerPC 405 microcontrolers */
       
  6368     /* XXX: missing 0x200108a0 */
       
  6369 #define CPU_POWERPC_405CR            CPU_POWERPC_405CRc
       
  6370     CPU_POWERPC_405CRa             = 0x40110041,
       
  6371     CPU_POWERPC_405CRb             = 0x401100C5,
       
  6372     CPU_POWERPC_405CRc             = 0x40110145,
       
  6373     CPU_POWERPC_405EP              = 0x51210950,
       
  6374 #if 0
       
  6375     CPU_POWERPC_405EXr             = xxx,
       
  6376 #endif
       
  6377     CPU_POWERPC_405EZ              = 0x41511460, /* 0x51210950 ? */
       
  6378 #if 0
       
  6379     CPU_POWERPC_405FX              = xxx,
       
  6380 #endif
       
  6381 #define CPU_POWERPC_405GP            CPU_POWERPC_405GPd
       
  6382     CPU_POWERPC_405GPa             = 0x40110000,
       
  6383     CPU_POWERPC_405GPb             = 0x40110040,
       
  6384     CPU_POWERPC_405GPc             = 0x40110082,
       
  6385     CPU_POWERPC_405GPd             = 0x401100C4,
       
  6386 #define CPU_POWERPC_405GPe           CPU_POWERPC_405CRc
       
  6387     CPU_POWERPC_405GPR             = 0x50910951,
       
  6388 #if 0
       
  6389     CPU_POWERPC_405H               = xxx,
       
  6390 #endif
       
  6391 #if 0
       
  6392     CPU_POWERPC_405L               = xxx,
       
  6393 #endif
       
  6394     CPU_POWERPC_405LP              = 0x41F10000,
       
  6395 #if 0
       
  6396     CPU_POWERPC_405PM              = xxx,
       
  6397 #endif
       
  6398 #if 0
       
  6399     CPU_POWERPC_405PS              = xxx,
       
  6400 #endif
       
  6401 #if 0
       
  6402     CPU_POWERPC_405S               = xxx,
       
  6403 #endif
       
  6404     /* IBM network processors */
       
  6405     CPU_POWERPC_NPE405H            = 0x414100C0,
       
  6406     CPU_POWERPC_NPE405H2           = 0x41410140,
       
  6407     CPU_POWERPC_NPE405L            = 0x416100C0,
       
  6408     CPU_POWERPC_NPE4GS3            = 0x40B10000,
       
  6409 #if 0
       
  6410     CPU_POWERPC_NPCxx1             = xxx,
       
  6411 #endif
       
  6412 #if 0
       
  6413     CPU_POWERPC_NPR161             = xxx,
       
  6414 #endif
       
  6415 #if 0
       
  6416     CPU_POWERPC_LC77700            = xxx,
       
  6417 #endif
       
  6418     /* IBM STBxxx (PowerPC 401/403/405 core based microcontrollers) */
       
  6419 #if 0
       
  6420     CPU_POWERPC_STB01000           = xxx,
       
  6421 #endif
       
  6422 #if 0
       
  6423     CPU_POWERPC_STB01010           = xxx,
       
  6424 #endif
       
  6425 #if 0
       
  6426     CPU_POWERPC_STB0210            = xxx, /* 401B3 */
       
  6427 #endif
       
  6428     CPU_POWERPC_STB03              = 0x40310000, /* 0x40130000 ? */
       
  6429 #if 0
       
  6430     CPU_POWERPC_STB043             = xxx,
       
  6431 #endif
       
  6432 #if 0
       
  6433     CPU_POWERPC_STB045             = xxx,
       
  6434 #endif
       
  6435     CPU_POWERPC_STB04              = 0x41810000,
       
  6436     CPU_POWERPC_STB25              = 0x51510950,
       
  6437 #if 0
       
  6438     CPU_POWERPC_STB130             = xxx,
       
  6439 #endif
       
  6440     /* Xilinx cores */
       
  6441     CPU_POWERPC_X2VP4              = 0x20010820,
       
  6442 #define CPU_POWERPC_X2VP7            CPU_POWERPC_X2VP4
       
  6443     CPU_POWERPC_X2VP20             = 0x20010860,
       
  6444 #define CPU_POWERPC_X2VP50           CPU_POWERPC_X2VP20
       
  6445 #if 0
       
  6446     CPU_POWERPC_ZL10310            = xxx,
       
  6447 #endif
       
  6448 #if 0
       
  6449     CPU_POWERPC_ZL10311            = xxx,
       
  6450 #endif
       
  6451 #if 0
       
  6452     CPU_POWERPC_ZL10320            = xxx,
       
  6453 #endif
       
  6454 #if 0
       
  6455     CPU_POWERPC_ZL10321            = xxx,
       
  6456 #endif
       
  6457     /* PowerPC 440 family */
       
  6458     /* Generic PowerPC 440 */
       
  6459 #define CPU_POWERPC_440              CPU_POWERPC_440GXf
       
  6460     /* PowerPC 440 cores */
       
  6461 #if 0
       
  6462     CPU_POWERPC_440A4              = xxx,
       
  6463 #endif
       
  6464 #if 0
       
  6465     CPU_POWERPC_440A5              = xxx,
       
  6466 #endif
       
  6467 #if 0
       
  6468     CPU_POWERPC_440B4              = xxx,
       
  6469 #endif
       
  6470 #if 0
       
  6471     CPU_POWERPC_440F5              = xxx,
       
  6472 #endif
       
  6473 #if 0
       
  6474     CPU_POWERPC_440G5              = xxx,
       
  6475 #endif
       
  6476 #if 0
       
  6477     CPU_POWERPC_440H4              = xxx,
       
  6478 #endif
       
  6479 #if 0
       
  6480     CPU_POWERPC_440H6              = xxx,
       
  6481 #endif
       
  6482     /* PowerPC 440 microcontrolers */
       
  6483 #define CPU_POWERPC_440EP            CPU_POWERPC_440EPb
       
  6484     CPU_POWERPC_440EPa             = 0x42221850,
       
  6485     CPU_POWERPC_440EPb             = 0x422218D3,
       
  6486 #define CPU_POWERPC_440GP            CPU_POWERPC_440GPc
       
  6487     CPU_POWERPC_440GPb             = 0x40120440,
       
  6488     CPU_POWERPC_440GPc             = 0x40120481,
       
  6489 #define CPU_POWERPC_440GR            CPU_POWERPC_440GRa
       
  6490 #define CPU_POWERPC_440GRa           CPU_POWERPC_440EPb
       
  6491     CPU_POWERPC_440GRX             = 0x200008D0,
       
  6492 #define CPU_POWERPC_440EPX           CPU_POWERPC_440GRX
       
  6493 #define CPU_POWERPC_440GX            CPU_POWERPC_440GXf
       
  6494     CPU_POWERPC_440GXa             = 0x51B21850,
       
  6495     CPU_POWERPC_440GXb             = 0x51B21851,
       
  6496     CPU_POWERPC_440GXc             = 0x51B21892,
       
  6497     CPU_POWERPC_440GXf             = 0x51B21894,
       
  6498 #if 0
       
  6499     CPU_POWERPC_440S               = xxx,
       
  6500 #endif
       
  6501     CPU_POWERPC_440SP              = 0x53221850,
       
  6502     CPU_POWERPC_440SP2             = 0x53221891,
       
  6503     CPU_POWERPC_440SPE             = 0x53421890,
       
  6504     /* PowerPC 460 family */
       
  6505 #if 0
       
  6506     /* Generic PowerPC 464 */
       
  6507 #define CPU_POWERPC_464              CPU_POWERPC_464H90
       
  6508 #endif
       
  6509     /* PowerPC 464 microcontrolers */
       
  6510 #if 0
       
  6511     CPU_POWERPC_464H90             = xxx,
       
  6512 #endif
       
  6513 #if 0
       
  6514     CPU_POWERPC_464H90FP           = xxx,
       
  6515 #endif
       
  6516     /* Freescale embedded PowerPC cores */
       
  6517     /* PowerPC MPC 5xx cores (aka RCPU) */
       
  6518     CPU_POWERPC_MPC5xx             = 0x00020020,
       
  6519 #define CPU_POWERPC_MGT560           CPU_POWERPC_MPC5xx
       
  6520 #define CPU_POWERPC_MPC509           CPU_POWERPC_MPC5xx
       
  6521 #define CPU_POWERPC_MPC533           CPU_POWERPC_MPC5xx
       
  6522 #define CPU_POWERPC_MPC534           CPU_POWERPC_MPC5xx
       
  6523 #define CPU_POWERPC_MPC555           CPU_POWERPC_MPC5xx
       
  6524 #define CPU_POWERPC_MPC556           CPU_POWERPC_MPC5xx
       
  6525 #define CPU_POWERPC_MPC560           CPU_POWERPC_MPC5xx
       
  6526 #define CPU_POWERPC_MPC561           CPU_POWERPC_MPC5xx
       
  6527 #define CPU_POWERPC_MPC562           CPU_POWERPC_MPC5xx
       
  6528 #define CPU_POWERPC_MPC563           CPU_POWERPC_MPC5xx
       
  6529 #define CPU_POWERPC_MPC564           CPU_POWERPC_MPC5xx
       
  6530 #define CPU_POWERPC_MPC565           CPU_POWERPC_MPC5xx
       
  6531 #define CPU_POWERPC_MPC566           CPU_POWERPC_MPC5xx
       
  6532     /* PowerPC MPC 8xx cores (aka PowerQUICC) */
       
  6533     CPU_POWERPC_MPC8xx             = 0x00500000,
       
  6534 #define CPU_POWERPC_MGT823           CPU_POWERPC_MPC8xx
       
  6535 #define CPU_POWERPC_MPC821           CPU_POWERPC_MPC8xx
       
  6536 #define CPU_POWERPC_MPC823           CPU_POWERPC_MPC8xx
       
  6537 #define CPU_POWERPC_MPC850           CPU_POWERPC_MPC8xx
       
  6538 #define CPU_POWERPC_MPC852T          CPU_POWERPC_MPC8xx
       
  6539 #define CPU_POWERPC_MPC855T          CPU_POWERPC_MPC8xx
       
  6540 #define CPU_POWERPC_MPC857           CPU_POWERPC_MPC8xx
       
  6541 #define CPU_POWERPC_MPC859           CPU_POWERPC_MPC8xx
       
  6542 #define CPU_POWERPC_MPC860           CPU_POWERPC_MPC8xx
       
  6543 #define CPU_POWERPC_MPC862           CPU_POWERPC_MPC8xx
       
  6544 #define CPU_POWERPC_MPC866           CPU_POWERPC_MPC8xx
       
  6545 #define CPU_POWERPC_MPC870           CPU_POWERPC_MPC8xx
       
  6546 #define CPU_POWERPC_MPC875           CPU_POWERPC_MPC8xx
       
  6547 #define CPU_POWERPC_MPC880           CPU_POWERPC_MPC8xx
       
  6548 #define CPU_POWERPC_MPC885           CPU_POWERPC_MPC8xx
       
  6549     /* G2 cores (aka PowerQUICC-II) */
       
  6550     CPU_POWERPC_G2                 = 0x00810011,
       
  6551     CPU_POWERPC_G2H4               = 0x80811010,
       
  6552     CPU_POWERPC_G2gp               = 0x80821010,
       
  6553     CPU_POWERPC_G2ls               = 0x90810010,
       
  6554     CPU_POWERPC_MPC603             = 0x00810100,
       
  6555     CPU_POWERPC_G2_HIP3            = 0x00810101,
       
  6556     CPU_POWERPC_G2_HIP4            = 0x80811014,
       
  6557     /*   G2_LE core (aka PowerQUICC-II) */
       
  6558     CPU_POWERPC_G2LE               = 0x80820010,
       
  6559     CPU_POWERPC_G2LEgp             = 0x80822010,
       
  6560     CPU_POWERPC_G2LEls             = 0xA0822010,
       
  6561     CPU_POWERPC_G2LEgp1            = 0x80822011,
       
  6562     CPU_POWERPC_G2LEgp3            = 0x80822013,
       
  6563     /* MPC52xx microcontrollers  */
       
  6564     /* XXX: MPC 5121 ? */
       
  6565 #define CPU_POWERPC_MPC52xx          CPU_POWERPC_MPC5200
       
  6566 #define CPU_POWERPC_MPC5200          CPU_POWERPC_MPC5200_v12
       
  6567 #define CPU_POWERPC_MPC5200_v10      CPU_POWERPC_G2LEgp1
       
  6568 #define CPU_POWERPC_MPC5200_v11      CPU_POWERPC_G2LEgp1
       
  6569 #define CPU_POWERPC_MPC5200_v12      CPU_POWERPC_G2LEgp1
       
  6570 #define CPU_POWERPC_MPC5200B         CPU_POWERPC_MPC5200B_v21
       
  6571 #define CPU_POWERPC_MPC5200B_v20     CPU_POWERPC_G2LEgp1
       
  6572 #define CPU_POWERPC_MPC5200B_v21     CPU_POWERPC_G2LEgp1
       
  6573     /* MPC82xx microcontrollers */
       
  6574 #define CPU_POWERPC_MPC82xx          CPU_POWERPC_MPC8280
       
  6575 #define CPU_POWERPC_MPC8240          CPU_POWERPC_MPC603
       
  6576 #define CPU_POWERPC_MPC8241          CPU_POWERPC_G2_HIP4
       
  6577 #define CPU_POWERPC_MPC8245          CPU_POWERPC_G2_HIP4
       
  6578 #define CPU_POWERPC_MPC8247          CPU_POWERPC_G2LEgp3
       
  6579 #define CPU_POWERPC_MPC8248          CPU_POWERPC_G2LEgp3
       
  6580 #define CPU_POWERPC_MPC8250          CPU_POWERPC_MPC8250_HiP4
       
  6581 #define CPU_POWERPC_MPC8250_HiP3     CPU_POWERPC_G2_HIP3
       
  6582 #define CPU_POWERPC_MPC8250_HiP4     CPU_POWERPC_G2_HIP4
       
  6583 #define CPU_POWERPC_MPC8255          CPU_POWERPC_MPC8255_HiP4
       
  6584 #define CPU_POWERPC_MPC8255_HiP3     CPU_POWERPC_G2_HIP3
       
  6585 #define CPU_POWERPC_MPC8255_HiP4     CPU_POWERPC_G2_HIP4
       
  6586 #define CPU_POWERPC_MPC8260          CPU_POWERPC_MPC8260_HiP4
       
  6587 #define CPU_POWERPC_MPC8260_HiP3     CPU_POWERPC_G2_HIP3
       
  6588 #define CPU_POWERPC_MPC8260_HiP4     CPU_POWERPC_G2_HIP4
       
  6589 #define CPU_POWERPC_MPC8264          CPU_POWERPC_MPC8264_HiP4
       
  6590 #define CPU_POWERPC_MPC8264_HiP3     CPU_POWERPC_G2_HIP3
       
  6591 #define CPU_POWERPC_MPC8264_HiP4     CPU_POWERPC_G2_HIP4
       
  6592 #define CPU_POWERPC_MPC8265          CPU_POWERPC_MPC8265_HiP4
       
  6593 #define CPU_POWERPC_MPC8265_HiP3     CPU_POWERPC_G2_HIP3
       
  6594 #define CPU_POWERPC_MPC8265_HiP4     CPU_POWERPC_G2_HIP4
       
  6595 #define CPU_POWERPC_MPC8266          CPU_POWERPC_MPC8266_HiP4
       
  6596 #define CPU_POWERPC_MPC8266_HiP3     CPU_POWERPC_G2_HIP3
       
  6597 #define CPU_POWERPC_MPC8266_HiP4     CPU_POWERPC_G2_HIP4
       
  6598 #define CPU_POWERPC_MPC8270          CPU_POWERPC_G2LEgp3
       
  6599 #define CPU_POWERPC_MPC8271          CPU_POWERPC_G2LEgp3
       
  6600 #define CPU_POWERPC_MPC8272          CPU_POWERPC_G2LEgp3
       
  6601 #define CPU_POWERPC_MPC8275          CPU_POWERPC_G2LEgp3
       
  6602 #define CPU_POWERPC_MPC8280          CPU_POWERPC_G2LEgp3
       
  6603     /* e200 family */
       
  6604     /* e200 cores */
       
  6605 #define CPU_POWERPC_e200             CPU_POWERPC_e200z6
       
  6606 #if 0
       
  6607     CPU_POWERPC_e200z0             = xxx,
       
  6608 #endif
       
  6609 #if 0
       
  6610     CPU_POWERPC_e200z1             = xxx,
       
  6611 #endif
       
  6612 #if 0 /* ? */
       
  6613     CPU_POWERPC_e200z3             = 0x81120000,
       
  6614 #endif
       
  6615     CPU_POWERPC_e200z5             = 0x81000000,
       
  6616     CPU_POWERPC_e200z6             = 0x81120000,
       
  6617     /* MPC55xx microcontrollers */
       
  6618 #define CPU_POWERPC_MPC55xx          CPU_POWERPC_MPC5567
       
  6619 #if 0
       
  6620 #define CPU_POWERPC_MPC5514E         CPU_POWERPC_MPC5514E_v1
       
  6621 #define CPU_POWERPC_MPC5514E_v0      CPU_POWERPC_e200z0
       
  6622 #define CPU_POWERPC_MPC5514E_v1      CPU_POWERPC_e200z1
       
  6623 #define CPU_POWERPC_MPC5514G         CPU_POWERPC_MPC5514G_v1
       
  6624 #define CPU_POWERPC_MPC5514G_v0      CPU_POWERPC_e200z0
       
  6625 #define CPU_POWERPC_MPC5514G_v1      CPU_POWERPC_e200z1
       
  6626 #define CPU_POWERPC_MPC5515S         CPU_POWERPC_e200z1
       
  6627 #define CPU_POWERPC_MPC5516E         CPU_POWERPC_MPC5516E_v1
       
  6628 #define CPU_POWERPC_MPC5516E_v0      CPU_POWERPC_e200z0
       
  6629 #define CPU_POWERPC_MPC5516E_v1      CPU_POWERPC_e200z1
       
  6630 #define CPU_POWERPC_MPC5516G         CPU_POWERPC_MPC5516G_v1
       
  6631 #define CPU_POWERPC_MPC5516G_v0      CPU_POWERPC_e200z0
       
  6632 #define CPU_POWERPC_MPC5516G_v1      CPU_POWERPC_e200z1
       
  6633 #define CPU_POWERPC_MPC5516S         CPU_POWERPC_e200z1
       
  6634 #endif
       
  6635 #if 0
       
  6636 #define CPU_POWERPC_MPC5533          CPU_POWERPC_e200z3
       
  6637 #define CPU_POWERPC_MPC5534          CPU_POWERPC_e200z3
       
  6638 #endif
       
  6639 #define CPU_POWERPC_MPC5553          CPU_POWERPC_e200z6
       
  6640 #define CPU_POWERPC_MPC5554          CPU_POWERPC_e200z6
       
  6641 #define CPU_POWERPC_MPC5561          CPU_POWERPC_e200z6
       
  6642 #define CPU_POWERPC_MPC5565          CPU_POWERPC_e200z6
       
  6643 #define CPU_POWERPC_MPC5566          CPU_POWERPC_e200z6
       
  6644 #define CPU_POWERPC_MPC5567          CPU_POWERPC_e200z6
       
  6645     /* e300 family */
       
  6646     /* e300 cores */
       
  6647 #define CPU_POWERPC_e300             CPU_POWERPC_e300c3
       
  6648     CPU_POWERPC_e300c1             = 0x00830010,
       
  6649     CPU_POWERPC_e300c2             = 0x00840010,
       
  6650     CPU_POWERPC_e300c3             = 0x00850010,
       
  6651     CPU_POWERPC_e300c4             = 0x00860010,
       
  6652     /* MPC83xx microcontrollers */
       
  6653 #define CPU_POWERPC_MPC8313          CPU_POWERPC_e300c3
       
  6654 #define CPU_POWERPC_MPC8313E         CPU_POWERPC_e300c3
       
  6655 #define CPU_POWERPC_MPC8314          CPU_POWERPC_e300c3
       
  6656 #define CPU_POWERPC_MPC8314E         CPU_POWERPC_e300c3
       
  6657 #define CPU_POWERPC_MPC8315          CPU_POWERPC_e300c3
       
  6658 #define CPU_POWERPC_MPC8315E         CPU_POWERPC_e300c3
       
  6659 #define CPU_POWERPC_MPC8321          CPU_POWERPC_e300c2
       
  6660 #define CPU_POWERPC_MPC8321E         CPU_POWERPC_e300c2
       
  6661 #define CPU_POWERPC_MPC8323          CPU_POWERPC_e300c2
       
  6662 #define CPU_POWERPC_MPC8323E         CPU_POWERPC_e300c2
       
  6663 #define CPU_POWERPC_MPC8343A         CPU_POWERPC_e300c1
       
  6664 #define CPU_POWERPC_MPC8343EA        CPU_POWERPC_e300c1
       
  6665 #define CPU_POWERPC_MPC8347A         CPU_POWERPC_e300c1
       
  6666 #define CPU_POWERPC_MPC8347AT        CPU_POWERPC_e300c1
       
  6667 #define CPU_POWERPC_MPC8347AP        CPU_POWERPC_e300c1
       
  6668 #define CPU_POWERPC_MPC8347EA        CPU_POWERPC_e300c1
       
  6669 #define CPU_POWERPC_MPC8347EAT       CPU_POWERPC_e300c1
       
  6670 #define CPU_POWERPC_MPC8347EAP       CPU_POWERPC_e300c1
       
  6671 #define CPU_POWERPC_MPC8349          CPU_POWERPC_e300c1
       
  6672 #define CPU_POWERPC_MPC8349A         CPU_POWERPC_e300c1
       
  6673 #define CPU_POWERPC_MPC8349E         CPU_POWERPC_e300c1
       
  6674 #define CPU_POWERPC_MPC8349EA        CPU_POWERPC_e300c1
       
  6675 #define CPU_POWERPC_MPC8358E         CPU_POWERPC_e300c1
       
  6676 #define CPU_POWERPC_MPC8360E         CPU_POWERPC_e300c1
       
  6677 #define CPU_POWERPC_MPC8377          CPU_POWERPC_e300c4
       
  6678 #define CPU_POWERPC_MPC8377E         CPU_POWERPC_e300c4
       
  6679 #define CPU_POWERPC_MPC8378          CPU_POWERPC_e300c4
       
  6680 #define CPU_POWERPC_MPC8378E         CPU_POWERPC_e300c4
       
  6681 #define CPU_POWERPC_MPC8379          CPU_POWERPC_e300c4
       
  6682 #define CPU_POWERPC_MPC8379E         CPU_POWERPC_e300c4
       
  6683     /* e500 family */
       
  6684     /* e500 cores  */
       
  6685 #define CPU_POWERPC_e500             CPU_POWERPC_e500v2_v22
       
  6686 #define CPU_POWERPC_e500v2           CPU_POWERPC_e500v2_v22
       
  6687     CPU_POWERPC_e500_v10           = 0x80200010,
       
  6688     CPU_POWERPC_e500_v20           = 0x80200020,
       
  6689     CPU_POWERPC_e500v2_v10         = 0x80210010,
       
  6690     CPU_POWERPC_e500v2_v11         = 0x80210011,
       
  6691     CPU_POWERPC_e500v2_v20         = 0x80210020,
       
  6692     CPU_POWERPC_e500v2_v21         = 0x80210021,
       
  6693     CPU_POWERPC_e500v2_v22         = 0x80210022,
       
  6694     CPU_POWERPC_e500v2_v30         = 0x80210030,
       
  6695     /* MPC85xx microcontrollers */
       
  6696 #define CPU_POWERPC_MPC8533          CPU_POWERPC_MPC8533_v11
       
  6697 #define CPU_POWERPC_MPC8533_v10      CPU_POWERPC_e500v2_v21
       
  6698 #define CPU_POWERPC_MPC8533_v11      CPU_POWERPC_e500v2_v22
       
  6699 #define CPU_POWERPC_MPC8533E         CPU_POWERPC_MPC8533E_v11
       
  6700 #define CPU_POWERPC_MPC8533E_v10     CPU_POWERPC_e500v2_v21
       
  6701 #define CPU_POWERPC_MPC8533E_v11     CPU_POWERPC_e500v2_v22
       
  6702 #define CPU_POWERPC_MPC8540          CPU_POWERPC_MPC8540_v21
       
  6703 #define CPU_POWERPC_MPC8540_v10      CPU_POWERPC_e500_v10
       
  6704 #define CPU_POWERPC_MPC8540_v20      CPU_POWERPC_e500_v20
       
  6705 #define CPU_POWERPC_MPC8540_v21      CPU_POWERPC_e500_v20
       
  6706 #define CPU_POWERPC_MPC8541          CPU_POWERPC_MPC8541_v11
       
  6707 #define CPU_POWERPC_MPC8541_v10      CPU_POWERPC_e500_v20
       
  6708 #define CPU_POWERPC_MPC8541_v11      CPU_POWERPC_e500_v20
       
  6709 #define CPU_POWERPC_MPC8541E         CPU_POWERPC_MPC8541E_v11
       
  6710 #define CPU_POWERPC_MPC8541E_v10     CPU_POWERPC_e500_v20
       
  6711 #define CPU_POWERPC_MPC8541E_v11     CPU_POWERPC_e500_v20
       
  6712 #define CPU_POWERPC_MPC8543          CPU_POWERPC_MPC8543_v21
       
  6713 #define CPU_POWERPC_MPC8543_v10      CPU_POWERPC_e500v2_v10
       
  6714 #define CPU_POWERPC_MPC8543_v11      CPU_POWERPC_e500v2_v11
       
  6715 #define CPU_POWERPC_MPC8543_v20      CPU_POWERPC_e500v2_v20
       
  6716 #define CPU_POWERPC_MPC8543_v21      CPU_POWERPC_e500v2_v21
       
  6717 #define CPU_POWERPC_MPC8543E         CPU_POWERPC_MPC8543E_v21
       
  6718 #define CPU_POWERPC_MPC8543E_v10     CPU_POWERPC_e500v2_v10
       
  6719 #define CPU_POWERPC_MPC8543E_v11     CPU_POWERPC_e500v2_v11
       
  6720 #define CPU_POWERPC_MPC8543E_v20     CPU_POWERPC_e500v2_v20
       
  6721 #define CPU_POWERPC_MPC8543E_v21     CPU_POWERPC_e500v2_v21
       
  6722 #define CPU_POWERPC_MPC8544          CPU_POWERPC_MPC8544_v11
       
  6723 #define CPU_POWERPC_MPC8544_v10      CPU_POWERPC_e500v2_v21
       
  6724 #define CPU_POWERPC_MPC8544_v11      CPU_POWERPC_e500v2_v22
       
  6725 #define CPU_POWERPC_MPC8544E_v11     CPU_POWERPC_e500v2_v22
       
  6726 #define CPU_POWERPC_MPC8544E         CPU_POWERPC_MPC8544E_v11
       
  6727 #define CPU_POWERPC_MPC8544E_v10     CPU_POWERPC_e500v2_v21
       
  6728 #define CPU_POWERPC_MPC8545          CPU_POWERPC_MPC8545_v21
       
  6729 #define CPU_POWERPC_MPC8545_v10      CPU_POWERPC_e500v2_v10
       
  6730 #define CPU_POWERPC_MPC8545_v20      CPU_POWERPC_e500v2_v20
       
  6731 #define CPU_POWERPC_MPC8545_v21      CPU_POWERPC_e500v2_v21
       
  6732 #define CPU_POWERPC_MPC8545E         CPU_POWERPC_MPC8545E_v21
       
  6733 #define CPU_POWERPC_MPC8545E_v10     CPU_POWERPC_e500v2_v10
       
  6734 #define CPU_POWERPC_MPC8545E_v20     CPU_POWERPC_e500v2_v20
       
  6735 #define CPU_POWERPC_MPC8545E_v21     CPU_POWERPC_e500v2_v21
       
  6736 #define CPU_POWERPC_MPC8547E         CPU_POWERPC_MPC8545E_v21
       
  6737 #define CPU_POWERPC_MPC8547E_v10     CPU_POWERPC_e500v2_v10
       
  6738 #define CPU_POWERPC_MPC8547E_v20     CPU_POWERPC_e500v2_v20
       
  6739 #define CPU_POWERPC_MPC8547E_v21     CPU_POWERPC_e500v2_v21
       
  6740 #define CPU_POWERPC_MPC8548          CPU_POWERPC_MPC8548_v21
       
  6741 #define CPU_POWERPC_MPC8548_v10      CPU_POWERPC_e500v2_v10
       
  6742 #define CPU_POWERPC_MPC8548_v11      CPU_POWERPC_e500v2_v11
       
  6743 #define CPU_POWERPC_MPC8548_v20      CPU_POWERPC_e500v2_v20
       
  6744 #define CPU_POWERPC_MPC8548_v21      CPU_POWERPC_e500v2_v21
       
  6745 #define CPU_POWERPC_MPC8548E         CPU_POWERPC_MPC8548E_v21
       
  6746 #define CPU_POWERPC_MPC8548E_v10     CPU_POWERPC_e500v2_v10
       
  6747 #define CPU_POWERPC_MPC8548E_v11     CPU_POWERPC_e500v2_v11
       
  6748 #define CPU_POWERPC_MPC8548E_v20     CPU_POWERPC_e500v2_v20
       
  6749 #define CPU_POWERPC_MPC8548E_v21     CPU_POWERPC_e500v2_v21
       
  6750 #define CPU_POWERPC_MPC8555          CPU_POWERPC_MPC8555_v11
       
  6751 #define CPU_POWERPC_MPC8555_v10      CPU_POWERPC_e500v2_v10
       
  6752 #define CPU_POWERPC_MPC8555_v11      CPU_POWERPC_e500v2_v11
       
  6753 #define CPU_POWERPC_MPC8555E         CPU_POWERPC_MPC8555E_v11
       
  6754 #define CPU_POWERPC_MPC8555E_v10     CPU_POWERPC_e500v2_v10
       
  6755 #define CPU_POWERPC_MPC8555E_v11     CPU_POWERPC_e500v2_v11
       
  6756 #define CPU_POWERPC_MPC8560          CPU_POWERPC_MPC8560_v21
       
  6757 #define CPU_POWERPC_MPC8560_v10      CPU_POWERPC_e500v2_v10
       
  6758 #define CPU_POWERPC_MPC8560_v20      CPU_POWERPC_e500v2_v20
       
  6759 #define CPU_POWERPC_MPC8560_v21      CPU_POWERPC_e500v2_v21
       
  6760 #define CPU_POWERPC_MPC8567          CPU_POWERPC_e500v2_v22
       
  6761 #define CPU_POWERPC_MPC8567E         CPU_POWERPC_e500v2_v22
       
  6762 #define CPU_POWERPC_MPC8568          CPU_POWERPC_e500v2_v22
       
  6763 #define CPU_POWERPC_MPC8568E         CPU_POWERPC_e500v2_v22
       
  6764 #define CPU_POWERPC_MPC8572          CPU_POWERPC_e500v2_v30
       
  6765 #define CPU_POWERPC_MPC8572E         CPU_POWERPC_e500v2_v30
       
  6766     /* e600 family */
       
  6767     /* e600 cores */
       
  6768     CPU_POWERPC_e600               = 0x80040010,
       
  6769     /* MPC86xx microcontrollers */
       
  6770 #define CPU_POWERPC_MPC8610          CPU_POWERPC_e600
       
  6771 #define CPU_POWERPC_MPC8641          CPU_POWERPC_e600
       
  6772 #define CPU_POWERPC_MPC8641D         CPU_POWERPC_e600
       
  6773     /* PowerPC 6xx cores */
       
  6774 #define CPU_POWERPC_601              CPU_POWERPC_601_v2
       
  6775     CPU_POWERPC_601_v0             = 0x00010001,
       
  6776     CPU_POWERPC_601_v1             = 0x00010001,
       
  6777 #define CPU_POWERPC_601v             CPU_POWERPC_601_v2
       
  6778     CPU_POWERPC_601_v2             = 0x00010002,
       
  6779     CPU_POWERPC_602                = 0x00050100,
       
  6780     CPU_POWERPC_603                = 0x00030100,
       
  6781 #define CPU_POWERPC_603E             CPU_POWERPC_603E_v41
       
  6782     CPU_POWERPC_603E_v11           = 0x00060101,
       
  6783     CPU_POWERPC_603E_v12           = 0x00060102,
       
  6784     CPU_POWERPC_603E_v13           = 0x00060103,
       
  6785     CPU_POWERPC_603E_v14           = 0x00060104,
       
  6786     CPU_POWERPC_603E_v22           = 0x00060202,
       
  6787     CPU_POWERPC_603E_v3            = 0x00060300,
       
  6788     CPU_POWERPC_603E_v4            = 0x00060400,
       
  6789     CPU_POWERPC_603E_v41           = 0x00060401,
       
  6790     CPU_POWERPC_603E7t             = 0x00071201,
       
  6791     CPU_POWERPC_603E7v             = 0x00070100,
       
  6792     CPU_POWERPC_603E7v1            = 0x00070101,
       
  6793     CPU_POWERPC_603E7v2            = 0x00070201,
       
  6794     CPU_POWERPC_603E7              = 0x00070200,
       
  6795     CPU_POWERPC_603P               = 0x00070000,
       
  6796 #define CPU_POWERPC_603R             CPU_POWERPC_603E7t
       
  6797     /* XXX: missing 0x00040303 (604) */
       
  6798     CPU_POWERPC_604                = 0x00040103,
       
  6799 #define CPU_POWERPC_604E             CPU_POWERPC_604E_v24
       
  6800     /* XXX: missing 0x00091203 */
       
  6801     /* XXX: missing 0x00092110 */
       
  6802     /* XXX: missing 0x00092120 */
       
  6803     CPU_POWERPC_604E_v10           = 0x00090100,
       
  6804     CPU_POWERPC_604E_v22           = 0x00090202,
       
  6805     CPU_POWERPC_604E_v24           = 0x00090204,
       
  6806     /* XXX: missing 0x000a0100 */
       
  6807     /* XXX: missing 0x00093102 */
       
  6808     CPU_POWERPC_604R               = 0x000a0101,
       
  6809 #if 0
       
  6810     CPU_POWERPC_604EV              = xxx, /* XXX: same as 604R ? */
       
  6811 #endif
       
  6812     /* PowerPC 740/750 cores (aka G3) */
       
  6813     /* XXX: missing 0x00084202 */
       
  6814 #define CPU_POWERPC_7x0              CPU_POWERPC_7x0_v31
       
  6815     CPU_POWERPC_7x0_v10            = 0x00080100,
       
  6816     CPU_POWERPC_7x0_v20            = 0x00080200,
       
  6817     CPU_POWERPC_7x0_v21            = 0x00080201,
       
  6818     CPU_POWERPC_7x0_v22            = 0x00080202,
       
  6819     CPU_POWERPC_7x0_v30            = 0x00080300,
       
  6820     CPU_POWERPC_7x0_v31            = 0x00080301,
       
  6821     CPU_POWERPC_740E               = 0x00080100,
       
  6822     CPU_POWERPC_750E               = 0x00080200,
       
  6823     CPU_POWERPC_7x0P               = 0x10080000,
       
  6824     /* XXX: missing 0x00087010 (CL ?) */
       
  6825 #define CPU_POWERPC_750CL            CPU_POWERPC_750CL_v20
       
  6826     CPU_POWERPC_750CL_v10          = 0x00087200,
       
  6827     CPU_POWERPC_750CL_v20          = 0x00087210, /* aka rev E */
       
  6828 #define CPU_POWERPC_750CX            CPU_POWERPC_750CX_v22
       
  6829     CPU_POWERPC_750CX_v10          = 0x00082100,
       
  6830     CPU_POWERPC_750CX_v20          = 0x00082200,
       
  6831     CPU_POWERPC_750CX_v21          = 0x00082201,
       
  6832     CPU_POWERPC_750CX_v22          = 0x00082202,
       
  6833 #define CPU_POWERPC_750CXE           CPU_POWERPC_750CXE_v31b
       
  6834     CPU_POWERPC_750CXE_v21         = 0x00082211,
       
  6835     CPU_POWERPC_750CXE_v22         = 0x00082212,
       
  6836     CPU_POWERPC_750CXE_v23         = 0x00082213,
       
  6837     CPU_POWERPC_750CXE_v24         = 0x00082214,
       
  6838     CPU_POWERPC_750CXE_v24b        = 0x00083214,
       
  6839     CPU_POWERPC_750CXE_v30         = 0x00082310,
       
  6840     CPU_POWERPC_750CXE_v31         = 0x00082311,
       
  6841     CPU_POWERPC_750CXE_v31b        = 0x00083311,
       
  6842     CPU_POWERPC_750CXR             = 0x00083410,
       
  6843     CPU_POWERPC_750FL              = 0x70000203,
       
  6844 #define CPU_POWERPC_750FX            CPU_POWERPC_750FX_v23
       
  6845     CPU_POWERPC_750FX_v10          = 0x70000100,
       
  6846     CPU_POWERPC_750FX_v20          = 0x70000200,
       
  6847     CPU_POWERPC_750FX_v21          = 0x70000201,
       
  6848     CPU_POWERPC_750FX_v22          = 0x70000202,
       
  6849     CPU_POWERPC_750FX_v23          = 0x70000203,
       
  6850     CPU_POWERPC_750GL              = 0x70020102,
       
  6851 #define CPU_POWERPC_750GX            CPU_POWERPC_750GX_v12
       
  6852     CPU_POWERPC_750GX_v10          = 0x70020100,
       
  6853     CPU_POWERPC_750GX_v11          = 0x70020101,
       
  6854     CPU_POWERPC_750GX_v12          = 0x70020102,
       
  6855 #define CPU_POWERPC_750L             CPU_POWERPC_750L_v32 /* Aka LoneStar */
       
  6856     CPU_POWERPC_750L_v20           = 0x00088200,
       
  6857     CPU_POWERPC_750L_v21           = 0x00088201,
       
  6858     CPU_POWERPC_750L_v22           = 0x00088202,
       
  6859     CPU_POWERPC_750L_v30           = 0x00088300,
       
  6860     CPU_POWERPC_750L_v32           = 0x00088302,
       
  6861     /* PowerPC 745/755 cores */
       
  6862 #define CPU_POWERPC_7x5              CPU_POWERPC_7x5_v28
       
  6863     CPU_POWERPC_7x5_v10            = 0x00083100,
       
  6864     CPU_POWERPC_7x5_v11            = 0x00083101,
       
  6865     CPU_POWERPC_7x5_v20            = 0x00083200,
       
  6866     CPU_POWERPC_7x5_v21            = 0x00083201,
       
  6867     CPU_POWERPC_7x5_v22            = 0x00083202, /* aka D */
       
  6868     CPU_POWERPC_7x5_v23            = 0x00083203, /* aka E */
       
  6869     CPU_POWERPC_7x5_v24            = 0x00083204,
       
  6870     CPU_POWERPC_7x5_v25            = 0x00083205,
       
  6871     CPU_POWERPC_7x5_v26            = 0x00083206,
       
  6872     CPU_POWERPC_7x5_v27            = 0x00083207,
       
  6873     CPU_POWERPC_7x5_v28            = 0x00083208,
       
  6874 #if 0
       
  6875     CPU_POWERPC_7x5P               = xxx,
       
  6876 #endif
       
  6877     /* PowerPC 74xx cores (aka G4) */
       
  6878     /* XXX: missing 0x000C1101 */
       
  6879 #define CPU_POWERPC_7400             CPU_POWERPC_7400_v29
       
  6880     CPU_POWERPC_7400_v10           = 0x000C0100,
       
  6881     CPU_POWERPC_7400_v11           = 0x000C0101,
       
  6882     CPU_POWERPC_7400_v20           = 0x000C0200,
       
  6883     CPU_POWERPC_7400_v21           = 0x000C0201,
       
  6884     CPU_POWERPC_7400_v22           = 0x000C0202,
       
  6885     CPU_POWERPC_7400_v26           = 0x000C0206,
       
  6886     CPU_POWERPC_7400_v27           = 0x000C0207,
       
  6887     CPU_POWERPC_7400_v28           = 0x000C0208,
       
  6888     CPU_POWERPC_7400_v29           = 0x000C0209,
       
  6889 #define CPU_POWERPC_7410             CPU_POWERPC_7410_v14
       
  6890     CPU_POWERPC_7410_v10           = 0x800C1100,
       
  6891     CPU_POWERPC_7410_v11           = 0x800C1101,
       
  6892     CPU_POWERPC_7410_v12           = 0x800C1102, /* aka C */
       
  6893     CPU_POWERPC_7410_v13           = 0x800C1103, /* aka D */
       
  6894     CPU_POWERPC_7410_v14           = 0x800C1104, /* aka E */
       
  6895 #define CPU_POWERPC_7448             CPU_POWERPC_7448_v21
       
  6896     CPU_POWERPC_7448_v10           = 0x80040100,
       
  6897     CPU_POWERPC_7448_v11           = 0x80040101,
       
  6898     CPU_POWERPC_7448_v20           = 0x80040200,
       
  6899     CPU_POWERPC_7448_v21           = 0x80040201,
       
  6900 #define CPU_POWERPC_7450             CPU_POWERPC_7450_v21
       
  6901     CPU_POWERPC_7450_v10           = 0x80000100,
       
  6902     CPU_POWERPC_7450_v11           = 0x80000101,
       
  6903     CPU_POWERPC_7450_v12           = 0x80000102,
       
  6904     CPU_POWERPC_7450_v20           = 0x80000200, /* aka A, B, C, D: 2.04 */
       
  6905     CPU_POWERPC_7450_v21           = 0x80000201, /* aka E */
       
  6906 #define CPU_POWERPC_74x1             CPU_POWERPC_74x1_v23
       
  6907     CPU_POWERPC_74x1_v23           = 0x80000203, /* aka G: 2.3 */
       
  6908     /* XXX: this entry might be a bug in some documentation */
       
  6909     CPU_POWERPC_74x1_v210          = 0x80000210, /* aka G: 2.3 ? */
       
  6910 #define CPU_POWERPC_74x5             CPU_POWERPC_74x5_v32
       
  6911     CPU_POWERPC_74x5_v10           = 0x80010100,
       
  6912     /* XXX: missing 0x80010200 */
       
  6913     CPU_POWERPC_74x5_v21           = 0x80010201, /* aka C: 2.1 */
       
  6914     CPU_POWERPC_74x5_v32           = 0x80010302,
       
  6915     CPU_POWERPC_74x5_v33           = 0x80010303, /* aka F: 3.3 */
       
  6916     CPU_POWERPC_74x5_v34           = 0x80010304, /* aka G: 3.4 */
       
  6917 #define CPU_POWERPC_74x7             CPU_POWERPC_74x7_v12
       
  6918     CPU_POWERPC_74x7_v10           = 0x80020100, /* aka A: 1.0 */
       
  6919     CPU_POWERPC_74x7_v11           = 0x80020101, /* aka B: 1.1 */
       
  6920     CPU_POWERPC_74x7_v12           = 0x80020102, /* aka C: 1.2 */
       
  6921 #define CPU_POWERPC_74x7A            CPU_POWERPC_74x7A_v12
       
  6922     CPU_POWERPC_74x7A_v10          = 0x80030100, /* aka A: 1.0 */
       
  6923     CPU_POWERPC_74x7A_v11          = 0x80030101, /* aka B: 1.1 */
       
  6924     CPU_POWERPC_74x7A_v12          = 0x80030102, /* aka C: 1.2 */
       
  6925     /* 64 bits PowerPC */
       
  6926 #if defined(TARGET_PPC64)
       
  6927     CPU_POWERPC_620                = 0x00140000,
       
  6928     CPU_POWERPC_630                = 0x00400000,
       
  6929     CPU_POWERPC_631                = 0x00410104,
       
  6930     CPU_POWERPC_POWER4             = 0x00350000,
       
  6931     CPU_POWERPC_POWER4P            = 0x00380000,
       
  6932      /* XXX: missing 0x003A0201 */
       
  6933     CPU_POWERPC_POWER5             = 0x003A0203,
       
  6934 #define CPU_POWERPC_POWER5GR         CPU_POWERPC_POWER5
       
  6935     CPU_POWERPC_POWER5P            = 0x003B0000,
       
  6936 #define CPU_POWERPC_POWER5GS         CPU_POWERPC_POWER5P
       
  6937     CPU_POWERPC_POWER6             = 0x003E0000,
       
  6938     CPU_POWERPC_POWER6_5           = 0x0F000001, /* POWER6 in POWER5 mode */
       
  6939     CPU_POWERPC_POWER6A            = 0x0F000002,
       
  6940     CPU_POWERPC_970                = 0x00390202,
       
  6941 #define CPU_POWERPC_970FX            CPU_POWERPC_970FX_v31
       
  6942     CPU_POWERPC_970FX_v10          = 0x00391100,
       
  6943     CPU_POWERPC_970FX_v20          = 0x003C0200,
       
  6944     CPU_POWERPC_970FX_v21          = 0x003C0201,
       
  6945     CPU_POWERPC_970FX_v30          = 0x003C0300,
       
  6946     CPU_POWERPC_970FX_v31          = 0x003C0301,
       
  6947     CPU_POWERPC_970GX              = 0x00450000,
       
  6948 #define CPU_POWERPC_970MP            CPU_POWERPC_970MP_v11
       
  6949     CPU_POWERPC_970MP_v10          = 0x00440100,
       
  6950     CPU_POWERPC_970MP_v11          = 0x00440101,
       
  6951 #define CPU_POWERPC_CELL             CPU_POWERPC_CELL_v32
       
  6952     CPU_POWERPC_CELL_v10           = 0x00700100,
       
  6953     CPU_POWERPC_CELL_v20           = 0x00700400,
       
  6954     CPU_POWERPC_CELL_v30           = 0x00700500,
       
  6955     CPU_POWERPC_CELL_v31           = 0x00700501,
       
  6956 #define CPU_POWERPC_CELL_v32         CPU_POWERPC_CELL_v31
       
  6957     CPU_POWERPC_RS64               = 0x00330000,
       
  6958     CPU_POWERPC_RS64II             = 0x00340000,
       
  6959     CPU_POWERPC_RS64III            = 0x00360000,
       
  6960     CPU_POWERPC_RS64IV             = 0x00370000,
       
  6961 #endif /* defined(TARGET_PPC64) */
       
  6962     /* Original POWER */
       
  6963     /* XXX: should be POWER (RIOS), RSC3308, RSC4608,
       
  6964      * POWER2 (RIOS2) & RSC2 (P2SC) here
       
  6965      */
       
  6966 #if 0
       
  6967     CPU_POWER                      = xxx, /* 0x20000 ? 0x30000 for RSC ? */
       
  6968 #endif
       
  6969 #if 0
       
  6970     CPU_POWER2                     = xxx, /* 0x40000 ? */
       
  6971 #endif
       
  6972     /* PA Semi core */
       
  6973     CPU_POWERPC_PA6T               = 0x00900000,
       
  6974 };
       
  6975 
       
  6976 /* System version register (used on MPC 8xxx)                                */
       
  6977 enum {
       
  6978     POWERPC_SVR_NONE               = 0x00000000,
       
  6979 #define POWERPC_SVR_52xx             POWERPC_SVR_5200
       
  6980 #define POWERPC_SVR_5200             POWERPC_SVR_5200_v12
       
  6981     POWERPC_SVR_5200_v10           = 0x80110010,
       
  6982     POWERPC_SVR_5200_v11           = 0x80110011,
       
  6983     POWERPC_SVR_5200_v12           = 0x80110012,
       
  6984 #define POWERPC_SVR_5200B            POWERPC_SVR_5200B_v21
       
  6985     POWERPC_SVR_5200B_v20          = 0x80110020,
       
  6986     POWERPC_SVR_5200B_v21          = 0x80110021,
       
  6987 #define POWERPC_SVR_55xx             POWERPC_SVR_5567
       
  6988 #if 0
       
  6989     POWERPC_SVR_5533               = xxx,
       
  6990 #endif
       
  6991 #if 0
       
  6992     POWERPC_SVR_5534               = xxx,
       
  6993 #endif
       
  6994 #if 0
       
  6995     POWERPC_SVR_5553               = xxx,
       
  6996 #endif
       
  6997 #if 0
       
  6998     POWERPC_SVR_5554               = xxx,
       
  6999 #endif
       
  7000 #if 0
       
  7001     POWERPC_SVR_5561               = xxx,
       
  7002 #endif
       
  7003 #if 0
       
  7004     POWERPC_SVR_5565               = xxx,
       
  7005 #endif
       
  7006 #if 0
       
  7007     POWERPC_SVR_5566               = xxx,
       
  7008 #endif
       
  7009 #if 0
       
  7010     POWERPC_SVR_5567               = xxx,
       
  7011 #endif
       
  7012 #if 0
       
  7013     POWERPC_SVR_8313               = xxx,
       
  7014 #endif
       
  7015 #if 0
       
  7016     POWERPC_SVR_8313E              = xxx,
       
  7017 #endif
       
  7018 #if 0
       
  7019     POWERPC_SVR_8314               = xxx,
       
  7020 #endif
       
  7021 #if 0
       
  7022     POWERPC_SVR_8314E              = xxx,
       
  7023 #endif
       
  7024 #if 0
       
  7025     POWERPC_SVR_8315               = xxx,
       
  7026 #endif
       
  7027 #if 0
       
  7028     POWERPC_SVR_8315E              = xxx,
       
  7029 #endif
       
  7030 #if 0
       
  7031     POWERPC_SVR_8321               = xxx,
       
  7032 #endif
       
  7033 #if 0
       
  7034     POWERPC_SVR_8321E              = xxx,
       
  7035 #endif
       
  7036 #if 0
       
  7037     POWERPC_SVR_8323               = xxx,
       
  7038 #endif
       
  7039 #if 0
       
  7040     POWERPC_SVR_8323E              = xxx,
       
  7041 #endif
       
  7042     POWERPC_SVR_8343A              = 0x80570030,
       
  7043     POWERPC_SVR_8343EA             = 0x80560030,
       
  7044 #define POWERPC_SVR_8347A            POWERPC_SVR_8347AT
       
  7045     POWERPC_SVR_8347AP             = 0x80550030, /* PBGA package */
       
  7046     POWERPC_SVR_8347AT             = 0x80530030, /* TBGA package */
       
  7047 #define POWERPC_SVR_8347EA            POWERPC_SVR_8347EAT
       
  7048     POWERPC_SVR_8347EAP            = 0x80540030, /* PBGA package */
       
  7049     POWERPC_SVR_8347EAT            = 0x80520030, /* TBGA package */
       
  7050     POWERPC_SVR_8349               = 0x80510010,
       
  7051     POWERPC_SVR_8349A              = 0x80510030,
       
  7052     POWERPC_SVR_8349E              = 0x80500010,
       
  7053     POWERPC_SVR_8349EA             = 0x80500030,
       
  7054 #if 0
       
  7055     POWERPC_SVR_8358E              = xxx,
       
  7056 #endif
       
  7057 #if 0
       
  7058     POWERPC_SVR_8360E              = xxx,
       
  7059 #endif
       
  7060 #define POWERPC_SVR_E500             0x40000000
       
  7061     POWERPC_SVR_8377               = 0x80C70010 | POWERPC_SVR_E500,
       
  7062     POWERPC_SVR_8377E              = 0x80C60010 | POWERPC_SVR_E500,
       
  7063     POWERPC_SVR_8378               = 0x80C50010 | POWERPC_SVR_E500,
       
  7064     POWERPC_SVR_8378E              = 0x80C40010 | POWERPC_SVR_E500,
       
  7065     POWERPC_SVR_8379               = 0x80C30010 | POWERPC_SVR_E500,
       
  7066     POWERPC_SVR_8379E              = 0x80C00010 | POWERPC_SVR_E500,
       
  7067 #define POWERPC_SVR_8533             POWERPC_SVR_8533_v11
       
  7068     POWERPC_SVR_8533_v10           = 0x80340010 | POWERPC_SVR_E500,
       
  7069     POWERPC_SVR_8533_v11           = 0x80340011 | POWERPC_SVR_E500,
       
  7070 #define POWERPC_SVR_8533E            POWERPC_SVR_8533E_v11
       
  7071     POWERPC_SVR_8533E_v10          = 0x803C0010 | POWERPC_SVR_E500,
       
  7072     POWERPC_SVR_8533E_v11          = 0x803C0011 | POWERPC_SVR_E500,
       
  7073 #define POWERPC_SVR_8540             POWERPC_SVR_8540_v21
       
  7074     POWERPC_SVR_8540_v10           = 0x80300010 | POWERPC_SVR_E500,
       
  7075     POWERPC_SVR_8540_v20           = 0x80300020 | POWERPC_SVR_E500,
       
  7076     POWERPC_SVR_8540_v21           = 0x80300021 | POWERPC_SVR_E500,
       
  7077 #define POWERPC_SVR_8541             POWERPC_SVR_8541_v11
       
  7078     POWERPC_SVR_8541_v10           = 0x80720010 | POWERPC_SVR_E500,
       
  7079     POWERPC_SVR_8541_v11           = 0x80720011 | POWERPC_SVR_E500,
       
  7080 #define POWERPC_SVR_8541E            POWERPC_SVR_8541E_v11
       
  7081     POWERPC_SVR_8541E_v10          = 0x807A0010 | POWERPC_SVR_E500,
       
  7082     POWERPC_SVR_8541E_v11          = 0x807A0011 | POWERPC_SVR_E500,
       
  7083 #define POWERPC_SVR_8543             POWERPC_SVR_8543_v21
       
  7084     POWERPC_SVR_8543_v10           = 0x80320010 | POWERPC_SVR_E500,
       
  7085     POWERPC_SVR_8543_v11           = 0x80320011 | POWERPC_SVR_E500,
       
  7086     POWERPC_SVR_8543_v20           = 0x80320020 | POWERPC_SVR_E500,
       
  7087     POWERPC_SVR_8543_v21           = 0x80320021 | POWERPC_SVR_E500,
       
  7088 #define POWERPC_SVR_8543E            POWERPC_SVR_8543E_v21
       
  7089     POWERPC_SVR_8543E_v10          = 0x803A0010 | POWERPC_SVR_E500,
       
  7090     POWERPC_SVR_8543E_v11          = 0x803A0011 | POWERPC_SVR_E500,
       
  7091     POWERPC_SVR_8543E_v20          = 0x803A0020 | POWERPC_SVR_E500,
       
  7092     POWERPC_SVR_8543E_v21          = 0x803A0021 | POWERPC_SVR_E500,
       
  7093 #define POWERPC_SVR_8544             POWERPC_SVR_8544_v11
       
  7094     POWERPC_SVR_8544_v10           = 0x80340110 | POWERPC_SVR_E500,
       
  7095     POWERPC_SVR_8544_v11           = 0x80340111 | POWERPC_SVR_E500,
       
  7096 #define POWERPC_SVR_8544E            POWERPC_SVR_8544E_v11
       
  7097     POWERPC_SVR_8544E_v10          = 0x803C0110 | POWERPC_SVR_E500,
       
  7098     POWERPC_SVR_8544E_v11          = 0x803C0111 | POWERPC_SVR_E500,
       
  7099 #define POWERPC_SVR_8545             POWERPC_SVR_8545_v21
       
  7100     POWERPC_SVR_8545_v20           = 0x80310220 | POWERPC_SVR_E500,
       
  7101     POWERPC_SVR_8545_v21           = 0x80310221 | POWERPC_SVR_E500,
       
  7102 #define POWERPC_SVR_8545E            POWERPC_SVR_8545E_v21
       
  7103     POWERPC_SVR_8545E_v20          = 0x80390220 | POWERPC_SVR_E500,
       
  7104     POWERPC_SVR_8545E_v21          = 0x80390221 | POWERPC_SVR_E500,
       
  7105 #define POWERPC_SVR_8547E            POWERPC_SVR_8547E_v21
       
  7106     POWERPC_SVR_8547E_v20          = 0x80390120 | POWERPC_SVR_E500,
       
  7107     POWERPC_SVR_8547E_v21          = 0x80390121 | POWERPC_SVR_E500,
       
  7108 #define POWERPC_SVR_8548             POWERPC_SVR_8548_v21
       
  7109     POWERPC_SVR_8548_v10           = 0x80310010 | POWERPC_SVR_E500,
       
  7110     POWERPC_SVR_8548_v11           = 0x80310011 | POWERPC_SVR_E500,
       
  7111     POWERPC_SVR_8548_v20           = 0x80310020 | POWERPC_SVR_E500,
       
  7112     POWERPC_SVR_8548_v21           = 0x80310021 | POWERPC_SVR_E500,
       
  7113 #define POWERPC_SVR_8548E            POWERPC_SVR_8548E_v21
       
  7114     POWERPC_SVR_8548E_v10          = 0x80390010 | POWERPC_SVR_E500,
       
  7115     POWERPC_SVR_8548E_v11          = 0x80390011 | POWERPC_SVR_E500,
       
  7116     POWERPC_SVR_8548E_v20          = 0x80390020 | POWERPC_SVR_E500,
       
  7117     POWERPC_SVR_8548E_v21          = 0x80390021 | POWERPC_SVR_E500,
       
  7118 #define POWERPC_SVR_8555             POWERPC_SVR_8555_v11
       
  7119     POWERPC_SVR_8555_v10           = 0x80710010 | POWERPC_SVR_E500,
       
  7120     POWERPC_SVR_8555_v11           = 0x80710011 | POWERPC_SVR_E500,
       
  7121 #define POWERPC_SVR_8555E            POWERPC_SVR_8555_v11
       
  7122     POWERPC_SVR_8555E_v10          = 0x80790010 | POWERPC_SVR_E500,
       
  7123     POWERPC_SVR_8555E_v11          = 0x80790011 | POWERPC_SVR_E500,
       
  7124 #define POWERPC_SVR_8560             POWERPC_SVR_8560_v21
       
  7125     POWERPC_SVR_8560_v10           = 0x80700010 | POWERPC_SVR_E500,
       
  7126     POWERPC_SVR_8560_v20           = 0x80700020 | POWERPC_SVR_E500,
       
  7127     POWERPC_SVR_8560_v21           = 0x80700021 | POWERPC_SVR_E500,
       
  7128     POWERPC_SVR_8567               = 0x80750111 | POWERPC_SVR_E500,
       
  7129     POWERPC_SVR_8567E              = 0x807D0111 | POWERPC_SVR_E500,
       
  7130     POWERPC_SVR_8568               = 0x80750011 | POWERPC_SVR_E500,
       
  7131     POWERPC_SVR_8568E              = 0x807D0011 | POWERPC_SVR_E500,
       
  7132     POWERPC_SVR_8572               = 0x80E00010 | POWERPC_SVR_E500,
       
  7133     POWERPC_SVR_8572E              = 0x80E80010 | POWERPC_SVR_E500,
       
  7134 #if 0
       
  7135     POWERPC_SVR_8610               = xxx,
       
  7136 #endif
       
  7137     POWERPC_SVR_8641               = 0x80900021,
       
  7138     POWERPC_SVR_8641D              = 0x80900121,
       
  7139 };
       
  7140 
       
  7141 /*****************************************************************************/
       
  7142 /* PowerPC CPU definitions                                                   */
       
  7143 #define POWERPC_DEF_SVR(_name, _pvr, _svr, _type)                             \
       
  7144     {                                                                         \
       
  7145         .name        = _name,                                                 \
       
  7146         .pvr         = _pvr,                                                  \
       
  7147         .svr         = _svr,                                                  \
       
  7148         .insns_flags = glue(POWERPC_INSNS_,_type),                            \
       
  7149         .msr_mask    = glue(POWERPC_MSRM_,_type),                             \
       
  7150         .mmu_model   = glue(POWERPC_MMU_,_type),                              \
       
  7151         .excp_model  = glue(POWERPC_EXCP_,_type),                             \
       
  7152         .bus_model   = glue(POWERPC_INPUT_,_type),                            \
       
  7153         .bfd_mach    = glue(POWERPC_BFDM_,_type),                             \
       
  7154         .flags       = glue(POWERPC_FLAG_,_type),                             \
       
  7155         .init_proc   = &glue(init_proc_,_type),                               \
       
  7156         .check_pow   = &glue(check_pow_,_type),                               \
       
  7157     }
       
  7158 #define POWERPC_DEF(_name, _pvr, _type)                                       \
       
  7159 POWERPC_DEF_SVR(_name, _pvr, POWERPC_SVR_NONE, _type)
       
  7160 
       
  7161 static const ppc_def_t ppc_defs[] = {
       
  7162     /* Embedded PowerPC                                                      */
       
  7163     /* PowerPC 401 family                                                    */
       
  7164     /* Generic PowerPC 401 */
       
  7165     POWERPC_DEF("401",           CPU_POWERPC_401,                    401),
       
  7166     /* PowerPC 401 cores                                                     */
       
  7167     /* PowerPC 401A1 */
       
  7168     POWERPC_DEF("401A1",         CPU_POWERPC_401A1,                  401),
       
  7169     /* PowerPC 401B2                                                         */
       
  7170     POWERPC_DEF("401B2",         CPU_POWERPC_401B2,                  401x2),
       
  7171 #if defined (TODO)
       
  7172     /* PowerPC 401B3                                                         */
       
  7173     POWERPC_DEF("401B3",         CPU_POWERPC_401B3,                  401x3),
       
  7174 #endif
       
  7175     /* PowerPC 401C2                                                         */
       
  7176     POWERPC_DEF("401C2",         CPU_POWERPC_401C2,                  401x2),
       
  7177     /* PowerPC 401D2                                                         */
       
  7178     POWERPC_DEF("401D2",         CPU_POWERPC_401D2,                  401x2),
       
  7179     /* PowerPC 401E2                                                         */
       
  7180     POWERPC_DEF("401E2",         CPU_POWERPC_401E2,                  401x2),
       
  7181     /* PowerPC 401F2                                                         */
       
  7182     POWERPC_DEF("401F2",         CPU_POWERPC_401F2,                  401x2),
       
  7183     /* PowerPC 401G2                                                         */
       
  7184     /* XXX: to be checked */
       
  7185     POWERPC_DEF("401G2",         CPU_POWERPC_401G2,                  401x2),
       
  7186     /* PowerPC 401 microcontrolers                                           */
       
  7187 #if defined (TODO)
       
  7188     /* PowerPC 401GF                                                         */
       
  7189     POWERPC_DEF("401GF",         CPU_POWERPC_401GF,                  401),
       
  7190 #endif
       
  7191     /* IOP480 (401 microcontroler)                                           */
       
  7192     POWERPC_DEF("IOP480",        CPU_POWERPC_IOP480,                 IOP480),
       
  7193     /* IBM Processor for Network Resources                                   */
       
  7194     POWERPC_DEF("Cobra",         CPU_POWERPC_COBRA,                  401),
       
  7195 #if defined (TODO)
       
  7196     POWERPC_DEF("Xipchip",       CPU_POWERPC_XIPCHIP,                401),
       
  7197 #endif
       
  7198     /* PowerPC 403 family                                                    */
       
  7199     /* Generic PowerPC 403                                                   */
       
  7200     POWERPC_DEF("403",           CPU_POWERPC_403,                    403),
       
  7201     /* PowerPC 403 microcontrolers                                           */
       
  7202     /* PowerPC 403 GA                                                        */
       
  7203     POWERPC_DEF("403GA",         CPU_POWERPC_403GA,                  403),
       
  7204     /* PowerPC 403 GB                                                        */
       
  7205     POWERPC_DEF("403GB",         CPU_POWERPC_403GB,                  403),
       
  7206     /* PowerPC 403 GC                                                        */
       
  7207     POWERPC_DEF("403GC",         CPU_POWERPC_403GC,                  403),
       
  7208     /* PowerPC 403 GCX                                                       */
       
  7209     POWERPC_DEF("403GCX",        CPU_POWERPC_403GCX,                 403GCX),
       
  7210 #if defined (TODO)
       
  7211     /* PowerPC 403 GP                                                        */
       
  7212     POWERPC_DEF("403GP",         CPU_POWERPC_403GP,                  403),
       
  7213 #endif
       
  7214     /* PowerPC 405 family                                                    */
       
  7215     /* Generic PowerPC 405                                                   */
       
  7216     POWERPC_DEF("405",           CPU_POWERPC_405,                    405),
       
  7217     /* PowerPC 405 cores                                                     */
       
  7218 #if defined (TODO)
       
  7219     /* PowerPC 405 A3                                                        */
       
  7220     POWERPC_DEF("405A3",         CPU_POWERPC_405A3,                  405),
       
  7221 #endif
       
  7222 #if defined (TODO)
       
  7223     /* PowerPC 405 A4                                                        */
       
  7224     POWERPC_DEF("405A4",         CPU_POWERPC_405A4,                  405),
       
  7225 #endif
       
  7226 #if defined (TODO)
       
  7227     /* PowerPC 405 B3                                                        */
       
  7228     POWERPC_DEF("405B3",         CPU_POWERPC_405B3,                  405),
       
  7229 #endif
       
  7230 #if defined (TODO)
       
  7231     /* PowerPC 405 B4                                                        */
       
  7232     POWERPC_DEF("405B4",         CPU_POWERPC_405B4,                  405),
       
  7233 #endif
       
  7234 #if defined (TODO)
       
  7235     /* PowerPC 405 C3                                                        */
       
  7236     POWERPC_DEF("405C3",         CPU_POWERPC_405C3,                  405),
       
  7237 #endif
       
  7238 #if defined (TODO)
       
  7239     /* PowerPC 405 C4                                                        */
       
  7240     POWERPC_DEF("405C4",         CPU_POWERPC_405C4,                  405),
       
  7241 #endif
       
  7242     /* PowerPC 405 D2                                                        */
       
  7243     POWERPC_DEF("405D2",         CPU_POWERPC_405D2,                  405),
       
  7244 #if defined (TODO)
       
  7245     /* PowerPC 405 D3                                                        */
       
  7246     POWERPC_DEF("405D3",         CPU_POWERPC_405D3,                  405),
       
  7247 #endif
       
  7248     /* PowerPC 405 D4                                                        */
       
  7249     POWERPC_DEF("405D4",         CPU_POWERPC_405D4,                  405),
       
  7250 #if defined (TODO)
       
  7251     /* PowerPC 405 D5                                                        */
       
  7252     POWERPC_DEF("405D5",         CPU_POWERPC_405D5,                  405),
       
  7253 #endif
       
  7254 #if defined (TODO)
       
  7255     /* PowerPC 405 E4                                                        */
       
  7256     POWERPC_DEF("405E4",         CPU_POWERPC_405E4,                  405),
       
  7257 #endif
       
  7258 #if defined (TODO)
       
  7259     /* PowerPC 405 F4                                                        */
       
  7260     POWERPC_DEF("405F4",         CPU_POWERPC_405F4,                  405),
       
  7261 #endif
       
  7262 #if defined (TODO)
       
  7263     /* PowerPC 405 F5                                                        */
       
  7264     POWERPC_DEF("405F5",         CPU_POWERPC_405F5,                  405),
       
  7265 #endif
       
  7266 #if defined (TODO)
       
  7267     /* PowerPC 405 F6                                                        */
       
  7268     POWERPC_DEF("405F6",         CPU_POWERPC_405F6,                  405),
       
  7269 #endif
       
  7270     /* PowerPC 405 microcontrolers                                           */
       
  7271     /* PowerPC 405 CR                                                        */
       
  7272     POWERPC_DEF("405CR",         CPU_POWERPC_405CR,                  405),
       
  7273     /* PowerPC 405 CRa                                                       */
       
  7274     POWERPC_DEF("405CRa",        CPU_POWERPC_405CRa,                 405),
       
  7275     /* PowerPC 405 CRb                                                       */
       
  7276     POWERPC_DEF("405CRb",        CPU_POWERPC_405CRb,                 405),
       
  7277     /* PowerPC 405 CRc                                                       */
       
  7278     POWERPC_DEF("405CRc",        CPU_POWERPC_405CRc,                 405),
       
  7279     /* PowerPC 405 EP                                                        */
       
  7280     POWERPC_DEF("405EP",         CPU_POWERPC_405EP,                  405),
       
  7281 #if defined(TODO)
       
  7282     /* PowerPC 405 EXr                                                       */
       
  7283     POWERPC_DEF("405EXr",        CPU_POWERPC_405EXr,                 405),
       
  7284 #endif
       
  7285     /* PowerPC 405 EZ                                                        */
       
  7286     POWERPC_DEF("405EZ",         CPU_POWERPC_405EZ,                  405),
       
  7287 #if defined(TODO)
       
  7288     /* PowerPC 405 FX                                                        */
       
  7289     POWERPC_DEF("405FX",         CPU_POWERPC_405FX,                  405),
       
  7290 #endif
       
  7291     /* PowerPC 405 GP                                                        */
       
  7292     POWERPC_DEF("405GP",         CPU_POWERPC_405GP,                  405),
       
  7293     /* PowerPC 405 GPa                                                       */
       
  7294     POWERPC_DEF("405GPa",        CPU_POWERPC_405GPa,                 405),
       
  7295     /* PowerPC 405 GPb                                                       */
       
  7296     POWERPC_DEF("405GPb",        CPU_POWERPC_405GPb,                 405),
       
  7297     /* PowerPC 405 GPc                                                       */
       
  7298     POWERPC_DEF("405GPc",        CPU_POWERPC_405GPc,                 405),
       
  7299     /* PowerPC 405 GPd                                                       */
       
  7300     POWERPC_DEF("405GPd",        CPU_POWERPC_405GPd,                 405),
       
  7301     /* PowerPC 405 GPe                                                       */
       
  7302     POWERPC_DEF("405GPe",        CPU_POWERPC_405GPe,                 405),
       
  7303     /* PowerPC 405 GPR                                                       */
       
  7304     POWERPC_DEF("405GPR",        CPU_POWERPC_405GPR,                 405),
       
  7305 #if defined(TODO)
       
  7306     /* PowerPC 405 H                                                         */
       
  7307     POWERPC_DEF("405H",          CPU_POWERPC_405H,                   405),
       
  7308 #endif
       
  7309 #if defined(TODO)
       
  7310     /* PowerPC 405 L                                                         */
       
  7311     POWERPC_DEF("405L",          CPU_POWERPC_405L,                   405),
       
  7312 #endif
       
  7313     /* PowerPC 405 LP                                                        */
       
  7314     POWERPC_DEF("405LP",         CPU_POWERPC_405LP,                  405),
       
  7315 #if defined(TODO)
       
  7316     /* PowerPC 405 PM                                                        */
       
  7317     POWERPC_DEF("405PM",         CPU_POWERPC_405PM,                  405),
       
  7318 #endif
       
  7319 #if defined(TODO)
       
  7320     /* PowerPC 405 PS                                                        */
       
  7321     POWERPC_DEF("405PS",         CPU_POWERPC_405PS,                  405),
       
  7322 #endif
       
  7323 #if defined(TODO)
       
  7324     /* PowerPC 405 S                                                         */
       
  7325     POWERPC_DEF("405S",          CPU_POWERPC_405S,                   405),
       
  7326 #endif
       
  7327     /* Npe405 H                                                              */
       
  7328     POWERPC_DEF("Npe405H",       CPU_POWERPC_NPE405H,                405),
       
  7329     /* Npe405 H2                                                             */
       
  7330     POWERPC_DEF("Npe405H2",      CPU_POWERPC_NPE405H2,               405),
       
  7331     /* Npe405 L                                                              */
       
  7332     POWERPC_DEF("Npe405L",       CPU_POWERPC_NPE405L,                405),
       
  7333     /* Npe4GS3                                                               */
       
  7334     POWERPC_DEF("Npe4GS3",       CPU_POWERPC_NPE4GS3,                405),
       
  7335 #if defined (TODO)
       
  7336     POWERPC_DEF("Npcxx1",        CPU_POWERPC_NPCxx1,                 405),
       
  7337 #endif
       
  7338 #if defined (TODO)
       
  7339     POWERPC_DEF("Npr161",        CPU_POWERPC_NPR161,                 405),
       
  7340 #endif
       
  7341 #if defined (TODO)
       
  7342     /* PowerPC LC77700 (Sanyo)                                               */
       
  7343     POWERPC_DEF("LC77700",       CPU_POWERPC_LC77700,                405),
       
  7344 #endif
       
  7345     /* PowerPC 401/403/405 based set-top-box microcontrolers                 */
       
  7346 #if defined (TODO)
       
  7347     /* STB010000                                                             */
       
  7348     POWERPC_DEF("STB01000",      CPU_POWERPC_STB01000,               401x2),
       
  7349 #endif
       
  7350 #if defined (TODO)
       
  7351     /* STB01010                                                              */
       
  7352     POWERPC_DEF("STB01010",      CPU_POWERPC_STB01010,               401x2),
       
  7353 #endif
       
  7354 #if defined (TODO)
       
  7355     /* STB0210                                                               */
       
  7356     POWERPC_DEF("STB0210",       CPU_POWERPC_STB0210,                401x3),
       
  7357 #endif
       
  7358     /* STB03xx                                                               */
       
  7359     POWERPC_DEF("STB03",         CPU_POWERPC_STB03,                  405),
       
  7360 #if defined (TODO)
       
  7361     /* STB043x                                                               */
       
  7362     POWERPC_DEF("STB043",        CPU_POWERPC_STB043,                 405),
       
  7363 #endif
       
  7364 #if defined (TODO)
       
  7365     /* STB045x                                                               */
       
  7366     POWERPC_DEF("STB045",        CPU_POWERPC_STB045,                 405),
       
  7367 #endif
       
  7368     /* STB04xx                                                               */
       
  7369     POWERPC_DEF("STB04",         CPU_POWERPC_STB04,                  405),
       
  7370     /* STB25xx                                                               */
       
  7371     POWERPC_DEF("STB25",         CPU_POWERPC_STB25,                  405),
       
  7372 #if defined (TODO)
       
  7373     /* STB130                                                                */
       
  7374     POWERPC_DEF("STB130",        CPU_POWERPC_STB130,                 405),
       
  7375 #endif
       
  7376     /* Xilinx PowerPC 405 cores                                              */
       
  7377     POWERPC_DEF("x2vp4",         CPU_POWERPC_X2VP4,                  405),
       
  7378     POWERPC_DEF("x2vp7",         CPU_POWERPC_X2VP7,                  405),
       
  7379     POWERPC_DEF("x2vp20",        CPU_POWERPC_X2VP20,                 405),
       
  7380     POWERPC_DEF("x2vp50",        CPU_POWERPC_X2VP50,                 405),
       
  7381 #if defined (TODO)
       
  7382     /* Zarlink ZL10310                                                       */
       
  7383     POWERPC_DEF("zl10310",       CPU_POWERPC_ZL10310,                405),
       
  7384 #endif
       
  7385 #if defined (TODO)
       
  7386     /* Zarlink ZL10311                                                       */
       
  7387     POWERPC_DEF("zl10311",       CPU_POWERPC_ZL10311,                405),
       
  7388 #endif
       
  7389 #if defined (TODO)
       
  7390     /* Zarlink ZL10320                                                       */
       
  7391     POWERPC_DEF("zl10320",       CPU_POWERPC_ZL10320,                405),
       
  7392 #endif
       
  7393 #if defined (TODO)
       
  7394     /* Zarlink ZL10321                                                       */
       
  7395     POWERPC_DEF("zl10321",       CPU_POWERPC_ZL10321,                405),
       
  7396 #endif
       
  7397     /* PowerPC 440 family                                                    */
       
  7398 #if defined(TODO_USER_ONLY)
       
  7399     /* Generic PowerPC 440                                                   */
       
  7400     POWERPC_DEF("440",           CPU_POWERPC_440,                    440GP),
       
  7401 #endif
       
  7402     /* PowerPC 440 cores                                                     */
       
  7403 #if defined (TODO)
       
  7404     /* PowerPC 440 A4                                                        */
       
  7405     POWERPC_DEF("440A4",         CPU_POWERPC_440A4,                  440x4),
       
  7406 #endif
       
  7407 #if defined (TODO)
       
  7408     /* PowerPC 440 A5                                                        */
       
  7409     POWERPC_DEF("440A5",         CPU_POWERPC_440A5,                  440x5),
       
  7410 #endif
       
  7411 #if defined (TODO)
       
  7412     /* PowerPC 440 B4                                                        */
       
  7413     POWERPC_DEF("440B4",         CPU_POWERPC_440B4,                  440x4),
       
  7414 #endif
       
  7415 #if defined (TODO)
       
  7416     /* PowerPC 440 G4                                                        */
       
  7417     POWERPC_DEF("440G4",         CPU_POWERPC_440G4,                  440x4),
       
  7418 #endif
       
  7419 #if defined (TODO)
       
  7420     /* PowerPC 440 F5                                                        */
       
  7421     POWERPC_DEF("440F5",         CPU_POWERPC_440F5,                  440x5),
       
  7422 #endif
       
  7423 #if defined (TODO)
       
  7424     /* PowerPC 440 G5                                                        */
       
  7425     POWERPC_DEF("440G5",         CPU_POWERPC_440G5,                  440x5),
       
  7426 #endif
       
  7427 #if defined (TODO)
       
  7428     /* PowerPC 440H4                                                         */
       
  7429     POWERPC_DEF("440H4",         CPU_POWERPC_440H4,                  440x4),
       
  7430 #endif
       
  7431 #if defined (TODO)
       
  7432     /* PowerPC 440H6                                                         */
       
  7433     POWERPC_DEF("440H6",         CPU_POWERPC_440H6,                  440Gx5),
       
  7434 #endif
       
  7435     /* PowerPC 440 microcontrolers                                           */
       
  7436 #if defined(TODO_USER_ONLY)
       
  7437     /* PowerPC 440 EP                                                        */
       
  7438     POWERPC_DEF("440EP",         CPU_POWERPC_440EP,                  440EP),
       
  7439 #endif
       
  7440 #if defined(TODO_USER_ONLY)
       
  7441     /* PowerPC 440 EPa                                                       */
       
  7442     POWERPC_DEF("440EPa",        CPU_POWERPC_440EPa,                 440EP),
       
  7443 #endif
       
  7444 #if defined(TODO_USER_ONLY)
       
  7445     /* PowerPC 440 EPb                                                       */
       
  7446     POWERPC_DEF("440EPb",        CPU_POWERPC_440EPb,                 440EP),
       
  7447 #endif
       
  7448 #if defined(TODO_USER_ONLY)
       
  7449     /* PowerPC 440 EPX                                                       */
       
  7450     POWERPC_DEF("440EPX",        CPU_POWERPC_440EPX,                 440EP),
       
  7451 #endif
       
  7452 #if defined(TODO_USER_ONLY)
       
  7453     /* PowerPC 440 GP                                                        */
       
  7454     POWERPC_DEF("440GP",         CPU_POWERPC_440GP,                  440GP),
       
  7455 #endif
       
  7456 #if defined(TODO_USER_ONLY)
       
  7457     /* PowerPC 440 GPb                                                       */
       
  7458     POWERPC_DEF("440GPb",        CPU_POWERPC_440GPb,                 440GP),
       
  7459 #endif
       
  7460 #if defined(TODO_USER_ONLY)
       
  7461     /* PowerPC 440 GPc                                                       */
       
  7462     POWERPC_DEF("440GPc",        CPU_POWERPC_440GPc,                 440GP),
       
  7463 #endif
       
  7464 #if defined(TODO_USER_ONLY)
       
  7465     /* PowerPC 440 GR                                                        */
       
  7466     POWERPC_DEF("440GR",         CPU_POWERPC_440GR,                  440x5),
       
  7467 #endif
       
  7468 #if defined(TODO_USER_ONLY)
       
  7469     /* PowerPC 440 GRa                                                       */
       
  7470     POWERPC_DEF("440GRa",        CPU_POWERPC_440GRa,                 440x5),
       
  7471 #endif
       
  7472 #if defined(TODO_USER_ONLY)
       
  7473     /* PowerPC 440 GRX                                                       */
       
  7474     POWERPC_DEF("440GRX",        CPU_POWERPC_440GRX,                 440x5),
       
  7475 #endif
       
  7476 #if defined(TODO_USER_ONLY)
       
  7477     /* PowerPC 440 GX                                                        */
       
  7478     POWERPC_DEF("440GX",         CPU_POWERPC_440GX,                  440EP),
       
  7479 #endif
       
  7480 #if defined(TODO_USER_ONLY)
       
  7481     /* PowerPC 440 GXa                                                       */
       
  7482     POWERPC_DEF("440GXa",        CPU_POWERPC_440GXa,                 440EP),
       
  7483 #endif
       
  7484 #if defined(TODO_USER_ONLY)
       
  7485     /* PowerPC 440 GXb                                                       */
       
  7486     POWERPC_DEF("440GXb",        CPU_POWERPC_440GXb,                 440EP),
       
  7487 #endif
       
  7488 #if defined(TODO_USER_ONLY)
       
  7489     /* PowerPC 440 GXc                                                       */
       
  7490     POWERPC_DEF("440GXc",        CPU_POWERPC_440GXc,                 440EP),
       
  7491 #endif
       
  7492 #if defined(TODO_USER_ONLY)
       
  7493     /* PowerPC 440 GXf                                                       */
       
  7494     POWERPC_DEF("440GXf",        CPU_POWERPC_440GXf,                 440EP),
       
  7495 #endif
       
  7496 #if defined(TODO)
       
  7497     /* PowerPC 440 S                                                         */
       
  7498     POWERPC_DEF("440S",          CPU_POWERPC_440S,                   440),
       
  7499 #endif
       
  7500 #if defined(TODO_USER_ONLY)
       
  7501     /* PowerPC 440 SP                                                        */
       
  7502     POWERPC_DEF("440SP",         CPU_POWERPC_440SP,                  440EP),
       
  7503 #endif
       
  7504 #if defined(TODO_USER_ONLY)
       
  7505     /* PowerPC 440 SP2                                                       */
       
  7506     POWERPC_DEF("440SP2",        CPU_POWERPC_440SP2,                 440EP),
       
  7507 #endif
       
  7508 #if defined(TODO_USER_ONLY)
       
  7509     /* PowerPC 440 SPE                                                       */
       
  7510     POWERPC_DEF("440SPE",        CPU_POWERPC_440SPE,                 440EP),
       
  7511 #endif
       
  7512     /* PowerPC 460 family                                                    */
       
  7513 #if defined (TODO)
       
  7514     /* Generic PowerPC 464                                                   */
       
  7515     POWERPC_DEF("464",           CPU_POWERPC_464,                    460),
       
  7516 #endif
       
  7517     /* PowerPC 464 microcontrolers                                           */
       
  7518 #if defined (TODO)
       
  7519     /* PowerPC 464H90                                                        */
       
  7520     POWERPC_DEF("464H90",        CPU_POWERPC_464H90,                 460),
       
  7521 #endif
       
  7522 #if defined (TODO)
       
  7523     /* PowerPC 464H90F                                                       */
       
  7524     POWERPC_DEF("464H90F",       CPU_POWERPC_464H90F,                460F),
       
  7525 #endif
       
  7526     /* Freescale embedded PowerPC cores                                      */
       
  7527     /* MPC5xx family (aka RCPU)                                              */
       
  7528 #if defined(TODO_USER_ONLY)
       
  7529     /* Generic MPC5xx core                                                   */
       
  7530     POWERPC_DEF("MPC5xx",        CPU_POWERPC_MPC5xx,                 MPC5xx),
       
  7531 #endif
       
  7532 #if defined(TODO_USER_ONLY)
       
  7533     /* Codename for MPC5xx core                                              */
       
  7534     POWERPC_DEF("RCPU",          CPU_POWERPC_MPC5xx,                 MPC5xx),
       
  7535 #endif
       
  7536     /* MPC5xx microcontrollers                                               */
       
  7537 #if defined(TODO_USER_ONLY)
       
  7538     /* MGT560                                                                */
       
  7539     POWERPC_DEF("MGT560",        CPU_POWERPC_MGT560,                 MPC5xx),
       
  7540 #endif
       
  7541 #if defined(TODO_USER_ONLY)
       
  7542     /* MPC509                                                                */
       
  7543     POWERPC_DEF("MPC509",        CPU_POWERPC_MPC509,                 MPC5xx),
       
  7544 #endif
       
  7545 #if defined(TODO_USER_ONLY)
       
  7546     /* MPC533                                                                */
       
  7547     POWERPC_DEF("MPC533",        CPU_POWERPC_MPC533,                 MPC5xx),
       
  7548 #endif
       
  7549 #if defined(TODO_USER_ONLY)
       
  7550     /* MPC534                                                                */
       
  7551     POWERPC_DEF("MPC534",        CPU_POWERPC_MPC534,                 MPC5xx),
       
  7552 #endif
       
  7553 #if defined(TODO_USER_ONLY)
       
  7554     /* MPC555                                                                */
       
  7555     POWERPC_DEF("MPC555",        CPU_POWERPC_MPC555,                 MPC5xx),
       
  7556 #endif
       
  7557 #if defined(TODO_USER_ONLY)
       
  7558     /* MPC556                                                                */
       
  7559     POWERPC_DEF("MPC556",        CPU_POWERPC_MPC556,                 MPC5xx),
       
  7560 #endif
       
  7561 #if defined(TODO_USER_ONLY)
       
  7562     /* MPC560                                                                */
       
  7563     POWERPC_DEF("MPC560",        CPU_POWERPC_MPC560,                 MPC5xx),
       
  7564 #endif
       
  7565 #if defined(TODO_USER_ONLY)
       
  7566     /* MPC561                                                                */
       
  7567     POWERPC_DEF("MPC561",        CPU_POWERPC_MPC561,                 MPC5xx),
       
  7568 #endif
       
  7569 #if defined(TODO_USER_ONLY)
       
  7570     /* MPC562                                                                */
       
  7571     POWERPC_DEF("MPC562",        CPU_POWERPC_MPC562,                 MPC5xx),
       
  7572 #endif
       
  7573 #if defined(TODO_USER_ONLY)
       
  7574     /* MPC563                                                                */
       
  7575     POWERPC_DEF("MPC563",        CPU_POWERPC_MPC563,                 MPC5xx),
       
  7576 #endif
       
  7577 #if defined(TODO_USER_ONLY)
       
  7578     /* MPC564                                                                */
       
  7579     POWERPC_DEF("MPC564",        CPU_POWERPC_MPC564,                 MPC5xx),
       
  7580 #endif
       
  7581 #if defined(TODO_USER_ONLY)
       
  7582     /* MPC565                                                                */
       
  7583     POWERPC_DEF("MPC565",        CPU_POWERPC_MPC565,                 MPC5xx),
       
  7584 #endif
       
  7585 #if defined(TODO_USER_ONLY)
       
  7586     /* MPC566                                                                */
       
  7587     POWERPC_DEF("MPC566",        CPU_POWERPC_MPC566,                 MPC5xx),
       
  7588 #endif
       
  7589     /* MPC8xx family (aka PowerQUICC)                                        */
       
  7590 #if defined(TODO_USER_ONLY)
       
  7591     /* Generic MPC8xx core                                                   */
       
  7592     POWERPC_DEF("MPC8xx",        CPU_POWERPC_MPC8xx,                 MPC8xx),
       
  7593 #endif
       
  7594 #if defined(TODO_USER_ONLY)
       
  7595     /* Codename for MPC8xx core                                              */
       
  7596     POWERPC_DEF("PowerQUICC",    CPU_POWERPC_MPC8xx,                 MPC8xx),
       
  7597 #endif
       
  7598     /* MPC8xx microcontrollers                                               */
       
  7599 #if defined(TODO_USER_ONLY)
       
  7600     /* MGT823                                                                */
       
  7601     POWERPC_DEF("MGT823",        CPU_POWERPC_MGT823,                 MPC8xx),
       
  7602 #endif
       
  7603 #if defined(TODO_USER_ONLY)
       
  7604     /* MPC821                                                                */
       
  7605     POWERPC_DEF("MPC821",        CPU_POWERPC_MPC821,                 MPC8xx),
       
  7606 #endif
       
  7607 #if defined(TODO_USER_ONLY)
       
  7608     /* MPC823                                                                */
       
  7609     POWERPC_DEF("MPC823",        CPU_POWERPC_MPC823,                 MPC8xx),
       
  7610 #endif
       
  7611 #if defined(TODO_USER_ONLY)
       
  7612     /* MPC850                                                                */
       
  7613     POWERPC_DEF("MPC850",        CPU_POWERPC_MPC850,                 MPC8xx),
       
  7614 #endif
       
  7615 #if defined(TODO_USER_ONLY)
       
  7616     /* MPC852T                                                               */
       
  7617     POWERPC_DEF("MPC852T",       CPU_POWERPC_MPC852T,                MPC8xx),
       
  7618 #endif
       
  7619 #if defined(TODO_USER_ONLY)
       
  7620     /* MPC855T                                                               */
       
  7621     POWERPC_DEF("MPC855T",       CPU_POWERPC_MPC855T,                MPC8xx),
       
  7622 #endif
       
  7623 #if defined(TODO_USER_ONLY)
       
  7624     /* MPC857                                                                */
       
  7625     POWERPC_DEF("MPC857",        CPU_POWERPC_MPC857,                 MPC8xx),
       
  7626 #endif
       
  7627 #if defined(TODO_USER_ONLY)
       
  7628     /* MPC859                                                                */
       
  7629     POWERPC_DEF("MPC859",        CPU_POWERPC_MPC859,                 MPC8xx),
       
  7630 #endif
       
  7631 #if defined(TODO_USER_ONLY)
       
  7632     /* MPC860                                                                */
       
  7633     POWERPC_DEF("MPC860",        CPU_POWERPC_MPC860,                 MPC8xx),
       
  7634 #endif
       
  7635 #if defined(TODO_USER_ONLY)
       
  7636     /* MPC862                                                                */
       
  7637     POWERPC_DEF("MPC862",        CPU_POWERPC_MPC862,                 MPC8xx),
       
  7638 #endif
       
  7639 #if defined(TODO_USER_ONLY)
       
  7640     /* MPC866                                                                */
       
  7641     POWERPC_DEF("MPC866",        CPU_POWERPC_MPC866,                 MPC8xx),
       
  7642 #endif
       
  7643 #if defined(TODO_USER_ONLY)
       
  7644     /* MPC870                                                                */
       
  7645     POWERPC_DEF("MPC870",        CPU_POWERPC_MPC870,                 MPC8xx),
       
  7646 #endif
       
  7647 #if defined(TODO_USER_ONLY)
       
  7648     /* MPC875                                                                */
       
  7649     POWERPC_DEF("MPC875",        CPU_POWERPC_MPC875,                 MPC8xx),
       
  7650 #endif
       
  7651 #if defined(TODO_USER_ONLY)
       
  7652     /* MPC880                                                                */
       
  7653     POWERPC_DEF("MPC880",        CPU_POWERPC_MPC880,                 MPC8xx),
       
  7654 #endif
       
  7655 #if defined(TODO_USER_ONLY)
       
  7656     /* MPC885                                                                */
       
  7657     POWERPC_DEF("MPC885",        CPU_POWERPC_MPC885,                 MPC8xx),
       
  7658 #endif
       
  7659     /* MPC82xx family (aka PowerQUICC-II)                                    */
       
  7660     /* Generic MPC52xx core                                                  */
       
  7661     POWERPC_DEF_SVR("MPC52xx",
       
  7662                     CPU_POWERPC_MPC52xx,      POWERPC_SVR_52xx,      G2LE),
       
  7663     /* Generic MPC82xx core                                                  */
       
  7664     POWERPC_DEF("MPC82xx",       CPU_POWERPC_MPC82xx,                G2),
       
  7665     /* Codename for MPC82xx                                                  */
       
  7666     POWERPC_DEF("PowerQUICC-II", CPU_POWERPC_MPC82xx,                G2),
       
  7667     /* PowerPC G2 core                                                       */
       
  7668     POWERPC_DEF("G2",            CPU_POWERPC_G2,                     G2),
       
  7669     /* PowerPC G2 H4 core                                                    */
       
  7670     POWERPC_DEF("G2H4",          CPU_POWERPC_G2H4,                   G2),
       
  7671     /* PowerPC G2 GP core                                                    */
       
  7672     POWERPC_DEF("G2GP",          CPU_POWERPC_G2gp,                   G2),
       
  7673     /* PowerPC G2 LS core                                                    */
       
  7674     POWERPC_DEF("G2LS",          CPU_POWERPC_G2ls,                   G2),
       
  7675     /* PowerPC G2 HiP3 core                                                  */
       
  7676     POWERPC_DEF("G2HiP3",        CPU_POWERPC_G2_HIP3,                G2),
       
  7677     /* PowerPC G2 HiP4 core                                                  */
       
  7678     POWERPC_DEF("G2HiP4",        CPU_POWERPC_G2_HIP4,                G2),
       
  7679     /* PowerPC MPC603 core                                                   */
       
  7680     POWERPC_DEF("MPC603",        CPU_POWERPC_MPC603,                 603E),
       
  7681     /* PowerPC G2le core (same as G2 plus little-endian mode support)        */
       
  7682     POWERPC_DEF("G2le",          CPU_POWERPC_G2LE,                   G2LE),
       
  7683     /* PowerPC G2LE GP core                                                  */
       
  7684     POWERPC_DEF("G2leGP",        CPU_POWERPC_G2LEgp,                 G2LE),
       
  7685     /* PowerPC G2LE LS core                                                  */
       
  7686     POWERPC_DEF("G2leLS",        CPU_POWERPC_G2LEls,                 G2LE),
       
  7687     /* PowerPC G2LE GP1 core                                                 */
       
  7688     POWERPC_DEF("G2leGP1",       CPU_POWERPC_G2LEgp1,                G2LE),
       
  7689     /* PowerPC G2LE GP3 core                                                 */
       
  7690     POWERPC_DEF("G2leGP3",       CPU_POWERPC_G2LEgp1,                G2LE),
       
  7691     /* PowerPC MPC603 microcontrollers                                       */
       
  7692     /* MPC8240                                                               */
       
  7693     POWERPC_DEF("MPC8240",       CPU_POWERPC_MPC8240,                603E),
       
  7694     /* PowerPC G2 microcontrollers                                           */
       
  7695 #if defined(TODO)
       
  7696     /* MPC5121                                                               */
       
  7697     POWERPC_DEF_SVR("MPC5121",
       
  7698                     CPU_POWERPC_MPC5121,      POWERPC_SVR_5121,      G2LE),
       
  7699 #endif
       
  7700     /* MPC5200                                                               */
       
  7701     POWERPC_DEF_SVR("MPC5200",
       
  7702                     CPU_POWERPC_MPC5200,      POWERPC_SVR_5200,      G2LE),
       
  7703     /* MPC5200 v1.0                                                          */
       
  7704     POWERPC_DEF_SVR("MPC5200_v10",
       
  7705                     CPU_POWERPC_MPC5200_v10,  POWERPC_SVR_5200_v10,  G2LE),
       
  7706     /* MPC5200 v1.1                                                          */
       
  7707     POWERPC_DEF_SVR("MPC5200_v11",
       
  7708                     CPU_POWERPC_MPC5200_v11,  POWERPC_SVR_5200_v11,  G2LE),
       
  7709     /* MPC5200 v1.2                                                          */
       
  7710     POWERPC_DEF_SVR("MPC5200_v12",
       
  7711                     CPU_POWERPC_MPC5200_v12,  POWERPC_SVR_5200_v12,  G2LE),
       
  7712     /* MPC5200B                                                              */
       
  7713     POWERPC_DEF_SVR("MPC5200B",
       
  7714                     CPU_POWERPC_MPC5200B,     POWERPC_SVR_5200B,     G2LE),
       
  7715     /* MPC5200B v2.0                                                         */
       
  7716     POWERPC_DEF_SVR("MPC5200B_v20",
       
  7717                     CPU_POWERPC_MPC5200B_v20, POWERPC_SVR_5200B_v20, G2LE),
       
  7718     /* MPC5200B v2.1                                                         */
       
  7719     POWERPC_DEF_SVR("MPC5200B_v21",
       
  7720                     CPU_POWERPC_MPC5200B_v21, POWERPC_SVR_5200B_v21, G2LE),
       
  7721     /* MPC8241                                                               */
       
  7722     POWERPC_DEF("MPC8241",       CPU_POWERPC_MPC8241,                G2),
       
  7723     /* MPC8245                                                               */
       
  7724     POWERPC_DEF("MPC8245",       CPU_POWERPC_MPC8245,                G2),
       
  7725     /* MPC8247                                                               */
       
  7726     POWERPC_DEF("MPC8247",       CPU_POWERPC_MPC8247,                G2LE),
       
  7727     /* MPC8248                                                               */
       
  7728     POWERPC_DEF("MPC8248",       CPU_POWERPC_MPC8248,                G2LE),
       
  7729     /* MPC8250                                                               */
       
  7730     POWERPC_DEF("MPC8250",       CPU_POWERPC_MPC8250,                G2),
       
  7731     /* MPC8250 HiP3                                                          */
       
  7732     POWERPC_DEF("MPC8250_HiP3",  CPU_POWERPC_MPC8250_HiP3,           G2),
       
  7733     /* MPC8250 HiP4                                                          */
       
  7734     POWERPC_DEF("MPC8250_HiP4",  CPU_POWERPC_MPC8250_HiP4,           G2),
       
  7735     /* MPC8255                                                               */
       
  7736     POWERPC_DEF("MPC8255",       CPU_POWERPC_MPC8255,                G2),
       
  7737     /* MPC8255 HiP3                                                          */
       
  7738     POWERPC_DEF("MPC8255_HiP3",  CPU_POWERPC_MPC8255_HiP3,           G2),
       
  7739     /* MPC8255 HiP4                                                          */
       
  7740     POWERPC_DEF("MPC8255_HiP4",  CPU_POWERPC_MPC8255_HiP4,           G2),
       
  7741     /* MPC8260                                                               */
       
  7742     POWERPC_DEF("MPC8260",       CPU_POWERPC_MPC8260,                G2),
       
  7743     /* MPC8260 HiP3                                                          */
       
  7744     POWERPC_DEF("MPC8260_HiP3",  CPU_POWERPC_MPC8260_HiP3,           G2),
       
  7745     /* MPC8260 HiP4                                                          */
       
  7746     POWERPC_DEF("MPC8260_HiP4",  CPU_POWERPC_MPC8260_HiP4,           G2),
       
  7747     /* MPC8264                                                               */
       
  7748     POWERPC_DEF("MPC8264",       CPU_POWERPC_MPC8264,                G2),
       
  7749     /* MPC8264 HiP3                                                          */
       
  7750     POWERPC_DEF("MPC8264_HiP3",  CPU_POWERPC_MPC8264_HiP3,           G2),
       
  7751     /* MPC8264 HiP4                                                          */
       
  7752     POWERPC_DEF("MPC8264_HiP4",  CPU_POWERPC_MPC8264_HiP4,           G2),
       
  7753     /* MPC8265                                                               */
       
  7754     POWERPC_DEF("MPC8265",       CPU_POWERPC_MPC8265,                G2),
       
  7755     /* MPC8265 HiP3                                                          */
       
  7756     POWERPC_DEF("MPC8265_HiP3",  CPU_POWERPC_MPC8265_HiP3,           G2),
       
  7757     /* MPC8265 HiP4                                                          */
       
  7758     POWERPC_DEF("MPC8265_HiP4",  CPU_POWERPC_MPC8265_HiP4,           G2),
       
  7759     /* MPC8266                                                               */
       
  7760     POWERPC_DEF("MPC8266",       CPU_POWERPC_MPC8266,                G2),
       
  7761     /* MPC8266 HiP3                                                          */
       
  7762     POWERPC_DEF("MPC8266_HiP3",  CPU_POWERPC_MPC8266_HiP3,           G2),
       
  7763     /* MPC8266 HiP4                                                          */
       
  7764     POWERPC_DEF("MPC8266_HiP4",  CPU_POWERPC_MPC8266_HiP4,           G2),
       
  7765     /* MPC8270                                                               */
       
  7766     POWERPC_DEF("MPC8270",       CPU_POWERPC_MPC8270,                G2LE),
       
  7767     /* MPC8271                                                               */
       
  7768     POWERPC_DEF("MPC8271",       CPU_POWERPC_MPC8271,                G2LE),
       
  7769     /* MPC8272                                                               */
       
  7770     POWERPC_DEF("MPC8272",       CPU_POWERPC_MPC8272,                G2LE),
       
  7771     /* MPC8275                                                               */
       
  7772     POWERPC_DEF("MPC8275",       CPU_POWERPC_MPC8275,                G2LE),
       
  7773     /* MPC8280                                                               */
       
  7774     POWERPC_DEF("MPC8280",       CPU_POWERPC_MPC8280,                G2LE),
       
  7775     /* e200 family                                                           */
       
  7776     /* Generic PowerPC e200 core                                             */
       
  7777     POWERPC_DEF("e200",          CPU_POWERPC_e200,                   e200),
       
  7778     /* Generic MPC55xx core                                                  */
       
  7779 #if defined (TODO)
       
  7780     POWERPC_DEF_SVR("MPC55xx",
       
  7781                     CPU_POWERPC_MPC55xx,      POWERPC_SVR_55xx,      e200),
       
  7782 #endif
       
  7783 #if defined (TODO)
       
  7784     /* PowerPC e200z0 core                                                   */
       
  7785     POWERPC_DEF("e200z0",        CPU_POWERPC_e200z0,                 e200),
       
  7786 #endif
       
  7787 #if defined (TODO)
       
  7788     /* PowerPC e200z1 core                                                   */
       
  7789     POWERPC_DEF("e200z1",        CPU_POWERPC_e200z1,                 e200),
       
  7790 #endif
       
  7791 #if defined (TODO)
       
  7792     /* PowerPC e200z3 core                                                   */
       
  7793     POWERPC_DEF("e200z3",        CPU_POWERPC_e200z3,                 e200),
       
  7794 #endif
       
  7795     /* PowerPC e200z5 core                                                   */
       
  7796     POWERPC_DEF("e200z5",        CPU_POWERPC_e200z5,                 e200),
       
  7797     /* PowerPC e200z6 core                                                   */
       
  7798     POWERPC_DEF("e200z6",        CPU_POWERPC_e200z6,                 e200),
       
  7799     /* PowerPC e200 microcontrollers                                         */
       
  7800 #if defined (TODO)
       
  7801     /* MPC5514E                                                              */
       
  7802     POWERPC_DEF_SVR("MPC5514E",
       
  7803                     CPU_POWERPC_MPC5514E,     POWERPC_SVR_5514E,     e200),
       
  7804 #endif
       
  7805 #if defined (TODO)
       
  7806     /* MPC5514E v0                                                           */
       
  7807     POWERPC_DEF_SVR("MPC5514E_v0",
       
  7808                     CPU_POWERPC_MPC5514E_v0,  POWERPC_SVR_5514E_v0,  e200),
       
  7809 #endif
       
  7810 #if defined (TODO)
       
  7811     /* MPC5514E v1                                                           */
       
  7812     POWERPC_DEF_SVR("MPC5514E_v1",
       
  7813                     CPU_POWERPC_MPC5514E_v1,  POWERPC_SVR_5514E_v1,  e200),
       
  7814 #endif
       
  7815 #if defined (TODO)
       
  7816     /* MPC5514G                                                              */
       
  7817     POWERPC_DEF_SVR("MPC5514G",
       
  7818                     CPU_POWERPC_MPC5514G,     POWERPC_SVR_5514G,     e200),
       
  7819 #endif
       
  7820 #if defined (TODO)
       
  7821     /* MPC5514G v0                                                           */
       
  7822     POWERPC_DEF_SVR("MPC5514G_v0",
       
  7823                     CPU_POWERPC_MPC5514G_v0,  POWERPC_SVR_5514G_v0,  e200),
       
  7824 #endif
       
  7825 #if defined (TODO)
       
  7826     /* MPC5514G v1                                                           */
       
  7827     POWERPC_DEF_SVR("MPC5514G_v1",
       
  7828                     CPU_POWERPC_MPC5514G_v1,  POWERPC_SVR_5514G_v1,  e200),
       
  7829 #endif
       
  7830 #if defined (TODO)
       
  7831     /* MPC5515S                                                              */
       
  7832     POWERPC_DEF_SVR("MPC5515S",
       
  7833                     CPU_POWERPC_MPC5515S,     POWERPC_SVR_5515S,     e200),
       
  7834 #endif
       
  7835 #if defined (TODO)
       
  7836     /* MPC5516E                                                              */
       
  7837     POWERPC_DEF_SVR("MPC5516E",
       
  7838                     CPU_POWERPC_MPC5516E,     POWERPC_SVR_5516E,     e200),
       
  7839 #endif
       
  7840 #if defined (TODO)
       
  7841     /* MPC5516E v0                                                           */
       
  7842     POWERPC_DEF_SVR("MPC5516E_v0",
       
  7843                     CPU_POWERPC_MPC5516E_v0,  POWERPC_SVR_5516E_v0,  e200),
       
  7844 #endif
       
  7845 #if defined (TODO)
       
  7846     /* MPC5516E v1                                                           */
       
  7847     POWERPC_DEF_SVR("MPC5516E_v1",
       
  7848                     CPU_POWERPC_MPC5516E_v1,  POWERPC_SVR_5516E_v1,  e200),
       
  7849 #endif
       
  7850 #if defined (TODO)
       
  7851     /* MPC5516G                                                              */
       
  7852     POWERPC_DEF_SVR("MPC5516G",
       
  7853                     CPU_POWERPC_MPC5516G,     POWERPC_SVR_5516G,     e200),
       
  7854 #endif
       
  7855 #if defined (TODO)
       
  7856     /* MPC5516G v0                                                           */
       
  7857     POWERPC_DEF_SVR("MPC5516G_v0",
       
  7858                     CPU_POWERPC_MPC5516G_v0,  POWERPC_SVR_5516G_v0,  e200),
       
  7859 #endif
       
  7860 #if defined (TODO)
       
  7861     /* MPC5516G v1                                                           */
       
  7862     POWERPC_DEF_SVR("MPC5516G_v1",
       
  7863                     CPU_POWERPC_MPC5516G_v1,  POWERPC_SVR_5516G_v1,  e200),
       
  7864 #endif
       
  7865 #if defined (TODO)
       
  7866     /* MPC5516S                                                              */
       
  7867     POWERPC_DEF_SVR("MPC5516S",
       
  7868                     CPU_POWERPC_MPC5516S,     POWERPC_SVR_5516S,     e200),
       
  7869 #endif
       
  7870 #if defined (TODO)
       
  7871     /* MPC5533                                                               */
       
  7872     POWERPC_DEF_SVR("MPC5533",
       
  7873                     CPU_POWERPC_MPC5533,      POWERPC_SVR_5533,      e200),
       
  7874 #endif
       
  7875 #if defined (TODO)
       
  7876     /* MPC5534                                                               */
       
  7877     POWERPC_DEF_SVR("MPC5534",
       
  7878                     CPU_POWERPC_MPC5534,      POWERPC_SVR_5534,      e200),
       
  7879 #endif
       
  7880 #if defined (TODO)
       
  7881     /* MPC5553                                                               */
       
  7882     POWERPC_DEF_SVR("MPC5553",
       
  7883                     CPU_POWERPC_MPC5553,      POWERPC_SVR_5553,      e200),
       
  7884 #endif
       
  7885 #if defined (TODO)
       
  7886     /* MPC5554                                                               */
       
  7887     POWERPC_DEF_SVR("MPC5554",
       
  7888                     CPU_POWERPC_MPC5554,      POWERPC_SVR_5554,      e200),
       
  7889 #endif
       
  7890 #if defined (TODO)
       
  7891     /* MPC5561                                                               */
       
  7892     POWERPC_DEF_SVR("MPC5561",
       
  7893                     CPU_POWERPC_MPC5561,      POWERPC_SVR_5561,      e200),
       
  7894 #endif
       
  7895 #if defined (TODO)
       
  7896     /* MPC5565                                                               */
       
  7897     POWERPC_DEF_SVR("MPC5565",
       
  7898                     CPU_POWERPC_MPC5565,      POWERPC_SVR_5565,      e200),
       
  7899 #endif
       
  7900 #if defined (TODO)
       
  7901     /* MPC5566                                                               */
       
  7902     POWERPC_DEF_SVR("MPC5566",
       
  7903                     CPU_POWERPC_MPC5566,      POWERPC_SVR_5566,      e200),
       
  7904 #endif
       
  7905 #if defined (TODO)
       
  7906     /* MPC5567                                                               */
       
  7907     POWERPC_DEF_SVR("MPC5567",
       
  7908                     CPU_POWERPC_MPC5567,      POWERPC_SVR_5567,      e200),
       
  7909 #endif
       
  7910     /* e300 family                                                           */
       
  7911     /* Generic PowerPC e300 core                                             */
       
  7912     POWERPC_DEF("e300",          CPU_POWERPC_e300,                   e300),
       
  7913     /* PowerPC e300c1 core                                                   */
       
  7914     POWERPC_DEF("e300c1",        CPU_POWERPC_e300c1,                 e300),
       
  7915     /* PowerPC e300c2 core                                                   */
       
  7916     POWERPC_DEF("e300c2",        CPU_POWERPC_e300c2,                 e300),
       
  7917     /* PowerPC e300c3 core                                                   */
       
  7918     POWERPC_DEF("e300c3",        CPU_POWERPC_e300c3,                 e300),
       
  7919     /* PowerPC e300c4 core                                                   */
       
  7920     POWERPC_DEF("e300c4",        CPU_POWERPC_e300c4,                 e300),
       
  7921     /* PowerPC e300 microcontrollers                                         */
       
  7922 #if defined (TODO)
       
  7923     /* MPC8313                                                               */
       
  7924     POWERPC_DEF_SVR("MPC8313",
       
  7925                     CPU_POWERPC_MPC8313,      POWERPC_SVR_8313,      e300),
       
  7926 #endif
       
  7927 #if defined (TODO)
       
  7928     /* MPC8313E                                                              */
       
  7929     POWERPC_DEF_SVR("MPC8313E",
       
  7930                     CPU_POWERPC_MPC8313E,     POWERPC_SVR_8313E,     e300),
       
  7931 #endif
       
  7932 #if defined (TODO)
       
  7933     /* MPC8314                                                               */
       
  7934     POWERPC_DEF_SVR("MPC8314",
       
  7935                     CPU_POWERPC_MPC8314,      POWERPC_SVR_8314,      e300),
       
  7936 #endif
       
  7937 #if defined (TODO)
       
  7938     /* MPC8314E                                                              */
       
  7939     POWERPC_DEF_SVR("MPC8314E",
       
  7940                     CPU_POWERPC_MPC8314E,     POWERPC_SVR_8314E,     e300),
       
  7941 #endif
       
  7942 #if defined (TODO)
       
  7943     /* MPC8315                                                               */
       
  7944     POWERPC_DEF_SVR("MPC8315",
       
  7945                     CPU_POWERPC_MPC8315,      POWERPC_SVR_8315,      e300),
       
  7946 #endif
       
  7947 #if defined (TODO)
       
  7948     /* MPC8315E                                                              */
       
  7949     POWERPC_DEF_SVR("MPC8315E",
       
  7950                     CPU_POWERPC_MPC8315E,     POWERPC_SVR_8315E,     e300),
       
  7951 #endif
       
  7952 #if defined (TODO)
       
  7953     /* MPC8321                                                               */
       
  7954     POWERPC_DEF_SVR("MPC8321",
       
  7955                     CPU_POWERPC_MPC8321,      POWERPC_SVR_8321,      e300),
       
  7956 #endif
       
  7957 #if defined (TODO)
       
  7958     /* MPC8321E                                                              */
       
  7959     POWERPC_DEF_SVR("MPC8321E",
       
  7960                     CPU_POWERPC_MPC8321E,     POWERPC_SVR_8321E,     e300),
       
  7961 #endif
       
  7962 #if defined (TODO)
       
  7963     /* MPC8323                                                               */
       
  7964     POWERPC_DEF_SVR("MPC8323",
       
  7965                     CPU_POWERPC_MPC8323,      POWERPC_SVR_8323,      e300),
       
  7966 #endif
       
  7967 #if defined (TODO)
       
  7968     /* MPC8323E                                                              */
       
  7969     POWERPC_DEF_SVR("MPC8323E",
       
  7970                     CPU_POWERPC_MPC8323E,     POWERPC_SVR_8323E,     e300),
       
  7971 #endif
       
  7972     /* MPC8343A                                                              */
       
  7973     POWERPC_DEF_SVR("MPC8343A",
       
  7974                     CPU_POWERPC_MPC8343A,     POWERPC_SVR_8343A,     e300),
       
  7975     /* MPC8343EA                                                             */
       
  7976     POWERPC_DEF_SVR("MPC8343EA",
       
  7977                     CPU_POWERPC_MPC8343EA,    POWERPC_SVR_8343EA,    e300),
       
  7978     /* MPC8347A                                                              */
       
  7979     POWERPC_DEF_SVR("MPC8347A",
       
  7980                     CPU_POWERPC_MPC8347A,     POWERPC_SVR_8347A,     e300),
       
  7981     /* MPC8347AT                                                             */
       
  7982     POWERPC_DEF_SVR("MPC8347AT",
       
  7983                     CPU_POWERPC_MPC8347AT,    POWERPC_SVR_8347AT,    e300),
       
  7984     /* MPC8347AP                                                             */
       
  7985     POWERPC_DEF_SVR("MPC8347AP",
       
  7986                     CPU_POWERPC_MPC8347AP,    POWERPC_SVR_8347AP,    e300),
       
  7987     /* MPC8347EA                                                             */
       
  7988     POWERPC_DEF_SVR("MPC8347EA",
       
  7989                     CPU_POWERPC_MPC8347EA,    POWERPC_SVR_8347EA,    e300),
       
  7990     /* MPC8347EAT                                                            */
       
  7991     POWERPC_DEF_SVR("MPC8347EAT",
       
  7992                     CPU_POWERPC_MPC8347EAT,   POWERPC_SVR_8347EAT,   e300),
       
  7993     /* MPC8343EAP                                                            */
       
  7994     POWERPC_DEF_SVR("MPC8347EAP",
       
  7995                     CPU_POWERPC_MPC8347EAP,   POWERPC_SVR_8347EAP,   e300),
       
  7996     /* MPC8349                                                               */
       
  7997     POWERPC_DEF_SVR("MPC8349",
       
  7998                     CPU_POWERPC_MPC8349,      POWERPC_SVR_8349,      e300),
       
  7999     /* MPC8349A                                                              */
       
  8000     POWERPC_DEF_SVR("MPC8349A",
       
  8001                     CPU_POWERPC_MPC8349A,     POWERPC_SVR_8349A,     e300),
       
  8002     /* MPC8349E                                                              */
       
  8003     POWERPC_DEF_SVR("MPC8349E",
       
  8004                     CPU_POWERPC_MPC8349E,     POWERPC_SVR_8349E,     e300),
       
  8005     /* MPC8349EA                                                             */
       
  8006     POWERPC_DEF_SVR("MPC8349EA",
       
  8007                     CPU_POWERPC_MPC8349EA,    POWERPC_SVR_8349EA,    e300),
       
  8008 #if defined (TODO)
       
  8009     /* MPC8358E                                                              */
       
  8010     POWERPC_DEF_SVR("MPC8358E",
       
  8011                     CPU_POWERPC_MPC8358E,     POWERPC_SVR_8358E,     e300),
       
  8012 #endif
       
  8013 #if defined (TODO)
       
  8014     /* MPC8360E                                                              */
       
  8015     POWERPC_DEF_SVR("MPC8360E",
       
  8016                     CPU_POWERPC_MPC8360E,     POWERPC_SVR_8360E,     e300),
       
  8017 #endif
       
  8018     /* MPC8377                                                               */
       
  8019     POWERPC_DEF_SVR("MPC8377",
       
  8020                     CPU_POWERPC_MPC8377,      POWERPC_SVR_8377,      e300),
       
  8021     /* MPC8377E                                                              */
       
  8022     POWERPC_DEF_SVR("MPC8377E",
       
  8023                     CPU_POWERPC_MPC8377E,     POWERPC_SVR_8377E,     e300),
       
  8024     /* MPC8378                                                               */
       
  8025     POWERPC_DEF_SVR("MPC8378",
       
  8026                     CPU_POWERPC_MPC8378,      POWERPC_SVR_8378,      e300),
       
  8027     /* MPC8378E                                                              */
       
  8028     POWERPC_DEF_SVR("MPC8378E",
       
  8029                     CPU_POWERPC_MPC8378E,     POWERPC_SVR_8378E,     e300),
       
  8030     /* MPC8379                                                               */
       
  8031     POWERPC_DEF_SVR("MPC8379",
       
  8032                     CPU_POWERPC_MPC8379,      POWERPC_SVR_8379,      e300),
       
  8033     /* MPC8379E                                                              */
       
  8034     POWERPC_DEF_SVR("MPC8379E",
       
  8035                     CPU_POWERPC_MPC8379E,     POWERPC_SVR_8379E,     e300),
       
  8036     /* e500 family                                                           */
       
  8037     /* PowerPC e500 core                                                     */
       
  8038     POWERPC_DEF("e500",          CPU_POWERPC_e500,                   e500),
       
  8039     /* PowerPC e500 v1.0 core                                                */
       
  8040     POWERPC_DEF("e500_v10",      CPU_POWERPC_e500_v10,               e500),
       
  8041     /* PowerPC e500 v2.0 core                                                */
       
  8042     POWERPC_DEF("e500_v20",      CPU_POWERPC_e500_v20,               e500),
       
  8043     /* PowerPC e500v2 core                                                   */
       
  8044     POWERPC_DEF("e500v2",        CPU_POWERPC_e500v2,                 e500),
       
  8045     /* PowerPC e500v2 v1.0 core                                              */
       
  8046     POWERPC_DEF("e500v2_v10",    CPU_POWERPC_e500v2_v10,             e500),
       
  8047     /* PowerPC e500v2 v2.0 core                                              */
       
  8048     POWERPC_DEF("e500v2_v20",    CPU_POWERPC_e500v2_v20,             e500),
       
  8049     /* PowerPC e500v2 v2.1 core                                              */
       
  8050     POWERPC_DEF("e500v2_v21",    CPU_POWERPC_e500v2_v21,             e500),
       
  8051     /* PowerPC e500v2 v2.2 core                                              */
       
  8052     POWERPC_DEF("e500v2_v22",    CPU_POWERPC_e500v2_v22,             e500),
       
  8053     /* PowerPC e500v2 v3.0 core                                              */
       
  8054     POWERPC_DEF("e500v2_v30",    CPU_POWERPC_e500v2_v30,             e500),
       
  8055     /* PowerPC e500 microcontrollers                                         */
       
  8056     /* MPC8533                                                               */
       
  8057     POWERPC_DEF_SVR("MPC8533",
       
  8058                     CPU_POWERPC_MPC8533,      POWERPC_SVR_8533,      e500),
       
  8059     /* MPC8533 v1.0                                                          */
       
  8060     POWERPC_DEF_SVR("MPC8533_v10",
       
  8061                     CPU_POWERPC_MPC8533_v10,  POWERPC_SVR_8533_v10,  e500),
       
  8062     /* MPC8533 v1.1                                                          */
       
  8063     POWERPC_DEF_SVR("MPC8533_v11",
       
  8064                     CPU_POWERPC_MPC8533_v11,  POWERPC_SVR_8533_v11,  e500),
       
  8065     /* MPC8533E                                                              */
       
  8066     POWERPC_DEF_SVR("MPC8533E",
       
  8067                     CPU_POWERPC_MPC8533E,     POWERPC_SVR_8533E,     e500),
       
  8068     /* MPC8533E v1.0                                                         */
       
  8069     POWERPC_DEF_SVR("MPC8533E_v10",
       
  8070                     CPU_POWERPC_MPC8533E_v10, POWERPC_SVR_8533E_v10, e500),
       
  8071     POWERPC_DEF_SVR("MPC8533E_v11",
       
  8072                     CPU_POWERPC_MPC8533E_v11, POWERPC_SVR_8533E_v11, e500),
       
  8073     /* MPC8540                                                               */
       
  8074     POWERPC_DEF_SVR("MPC8540",
       
  8075                     CPU_POWERPC_MPC8540,      POWERPC_SVR_8540,      e500),
       
  8076     /* MPC8540 v1.0                                                          */
       
  8077     POWERPC_DEF_SVR("MPC8540_v10",
       
  8078                     CPU_POWERPC_MPC8540_v10,  POWERPC_SVR_8540_v10,  e500),
       
  8079     /* MPC8540 v2.0                                                          */
       
  8080     POWERPC_DEF_SVR("MPC8540_v20",
       
  8081                     CPU_POWERPC_MPC8540_v20,  POWERPC_SVR_8540_v20,  e500),
       
  8082     /* MPC8540 v2.1                                                          */
       
  8083     POWERPC_DEF_SVR("MPC8540_v21",
       
  8084                     CPU_POWERPC_MPC8540_v21,  POWERPC_SVR_8540_v21,  e500),
       
  8085     /* MPC8541                                                               */
       
  8086     POWERPC_DEF_SVR("MPC8541",
       
  8087                     CPU_POWERPC_MPC8541,      POWERPC_SVR_8541,      e500),
       
  8088     /* MPC8541 v1.0                                                          */
       
  8089     POWERPC_DEF_SVR("MPC8541_v10",
       
  8090                     CPU_POWERPC_MPC8541_v10,  POWERPC_SVR_8541_v10,  e500),
       
  8091     /* MPC8541 v1.1                                                          */
       
  8092     POWERPC_DEF_SVR("MPC8541_v11",
       
  8093                     CPU_POWERPC_MPC8541_v11,  POWERPC_SVR_8541_v11,  e500),
       
  8094     /* MPC8541E                                                              */
       
  8095     POWERPC_DEF_SVR("MPC8541E",
       
  8096                     CPU_POWERPC_MPC8541E,     POWERPC_SVR_8541E,     e500),
       
  8097     /* MPC8541E v1.0                                                         */
       
  8098     POWERPC_DEF_SVR("MPC8541E_v10",
       
  8099                     CPU_POWERPC_MPC8541E_v10, POWERPC_SVR_8541E_v10, e500),
       
  8100     /* MPC8541E v1.1                                                         */
       
  8101     POWERPC_DEF_SVR("MPC8541E_v11",
       
  8102                     CPU_POWERPC_MPC8541E_v11, POWERPC_SVR_8541E_v11, e500),
       
  8103     /* MPC8543                                                               */
       
  8104     POWERPC_DEF_SVR("MPC8543",
       
  8105                     CPU_POWERPC_MPC8543,      POWERPC_SVR_8543,      e500),
       
  8106     /* MPC8543 v1.0                                                          */
       
  8107     POWERPC_DEF_SVR("MPC8543_v10",
       
  8108                     CPU_POWERPC_MPC8543_v10,  POWERPC_SVR_8543_v10,  e500),
       
  8109     /* MPC8543 v1.1                                                          */
       
  8110     POWERPC_DEF_SVR("MPC8543_v11",
       
  8111                     CPU_POWERPC_MPC8543_v11,  POWERPC_SVR_8543_v11,  e500),
       
  8112     /* MPC8543 v2.0                                                          */
       
  8113     POWERPC_DEF_SVR("MPC8543_v20",
       
  8114                     CPU_POWERPC_MPC8543_v20,  POWERPC_SVR_8543_v20,  e500),
       
  8115     /* MPC8543 v2.1                                                          */
       
  8116     POWERPC_DEF_SVR("MPC8543_v21",
       
  8117                     CPU_POWERPC_MPC8543_v21,  POWERPC_SVR_8543_v21,  e500),
       
  8118     /* MPC8543E                                                              */
       
  8119     POWERPC_DEF_SVR("MPC8543E",
       
  8120                     CPU_POWERPC_MPC8543E,     POWERPC_SVR_8543E,     e500),
       
  8121     /* MPC8543E v1.0                                                         */
       
  8122     POWERPC_DEF_SVR("MPC8543E_v10",
       
  8123                     CPU_POWERPC_MPC8543E_v10, POWERPC_SVR_8543E_v10, e500),
       
  8124     /* MPC8543E v1.1                                                         */
       
  8125     POWERPC_DEF_SVR("MPC8543E_v11",
       
  8126                     CPU_POWERPC_MPC8543E_v11, POWERPC_SVR_8543E_v11, e500),
       
  8127     /* MPC8543E v2.0                                                         */
       
  8128     POWERPC_DEF_SVR("MPC8543E_v20",
       
  8129                     CPU_POWERPC_MPC8543E_v20, POWERPC_SVR_8543E_v20, e500),
       
  8130     /* MPC8543E v2.1                                                         */
       
  8131     POWERPC_DEF_SVR("MPC8543E_v21",
       
  8132                     CPU_POWERPC_MPC8543E_v21, POWERPC_SVR_8543E_v21, e500),
       
  8133     /* MPC8544                                                               */
       
  8134     POWERPC_DEF_SVR("MPC8544",
       
  8135                     CPU_POWERPC_MPC8544,      POWERPC_SVR_8544,      e500),
       
  8136     /* MPC8544 v1.0                                                          */
       
  8137     POWERPC_DEF_SVR("MPC8544_v10",
       
  8138                     CPU_POWERPC_MPC8544_v10,  POWERPC_SVR_8544_v10,  e500),
       
  8139     /* MPC8544 v1.1                                                          */
       
  8140     POWERPC_DEF_SVR("MPC8544_v11",
       
  8141                     CPU_POWERPC_MPC8544_v11,  POWERPC_SVR_8544_v11,  e500),
       
  8142     /* MPC8544E                                                              */
       
  8143     POWERPC_DEF_SVR("MPC8544E",
       
  8144                     CPU_POWERPC_MPC8544E,     POWERPC_SVR_8544E,     e500),
       
  8145     /* MPC8544E v1.0                                                         */
       
  8146     POWERPC_DEF_SVR("MPC8544E_v10",
       
  8147                     CPU_POWERPC_MPC8544E_v10, POWERPC_SVR_8544E_v10, e500),
       
  8148     /* MPC8544E v1.1                                                         */
       
  8149     POWERPC_DEF_SVR("MPC8544E_v11",
       
  8150                     CPU_POWERPC_MPC8544E_v11, POWERPC_SVR_8544E_v11, e500),
       
  8151     /* MPC8545                                                               */
       
  8152     POWERPC_DEF_SVR("MPC8545",
       
  8153                     CPU_POWERPC_MPC8545,      POWERPC_SVR_8545,      e500),
       
  8154     /* MPC8545 v2.0                                                          */
       
  8155     POWERPC_DEF_SVR("MPC8545_v20",
       
  8156                     CPU_POWERPC_MPC8545_v20,  POWERPC_SVR_8545_v20,  e500),
       
  8157     /* MPC8545 v2.1                                                          */
       
  8158     POWERPC_DEF_SVR("MPC8545_v21",
       
  8159                     CPU_POWERPC_MPC8545_v21,  POWERPC_SVR_8545_v21,  e500),
       
  8160     /* MPC8545E                                                              */
       
  8161     POWERPC_DEF_SVR("MPC8545E",
       
  8162                     CPU_POWERPC_MPC8545E,     POWERPC_SVR_8545E,     e500),
       
  8163     /* MPC8545E v2.0                                                         */
       
  8164     POWERPC_DEF_SVR("MPC8545E_v20",
       
  8165                     CPU_POWERPC_MPC8545E_v20, POWERPC_SVR_8545E_v20, e500),
       
  8166     /* MPC8545E v2.1                                                         */
       
  8167     POWERPC_DEF_SVR("MPC8545E_v21",
       
  8168                     CPU_POWERPC_MPC8545E_v21, POWERPC_SVR_8545E_v21, e500),
       
  8169     /* MPC8547E                                                              */
       
  8170     POWERPC_DEF_SVR("MPC8547E",
       
  8171                     CPU_POWERPC_MPC8547E,     POWERPC_SVR_8547E,     e500),
       
  8172     /* MPC8547E v2.0                                                         */
       
  8173     POWERPC_DEF_SVR("MPC8547E_v20",
       
  8174                     CPU_POWERPC_MPC8547E_v20, POWERPC_SVR_8547E_v20, e500),
       
  8175     /* MPC8547E v2.1                                                         */
       
  8176     POWERPC_DEF_SVR("MPC8547E_v21",
       
  8177                     CPU_POWERPC_MPC8547E_v21, POWERPC_SVR_8547E_v21, e500),
       
  8178     /* MPC8548                                                               */
       
  8179     POWERPC_DEF_SVR("MPC8548",
       
  8180                     CPU_POWERPC_MPC8548,      POWERPC_SVR_8548,      e500),
       
  8181     /* MPC8548 v1.0                                                          */
       
  8182     POWERPC_DEF_SVR("MPC8548_v10",
       
  8183                     CPU_POWERPC_MPC8548_v10,  POWERPC_SVR_8548_v10,  e500),
       
  8184     /* MPC8548 v1.1                                                          */
       
  8185     POWERPC_DEF_SVR("MPC8548_v11",
       
  8186                     CPU_POWERPC_MPC8548_v11,  POWERPC_SVR_8548_v11,  e500),
       
  8187     /* MPC8548 v2.0                                                          */
       
  8188     POWERPC_DEF_SVR("MPC8548_v20",
       
  8189                     CPU_POWERPC_MPC8548_v20,  POWERPC_SVR_8548_v20,  e500),
       
  8190     /* MPC8548 v2.1                                                          */
       
  8191     POWERPC_DEF_SVR("MPC8548_v21",
       
  8192                     CPU_POWERPC_MPC8548_v21,  POWERPC_SVR_8548_v21,  e500),
       
  8193     /* MPC8548E                                                              */
       
  8194     POWERPC_DEF_SVR("MPC8548E",
       
  8195                     CPU_POWERPC_MPC8548E,     POWERPC_SVR_8548E,     e500),
       
  8196     /* MPC8548E v1.0                                                         */
       
  8197     POWERPC_DEF_SVR("MPC8548E_v10",
       
  8198                     CPU_POWERPC_MPC8548E_v10, POWERPC_SVR_8548E_v10, e500),
       
  8199     /* MPC8548E v1.1                                                         */
       
  8200     POWERPC_DEF_SVR("MPC8548E_v11",
       
  8201                     CPU_POWERPC_MPC8548E_v11, POWERPC_SVR_8548E_v11, e500),
       
  8202     /* MPC8548E v2.0                                                         */
       
  8203     POWERPC_DEF_SVR("MPC8548E_v20",
       
  8204                     CPU_POWERPC_MPC8548E_v20, POWERPC_SVR_8548E_v20, e500),
       
  8205     /* MPC8548E v2.1                                                         */
       
  8206     POWERPC_DEF_SVR("MPC8548E_v21",
       
  8207                     CPU_POWERPC_MPC8548E_v21, POWERPC_SVR_8548E_v21, e500),
       
  8208     /* MPC8555                                                               */
       
  8209     POWERPC_DEF_SVR("MPC8555",
       
  8210                     CPU_POWERPC_MPC8555,      POWERPC_SVR_8555,      e500),
       
  8211     /* MPC8555 v1.0                                                          */
       
  8212     POWERPC_DEF_SVR("MPC8555_v10",
       
  8213                     CPU_POWERPC_MPC8555_v10,  POWERPC_SVR_8555_v10,  e500),
       
  8214     /* MPC8555 v1.1                                                          */
       
  8215     POWERPC_DEF_SVR("MPC8555_v11",
       
  8216                     CPU_POWERPC_MPC8555_v11,  POWERPC_SVR_8555_v11,  e500),
       
  8217     /* MPC8555E                                                              */
       
  8218     POWERPC_DEF_SVR("MPC8555E",
       
  8219                     CPU_POWERPC_MPC8555E,     POWERPC_SVR_8555E,     e500),
       
  8220     /* MPC8555E v1.0                                                         */
       
  8221     POWERPC_DEF_SVR("MPC8555E_v10",
       
  8222                     CPU_POWERPC_MPC8555E_v10, POWERPC_SVR_8555E_v10, e500),
       
  8223     /* MPC8555E v1.1                                                         */
       
  8224     POWERPC_DEF_SVR("MPC8555E_v11",
       
  8225                     CPU_POWERPC_MPC8555E_v11, POWERPC_SVR_8555E_v11, e500),
       
  8226     /* MPC8560                                                               */
       
  8227     POWERPC_DEF_SVR("MPC8560",
       
  8228                     CPU_POWERPC_MPC8560,      POWERPC_SVR_8560,      e500),
       
  8229     /* MPC8560 v1.0                                                          */
       
  8230     POWERPC_DEF_SVR("MPC8560_v10",
       
  8231                     CPU_POWERPC_MPC8560_v10,  POWERPC_SVR_8560_v10,  e500),
       
  8232     /* MPC8560 v2.0                                                          */
       
  8233     POWERPC_DEF_SVR("MPC8560_v20",
       
  8234                     CPU_POWERPC_MPC8560_v20,  POWERPC_SVR_8560_v20,  e500),
       
  8235     /* MPC8560 v2.1                                                          */
       
  8236     POWERPC_DEF_SVR("MPC8560_v21",
       
  8237                     CPU_POWERPC_MPC8560_v21,  POWERPC_SVR_8560_v21,  e500),
       
  8238     /* MPC8567                                                               */
       
  8239     POWERPC_DEF_SVR("MPC8567",
       
  8240                     CPU_POWERPC_MPC8567,      POWERPC_SVR_8567,      e500),
       
  8241     /* MPC8567E                                                              */
       
  8242     POWERPC_DEF_SVR("MPC8567E",
       
  8243                     CPU_POWERPC_MPC8567E,     POWERPC_SVR_8567E,     e500),
       
  8244     /* MPC8568                                                               */
       
  8245     POWERPC_DEF_SVR("MPC8568",
       
  8246                     CPU_POWERPC_MPC8568,      POWERPC_SVR_8568,      e500),
       
  8247     /* MPC8568E                                                              */
       
  8248     POWERPC_DEF_SVR("MPC8568E",
       
  8249                     CPU_POWERPC_MPC8568E,     POWERPC_SVR_8568E,     e500),
       
  8250     /* MPC8572                                                               */
       
  8251     POWERPC_DEF_SVR("MPC8572",
       
  8252                     CPU_POWERPC_MPC8572,      POWERPC_SVR_8572,      e500),
       
  8253     /* MPC8572E                                                              */
       
  8254     POWERPC_DEF_SVR("MPC8572E",
       
  8255                     CPU_POWERPC_MPC8572E,     POWERPC_SVR_8572E,     e500),
       
  8256     /* e600 family                                                           */
       
  8257     /* PowerPC e600 core                                                     */
       
  8258     POWERPC_DEF("e600",          CPU_POWERPC_e600,                   7400),
       
  8259     /* PowerPC e600 microcontrollers                                         */
       
  8260 #if defined (TODO)
       
  8261     /* MPC8610                                                               */
       
  8262     POWERPC_DEF_SVR("MPC8610",
       
  8263                     CPU_POWERPC_MPC8610,      POWERPC_SVR_8610,      7400),
       
  8264 #endif
       
  8265     /* MPC8641                                                               */
       
  8266     POWERPC_DEF_SVR("MPC8641",
       
  8267                     CPU_POWERPC_MPC8641,      POWERPC_SVR_8641,      7400),
       
  8268     /* MPC8641D                                                              */
       
  8269     POWERPC_DEF_SVR("MPC8641D",
       
  8270                     CPU_POWERPC_MPC8641D,     POWERPC_SVR_8641D,     7400),
       
  8271     /* 32 bits "classic" PowerPC                                             */
       
  8272     /* PowerPC 6xx family                                                    */
       
  8273     /* PowerPC 601                                                           */
       
  8274     POWERPC_DEF("601",           CPU_POWERPC_601,                    601v),
       
  8275     /* PowerPC 601v0                                                         */
       
  8276     POWERPC_DEF("601_v0",        CPU_POWERPC_601_v0,                 601),
       
  8277     /* PowerPC 601v1                                                         */
       
  8278     POWERPC_DEF("601_v1",        CPU_POWERPC_601_v1,                 601),
       
  8279     /* PowerPC 601v                                                          */
       
  8280     POWERPC_DEF("601v",          CPU_POWERPC_601v,                   601v),
       
  8281     /* PowerPC 601v2                                                         */
       
  8282     POWERPC_DEF("601_v2",        CPU_POWERPC_601_v2,                 601v),
       
  8283     /* PowerPC 602                                                           */
       
  8284     POWERPC_DEF("602",           CPU_POWERPC_602,                    602),
       
  8285     /* PowerPC 603                                                           */
       
  8286     POWERPC_DEF("603",           CPU_POWERPC_603,                    603),
       
  8287     /* Code name for PowerPC 603                                             */
       
  8288     POWERPC_DEF("Vanilla",       CPU_POWERPC_603,                    603),
       
  8289     /* PowerPC 603e (aka PID6)                                               */
       
  8290     POWERPC_DEF("603e",          CPU_POWERPC_603E,                   603E),
       
  8291     /* Code name for PowerPC 603e                                            */
       
  8292     POWERPC_DEF("Stretch",       CPU_POWERPC_603E,                   603E),
       
  8293     /* PowerPC 603e v1.1                                                     */
       
  8294     POWERPC_DEF("603e_v1.1",     CPU_POWERPC_603E_v11,               603E),
       
  8295     /* PowerPC 603e v1.2                                                     */
       
  8296     POWERPC_DEF("603e_v1.2",     CPU_POWERPC_603E_v12,               603E),
       
  8297     /* PowerPC 603e v1.3                                                     */
       
  8298     POWERPC_DEF("603e_v1.3",     CPU_POWERPC_603E_v13,               603E),
       
  8299     /* PowerPC 603e v1.4                                                     */
       
  8300     POWERPC_DEF("603e_v1.4",     CPU_POWERPC_603E_v14,               603E),
       
  8301     /* PowerPC 603e v2.2                                                     */
       
  8302     POWERPC_DEF("603e_v2.2",     CPU_POWERPC_603E_v22,               603E),
       
  8303     /* PowerPC 603e v3                                                       */
       
  8304     POWERPC_DEF("603e_v3",       CPU_POWERPC_603E_v3,                603E),
       
  8305     /* PowerPC 603e v4                                                       */
       
  8306     POWERPC_DEF("603e_v4",       CPU_POWERPC_603E_v4,                603E),
       
  8307     /* PowerPC 603e v4.1                                                     */
       
  8308     POWERPC_DEF("603e_v4.1",     CPU_POWERPC_603E_v41,               603E),
       
  8309     /* PowerPC 603e (aka PID7)                                               */
       
  8310     POWERPC_DEF("603e7",         CPU_POWERPC_603E7,                  603E),
       
  8311     /* PowerPC 603e7t                                                        */
       
  8312     POWERPC_DEF("603e7t",        CPU_POWERPC_603E7t,                 603E),
       
  8313     /* PowerPC 603e7v                                                        */
       
  8314     POWERPC_DEF("603e7v",        CPU_POWERPC_603E7v,                 603E),
       
  8315     /* Code name for PowerPC 603ev                                           */
       
  8316     POWERPC_DEF("Vaillant",      CPU_POWERPC_603E7v,                 603E),
       
  8317     /* PowerPC 603e7v1                                                       */
       
  8318     POWERPC_DEF("603e7v1",       CPU_POWERPC_603E7v1,                603E),
       
  8319     /* PowerPC 603e7v2                                                       */
       
  8320     POWERPC_DEF("603e7v2",       CPU_POWERPC_603E7v2,                603E),
       
  8321     /* PowerPC 603p (aka PID7v)                                              */
       
  8322     POWERPC_DEF("603p",          CPU_POWERPC_603P,                   603E),
       
  8323     /* PowerPC 603r (aka PID7t)                                              */
       
  8324     POWERPC_DEF("603r",          CPU_POWERPC_603R,                   603E),
       
  8325     /* Code name for PowerPC 603r                                            */
       
  8326     POWERPC_DEF("Goldeneye",     CPU_POWERPC_603R,                   603E),
       
  8327     /* PowerPC 604                                                           */
       
  8328     POWERPC_DEF("604",           CPU_POWERPC_604,                    604),
       
  8329     /* PowerPC 604e (aka PID9)                                               */
       
  8330     POWERPC_DEF("604e",          CPU_POWERPC_604E,                   604E),
       
  8331     /* Code name for PowerPC 604e                                            */
       
  8332     POWERPC_DEF("Sirocco",       CPU_POWERPC_604E,                   604E),
       
  8333     /* PowerPC 604e v1.0                                                     */
       
  8334     POWERPC_DEF("604e_v1.0",     CPU_POWERPC_604E_v10,               604E),
       
  8335     /* PowerPC 604e v2.2                                                     */
       
  8336     POWERPC_DEF("604e_v2.2",     CPU_POWERPC_604E_v22,               604E),
       
  8337     /* PowerPC 604e v2.4                                                     */
       
  8338     POWERPC_DEF("604e_v2.4",     CPU_POWERPC_604E_v24,               604E),
       
  8339     /* PowerPC 604r (aka PIDA)                                               */
       
  8340     POWERPC_DEF("604r",          CPU_POWERPC_604R,                   604E),
       
  8341     /* Code name for PowerPC 604r                                            */
       
  8342     POWERPC_DEF("Mach5",         CPU_POWERPC_604R,                   604E),
       
  8343 #if defined(TODO)
       
  8344     /* PowerPC 604ev                                                         */
       
  8345     POWERPC_DEF("604ev",         CPU_POWERPC_604EV,                  604E),
       
  8346 #endif
       
  8347     /* PowerPC 7xx family                                                    */
       
  8348     /* Generic PowerPC 740 (G3)                                              */
       
  8349     POWERPC_DEF("740",           CPU_POWERPC_7x0,                    740),
       
  8350     /* Code name for PowerPC 740                                             */
       
  8351     POWERPC_DEF("Arthur",        CPU_POWERPC_7x0,                    740),
       
  8352     /* Generic PowerPC 750 (G3)                                              */
       
  8353     POWERPC_DEF("750",           CPU_POWERPC_7x0,                    750),
       
  8354     /* Code name for PowerPC 750                                             */
       
  8355     POWERPC_DEF("Typhoon",       CPU_POWERPC_7x0,                    750),
       
  8356     /* PowerPC 740/750 is also known as G3                                   */
       
  8357     POWERPC_DEF("G3",            CPU_POWERPC_7x0,                    750),
       
  8358     /* PowerPC 740 v1.0 (G3)                                                 */
       
  8359     POWERPC_DEF("740_v1.0",      CPU_POWERPC_7x0_v10,                740),
       
  8360     /* PowerPC 750 v1.0 (G3)                                                 */
       
  8361     POWERPC_DEF("750_v1.0",      CPU_POWERPC_7x0_v10,                750),
       
  8362     /* PowerPC 740 v2.0 (G3)                                                 */
       
  8363     POWERPC_DEF("740_v2.0",      CPU_POWERPC_7x0_v20,                740),
       
  8364     /* PowerPC 750 v2.0 (G3)                                                 */
       
  8365     POWERPC_DEF("750_v2.0",      CPU_POWERPC_7x0_v20,                750),
       
  8366     /* PowerPC 740 v2.1 (G3)                                                 */
       
  8367     POWERPC_DEF("740_v2.1",      CPU_POWERPC_7x0_v21,                740),
       
  8368     /* PowerPC 750 v2.1 (G3)                                                 */
       
  8369     POWERPC_DEF("750_v2.1",      CPU_POWERPC_7x0_v21,                750),
       
  8370     /* PowerPC 740 v2.2 (G3)                                                 */
       
  8371     POWERPC_DEF("740_v2.2",      CPU_POWERPC_7x0_v22,                740),
       
  8372     /* PowerPC 750 v2.2 (G3)                                                 */
       
  8373     POWERPC_DEF("750_v2.2",      CPU_POWERPC_7x0_v22,                750),
       
  8374     /* PowerPC 740 v3.0 (G3)                                                 */
       
  8375     POWERPC_DEF("740_v3.0",      CPU_POWERPC_7x0_v30,                740),
       
  8376     /* PowerPC 750 v3.0 (G3)                                                 */
       
  8377     POWERPC_DEF("750_v3.0",      CPU_POWERPC_7x0_v30,                750),
       
  8378     /* PowerPC 740 v3.1 (G3)                                                 */
       
  8379     POWERPC_DEF("740_v3.1",      CPU_POWERPC_7x0_v31,                740),
       
  8380     /* PowerPC 750 v3.1 (G3)                                                 */
       
  8381     POWERPC_DEF("750_v3.1",      CPU_POWERPC_7x0_v31,                750),
       
  8382     /* PowerPC 740E (G3)                                                     */
       
  8383     POWERPC_DEF("740e",          CPU_POWERPC_740E,                   740),
       
  8384     /* PowerPC 750E (G3)                                                     */
       
  8385     POWERPC_DEF("750e",          CPU_POWERPC_750E,                   750),
       
  8386     /* PowerPC 740P (G3)                                                     */
       
  8387     POWERPC_DEF("740p",          CPU_POWERPC_7x0P,                   740),
       
  8388     /* PowerPC 750P (G3)                                                     */
       
  8389     POWERPC_DEF("750p",          CPU_POWERPC_7x0P,                   750),
       
  8390     /* Code name for PowerPC 740P/750P (G3)                                  */
       
  8391     POWERPC_DEF("Conan/Doyle",   CPU_POWERPC_7x0P,                   750),
       
  8392     /* PowerPC 750CL (G3 embedded)                                           */
       
  8393     POWERPC_DEF("750cl",         CPU_POWERPC_750CL,                  750cl),
       
  8394     /* PowerPC 750CL v1.0                                                    */
       
  8395     POWERPC_DEF("750cl_v1.0",    CPU_POWERPC_750CL_v10,              750cl),
       
  8396     /* PowerPC 750CL v2.0                                                    */
       
  8397     POWERPC_DEF("750cl_v2.0",    CPU_POWERPC_750CL_v20,              750cl),
       
  8398     /* PowerPC 750CX (G3 embedded)                                           */
       
  8399     POWERPC_DEF("750cx",         CPU_POWERPC_750CX,                  750cx),
       
  8400     /* PowerPC 750CX v1.0 (G3 embedded)                                      */
       
  8401     POWERPC_DEF("750cx_v1.0",    CPU_POWERPC_750CX_v10,              750cx),
       
  8402     /* PowerPC 750CX v2.1 (G3 embedded)                                      */
       
  8403     POWERPC_DEF("750cx_v2.0",    CPU_POWERPC_750CX_v20,              750cx),
       
  8404     /* PowerPC 750CX v2.1 (G3 embedded)                                      */
       
  8405     POWERPC_DEF("750cx_v2.1",    CPU_POWERPC_750CX_v21,              750cx),
       
  8406     /* PowerPC 750CX v2.2 (G3 embedded)                                      */
       
  8407     POWERPC_DEF("750cx_v2.2",    CPU_POWERPC_750CX_v22,              750cx),
       
  8408     /* PowerPC 750CXe (G3 embedded)                                          */
       
  8409     POWERPC_DEF("750cxe",        CPU_POWERPC_750CXE,                 750cx),
       
  8410     /* PowerPC 750CXe v2.1 (G3 embedded)                                     */
       
  8411     POWERPC_DEF("750cxe_v2.1",   CPU_POWERPC_750CXE_v21,             750cx),
       
  8412     /* PowerPC 750CXe v2.2 (G3 embedded)                                     */
       
  8413     POWERPC_DEF("750cxe_v2.2",   CPU_POWERPC_750CXE_v22,             750cx),
       
  8414     /* PowerPC 750CXe v2.3 (G3 embedded)                                     */
       
  8415     POWERPC_DEF("750cxe_v2.3",   CPU_POWERPC_750CXE_v23,             750cx),
       
  8416     /* PowerPC 750CXe v2.4 (G3 embedded)                                     */
       
  8417     POWERPC_DEF("750cxe_v2.4",   CPU_POWERPC_750CXE_v24,             750cx),
       
  8418     /* PowerPC 750CXe v2.4b (G3 embedded)                                    */
       
  8419     POWERPC_DEF("750cxe_v2.4b",  CPU_POWERPC_750CXE_v24b,            750cx),
       
  8420     /* PowerPC 750CXe v3.0 (G3 embedded)                                     */
       
  8421     POWERPC_DEF("750cxe_v3.0",   CPU_POWERPC_750CXE_v30,             750cx),
       
  8422     /* PowerPC 750CXe v3.1 (G3 embedded)                                     */
       
  8423     POWERPC_DEF("750cxe_v3.1",   CPU_POWERPC_750CXE_v31,             750cx),
       
  8424     /* PowerPC 750CXe v3.1b (G3 embedded)                                    */
       
  8425     POWERPC_DEF("750cxe_v3.1b",  CPU_POWERPC_750CXE_v31b,            750cx),
       
  8426     /* PowerPC 750CXr (G3 embedded)                                          */
       
  8427     POWERPC_DEF("750cxr",        CPU_POWERPC_750CXR,                 750cx),
       
  8428     /* PowerPC 750FL (G3 embedded)                                           */
       
  8429     POWERPC_DEF("750fl",         CPU_POWERPC_750FL,                  750fx),
       
  8430     /* PowerPC 750FX (G3 embedded)                                           */
       
  8431     POWERPC_DEF("750fx",         CPU_POWERPC_750FX,                  750fx),
       
  8432     /* PowerPC 750FX v1.0 (G3 embedded)                                      */
       
  8433     POWERPC_DEF("750fx_v1.0",    CPU_POWERPC_750FX_v10,              750fx),
       
  8434     /* PowerPC 750FX v2.0 (G3 embedded)                                      */
       
  8435     POWERPC_DEF("750fx_v2.0",    CPU_POWERPC_750FX_v20,              750fx),
       
  8436     /* PowerPC 750FX v2.1 (G3 embedded)                                      */
       
  8437     POWERPC_DEF("750fx_v2.1",    CPU_POWERPC_750FX_v21,              750fx),
       
  8438     /* PowerPC 750FX v2.2 (G3 embedded)                                      */
       
  8439     POWERPC_DEF("750fx_v2.2",    CPU_POWERPC_750FX_v22,              750fx),
       
  8440     /* PowerPC 750FX v2.3 (G3 embedded)                                      */
       
  8441     POWERPC_DEF("750fx_v2.3",    CPU_POWERPC_750FX_v23,              750fx),
       
  8442     /* PowerPC 750GL (G3 embedded)                                           */
       
  8443     POWERPC_DEF("750gl",         CPU_POWERPC_750GL,                  750gx),
       
  8444     /* PowerPC 750GX (G3 embedded)                                           */
       
  8445     POWERPC_DEF("750gx",         CPU_POWERPC_750GX,                  750gx),
       
  8446     /* PowerPC 750GX v1.0 (G3 embedded)                                      */
       
  8447     POWERPC_DEF("750gx_v1.0",    CPU_POWERPC_750GX_v10,              750gx),
       
  8448     /* PowerPC 750GX v1.1 (G3 embedded)                                      */
       
  8449     POWERPC_DEF("750gx_v1.1",    CPU_POWERPC_750GX_v11,              750gx),
       
  8450     /* PowerPC 750GX v1.2 (G3 embedded)                                      */
       
  8451     POWERPC_DEF("750gx_v1.2",    CPU_POWERPC_750GX_v12,              750gx),
       
  8452     /* PowerPC 750L (G3 embedded)                                            */
       
  8453     POWERPC_DEF("750l",          CPU_POWERPC_750L,                   750),
       
  8454     /* Code name for PowerPC 750L (G3 embedded)                              */
       
  8455     POWERPC_DEF("LoneStar",      CPU_POWERPC_750L,                   750),
       
  8456     /* PowerPC 750L v2.0 (G3 embedded)                                       */
       
  8457     POWERPC_DEF("750l_v2.0",     CPU_POWERPC_750L_v20,               750),
       
  8458     /* PowerPC 750L v2.1 (G3 embedded)                                       */
       
  8459     POWERPC_DEF("750l_v2.1",     CPU_POWERPC_750L_v21,               750),
       
  8460     /* PowerPC 750L v2.2 (G3 embedded)                                       */
       
  8461     POWERPC_DEF("750l_v2.2",     CPU_POWERPC_750L_v22,               750),
       
  8462     /* PowerPC 750L v3.0 (G3 embedded)                                       */
       
  8463     POWERPC_DEF("750l_v3.0",     CPU_POWERPC_750L_v30,               750),
       
  8464     /* PowerPC 750L v3.2 (G3 embedded)                                       */
       
  8465     POWERPC_DEF("750l_v3.2",     CPU_POWERPC_750L_v32,               750),
       
  8466     /* Generic PowerPC 745                                                   */
       
  8467     POWERPC_DEF("745",           CPU_POWERPC_7x5,                    745),
       
  8468     /* Generic PowerPC 755                                                   */
       
  8469     POWERPC_DEF("755",           CPU_POWERPC_7x5,                    755),
       
  8470     /* Code name for PowerPC 745/755                                         */
       
  8471     POWERPC_DEF("Goldfinger",    CPU_POWERPC_7x5,                    755),
       
  8472     /* PowerPC 745 v1.0                                                      */
       
  8473     POWERPC_DEF("745_v1.0",      CPU_POWERPC_7x5_v10,                745),
       
  8474     /* PowerPC 755 v1.0                                                      */
       
  8475     POWERPC_DEF("755_v1.0",      CPU_POWERPC_7x5_v10,                755),
       
  8476     /* PowerPC 745 v1.1                                                      */
       
  8477     POWERPC_DEF("745_v1.1",      CPU_POWERPC_7x5_v11,                745),
       
  8478     /* PowerPC 755 v1.1                                                      */
       
  8479     POWERPC_DEF("755_v1.1",      CPU_POWERPC_7x5_v11,                755),
       
  8480     /* PowerPC 745 v2.0                                                      */
       
  8481     POWERPC_DEF("745_v2.0",      CPU_POWERPC_7x5_v20,                745),
       
  8482     /* PowerPC 755 v2.0                                                      */
       
  8483     POWERPC_DEF("755_v2.0",      CPU_POWERPC_7x5_v20,                755),
       
  8484     /* PowerPC 745 v2.1                                                      */
       
  8485     POWERPC_DEF("745_v2.1",      CPU_POWERPC_7x5_v21,                745),
       
  8486     /* PowerPC 755 v2.1                                                      */
       
  8487     POWERPC_DEF("755_v2.1",      CPU_POWERPC_7x5_v21,                755),
       
  8488     /* PowerPC 745 v2.2                                                      */
       
  8489     POWERPC_DEF("745_v2.2",      CPU_POWERPC_7x5_v22,                745),
       
  8490     /* PowerPC 755 v2.2                                                      */
       
  8491     POWERPC_DEF("755_v2.2",      CPU_POWERPC_7x5_v22,                755),
       
  8492     /* PowerPC 745 v2.3                                                      */
       
  8493     POWERPC_DEF("745_v2.3",      CPU_POWERPC_7x5_v23,                745),
       
  8494     /* PowerPC 755 v2.3                                                      */
       
  8495     POWERPC_DEF("755_v2.3",      CPU_POWERPC_7x5_v23,                755),
       
  8496     /* PowerPC 745 v2.4                                                      */
       
  8497     POWERPC_DEF("745_v2.4",      CPU_POWERPC_7x5_v24,                745),
       
  8498     /* PowerPC 755 v2.4                                                      */
       
  8499     POWERPC_DEF("755_v2.4",      CPU_POWERPC_7x5_v24,                755),
       
  8500     /* PowerPC 745 v2.5                                                      */
       
  8501     POWERPC_DEF("745_v2.5",      CPU_POWERPC_7x5_v25,                745),
       
  8502     /* PowerPC 755 v2.5                                                      */
       
  8503     POWERPC_DEF("755_v2.5",      CPU_POWERPC_7x5_v25,                755),
       
  8504     /* PowerPC 745 v2.6                                                      */
       
  8505     POWERPC_DEF("745_v2.6",      CPU_POWERPC_7x5_v26,                745),
       
  8506     /* PowerPC 755 v2.6                                                      */
       
  8507     POWERPC_DEF("755_v2.6",      CPU_POWERPC_7x5_v26,                755),
       
  8508     /* PowerPC 745 v2.7                                                      */
       
  8509     POWERPC_DEF("745_v2.7",      CPU_POWERPC_7x5_v27,                745),
       
  8510     /* PowerPC 755 v2.7                                                      */
       
  8511     POWERPC_DEF("755_v2.7",      CPU_POWERPC_7x5_v27,                755),
       
  8512     /* PowerPC 745 v2.8                                                      */
       
  8513     POWERPC_DEF("745_v2.8",      CPU_POWERPC_7x5_v28,                745),
       
  8514     /* PowerPC 755 v2.8                                                      */
       
  8515     POWERPC_DEF("755_v2.8",      CPU_POWERPC_7x5_v28,                755),
       
  8516 #if defined (TODO)
       
  8517     /* PowerPC 745P (G3)                                                     */
       
  8518     POWERPC_DEF("745p",          CPU_POWERPC_7x5P,                   745),
       
  8519     /* PowerPC 755P (G3)                                                     */
       
  8520     POWERPC_DEF("755p",          CPU_POWERPC_7x5P,                   755),
       
  8521 #endif
       
  8522     /* PowerPC 74xx family                                                   */
       
  8523     /* PowerPC 7400 (G4)                                                     */
       
  8524     POWERPC_DEF("7400",          CPU_POWERPC_7400,                   7400),
       
  8525     /* Code name for PowerPC 7400                                            */
       
  8526     POWERPC_DEF("Max",           CPU_POWERPC_7400,                   7400),
       
  8527     /* PowerPC 74xx is also well known as G4                                 */
       
  8528     POWERPC_DEF("G4",            CPU_POWERPC_7400,                   7400),
       
  8529     /* PowerPC 7400 v1.0 (G4)                                                */
       
  8530     POWERPC_DEF("7400_v1.0",     CPU_POWERPC_7400_v10,               7400),
       
  8531     /* PowerPC 7400 v1.1 (G4)                                                */
       
  8532     POWERPC_DEF("7400_v1.1",     CPU_POWERPC_7400_v11,               7400),
       
  8533     /* PowerPC 7400 v2.0 (G4)                                                */
       
  8534     POWERPC_DEF("7400_v2.0",     CPU_POWERPC_7400_v20,               7400),
       
  8535     /* PowerPC 7400 v2.1 (G4)                                                */
       
  8536     POWERPC_DEF("7400_v2.1",     CPU_POWERPC_7400_v21,               7400),
       
  8537     /* PowerPC 7400 v2.2 (G4)                                                */
       
  8538     POWERPC_DEF("7400_v2.2",     CPU_POWERPC_7400_v22,               7400),
       
  8539     /* PowerPC 7400 v2.6 (G4)                                                */
       
  8540     POWERPC_DEF("7400_v2.6",     CPU_POWERPC_7400_v26,               7400),
       
  8541     /* PowerPC 7400 v2.7 (G4)                                                */
       
  8542     POWERPC_DEF("7400_v2.7",     CPU_POWERPC_7400_v27,               7400),
       
  8543     /* PowerPC 7400 v2.8 (G4)                                                */
       
  8544     POWERPC_DEF("7400_v2.8",     CPU_POWERPC_7400_v28,               7400),
       
  8545     /* PowerPC 7400 v2.9 (G4)                                                */
       
  8546     POWERPC_DEF("7400_v2.9",     CPU_POWERPC_7400_v29,               7400),
       
  8547     /* PowerPC 7410 (G4)                                                     */
       
  8548     POWERPC_DEF("7410",          CPU_POWERPC_7410,                   7410),
       
  8549     /* Code name for PowerPC 7410                                            */
       
  8550     POWERPC_DEF("Nitro",         CPU_POWERPC_7410,                   7410),
       
  8551     /* PowerPC 7410 v1.0 (G4)                                                */
       
  8552     POWERPC_DEF("7410_v1.0",     CPU_POWERPC_7410_v10,               7410),
       
  8553     /* PowerPC 7410 v1.1 (G4)                                                */
       
  8554     POWERPC_DEF("7410_v1.1",     CPU_POWERPC_7410_v11,               7410),
       
  8555     /* PowerPC 7410 v1.2 (G4)                                                */
       
  8556     POWERPC_DEF("7410_v1.2",     CPU_POWERPC_7410_v12,               7410),
       
  8557     /* PowerPC 7410 v1.3 (G4)                                                */
       
  8558     POWERPC_DEF("7410_v1.3",     CPU_POWERPC_7410_v13,               7410),
       
  8559     /* PowerPC 7410 v1.4 (G4)                                                */
       
  8560     POWERPC_DEF("7410_v1.4",     CPU_POWERPC_7410_v14,               7410),
       
  8561     /* PowerPC 7448 (G4)                                                     */
       
  8562     POWERPC_DEF("7448",          CPU_POWERPC_7448,                   7400),
       
  8563     /* PowerPC 7448 v1.0 (G4)                                                */
       
  8564     POWERPC_DEF("7448_v1.0",     CPU_POWERPC_7448_v10,               7400),
       
  8565     /* PowerPC 7448 v1.1 (G4)                                                */
       
  8566     POWERPC_DEF("7448_v1.1",     CPU_POWERPC_7448_v11,               7400),
       
  8567     /* PowerPC 7448 v2.0 (G4)                                                */
       
  8568     POWERPC_DEF("7448_v2.0",     CPU_POWERPC_7448_v20,               7400),
       
  8569     /* PowerPC 7448 v2.1 (G4)                                                */
       
  8570     POWERPC_DEF("7448_v2.1",     CPU_POWERPC_7448_v21,               7400),
       
  8571     /* PowerPC 7450 (G4)                                                     */
       
  8572     POWERPC_DEF("7450",          CPU_POWERPC_7450,                   7450),
       
  8573     /* Code name for PowerPC 7450                                            */
       
  8574     POWERPC_DEF("Vger",          CPU_POWERPC_7450,                   7450),
       
  8575     /* PowerPC 7450 v1.0 (G4)                                                */
       
  8576     POWERPC_DEF("7450_v1.0",     CPU_POWERPC_7450_v10,               7450),
       
  8577     /* PowerPC 7450 v1.1 (G4)                                                */
       
  8578     POWERPC_DEF("7450_v1.1",     CPU_POWERPC_7450_v11,               7450),
       
  8579     /* PowerPC 7450 v1.2 (G4)                                                */
       
  8580     POWERPC_DEF("7450_v1.2",     CPU_POWERPC_7450_v12,               7450),
       
  8581     /* PowerPC 7450 v2.0 (G4)                                                */
       
  8582     POWERPC_DEF("7450_v2.0",     CPU_POWERPC_7450_v20,               7450),
       
  8583     /* PowerPC 7450 v2.1 (G4)                                                */
       
  8584     POWERPC_DEF("7450_v2.1",     CPU_POWERPC_7450_v21,               7450),
       
  8585     /* PowerPC 7441 (G4)                                                     */
       
  8586     POWERPC_DEF("7441",          CPU_POWERPC_74x1,                   7440),
       
  8587     /* PowerPC 7451 (G4)                                                     */
       
  8588     POWERPC_DEF("7451",          CPU_POWERPC_74x1,                   7450),
       
  8589     /* PowerPC 7441 v2.1 (G4)                                                */
       
  8590     POWERPC_DEF("7441_v2.1",     CPU_POWERPC_7450_v21,               7440),
       
  8591     /* PowerPC 7441 v2.3 (G4)                                                */
       
  8592     POWERPC_DEF("7441_v2.3",     CPU_POWERPC_74x1_v23,               7440),
       
  8593     /* PowerPC 7451 v2.3 (G4)                                                */
       
  8594     POWERPC_DEF("7451_v2.3",     CPU_POWERPC_74x1_v23,               7450),
       
  8595     /* PowerPC 7441 v2.10 (G4)                                                */
       
  8596     POWERPC_DEF("7441_v2.10",    CPU_POWERPC_74x1_v210,              7440),
       
  8597     /* PowerPC 7451 v2.10 (G4)                                               */
       
  8598     POWERPC_DEF("7451_v2.10",    CPU_POWERPC_74x1_v210,              7450),
       
  8599     /* PowerPC 7445 (G4)                                                     */
       
  8600     POWERPC_DEF("7445",          CPU_POWERPC_74x5,                   7445),
       
  8601     /* PowerPC 7455 (G4)                                                     */
       
  8602     POWERPC_DEF("7455",          CPU_POWERPC_74x5,                   7455),
       
  8603     /* Code name for PowerPC 7445/7455                                       */
       
  8604     POWERPC_DEF("Apollo6",       CPU_POWERPC_74x5,                   7455),
       
  8605     /* PowerPC 7445 v1.0 (G4)                                                */
       
  8606     POWERPC_DEF("7445_v1.0",     CPU_POWERPC_74x5_v10,               7445),
       
  8607     /* PowerPC 7455 v1.0 (G4)                                                */
       
  8608     POWERPC_DEF("7455_v1.0",     CPU_POWERPC_74x5_v10,               7455),
       
  8609     /* PowerPC 7445 v2.1 (G4)                                                */
       
  8610     POWERPC_DEF("7445_v2.1",     CPU_POWERPC_74x5_v21,               7445),
       
  8611     /* PowerPC 7455 v2.1 (G4)                                                */
       
  8612     POWERPC_DEF("7455_v2.1",     CPU_POWERPC_74x5_v21,               7455),
       
  8613     /* PowerPC 7445 v3.2 (G4)                                                */
       
  8614     POWERPC_DEF("7445_v3.2",     CPU_POWERPC_74x5_v32,               7445),
       
  8615     /* PowerPC 7455 v3.2 (G4)                                                */
       
  8616     POWERPC_DEF("7455_v3.2",     CPU_POWERPC_74x5_v32,               7455),
       
  8617     /* PowerPC 7445 v3.3 (G4)                                                */
       
  8618     POWERPC_DEF("7445_v3.3",     CPU_POWERPC_74x5_v33,               7445),
       
  8619     /* PowerPC 7455 v3.3 (G4)                                                */
       
  8620     POWERPC_DEF("7455_v3.3",     CPU_POWERPC_74x5_v33,               7455),
       
  8621     /* PowerPC 7445 v3.4 (G4)                                                */
       
  8622     POWERPC_DEF("7445_v3.4",     CPU_POWERPC_74x5_v34,               7445),
       
  8623     /* PowerPC 7455 v3.4 (G4)                                                */
       
  8624     POWERPC_DEF("7455_v3.4",     CPU_POWERPC_74x5_v34,               7455),
       
  8625     /* PowerPC 7447 (G4)                                                     */
       
  8626     POWERPC_DEF("7447",          CPU_POWERPC_74x7,                   7445),
       
  8627     /* PowerPC 7457 (G4)                                                     */
       
  8628     POWERPC_DEF("7457",          CPU_POWERPC_74x7,                   7455),
       
  8629     /* Code name for PowerPC 7447/7457                                       */
       
  8630     POWERPC_DEF("Apollo7",       CPU_POWERPC_74x7,                   7455),
       
  8631     /* PowerPC 7447 v1.0 (G4)                                                */
       
  8632     POWERPC_DEF("7447_v1.0",     CPU_POWERPC_74x7_v10,               7445),
       
  8633     /* PowerPC 7457 v1.0 (G4)                                                */
       
  8634     POWERPC_DEF("7457_v1.0",     CPU_POWERPC_74x7_v10,               7455),
       
  8635     /* PowerPC 7447 v1.1 (G4)                                                */
       
  8636     POWERPC_DEF("7447_v1.1",     CPU_POWERPC_74x7_v11,               7445),
       
  8637     /* PowerPC 7457 v1.1 (G4)                                                */
       
  8638     POWERPC_DEF("7457_v1.1",     CPU_POWERPC_74x7_v11,               7455),
       
  8639     /* PowerPC 7457 v1.2 (G4)                                                */
       
  8640     POWERPC_DEF("7457_v1.2",     CPU_POWERPC_74x7_v12,               7455),
       
  8641     /* PowerPC 7447A (G4)                                                    */
       
  8642     POWERPC_DEF("7447A",         CPU_POWERPC_74x7A,                  7445),
       
  8643     /* PowerPC 7457A (G4)                                                    */
       
  8644     POWERPC_DEF("7457A",         CPU_POWERPC_74x7A,                  7455),
       
  8645     /* PowerPC 7447A v1.0 (G4)                                               */
       
  8646     POWERPC_DEF("7447A_v1.0",    CPU_POWERPC_74x7A_v10,              7445),
       
  8647     /* PowerPC 7457A v1.0 (G4)                                               */
       
  8648     POWERPC_DEF("7457A_v1.0",    CPU_POWERPC_74x7A_v10,              7455),
       
  8649     /* Code name for PowerPC 7447A/7457A                                     */
       
  8650     POWERPC_DEF("Apollo7PM",     CPU_POWERPC_74x7A_v10,              7455),
       
  8651     /* PowerPC 7447A v1.1 (G4)                                               */
       
  8652     POWERPC_DEF("7447A_v1.1",    CPU_POWERPC_74x7A_v11,              7445),
       
  8653     /* PowerPC 7457A v1.1 (G4)                                               */
       
  8654     POWERPC_DEF("7457A_v1.1",    CPU_POWERPC_74x7A_v11,              7455),
       
  8655     /* PowerPC 7447A v1.2 (G4)                                               */
       
  8656     POWERPC_DEF("7447A_v1.2",    CPU_POWERPC_74x7A_v12,              7445),
       
  8657     /* PowerPC 7457A v1.2 (G4)                                               */
       
  8658     POWERPC_DEF("7457A_v1.2",    CPU_POWERPC_74x7A_v12,              7455),
       
  8659     /* 64 bits PowerPC                                                       */
       
  8660 #if defined (TARGET_PPC64)
       
  8661     /* PowerPC 620                                                           */
       
  8662     POWERPC_DEF("620",           CPU_POWERPC_620,                    620),
       
  8663     /* Code name for PowerPC 620                                             */
       
  8664     POWERPC_DEF("Trident",       CPU_POWERPC_620,                    620),
       
  8665 #if defined (TODO)
       
  8666     /* PowerPC 630 (POWER3)                                                  */
       
  8667     POWERPC_DEF("630",           CPU_POWERPC_630,                    630),
       
  8668     POWERPC_DEF("POWER3",        CPU_POWERPC_630,                    630),
       
  8669     /* Code names for POWER3                                                 */
       
  8670     POWERPC_DEF("Boxer",         CPU_POWERPC_630,                    630),
       
  8671     POWERPC_DEF("Dino",          CPU_POWERPC_630,                    630),
       
  8672 #endif
       
  8673 #if defined (TODO)
       
  8674     /* PowerPC 631 (Power 3+)                                                */
       
  8675     POWERPC_DEF("631",           CPU_POWERPC_631,                    631),
       
  8676     POWERPC_DEF("POWER3+",       CPU_POWERPC_631,                    631),
       
  8677 #endif
       
  8678 #if defined (TODO)
       
  8679     /* POWER4                                                                */
       
  8680     POWERPC_DEF("POWER4",        CPU_POWERPC_POWER4,                 POWER4),
       
  8681 #endif
       
  8682 #if defined (TODO)
       
  8683     /* POWER4p                                                               */
       
  8684     POWERPC_DEF("POWER4+",       CPU_POWERPC_POWER4P,                POWER4P),
       
  8685 #endif
       
  8686 #if defined (TODO)
       
  8687     /* POWER5                                                                */
       
  8688     POWERPC_DEF("POWER5",        CPU_POWERPC_POWER5,                 POWER5),
       
  8689     /* POWER5GR                                                              */
       
  8690     POWERPC_DEF("POWER5gr",      CPU_POWERPC_POWER5GR,               POWER5),
       
  8691 #endif
       
  8692 #if defined (TODO)
       
  8693     /* POWER5+                                                               */
       
  8694     POWERPC_DEF("POWER5+",       CPU_POWERPC_POWER5P,                POWER5P),
       
  8695     /* POWER5GS                                                              */
       
  8696     POWERPC_DEF("POWER5gs",      CPU_POWERPC_POWER5GS,               POWER5P),
       
  8697 #endif
       
  8698 #if defined (TODO)
       
  8699     /* POWER6                                                                */
       
  8700     POWERPC_DEF("POWER6",        CPU_POWERPC_POWER6,                 POWER6),
       
  8701     /* POWER6 running in POWER5 mode                                         */
       
  8702     POWERPC_DEF("POWER6_5",      CPU_POWERPC_POWER6_5,               POWER5),
       
  8703     /* POWER6A                                                               */
       
  8704     POWERPC_DEF("POWER6A",       CPU_POWERPC_POWER6A,                POWER6),
       
  8705 #endif
       
  8706     /* PowerPC 970                                                           */
       
  8707     POWERPC_DEF("970",           CPU_POWERPC_970,                    970),
       
  8708     /* PowerPC 970FX (G5)                                                    */
       
  8709     POWERPC_DEF("970fx",         CPU_POWERPC_970FX,                  970FX),
       
  8710     /* PowerPC 970FX v1.0 (G5)                                               */
       
  8711     POWERPC_DEF("970fx_v1.0",    CPU_POWERPC_970FX_v10,              970FX),
       
  8712     /* PowerPC 970FX v2.0 (G5)                                               */
       
  8713     POWERPC_DEF("970fx_v2.0",    CPU_POWERPC_970FX_v20,              970FX),
       
  8714     /* PowerPC 970FX v2.1 (G5)                                               */
       
  8715     POWERPC_DEF("970fx_v2.1",    CPU_POWERPC_970FX_v21,              970FX),
       
  8716     /* PowerPC 970FX v3.0 (G5)                                               */
       
  8717     POWERPC_DEF("970fx_v3.0",    CPU_POWERPC_970FX_v30,              970FX),
       
  8718     /* PowerPC 970FX v3.1 (G5)                                               */
       
  8719     POWERPC_DEF("970fx_v3.1",    CPU_POWERPC_970FX_v31,              970FX),
       
  8720     /* PowerPC 970GX (G5)                                                    */
       
  8721     POWERPC_DEF("970gx",         CPU_POWERPC_970GX,                  970GX),
       
  8722     /* PowerPC 970MP                                                         */
       
  8723     POWERPC_DEF("970mp",         CPU_POWERPC_970MP,                  970MP),
       
  8724     /* PowerPC 970MP v1.0                                                    */
       
  8725     POWERPC_DEF("970mp_v1.0",    CPU_POWERPC_970MP_v10,              970MP),
       
  8726     /* PowerPC 970MP v1.1                                                    */
       
  8727     POWERPC_DEF("970mp_v1.1",    CPU_POWERPC_970MP_v11,              970MP),
       
  8728 #if defined (TODO)
       
  8729     /* PowerPC Cell                                                          */
       
  8730     POWERPC_DEF("Cell",          CPU_POWERPC_CELL,                   970),
       
  8731 #endif
       
  8732 #if defined (TODO)
       
  8733     /* PowerPC Cell v1.0                                                     */
       
  8734     POWERPC_DEF("Cell_v1.0",     CPU_POWERPC_CELL_v10,               970),
       
  8735 #endif
       
  8736 #if defined (TODO)
       
  8737     /* PowerPC Cell v2.0                                                     */
       
  8738     POWERPC_DEF("Cell_v2.0",     CPU_POWERPC_CELL_v20,               970),
       
  8739 #endif
       
  8740 #if defined (TODO)
       
  8741     /* PowerPC Cell v3.0                                                     */
       
  8742     POWERPC_DEF("Cell_v3.0",     CPU_POWERPC_CELL_v30,               970),
       
  8743 #endif
       
  8744 #if defined (TODO)
       
  8745     /* PowerPC Cell v3.1                                                     */
       
  8746     POWERPC_DEF("Cell_v3.1",     CPU_POWERPC_CELL_v31,               970),
       
  8747 #endif
       
  8748 #if defined (TODO)
       
  8749     /* PowerPC Cell v3.2                                                     */
       
  8750     POWERPC_DEF("Cell_v3.2",     CPU_POWERPC_CELL_v32,               970),
       
  8751 #endif
       
  8752 #if defined (TODO)
       
  8753     /* RS64 (Apache/A35)                                                     */
       
  8754     /* This one seems to support the whole POWER2 instruction set
       
  8755      * and the PowerPC 64 one.
       
  8756      */
       
  8757     /* What about A10 & A30 ? */
       
  8758     POWERPC_DEF("RS64",          CPU_POWERPC_RS64,                   RS64),
       
  8759     POWERPC_DEF("Apache",        CPU_POWERPC_RS64,                   RS64),
       
  8760     POWERPC_DEF("A35",           CPU_POWERPC_RS64,                   RS64),
       
  8761 #endif
       
  8762 #if defined (TODO)
       
  8763     /* RS64-II (NorthStar/A50)                                               */
       
  8764     POWERPC_DEF("RS64-II",       CPU_POWERPC_RS64II,                 RS64),
       
  8765     POWERPC_DEF("NorthStar",     CPU_POWERPC_RS64II,                 RS64),
       
  8766     POWERPC_DEF("A50",           CPU_POWERPC_RS64II,                 RS64),
       
  8767 #endif
       
  8768 #if defined (TODO)
       
  8769     /* RS64-III (Pulsar)                                                     */
       
  8770     POWERPC_DEF("RS64-III",      CPU_POWERPC_RS64III,                RS64),
       
  8771     POWERPC_DEF("Pulsar",        CPU_POWERPC_RS64III,                RS64),
       
  8772 #endif
       
  8773 #if defined (TODO)
       
  8774     /* RS64-IV (IceStar/IStar/SStar)                                         */
       
  8775     POWERPC_DEF("RS64-IV",       CPU_POWERPC_RS64IV,                 RS64),
       
  8776     POWERPC_DEF("IceStar",       CPU_POWERPC_RS64IV,                 RS64),
       
  8777     POWERPC_DEF("IStar",         CPU_POWERPC_RS64IV,                 RS64),
       
  8778     POWERPC_DEF("SStar",         CPU_POWERPC_RS64IV,                 RS64),
       
  8779 #endif
       
  8780 #endif /* defined (TARGET_PPC64) */
       
  8781     /* POWER                                                                 */
       
  8782 #if defined (TODO)
       
  8783     /* Original POWER                                                        */
       
  8784     POWERPC_DEF("POWER",         CPU_POWERPC_POWER,                  POWER),
       
  8785     POWERPC_DEF("RIOS",          CPU_POWERPC_POWER,                  POWER),
       
  8786     POWERPC_DEF("RSC",           CPU_POWERPC_POWER,                  POWER),
       
  8787     POWERPC_DEF("RSC3308",       CPU_POWERPC_POWER,                  POWER),
       
  8788     POWERPC_DEF("RSC4608",       CPU_POWERPC_POWER,                  POWER),
       
  8789 #endif
       
  8790 #if defined (TODO)
       
  8791     /* POWER2                                                                */
       
  8792     POWERPC_DEF("POWER2",        CPU_POWERPC_POWER2,                 POWER),
       
  8793     POWERPC_DEF("RSC2",          CPU_POWERPC_POWER2,                 POWER),
       
  8794     POWERPC_DEF("P2SC",          CPU_POWERPC_POWER2,                 POWER),
       
  8795 #endif
       
  8796     /* PA semi cores                                                         */
       
  8797 #if defined (TODO)
       
  8798     /* PA PA6T */
       
  8799     POWERPC_DEF("PA6T",          CPU_POWERPC_PA6T,                   PA6T),
       
  8800 #endif
       
  8801     /* Generic PowerPCs                                                      */
       
  8802 #if defined (TARGET_PPC64)
       
  8803     POWERPC_DEF("ppc64",         CPU_POWERPC_PPC64,                  PPC64),
       
  8804 #endif
       
  8805     POWERPC_DEF("ppc32",         CPU_POWERPC_PPC32,                  PPC32),
       
  8806     POWERPC_DEF("ppc",           CPU_POWERPC_DEFAULT,                DEFAULT),
       
  8807     /* Fallback                                                              */
       
  8808     POWERPC_DEF("default",       CPU_POWERPC_DEFAULT,                DEFAULT),
       
  8809 };
       
  8810 
       
  8811 /*****************************************************************************/
       
  8812 /* Generic CPU instanciation routine                                         */
       
  8813 static void init_ppc_proc (CPUPPCState *env, const ppc_def_t *def)
       
  8814 {
       
  8815 #if !defined(CONFIG_USER_ONLY)
       
  8816     int i;
       
  8817 
       
  8818     env->irq_inputs = NULL;
       
  8819     /* Set all exception vectors to an invalid address */
       
  8820     for (i = 0; i < POWERPC_EXCP_NB; i++)
       
  8821         env->excp_vectors[i] = (target_ulong)(-1ULL);
       
  8822     env->excp_prefix = 0x00000000;
       
  8823     env->ivor_mask = 0x00000000;
       
  8824     env->ivpr_mask = 0x00000000;
       
  8825     /* Default MMU definitions */
       
  8826     env->nb_BATs = 0;
       
  8827     env->nb_tlb = 0;
       
  8828     env->nb_ways = 0;
       
  8829 #endif
       
  8830     /* Register SPR common to all PowerPC implementations */
       
  8831     gen_spr_generic(env);
       
  8832     spr_register(env, SPR_PVR, "PVR",
       
  8833 #if defined(CONFIG_USER_ONLY)
       
  8834                  &spr_read_generic, SPR_NOACCESS,
       
  8835 #else
       
  8836                  SPR_NOACCESS, SPR_NOACCESS,
       
  8837 #endif
       
  8838                  &spr_read_generic, SPR_NOACCESS,
       
  8839                  def->pvr);
       
  8840     /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
       
  8841     if (def->svr != POWERPC_SVR_NONE) {
       
  8842         if (def->svr & POWERPC_SVR_E500) {
       
  8843             spr_register(env, SPR_E500_SVR, "SVR",
       
  8844                          SPR_NOACCESS, SPR_NOACCESS,
       
  8845                          &spr_read_generic, SPR_NOACCESS,
       
  8846                          def->svr & ~POWERPC_SVR_E500);
       
  8847         } else {
       
  8848             spr_register(env, SPR_SVR, "SVR",
       
  8849                          SPR_NOACCESS, SPR_NOACCESS,
       
  8850                          &spr_read_generic, SPR_NOACCESS,
       
  8851                          def->svr);
       
  8852         }
       
  8853     }
       
  8854     /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
       
  8855     (*def->init_proc)(env);
       
  8856     /* MSR bits & flags consistency checks */
       
  8857     if (env->msr_mask & (1 << 25)) {
       
  8858         switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {
       
  8859         case POWERPC_FLAG_SPE:
       
  8860         case POWERPC_FLAG_VRE:
       
  8861             break;
       
  8862         default:
       
  8863             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
       
  8864                     "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
       
  8865             exit(1);
       
  8866         }
       
  8867     } else if (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {
       
  8868         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
       
  8869                 "Should not define POWERPC_FLAG_SPE nor POWERPC_FLAG_VRE\n");
       
  8870         exit(1);
       
  8871     }
       
  8872     if (env->msr_mask & (1 << 17)) {
       
  8873         switch (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) {
       
  8874         case POWERPC_FLAG_TGPR:
       
  8875         case POWERPC_FLAG_CE:
       
  8876             break;
       
  8877         default:
       
  8878             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
       
  8879                     "Should define POWERPC_FLAG_TGPR or POWERPC_FLAG_CE\n");
       
  8880             exit(1);
       
  8881         }
       
  8882     } else if (env->flags & (POWERPC_FLAG_TGPR | POWERPC_FLAG_CE)) {
       
  8883         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
       
  8884                 "Should not define POWERPC_FLAG_TGPR nor POWERPC_FLAG_CE\n");
       
  8885         exit(1);
       
  8886     }
       
  8887     if (env->msr_mask & (1 << 10)) {
       
  8888         switch (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |
       
  8889                               POWERPC_FLAG_UBLE)) {
       
  8890         case POWERPC_FLAG_SE:
       
  8891         case POWERPC_FLAG_DWE:
       
  8892         case POWERPC_FLAG_UBLE:
       
  8893             break;
       
  8894         default:
       
  8895             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
       
  8896                     "Should define POWERPC_FLAG_SE or POWERPC_FLAG_DWE or "
       
  8897                     "POWERPC_FLAG_UBLE\n");
       
  8898             exit(1);
       
  8899         }
       
  8900     } else if (env->flags & (POWERPC_FLAG_SE | POWERPC_FLAG_DWE |
       
  8901                              POWERPC_FLAG_UBLE)) {
       
  8902         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
       
  8903                 "Should not define POWERPC_FLAG_SE nor POWERPC_FLAG_DWE nor "
       
  8904                 "POWERPC_FLAG_UBLE\n");
       
  8905             exit(1);
       
  8906     }
       
  8907     if (env->msr_mask & (1 << 9)) {
       
  8908         switch (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) {
       
  8909         case POWERPC_FLAG_BE:
       
  8910         case POWERPC_FLAG_DE:
       
  8911             break;
       
  8912         default:
       
  8913             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
       
  8914                     "Should define POWERPC_FLAG_BE or POWERPC_FLAG_DE\n");
       
  8915             exit(1);
       
  8916         }
       
  8917     } else if (env->flags & (POWERPC_FLAG_BE | POWERPC_FLAG_DE)) {
       
  8918         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
       
  8919                 "Should not define POWERPC_FLAG_BE nor POWERPC_FLAG_DE\n");
       
  8920         exit(1);
       
  8921     }
       
  8922     if (env->msr_mask & (1 << 2)) {
       
  8923         switch (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {
       
  8924         case POWERPC_FLAG_PX:
       
  8925         case POWERPC_FLAG_PMM:
       
  8926             break;
       
  8927         default:
       
  8928             fprintf(stderr, "PowerPC MSR definition inconsistency\n"
       
  8929                     "Should define POWERPC_FLAG_PX or POWERPC_FLAG_PMM\n");
       
  8930             exit(1);
       
  8931         }
       
  8932     } else if (env->flags & (POWERPC_FLAG_PX | POWERPC_FLAG_PMM)) {
       
  8933         fprintf(stderr, "PowerPC MSR definition inconsistency\n"
       
  8934                 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
       
  8935         exit(1);
       
  8936     }
       
  8937     if ((env->flags & (POWERPC_FLAG_RTC_CLK | POWERPC_FLAG_BUS_CLK)) == 0) {
       
  8938         fprintf(stderr, "PowerPC flags inconsistency\n"
       
  8939                 "Should define the time-base and decrementer clock source\n");
       
  8940         exit(1);
       
  8941     }
       
  8942     /* Allocate TLBs buffer when needed */
       
  8943 #if !defined(CONFIG_USER_ONLY)
       
  8944     if (env->nb_tlb != 0) {
       
  8945         int nb_tlb = env->nb_tlb;
       
  8946         if (env->id_tlbs != 0)
       
  8947             nb_tlb *= 2;
       
  8948         env->tlb = qemu_mallocz(nb_tlb * sizeof(ppc_tlb_t));
       
  8949         /* Pre-compute some useful values */
       
  8950         env->tlb_per_way = env->nb_tlb / env->nb_ways;
       
  8951     }
       
  8952     if (env->irq_inputs == NULL) {
       
  8953         fprintf(stderr, "WARNING: no internal IRQ controller registered.\n"
       
  8954                 " Attempt Qemu to crash very soon !\n");
       
  8955     }
       
  8956 #endif
       
  8957     if (env->check_pow == NULL) {
       
  8958         fprintf(stderr, "WARNING: no power management check handler "
       
  8959                 "registered.\n"
       
  8960                 " Attempt Qemu to crash very soon !\n");
       
  8961     }
       
  8962 }
       
  8963 
       
  8964 #if defined(PPC_DUMP_CPU)
       
  8965 static void dump_ppc_sprs (CPUPPCState *env)
       
  8966 {
       
  8967     ppc_spr_t *spr;
       
  8968 #if !defined(CONFIG_USER_ONLY)
       
  8969     uint32_t sr, sw;
       
  8970 #endif
       
  8971     uint32_t ur, uw;
       
  8972     int i, j, n;
       
  8973 
       
  8974     printf("Special purpose registers:\n");
       
  8975     for (i = 0; i < 32; i++) {
       
  8976         for (j = 0; j < 32; j++) {
       
  8977             n = (i << 5) | j;
       
  8978             spr = &env->spr_cb[n];
       
  8979             uw = spr->uea_write != NULL && spr->uea_write != SPR_NOACCESS;
       
  8980             ur = spr->uea_read != NULL && spr->uea_read != SPR_NOACCESS;
       
  8981 #if !defined(CONFIG_USER_ONLY)
       
  8982             sw = spr->oea_write != NULL && spr->oea_write != SPR_NOACCESS;
       
  8983             sr = spr->oea_read != NULL && spr->oea_read != SPR_NOACCESS;
       
  8984             if (sw || sr || uw || ur) {
       
  8985                 printf("SPR: %4d (%03x) %-8s s%c%c u%c%c\n",
       
  8986                        (i << 5) | j, (i << 5) | j, spr->name,
       
  8987                        sw ? 'w' : '-', sr ? 'r' : '-',
       
  8988                        uw ? 'w' : '-', ur ? 'r' : '-');
       
  8989             }
       
  8990 #else
       
  8991             if (uw || ur) {
       
  8992                 printf("SPR: %4d (%03x) %-8s u%c%c\n",
       
  8993                        (i << 5) | j, (i << 5) | j, spr->name,
       
  8994                        uw ? 'w' : '-', ur ? 'r' : '-');
       
  8995             }
       
  8996 #endif
       
  8997         }
       
  8998     }
       
  8999     fflush(stdout);
       
  9000     fflush(stderr);
       
  9001 }
       
  9002 #endif
       
  9003 
       
  9004 /*****************************************************************************/
       
  9005 #include <stdlib.h>
       
  9006 #include <string.h>
       
  9007 
       
  9008 /* Opcode types */
       
  9009 enum {
       
  9010     PPC_DIRECT   = 0, /* Opcode routine        */
       
  9011     PPC_INDIRECT = 1, /* Indirect opcode table */
       
  9012 };
       
  9013 
       
  9014 static inline int is_indirect_opcode (void *handler)
       
  9015 {
       
  9016     return ((unsigned long)handler & 0x03) == PPC_INDIRECT;
       
  9017 }
       
  9018 
       
  9019 static inline opc_handler_t **ind_table(void *handler)
       
  9020 {
       
  9021     return (opc_handler_t **)((unsigned long)handler & ~3);
       
  9022 }
       
  9023 
       
  9024 /* Instruction table creation */
       
  9025 /* Opcodes tables creation */
       
  9026 static void fill_new_table (opc_handler_t **table, int len)
       
  9027 {
       
  9028     int i;
       
  9029 
       
  9030     for (i = 0; i < len; i++)
       
  9031         table[i] = &invalid_handler;
       
  9032 }
       
  9033 
       
  9034 static int create_new_table (opc_handler_t **table, unsigned char idx)
       
  9035 {
       
  9036     opc_handler_t **tmp;
       
  9037 
       
  9038     tmp = malloc(0x20 * sizeof(opc_handler_t));
       
  9039     if (tmp == NULL)
       
  9040         return -1;
       
  9041     fill_new_table(tmp, 0x20);
       
  9042     table[idx] = (opc_handler_t *)((unsigned long)tmp | PPC_INDIRECT);
       
  9043 
       
  9044     return 0;
       
  9045 }
       
  9046 
       
  9047 static int insert_in_table (opc_handler_t **table, unsigned char idx,
       
  9048                             opc_handler_t *handler)
       
  9049 {
       
  9050     if (table[idx] != &invalid_handler)
       
  9051         return -1;
       
  9052     table[idx] = handler;
       
  9053 
       
  9054     return 0;
       
  9055 }
       
  9056 
       
  9057 static int register_direct_insn (opc_handler_t **ppc_opcodes,
       
  9058                                  unsigned char idx, opc_handler_t *handler)
       
  9059 {
       
  9060     if (insert_in_table(ppc_opcodes, idx, handler) < 0) {
       
  9061         printf("*** ERROR: opcode %02x already assigned in main "
       
  9062                "opcode table\n", idx);
       
  9063 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
       
  9064         printf("           Registered handler '%s' - new handler '%s'\n",
       
  9065                ppc_opcodes[idx]->oname, handler->oname);
       
  9066 #endif
       
  9067         return -1;
       
  9068     }
       
  9069 
       
  9070     return 0;
       
  9071 }
       
  9072 
       
  9073 static int register_ind_in_table (opc_handler_t **table,
       
  9074                                   unsigned char idx1, unsigned char idx2,
       
  9075                                   opc_handler_t *handler)
       
  9076 {
       
  9077     if (table[idx1] == &invalid_handler) {
       
  9078         if (create_new_table(table, idx1) < 0) {
       
  9079             printf("*** ERROR: unable to create indirect table "
       
  9080                    "idx=%02x\n", idx1);
       
  9081             return -1;
       
  9082         }
       
  9083     } else {
       
  9084         if (!is_indirect_opcode(table[idx1])) {
       
  9085             printf("*** ERROR: idx %02x already assigned to a direct "
       
  9086                    "opcode\n", idx1);
       
  9087 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
       
  9088             printf("           Registered handler '%s' - new handler '%s'\n",
       
  9089                    ind_table(table[idx1])[idx2]->oname, handler->oname);
       
  9090 #endif
       
  9091             return -1;
       
  9092         }
       
  9093     }
       
  9094     if (handler != NULL &&
       
  9095         insert_in_table(ind_table(table[idx1]), idx2, handler) < 0) {
       
  9096         printf("*** ERROR: opcode %02x already assigned in "
       
  9097                "opcode table %02x\n", idx2, idx1);
       
  9098 #if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
       
  9099         printf("           Registered handler '%s' - new handler '%s'\n",
       
  9100                ind_table(table[idx1])[idx2]->oname, handler->oname);
       
  9101 #endif
       
  9102         return -1;
       
  9103     }
       
  9104 
       
  9105     return 0;
       
  9106 }
       
  9107 
       
  9108 static int register_ind_insn (opc_handler_t **ppc_opcodes,
       
  9109                               unsigned char idx1, unsigned char idx2,
       
  9110                               opc_handler_t *handler)
       
  9111 {
       
  9112     int ret;
       
  9113 
       
  9114     ret = register_ind_in_table(ppc_opcodes, idx1, idx2, handler);
       
  9115 
       
  9116     return ret;
       
  9117 }
       
  9118 
       
  9119 static int register_dblind_insn (opc_handler_t **ppc_opcodes,
       
  9120                                  unsigned char idx1, unsigned char idx2,
       
  9121                                  unsigned char idx3, opc_handler_t *handler)
       
  9122 {
       
  9123     if (register_ind_in_table(ppc_opcodes, idx1, idx2, NULL) < 0) {
       
  9124         printf("*** ERROR: unable to join indirect table idx "
       
  9125                "[%02x-%02x]\n", idx1, idx2);
       
  9126         return -1;
       
  9127     }
       
  9128     if (register_ind_in_table(ind_table(ppc_opcodes[idx1]), idx2, idx3,
       
  9129                               handler) < 0) {
       
  9130         printf("*** ERROR: unable to insert opcode "
       
  9131                "[%02x-%02x-%02x]\n", idx1, idx2, idx3);
       
  9132         return -1;
       
  9133     }
       
  9134 
       
  9135     return 0;
       
  9136 }
       
  9137 
       
  9138 static int register_insn (opc_handler_t **ppc_opcodes, opcode_t *insn)
       
  9139 {
       
  9140     if (insn->opc2 != 0xFF) {
       
  9141         if (insn->opc3 != 0xFF) {
       
  9142             if (register_dblind_insn(ppc_opcodes, insn->opc1, insn->opc2,
       
  9143                                      insn->opc3, &insn->handler) < 0)
       
  9144                 return -1;
       
  9145         } else {
       
  9146             if (register_ind_insn(ppc_opcodes, insn->opc1,
       
  9147                                   insn->opc2, &insn->handler) < 0)
       
  9148                 return -1;
       
  9149         }
       
  9150     } else {
       
  9151         if (register_direct_insn(ppc_opcodes, insn->opc1, &insn->handler) < 0)
       
  9152             return -1;
       
  9153     }
       
  9154 
       
  9155     return 0;
       
  9156 }
       
  9157 
       
  9158 static int test_opcode_table (opc_handler_t **table, int len)
       
  9159 {
       
  9160     int i, count, tmp;
       
  9161 
       
  9162     for (i = 0, count = 0; i < len; i++) {
       
  9163         /* Consistency fixup */
       
  9164         if (table[i] == NULL)
       
  9165             table[i] = &invalid_handler;
       
  9166         if (table[i] != &invalid_handler) {
       
  9167             if (is_indirect_opcode(table[i])) {
       
  9168                 tmp = test_opcode_table(ind_table(table[i]), 0x20);
       
  9169                 if (tmp == 0) {
       
  9170                     free(table[i]);
       
  9171                     table[i] = &invalid_handler;
       
  9172                 } else {
       
  9173                     count++;
       
  9174                 }
       
  9175             } else {
       
  9176                 count++;
       
  9177             }
       
  9178         }
       
  9179     }
       
  9180 
       
  9181     return count;
       
  9182 }
       
  9183 
       
  9184 static void fix_opcode_tables (opc_handler_t **ppc_opcodes)
       
  9185 {
       
  9186     if (test_opcode_table(ppc_opcodes, 0x40) == 0)
       
  9187         printf("*** WARNING: no opcode defined !\n");
       
  9188 }
       
  9189 
       
  9190 /*****************************************************************************/
       
  9191 static int create_ppc_opcodes (CPUPPCState *env, const ppc_def_t *def)
       
  9192 {
       
  9193     opcode_t *opc, *start, *end;
       
  9194 
       
  9195     fill_new_table(env->opcodes, 0x40);
       
  9196     if (&opc_start < &opc_end) {
       
  9197         start = &opc_start;
       
  9198         end = &opc_end;
       
  9199     } else {
       
  9200         start = &opc_end;
       
  9201         end = &opc_start;
       
  9202     }
       
  9203     for (opc = start + 1; opc != end; opc++) {
       
  9204         if ((opc->handler.type & def->insns_flags) != 0) {
       
  9205             if (register_insn(env->opcodes, opc) < 0) {
       
  9206                 printf("*** ERROR initializing PowerPC instruction "
       
  9207                        "0x%02x 0x%02x 0x%02x\n", opc->opc1, opc->opc2,
       
  9208                        opc->opc3);
       
  9209                 return -1;
       
  9210             }
       
  9211         }
       
  9212     }
       
  9213     fix_opcode_tables(env->opcodes);
       
  9214     fflush(stdout);
       
  9215     fflush(stderr);
       
  9216 
       
  9217     return 0;
       
  9218 }
       
  9219 
       
  9220 #if defined(PPC_DUMP_CPU)
       
  9221 static void dump_ppc_insns (CPUPPCState *env)
       
  9222 {
       
  9223     opc_handler_t **table, *handler;
       
  9224     const char *p, *q;
       
  9225     uint8_t opc1, opc2, opc3;
       
  9226 
       
  9227     printf("Instructions set:\n");
       
  9228     /* opc1 is 6 bits long */
       
  9229     for (opc1 = 0x00; opc1 < 0x40; opc1++) {
       
  9230         table = env->opcodes;
       
  9231         handler = table[opc1];
       
  9232         if (is_indirect_opcode(handler)) {
       
  9233             /* opc2 is 5 bits long */
       
  9234             for (opc2 = 0; opc2 < 0x20; opc2++) {
       
  9235                 table = env->opcodes;
       
  9236                 handler = env->opcodes[opc1];
       
  9237                 table = ind_table(handler);
       
  9238                 handler = table[opc2];
       
  9239                 if (is_indirect_opcode(handler)) {
       
  9240                     table = ind_table(handler);
       
  9241                     /* opc3 is 5 bits long */
       
  9242                     for (opc3 = 0; opc3 < 0x20; opc3++) {
       
  9243                         handler = table[opc3];
       
  9244                         if (handler->handler != &gen_invalid) {
       
  9245                             /* Special hack to properly dump SPE insns */
       
  9246                             p = strchr(handler->oname, '_');
       
  9247                             if (p == NULL) {
       
  9248                                 printf("INSN: %02x %02x %02x (%02d %04d) : "
       
  9249                                        "%s\n",
       
  9250                                        opc1, opc2, opc3, opc1,
       
  9251                                        (opc3 << 5) | opc2,
       
  9252                                        handler->oname);
       
  9253                             } else {
       
  9254                                 q = "speundef";
       
  9255                                 if ((p - handler->oname) != strlen(q) ||
       
  9256                                     memcmp(handler->oname, q, strlen(q)) != 0) {
       
  9257                                     /* First instruction */
       
  9258                                     printf("INSN: %02x %02x %02x (%02d %04d) : "
       
  9259                                            "%.*s\n",
       
  9260                                            opc1, opc2 << 1, opc3, opc1,
       
  9261                                            (opc3 << 6) | (opc2 << 1),
       
  9262                                            (int)(p - handler->oname),
       
  9263                                            handler->oname);
       
  9264                                 }
       
  9265                                 if (strcmp(p + 1, q) != 0) {
       
  9266                                     /* Second instruction */
       
  9267                                     printf("INSN: %02x %02x %02x (%02d %04d) : "
       
  9268                                            "%s\n",
       
  9269                                            opc1, (opc2 << 1) | 1, opc3, opc1,
       
  9270                                            (opc3 << 6) | (opc2 << 1) | 1,
       
  9271                                            p + 1);
       
  9272                                 }
       
  9273                             }
       
  9274                         }
       
  9275                     }
       
  9276                 } else {
       
  9277                     if (handler->handler != &gen_invalid) {
       
  9278                         printf("INSN: %02x %02x -- (%02d %04d) : %s\n",
       
  9279                                opc1, opc2, opc1, opc2, handler->oname);
       
  9280                     }
       
  9281                 }
       
  9282             }
       
  9283         } else {
       
  9284             if (handler->handler != &gen_invalid) {
       
  9285                 printf("INSN: %02x -- -- (%02d ----) : %s\n",
       
  9286                        opc1, opc1, handler->oname);
       
  9287             }
       
  9288         }
       
  9289     }
       
  9290 }
       
  9291 #endif
       
  9292 
       
  9293 int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def)
       
  9294 {
       
  9295     env->msr_mask = def->msr_mask;
       
  9296     env->mmu_model = def->mmu_model;
       
  9297     env->excp_model = def->excp_model;
       
  9298     env->bus_model = def->bus_model;
       
  9299     env->flags = def->flags;
       
  9300     env->bfd_mach = def->bfd_mach;
       
  9301     env->check_pow = def->check_pow;
       
  9302     if (create_ppc_opcodes(env, def) < 0)
       
  9303         return -1;
       
  9304     init_ppc_proc(env, def);
       
  9305 #if defined(PPC_DUMP_CPU)
       
  9306     {
       
  9307         const char *mmu_model, *excp_model, *bus_model;
       
  9308         switch (env->mmu_model) {
       
  9309         case POWERPC_MMU_32B:
       
  9310             mmu_model = "PowerPC 32";
       
  9311             break;
       
  9312         case POWERPC_MMU_SOFT_6xx:
       
  9313             mmu_model = "PowerPC 6xx/7xx with software driven TLBs";
       
  9314             break;
       
  9315         case POWERPC_MMU_SOFT_74xx:
       
  9316             mmu_model = "PowerPC 74xx with software driven TLBs";
       
  9317             break;
       
  9318         case POWERPC_MMU_SOFT_4xx:
       
  9319             mmu_model = "PowerPC 4xx with software driven TLBs";
       
  9320             break;
       
  9321         case POWERPC_MMU_SOFT_4xx_Z:
       
  9322             mmu_model = "PowerPC 4xx with software driven TLBs "
       
  9323                 "and zones protections";
       
  9324             break;
       
  9325         case POWERPC_MMU_REAL:
       
  9326             mmu_model = "PowerPC real mode only";
       
  9327             break;
       
  9328         case POWERPC_MMU_MPC8xx:
       
  9329             mmu_model = "PowerPC MPC8xx";
       
  9330             break;
       
  9331         case POWERPC_MMU_BOOKE:
       
  9332             mmu_model = "PowerPC BookE";
       
  9333             break;
       
  9334         case POWERPC_MMU_BOOKE_FSL:
       
  9335             mmu_model = "PowerPC BookE FSL";
       
  9336             break;
       
  9337         case POWERPC_MMU_601:
       
  9338             mmu_model = "PowerPC 601";
       
  9339             break;
       
  9340 #if defined (TARGET_PPC64)
       
  9341         case POWERPC_MMU_64B:
       
  9342             mmu_model = "PowerPC 64";
       
  9343             break;
       
  9344         case POWERPC_MMU_620:
       
  9345             mmu_model = "PowerPC 620";
       
  9346             break;
       
  9347 #endif
       
  9348         default:
       
  9349             mmu_model = "Unknown or invalid";
       
  9350             break;
       
  9351         }
       
  9352         switch (env->excp_model) {
       
  9353         case POWERPC_EXCP_STD:
       
  9354             excp_model = "PowerPC";
       
  9355             break;
       
  9356         case POWERPC_EXCP_40x:
       
  9357             excp_model = "PowerPC 40x";
       
  9358             break;
       
  9359         case POWERPC_EXCP_601:
       
  9360             excp_model = "PowerPC 601";
       
  9361             break;
       
  9362         case POWERPC_EXCP_602:
       
  9363             excp_model = "PowerPC 602";
       
  9364             break;
       
  9365         case POWERPC_EXCP_603:
       
  9366             excp_model = "PowerPC 603";
       
  9367             break;
       
  9368         case POWERPC_EXCP_603E:
       
  9369             excp_model = "PowerPC 603e";
       
  9370             break;
       
  9371         case POWERPC_EXCP_604:
       
  9372             excp_model = "PowerPC 604";
       
  9373             break;
       
  9374         case POWERPC_EXCP_7x0:
       
  9375             excp_model = "PowerPC 740/750";
       
  9376             break;
       
  9377         case POWERPC_EXCP_7x5:
       
  9378             excp_model = "PowerPC 745/755";
       
  9379             break;
       
  9380         case POWERPC_EXCP_74xx:
       
  9381             excp_model = "PowerPC 74xx";
       
  9382             break;
       
  9383         case POWERPC_EXCP_BOOKE:
       
  9384             excp_model = "PowerPC BookE";
       
  9385             break;
       
  9386 #if defined (TARGET_PPC64)
       
  9387         case POWERPC_EXCP_970:
       
  9388             excp_model = "PowerPC 970";
       
  9389             break;
       
  9390 #endif
       
  9391         default:
       
  9392             excp_model = "Unknown or invalid";
       
  9393             break;
       
  9394         }
       
  9395         switch (env->bus_model) {
       
  9396         case PPC_FLAGS_INPUT_6xx:
       
  9397             bus_model = "PowerPC 6xx";
       
  9398             break;
       
  9399         case PPC_FLAGS_INPUT_BookE:
       
  9400             bus_model = "PowerPC BookE";
       
  9401             break;
       
  9402         case PPC_FLAGS_INPUT_405:
       
  9403             bus_model = "PowerPC 405";
       
  9404             break;
       
  9405         case PPC_FLAGS_INPUT_401:
       
  9406             bus_model = "PowerPC 401/403";
       
  9407             break;
       
  9408         case PPC_FLAGS_INPUT_RCPU:
       
  9409             bus_model = "RCPU / MPC8xx";
       
  9410             break;
       
  9411 #if defined (TARGET_PPC64)
       
  9412         case PPC_FLAGS_INPUT_970:
       
  9413             bus_model = "PowerPC 970";
       
  9414             break;
       
  9415 #endif
       
  9416         default:
       
  9417             bus_model = "Unknown or invalid";
       
  9418             break;
       
  9419         }
       
  9420         printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64 "\n"
       
  9421                "    MMU model        : %s\n",
       
  9422                def->name, def->pvr, def->msr_mask, mmu_model);
       
  9423 #if !defined(CONFIG_USER_ONLY)
       
  9424         if (env->tlb != NULL) {
       
  9425             printf("                       %d %s TLB in %d ways\n",
       
  9426                    env->nb_tlb, env->id_tlbs ? "splitted" : "merged",
       
  9427                    env->nb_ways);
       
  9428         }
       
  9429 #endif
       
  9430         printf("    Exceptions model : %s\n"
       
  9431                "    Bus model        : %s\n",
       
  9432                excp_model, bus_model);
       
  9433         printf("    MSR features     :\n");
       
  9434         if (env->flags & POWERPC_FLAG_SPE)
       
  9435             printf("                        signal processing engine enable"
       
  9436                    "\n");
       
  9437         else if (env->flags & POWERPC_FLAG_VRE)
       
  9438             printf("                        vector processor enable\n");
       
  9439         if (env->flags & POWERPC_FLAG_TGPR)
       
  9440             printf("                        temporary GPRs\n");
       
  9441         else if (env->flags & POWERPC_FLAG_CE)
       
  9442             printf("                        critical input enable\n");
       
  9443         if (env->flags & POWERPC_FLAG_SE)
       
  9444             printf("                        single-step trace mode\n");
       
  9445         else if (env->flags & POWERPC_FLAG_DWE)
       
  9446             printf("                        debug wait enable\n");
       
  9447         else if (env->flags & POWERPC_FLAG_UBLE)
       
  9448             printf("                        user BTB lock enable\n");
       
  9449         if (env->flags & POWERPC_FLAG_BE)
       
  9450             printf("                        branch-step trace mode\n");
       
  9451         else if (env->flags & POWERPC_FLAG_DE)
       
  9452             printf("                        debug interrupt enable\n");
       
  9453         if (env->flags & POWERPC_FLAG_PX)
       
  9454             printf("                        inclusive protection\n");
       
  9455         else if (env->flags & POWERPC_FLAG_PMM)
       
  9456             printf("                        performance monitor mark\n");
       
  9457         if (env->flags == POWERPC_FLAG_NONE)
       
  9458             printf("                        none\n");
       
  9459         printf("    Time-base/decrementer clock source: %s\n",
       
  9460                env->flags & POWERPC_FLAG_RTC_CLK ? "RTC clock" : "bus clock");
       
  9461     }
       
  9462     dump_ppc_insns(env);
       
  9463     dump_ppc_sprs(env);
       
  9464     fflush(stdout);
       
  9465 #endif
       
  9466 
       
  9467     return 0;
       
  9468 }
       
  9469 
       
  9470 static const ppc_def_t *ppc_find_by_pvr (uint32_t pvr)
       
  9471 {
       
  9472     const ppc_def_t *ret;
       
  9473     uint32_t pvr_rev;
       
  9474     int i, best, match, best_match, max;
       
  9475 
       
  9476     ret = NULL;
       
  9477     max = ARRAY_SIZE(ppc_defs);
       
  9478     best = -1;
       
  9479     pvr_rev = pvr & 0xFFFF;
       
  9480     /* We want all specified bits to match */
       
  9481     best_match = 32 - ctz32(pvr_rev);
       
  9482     for (i = 0; i < max; i++) {
       
  9483         /* We check that the 16 higher bits are the same to ensure the CPU
       
  9484          * model will be the choosen one.
       
  9485          */
       
  9486         if (((pvr ^ ppc_defs[i].pvr) >> 16) == 0) {
       
  9487             /* We want as much as possible of the low-level 16 bits
       
  9488              * to be the same but we allow inexact matches.
       
  9489              */
       
  9490             match = clz32(pvr_rev ^ (ppc_defs[i].pvr & 0xFFFF));
       
  9491             /* We check '>=' instead of '>' because the PPC_defs table
       
  9492              * is ordered by increasing revision.
       
  9493              * Then, we will match the higher revision compatible
       
  9494              * with the requested PVR
       
  9495              */
       
  9496             if (match >= best_match) {
       
  9497                 best = i;
       
  9498                 best_match = match;
       
  9499             }
       
  9500         }
       
  9501     }
       
  9502     if (best != -1)
       
  9503         ret = &ppc_defs[best];
       
  9504 
       
  9505     return ret;
       
  9506 }
       
  9507 
       
  9508 #include <ctype.h>
       
  9509 
       
  9510 const ppc_def_t *cpu_ppc_find_by_name (const char *name)
       
  9511 {
       
  9512     const ppc_def_t *ret;
       
  9513     const char *p;
       
  9514     int i, max, len;
       
  9515 
       
  9516     /* Check if the given name is a PVR */
       
  9517     len = strlen(name);
       
  9518     if (len == 10 && name[0] == '0' && name[1] == 'x') {
       
  9519         p = name + 2;
       
  9520         goto check_pvr;
       
  9521     } else if (len == 8) {
       
  9522         p = name;
       
  9523     check_pvr:
       
  9524         for (i = 0; i < 8; i++) {
       
  9525             if (!qemu_isxdigit(*p++))
       
  9526                 break;
       
  9527         }
       
  9528         if (i == 8)
       
  9529             return ppc_find_by_pvr(strtoul(name, NULL, 16));
       
  9530     }
       
  9531     ret = NULL;
       
  9532     max = ARRAY_SIZE(ppc_defs);
       
  9533     for (i = 0; i < max; i++) {
       
  9534         if (strcasecmp(name, ppc_defs[i].name) == 0) {
       
  9535             ret = &ppc_defs[i];
       
  9536             break;
       
  9537         }
       
  9538     }
       
  9539 
       
  9540     return ret;
       
  9541 }
       
  9542 
       
  9543 void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
       
  9544 {
       
  9545     int i, max;
       
  9546 
       
  9547     max = ARRAY_SIZE(ppc_defs);
       
  9548     for (i = 0; i < max; i++) {
       
  9549         (*cpu_fprintf)(f, "PowerPC %-16s PVR %08x\n",
       
  9550                        ppc_defs[i].name, ppc_defs[i].pvr);
       
  9551     }
       
  9552 }