diff options
author | Jes Sorensen <jes@sgi.com> | 2007-10-21 21:03:32 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-23 01:49:52 -0400 |
commit | d612cde060a005c1effb13d0f665448a04ce5f67 (patch) | |
tree | e7d77ba966a7c1dad70433b23e6086a1b5e18159 /drivers/lguest/x86 | |
parent | 511801dc31c095b2bfe3bf5c6a370dbe9b042a70 (diff) |
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 <jes@sgi.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/x86')
-rw-r--r-- | drivers/lguest/x86/core.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c index 2ef64a2734d3..84c09082f27f 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) | |||
535 | /* Now we've examined the hypercall code; our Guest can make requests. There | 535 | /* Now we've examined the hypercall code; our Guest can make requests. There |
536 | * is one other way we can do things for the Guest, as we see in | 536 | * is one other way we can do things for the Guest, as we see in |
537 | * emulate_insn(). :*/ | 537 | * emulate_insn(). :*/ |
538 | |||
539 | /*L:030 lguest_arch_setup_regs() | ||
540 | * | ||
541 | * Most of the Guest's registers are left alone: we used get_zeroed_page() to | ||
542 | * allocate the structure, so they will be 0. */ | ||
543 | void lguest_arch_setup_regs(struct lguest *lg, unsigned long start) | ||
544 | { | ||
545 | struct lguest_regs *regs = lg->regs; | ||
546 | |||
547 | /* There are four "segment" registers which the Guest needs to boot: | ||
548 | * The "code segment" register (cs) refers to the kernel code segment | ||
549 | * __KERNEL_CS, and the "data", "extra" and "stack" segment registers | ||
550 | * refer to the kernel data segment __KERNEL_DS. | ||
551 | * | ||
552 | * The privilege level is packed into the lower bits. The Guest runs | ||
553 | * at privilege level 1 (GUEST_PL).*/ | ||
554 | regs->ds = regs->es = regs->ss = __KERNEL_DS|GUEST_PL; | ||
555 | regs->cs = __KERNEL_CS|GUEST_PL; | ||
556 | |||
557 | /* The "eflags" register contains miscellaneous flags. Bit 1 (0x002) | ||
558 | * is supposed to always be "1". Bit 9 (0x200) controls whether | ||
559 | * interrupts are enabled. We always leave interrupts enabled while | ||
560 | * running the Guest. */ | ||
561 | regs->eflags = 0x202; | ||
562 | |||
563 | /* The "Extended Instruction Pointer" register says where the Guest is | ||
564 | * running. */ | ||
565 | regs->eip = start; | ||
566 | |||
567 | /* %esi points to our boot information, at physical address 0, so don't | ||
568 | * touch it. */ | ||
569 | /* There are a couple of GDT entries the Guest expects when first | ||
570 | * booting. */ | ||
571 | |||
572 | setup_guest_gdt(lg); | ||
573 | } | ||