Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d612cde060a005c1effb13d0f665448a04ce5f67
Commit:     d612cde060a005c1effb13d0f665448a04ce5f67
Parent:     511801dc31c095b2bfe3bf5c6a370dbe9b042a70
Author:     Jes Sorensen <[EMAIL PROTECTED]>
AuthorDate: Mon Oct 22 11:03:32 2007 +1000
Committer:  Rusty Russell <[EMAIL PROTECTED]>
CommitDate: Tue Oct 23 15:49:52 2007 +1000

    Move register setup into i386_core.c
    
    Move setup_regs() to lguest_arch_setup_regs() in i386_core.c given
    that this is very architecture specific.
    
    Signed-off-by: Jes Sorensen <[EMAIL PROTECTED]>
    Signed-off-by: Rusty Russell <[EMAIL PROTECTED]>
---
 drivers/lguest/lg.h          |    1 +
 drivers/lguest/lguest_user.c |   37 +------------------------------------
 drivers/lguest/x86/core.c    |   36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index 00c869b..c2557cf 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -199,6 +199,7 @@ void lguest_arch_run_guest(struct lguest *lg);
 void lguest_arch_handle_trap(struct lguest *lg);
 int lguest_arch_init_hypercalls(struct lguest *lg);
 int lguest_arch_do_hcall(struct lguest *lg, struct hcall_args *args);
+void lguest_arch_setup_regs(struct lguest *lg, unsigned long start);
 
 /* <arch>/switcher.S: */
 extern char start_switcher_text[], end_switcher_text[], switch_to_guest[];
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index d4ac5f8..b184652 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -9,37 +9,6 @@
 #include <linux/fs.h>
 #include "lg.h"
 
-/*L:030 setup_regs() doesn't really belong in this file, but it gives us an
- * early glimpse deeper into the Host so it's worth having here.
- *
- * Most of the Guest's registers are left alone: we used get_zeroed_page() to
- * allocate the structure, so they will be 0. */
-static void setup_regs(struct lguest_regs *regs, unsigned long start)
-{
-       /* There are four "segment" registers which the Guest needs to boot:
-        * The "code segment" register (cs) refers to the kernel code segment
-        * __KERNEL_CS, and the "data", "extra" and "stack" segment registers
-        * refer to the kernel data segment __KERNEL_DS.
-        *
-        * The privilege level is packed into the lower bits.  The Guest runs
-        * at privilege level 1 (GUEST_PL).*/
-       regs->ds = regs->es = regs->ss = __KERNEL_DS|GUEST_PL;
-       regs->cs = __KERNEL_CS|GUEST_PL;
-
-       /* The "eflags" register contains miscellaneous flags.  Bit 1 (0x002)
-        * is supposed to always be "1".  Bit 9 (0x200) controls whether
-        * interrupts are enabled.  We always leave interrupts enabled while
-        * running the Guest. */
-       regs->eflags = 0x202;
-
-       /* The "Extended Instruction Pointer" register says where the Guest is
-        * running. */
-       regs->eip = start;
-
-       /* %esi points to our boot information, at physical address 0, so don't
-        * touch it. */
-}
-
 /*L:310 To send DMA into the Guest, the Launcher needs to be able to ask for a
  * DMA buffer.  This is done by writing LHREQ_GETDMA and the key to
  * /dev/lguest. */
@@ -214,11 +183,7 @@ static int initialize(struct file *file, const unsigned 
long __user *input)
 
        /* Now we initialize the Guest's registers, handing it the start
         * address. */
-       setup_regs(lg->regs, args[3]);
-
-       /* There are a couple of GDT entries the Guest expects when first
-        * booting. */
-       setup_guest_gdt(lg);
+       lguest_arch_setup_regs(lg, args[3]);
 
        /* The timer for lguest's clock needs initialization. */
        init_clockdev(lg);
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index 2ef64a2..84c0908 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -535,3 +535,39 @@ int lguest_arch_init_hypercalls(struct lguest *lg)
 /* Now we've examined the hypercall code; our Guest can make requests.  There
  * is one other way we can do things for the Guest, as we see in
  * emulate_insn(). :*/
+
+/*L:030 lguest_arch_setup_regs()
+ *
+ * Most of the Guest's registers are left alone: we used get_zeroed_page() to
+ * allocate the structure, so they will be 0. */
+void lguest_arch_setup_regs(struct lguest *lg, unsigned long start)
+{
+       struct lguest_regs *regs = lg->regs;
+
+       /* There are four "segment" registers which the Guest needs to boot:
+        * The "code segment" register (cs) refers to the kernel code segment
+        * __KERNEL_CS, and the "data", "extra" and "stack" segment registers
+        * refer to the kernel data segment __KERNEL_DS.
+        *
+        * The privilege level is packed into the lower bits.  The Guest runs
+        * at privilege level 1 (GUEST_PL).*/
+       regs->ds = regs->es = regs->ss = __KERNEL_DS|GUEST_PL;
+       regs->cs = __KERNEL_CS|GUEST_PL;
+
+       /* The "eflags" register contains miscellaneous flags.  Bit 1 (0x002)
+        * is supposed to always be "1".  Bit 9 (0x200) controls whether
+        * interrupts are enabled.  We always leave interrupts enabled while
+        * running the Guest. */
+       regs->eflags = 0x202;
+
+       /* The "Extended Instruction Pointer" register says where the Guest is
+        * running. */
+       regs->eip = start;
+
+       /* %esi points to our boot information, at physical address 0, so don't
+        * touch it. */
+       /* There are a couple of GDT entries the Guest expects when first
+        * booting. */
+
+       setup_guest_gdt(lg);
+}
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to