···1+From cdd77e87eae52b7251acc5990207a1c4500a84ce Mon Sep 17 00:00:00 2001
2+From: Andi Kleen <ak@linux.intel.com>
3+Date: Tue, 5 Nov 2013 21:22:28 +1030
4+Subject: x86, asmlinkage, lguest: Pass in globals into assembler statement
5+6+Tell the compiler that the inline assembler statement
7+references lguest_entry.
8+9+This fixes compile problems with LTO where the variable
10+and the assembler code may end up in different files.
11+12+Cc: x86@kernel.org
13+Cc: rusty@rustcorp.com.au
14+Signed-off-by: Andi Kleen <ak@linux.intel.com>
15+Signed-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+20+diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
21+index 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+--
45+cgit v0.12
46+