Received: from eggs.gnu.org ([2001:4830:134:3::10]:51403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btiGR-0005ps-KI for qemu-devel@nongnu.org; Mon, 10 Oct 2016 17:37:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btiGN-0005bF-FT for qemu-devel@nongnu.org; Mon, 10 Oct 2016 17:37:38 -0400 Received: from mail-pa0-x244.google.com ([2607:f8b0:400e:c03::244]:36453) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btiGN-0005b0-8O for qemu-devel@nongnu.org; Mon, 10 Oct 2016 17:37:35 -0400 Received: by mail-pa0-x244.google.com with SMTP id rw4so164384pab.3 for ; Mon, 10 Oct 2016 14:37:35 -0700 (PDT) Sender: Richard Henderson References: <1475316333-9776-1-git-send-email-atar4qemu@gmail.com> <1475316333-9776-8-git-send-email-atar4qemu@gmail.com> From: Richard Henderson Message-ID: <89b05685-8e85-85ef-aa52-9da232ddc40c@twiddle.net> Date: Mon, 10 Oct 2016 16:37:31 -0500 MIME-Version: 1.0 In-Reply-To: <1475316333-9776-8-git-send-email-atar4qemu@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 07/29] target-sparc: implement UA2005 scratchpad registers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Artyom Tarasenko , qemu-devel@nongnu.org Cc: Mark Cave-Ayland On 10/01/2016 05:05 AM, Artyom Tarasenko wrote: > + case ASI_SCRATCHPAD: /* UA2005 privileged scratchpad */ > + if (unlikely((addr >= 0x20) && (addr < 0x30))) { > + /* Hyperprivileged access only */ > + cpu_unassigned_access(cs, addr, false, false, 1, size); > + } > + /* fall through */ > + case ASI_HYP_SCRATCHPAD: /* UA2005 hyperprivileged scratchpad */ > + { > + unsigned int i = (addr >> 3) & 0x7; > + ret = env->scratch[i]; > + break; > + } It *might* speed things up a teeny bit to implement ASI_HYP_SCRATCHPAD inline. E.g. case GET_ASI_HYP_SCRATCH: { TCGv_ptr tmp = tcg_temp_new_ptr(); #if UINTPTR_MAX == UINT32_MAX tcg_gen_extrl_i64_i32(tmp, addr); tcg_gen_andi_i32(tmp, tmp, 7 << 3); #else tcg_gen_andi_i64(tmp, addr, 7 << 3); #endif tcg_gen_add_ptr(tmp, tmp, cpu_env); tcg_gen_ld_i64(dst, tmp, offsetof(CPUSPARCState, scratch)); tcg_temp_free_ptr(tmp); } break; Of course, you can't do that for ASI_SCRATCHPAD because of the dynamic check against ADDR. > @@ -2056,6 +2068,9 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, > return; > case ASI_INTR_RECEIVE: /* Interrupt data receive */ > env->ivec_status = val & 0x20; > + if (!env->ivec_status) { > + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); > + } > return; This belongs in some other patch. r~