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 307 /* 64 bits PowerPC specific SPRs */
308 308 /* ASR */
309 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 323 static void spr_read_asr (void *opaque, int gprn, int sprn)
311 324 {
312 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 5952 0x00000000); /* TOFIX */
5940 5953 spr_register(env, SPR_HIOR, "SPR_HIOR",
5941 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 5957 #if !defined(CONFIG_USER_ONLY)
5945 5958 env->slb_nr = 32;
5946 5959 #endif
... ... @@ -6028,8 +6041,8 @@ static void init_proc_970FX (CPUPPCState *env)
6028 6041 0x00000000); /* TOFIX */
6029 6042 spr_register(env, SPR_HIOR, "SPR_HIOR",
6030 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 6046 #if !defined(CONFIG_USER_ONLY)
6034 6047 env->slb_nr = 32;
6035 6048 #endif
... ... @@ -6117,8 +6130,8 @@ static void init_proc_970GX (CPUPPCState *env)
6117 6130 0x00000000); /* TOFIX */
6118 6131 spr_register(env, SPR_HIOR, "SPR_HIOR",
6119 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 6135 #if !defined(CONFIG_USER_ONLY)
6123 6136 env->slb_nr = 32;
6124 6137 #endif
... ... @@ -6206,8 +6219,8 @@ static void init_proc_970MP (CPUPPCState *env)
6206 6219 0x00000000); /* TOFIX */
6207 6220 spr_register(env, SPR_HIOR, "SPR_HIOR",
6208 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 6224 #if !defined(CONFIG_USER_ONLY)
6212 6225 env->slb_nr = 32;
6213 6226 #endif
... ...