From patchwork Fri Apr 13 21:30:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 152398 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 09269B7007 for ; Sat, 14 Apr 2012 07:31:01 +1000 (EST) Received: from localhost ([::1]:44848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIo54-0003na-Ny for incoming@patchwork.ozlabs.org; Fri, 13 Apr 2012 17:30:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIo4c-0003Ir-Ov for qemu-devel@nongnu.org; Fri, 13 Apr 2012 17:30:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SIo4a-0006ne-NW for qemu-devel@nongnu.org; Fri, 13 Apr 2012 17:30:30 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35637 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIo4a-0006my-EE for qemu-devel@nongnu.org; Fri, 13 Apr 2012 17:30:28 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 4D33B8FC93; Fri, 13 Apr 2012 23:30:27 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Fri, 13 Apr 2012 23:30:12 +0200 Message-Id: <1334352618-4551-8-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1334352618-4551-1-git-send-email-afaerber@suse.de> References: <1334352618-4551-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Aurelien Jarno Subject: [Qemu-devel] [PATCH v2 07/13] target-sh4: Make increment_urc() take SuperHCPU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Andreas Färber --- target-sh4/helper.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/target-sh4/helper.c b/target-sh4/helper.c index 655faaa..2d5a4e4 100644 --- a/target-sh4/helper.c +++ b/target-sh4/helper.c @@ -269,17 +269,18 @@ static int find_tlb_entry(CPUSH4State * env, target_ulong address, return match; } -static void increment_urc(CPUSH4State * env) +static void increment_urc(SuperHCPU *cpu) { uint8_t urb, urc; /* Increment URC */ - urb = ((env->mmucr) >> 18) & 0x3f; - urc = ((env->mmucr) >> 10) & 0x3f; + urb = ((cpu->env.mmucr) >> 18) & 0x3f; + urc = ((cpu->env.mmucr) >> 10) & 0x3f; urc++; - if ((urb > 0 && urc > urb) || urc > (UTLB_SIZE - 1)) + if ((urb > 0 && urc > urb) || urc > (UTLB_SIZE - 1)) { urc = 0; - env->mmucr = (env->mmucr & 0xffff03ff) | (urc << 10); + } + cpu->env.mmucr = (cpu->env.mmucr & 0xffff03ff) | (urc << 10); } /* Copy and utlb entry into itlb @@ -324,7 +325,7 @@ static int find_itlb_entry(CPUSH4State * env, target_ulong address, static int find_utlb_entry(CPUSH4State * env, target_ulong address, int use_asid) { /* per utlb access */ - increment_urc(env); + increment_urc(sh_env_get_cpu(env)); /* Return entry */ return find_tlb_entry(env, address, env->utlb, UTLB_SIZE, use_asid); @@ -660,7 +661,7 @@ uint32_t cpu_sh4_read_mmaped_utlb_addr(CPUSH4State *s, int index = (addr & 0x00003f00) >> 8; tlb_t * entry = &s->utlb[index]; - increment_urc(s); /* per utlb access */ + increment_urc(sh_env_get_cpu(s)); /* per utlb access */ return (entry->vpn << 10) | (entry->v << 8) | @@ -702,7 +703,7 @@ void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr, entry->d = d; utlb_match_entry = entry; } - increment_urc(s); /* per utlb access */ + increment_urc(sh_env_get_cpu(s)); /* per utlb access */ } /* search ITLB */ @@ -735,7 +736,7 @@ void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr, entry->vpn = vpn; entry->d = d; entry->v = v; - increment_urc(s); + increment_urc(sh_env_get_cpu(s)); } } @@ -746,7 +747,7 @@ uint32_t cpu_sh4_read_mmaped_utlb_data(CPUSH4State *s, int index = (addr & 0x00003f00) >> 8; tlb_t * entry = &s->utlb[index]; - increment_urc(s); /* per utlb access */ + increment_urc(sh_env_get_cpu(s)); /* per utlb access */ if (array == 0) { /* ITLB Data Array 1 */ @@ -773,7 +774,7 @@ void cpu_sh4_write_mmaped_utlb_data(CPUSH4State *s, target_phys_addr_t addr, int index = (addr & 0x00003f00) >> 8; tlb_t * entry = &s->utlb[index]; - increment_urc(s); /* per utlb access */ + increment_urc(sh_env_get_cpu(s)); /* per utlb access */ if (array == 0) { /* UTLB Data Array 1 */