2018-06-25 05:38:16

by LiuYang

[permalink] [raw]
Subject: [PATCH] KVM: SVM: modify macro definition 'R' to 'R ' because of gcc-5+

From: yiqiaoxihui <[email protected]>

GCC 5.4.0 enables raw strings by default and they have higher priority
than macros, thus R is interpreted incorrectly.
Fix it by putting a space between macro R and a string literal.

Signed-off-by: yiqiaoxihui <[email protected]>
---
arch/x86/kvm/svm.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 506e4fe..dc328e1 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -3676,13 +3676,13 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
local_irq_enable();

asm volatile (
- "push %%"R"bp; \n\t"
- "mov %c[rbx](%[svm]), %%"R"bx \n\t"
- "mov %c[rcx](%[svm]), %%"R"cx \n\t"
- "mov %c[rdx](%[svm]), %%"R"dx \n\t"
- "mov %c[rsi](%[svm]), %%"R"si \n\t"
- "mov %c[rdi](%[svm]), %%"R"di \n\t"
- "mov %c[rbp](%[svm]), %%"R"bp \n\t"
+ "push %%"R "bp; \n\t"
+ "mov %c[rbx](%[svm]), %%"R "bx \n\t"
+ "mov %c[rcx](%[svm]), %%"R "cx \n\t"
+ "mov %c[rdx](%[svm]), %%"R "dx \n\t"
+ "mov %c[rsi](%[svm]), %%"R "si \n\t"
+ "mov %c[rdi](%[svm]), %%"R "di \n\t"
+ "mov %c[rbp](%[svm]), %%"R "bp \n\t"
#ifdef CONFIG_X86_64
"mov %c[r8](%[svm]), %%r8 \n\t"
"mov %c[r9](%[svm]), %%r9 \n\t"
@@ -3695,20 +3695,20 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
#endif

/* Enter guest mode */
- "push %%"R"ax \n\t"
- "mov %c[vmcb](%[svm]), %%"R"ax \n\t"
+ "push %%"R "ax \n\t"
+ "mov %c[vmcb](%[svm]), %%"R "ax \n\t"
__ex(SVM_VMLOAD) "\n\t"
__ex(SVM_VMRUN) "\n\t"
__ex(SVM_VMSAVE) "\n\t"
- "pop %%"R"ax \n\t"
+ "pop %%"R "ax \n\t"

/* Save guest registers, load host registers */
- "mov %%"R"bx, %c[rbx](%[svm]) \n\t"
- "mov %%"R"cx, %c[rcx](%[svm]) \n\t"
- "mov %%"R"dx, %c[rdx](%[svm]) \n\t"
- "mov %%"R"si, %c[rsi](%[svm]) \n\t"
- "mov %%"R"di, %c[rdi](%[svm]) \n\t"
- "mov %%"R"bp, %c[rbp](%[svm]) \n\t"
+ "mov %%"R "bx, %c[rbx](%[svm]) \n\t"
+ "mov %%"R "cx, %c[rcx](%[svm]) \n\t"
+ "mov %%"R "dx, %c[rdx](%[svm]) \n\t"
+ "mov %%"R "si, %c[rsi](%[svm]) \n\t"
+ "mov %%"R "di, %c[rdi](%[svm]) \n\t"
+ "mov %%"R "bp, %c[rbp](%[svm]) \n\t"
#ifdef CONFIG_X86_64
"mov %%r8, %c[r8](%[svm]) \n\t"
"mov %%r9, %c[r9](%[svm]) \n\t"
@@ -3719,7 +3719,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
"mov %%r14, %c[r14](%[svm]) \n\t"
"mov %%r15, %c[r15](%[svm]) \n\t"
#endif
- "pop %%"R"bp"
+ "pop %%"R "bp"
:
: [svm]"a"(svm),
[vmcb]"i"(offsetof(struct vcpu_svm, vmcb_pa)),
@@ -3740,7 +3740,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
[r15]"i"(offsetof(struct vcpu_svm, vcpu.arch.regs[VCPU_REGS_R15]))
#endif
: "cc", "memory"
- , R"bx", R"cx", R"dx", R"si", R"di"
+ , R "bx", R "cx", R "dx", R "si", R "di"
#ifdef CONFIG_X86_64
, "r8", "r9", "r10", "r11" , "r12", "r13", "r14", "r15"
#endif
--
2.7.4