1 /* Copyright (C) 2007-2008 Jeffrey Brian Arnold <jbarnold@mit.edu>
2 * Copyright (C) 2008 Anders Kaseorg <andersk@mit.edu>,
3 * Tim Abbott <tabbott@mit.edu>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
19 #ifdef KSPLICE_STANDALONE
22 #include <linux/ksplice.h>
25 extern const struct ksplice_reloc ksplice_relocs
[], ksplice_relocs_end
[];
26 extern const struct ksplice_section ksplice_sections
[], ksplice_sections_end
[];
27 #ifdef KSPLICE_NEED_PARAINSTRUCTIONS
28 extern struct paravirt_patch_site parainstructions
[], parainstructions_end
[];
30 #ifdef KSPLICE_STANDALONE
31 extern struct ksplice_system_map ksplice_system_map
[],
32 ksplice_system_map_end
[];
33 #endif /* KSPLICE_STANDALONE */
35 /* Defined in primary.c */
36 #define pack KSPLICE_UNIQ(pack)
37 extern struct ksplice_pack pack
;
39 #define PTR(p) ({ static const volatile typeof(&*p) p##_ptr = p; p##_ptr; })
41 static int init_helper(void)
43 pack
.helper_relocs
= PTR(ksplice_relocs
);
44 pack
.helper_relocs_end
= PTR(ksplice_relocs_end
);
45 pack
.helper_sections
= PTR(ksplice_sections
);
46 pack
.helper_sections_end
= PTR(ksplice_sections_end
);
47 #ifdef KSPLICE_NEED_PARAINSTRUCTIONS
48 pack
.helper_parainstructions
= PTR(parainstructions
);
49 pack
.helper_parainstructions_end
= PTR(parainstructions_end
);
51 #ifdef KSPLICE_STANDALONE
52 pack
.helper_system_map
= PTR(ksplice_system_map
);
53 pack
.helper_system_map_end
= PTR(ksplice_system_map_end
);
54 #endif /* KSPLICE_STANDALONE */
55 return init_ksplice_pack(&pack
);
58 static void cleanup_helper(void)
60 cleanup_ksplice_pack(&pack
);
63 module_init(init_helper
);
64 module_exit(cleanup_helper
);
66 MODULE_AUTHOR("Jeffrey Brian Arnold <jbarnold@mit.edu>");
67 MODULE_DESCRIPTION("Ksplice rebootless update helper module");
68 #ifdef KSPLICE_VERSION
69 MODULE_VERSION(KSPLICE_VERSION
);
71 MODULE_LICENSE("GPL v2");