Commit f2e63a42c9151d17d734ce5a173d81f1598f0565

Authored by j_mayer
1 parent d26bfc9a

Reorganize the CPUPPCState structure to group features.

Add #ifdef to avoid compiling not relevant resources:
- MMU related stuff for user-mode only targets
- PowerPC 64 only resources for PowerPC 32 targets
- embedded PowerPC extensions for non-ppcemb targets.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3343 c046a42c-6fe2-441c-8c8c-71466251a162
target-ppc/cpu.h
@@ -495,9 +495,14 @@ struct CPUPPCState { @@ -495,9 +495,14 @@ struct CPUPPCState {
495 int access_type; /* when a memory exception occurs, the access 495 int access_type; /* when a memory exception occurs, the access
496 type is stored here */ 496 type is stored here */
497 497
498 - /* MMU context */ 498 + /* MMU context - only relevant for full system emulation */
  499 +#if !defined(CONFIG_USER_ONLY)
  500 +#if defined(TARGET_PPC64)
499 /* Address space register */ 501 /* Address space register */
500 target_ulong asr; 502 target_ulong asr;
  503 + /* PowerPC 64 SLB area */
  504 + int slb_nr;
  505 +#endif
501 /* segment registers */ 506 /* segment registers */
502 target_ulong sdr1; 507 target_ulong sdr1;
503 target_ulong sr[16]; 508 target_ulong sr[16];
@@ -505,17 +510,31 @@ struct CPUPPCState { @@ -505,17 +510,31 @@ struct CPUPPCState {
505 int nb_BATs; 510 int nb_BATs;
506 target_ulong DBAT[2][8]; 511 target_ulong DBAT[2][8];
507 target_ulong IBAT[2][8]; 512 target_ulong IBAT[2][8];
  513 + /* PowerPC TLB registers (for 4xx and 60x software driven TLBs) */
  514 + int nb_tlb; /* Total number of TLB */
  515 + int tlb_per_way; /* Speed-up helper: used to avoid divisions at run time */
  516 + int nb_ways; /* Number of ways in the TLB set */
  517 + int last_way; /* Last used way used to allocate TLB in a LRU way */
  518 + int id_tlbs; /* If 1, MMU has separated TLBs for instructions & data */
  519 + int nb_pids; /* Number of available PID registers */
  520 + ppc_tlb_t *tlb; /* TLB is optional. Allocate them only if needed */
  521 + /* 403 dedicated access protection registers */
  522 + target_ulong pb[4];
  523 +#endif
508 524
509 /* Other registers */ 525 /* Other registers */
510 /* Special purpose registers */ 526 /* Special purpose registers */
511 target_ulong spr[1024]; 527 target_ulong spr[1024];
  528 + ppc_spr_t spr_cb[1024];
512 /* Altivec registers */ 529 /* Altivec registers */
513 ppc_avr_t avr[32]; 530 ppc_avr_t avr[32];
514 uint32_t vscr; 531 uint32_t vscr;
  532 +#if defined(TARGET_PPCEMB)
515 /* SPE registers */ 533 /* SPE registers */
516 ppc_gpr_t spe_acc; 534 ppc_gpr_t spe_acc;
517 float_status spe_status; 535 float_status spe_status;
518 uint32_t spe_fscr; 536 uint32_t spe_fscr;
  537 +#endif
519 538
520 /* Internal devices resources */ 539 /* Internal devices resources */
521 /* Time base and decrementer */ 540 /* Time base and decrementer */
@@ -523,19 +542,6 @@ struct CPUPPCState { @@ -523,19 +542,6 @@ struct CPUPPCState {
523 /* Device control registers */ 542 /* Device control registers */
524 ppc_dcr_t *dcr_env; 543 ppc_dcr_t *dcr_env;
525 544
526 - /* PowerPC TLB registers (for 4xx and 60x software driven TLBs) */  
527 - int nb_tlb; /* Total number of TLB */  
528 - int tlb_per_way; /* Speed-up helper: used to avoid divisions at run time */  
529 - int nb_ways; /* Number of ways in the TLB set */  
530 - int last_way; /* Last used way used to allocate TLB in a LRU way */  
531 - int id_tlbs; /* If 1, MMU has separated TLBs for instructions & data */  
532 - int nb_pids; /* Number of available PID registers */  
533 - ppc_tlb_t *tlb; /* TLB is optional. Allocate them only if needed */  
534 - /* 403 dedicated access protection registers */  
535 - target_ulong pb[4];  
536 - /* PowerPC 64 SLB area */  
537 - int slb_nr;  
538 -  
539 int dcache_line_size; 545 int dcache_line_size;
540 int icache_line_size; 546 int icache_line_size;
541 547
@@ -570,8 +576,7 @@ struct CPUPPCState { @@ -570,8 +576,7 @@ struct CPUPPCState {
570 /* Those resources are used only during code translation */ 576 /* Those resources are used only during code translation */
571 /* Next instruction pointer */ 577 /* Next instruction pointer */
572 target_ulong nip; 578 target_ulong nip;
573 - /* SPR translation callbacks */  
574 - ppc_spr_t spr_cb[1024]; 579 +
575 /* opcode handlers */ 580 /* opcode handlers */
576 opc_handler_t *opcodes[0x40]; 581 opc_handler_t *opcodes[0x40];
577 582
target-ppc/translate.c
@@ -6448,9 +6448,11 @@ void cpu_dump_state (CPUState *env, FILE *f, @@ -6448,9 +6448,11 @@ void cpu_dump_state (CPUState *env, FILE *f,
6448 if ((i & (RFPL - 1)) == (RFPL - 1)) 6448 if ((i & (RFPL - 1)) == (RFPL - 1))
6449 cpu_fprintf(f, "\n"); 6449 cpu_fprintf(f, "\n");
6450 } 6450 }
  6451 +#if !defined(CONFIG_USER_ONLY)
6451 cpu_fprintf(f, "SRR0 " REGX " SRR1 " REGX " " FILL FILL FILL 6452 cpu_fprintf(f, "SRR0 " REGX " SRR1 " REGX " " FILL FILL FILL
6452 "SDR1 " REGX "\n", 6453 "SDR1 " REGX "\n",
6453 env->spr[SPR_SRR0], env->spr[SPR_SRR1], env->sdr1); 6454 env->spr[SPR_SRR0], env->spr[SPR_SRR1], env->sdr1);
  6455 +#endif
6454 6456
6455 #undef RGPL 6457 #undef RGPL
6456 #undef RFPL 6458 #undef RFPL
target-ppc/translate_init.c
@@ -533,6 +533,7 @@ static void gen_spr_ne_601 (CPUPPCState *env) @@ -533,6 +533,7 @@ static void gen_spr_ne_601 (CPUPPCState *env)
533 /* BATs 0-3 */ 533 /* BATs 0-3 */
534 static void gen_low_BATs (CPUPPCState *env) 534 static void gen_low_BATs (CPUPPCState *env)
535 { 535 {
  536 +#if !defined(CONFIG_USER_ONLY)
536 spr_register(env, SPR_IBAT0U, "IBAT0U", 537 spr_register(env, SPR_IBAT0U, "IBAT0U",
537 SPR_NOACCESS, SPR_NOACCESS, 538 SPR_NOACCESS, SPR_NOACCESS,
538 &spr_read_ibat, &spr_write_ibatu, 539 &spr_read_ibat, &spr_write_ibatu,
@@ -598,11 +599,13 @@ static void gen_low_BATs (CPUPPCState *env) @@ -598,11 +599,13 @@ static void gen_low_BATs (CPUPPCState *env)
598 &spr_read_dbat, &spr_write_dbatl, 599 &spr_read_dbat, &spr_write_dbatl,
599 0x00000000); 600 0x00000000);
600 env->nb_BATs += 4; 601 env->nb_BATs += 4;
  602 +#endif
601 } 603 }
602 604
603 /* BATs 4-7 */ 605 /* BATs 4-7 */
604 static void gen_high_BATs (CPUPPCState *env) 606 static void gen_high_BATs (CPUPPCState *env)
605 { 607 {
  608 +#if !defined(CONFIG_USER_ONLY)
606 spr_register(env, SPR_IBAT4U, "IBAT4U", 609 spr_register(env, SPR_IBAT4U, "IBAT4U",
607 SPR_NOACCESS, SPR_NOACCESS, 610 SPR_NOACCESS, SPR_NOACCESS,
608 &spr_read_ibat_h, &spr_write_ibatu_h, 611 &spr_read_ibat_h, &spr_write_ibatu_h,
@@ -668,6 +671,7 @@ static void gen_high_BATs (CPUPPCState *env) @@ -668,6 +671,7 @@ static void gen_high_BATs (CPUPPCState *env)
668 &spr_read_dbat_h, &spr_write_dbatl_h, 671 &spr_read_dbat_h, &spr_write_dbatl_h,
669 0x00000000); 672 0x00000000);
670 env->nb_BATs += 4; 673 env->nb_BATs += 4;
  674 +#endif
671 } 675 }
672 676
673 /* Generic PowerPC time base */ 677 /* Generic PowerPC time base */
@@ -694,6 +698,7 @@ static void gen_tbl (CPUPPCState *env) @@ -694,6 +698,7 @@ static void gen_tbl (CPUPPCState *env)
694 /* Softare table search registers */ 698 /* Softare table search registers */
695 static void gen_6xx_7xx_soft_tlb (CPUPPCState *env, int nb_tlbs, int nb_ways) 699 static void gen_6xx_7xx_soft_tlb (CPUPPCState *env, int nb_tlbs, int nb_ways)
696 { 700 {
  701 +#if !defined(CONFIG_USER_ONLY)
697 env->nb_tlb = nb_tlbs; 702 env->nb_tlb = nb_tlbs;
698 env->nb_ways = nb_ways; 703 env->nb_ways = nb_ways;
699 env->id_tlbs = 1; 704 env->id_tlbs = 1;
@@ -725,6 +730,7 @@ static void gen_6xx_7xx_soft_tlb (CPUPPCState *env, int nb_tlbs, int nb_ways) @@ -725,6 +730,7 @@ static void gen_6xx_7xx_soft_tlb (CPUPPCState *env, int nb_tlbs, int nb_ways)
725 SPR_NOACCESS, SPR_NOACCESS, 730 SPR_NOACCESS, SPR_NOACCESS,
726 &spr_read_generic, &spr_write_generic, 731 &spr_read_generic, &spr_write_generic,
727 0x00000000); 732 0x00000000);
  733 +#endif
728 } 734 }
729 735
730 /* SPR common to MPC755 and G2 */ 736 /* SPR common to MPC755 and G2 */
@@ -1105,6 +1111,7 @@ static void gen_spr_601 (CPUPPCState *env) @@ -1105,6 +1111,7 @@ static void gen_spr_601 (CPUPPCState *env)
1105 &spr_read_generic, &spr_write_generic, 1111 &spr_read_generic, &spr_write_generic,
1106 0x00000000); 1112 0x00000000);
1107 /* Memory management */ 1113 /* Memory management */
  1114 +#if !defined(CONFIG_USER_ONLY)
1108 spr_register(env, SPR_IBAT0U, "IBAT0U", 1115 spr_register(env, SPR_IBAT0U, "IBAT0U",
1109 SPR_NOACCESS, SPR_NOACCESS, 1116 SPR_NOACCESS, SPR_NOACCESS,
1110 &spr_read_601_ubat, &spr_write_601_ubatu, 1117 &spr_read_601_ubat, &spr_write_601_ubatu,
@@ -1138,6 +1145,7 @@ static void gen_spr_601 (CPUPPCState *env) @@ -1138,6 +1145,7 @@ static void gen_spr_601 (CPUPPCState *env)
1138 &spr_read_601_ubat, &spr_write_601_ubatl, 1145 &spr_read_601_ubat, &spr_write_601_ubatl,
1139 0x00000000); 1146 0x00000000);
1140 env->nb_BATs = 4; 1147 env->nb_BATs = 4;
  1148 +#endif
1141 } 1149 }
1142 1150
1143 static void gen_spr_74xx (CPUPPCState *env) 1151 static void gen_spr_74xx (CPUPPCState *env)
@@ -1238,6 +1246,7 @@ static void gen_l3_ctrl (CPUPPCState *env) @@ -1238,6 +1246,7 @@ static void gen_l3_ctrl (CPUPPCState *env)
1238 1246
1239 static void gen_74xx_soft_tlb (CPUPPCState *env, int nb_tlbs, int nb_ways) 1247 static void gen_74xx_soft_tlb (CPUPPCState *env, int nb_tlbs, int nb_ways)
1240 { 1248 {
  1249 +#if !defined(CONFIG_USER_ONLY)
1241 env->nb_tlb = nb_tlbs; 1250 env->nb_tlb = nb_tlbs;
1242 env->nb_ways = nb_ways; 1251 env->nb_ways = nb_ways;
1243 env->id_tlbs = 1; 1252 env->id_tlbs = 1;
@@ -1256,6 +1265,7 @@ static void gen_74xx_soft_tlb (CPUPPCState *env, int nb_tlbs, int nb_ways) @@ -1256,6 +1265,7 @@ static void gen_74xx_soft_tlb (CPUPPCState *env, int nb_tlbs, int nb_ways)
1256 SPR_NOACCESS, SPR_NOACCESS, 1265 SPR_NOACCESS, SPR_NOACCESS,
1257 &spr_read_generic, &spr_write_generic, 1266 &spr_read_generic, &spr_write_generic,
1258 0x00000000); 1267 0x00000000);
  1268 +#endif
1259 } 1269 }
1260 1270
1261 /* PowerPC BookE SPR */ 1271 /* PowerPC BookE SPR */
@@ -1512,6 +1522,7 @@ static void gen_spr_BookE (CPUPPCState *env) @@ -1512,6 +1522,7 @@ static void gen_spr_BookE (CPUPPCState *env)
1512 /* FSL storage control registers */ 1522 /* FSL storage control registers */
1513 static void gen_spr_BookE_FSL (CPUPPCState *env) 1523 static void gen_spr_BookE_FSL (CPUPPCState *env)
1514 { 1524 {
  1525 +#if !defined(CONFIG_USER_ONLY)
1515 /* TLB assist registers */ 1526 /* TLB assist registers */
1516 /* XXX : not implemented */ 1527 /* XXX : not implemented */
1517 spr_register(env, SPR_BOOKE_MAS0, "MAS0", 1528 spr_register(env, SPR_BOOKE_MAS0, "MAS0",
@@ -1605,6 +1616,7 @@ static void gen_spr_BookE_FSL (CPUPPCState *env) @@ -1605,6 +1616,7 @@ static void gen_spr_BookE_FSL (CPUPPCState *env)
1605 default: 1616 default:
1606 break; 1617 break;
1607 } 1618 }
  1619 +#endif
1608 } 1620 }
1609 1621
1610 /* SPR specific to PowerPC 440 implementation */ 1622 /* SPR specific to PowerPC 440 implementation */
@@ -2616,9 +2628,11 @@ static void init_proc_401x2 (CPUPPCState *env) @@ -2616,9 +2628,11 @@ static void init_proc_401x2 (CPUPPCState *env)
2616 gen_spr_401x2(env); 2628 gen_spr_401x2(env);
2617 gen_spr_compress(env); 2629 gen_spr_compress(env);
2618 /* Memory management */ 2630 /* Memory management */
  2631 +#if !defined(CONFIG_USER_ONLY)
