Commit cf8358c8f784561e2ffd4d2eb66fccfca6301f67

Authored by aurel32
1 parent fbd265b6

Add calls to initialize VSCR on appropriate machines

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6507 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 22 additions and 0 deletions
target-ppc/translate_init.c
@@ -472,6 +472,14 @@ static void spr_write_excp_vector (void *opaque, int sprn, int gprn) @@ -472,6 +472,14 @@ static void spr_write_excp_vector (void *opaque, int sprn, int gprn)
472 } 472 }
473 #endif 473 #endif
474 474
  475 +static inline void vscr_init (CPUPPCState *env, uint32_t val)
  476 +{
  477 + env->vscr = val;
  478 + /* Altivec always uses round-to-nearest */
  479 + set_float_rounding_mode(float_round_nearest_even, &env->vec_status);
  480 + set_flush_to_zero(vscr_nj, &env->vec_status);
  481 +}
  482 +
475 #if defined(CONFIG_USER_ONLY) 483 #if defined(CONFIG_USER_ONLY)
476 #define spr_register(env, num, name, uea_read, uea_write, \ 484 #define spr_register(env, num, name, uea_read, uea_write, \
477 oea_read, oea_write, initial_value) \ 485 oea_read, oea_write, initial_value) \
@@ -1220,6 +1228,8 @@ static void gen_spr_74xx (CPUPPCState *env) @@ -1220,6 +1228,8 @@ static void gen_spr_74xx (CPUPPCState *env)
1220 SPR_NOACCESS, SPR_NOACCESS, 1228 SPR_NOACCESS, SPR_NOACCESS,
1221 &spr_read_generic, &spr_write_generic, 1229 &spr_read_generic, &spr_write_generic,
1222 0x00000000); 1230 0x00000000);
  1231 + /* Not strictly an SPR */
  1232 + vscr_init(env, 0x00010000);
1223 } 1233 }
1224 1234
1225 static void gen_l3_ctrl (CPUPPCState *env) 1235 static void gen_l3_ctrl (CPUPPCState *env)
@@ -5919,6 +5929,9 @@ static void init_proc_970 (CPUPPCState *env) @@ -5919,6 +5929,9 @@ static void init_proc_970 (CPUPPCState *env)
5919 env->icache_line_size = 128; 5929 env->icache_line_size = 128;
5920 /* Allocate hardware IRQ controller */ 5930 /* Allocate hardware IRQ controller */
5921 ppc970_irq_init(env); 5931 ppc970_irq_init(env);
  5932 + /* Can't find information on what this should be on reset. This
  5933 + * value is the one used by 74xx processors. */
  5934 + vscr_init(env, 0x00010000);
5922 } 5935 }
5923 5936
5924 /* PowerPC 970FX (aka G5) */ 5937 /* PowerPC 970FX (aka G5) */
@@ -6005,6 +6018,9 @@ static void init_proc_970FX (CPUPPCState *env) @@ -6005,6 +6018,9 @@ static void init_proc_970FX (CPUPPCState *env)
6005 env->icache_line_size = 128; 6018 env->icache_line_size = 128;
6006 /* Allocate hardware IRQ controller */ 6019 /* Allocate hardware IRQ controller */
6007 ppc970_irq_init(env); 6020 ppc970_irq_init(env);
  6021 + /* Can't find information on what this should be on reset. This
  6022 + * value is the one used by 74xx processors. */
  6023 + vscr_init(env, 0x00010000);
6008 } 6024 }
6009 6025
6010 /* PowerPC 970 GX */ 6026 /* PowerPC 970 GX */
@@ -6091,6 +6107,9 @@ static void init_proc_970GX (CPUPPCState *env) @@ -6091,6 +6107,9 @@ static void init_proc_970GX (CPUPPCState *env)
6091 env->icache_line_size = 128; 6107 env->icache_line_size = 128;
6092 /* Allocate hardware IRQ controller */ 6108 /* Allocate hardware IRQ controller */
6093 ppc970_irq_init(env); 6109 ppc970_irq_init(env);
  6110 + /* Can't find information on what this should be on reset. This
  6111 + * value is the one used by 74xx processors. */
  6112 + vscr_init(env, 0x00010000);
6094 } 6113 }
6095 6114
6096 /* PowerPC 970 MP */ 6115 /* PowerPC 970 MP */
@@ -6177,6 +6196,9 @@ static void init_proc_970MP (CPUPPCState *env) @@ -6177,6 +6196,9 @@ static void init_proc_970MP (CPUPPCState *env)
6177 env->icache_line_size = 128; 6196 env->icache_line_size = 128;
6178 /* Allocate hardware IRQ controller */ 6197 /* Allocate hardware IRQ controller */
6179 ppc970_irq_init(env); 6198 ppc970_irq_init(env);
  6199 + /* Can't find information on what this should be on reset. This
  6200 + * value is the one used by 74xx processors. */
  6201 + vscr_init(env, 0x00010000);
6180 } 6202 }
6181 6203
6182 /* PowerPC 620 */ 6204 /* PowerPC 620 */