kvm: external module: Remove obsolete special_reload_dr7 hack
[qemu-kvm/amd-iommu.git] / kvm / kernel / x86 / hack-module.awk
blobf40c97276f7e17065491f2fb35a347bc952c9141
1 BEGIN { split("INIT_WORK tsc_khz desc_struct ldttss_desc64 desc_ptr " \
2 "on_each_cpu relay_open request_irq" , compat_apis); }
4 /^int kvm_init\(/ { anon_inodes = 1 }
6 /return 0;/ && anon_inodes {
7 print "\tr = kvm_init_anon_inodes();";
8 print "\tif (r) {";
9 print "\t\t__free_page(bad_page);";
10 print "\t\tgoto out;";
11 print "\t}";
12 print "\tpreempt_notifier_sys_init();";
13 printf("\tprintk(\"loaded kvm module (%s)\\n\");\n", version);
14 anon_inodes = 0
17 /^void kvm_exit/ { anon_inodes_exit = 1 }
19 /\}/ && anon_inodes_exit {
20 print "\tkvm_exit_anon_inodes();";
21 print "\tpreempt_notifier_sys_exit();";
22 anon_inodes_exit = 0
25 /MODULE_AUTHOR/ {
26 printf("MODULE_INFO(version, \"%s\");\n", version)
29 /^static void __vmx_load_host_state/ {
30 vmx_load_host_state = 1
33 /vmcs_readl\(HOST_GS_BASE\)/ && vmx_load_host_state {
34 $0 = "\t\twrmsrl(MSR_GS_BASE, gsbase);";
35 vmx_load_host_state = 0
38 /atomic_inc\(&kvm->mm->mm_count\);/ { $0 = "mmget(&kvm->mm->mm_count);" }
40 /^\t\.fault = / {
41 fcn = gensub(/,/, "", "g", $3)
42 $0 = "\t.VMA_OPS_FAULT(fault) = VMA_OPS_FAULT_FUNC(" fcn "),"
45 /^static int (.*_stat_get|lost_records_get)/ {
46 $3 = "__" $3
49 /DEFINE_SIMPLE_ATTRIBUTE.*(_stat_get|lost_records_get)/ {
50 name = gensub(/,/, "", "g", $2);
51 print "MAKE_SIMPLE_ATTRIBUTE_GETTER(" name ")"
54 { sub(/linux\/mm_types\.h/, "linux/mm.h") }
56 { sub(/\<__user\>/, " ") }
58 /^\t\.name = "kvm"/ { $0 = "\tset_kset_name(\"kvm\")," }
60 /#include <linux\/compiler.h>/ { $0 = "" }
61 /#include <linux\/clocksource.h>/ { $0 = "" }
63 { sub(/\<hrtimer_init\>/, "hrtimer_init_p") }
64 { sub(/\<hrtimer_start\>/, "hrtimer_start_p") }
65 { sub(/\<hrtimer_cancel\>/, "hrtimer_cancel_p") }
67 /case KVM_CAP_SYNC_MMU/ { $0 = "#ifdef CONFIG_MMU_NOTIFIER\n" $0 "\n#endif" }
70 for (i in compat_apis) {
71 ident = compat_apis[i]
72 sub("\\<" ident "\\>", "kvm_" ident)
76 /\kvm_.*_fops\.owner = module;/ { $0 = "IF_ANON_INODES_DOES_REFCOUNTS(" $0 ")" }
78 { print }
80 /unsigned long flags;/ && vmx_load_host_state {
81 print "\tunsigned long gsbase;"
84 /local_irq_save/ && vmx_load_host_state {
85 print "\t\tgsbase = vmcs_readl(HOST_GS_BASE);"
88 /\tkvm_init_debug/ {
89 print "\thrtimer_kallsyms_resolve();"
91 /apic->timer.dev.function =/ {
92 print "\thrtimer_data_pointer(&apic->timer.dev);"
94 /pt->timer.function =/ {
95 print "\thrtimer_data_pointer(&pt->timer);"