2619 env->nb_tlb = 64; 2632 env->nb_tlb = 64;
2620 env->nb_ways = 1; 2633 env->nb_ways = 1;
2621 env->id_tlbs = 0; 2634 env->id_tlbs = 0;
  2635 +#endif
2622 init_excp_4xx_softmmu(env); 2636 init_excp_4xx_softmmu(env);
2623 env->dcache_line_size = 32; 2637 env->dcache_line_size = 32;
2624 env->icache_line_size = 32; 2638 env->icache_line_size = 32;
@@ -2674,9 +2688,11 @@ static void init_proc_IOP480 (CPUPPCState *env) @@ -2674,9 +2688,11 @@ static void init_proc_IOP480 (CPUPPCState *env)
2674 gen_spr_401x2(env); 2688 gen_spr_401x2(env);
2675 gen_spr_compress(env); 2689 gen_spr_compress(env);
2676 /* Memory management */ 2690 /* Memory management */
  2691 +#if !defined(CONFIG_USER_ONLY)
2677 env->nb_tlb = 64; 2692 env->nb_tlb = 64;
2678 env->nb_ways = 1; 2693 env->nb_ways = 1;
2679 env->id_tlbs = 0; 2694 env->id_tlbs = 0;
  2695 +#endif
2680 init_excp_4xx_softmmu(env); 2696 init_excp_4xx_softmmu(env);
2681 env->dcache_line_size = 32; 2697 env->dcache_line_size = 32;
2682 env->icache_line_size = 32; 2698 env->icache_line_size = 32;
@@ -2744,9 +2760,11 @@ static void init_proc_403GCX (CPUPPCState *env) @@ -2744,9 +2760,11 @@ static void init_proc_403GCX (CPUPPCState *env)
2744 &spr_read_generic, &spr_write_generic, 2760 &spr_read_generic, &spr_write_generic,
2745 0x00000000); 2761 0x00000000);
2746 /* Memory management */ 2762 /* Memory management */
  2763 +#if !defined(CONFIG_USER_ONLY)
