From patchwork Thu Jun 18 17:24:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 486453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D4BE614027C for ; Fri, 19 Jun 2015 03:25:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=F/dPfbno; dkim-atps=neutral Received: from localhost ([::1]:54174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5dZY-0002zK-Dj for incoming@patchwork.ozlabs.org; Thu, 18 Jun 2015 13:25:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5dYv-0001ww-Pg for qemu-devel@nongnu.org; Thu, 18 Jun 2015 13:25:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5dYu-0007Cd-RA for qemu-devel@nongnu.org; Thu, 18 Jun 2015 13:25:13 -0400 Received: from mail-pa0-x236.google.com ([2607:f8b0:400e:c03::236]:35735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5dYu-0007C5-LB for qemu-devel@nongnu.org; Thu, 18 Jun 2015 13:25:12 -0400 Received: by pacyx8 with SMTP id yx8so65753759pac.2 for ; Thu, 18 Jun 2015 10:25:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=Ipptg0fvrFN6BunnROr+JKKB8+mZVHeblV+NYwPtEtM=; b=F/dPfbnoTvNSkDN+ZiSwnTKhB/DV49UwLjJzN7f3MO+AB5IZERRYwO4Y7wXuCW1A/Y vDF74M6oVFhi1CMZpdrcFd0vg2PiVD+INet+x5fNDbTL3MDp/C3ztaw3gJ6q+kXDj8p2 Z1qn9uqpYfmU/gcDpR2gmMh/Br9JjWWAe7MVuzJJmdnAYZUm+BpfYFvvOrDP1vp+APK/ SrnhOhzzg2zQnq2TfFE3GFCtsRhMkSpdLLkGgovOf5MEdzgen/2dBKejsbkSYJEmAG3Y KApu4Zqe6avzE1Y4DsJ11vVb/QwrKY3s0uVf26HviU3/Y+gNB1euYozQNl2+8Tf0WJWD 8aHA== X-Received: by 10.68.68.167 with SMTP id x7mr1253328pbt.161.1434648312030; Thu, 18 Jun 2015 10:25:12 -0700 (PDT) Received: from pcrost-laptop.hsd1.ca.comcast.net (c-73-15-58-35.hsd1.ca.comcast.net. [73.15.58.35]) by mx.google.com with ESMTPSA id cz1sm8605105pbc.84.2015.06.18.10.25.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Jun 2015 10:25:11 -0700 (PDT) From: Peter Crosthwaite X-Google-Original-From: Peter Crosthwaite To: qemu-devel@nongnu.org Date: Thu, 18 Jun 2015 10:24:52 -0700 Message-Id: <1434648295-30584-6-git-send-email-crosthwaite.peter@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1434648295-30584-1-git-send-email-crosthwaite.peter@gmail.com> References: <1434648295-30584-1-git-send-email-crosthwaite.peter@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::236 Cc: ehabkost@redhat.com, Peter Crosthwaite , Riku Voipio , afaerber@suse.de, aurelien@aurel32.net, rth@twiddle.net Subject: [Qemu-devel] [PATCH v3 5/8] gdbserver: _fork: Change fn to accept cpu instead of env 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 All callsites to this function navigate the cpu->env_ptr only for the function to take the env ptr back to the original cpu ptr. Change the function to just pass in the CPU pointer instead. Removes a core code usage of ENV_GET_CPU (in gdbstub.c). Cc: Riku Voipio Reviewed-by: Andreas Färber Signed-off-by: Peter Crosthwaite Reviewed-by: Eduardo Habkost --- bsd-user/main.c | 2 +- gdbstub.c | 3 +-- include/exec/gdbstub.h | 2 +- linux-user/main.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index ba0b998..45a1436 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -92,7 +92,7 @@ void fork_start(void) void fork_end(int child) { if (child) { - gdbserver_fork((CPUArchState *)thread_cpu->env_ptr); + gdbserver_fork(thread_cpu); } } diff --git a/gdbstub.c b/gdbstub.c index 94e59fe..c023aa8 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1629,9 +1629,8 @@ int gdbserver_start(int port) } /* Disable gdb stub for child processes. */ -void gdbserver_fork(CPUArchState *env) +void gdbserver_fork(CPUState *cpu) { - CPUState *cpu = ENV_GET_CPU(env); GDBState *s = gdbserver_state; if (gdbserver_fd < 0 || s->fd < 0) { diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index c633248..ab7ac33 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -22,7 +22,7 @@ void gdb_exit(CPUArchState *, int); int gdb_queuesig (void); int gdb_handlesig(CPUState *, int); void gdb_signalled(CPUArchState *, int); -void gdbserver_fork(CPUArchState *); +void gdbserver_fork(CPUState *); #endif /* Get or set a register. Returns the size of the register. */ typedef int (*gdb_reg_cb)(CPUArchState *env, uint8_t *buf, int reg); diff --git a/linux-user/main.c b/linux-user/main.c index a0d3e58..17cf38d 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -130,7 +130,7 @@ void fork_end(int child) pthread_cond_init(&exclusive_cond, NULL); pthread_cond_init(&exclusive_resume, NULL); pthread_mutex_init(&tcg_ctx.tb_ctx.tb_lock, NULL); - gdbserver_fork((CPUArchState *)thread_cpu->env_ptr); + gdbserver_fork(thread_cpu); } else { pthread_mutex_unlock(&exclusive_lock); pthread_mutex_unlock(&tcg_ctx.tb_ctx.tb_lock);