From patchwork Mon Jul 6 23:13:51 2015 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: 491883 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 C690D1402D2 for ; Tue, 7 Jul 2015 09:23:11 +1000 (AEST) Received: from localhost ([::1]:53304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCFjB-0003SV-R3 for incoming@patchwork.ozlabs.org; Mon, 06 Jul 2015 19:23:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCFaf-00059O-Fw for qemu-devel@nongnu.org; Mon, 06 Jul 2015 19:14:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCFac-0007f2-VN for qemu-devel@nongnu.org; Mon, 06 Jul 2015 19:14:21 -0400 Received: from cantor2.suse.de ([195.135.220.15]:44074 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCFac-0007eD-Nt for qemu-devel@nongnu.org; Mon, 06 Jul 2015 19:14:18 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 46555ADDE; Mon, 6 Jul 2015 23:14:18 +0000 (UTC) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Tue, 7 Jul 2015 01:13:51 +0200 Message-Id: <1436224445-19449-9-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1436224445-19449-1-git-send-email-afaerber@suse.de> References: <1436224445-19449-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: Blue Swirl , Peter Crosthwaite , Riku Voipio , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Peter Crosthwaite Subject: [Qemu-devel] [PULL 08/22] gdbstub: Change gdbserver_fork() 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 From: Peter Crosthwaite 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 Reviewed-by: Eduardo Habkost Signed-off-by: Peter Crosthwaite Signed-off-by: Andreas Färber --- 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 0fa8dd8..aa5ba51 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 a608a26..05f57c2 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 c855bcc..12b18d0 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);