2747 env->nb_tlb = 64; 2764 env->nb_tlb = 64;
2748 env->nb_ways = 1; 2765 env->nb_ways = 1;
2749 env->id_tlbs = 0; 2766 env->id_tlbs = 0;
  2767 +#endif
2750 init_excp_4xx_softmmu(env); 2768 init_excp_4xx_softmmu(env);
2751 env->dcache_line_size = 32; 2769 env->dcache_line_size = 32;
2752 env->icache_line_size = 32; 2770 env->icache_line_size = 32;
@@ -2785,9 +2803,11 @@ static void init_proc_405 (CPUPPCState *env) @@ -2785,9 +2803,11 @@ static void init_proc_405 (CPUPPCState *env)
2785 &spr_read_generic, &spr_write_generic, 2803 &spr_read_generic, &spr_write_generic,
2786 0x00000000); 2804 0x00000000);
2787 /* Memory management */ 2805 /* Memory management */
  2806 +#if !defined(CONFIG_USER_ONLY)
2788 env->nb_tlb = 64; 2807 env->nb_tlb = 64;
2789 env->nb_ways = 1; 2808 env->nb_ways = 1;
2790 env->id_tlbs = 0; 2809 env->id_tlbs = 0;
  2810 +#endif
2791 init_excp_4xx_softmmu(env); 2811 init_excp_4xx_softmmu(env);
2792 env->dcache_line_size = 32; 2812 env->dcache_line_size = 32;
2793 env->icache_line_size = 32; 2813 env->icache_line_size = 32;
@@ -2832,9 +2852,11 @@ static void init_proc_440EP (CPUPPCState *env) @@ -2832,9 +2852,11 @@ static void init_proc_440EP (CPUPPCState *env)
2832 &spr_read_generic, &spr_write_generic, 2852 &spr_read_generic, &spr_write_generic,
2833 0x00000000); 2853 0x00000000);
2834 /* Memory management */ 2854 /* Memory management */
  2855 +#if !defined(CONFIG_USER_ONLY)
