From 2adab7d6b53a246905038fde12c2a0c1d40c6807 Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Sat, 28 Feb 2009 18:39:42 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6656 c046a42c-6fe2-441c-8c8c-71466251a162 --- target-ppc/translate_init.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 889708f28c..77443f153a 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -307,6 +307,19 @@ static void spr_write_sdr1 (void *opaque, int sprn, int gprn) /* 64 bits PowerPC specific SPRs */ /* ASR */ #if defined(TARGET_PPC64) +static void spr_read_hior (void *opaque, int gprn, int sprn) +{ + tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, excp_prefix)); +} + +static void spr_write_hior (void *opaque, int sprn, int gprn) +{ + TCGv t0 = tcg_temp_new(); + tcg_gen_andi_tl(t0, cpu_gpr[gprn], 0x3FFFFF00000ULL); + tcg_gen_st_tl(t0, cpu_env, offsetof(CPUState, excp_prefix)); + tcg_temp_free(t0); +} + static void spr_read_asr (void *opaque, int gprn, int sprn) { tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, asr)); @@ -5939,8 +5952,8 @@ static void init_proc_970 (CPUPPCState *env) 0x00000000); /* TOFIX */ spr_register(env, SPR_HIOR, "SPR_HIOR", SPR_NOACCESS, SPR_NOACCESS, - &spr_read_generic, &spr_write_generic, - 0xFFF00000); /* XXX: This is a hack */ + &spr_read_hior, &spr_write_hior, + 0x00000000); #if !defined(CONFIG_USER_ONLY) env->slb_nr = 32; #endif @@ -6028,8 +6041,8 @@ static void init_proc_970FX (CPUPPCState *env) 0x00000000); /* TOFIX */ spr_register(env, SPR_HIOR, "SPR_HIOR", SPR_NOACCESS, SPR_NOACCESS, - &spr_read_generic, &spr_write_generic, - 0xFFF00000); /* XXX: This is a hack */ + &spr_read_hior, &spr_write_hior, + 0x00000000); #if !defined(CONFIG_USER_ONLY) env->slb_nr = 32; #endif @@ -6117,8 +6130,8 @@ static void init_proc_970GX (CPUPPCState *env) 0x00000000); /* TOFIX */ spr_register(env, SPR_HIOR, "SPR_HIOR", SPR_NOACCESS, SPR_NOACCESS, - &spr_read_generic, &spr_write_generic, - 0xFFF00000); /* XXX: This is a hack */ + &spr_read_hior, &spr_write_hior, + 0x00000000); #if !defined(CONFIG_USER_ONLY) env->slb_nr = 32; #endif @@ -6206,8 +6219,8 @@ static void init_proc_970MP (CPUPPCState *env) 0x00000000); /* TOFIX */ spr_register(env, SPR_HIOR, "SPR_HIOR", SPR_NOACCESS, SPR_NOACCESS, - &spr_read_generic, &spr_write_generic, - 0xFFF00000); /* XXX: This is a hack */ + &spr_read_hior, &spr_write_hior, + 0x00000000); #if !defined(CONFIG_USER_ONLY) env->slb_nr = 32; #endif