kvm: qemu: consolidate signal handling variables into own struct
[kvm-userspace.git] / kernel / hack-module.awk
blob5187c966a6586974eeabac5a3c90466419453873
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 = "//" $0 }
38 /^\t\.fault = / {
39 fcn = gensub(/,/, "", "g", $3)
40 $0 = "\t.VMA_OPS_FAULT(fault) = VMA_OPS_FAULT_FUNC(" fcn "),"
43 { sub(/linux\/mm_types\.h/, "linux/mm.h") }
45 { print }
47 /kvm_x86_ops->run/ {
48 print "\tspecial_reload_dr7();"
51 /unsigned long flags;/ && vmx_load_host_state {
52 print "\tunsigned long gsbase;"
55 /local_irq_save/ && vmx_load_host_state {
56 print "\t\tgsbase = vmcs_readl(HOST_GS_BASE);"