diff options
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r-- | drivers/kvm/vmx.c | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 529162345c12..84c77fed9d17 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -2350,36 +2350,36 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
2350 | #endif | 2350 | #endif |
2351 | ASM_VMX_VMWRITE_RSP_RDX "\n\t" | 2351 | ASM_VMX_VMWRITE_RSP_RDX "\n\t" |
2352 | /* Check if vmlaunch of vmresume is needed */ | 2352 | /* Check if vmlaunch of vmresume is needed */ |
2353 | "cmp $0, %1 \n\t" | 2353 | "cmpl $0, %c[launched](%0) \n\t" |
2354 | /* Load guest registers. Don't clobber flags. */ | 2354 | /* Load guest registers. Don't clobber flags. */ |
2355 | #ifdef CONFIG_X86_64 | 2355 | #ifdef CONFIG_X86_64 |
2356 | "mov %c[cr2](%3), %%rax \n\t" | 2356 | "mov %c[cr2](%0), %%rax \n\t" |
2357 | "mov %%rax, %%cr2 \n\t" | 2357 | "mov %%rax, %%cr2 \n\t" |
2358 | "mov %c[rax](%3), %%rax \n\t" | 2358 | "mov %c[rax](%0), %%rax \n\t" |
2359 | "mov %c[rbx](%3), %%rbx \n\t" | 2359 | "mov %c[rbx](%0), %%rbx \n\t" |
2360 | "mov %c[rdx](%3), %%rdx \n\t" | 2360 | "mov %c[rdx](%0), %%rdx \n\t" |
2361 | "mov %c[rsi](%3), %%rsi \n\t" | 2361 | "mov %c[rsi](%0), %%rsi \n\t" |
2362 | "mov %c[rdi](%3), %%rdi \n\t" | 2362 | "mov %c[rdi](%0), %%rdi \n\t" |
2363 | "mov %c[rbp](%3), %%rbp \n\t" | 2363 | "mov %c[rbp](%0), %%rbp \n\t" |
2364 | "mov %c[r8](%3), %%r8 \n\t" | 2364 | "mov %c[r8](%0), %%r8 \n\t" |
2365 | "mov %c[r9](%3), %%r9 \n\t" | 2365 | "mov %c[r9](%0), %%r9 \n\t" |
2366 | "mov %c[r10](%3), %%r10 \n\t" | 2366 | "mov %c[r10](%0), %%r10 \n\t" |
2367 | "mov %c[r11](%3), %%r11 \n\t" | 2367 | "mov %c[r11](%0), %%r11 \n\t" |
2368 | "mov %c[r12](%3), %%r12 \n\t" | 2368 | "mov %c[r12](%0), %%r12 \n\t" |
2369 | "mov %c[r13](%3), %%r13 \n\t" | 2369 | "mov %c[r13](%0), %%r13 \n\t" |
2370 | "mov %c[r14](%3), %%r14 \n\t" | 2370 | "mov %c[r14](%0), %%r14 \n\t" |
2371 | "mov %c[r15](%3), %%r15 \n\t" | 2371 | "mov %c[r15](%0), %%r15 \n\t" |
2372 | "mov %c[rcx](%3), %%rcx \n\t" /* kills %3 (rcx) */ | 2372 | "mov %c[rcx](%0), %%rcx \n\t" /* kills %0 (rcx) */ |
2373 | #else | 2373 | #else |
2374 | "mov %c[cr2](%3), %%eax \n\t" | 2374 | "mov %c[cr2](%0), %%eax \n\t" |
2375 | "mov %%eax, %%cr2 \n\t" | 2375 | "mov %%eax, %%cr2 \n\t" |
2376 | "mov %c[rax](%3), %%eax \n\t" | 2376 | "mov %c[rax](%0), %%eax \n\t" |
2377 | "mov %c[rbx](%3), %%ebx \n\t" | 2377 | "mov %c[rbx](%0), %%ebx \n\t" |
2378 | "mov %c[rdx](%3), %%edx \n\t" | 2378 | "mov %c[rdx](%0), %%edx \n\t" |
2379 | "mov %c[rsi](%3), %%esi \n\t" | 2379 | "mov %c[rsi](%0), %%esi \n\t" |
2380 | "mov %c[rdi](%3), %%edi \n\t" | 2380 | "mov %c[rdi](%0), %%edi \n\t" |
2381 | "mov %c[rbp](%3), %%ebp \n\t" | 2381 | "mov %c[rbp](%0), %%ebp \n\t" |
2382 | "mov %c[rcx](%3), %%ecx \n\t" /* kills %3 (ecx) */ | 2382 | "mov %c[rcx](%0), %%ecx \n\t" /* kills %0 (ecx) */ |
2383 | #endif | 2383 | #endif |
2384 | /* Enter guest mode */ | 2384 | /* Enter guest mode */ |
2385 | "jne .Llaunched \n\t" | 2385 | "jne .Llaunched \n\t" |
@@ -2389,62 +2389,62 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
2389 | ".Lkvm_vmx_return: " | 2389 | ".Lkvm_vmx_return: " |
2390 | /* Save guest registers, load host registers, keep flags */ | 2390 | /* Save guest registers, load host registers, keep flags */ |
2391 | #ifdef CONFIG_X86_64 | 2391 | #ifdef CONFIG_X86_64 |
2392 | "xchg %3, (%%rsp) \n\t" | 2392 | "xchg %0, (%%rsp) \n\t" |
2393 | "mov %%rax, %c[rax](%3) \n\t" | 2393 | "mov %%rax, %c[rax](%0) \n\t" |
2394 | "mov %%rbx, %c[rbx](%3) \n\t" | 2394 | "mov %%rbx, %c[rbx](%0) \n\t" |
2395 | "pushq (%%rsp); popq %c[rcx](%3) \n\t" | 2395 | "pushq (%%rsp); popq %c[rcx](%0) \n\t" |
2396 | "mov %%rdx, %c[rdx](%3) \n\t" | 2396 | "mov %%rdx, %c[rdx](%0) \n\t" |
2397 | "mov %%rsi, %c[rsi](%3) \n\t" | 2397 | "mov %%rsi, %c[rsi](%0) \n\t" |
2398 | "mov %%rdi, %c[rdi](%3) \n\t" | 2398 | "mov %%rdi, %c[rdi](%0) \n\t" |
2399 | "mov %%rbp, %c[rbp](%3) \n\t" | 2399 | "mov %%rbp, %c[rbp](%0) \n\t" |
2400 | "mov %%r8, %c[r8](%3) \n\t" | 2400 | "mov %%r8, %c[r8](%0) \n\t" |
2401 | "mov %%r9, %c[r9](%3) \n\t" | 2401 | "mov %%r9, %c[r9](%0) \n\t" |
2402 | "mov %%r10, %c[r10](%3) \n\t" | 2402 | "mov %%r10, %c[r10](%0) \n\t" |
2403 | "mov %%r11, %c[r11](%3) \n\t" | 2403 | "mov %%r11, %c[r11](%0) \n\t" |
2404 | "mov %%r12, %c[r12](%3) \n\t" | 2404 | "mov %%r12, %c[r12](%0) \n\t" |
2405 | "mov %%r13, %c[r13](%3) \n\t" | 2405 | "mov %%r13, %c[r13](%0) \n\t" |
2406 | "mov %%r14, %c[r14](%3) \n\t" | 2406 | "mov %%r14, %c[r14](%0) \n\t" |
2407 | "mov %%r15, %c[r15](%3) \n\t" | 2407 | "mov %%r15, %c[r15](%0) \n\t" |
2408 | "mov %%cr2, %%rax \n\t" | 2408 | "mov %%cr2, %%rax \n\t" |
2409 | "mov %%rax, %c[cr2](%3) \n\t" | 2409 | "mov %%rax, %c[cr2](%0) \n\t" |
2410 | 2410 | ||
2411 | "pop %%rcx; pop %%rbp; pop %%rdx \n\t" | 2411 | "pop %%rbp; pop %%rbp; pop %%rdx \n\t" |
2412 | #else | 2412 | #else |
2413 | "xchg %3, (%%esp) \n\t" | 2413 | "xchg %0, (%%esp) \n\t" |
2414 | "mov %%eax, %c[rax](%3) \n\t" | 2414 | "mov %%eax, %c[rax](%0) \n\t" |
2415 | "mov %%ebx, %c[rbx](%3) \n\t" | 2415 | "mov %%ebx, %c[rbx](%0) \n\t" |
2416 | "pushl (%%esp); popl %c[rcx](%3) \n\t" | 2416 | "pushl (%%esp); popl %c[rcx](%0) \n\t" |
2417 | "mov %%edx, %c[rdx](%3) \n\t" | 2417 | "mov %%edx, %c[rdx](%0) \n\t" |
2418 | "mov %%esi, %c[rsi](%3) \n\t" | 2418 | "mov %%esi, %c[rsi](%0) \n\t" |
2419 | "mov %%edi, %c[rdi](%3) \n\t" | 2419 | "mov %%edi, %c[rdi](%0) \n\t" |
2420 | "mov %%ebp, %c[rbp](%3) \n\t" | 2420 | "mov %%ebp, %c[rbp](%0) \n\t" |
2421 | "mov %%cr2, %%eax \n\t" | 2421 | "mov %%cr2, %%eax \n\t" |
2422 | "mov %%eax, %c[cr2](%3) \n\t" | 2422 | "mov %%eax, %c[cr2](%0) \n\t" |
2423 | 2423 | ||
2424 | "pop %%ecx; pop %%ebp; pop %%edx \n\t" | 2424 | "pop %%ebp; pop %%ebp; pop %%edx \n\t" |
2425 | #endif | 2425 | #endif |
2426 | "setbe %0 \n\t" | 2426 | "setbe %c[fail](%0) \n\t" |
2427 | : "=q" (vmx->fail) | 2427 | : : "c"(vmx), "d"((unsigned long)HOST_RSP), |
2428 | : "r"(vmx->launched), "d"((unsigned long)HOST_RSP), | 2428 | [launched]"i"(offsetof(struct vcpu_vmx, launched)), |
2429 | "c"(vcpu), | 2429 | [fail]"i"(offsetof(struct vcpu_vmx, fail)), |
2430 | [rax]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RAX])), | 2430 | [rax]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_RAX])), |
2431 | [rbx]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RBX])), | 2431 | [rbx]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_RBX])), |
2432 | [rcx]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RCX])), | 2432 | [rcx]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_RCX])), |
2433 | [rdx]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RDX])), | 2433 | [rdx]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_RDX])), |
2434 | [rsi]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RSI])), | 2434 | [rsi]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_RSI])), |
2435 | [rdi]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RDI])), | 2435 | [rdi]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_RDI])), |
2436 | [rbp]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_RBP])), | 2436 | [rbp]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_RBP])), |
2437 | #ifdef CONFIG_X86_64 | 2437 | #ifdef CONFIG_X86_64 |
2438 | [r8]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R8])), | 2438 | [r8]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_R8])), |
2439 | [r9]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R9])), | 2439 | [r9]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_R9])), |
2440 | [r10]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R10])), | 2440 | [r10]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_R10])), |
2441 | [r11]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R11])), | 2441 | [r11]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_R11])), |
2442 | [r12]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R12])), | 2442 | [r12]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_R12])), |
2443 | [r13]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R13])), | 2443 | [r13]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_R13])), |
2444 | [r14]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R14])), | 2444 | [r14]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_R14])), |
2445 | [r15]"i"(offsetof(struct kvm_vcpu, regs[VCPU_REGS_R15])), | 2445 | [r15]"i"(offsetof(struct vcpu_vmx, vcpu.regs[VCPU_REGS_R15])), |
2446 | #endif | 2446 | #endif |
2447 | [cr2]"i"(offsetof(struct kvm_vcpu, cr2)) | 2447 | [cr2]"i"(offsetof(struct vcpu_vmx, vcpu.cr2)) |
2448 | : "cc", "memory" | 2448 | : "cc", "memory" |
2449 | #ifdef CONFIG_X86_64 | 2449 | #ifdef CONFIG_X86_64 |
2450 | , "rbx", "rdi", "rsi" | 2450 | , "rbx", "rdi", "rsi" |