1 BEGIN { split("INIT_WORK tsc_khz desc_struct ldttss_desc64 desc_ptr " \
2 "hrtimer_add_expires_ns hrtimer_get_expires " \
3 "hrtimer_get_expires_ns hrtimer_start_expires " \
4 "on_each_cpu relay_open request_irq" , compat_apis
); }
6 /^int kvm_init\
(/ { anon_inodes =
1 }
8 /return 0;/ && anon_inodes
{
9 print "\tr = kvm_init_anon_inodes();";
11 print "\t\t__free_page(bad_page);";
12 print "\t\tgoto out;";
14 print "\tpreempt_notifier_sys_init();";
15 printf("\tprintk(\"loaded kvm module (%s)\\n\");\n", version
);
19 /^void kvm_exit
/ { anon_inodes_exit =
1 }
21 /\
}/ && anon_inodes_exit
{
22 print "\tkvm_exit_anon_inodes();";
23 print "\tpreempt_notifier_sys_exit();";
28 printf("MODULE_INFO(version, \"%s\");\n", version
)
31 /^static void __vmx_load_host_state
/ {
32 vmx_load_host_state =
1
35 /vmcs_readl\
(HOST_GS_BASE\
)/ && vmx_load_host_state
{
36 $
0 =
"\t\twrmsrl(MSR_GS_BASE, gsbase);";
37 vmx_load_host_state =
0
40 /atomic_inc\
(&kvm
->mm
->mm_count\
);/ { $
0 =
"mmget(&kvm->mm->mm_count);" }
43 fcn = gensub
(/,/, "", "g", $
3)
44 $
0 =
"\t.VMA_OPS_FAULT(fault) = VMA_OPS_FAULT_FUNC(" fcn
"),"
47 /^static int
(.
*_stat_get
|lost_records_get
)/ {
51 /DEFINE_SIMPLE_ATTRIBUTE.
*(_stat_get
|lost_records_get
)/ {
52 name = gensub
(/,/, "", "g", $
2);
53 print "MAKE_SIMPLE_ATTRIBUTE_GETTER(" name
")"
56 { sub(/linux\
/mm_types\.h
/, "linux/mm.h") }
58 { sub(/\
<__user\
>/, " ") }
60 /^
\t\.name =
"kvm"/ { $
0 =
"\tset_kset_name(\"kvm\")," }
62 /#include <linux\/compiler.h>/ { $0 = "" }
63 /#include <linux\/clocksource.h>/ { $0 = "" }
64 /#include <linux\/types.h>/ { $0 = "" }
66 { sub(/\
<hrtimer_init\
>/, "hrtimer_init_p") }
67 { sub(/\
<hrtimer_start\
>/, "hrtimer_start_p") }
68 { sub(/\
<hrtimer_cancel\
>/, "hrtimer_cancel_p") }
70 /case KVM_CAP_SYNC_MMU
/ { $
0 =
"#ifdef CONFIG_MMU_NOTIFIER\n" $
0 "\n#endif" }
73 for (i in compat_apis
) {
74 ident = compat_apis
[i
]
75 sub("\\<" ident
"\\>", "kvm_" ident
)
79 /\kvm_.
*_fops\.owner = module
;/ { $
0 =
"IF_ANON_INODES_DOES_REFCOUNTS(" $
0 ")" }
83 /unsigned long flags
;/ && vmx_load_host_state
{
84 print "\tunsigned long gsbase;"
87 /local_irq_save
/ && vmx_load_host_state
{
88 print "\t\tgsbase = vmcs_readl(HOST_GS_BASE);"
92 print "\thrtimer_kallsyms_resolve();"
94 /apic
->timer.dev.
function =
/ {
95 print "\thrtimer_data_pointer(&apic->timer.dev);"
97 /pt
->timer.
function =
/ {
98 print "\thrtimer_data_pointer(&pt->timer);"