Skip to contentSkip to conversation

/target/i386: fix gdbstub k_gs_base issue

PATCH In review Marek Dolata - [email protected] 2 participants 2 messages Dec 27, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 /target/i386: fix gdbstub k_gs_base issue

Fixes corrects clobbering of registers appearing after k_gs_base

---
target/i386/gdbstub.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
target/i386/gdbstub.c +3 -1
index aef25b70f1..7228d20674 100644
@@ -350,14 +350,16 @@ 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;
+#else
+            return 4;

#endif
case IDX_FP_REGS + 8:
--
2.21.0

#1 lore raw

Hi Marek,

If you look at the other patches, you'll notice no leading slash is used, so please remove it when resending.

Maybe you can use "target/i386: Fix handling of k_gs_base register in 32-bit mode in gdbstub" as patch subject.

Please Cc the maintainers. See:
https://wiki.qemu.org/Contribute/SubmitAPatch#CC_the_relevant_maintainer
Doing it for you now (adding Richard and Eduardo).

Quoted 14 lines · On 12/27/19 3:41 AM, Marek Dolata - [email protected] wrote:
Fixes corrects clobbering of registers appearing after k_gs_base

---

target/i386/gdbstub.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
target/i386/gdbstub.c +0 -0
Quoted 5 lines

index aef25b70f1..7228d20674 100644

--- a/target/i386/gdbstub.c

+++ b/target/i386/gdbstub.c

I am having troubles trying to apply your patch:

Applying: /target/i386: fix gdbstub k_gs_base issue
error: corrupt patch at line 23
Patch failed at 0001 /target/i386: fix gdbstub k_gs_base issue
hint: Use 'git am --show-current-patch' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

The information on the wiki might help you to use proper format:
https://wiki.qemu.org/Contribute/SubmitAPatch#Use_git_format-patch

Quoted 13 lines
target/i386/gdbstub.c +1 -1
@@ -350,14 +350,16 @@ 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

target/i386/gdbstub.c int x86_cpu_gdb_write_register(CPUState *cs,

Quoted 10 lines
target/i386/gdbstub.c +0 -0
 
              if (env->hflags & HF_CS64_MASK) {
 
                  env->kernelgsbase = ldq_p(mem_buf);
 
                  return 8;
 
              }
 
              env->kernelgsbase = ldl_p(mem_buf);

You can add here the

#endif

Quoted 2 lines

             return 4;

and remove the '#else return 4; #endif' lines.

Quoted 13 lines

+#else

+            return 4;

#endif

         case IDX_FP_REGS + 8:

Signature · 1 line
2.21.0

Regards,

Phil.