1From cdd77e87eae52b7251acc5990207a1c4500a84ce Mon Sep 17 00:00:00 2001
2From: Andi Kleen <ak@linux.intel.com>
3Date: Tue, 5 Nov 2013 21:22:28 +1030
4Subject: x86, asmlinkage, lguest: Pass in globals into assembler statement
5
6Tell the compiler that the inline assembler statement
7references lguest_entry.
8
9This fixes compile problems with LTO where the variable
10and the assembler code may end up in different files.
11
12Cc: x86@kernel.org
13Cc: rusty@rustcorp.com.au
14Signed-off-by: Andi Kleen <ak@linux.intel.com>
15Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
16---
17 drivers/lguest/x86/core.c | 6 ++++--
18 1 file changed, 4 insertions(+), 2 deletions(-)
19
20diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
21index 5169239..922a1ac 100644
22--- a/drivers/lguest/x86/core.c
23+++ b/drivers/lguest/x86/core.c
24@@ -157,7 +157,7 @@ static void run_guest_once(struct lg_cpu *cpu, struct lguest_pages *pages)
25 * stack, then the address of this call. This stack layout happens to
26 * exactly match the stack layout created by an interrupt...
27 */
28- asm volatile("pushf; lcall *lguest_entry"
29+ asm volatile("pushf; lcall *%4"
30 /*
31 * This is how we tell GCC that %eax ("a") and %ebx ("b")
32 * are changed by this routine. The "=" means output.
33@@ -169,7 +169,9 @@ static void run_guest_once(struct lg_cpu *cpu, struct lguest_pages *pages)
34 * physical address of the Guest's top-level page
35 * directory.
36 */
37- : "0"(pages), "1"(__pa(cpu->lg->pgdirs[cpu->cpu_pgd].pgdir))
38+ : "0"(pages),
39+ "1"(__pa(cpu->lg->pgdirs[cpu->cpu_pgd].pgdir)),
40+ "m"(lguest_entry)
41 /*
42 * We tell gcc that all these registers could change,
43 * which means we don't have to save and restore them in
44--
45cgit v0.12
46