1 BEGIN { split("INIT_WORK desc_struct ldttss_desc64 desc_ptr " \
2 "hrtimer_add_expires_ns hrtimer_get_expires " \
3 "hrtimer_get_expires_ns hrtimer_start_expires " \
4 "hrtimer_expires_remaining " \
5 "on_each_cpu relay_open request_irq" , compat_apis
); }
7 /^int kvm_init\
(/ { anon_inodes =
1 }
9 /return 0;/ && anon_inodes
{
10 print "\tr = kvm_init_anon_inodes();";
12 print "\t\t__free_page(bad_page);";
13 print "\t\tgoto out;";
15 print "\tpreempt_notifier_sys_init();";
16 printf("\tprintk(\"loaded kvm module (%s)\\n\");\n", version
);
20 /^void kvm_exit
/ { anon_inodes_exit =
1 }
22 /\
}/ && anon_inodes_exit
{
23 print "\tkvm_exit_anon_inodes();";
24 print "\tpreempt_notifier_sys_exit();";
28 /^int kvm_arch_init
/ { kvm_arch_init =
1 }
29 /\
<tsc_khz\
>/ && kvm_arch_init
{ sub("\\<tsc_khz\\>", "kvm_tsc_khz") }
30 /^
}/ { kvm_arch_init =
0 }
33 printf("MODULE_INFO(version, \"%s\");\n", version
)
36 { sub(/match->dev
->msi_enabled
/, "kvm_pcidev_msi_enabled(match->dev)") }
38 /^static void __vmx_load_host_state
/ {
39 vmx_load_host_state =
1
42 /vmcs_readl\
(HOST_GS_BASE\
)/ && vmx_load_host_state
{
43 $
0 =
"\t\twrmsrl(MSR_GS_BASE, gsbase);";
44 vmx_load_host_state =
0
47 /atomic_inc\
(&kvm
->mm
->mm_count\
);/ { $
0 =
"mmget(&kvm->mm->mm_count);" }
50 fcn = gensub
(/,/, "", "g", $
3)
51 $
0 =
"\t.VMA_OPS_FAULT(fault) = VMA_OPS_FAULT_FUNC(" fcn
"),"
54 /^static int
(.
*_stat_get
|lost_records_get
)/ {
58 /DEFINE_SIMPLE_ATTRIBUTE.
*(_stat_get
|lost_records_get
)/ {
59 name = gensub
(/,/, "", "g", $
2);
60 print "MAKE_SIMPLE_ATTRIBUTE_GETTER(" name
")"
63 { sub(/linux\
/mm_types\.h
/, "linux/mm.h") }
65 { sub(/\
<__user\
>/, " ") }
67 /^
\t\.name =
"kvm"/ { $
0 =
"\tset_kset_name(\"kvm\")," }
69 /#include <linux\/compiler.h>/ { $0 = "" }
70 /#include <linux\/clocksource.h>/ { $0 = "" }
71 /#include <linux\/types.h>/ { $0 = "#include <asm/types.h>" }
73 { sub(/\
<hrtimer_init\
>/, "hrtimer_init_p") }
74 { sub(/\
<hrtimer_start\
>/, "hrtimer_start_p") }
75 { sub(/\
<hrtimer_cancel\
>/, "hrtimer_cancel_p") }
77 /case KVM_CAP_SYNC_MMU
/ { $
0 =
"#ifdef CONFIG_MMU_NOTIFIER\n" $
0 "\n#endif" }
80 for (i in compat_apis
) {
81 ident = compat_apis
[i
]
82 sub("\\<" ident
"\\>", "kvm_" ident
)
86 /\kvm_.
*_fops\.owner = module
;/ { $
0 =
"IF_ANON_INODES_DOES_REFCOUNTS(" $
0 ")" }
90 /unsigned long flags
;/ && vmx_load_host_state
{
91 print "\tunsigned long gsbase;"
94 /local_irq_save
/ && vmx_load_host_state
{
95 print "\t\tgsbase = vmcs_readl(HOST_GS_BASE);"
99 print "\thrtimer_kallsyms_resolve();"
101 /apic
->timer.dev.
function =
/ {
102 print "\thrtimer_data_pointer(&apic->timer.dev);"
104 /pt
->timer.
function =
/ {
105 print "\thrtimer_data_pointer(&pt->timer);"