2835 env->nb_tlb = 64; 2856 env->nb_tlb = 64;
2836 env->nb_ways = 1; 2857 env->nb_ways = 1;
2837 env->id_tlbs = 0; 2858 env->id_tlbs = 0;
  2859 +#endif
2838 init_excp_BookE(env); 2860 init_excp_BookE(env);
2839 env->dcache_line_size = 32; 2861 env->dcache_line_size = 32;
2840 env->icache_line_size = 32; 2862 env->icache_line_size = 32;
@@ -2860,9 +2882,11 @@ static void init_proc_440GP (CPUPPCState *env) @@ -2860,9 +2882,11 @@ static void init_proc_440GP (CPUPPCState *env)
2860 gen_spr_BookE(env); 2882 gen_spr_BookE(env);
2861 gen_spr_440(env); 2883 gen_spr_440(env);
2862 /* Memory management */ 2884 /* Memory management */
  2885 +#if !defined(CONFIG_USER_ONLY)
2863 env->nb_tlb = 64; 2886 env->nb_tlb = 64;
2864 env->nb_ways = 1; 2887 env->nb_ways = 1;
2865 env->id_tlbs = 0; 2888 env->id_tlbs = 0;
  2889 +#endif
2866 init_excp_BookE(env); 2890 init_excp_BookE(env);
2867 env->dcache_line_size = 32; 2891 env->dcache_line_size = 32;
2868 env->icache_line_size = 32; 2892 env->icache_line_size = 32;
@@ -2889,9 +2913,11 @@ static void init_proc_440x4 (CPUPPCState *env) @@ -2889,9 +2913,11 @@ static void init_proc_440x4 (CPUPPCState *env)
2889 gen_spr_BookE(env); 2913 gen_spr_BookE(env);
2890 gen_spr_440(env); 2914 gen_spr_440(env);
2891 /* Memory management */ 2915 /* Memory management */
  2916 +#if !defined(CONFIG_USER_ONLY)
