Loading Documentation/virtual/lguest/lguest.c +4 −8 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ #include <asm/bootparam.h> #include "../../../include/linux/lguest_launcher.h" /*L:110 * We can ignore the 42 include files we need for this program, but I do want * We can ignore the 43 include files we need for this program, but I do want * to draw attention to the use of kernel-style types. * * As Linus said, "C is a Spartan language, and so should your naming be." I Loading @@ -65,7 +65,6 @@ typedef uint16_t u16; typedef uint8_t u8; /*:*/ #define PAGE_PRESENT 0x7 /* Present, RW, Execute */ #define BRIDGE_PFX "bridge:" #ifndef SIOCBRADDIF #define SIOCBRADDIF 0x89a2 /* add interface to bridge */ Loading Loading @@ -1359,7 +1358,7 @@ static void setup_console(void) * --sharenet=<name> option which opens or creates a named pipe. This can be * used to send packets to another guest in a 1:1 manner. * * More sopisticated is to use one of the tools developed for project like UML * More sophisticated is to use one of the tools developed for project like UML * to do networking. * * Faster is to do virtio bonding in kernel. Doing this 1:1 would be Loading @@ -1369,7 +1368,7 @@ static void setup_console(void) * multiple inter-guest channels behind one interface, although it would * require some manner of hotplugging new virtio channels. * * Finally, we could implement a virtio network switch in the kernel. * Finally, we could use a virtio network switch in the kernel, ie. vhost. :*/ static u32 str2ip(const char *ipaddr) Loading Loading @@ -2006,10 +2005,7 @@ int main(int argc, char *argv[]) /* Tell the entry path not to try to reload segment registers. */ boot->hdr.loadflags |= KEEP_SEGMENTS; /* * We tell the kernel to initialize the Guest: this returns the open * /dev/lguest file descriptor. */ /* We tell the kernel to initialize the Guest. */ tell_kernel(start); /* Ensure that we terminate if a device-servicing child dies. */ Loading arch/x86/include/asm/lguest_hcall.h +1 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ hcall(unsigned long call, : "memory"); return call; } /*:*/ /* Can't use our min() macro here: needs to be a constant */ #define LGUEST_IRQS (NR_IRQS < 32 ? NR_IRQS: 32) Loading arch/x86/lguest/boot.c +15 −6 Original line number Diff line number Diff line Loading @@ -71,7 +71,8 @@ #include <asm/stackprotector.h> #include <asm/reboot.h> /* for struct machine_ops */ /*G:010 Welcome to the Guest! /*G:010 * Welcome to the Guest! * * The Guest in our tale is a simple creature: identical to the Host but * behaving in simplified but equivalent ways. In particular, the Guest is the Loading Loading @@ -190,15 +191,23 @@ static void lazy_hcall4(unsigned long call, #endif /*G:036 * When lazy mode is turned off reset the per-cpu lazy mode variable and then * issue the do-nothing hypercall to flush any stored calls. :*/ * When lazy mode is turned off, we issue the do-nothing hypercall to * flush any stored calls, and call the generic helper to reset the * per-cpu lazy mode variable. */ static void lguest_leave_lazy_mmu_mode(void) { hcall(LHCALL_FLUSH_ASYNC, 0, 0, 0, 0); paravirt_leave_lazy_mmu(); } /* * We also catch the end of context switch; we enter lazy mode for much of * that too, so again we need to flush here. * * (Technically, this is lazy CPU mode, and normally we're in lazy MMU * mode, but unlike Xen, lguest doesn't care about the difference). */ static void lguest_end_context_switch(struct task_struct *next) { hcall(LHCALL_FLUSH_ASYNC, 0, 0, 0, 0); Loading arch/x86/lguest/i386_head.S +11 −7 Original line number Diff line number Diff line Loading @@ -6,18 +6,22 @@ #include <asm/processor-flags.h> /*G:020 * Our story starts with the kernel booting into startup_32 in * arch/x86/kernel/head_32.S. It expects a boot header, which is created by * the bootloader (the Launcher in our case). * Our story starts with the bzImage: booting starts at startup_32 in * arch/x86/boot/compressed/head_32.S. This merely uncompresses the real * kernel in place and then jumps into it: startup_32 in * arch/x86/kernel/head_32.S. Both routines expects a boot header in the %esi * register, which is created by the bootloader (the Launcher in our case). * * The startup_32 function does very little: it clears the uninitialized global * C variables which we expect to be zero (ie. BSS) and then copies the boot * header and kernel command line somewhere safe. Finally it checks the * 'hardware_subarch' field. This was introduced in 2.6.24 for lguest and Xen: * if it's set to '1' (lguest's assigned number), then it calls us here. * header and kernel command line somewhere safe, and populates some initial * page tables. Finally it checks the 'hardware_subarch' field. This was * introduced in 2.6.24 for lguest and Xen: if it's set to '1' (lguest's * assigned number), then it calls us here. * * WARNING: be very careful here! We're running at addresses equal to physical * addesses (around 0), not above PAGE_OFFSET as most code expectes * addesses (around 0), not above PAGE_OFFSET as most code expects * (eg. 0xC0000000). Jumps are relative, so they're OK, but we can't touch any * data without remembering to subtract __PAGE_OFFSET! * Loading drivers/lguest/core.c +1 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ static __init int map_switcher(void) /* * Now the Switcher is mapped at the right address, we can't fail! * Copy in the compiled-in Switcher code (from <arch>_switcher.S). * Copy in the compiled-in Switcher code (from x86/switcher_32.S). */ memcpy(switcher_vma->addr, start_switcher_text, end_switcher_text - start_switcher_text); Loading Loading
Documentation/virtual/lguest/lguest.c +4 −8 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ #include <asm/bootparam.h> #include "../../../include/linux/lguest_launcher.h" /*L:110 * We can ignore the 42 include files we need for this program, but I do want * We can ignore the 43 include files we need for this program, but I do want * to draw attention to the use of kernel-style types. * * As Linus said, "C is a Spartan language, and so should your naming be." I Loading @@ -65,7 +65,6 @@ typedef uint16_t u16; typedef uint8_t u8; /*:*/ #define PAGE_PRESENT 0x7 /* Present, RW, Execute */ #define BRIDGE_PFX "bridge:" #ifndef SIOCBRADDIF #define SIOCBRADDIF 0x89a2 /* add interface to bridge */ Loading Loading @@ -1359,7 +1358,7 @@ static void setup_console(void) * --sharenet=<name> option which opens or creates a named pipe. This can be * used to send packets to another guest in a 1:1 manner. * * More sopisticated is to use one of the tools developed for project like UML * More sophisticated is to use one of the tools developed for project like UML * to do networking. * * Faster is to do virtio bonding in kernel. Doing this 1:1 would be Loading @@ -1369,7 +1368,7 @@ static void setup_console(void) * multiple inter-guest channels behind one interface, although it would * require some manner of hotplugging new virtio channels. * * Finally, we could implement a virtio network switch in the kernel. * Finally, we could use a virtio network switch in the kernel, ie. vhost. :*/ static u32 str2ip(const char *ipaddr) Loading Loading @@ -2006,10 +2005,7 @@ int main(int argc, char *argv[]) /* Tell the entry path not to try to reload segment registers. */ boot->hdr.loadflags |= KEEP_SEGMENTS; /* * We tell the kernel to initialize the Guest: this returns the open * /dev/lguest file descriptor. */ /* We tell the kernel to initialize the Guest. */ tell_kernel(start); /* Ensure that we terminate if a device-servicing child dies. */ Loading
arch/x86/include/asm/lguest_hcall.h +1 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ hcall(unsigned long call, : "memory"); return call; } /*:*/ /* Can't use our min() macro here: needs to be a constant */ #define LGUEST_IRQS (NR_IRQS < 32 ? NR_IRQS: 32) Loading
arch/x86/lguest/boot.c +15 −6 Original line number Diff line number Diff line Loading @@ -71,7 +71,8 @@ #include <asm/stackprotector.h> #include <asm/reboot.h> /* for struct machine_ops */ /*G:010 Welcome to the Guest! /*G:010 * Welcome to the Guest! * * The Guest in our tale is a simple creature: identical to the Host but * behaving in simplified but equivalent ways. In particular, the Guest is the Loading Loading @@ -190,15 +191,23 @@ static void lazy_hcall4(unsigned long call, #endif /*G:036 * When lazy mode is turned off reset the per-cpu lazy mode variable and then * issue the do-nothing hypercall to flush any stored calls. :*/ * When lazy mode is turned off, we issue the do-nothing hypercall to * flush any stored calls, and call the generic helper to reset the * per-cpu lazy mode variable. */ static void lguest_leave_lazy_mmu_mode(void) { hcall(LHCALL_FLUSH_ASYNC, 0, 0, 0, 0); paravirt_leave_lazy_mmu(); } /* * We also catch the end of context switch; we enter lazy mode for much of * that too, so again we need to flush here. * * (Technically, this is lazy CPU mode, and normally we're in lazy MMU * mode, but unlike Xen, lguest doesn't care about the difference). */ static void lguest_end_context_switch(struct task_struct *next) { hcall(LHCALL_FLUSH_ASYNC, 0, 0, 0, 0); Loading
arch/x86/lguest/i386_head.S +11 −7 Original line number Diff line number Diff line Loading @@ -6,18 +6,22 @@ #include <asm/processor-flags.h> /*G:020 * Our story starts with the kernel booting into startup_32 in * arch/x86/kernel/head_32.S. It expects a boot header, which is created by * the bootloader (the Launcher in our case). * Our story starts with the bzImage: booting starts at startup_32 in * arch/x86/boot/compressed/head_32.S. This merely uncompresses the real * kernel in place and then jumps into it: startup_32 in * arch/x86/kernel/head_32.S. Both routines expects a boot header in the %esi * register, which is created by the bootloader (the Launcher in our case). * * The startup_32 function does very little: it clears the uninitialized global * C variables which we expect to be zero (ie. BSS) and then copies the boot * header and kernel command line somewhere safe. Finally it checks the * 'hardware_subarch' field. This was introduced in 2.6.24 for lguest and Xen: * if it's set to '1' (lguest's assigned number), then it calls us here. * header and kernel command line somewhere safe, and populates some initial * page tables. Finally it checks the 'hardware_subarch' field. This was * introduced in 2.6.24 for lguest and Xen: if it's set to '1' (lguest's * assigned number), then it calls us here. * * WARNING: be very careful here! We're running at addresses equal to physical * addesses (around 0), not above PAGE_OFFSET as most code expectes * addesses (around 0), not above PAGE_OFFSET as most code expects * (eg. 0xC0000000). Jumps are relative, so they're OK, but we can't touch any * data without remembering to subtract __PAGE_OFFSET! * Loading
drivers/lguest/core.c +1 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ static __init int map_switcher(void) /* * Now the Switcher is mapped at the right address, we can't fail! * Copy in the compiled-in Switcher code (from <arch>_switcher.S). * Copy in the compiled-in Switcher code (from x86/switcher_32.S). */ memcpy(switcher_vma->addr, start_switcher_text, end_switcher_text - start_switcher_text); Loading