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 #ifdef KSPLICE_NEED_PARAINSTRUCTIONS
38 extern struct paravirt_patch_site parainstructions
[], parainstructions_end
[];
41 LIST_HEAD(reloc_addrmaps
);
42 LIST_HEAD(reloc_namevals
);
43 LIST_HEAD(safety_records
);
46 module_param(debug
, int, 0600);
48 #define pack KSPLICE_UNIQ(pack)
49 struct module_pack pack
= {
50 .name
= "ksplice_" STR(KSPLICE_ID
),
52 .target
= STR(KSPLICE_TARGET
),
56 .map_printk
= MAP_PRINTK
,
57 .primary
= THIS_MODULE
,
58 .primary_relocs
= ksplice_relocs
,
59 .primary_relocs_end
= ksplice_relocs_end
,
60 .primary_sizes
= ksplice_sizes
,
61 .primary_sizes_end
= ksplice_sizes_end
,
62 .patches
= ksplice_patches
,
63 .patches_end
= ksplice_patches_end
,
64 #ifdef KSPLICE_NEED_PARAINSTRUCTIONS
65 .primary_parainstructions
= parainstructions
,
66 .primary_parainstructions_end
= parainstructions_end
,
68 .reloc_addrmaps
= &reloc_addrmaps
,
69 .reloc_namevals
= &reloc_namevals
,
70 .safety_records
= &safety_records
,
72 EXPORT_SYMBOL_GPL(pack
);
74 static int init_primary(void)
80 static void cleanup_primary(void)
82 cleanup_ksplice_module(&pack
);
85 #define helper_init_module KSPLICE_UNIQ(helper_init_module)
86 int helper_init_module(void)
88 return init_ksplice_module(&pack
);
90 EXPORT_SYMBOL_GPL(helper_init_module
);
92 module_init(init_primary
);
93 module_exit(cleanup_primary
);