2892 env->nb_tlb = 64; 2917 env->nb_tlb = 64;
2893 env->nb_ways = 1; 2918 env->nb_ways = 1;
2894 env->id_tlbs = 0; 2919 env->id_tlbs = 0;
  2920 +#endif
2895 init_excp_BookE(env); 2921 init_excp_BookE(env);
2896 env->dcache_line_size = 32; 2922 env->dcache_line_size = 32;
2897 env->icache_line_size = 32; 2923 env->icache_line_size = 32;
@@ -2935,9 +2961,11 @@ static void init_proc_440x5 (CPUPPCState *env) @@ -2935,9 +2961,11 @@ static void init_proc_440x5 (CPUPPCState *env)
2935 &spr_read_generic, &spr_write_generic, 2961 &spr_read_generic, &spr_write_generic,
2936 0x00000000); 2962 0x00000000);
2937 /* Memory management */ 2963 /* Memory management */
  2964 +#if !defined(CONFIG_USER_ONLY)
2938 env->nb_tlb = 64; 2965 env->nb_tlb = 64;
2939 env->nb_ways = 1; 2966 env->nb_ways = 1;
2940 env->id_tlbs = 0; 2967 env->id_tlbs = 0;
  2968 +#endif
2941 init_excp_BookE(env); 2969 init_excp_BookE(env);
2942 env->dcache_line_size = 32; 2970 env->dcache_line_size = 32;
2943 env->icache_line_size = 32; 2971 env->icache_line_size = 32;
@@ -2987,9 +3015,11 @@ static void init_proc_460 (CPUPPCState *env) @@ -2987,9 +3015,11 @@ static void init_proc_460 (CPUPPCState *env)
2987 &spr_read_generic, &spr_write_generic, 3015 &spr_read_generic, &spr_write_generic,
2988 0x00000000); 3016 0x00000000);
2989 /* Memory management */ 3017 /* Memory management */
  3018 +#if !defined(CONFIG_USER_ONLY)
