Commit fd88b6abab9a4425505b292b5fedbad31d0dfe4f

Authored by ths
1 parent df1561e2

The 24k wants more watch and srsmap registers.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2849 c046a42c-6fe2-441c-8c8c-71466251a162
target-mips/cpu.h
@@ -216,8 +216,8 @@ struct CPUMIPSState { @@ -216,8 +216,8 @@ struct CPUMIPSState {
216 int32_t CP0_Config6; 216 int32_t CP0_Config6;
217 int32_t CP0_Config7; 217 int32_t CP0_Config7;
218 target_ulong CP0_LLAddr; 218 target_ulong CP0_LLAddr;
219 - target_ulong CP0_WatchLo;  
220 - int32_t CP0_WatchHi; 219 + target_ulong CP0_WatchLo[8];
  220 + int32_t CP0_WatchHi[8];
221 target_ulong CP0_XContext; 221 target_ulong CP0_XContext;
222 int32_t CP0_Framemask; 222 int32_t CP0_Framemask;
223 int32_t CP0_Debug; 223 int32_t CP0_Debug;
target-mips/helper.c
@@ -381,7 +381,7 @@ void do_interrupt (CPUState *env) @@ -381,7 +381,7 @@ void do_interrupt (CPUState *env)
381 break; 381 break;
382 case EXCP_SRESET: 382 case EXCP_SRESET:
383 env->CP0_Status |= (1 << CP0St_SR); 383 env->CP0_Status |= (1 << CP0St_SR);
384 - env->CP0_WatchLo = 0; 384 + memset(env->CP0_WatchLo, 0, sizeof(*env->CP0_WatchLo));
385 goto set_error_EPC; 385 goto set_error_EPC;
386 case EXCP_NMI: 386 case EXCP_NMI:
387 env->CP0_Status |= (1 << CP0St_NMI); 387 env->CP0_Status |= (1 << CP0St_NMI);
target-mips/op.c
@@ -1171,15 +1171,15 @@ void op_mfc0_lladdr (void) @@ -1171,15 +1171,15 @@ void op_mfc0_lladdr (void)
1171 RETURN(); 1171 RETURN();
1172 } 1172 }
1173 1173
1174 -void op_mfc0_watchlo0 (void) 1174 +void op_mfc0_watchlo (void)
1175 { 1175 {
1176 - T0 = (int32_t)env->CP0_WatchLo; 1176 + T0 = (int32_t)env->CP0_WatchLo[PARAM1];
1177 RETURN(); 1177 RETURN();
1178 } 1178 }
1179 1179
1180 -void op_mfc0_watchhi0 (void) 1180 +void op_mfc0_watchhi (void)
1181 { 1181 {
1182 - T0 = env->CP0_WatchHi; 1182 + T0 = env->CP0_WatchHi[PARAM1];
1183 RETURN(); 1183 RETURN();
1184 } 1184 }
1185 1185
@@ -1423,18 +1423,18 @@ void op_mtc0_config2 (void) @@ -1423,18 +1423,18 @@ void op_mtc0_config2 (void)
1423 RETURN(); 1423 RETURN();
1424 } 1424 }
1425 1425
1426 -void op_mtc0_watchlo0 (void) 1426 +void op_mtc0_watchlo (void)
1427 { 1427 {
1428 /* Watch exceptions for instructions, data loads, data stores 1428 /* Watch exceptions for instructions, data loads, data stores
1429 not implemented. */ 1429 not implemented. */
1430 - env->CP0_WatchLo = (T0 & ~0x7); 1430 + env->CP0_WatchLo[PARAM1] = (T0 & ~0x7);
1431 RETURN(); 1431 RETURN();
1432 } 1432 }
1433 1433
1434 -void op_mtc0_watchhi0 (void) 1434 +void op_mtc0_watchhi (void)
1435 { 1435 {
1436 - env->CP0_WatchHi = (T0 & 0x40FF0FF8);  
1437 - env->CP0_WatchHi &= ~(env->CP0_WatchHi & T0 & 0x7); 1436 + env->CP0_WatchHi[PARAM1] = (T0 & 0x40FF0FF8);
  1437 + env->CP0_WatchHi[PARAM1] &= ~(env->CP0_WatchHi[PARAM1] & T0 & 0x7);
1438 RETURN(); 1438 RETURN();
1439 } 1439 }
1440 1440
@@ -1551,9 +1551,9 @@ void op_dmfc0_lladdr (void) @@ -1551,9 +1551,9 @@ void op_dmfc0_lladdr (void)
1551 RETURN(); 1551 RETURN();
1552 } 1552 }
1553 1553
1554 -void op_dmfc0_watchlo0 (void) 1554 +void op_dmfc0_watchlo (void)
1555 { 1555 {
1556 - T0 = env->CP0_WatchLo; 1556 + T0 = env->CP0_WatchLo[PARAM1];
1557 RETURN(); 1557 RETURN();
1558 } 1558 }
1559 1559
target-mips/translate.c
@@ -2035,9 +2035,9 @@ static void gen_mfc0 (DisasContext *ctx, int reg, int sel) @@ -2035,9 +2035,9 @@ static void gen_mfc0 (DisasContext *ctx, int reg, int sel)
2035 rn = "SRSCtl"; 2035 rn = "SRSCtl";
2036 break; 2036 break;
2037 case 3: 2037 case 3:
2038 -// gen_op_mfc0_srsmap(); /* shadow registers */ 2038 + gen_op_mfc0_srsmap();
2039 rn = "SRSMap"; 2039 rn = "SRSMap";
2040 -// break; 2040 + break;
2041 default: 2041 default:
2042 goto die; 2042 goto die;
2043 } 2043 }
@@ -2120,76 +2120,20 @@ static void gen_mfc0 (DisasContext *ctx, int reg, int sel) @@ -2120,76 +2120,20 @@ static void gen_mfc0 (DisasContext *ctx, int reg, int sel)
2120 break; 2120 break;
2121 case 18: 2121 case 18:
2122 switch (sel) { 2122 switch (sel) {
2123 - case 0:  
2124 - gen_op_mfc0_watchlo0(); 2123 + case 0 ... 7:
  2124 + gen_op_mfc0_watchlo(sel);
2125 rn = "WatchLo"; 2125 rn = "WatchLo";
2126 break; 2126 break;
2127 - case 1:  
2128 -// gen_op_mfc0_watchlo1();  
2129 - rn = "WatchLo1";  
2130 -// break;  
2131 - case 2:  
2132 -// gen_op_mfc0_watchlo2();  
2133 - rn = "WatchLo2";  
2134 -// break;  
2135 - case 3:  
2136 -// gen_op_mfc0_watchlo3();  
2137 - rn = "WatchLo3";  
2138 -// break;  
2139 - case 4:  
2140 -// gen_op_mfc0_watchlo4();  
2141 - rn = "WatchLo4";  
2142 -// break;  
2143 - case 5:  
2144 -// gen_op_mfc0_watchlo5();  
2145 - rn = "WatchLo5";  
2146 -// break;  
2147 - case 6:  
2148 -// gen_op_mfc0_watchlo6();  
2149 - rn = "WatchLo6";  
2150 -// break;  
2151 - case 7:  
2152 -// gen_op_mfc0_watchlo7();  
2153 - rn = "WatchLo7";  
2154 -// break;  
2155 default: 2127 default:
2156 goto die; 2128 goto die;
2157 } 2129 }
2158 break; 2130 break;
2159 case 19: 2131 case 19:
2160 switch (sel) { 2132 switch (sel) {
2161 - case 0:  
2162 - gen_op_mfc0_watchhi0(); 2133 + case 0 ...7:
  2134 + gen_op_mfc0_watchhi(sel);
2163 rn = "WatchHi"; 2135 rn = "WatchHi";
2164 break; 2136 break;
2165 - case 1:  
2166 -// gen_op_mfc0_watchhi1();  
2167 - rn = "WatchHi1";  
2168 -// break;  
2169 - case 2:  
2170 -// gen_op_mfc0_watchhi2();  
2171 - rn = "WatchHi2";  
2172 -// break;  
2173 - case 3:  
2174 -// gen_op_mfc0_watchhi3();  
2175 - rn = "WatchHi3";  
2176 -// break;  
2177 - case 4:  
2178 -// gen_op_mfc0_watchhi4();  
2179 - rn = "WatchHi4";  
2180 -// break;  
2181 - case 5:  
2182 -// gen_op_mfc0_watchhi5();  
2183 - rn = "WatchHi5";  
2184 -// break;  
2185 - case 6:  
2186 -// gen_op_mfc0_watchhi6();  
2187 - rn = "WatchHi6";  
2188 -// break;  
2189 - case 7:  
2190 -// gen_op_mfc0_watchhi7();  
2191 - rn = "WatchHi7";  
2192 -// break;  
2193 default: 2137 default:
2194 goto die; 2138 goto die;
2195 } 2139 }
@@ -2625,9 +2569,9 @@ static void gen_mtc0 (DisasContext *ctx, int reg, int sel) @@ -2625,9 +2569,9 @@ static void gen_mtc0 (DisasContext *ctx, int reg, int sel)
2625 rn = "SRSCtl"; 2569 rn = "SRSCtl";
2626 break; 2570 break;
2627 case 3: 2571 case 3:
2628 -// gen_op_mtc0_srsmap(); /* shadow registers */ 2572 + gen_op_mtc0_srsmap();
2629 rn = "SRSMap"; 2573 rn = "SRSMap";
2630 -// break; 2574 + break;
2631 default: 2575 default:
2632 goto die; 2576 goto die;
2633 } 2577 }
@@ -2719,76 +2663,20 @@ static void gen_mtc0 (DisasContext *ctx, int reg, int sel) @@ -2719,76 +2663,20 @@ static void gen_mtc0 (DisasContext *ctx, int reg, int sel)
2719 break; 2663 break;
2720 case 18: 2664 case 18:
2721 switch (sel) { 2665 switch (sel) {
2722 - case 0:  
2723 - gen_op_mtc0_watchlo0(); 2666 + case 0 ... 7:
  2667 + gen_op_mtc0_watchlo(sel);
2724 rn = "WatchLo"; 2668 rn = "WatchLo";
2725 break; 2669 break;
2726 - case 1:  
2727 -// gen_op_mtc0_watchlo1();  
2728 - rn = "WatchLo1";  
2729 -// break;  
2730 - case 2:  
2731 -// gen_op_mtc0_watchlo2();  
2732 - rn = "WatchLo2";  
2733 -// break;  
2734 - case 3:  
2735 -// gen_op_mtc0_watchlo3();  
2736 - rn = "WatchLo3";  
2737 -// break;  
2738 - case 4:  
2739 -// gen_op_mtc0_watchlo4();  
2740 - rn = "WatchLo4";  
2741 -// break;  
2742 - case 5:  
2743 -// gen_op_mtc0_watchlo5();  
2744 - rn = "WatchLo5";  
2745 -// break;  
2746 - case 6:  
2747 -// gen_op_mtc0_watchlo6();  
2748 - rn = "WatchLo6";  
2749 -// break;  
2750 - case 7:  
2751 -// gen_op_mtc0_watchlo7();  
2752 - rn = "WatchLo7";  
2753 -// break;  
2754 default: 2670 default:
2755 goto die; 2671 goto die;
2756 } 2672 }
2757 break; 2673 break;
2758 case 19: 2674 case 19:
2759 switch (sel) { 2675 switch (sel) {
2760 - case 0:  
2761 - gen_op_mtc0_watchhi0(); 2676 + case 0 ... 7:
  2677 + gen_op_mtc0_watchhi(sel);
2762 rn = "WatchHi"; 2678 rn = "WatchHi";
2763 break; 2679 break;
2764 - case 1:  
2765 -// gen_op_mtc0_watchhi1();  
2766 - rn = "WatchHi1";  
2767 -// break;  
2768 - case 2:  
2769 -// gen_op_mtc0_watchhi2();  
2770 - rn = "WatchHi2";  
2771 -// break;  
2772 - case 3:  
2773 -// gen_op_mtc0_watchhi3();  
2774 - rn = "WatchHi3";  
2775 -// break;  
2776 - case 4:  
2777 -// gen_op_mtc0_watchhi4();  
2778 - rn = "WatchHi4";  
2779 -// break;  
2780 - case 5:  
2781 -// gen_op_mtc0_watchhi5();  
2782 - rn = "WatchHi5";  
2783 -// break;  
2784 - case 6:  
2785 -// gen_op_mtc0_watchhi6();  
2786 - rn = "WatchHi6";  
2787 -// break;  
2788 - case 7:  
2789 -// gen_op_mtc0_watchhi7();  
2790 - rn = "WatchHi7";  
2791 -// break;  
2792 default: 2680 default:
2793 goto die; 2681 goto die;
2794 } 2682 }
@@ -3309,76 +3197,20 @@ static void gen_dmfc0 (DisasContext *ctx, int reg, int sel) @@ -3309,76 +3197,20 @@ static void gen_dmfc0 (DisasContext *ctx, int reg, int sel)
3309 break; 3197 break;
3310 case 18: 3198 case 18:
3311 switch (sel) { 3199 switch (sel) {
3312 - case 0:  
3313 - gen_op_dmfc0_watchlo0(); 3200 + case 0 ... 7:
  3201 + gen_op_dmfc0_watchlo(sel);
3314 rn = "WatchLo"; 3202 rn = "WatchLo";
3315 break; 3203 break;
3316 - case 1:  
3317 -// gen_op_dmfc0_watchlo1();  
3318 - rn = "WatchLo1";  
3319 -// break;  
3320 - case 2:  
3321 -// gen_op_dmfc0_watchlo2();  
3322 - rn = "WatchLo2";  
3323 -// break;  
3324 - case 3:  
3325 -// gen_op_dmfc0_watchlo3();  
3326 - rn = "WatchLo3";  
3327 -// break;  
3328 - case 4:  
3329 -// gen_op_dmfc0_watchlo4();  
3330 - rn = "WatchLo4";  
3331 -// break;  
3332 - case 5:  
3333 -// gen_op_dmfc0_watchlo5();  
3334 - rn = "WatchLo5";  
3335 -// break;  
3336 - case 6:  
3337 -// gen_op_dmfc0_watchlo6();  
3338 - rn = "WatchLo6";  
3339 -// break;  
3340 - case 7:  
3341 -// gen_op_dmfc0_watchlo7();  
3342 - rn = "WatchLo7";  
3343 -// break;  
3344 default: 3204 default:
3345 goto die; 3205 goto die;
3346 } 3206 }
3347 break; 3207 break;
3348 case 19: 3208 case 19:
3349 switch (sel) { 3209 switch (sel) {
3350 - case 0:  
3351 - gen_op_mfc0_watchhi0(); 3210 + case 0 ... 7:
  3211 + gen_op_mfc0_watchhi(sel);
3352 rn = "WatchHi"; 3212 rn = "WatchHi";
3353 break; 3213 break;
3354 - case 1:  
3355 -// gen_op_mfc0_watchhi1();  
3356 - rn = "WatchHi1";  
3357 -// break;  
3358 - case 2:  
3359 -// gen_op_mfc0_watchhi2();  
3360 - rn = "WatchHi2";  
3361 -// break;  
3362 - case 3:  
3363 -// gen_op_mfc0_watchhi3();  
3364 - rn = "WatchHi3";  
3365 -// break;  
3366 - case 4:  
3367 -// gen_op_mfc0_watchhi4();  
3368 - rn = "WatchHi4";  
3369 -// break;  
3370 - case 5:  
3371 -// gen_op_mfc0_watchhi5();  
3372 - rn = "WatchHi5";  
3373 -// break;  
3374 - case 6:  
3375 -// gen_op_mfc0_watchhi6();  
3376 - rn = "WatchHi6";  
3377 -// break;  
3378 - case 7:  
3379 -// gen_op_mfc0_watchhi7();  
3380 - rn = "WatchHi7";  
3381 -// break;  
3382 default: 3214 default:
3383 goto die; 3215 goto die;
3384 } 3216 }
@@ -3814,7 +3646,7 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) @@ -3814,7 +3646,7 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
3814 rn = "SRSCtl"; 3646 rn = "SRSCtl";
3815 break; 3647 break;
3816 case 3: 3648 case 3:
3817 - gen_op_mtc0_srsmap(); /* shadow registers */ 3649 + gen_op_mtc0_srsmap();
3818 rn = "SRSMap"; 3650 rn = "SRSMap";
3819 break; 3651 break;
3820 default: 3652 default:
@@ -3899,76 +3731,20 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel) @@ -3899,76 +3731,20 @@ static void gen_dmtc0 (DisasContext *ctx, int reg, int sel)
3899 break; 3731 break;
3900 case 18: 3732 case 18:
3901 switch (sel) { 3733 switch (sel) {
3902 - case 0:  
3903 - gen_op_mtc0_watchlo0(); 3734 + case 0 ... 7:
  3735 + gen_op_mtc0_watchlo(sel);
3904 rn = "WatchLo"; 3736 rn = "WatchLo";
3905 break; 3737 break;
3906 - case 1:  
3907 -// gen_op_mtc0_watchlo1();  
3908 - rn = "WatchLo1";  
3909 -// break;  
3910 - case 2:  
3911 -// gen_op_mtc0_watchlo2();  
3912 - rn = "WatchLo2";  
3913 -// break;  
3914 - case 3:  
3915 -// gen_op_mtc0_watchlo3();  
3916 - rn = "WatchLo3";  
3917 -// break;  
3918 - case 4:  
3919 -// gen_op_mtc0_watchlo4();  
3920 - rn = "WatchLo4";  
3921 -// break;  
3922 - case 5:  
3923 -// gen_op_mtc0_watchlo5();  
3924 - rn = "WatchLo5";  
3925 -// break;  
3926 - case 6:  
3927 -// gen_op_mtc0_watchlo6();  
3928 - rn = "WatchLo6";  
3929 -// break;  
3930 - case 7:  
3931 -// gen_op_mtc0_watchlo7();  
3932 - rn = "WatchLo7";  
3933 -// break;  
3934 default: 3738 default:
3935 goto die; 3739 goto die;
3936 } 3740 }
3937 break; 3741 break;
3938 case 19: 3742 case 19:
3939 switch (sel) { 3743 switch (sel) {
3940 - case 0:  
3941 - gen_op_mtc0_watchhi0(); 3744 + case 0 ... 7:
  3745 + gen_op_mtc0_watchhi(sel);
3942 rn = "WatchHi"; 3746 rn = "WatchHi";
3943 break; 3747 break;
3944 - case 1:  
3945 -// gen_op_mtc0_watchhi1();  
3946 - rn = "WatchHi1";  
3947 -// break;  
3948 - case 2:  
3949 -// gen_op_mtc0_watchhi2();  
3950 - rn = "WatchHi2";  
3951 -// break;  
3952 - case 3:  
3953 -// gen_op_mtc0_watchhi3();  
3954 - rn = "WatchHi3";  
3955 -// break;  
3956 - case 4:  
3957 -// gen_op_mtc0_watchhi4();  
3958 - rn = "WatchHi4";  
3959 -// break;  
3960 - case 5:  
3961 -// gen_op_mtc0_watchhi5();  
3962 - rn = "WatchHi5";  
3963 -// break;  
3964 - case 6:  
3965 -// gen_op_mtc0_watchhi6();  
3966 - rn = "WatchHi6";  
3967 -// break;  
3968 - case 7:  
3969 -// gen_op_mtc0_watchhi7();  
3970 - rn = "WatchHi7";  
3971 -// break;  
3972 default: 3748 default:
3973 goto die; 3749 goto die;
3974 } 3750 }
@@ -6269,8 +6045,16 @@ void cpu_reset (CPUMIPSState *env) @@ -6269,8 +6045,16 @@ void cpu_reset (CPUMIPSState *env)
6269 /* vectored interrupts not implemented, timer on int 7, 6045 /* vectored interrupts not implemented, timer on int 7,
6270 no performance counters. */ 6046 no performance counters. */
6271 env->CP0_IntCtl = 0xe0000000; 6047 env->CP0_IntCtl = 0xe0000000;
6272 - env->CP0_WatchLo = 0;  
6273 - env->CP0_WatchHi = 0; 6048 + {
  6049 + int i;
  6050 +
  6051 + for (i = 0; i < 7; i++) {
  6052 + env->CP0_WatchLo[i] = 0;
  6053 + env->CP0_WatchHi[i] = 0x80000000;
  6054 + }
  6055 + env->CP0_WatchLo[7] = 0;
  6056 + env->CP0_WatchHi[7] = 0;
  6057 + }
6274 /* Count register increments in debug mode, EJTAG version 1 */ 6058 /* Count register increments in debug mode, EJTAG version 1 */
6275 env->CP0_Debug = (1 << CP0DB_CNT) | (0x1 << CP0DB_VER); 6059 env->CP0_Debug = (1 << CP0DB_CNT) | (0x1 << CP0DB_VER);
6276 #endif 6060 #endif