[Lguest] [PATCH] Fix building lguest as module.

Tony Breeds tony at bakeyournoodle.com
Tue Feb 19 14:44:04 EST 2008


On Mon, Feb 04, 2008 at 07:11:10AM +1100, Rusty Russell wrote:
 
> Lguest guest support and host support are separate config options: they used
> to be tied together.  Sort out which parts of asm-offsets are needed for Guest
> and Host.

<snip> With rusty's patch applied the errors still persist in some
configs.  Please try  the patch below.

Fixes the following errors from modpost when the lguest (host) support is
modular.

ERROR: "LGUEST_PAGES_guest_gdt_desc" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_host_gdt_desc" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_host_cr3" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_regs" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_host_idt_desc" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_guest_gdt" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_host_sp" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_regs_trapnum" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_guest_idt_desc" [drivers/lguest/lg.ko] undefined!

Lguest guest support and host support are separate config options: they used
to be tied together.  Sort out which parts of asm-offsets are needed for Guest
and Host.

Signed-off-by: Tony Breeds <tony at bakeyournoodle.com>
---

Original patch from rusty (http://lkml.org/lkml/2008/2/3/168) didn't completely
fix the problem.  I think this matches the original intent.

Not sure of the right way to attribute this patch, clearlyt it's mostly
Rusty's work.

 arch/x86/kernel/asm-offsets_32.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index afd8446..ae9d289 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -20,10 +20,8 @@
 
 #include <xen/interface/xen.h>
 
-#ifdef CONFIG_LGUEST_GUEST
 #include <linux/lguest.h>
 #include "../../../drivers/lguest/lg.h"
-#endif
 
 #define DEFINE(sym, val) \
         asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -134,6 +132,10 @@ void foo(void)
 	BLANK();
 	OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
 	OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);
+#endif
+
+#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_MODULE)
+	BLANK();
 	OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
 	OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
 	OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
-- 
1.5.4.1




Yours Tony

  linux.conf.au        http://linux.conf.au/ || http://lca2008.linux.org.au/
  Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!




More information about the Lguest mailing list