From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JpEcP-0006b5-Kk for qemu-devel@nongnu.org; Thu, 24 Apr 2008 23:29:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JpEcO-0006aD-QR for qemu-devel@nongnu.org; Thu, 24 Apr 2008 23:29:01 -0400 Received: from [199.232.76.173] (port=42092 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JpEcO-0006Zw-HR for qemu-devel@nongnu.org; Thu, 24 Apr 2008 23:29:00 -0400 Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JpEcO-0000sP-6n for qemu-devel@nongnu.org; Thu, 24 Apr 2008 23:29:00 -0400 From: Glauber Costa Date: Fri, 25 Apr 2008 00:23:08 -0300 Message-Id: <12090938183381-git-send-email-gcosta@redhat.com> In-Reply-To: <12090938153388-git-send-email-gcosta@redhat.com> References: <12090937903925-git-send-email-gcosta@redhat.com> <12090937962588-git-send-email-gcosta@redhat.com> <12090937991633-git-send-email-gcosta@redhat.com> <12090938023558-git-send-email-gcosta@redhat.com> <12090938052239-git-send-email-gcosta@redhat.com> <12090938091281-git-send-email-gcosta@redhat.com> <12090938123024-git-send-email-gcosta@redhat.com> <12090938153388-git-send-email-gcosta@redhat.com> Subject: [Qemu-devel] [PATCH 08/10] sh4: replace code inside ifdef with generic function Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kvm-devel@lists.sourceforge.net this patch replaced code inside specific ifdef in translate-all.c with a generic architecture-implemented function. This leads to a cleaner and more modular code in the generic part. --- target-sh4/translate.c | 7 +++++++ translate-all.c | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/target-sh4/translate.c b/target-sh4/translate.c index b7c5f8d..1468e7a 100644 --- a/target-sh4/translate.c +++ b/target-sh4/translate.c @@ -1302,3 +1302,10 @@ int gen_intermediate_code_pc(CPUState * env, struct TranslationBlock *tb) { return gen_intermediate_code_internal(env, tb, 1); } + +void gen_pc_load(CPUState *env, TranslationBlock *tb, + unsigned long searched_pc, int pc_pos, void *puc) +{ + env->pc = gen_opc_pc[pc_pos]; + env->flags = gen_opc_hflags[pc_pos]; +} diff --git a/translate-all.c b/translate-all.c index bcad1f4..401969c 100644 --- a/translate-all.c +++ b/translate-all.c @@ -208,8 +208,7 @@ int cpu_restore_state(TranslationBlock *tb, #elif defined(TARGET_ALPHA) gen_pc_load(env, tb, searched_pc, j, puc); #elif defined(TARGET_SH4) - env->pc = gen_opc_pc[j]; - env->flags = gen_opc_hflags[j]; + gen_pc_load(env, tb, searched_pc, j, puc); #elif defined(TARGET_CRIS) env->pregs[PR_ERP] = gen_opc_pc[j]; #endif -- 1.5.0.6