qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "mkdolata@us.ibm.com" <mkdolata@us.ibm.com>
Subject: [PULL 21/38] target/i386: Fix handling of k_gs_base register in 32-bit mode in gdbstub
Date: Wed,  8 Jan 2020 13:32:38 +0100	[thread overview]
Message-ID: <1578486775-52247-22-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1578486775-52247-1-git-send-email-pbonzini@redhat.com>

From: "mkdolata@us.ibm.com" <mkdolata@us.ibm.com>

gdb-xml/i386-32bit.xml includes the k_gs_base register too, so we have to
handle it even if TARGET_X86_64 is not defined.  This is already done in
x86_cpu_gdb_read_register, but not in x86_cpu_gdb_write_register where the
incorrect return value causes all registers after it to be clobbered.

Fixes https://bugs.launchpad.net/qemu/+bug/1857640.

Signed-off-by: Marek Dolata <mkdolata@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/gdbstub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c
index aef25b7..572ead6 100644
--- a/target/i386/gdbstub.c
+++ b/target/i386/gdbstub.c
@@ -350,15 +350,15 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
             env->segs[R_GS].base = ldl_p(mem_buf);
             return 4;
 
-#ifdef TARGET_X86_64
         case IDX_SEG_REGS + 8:
+#ifdef TARGET_X86_64
             if (env->hflags & HF_CS64_MASK) {
                 env->kernelgsbase = ldq_p(mem_buf);
                 return 8;
             }
             env->kernelgsbase = ldl_p(mem_buf);
-            return 4;
 #endif
+            return 4;
 
         case IDX_FP_REGS + 8:
             cpu_set_fpuc(env, ldl_p(mem_buf));
-- 
1.8.3.1




  parent reply	other threads:[~2020-01-08 12:48 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 12:32 [PULL 00/38] Misc patches for 2020-01-08 Paolo Bonzini
2020-01-08 12:32 ` [PULL 01/38] x86: Check for machine state object class before typecasting it Paolo Bonzini
2020-01-08 12:32 ` [PULL 02/38] accel/kvm: Make "kernel_irqchip" default on Paolo Bonzini
2020-01-08 12:32 ` [PULL 03/38] hw: fix using 4.2 compat in 5.0 machine types for i440fx/q35 Paolo Bonzini
2020-01-08 12:32 ` [PULL 04/38] replay: check other timers for icount limit Paolo Bonzini
2020-01-08 12:32 ` [PULL 05/38] replay: record and replay random number sources Paolo Bonzini
2020-01-08 12:32 ` [PULL 06/38] hw/i386/x86-iommu: Add missing stubs Paolo Bonzini
2020-01-08 12:32 ` [PULL 07/38] hw/i386/pc: fix regression in parsing vga cmdline parameter Paolo Bonzini
2020-01-08 12:32 ` [PULL 08/38] hw/timer/Kconfig: Intel 8254 PIT depends of ISA bus Paolo Bonzini
2020-01-08 12:32 ` [PULL 09/38] hw/usb/redirect: Do not link 'usb-redir' device when USB not enabled Paolo Bonzini
2020-01-08 12:32 ` [PULL 10/38] hw/intc/i8259: Fix Kconfig dependency on ISA bus Paolo Bonzini
2020-01-08 12:32 ` [PULL 11/38] hw/i386/Kconfig: Let the MicroVM machine select the SERIAL_ISA config Paolo Bonzini
2020-01-08 12:32 ` [PULL 12/38] hw/ppc/Kconfig: Restrict the MPC I2C controller to e500-based platforms Paolo Bonzini
2020-01-08 12:32 ` [PULL 13/38] hw/ppc/Kconfig: Let the Sam460ex board use the PowerPC 405 devices Paolo Bonzini
2020-01-08 12:32 ` [PULL 14/38] hw/ppc/Kconfig: Let the Xilinx Virtex5 ML507 use the PPC-440 devices Paolo Bonzini
2020-01-08 12:32 ` [PULL 15/38] hw/ppc/Makefile: Simplify the sPAPR PCI objects rule Paolo Bonzini
2020-01-08 12:32 ` [PULL 16/38] hw/ppc/Kconfig: Only select fw_cfg with machines using OpenBIOS Paolo Bonzini
2020-01-08 12:32 ` [PULL 17/38] hw/ppc/Kconfig: Only select FDT helper for machines using it Paolo Bonzini
2020-01-08 12:32 ` [PULL 18/38] hw/nvram/Kconfig: Add an entry for the NMC93xx EEPROM Paolo Bonzini
2020-01-08 12:32 ` [PULL 19/38] hw/nvram/Kconfig: Restrict CHRP NVRAM to machines using OpenBIOS or SLOF Paolo Bonzini
2020-01-08 12:32 ` [PULL 20/38] hw/rtc/mc146818: Add missing dependency on ISA Bus Paolo Bonzini
2020-01-08 12:32 ` Paolo Bonzini [this message]
2020-01-08 12:32 ` [PULL 22/38] target/i386: Add new bit definitions of MSR_IA32_ARCH_CAPABILITIES Paolo Bonzini
2020-01-08 12:32 ` [PULL 23/38] target/i386: Add missed features to Cooperlake CPU model Paolo Bonzini
2020-01-08 12:32 ` [PULL 24/38] hw/ipmi: Remove unnecessary declarations Paolo Bonzini
2020-01-08 12:32 ` [PULL 25/38] hw/ipmi: Explicit we ignore some QEMUChrEvent in IOEventHandler Paolo Bonzini
2020-01-08 12:32 ` [PULL 26/38] hw/char/terminal3270: Explicit ignored " Paolo Bonzini
2020-01-08 12:32 ` [PULL 27/38] hw/usb/dev-serial: Explicit we ignore few " Paolo Bonzini
2020-01-08 12:32 ` [PULL 28/38] hw/usb/redirect: " Paolo Bonzini
2020-01-08 12:32 ` [PULL 29/38] ccid-card-passthru: Explicit we ignore " Paolo Bonzini
2020-01-08 12:32 ` [PULL 30/38] vhost-user-crypto: Explicit we ignore some " Paolo Bonzini
2020-01-08 12:32 ` [PULL 31/38] vhost-user-net: Explicit we ignore few " Paolo Bonzini
2020-01-08 12:32 ` [PULL 32/38] vhost-user-blk: " Paolo Bonzini
2020-01-08 12:32 ` [PULL 33/38] virtio-console: Explicit we ignore some " Paolo Bonzini
2020-01-08 12:32 ` [PULL 34/38] monitor/qmp: Explicit we ignore few " Paolo Bonzini
2020-01-08 12:32 ` [PULL 35/38] monitor/hmp: Explicit we ignore a " Paolo Bonzini
2020-01-08 12:32 ` [PULL 36/38] chardev/char: Explicit we ignore some " Paolo Bonzini
2020-01-08 12:32 ` [PULL 37/38] chardev: use QEMUChrEvent instead of int Paolo Bonzini
2020-01-08 12:32 ` [PULL 38/38] chardev: Use QEMUChrEvent enum in IOEventHandler typedef Paolo Bonzini
2020-01-08 14:28 ` [PULL 00/38] Misc patches for 2020-01-08 no-reply
2020-01-13  9:50 ` Peter Maydell

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=1578486775-52247-22-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=mkdolata@us.ibm.com \
    --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).