2990 env->nb_tlb = 64; 3019 env->nb_tlb = 64;
2991 env->nb_ways = 1; 3020 env->nb_ways = 1;
2992 env->id_tlbs = 0; 3021 env->id_tlbs = 0;
  3022 +#endif
2993 init_excp_BookE(env); 3023 init_excp_BookE(env);
2994 env->dcache_line_size = 32; 3024 env->dcache_line_size = 32;
2995 env->icache_line_size = 32; 3025 env->icache_line_size = 32;
@@ -3042,9 +3072,11 @@ static void init_proc_460F (CPUPPCState *env) @@ -3042,9 +3072,11 @@ static void init_proc_460F (CPUPPCState *env)
3042 &spr_read_generic, &spr_write_generic, 3072 &spr_read_generic, &spr_write_generic,
3043 0x00000000); 3073 0x00000000);
3044 /* Memory management */ 3074 /* Memory management */
  3075 +#if !defined(CONFIG_USER_ONLY)
3045 env->nb_tlb = 64; 3076 env->nb_tlb = 64;
3046 env->nb_ways = 1; 3077 env->nb_ways = 1;
3047 env->id_tlbs = 0; 3078 env->id_tlbs = 0;
  3079 +#endif
3048 init_excp_BookE(env); 3080 init_excp_BookE(env);
3049 env->dcache_line_size = 32; 3081 env->dcache_line_size = 32;
3050 env->icache_line_size = 32; 3082 env->icache_line_size = 32;
@@ -3097,9 +3129,11 @@ static void init_proc_e500 (CPUPPCState *env) @@ -3097,9 +3129,11 @@ static void init_proc_e500 (CPUPPCState *env)
3097 gen_spr_BookE(env); 3129 gen_spr_BookE(env);
3098 /* Memory management */ 3130 /* Memory management */
3099 gen_spr_BookE_FSL(env); 3131 gen_spr_BookE_FSL(env);
  3132 +#if !defined(CONFIG_USER_ONLY)
