From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Claudio Fontana" <cfontana@suse.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: [PATCH 2/3] cpu: Forward-declare user-mode TaskState structure
Date: Thu, 4 Mar 2021 16:26:06 +0100 [thread overview]
Message-ID: <20210304152607.1817648-3-f4bug@amsat.org> (raw)
In-Reply-To: <20210304152607.1817648-1-f4bug@amsat.org>
The TaskState structure is only used by user emulation.
Currently it is hold in CPUState as a void pointer and
casted in user-specific code. In order to simplify by
- renaming this generic field
- remove the casts
in the next commit, forward-declare the type in "cpu.h".
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
bsd-user/qemu.h | 4 ++--
include/hw/core/cpu.h | 7 +++++--
linux-user/qemu.h | 4 ++--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 1ec14010216..00e76ad856e 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -83,7 +83,7 @@ struct emulated_sigtable {
/* NOTE: we force a big alignment so that the stack stored after is
aligned too */
-typedef struct TaskState {
+struct TaskState {
pid_t ts_tid; /* tid (or pid) of this task */
struct TaskState *next;
@@ -96,7 +96,7 @@ typedef struct TaskState {
int signal_pending; /* non zero if a signal may be pending */
uint8_t stack[];
-} QEMU_ALIGNED(16) TaskState;
+} QEMU_ALIGNED(16);
void init_task_state(TaskState *ts);
extern const char *qemu_uname_release;
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index c005d3dc2d8..f4d2169cc8e 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -274,6 +274,9 @@ struct qemu_work_item;
#define CPU_UNSET_NUMA_NODE_ID -1
#define CPU_TRACE_DSTATE_MAX_EVENTS 32
+/* See bsd-user/qemu.h and linux-user/qemu.h */
+typedef struct TaskState TaskState;
+
/**
* CPUState:
* @cpu_index: CPU index (informative).
@@ -310,7 +313,7 @@ struct qemu_work_item;
* @gdb_num_regs: Number of total registers accessible to GDB.
* @gdb_num_g_regs: Number of registers in GDB 'g' packets.
* @next_cpu: Next CPU sharing TB cache.
- * @opaque: User data.
+ * @opaque: User task data.
* @mem_io_pc: Host Program Counter at which the memory was accessed.
* @kvm_fd: vCPU file descriptor for KVM.
* @work_mutex: Lock to prevent multiple access to @work_list.
@@ -386,7 +389,7 @@ struct CPUState {
QTAILQ_HEAD(, CPUWatchpoint) watchpoints;
CPUWatchpoint *watchpoint_hit;
- void *opaque;
+ TaskState *opaque;
/* In order to avoid passing too many arguments to the MMIO helpers,
* we store some rarely used information in the CPU context.
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index d7815bfb845..5394f726892 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -100,7 +100,7 @@ struct emulated_sigtable {
/* NOTE: we force a big alignment so that the stack stored after is
aligned too */
-typedef struct TaskState {
+struct TaskState {
pid_t ts_tid; /* tid (or pid) of this task */
#ifdef TARGET_ARM
# ifdef TARGET_ABI32
@@ -157,7 +157,7 @@ typedef struct TaskState {
/* This thread's sigaltstack, if it has one */
struct target_sigaltstack sigaltstack_used;
-} QEMU_ALIGNED(16) TaskState;
+} QEMU_ALIGNED(16);
extern char *exec_path;
void init_task_state(TaskState *ts);
--
2.26.2
next prev parent reply other threads:[~2021-03-04 15:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 15:26 [PATCH 0/3] user-mode: Rename CPUState::opaque as CPUState::task_state Philippe Mathieu-Daudé
2021-03-04 15:26 ` [PATCH 1/3] user-mode: Use QEMU_ALIGNED() on TaskState structure Philippe Mathieu-Daudé
2021-03-04 17:08 ` Peter Maydell
2021-03-04 15:26 ` Philippe Mathieu-Daudé [this message]
2021-03-04 16:47 ` [PATCH 2/3] cpu: Forward-declare user-mode " Philippe Mathieu-Daudé
2021-03-04 15:26 ` [PATCH 3/3] user-mode: Rename CPUState::opaque as CPUState::task_state Philippe Mathieu-Daudé
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=20210304152607.1817648-3-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=alex.bennee@linaro.org \
--cc=cfontana@suse.de \
--cc=ehabkost@redhat.com \
--cc=laurent@vivier.eu \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).