qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Blue Swirl" <blauwirbel@gmail.com>,
	"Peter Crosthwaite" <crosthwaitepeter@gmail.com>,
	"Riku Voipio" <riku.voipio@iki.fi>,
	"Andreas Färber" <afaerber@suse.de>,
	"Peter Crosthwaite" <crosthwaite.peter@gmail.com>
Subject: [Qemu-devel] [PULL 08/22] gdbstub: Change gdbserver_fork() to accept cpu instead of env
Date: Tue,  7 Jul 2015 01:13:51 +0200	[thread overview]
Message-ID: <1436224445-19449-9-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1436224445-19449-1-git-send-email-afaerber@suse.de>

From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

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 <riku.voipio@iki.fi>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 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);
-- 
2.1.4

  parent reply	other threads:[~2015-07-06 23:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 23:13 [Qemu-devel] [PULL 00/22] QOM CPUState patch queue 2015-07-06 Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 01/22] cpu: No need to zero-initialize CPUState::numa_node Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 02/22] cpu: Initialize breakpoint/watchpoint lists in cpu_common_initfn() Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 03/22] cpu: Reorder cpu->as, cpu->thread_id, cpu->memory_dispatch init Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 04/22] cpu: Add Error argument to cpu_exec_init() Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 05/22] cpu: Convert cpu_index into a bitmap Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 06/22] target-ppc: Move cpu_exec_init() call to realize function Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 07/22] translate-all: Change tb_flush() env argument to cpu Andreas Färber
2015-07-06 23:13 ` Andreas Färber [this message]
2015-07-06 23:13 ` [Qemu-devel] [PULL 09/22] cpu: Change tcg_cpu_exec() arg to cpu, not env Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 10/22] cpu: Change cpu_exec_init() " Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 11/22] cpu-exec: Purge all uses of ENV_GET_CPU() Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 12/22] cpu: Add wrapper for the set_pc() hook Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 13/22] gdbstub: Use cpu_set_pc() helper Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 14/22] hw/arm/boot: Use cpu_set_pc() Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 15/22] microblaze: boot: " Andreas Färber
2015-07-06 23:13 ` [Qemu-devel] [PULL 16/22] disas: Add print_insn to disassemble info Andreas Färber
2015-07-06 23:14 ` [Qemu-devel] [PULL 17/22] disas: QOMify target specific setup Andreas Färber
2015-07-06 23:14 ` [Qemu-devel] [PULL 18/22] disas: arm-a64: Make printfer and stream variable Andreas Färber
2015-07-06 23:14 ` [Qemu-devel] [PULL 19/22] disas: arm: QOMify target specific disas setup Andreas Färber
2015-07-06 23:14 ` [Qemu-devel] [PULL 20/22] disas: microblaze: " Andreas Färber
2015-07-06 23:14 ` [Qemu-devel] [PULL 21/22] disas: cris: Fix 0 buffer length case Andreas Färber
2015-07-06 23:14 ` [Qemu-devel] [PULL 22/22] disas: cris: QOMify target specific disas setup Andreas Färber
2015-07-07  0:24 ` [Qemu-devel] [PULL 00/22] QOM CPUState patch queue 2015-07-06 Andreas Färber
2015-07-07  2:25   ` Peter Crosthwaite
2015-07-07  3:56     ` Bharata B Rao
2015-07-07  4:14       ` Peter Crosthwaite
2015-07-07  4:07     ` Peter Crosthwaite

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436224445-19449-9-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=blauwirbel@gmail.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).