6 #include <linux/module.h>
8 #include <linux/stddef.h>
15 #include <linux/slab.h>
16 #include <asm/paravirt.h>
17 #include <asm/pgtable.h>
18 #include <asm/uaccess.h>
20 #include <asm/asm-offsets.h>
25 static struct page **switcher_page;
42 static __init int map_switcher(
void)
72 if (!switcher_page[i]) {
85 printk(
"lguest: mapping switcher would thwack fixmap\n");
97 + (TOTAL_SWITCHER_PAGES+1) * PAGE_SIZE);
100 printk(
"lguest: could not map switcher pages high\n");
111 pagep = switcher_page;
114 printk(
"lguest: map_vm_area failed: %i\n", err);
122 memcpy(switcher_vma->
addr, start_switcher_text,
123 end_switcher_text - start_switcher_text);
135 for (--i; i >= 0; i--)
137 kfree(switcher_page);
144 static void unmap_switcher(
void)
153 kfree(switcher_page);
172 unsigned long addr,
unsigned long len)
174 return (addr+len) / PAGE_SIZE < lg->
pfn_limit && (addr+len >=
addr);
188 kill_guest(cpu,
"bad read address %#lx len %u", addr, bytes);
198 kill_guest(cpu,
"bad write address %#lx len %u", addr, bytes);
210 while (!cpu->
lg->dead) {
317 printk(
"lguest is afraid of being a guest\n");
322 err = map_switcher();
358 static void __exit fini(
void)