Commit 2adab7d6b53a246905038fde12c2a0c1d40c6807

Authored by blueswir1
1 parent cdad4bd8

Implement HIOR

A real 970 CPU starts up with HIOR=0xfff00000 and triggers a reset
exception, basically ending up at IP 0xfff001000.

Later on this HIOR has to be set to 0 by the firmware in order to
enable the OS to handle interrupts on its own.

This patch maps HIOR to exec_prefix, which does the same thing
internally in qemu already.

It replaces the previous patch that changed the 970 initialization
constants, as this is the clean solution to the same problem.

Signed-off-by: Alexander Graf <alex@csgraf.de>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6656 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 21 additions and 8 deletions
target-ppc/translate_init.c
@@ -307,6 +307,19 @@ static void spr_write_sdr1 (void *opaque, int sprn, int gprn) @@ -307,6 +307,19 @@ static void spr_write_sdr1 (void *opaque, int sprn, int gprn)
307 /* 64 bits PowerPC specific SPRs */ 307 /* 64 bits PowerPC specific SPRs */
308 /* ASR */ 308 /* ASR */
309 #if defined(TARGET_PPC64) 309 #if defined(TARGET_PPC64)
  310 +static void spr_read_hior (void *opaque, int gprn, int sprn)
  311 +{
  312 + tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, excp_prefix));
  313 +}
  314 +
  315 +static void spr_write_hior (void *opaque, int sprn, int gprn)
  316 +{
  317 + TCGv t0 = tcg_temp_new();
  318 + tcg_gen_andi_tl(t0, cpu_gpr[gprn], 0x3FFFFF00000ULL);
  319 + tcg_gen_st_tl(t0, cpu_env, offsetof(CPUState, excp_prefix));
  320 + tcg_temp_free(t0);
  321 +}
  322 +
310 static void spr_read_asr (void *opaque, int gprn, int sprn) 323 static void spr_read_asr (void *opaque, int gprn, int sprn)
311 { 324 {
312 tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, asr)); 325 tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, asr));
@@ -5939,8 +5952,8 @@ static void init_proc_970 (CPUPPCState *env) @@ -5939,8 +5952,8 @@ static void init_proc_970 (CPUPPCState *env)
5939 0x00000000); /* TOFIX */ 5952 0x00000000); /* TOFIX */
5940 spr_register(env, SPR_HIOR, "SPR_HIOR", 5953 spr_register(env, SPR_HIOR, "SPR_HIOR",
5941 SPR_NOACCESS, SPR_NOACCESS, 5954 SPR_NOACCESS, SPR_NOACCESS,
5942 - &spr_read_generic, &spr_write_generic,  
5943 - 0xFFF00000); /* XXX: This is a hack */ 5955 + &spr_read_hior, &spr_write_hior,
  5956 + 0x00000000);
5944 #if !defined(CONFIG_USER_ONLY) 5957 #if !defined(CONFIG_USER_ONLY)
5945 env->slb_nr = 32; 5958 env->slb_nr = 32;
5946 #endif 5959 #endif
@@ -6028,8 +6041,8 @@ static void init_proc_970FX (CPUPPCState *env) @@ -6028,8 +6041,8 @@ static void init_proc_970FX (CPUPPCState *env)
6028 0x00000000); /* TOFIX */ 6041 0x00000000); /* TOFIX */
6029 spr_register(env, SPR_HIOR, "SPR_HIOR", 6042 spr_register(env, SPR_HIOR, "SPR_HIOR",
6030 SPR_NOACCESS, SPR_NOACCESS, 6043 SPR_NOACCESS, SPR_NOACCESS,
6031 - &spr_read_generic, &spr_write_generic,  
6032 - 0xFFF00000); /* XXX: This is a hack */ 6044 + &spr_read_hior, &spr_write_hior,
  6045 + 0x00000000);
6033 #if !defined(CONFIG_USER_ONLY) 6046 #if !defined(CONFIG_USER_ONLY)
6034 env->slb_nr = 32; 6047 env->slb_nr = 32;
6035 #endif 6048 #endif
@@ -6117,8 +6130,8 @@ static void init_proc_970GX (CPUPPCState *env) @@ -6117,8 +6130,8 @@ static void init_proc_970GX (CPUPPCState *env)
6117 0x00000000); /* TOFIX */ 6130 0x00000000); /* TOFIX */
6118 spr_register(env, SPR_HIOR, "SPR_HIOR", 6131 spr_register(env, SPR_HIOR, "SPR_HIOR",
6119 SPR_NOACCESS, SPR_NOACCESS, 6132 SPR_NOACCESS, SPR_NOACCESS,
6120 - &spr_read_generic, &spr_write_generic,  
6121 - 0xFFF00000); /* XXX: This is a hack */ 6133 + &spr_read_hior, &spr_write_hior,
  6134 + 0x00000000);
6122 #if !defined(CONFIG_USER_ONLY) 6135 #if !defined(CONFIG_USER_ONLY)
6123 env->slb_nr = 32; 6136 env->slb_nr = 32;
6124 #endif 6137 #endif
@@ -6206,8 +6219,8 @@ static void init_proc_970MP (CPUPPCState *env) @@ -6206,8 +6219,8 @@ static void init_proc_970MP (CPUPPCState *env)
6206 0x00000000); /* TOFIX */ 6219 0x00000000); /* TOFIX */
6207 spr_register(env, SPR_HIOR, "SPR_HIOR", 6220 spr_register(env, SPR_HIOR, "SPR_HIOR",
6208 SPR_NOACCESS, SPR_NOACCESS, 6221 SPR_NOACCESS, SPR_NOACCESS,
6209 - &spr_read_generic, &spr_write_generic,  
6210 - 0xFFF00000); /* XXX: This is a hack */ 6222 + &spr_read_hior, &spr_write_hior,
  6223 + 0x00000000);
6211 #if !defined(CONFIG_USER_ONLY) 6224 #if !defined(CONFIG_USER_ONLY)
6212 env->slb_nr = 32; 6225 env->slb_nr = 32;
6213 #endif 6226 #endif