qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: pierrick.bouvier@linaro.org, alex.bennee@linaro.org
Subject: [PATCH v2 5/9] target/i386: Split out gdb-internal.h
Date: Wed,  5 Jun 2024 20:29:22 -0700	[thread overview]
Message-ID: <20240606032926.83599-6-richard.henderson@linaro.org> (raw)
In-Reply-To: <20240606032926.83599-1-richard.henderson@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/i386/gdb-internal.h | 65 ++++++++++++++++++++++++++++++++++++++
 target/i386/gdbstub.c      |  1 +
 2 files changed, 66 insertions(+)
 create mode 100644 target/i386/gdb-internal.h

diff --git a/target/i386/gdb-internal.h b/target/i386/gdb-internal.h
new file mode 100644
index 0000000000..7cf4c1a656
--- /dev/null
+++ b/target/i386/gdb-internal.h
@@ -0,0 +1,65 @@
+/*
+ * x86 gdb server stub
+ *
+ * Copyright (c) 2003-2005 Fabrice Bellard
+ * Copyright (c) 2013 SUSE LINUX Products GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef I386_GDB_INTERNAL_H
+#define I386_GDB_INTERNAL_H
+
+/*
+ * Keep these in sync with assignment to
+ * gdb_num_core_regs in target/i386/cpu.c
+ * and with the machine description
+ */
+
+/*
+ * SEG: 6 segments, plus fs_base, gs_base, kernel_gs_base
+ */
+
+/*
+ * general regs ----->  8 or 16
+ */
+#define IDX_NB_IP       1
+#define IDX_NB_FLAGS    1
+#define IDX_NB_SEG      (6 + 3)
+#define IDX_NB_CTL      6
+#define IDX_NB_FP       16
+/*
+ * fpu regs ----------> 8 or 16
+ */
+#define IDX_NB_MXCSR    1
+/*
+ *          total ----> 8+1+1+9+6+16+8+1=50 or 16+1+1+9+6+16+16+1=66
+ */
+
+#define IDX_IP_REG      CPU_NB_REGS
+#define IDX_FLAGS_REG   (IDX_IP_REG + IDX_NB_IP)
+#define IDX_SEG_REGS    (IDX_FLAGS_REG + IDX_NB_FLAGS)
+#define IDX_CTL_REGS    (IDX_SEG_REGS + IDX_NB_SEG)
+#define IDX_FP_REGS     (IDX_CTL_REGS + IDX_NB_CTL)
+#define IDX_XMM_REGS    (IDX_FP_REGS + IDX_NB_FP)
+#define IDX_MXCSR_REG   (IDX_XMM_REGS + CPU_NB_REGS)
+
+#define IDX_CTL_CR0_REG     (IDX_CTL_REGS + 0)
+#define IDX_CTL_CR2_REG     (IDX_CTL_REGS + 1)
+#define IDX_CTL_CR3_REG     (IDX_CTL_REGS + 2)
+#define IDX_CTL_CR4_REG     (IDX_CTL_REGS + 3)
+#define IDX_CTL_CR8_REG     (IDX_CTL_REGS + 4)
+#define IDX_CTL_EFER_REG    (IDX_CTL_REGS + 5)
+
+#endif
diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c
index 4acf485879..96b4382a5d 100644
--- a/target/i386/gdbstub.c
+++ b/target/i386/gdbstub.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "gdbstub/helpers.h"
+#include "gdb-internal.h"
 
 #ifdef TARGET_X86_64
 static const int gpr_map[16] = {
-- 
2.34.1



  parent reply	other threads:[~2024-06-06  3:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06  3:29 [PATCH v2 0/9] plugins: Use unwind info for special gdb registers Richard Henderson
2024-06-06  3:29 ` [PATCH v2 1/9] tcg: Introduce INDEX_op_plugin_pc Richard Henderson
2024-06-06  9:40   ` Alex Bennée
2024-06-06  3:29 ` [PATCH v2 2/9] accel/tcg: Set CPUState.plugin_ra before all plugin callbacks Richard Henderson
2024-06-06  9:44   ` Alex Bennée
2024-06-06  3:29 ` [PATCH v2 3/9] accel/tcg: Return the TranslationBlock from cpu_unwind_state_data Richard Henderson
2024-06-06  9:45   ` Alex Bennée
2024-06-06  3:29 ` [PATCH v2 4/9] plugins: Introduce TCGCPUOps callbacks for mid-tb register reads Richard Henderson
2024-06-06  9:47   ` Alex Bennée
2024-06-06 10:22     ` Alex Bennée
2024-06-06  3:29 ` Richard Henderson [this message]
2024-06-06  6:51   ` [PATCH v2 5/9] target/i386: Split out gdb-internal.h Philippe Mathieu-Daudé
2024-06-06 15:27     ` Richard Henderson
2024-06-06  3:29 ` [PATCH v2 6/9] target/i386: Introduce cpu_compute_eflags_ccop Richard Henderson
2024-06-06  3:29 ` [PATCH v2 7/9] target/i386: Implement TCGCPUOps for plugin register reads Richard Henderson
2024-06-06  9:52   ` Alex Bennée
2024-06-06  3:29 ` [PATCH v2 8/9] target/arm: Add aarch64_tcg_ops Richard Henderson
2024-06-12 14:36   ` Alex Bennée
2024-06-12 15:45     ` Richard Henderson
2024-06-13 12:35       ` Alex Bennée
2024-06-06  3:29 ` [PATCH v2 9/9] target/arm: Implement TCGCPUOps for plugin register reads Richard Henderson
2024-06-06  6:55 ` [PATCH v2 0/9] plugins: Use unwind info for special gdb registers Philippe Mathieu-Daudé
2024-06-12 14:39 ` Alex Bennée

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=20240606032926.83599-6-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.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).