···11+From cdd77e87eae52b7251acc5990207a1c4500a84ce Mon Sep 17 00:00:00 2001
22+From: Andi Kleen <ak@linux.intel.com>
33+Date: Tue, 5 Nov 2013 21:22:28 +1030
44+Subject: x86, asmlinkage, lguest: Pass in globals into assembler statement
55+66+Tell the compiler that the inline assembler statement
77+references lguest_entry.
88+99+This fixes compile problems with LTO where the variable
1010+and the assembler code may end up in different files.
1111+1212+Cc: x86@kernel.org
1313+Cc: rusty@rustcorp.com.au
1414+Signed-off-by: Andi Kleen <ak@linux.intel.com>
1515+Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1616+---
1717+ drivers/lguest/x86/core.c | 6 ++++--
1818+ 1 file changed, 4 insertions(+), 2 deletions(-)
1919+2020+diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
2121+index 5169239..922a1ac 100644
2222+--- a/drivers/lguest/x86/core.c
2323++++ b/drivers/lguest/x86/core.c
2424+@@ -157,7 +157,7 @@ static void run_guest_once(struct lg_cpu *cpu, struct lguest_pages *pages)
2525+ * stack, then the address of this call. This stack layout happens to
2626+ * exactly match the stack layout created by an interrupt...
2727+ */
2828+- asm volatile("pushf; lcall *lguest_entry"
2929++ asm volatile("pushf; lcall *%4"
3030+ /*
3131+ * This is how we tell GCC that %eax ("a") and %ebx ("b")
3232+ * are changed by this routine. The "=" means output.
3333+@@ -169,7 +169,9 @@ static void run_guest_once(struct lg_cpu *cpu, struct lguest_pages *pages)
3434+ * physical address of the Guest's top-level page
3535+ * directory.
3636+ */
3737+- : "0"(pages), "1"(__pa(cpu->lg->pgdirs[cpu->cpu_pgd].pgdir))
3838++ : "0"(pages),
3939++ "1"(__pa(cpu->lg->pgdirs[cpu->cpu_pgd].pgdir)),
4040++ "m"(lguest_entry)
4141+ /*
4242+ * We tell gcc that all these registers could change,
4343+ * which means we don't have to save and restore them in
4444+--
4545+cgit v0.12
4646+