/* Cleaning up is just the same code, backwards. With a little French. */ static void __exit fini(void) { lguest_device_remove(); free_interrupts(); free_pagetables(); unmap_switcher(); lguest_arch_host_fini(); }
/*H:000 * Welcome to the Host! * * By this point your brain has been tickled by the Guest code and numbed by * the Launcher code; prepare for it to be stretched by the Host code. This is * the heart. Let's begin at the initialization routine for the Host's lg * module. */ static int __init init(void) { int err; /* Lguest can't run under Xen, VMI or itself. It does Tricky Stuff. */ if (paravirt_enabled()) { printk("lguest is afraid of being a guest\n"); return -EPERM; } /* First we put the Switcher up in very high virtual memory. */ err = map_switcher(); if (err) goto out; /* Now we set up the pagetable implementation for the Guests. */ err = init_pagetables(switcher_page, SHARED_SWITCHER_PAGES); if (err) goto unmap; /* We might need to reserve an interrupt vector. */ err = init_interrupts(); if (err) goto free_pgtables; /* /dev/lguest needs to be registered. */ err = lguest_device_init(); if (err) goto free_interrupts; /* Finally we do some architecture-specific setup. */ lguest_arch_host_init(); /* All good! */ return 0; free_interrupts: free_interrupts(); free_pgtables: free_pagetables(); unmap: unmap_switcher(); out: return err; }
static int __init init(void) { int err; if (paravirt_enabled()) { printk("lguest is afraid of being a guest\n"); return -EPERM; } err = map_switcher(); if (err) goto out; err = init_pagetables(switcher_page, SHARED_SWITCHER_PAGES); if (err) goto unmap; err = init_interrupts(); if (err) goto free_pgtables; err = lguest_device_init(); if (err) goto free_interrupts; lguest_arch_host_init(); return 0; free_interrupts: free_interrupts(); free_pgtables: free_pagetables(); unmap: unmap_switcher(); out: return err; }