From patchwork Wed Jan 30 00:34:18 2013 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: 216738 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 628602C0093 for ; Wed, 30 Jan 2013 11:34:51 +1100 (EST) Received: from localhost ([::1]:58858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0LdZ-0007El-EG for incoming@patchwork.ozlabs.org; Tue, 29 Jan 2013 19:34:49 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0LdN-00074F-4u for qemu-devel@nongnu.org; Tue, 29 Jan 2013 19:34:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U0LdL-00022r-SD for qemu-devel@nongnu.org; Tue, 29 Jan 2013 19:34:37 -0500 Received: from cantor2.suse.de ([195.135.220.15]:52116 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0LdL-00022h-Lb for qemu-devel@nongnu.org; Tue, 29 Jan 2013 19:34:35 -0500 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 0C41DA4386; Wed, 30 Jan 2013 01:34:35 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Wed, 30 Jan 2013 01:34:18 +0100 Message-Id: <1359506059-765-2-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359506059-765-1-git-send-email-afaerber@suse.de> References: <1359506059-765-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Blue Swirl , Peter Maydell , Riku Voipio , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH for-1.4 1/2] linux-user: Fix cpu_copy() usage 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 Commit b4558d7481aefc865b0b52bf9b285ebcf2e8b59f ((x86/Sparc/PPC)-user: fix cpu_copy) added a CPU reset after cpu_copy() inside linux-user code. This reverses the register copying that cpu_copy() does. Clean this up by moving the cpu_reset() call to after cpu_init() but before memcpy(). This matches the initial CPU creation in linux-user. Cc: Blue Swirl Signed-off-by: Andreas Färber Cc: Peter Maydell Reviewed-By: Igor Mammedov --- exec.c | 6 ++++++ linux-user/syscall.c | 3 --- 2 Dateien geändert, 6 Zeilen hinzugefügt(+), 3 Zeilen entfernt(-) diff --git a/exec.c b/exec.c index b85508b..8dfa458 100644 --- a/exec.c +++ b/exec.c @@ -537,6 +537,12 @@ CPUArchState *cpu_copy(CPUArchState *env) CPUWatchpoint *wp; #endif +#ifdef CONFIG_USER_ONLY +#if defined(TARGET_I386) || defined(TARGET_SPARC) || defined(TARGET_PPC) + cpu_reset(ENV_GET_CPU(new_env)); +#endif +#endif + memcpy(new_env, env, sizeof(CPUArchState)); /* Preserve chaining. */ diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 693e66f..6c254ba 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4361,9 +4361,6 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, init_task_state(ts); /* we create a new CPU instance. */ new_env = cpu_copy(env); -#if defined(TARGET_I386) || defined(TARGET_SPARC) || defined(TARGET_PPC) - cpu_reset(ENV_GET_CPU(new_env)); -#endif /* Init regs that differ from the parent. */ cpu_clone_regs(new_env, newsp); new_env->opaque = ts;