Skip to contentSkip to conversation

x86: Fix the register order to match struct regs

PATCH In review Aaron Lewis 3 participants 5 messages Oct 25, 2019 – Nov 18, 2019 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: Fix the register order to match struct regs

Fix the order the registers show up in SAVE_GPR and SAVE_GPR_C to ensure the correct registers get the correct values. Previously, the registers were being written to (and read from) the wrong fields.

---
 x86/vmx.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
x86/vmx.h +6 -6
index 8496be7..8527997 100644
@@ -492,9 +492,9 @@ enum vm_instruction_error_number {
 
 #define SAVE_GPR				\
 	"xchg %rax, regs\n\t"			\
-	"xchg %rbx, regs+0x8\n\t"		\
-	"xchg %rcx, regs+0x10\n\t"		\
-	"xchg %rdx, regs+0x18\n\t"		\
+	"xchg %rcx, regs+0x8\n\t"		\
+	"xchg %rdx, regs+0x10\n\t"		\
+	"xchg %rbx, regs+0x18\n\t"		\
 	"xchg %rbp, regs+0x28\n\t"		\
 	"xchg %rsi, regs+0x30\n\t"		\
 	"xchg %rdi, regs+0x38\n\t"		\
@@ -511,9 +511,9 @@ enum vm_instruction_error_number {
 
 #define SAVE_GPR_C				\
 	"xchg %%rax, regs\n\t"			\
-	"xchg %%rbx, regs+0x8\n\t"		\
-	"xchg %%rcx, regs+0x10\n\t"		\
-	"xchg %%rdx, regs+0x18\n\t"		\
+	"xchg %%rcx, regs+0x8\n\t"		\
+	"xchg %%rdx, regs+0x10\n\t"		\
+	"xchg %%rbx, regs+0x18\n\t"		\
 	"xchg %%rbp, regs+0x28\n\t"		\
 	"xchg %%rsi, regs+0x30\n\t"		\
 	"xchg %%rdi, regs+0x38\n\t"		\
Signature · 1 line
2.24.0.rc0.303.g954a862665-goog
#1 lore raw
Quoted 42 lines · Aaron Lewis

Fix the order the registers show up in SAVE_GPR and SAVE_GPR_C to ensure the correct registers get the correct values. Previously, the registers were being written to (and read from) the wrong fields.

---
 x86/vmx.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
x86/vmx.h +6 -7
index 8496be7..8527997 100644
@@ -492,9 +492,9 @@ enum vm_instruction_error_number {
 
 #define SAVE_GPR                               \
        "xchg %rax, regs\n\t"                   \
-       "xchg %rbx, regs+0x8\n\t"               \
-       "xchg %rcx, regs+0x10\n\t"              \
-       "xchg %rdx, regs+0x18\n\t"              \
+       "xchg %rcx, regs+0x8\n\t"               \
+       "xchg %rdx, regs+0x10\n\t"              \
+       "xchg %rbx, regs+0x18\n\t"              \
        "xchg %rbp, regs+0x28\n\t"              \
        "xchg %rsi, regs+0x30\n\t"              \
        "xchg %rdi, regs+0x38\n\t"              \
@@ -511,9 +511,9 @@ enum vm_instruction_error_number {
 
 #define SAVE_GPR_C                             \
        "xchg %%rax, regs\n\t"                  \
-       "xchg %%rbx, regs+0x8\n\t"              \
-       "xchg %%rcx, regs+0x10\n\t"             \
-       "xchg %%rdx, regs+0x18\n\t"             \
+       "xchg %%rcx, regs+0x8\n\t"              \
+       "xchg %%rdx, regs+0x10\n\t"             \
+       "xchg %%rbx, regs+0x18\n\t"             \
        "xchg %%rbp, regs+0x28\n\t"             \
        "xchg %%rsi, regs+0x30\n\t"             \
        "xchg %%rdi, regs+0x38\n\t"             \
--
Quoted 2 lines

2.24.0.rc0.303.g954a862665-goog

ping. plain text this time.

#2 lore raw
In reply to Aaron Lewis
Quoted 42 lines · Aaron Lewis

Fix the order the registers show up in SAVE_GPR and SAVE_GPR_C to ensure the correct registers get the correct values. Previously, the registers were being written to (and read from) the wrong fields.

---
 x86/vmx.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
x86/vmx.h +6 -7
index 8496be7..8527997 100644
@@ -492,9 +492,9 @@ enum vm_instruction_error_number {
 
 #define SAVE_GPR                               \
        "xchg %rax, regs\n\t"                   \
-       "xchg %rbx, regs+0x8\n\t"               \
-       "xchg %rcx, regs+0x10\n\t"              \
-       "xchg %rdx, regs+0x18\n\t"              \
+       "xchg %rcx, regs+0x8\n\t"               \
+       "xchg %rdx, regs+0x10\n\t"              \
+       "xchg %rbx, regs+0x18\n\t"              \
        "xchg %rbp, regs+0x28\n\t"              \
        "xchg %rsi, regs+0x30\n\t"              \
        "xchg %rdi, regs+0x38\n\t"              \
@@ -511,9 +511,9 @@ enum vm_instruction_error_number {
 
 #define SAVE_GPR_C                             \
        "xchg %%rax, regs\n\t"                  \
-       "xchg %%rbx, regs+0x8\n\t"              \
-       "xchg %%rcx, regs+0x10\n\t"             \
-       "xchg %%rdx, regs+0x18\n\t"             \
+       "xchg %%rcx, regs+0x8\n\t"              \
+       "xchg %%rdx, regs+0x10\n\t"             \
+       "xchg %%rbx, regs+0x18\n\t"             \
        "xchg %%rbp, regs+0x28\n\t"             \
        "xchg %%rsi, regs+0x30\n\t"             \
        "xchg %%rdi, regs+0x38\n\t"             \
--
Quoted 2 lines

2.24.0.rc0.303.g954a862665-goog

Ping.

maintainer
#3 lore raw
Quoted 31 lines · Aaron Lewis
Quoted 30 lines · Aaron Lewis

Fix the order the registers show up in SAVE_GPR and SAVE_GPR_C to ensure the correct registers get the correct values. Previously, the registers were being written to (and read from) the wrong fields.

---
 x86/vmx.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
x86/vmx.h +3 -3
index 8496be7..8527997 100644
@@ -492,9 +492,9 @@ enum vm_instruction_error_number {
 
 #define SAVE_GPR                               \
        "xchg %rax, regs\n\t"                   \
-       "xchg %rbx, regs+0x8\n\t"               \
-       "xchg %rcx, regs+0x10\n\t"              \
-       "xchg %rdx, regs+0x18\n\t"              \
+       "xchg %rcx, regs+0x8\n\t"               \
+       "xchg %rdx, regs+0x10\n\t"              \
+       "xchg %rbx, regs+0x18\n\t"              \
        "xchg %rbp, regs+0x28\n\t"              \
        "xchg %rsi, regs+0x30\n\t"              \
        "xchg %rdi, regs+0x38\n\t"              \
@@ -511,9 +511,9 @@ enum vm_instruction_error_number {
 
Quoted 17 lines
Quoted 12 lines
x86/vmx.h +3 -4
 #define SAVE_GPR_C                             \
        "xchg %%rax, regs\n\t"                  \
-       "xchg %%rbx, regs+0x8\n\t"              \
-       "xchg %%rcx, regs+0x10\n\t"             \
-       "xchg %%rdx, regs+0x18\n\t"             \
+       "xchg %%rcx, regs+0x8\n\t"              \
+       "xchg %%rdx, regs+0x10\n\t"             \
+       "xchg %%rbx, regs+0x18\n\t"             \
        "xchg %%rbp, regs+0x28\n\t"             \
        "xchg %%rsi, regs+0x30\n\t"             \
        "xchg %%rdi, regs+0x38\n\t"             \
--
Quoted 2 lines

2.24.0.rc0.303.g954a862665-goog

Ping.

Pushed, thanks.

Paolo

Reviewed-by
#4 lore raw
In reply to Aaron Lewis
Quoted 30 lines · Aaron Lewis
Quoted 29 lines · Aaron Lewis

Fix the order the registers show up in SAVE_GPR and SAVE_GPR_C to ensure the correct registers get the correct values. Previously, the registers were being written to (and read from) the wrong fields.

---
  x86/vmx.h | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
x86/vmx.h +3 -3
index 8496be7..8527997 100644
@@ -492,9 +492,9 @@ enum vm_instruction_error_number {
 
  #define SAVE_GPR                               \
         "xchg %rax, regs\n\t"                   \
-       "xchg %rbx, regs+0x8\n\t"               \
-       "xchg %rcx, regs+0x10\n\t"              \
-       "xchg %rdx, regs+0x18\n\t"              \
+       "xchg %rcx, regs+0x8\n\t"               \
+       "xchg %rdx, regs+0x10\n\t"              \
+       "xchg %rbx, regs+0x18\n\t"              \
         "xchg %rbp, regs+0x28\n\t"              \
         "xchg %rsi, regs+0x30\n\t"              \
         "xchg %rdi, regs+0x38\n\t"              \
@@ -511,9 +511,9 @@ enum vm_instruction_error_number {
 
Quoted 15 lines
Quoted 12 lines
x86/vmx.h +3 -4
  #define SAVE_GPR_C                             \
         "xchg %%rax, regs\n\t"                  \
-       "xchg %%rbx, regs+0x8\n\t"              \
-       "xchg %%rcx, regs+0x10\n\t"             \
-       "xchg %%rdx, regs+0x18\n\t"             \
+       "xchg %%rcx, regs+0x8\n\t"              \
+       "xchg %%rdx, regs+0x10\n\t"             \
+       "xchg %%rbx, regs+0x18\n\t"             \
         "xchg %%rbp, regs+0x28\n\t"             \
         "xchg %%rsi, regs+0x30\n\t"             \
         "xchg %%rdi, regs+0x38\n\t"             \
--
Quoted 2 lines

2.24.0.rc0.303.g954a862665-goog

Ping.