1 /* Copyright (C) 2008 Jeffrey Brian Arnold <jbarnold@mit.edu>
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License, version 2.
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
17 #ifdef KSPLICE_STANDALONE
20 #include <linux/ksplice.h>
23 MODULE_LICENSE("GPL v2");
28 #define STR(x) _STR(x)
30 #define _PASTE(x, y) x##y
31 #define PASTE(x, y) _PASTE(x, y)
32 #define KSPLICE_UNIQ(s) PASTE(s##_, KSPLICE_ID)
34 extern const struct ksplice_reloc ksplice_relocs
[], ksplice_relocs_end
[];
35 extern const struct ksplice_size ksplice_sizes
[], ksplice_sizes_end
[];
36 extern struct ksplice_patch ksplice_patches
[], ksplice_patches_end
[];
37 extern const char ksplice_source_diff
[], ksplice_source_diff_end
[];
38 #ifdef KSPLICE_NEED_PARAINSTRUCTIONS
39 extern struct paravirt_patch_site parainstructions
[], parainstructions_end
[];
42 LIST_HEAD(reloc_addrmaps
);
43 LIST_HEAD(reloc_namevals
);
44 LIST_HEAD(safety_records
);
47 module_param(debug
, int, 0600);
49 #define pack KSPLICE_UNIQ(pack)
50 struct module_pack pack
= {
51 .name
= "ksplice_" STR(KSPLICE_ID
),
53 .target_name
= STR(KSPLICE_TARGET
),
58 .map_printk
= MAP_PRINTK
,
59 .primary
= THIS_MODULE
,
60 .primary_relocs
= ksplice_relocs
,
61 .primary_relocs_end
= ksplice_relocs_end
,
62 .primary_sizes
= ksplice_sizes
,
63 .primary_sizes_end
= ksplice_sizes_end
,
64 .patches
= ksplice_patches
,
65 .patches_end
= ksplice_patches_end
,
66 .source_diff
= ksplice_source_diff
,
67 .source_diff_end
= ksplice_source_diff_end
,
68 #ifdef KSPLICE_NEED_PARAINSTRUCTIONS
69 .primary_parainstructions
= parainstructions
,
70 .primary_parainstructions_end
= parainstructions_end
,
72 .reloc_addrmaps
= &reloc_addrmaps
,
73 .reloc_namevals
= &reloc_namevals
,
74 .safety_records
= &safety_records
,
76 EXPORT_SYMBOL_GPL(pack
);
78 static int init_primary(void)
84 static void cleanup_primary(void)
86 cleanup_ksplice_module(&pack
);
89 #define helper_init_module KSPLICE_UNIQ(helper_init_module)
90 int helper_init_module(void)
92 return init_ksplice_module(&pack
);
94 EXPORT_SYMBOL_GPL(helper_init_module
);
96 module_init(init_primary
);
97 module_exit(cleanup_primary
);