kvm: external module: adjust for on_each_cpu() changes in 2.6.27
[kvm-userspace.git] / kernel / hack-module.awk
blob4a9379c8c614c80e6a44d59ef9c82b5b86a51b3c
2 /^int kvm_init\(/ { anon_inodes = 1 }
4 /return 0;/ && anon_inodes {
5 print "\tr = kvm_init_anon_inodes();";
6 print "\tif (r) {";
7 print "\t\t__free_page(bad_page);";
8 print "\t\tgoto out;";
9 print "\t}";
10 print "\tpreempt_notifier_sys_init();";
11 printf("\tprintk(\"loaded kvm module (%s)\\n\");\n", version);
12 anon_inodes = 0
15 /^void kvm_exit/ { anon_inodes_exit = 1 }
17 /\}/ && anon_inodes_exit {
18 print "\tkvm_exit_anon_inodes();";
19 print "\tpreempt_notifier_sys_exit();";
20 anon_inodes_exit = 0
23 /MODULE_AUTHOR/ {
24 printf("MODULE_INFO(version, \"%s\");\n", version)
27 /^static void __vmx_load_host_state/ {
28 vmx_load_host_state = 1
31 /vmcs_readl\(HOST_GS_BASE\)/ && vmx_load_host_state {
32 $0 = "\t\twrmsrl(MSR_GS_BASE, gsbase);";
33 vmx_load_host_state = 0
36 /atomic_inc\(&kvm->mm->mm_count\);/ { $0 = "mmget(&kvm->mm->mm_count);" }
38 /^\t\.fault = / {
39 fcn = gensub(/,/, "", "g", $3)
40 $0 = "\t.VMA_OPS_FAULT(fault) = VMA_OPS_FAULT_FUNC(" fcn "),"
43 /^static int .*_stat_get/ {
44 $3 = "__" $3
47 /DEFINE_SIMPLE_ATTRIBUTE.*_stat_get/ {
48 name = gensub(/,/, "", "g", $2);
49 print "MAKE_SIMPLE_ATTRIBUTE_GETTER(" name ")"
52 { sub(/linux\/mm_types\.h/, "linux/mm.h") }
54 { sub(/\<tsc_khz\>/, "kvm_tsc_khz") }
56 { sub(/\<desc_struct\>/, "kvm_desc_struct") }
57 { sub(/\<ldttss_desc64\>/, "kvm_ldttss_desc64") }
58 { sub(/\<desc_ptr\>/, "kvm_desc_ptr") }
59 { sub(/\<__user\>/, " ") }
61 { sub(/\<on_each_cpu\>/, "kvm_on_each_cpu") }
63 /^\t\.name = "kvm"/ { $0 = "\tset_kset_name(\"kvm\")," }
65 /#include <linux\/compiler.h>/ { $0 = "" }
66 /#include <linux\/clocksource.h>/ { $0 = "" }
68 { sub(/hrtimer_init/, "hrtimer_init_p") }
69 { sub(/hrtimer_start/, "hrtimer_start_p") }
70 { sub(/hrtimer_cancel/, "hrtimer_cancel_p") }
72 { print }
74 /kvm_x86_ops->run/ {
75 print "\tspecial_reload_dr7();"
78 /unsigned long flags;/ && vmx_load_host_state {
79 print "\tunsigned long gsbase;"
82 /local_irq_save/ && vmx_load_host_state {
83 print "\t\tgsbase = vmcs_readl(HOST_GS_BASE);"
86 /\tkvm_init_debug/ {
87 print "\thrtimer_kallsyms_resolve();"
89 /apic->timer.dev.function =/ {
90 print "\thrtimer_data_pointer(&apic->timer.dev);"
92 /pt->timer.function =/ {
93 print "\thrtimer_data_pointer(&pt->timer);"