[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/7] target/i386: Split out gdb-internal.h
|
From: |
Richard Henderson |
|
Subject: |
[PATCH 5/7] target/i386: Split out gdb-internal.h |
|
Date: |
Mon, 15 Apr 2024 21:06:07 -0700 |
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 ebb000df6a..9662509b82 100644
--- a/target/i386/gdbstub.c
+++ b/target/i386/gdbstub.c
@@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "include/gdbstub/helpers.h"
+#include "gdb-internal.h"
#ifdef TARGET_X86_64
static const int gpr_map[16] = {
--
2.34.1
- [PATCH 0/7] plugins: Use unwind info for special gdb registers, Richard Henderson, 2024/04/16
- [PATCH 0/7] plugins: Use unwind info for special gdb registers, Richard Henderson, 2024/04/16
- [PATCH 1/7] tcg: Introduce INDEX_op_plugin_pc, Richard Henderson, 2024/04/16
- [PATCH 2/7] accel/tcg: Set CPUState.plugin_ra before all plugin callbacks, Richard Henderson, 2024/04/16
- [PATCH 3/7] accel/tcg: Return the TranslationBlock from cpu_unwind_state_data, Richard Henderson, 2024/04/16
- [PATCH 4/7] plugins: Introduce TCGCPUOps callbacks for mid-tb register reads, Richard Henderson, 2024/04/16
- [PATCH 5/7] target/i386: Split out gdb-internal.h,
Richard Henderson <=
- [PATCH 6/7] target/i386: Introduce cpu_compute_eflags_ccop, Richard Henderson, 2024/04/16
- [PATCH 7/7] target/i386: Implement TCGCPUOps for plugin register reads, Richard Henderson, 2024/04/16
- Re: [PATCH 0/7] plugins: Use unwind info for special gdb registers, Pierrick Bouvier, 2024/04/16
- Re: [PATCH 0/7] plugins: Use unwind info for special gdb registers, Alex Bennée, 2024/04/22