3100 env->nb_tlb = 64; 3133 env->nb_tlb = 64;
3101 env->nb_ways = 1; 3134 env->nb_ways = 1;
3102 env->id_tlbs = 0; 3135 env->id_tlbs = 0;
  3136 +#endif
3103 init_excp_BookE(env); 3137 init_excp_BookE(env);
3104 env->dcache_line_size = 32; 3138 env->dcache_line_size = 32;
3105 env->icache_line_size = 32; 3139 env->icache_line_size = 32;
@@ -3167,10 +3201,11 @@ static void init_proc_601 (CPUPPCState *env) @@ -3167,10 +3201,11 @@ static void init_proc_601 (CPUPPCState *env)
3167 &spr_read_generic, &spr_write_generic, 3201 &spr_read_generic, &spr_write_generic,
3168 0x00000000); 3202 0x00000000);
3169 /* Memory management */ 3203 /* Memory management */
  3204 +#if !defined(CONFIG_USER_ONLY)
3170 env->nb_tlb = 64; 3205 env->nb_tlb = 64;
3171 env->nb_ways = 2; 3206 env->nb_ways = 2;
3172 env->id_tlbs = 0; 3207 env->id_tlbs = 0;
3173 - env->id_tlbs = 0; 3208 +#endif
3174 init_excp_601(env); 3209 init_excp_601(env);
3175 env->dcache_line_size = 64; 3210 env->dcache_line_size = 64;
3176 env->icache_line_size = 64; 3211 env->icache_line_size = 64;
@@ -4041,7 +4076,9 @@ static void init_proc_970 (CPUPPCState *env) @@ -4041,7 +4076,9 @@ static void init_proc_970 (CPUPPCState *env)
4041 #if !defined(CONFIG_USER_ONLY) 4076 #if !defined(CONFIG_USER_ONLY)
4042 env->excp_prefix = 0xFFF00000; 4077 env->excp_prefix = 0xFFF00000;
4043 #endif 4078 #endif
  4079 +#if !defined(CONFIG_USER_ONLY)
4044 env->slb_nr = 32; 4080 env->slb_nr = 32;
  4081 +#endif
4045 init_excp_970(env); 4082 init_excp_970(env);
4046 env->dcache_line_size = 128; 4083 env->dcache_line_size = 128;
4047 env->icache_line_size = 128; 4084 env->icache_line_size = 128;
@@ -4112,7 +4149,9 @@ static void init_proc_970FX (CPUPPCState *env) @@ -4112,7 +4149,9 @@ static void init_proc_970FX (CPUPPCState *env)
4112 #if !defined(CONFIG_USER_ONLY) 4149 #if !defined(CONFIG_USER_ONLY)
4113 env->excp_prefix = 0xFFF00000; 4150 env->excp_prefix = 0xFFF00000;
4114 #endif 4151 #endif
  4152 +#if !defined(CONFIG_USER_ONLY)
4115 env->slb_nr = 32; 4153 env->slb_nr = 32;
  4154 +#endif
4116 init_excp_970(env); 4155 init_excp_970(env);
4117 env->dcache_line_size = 128; 4156 env->dcache_line_size = 128;
4118 env->icache_line_size = 128; 4157 env->icache_line_size = 128;
@@ -4183,7 +4222,9 @@ static void init_proc_970GX (CPUPPCState *env) @@ -4183,7 +4222,9 @@ static void init_proc_970GX (CPUPPCState *env)
4183 #if !defined(CONFIG_USER_ONLY) 4222 #if !defined(CONFIG_USER_ONLY)
4184 env->excp_prefix = 0xFFF00000; 4223 env->excp_prefix = 0xFFF00000;
4185 #endif 4224 #endif
  4225 +#if !defined(CONFIG_USER_ONLY)
4186 env->slb_nr = 32; 4226 env->slb_nr = 32;
  4227 +#endif
4187 init_excp_970(env); 4228 init_excp_970(env);
4188 env->dcache_line_size = 128; 4229 env->dcache_line_size = 128;
4189 env->icache_line_size = 128; 4230 env->icache_line_size = 128;
@@ -5729,11 +5770,11 @@ static void init_ppc_proc (CPUPPCState *env, ppc_def_t *def) @@ -5729,11 +5770,11 @@ static void init_ppc_proc (CPUPPCState *env, ppc_def_t *def)
5729 env->excp_prefix = 0x00000000; 5770 env->excp_prefix = 0x00000000;
5730 env->ivor_mask = 0x00000000; 5771 env->ivor_mask = 0x00000000;
5731 env->ivpr_mask = 0x00000000; 5772 env->ivpr_mask = 0x00000000;
5732 -#endif  
5733 /* Default MMU definitions */ 5773 /* Default MMU definitions */
5734 env->nb_BATs = 0; 5774 env->nb_BATs = 0;
5735 env->nb_tlb = 0; 5775 env->nb_tlb = 0;
5736 env->nb_ways = 0; 5776 env->nb_ways = 0;
  5777 +#endif
5737 /* Register SPR common to all PowerPC implementations */ 5778 /* Register SPR common to all PowerPC implementations */
5738 gen_spr_generic(env); 5779 gen_spr_generic(env);
5739 spr_register(env, SPR_PVR, "PVR", 5780 spr_register(env, SPR_PVR, "PVR",
@@ -5743,6 +5784,7 @@ static void init_ppc_proc (CPUPPCState *env, ppc_def_t *def) @@ -5743,6 +5784,7 @@ static void init_ppc_proc (CPUPPCState *env, ppc_def_t *def)
5743 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */ 5784 /* PowerPC implementation specific initialisations (SPRs, timers, ...) */
5744 (*def->init_proc)(env); 5785 (*def->init_proc)(env);
5745 /* Allocate TLBs buffer when needed */ 5786 /* Allocate TLBs buffer when needed */
  5787 +#if !defined(CONFIG_USER_ONLY)
5746 if (env->nb_tlb != 0) { 5788 if (env->nb_tlb != 0) {
5747 int nb_tlb = env->nb_tlb; 5789 int nb_tlb = env->nb_tlb;
5748 if (env->id_tlbs != 0) 5790 if (env->id_tlbs != 0)
@@ -5751,7 +5793,6 @@ static void init_ppc_proc (CPUPPCState *env, ppc_def_t *def) @@ -5751,7 +5793,6 @@ static void init_ppc_proc (CPUPPCState *env, ppc_def_t *def)
5751 /* Pre-compute some useful values */ 5793 /* Pre-compute some useful values */
5752 env->tlb_per_way = env->nb_tlb / env->nb_ways; 5794 env->tlb_per_way = env->nb_tlb / env->nb_ways;
5753 } 5795 }
5754 -#if !defined(CONFIG_USER_ONLY)  
5755 if (env->irq_inputs == NULL) { 5796 if (env->irq_inputs == NULL) {
5756 fprintf(stderr, "WARNING: no internal IRQ controller registered.\n" 5797 fprintf(stderr, "WARNING: no internal IRQ controller registered.\n"
5757 " Attempt Qemu to crash very soon !\n"); 5798 " Attempt Qemu to crash very soon !\n");
@@ -6171,11 +6212,13 @@ int cpu_ppc_register (CPUPPCState *env, ppc_def_t *def) @@ -6171,11 +6212,13 @@ int cpu_ppc_register (CPUPPCState *env, ppc_def_t *def)
6171 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64 "\n" 6212 printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64 "\n"
6172 " MMU model : %s\n", 6213 " MMU model : %s\n",
6173 def->name, def->pvr, def->msr_mask, mmu_model); 6214 def->name, def->pvr, def->msr_mask, mmu_model);
  6215 +#if !defined(CONFIG_USER_ONLY)
6174 if (env->tlb != NULL) { 6216 if (env->tlb != NULL) {
6175 printf(" %d %s TLB in %d ways\n", 6217 printf(" %d %s TLB in %d ways\n",
6176 env->nb_tlb, env->id_tlbs ? "splitted" : "merged", 6218 env->nb_tlb, env->id_tlbs ? "splitted" : "merged",
6177 env->nb_ways); 6219 env->nb_ways);
6178 } 6220 }
  6221 +#endif
6179 printf(" Exceptions model : %s\n" 6222 printf(" Exceptions model : %s\n"
6180 " Bus model : %s\n", 6223 " Bus model : %s\n",
6181 excp_model, bus_model); 6224 excp_model, bus_model);