summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/module_64.c
diff options
context:
space:
mode:
authorAnders H Kaseorg <andersk@MIT.EDU>2008-06-28 18:25:41 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-30 12:12:43 +0200
commit5e5a29bf2624a5984e1c36c3a2481ee91249ec9c (patch)
tree0f7c6ef5355f726cfa178330cd77c64383f8d1c1 /arch/x86/kernel/module_64.c
parent543cf4cb3fe6f6cae3651ba918b9c56200b257d0 (diff)
x86, 64-bit: patch paravirt inline replacements when loading modules
small speedup. Paravirt replacements were added to the i386 module loader by commit 139ec7c416248b9ea227d21839235344edfee1e0. This adds the same code to the x86_64 module loader. Signed-off-by: Anders Kaseorg <andersk@mit.edu> Acked-by: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/module_64.c')
-rw-r--r--arch/x86/kernel/module_64.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/x86/kernel/module_64.c b/arch/x86/kernel/module_64.c
index a888e67f587..0e867676b5a 100644
--- a/arch/x86/kernel/module_64.c
+++ b/arch/x86/kernel/module_64.c
@@ -150,7 +150,8 @@ int module_finalize(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
struct module *me)
{
- const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL;
+ const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL,
+ *para = NULL;
char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
@@ -160,6 +161,8 @@ int module_finalize(const Elf_Ehdr *hdr,
alt = s;
if (!strcmp(".smp_locks", secstrings + s->sh_name))
locks= s;
+ if (!strcmp(".parainstructions", secstrings + s->sh_name))
+ para = s;
}
if (alt) {
@@ -175,6 +178,11 @@ int module_finalize(const Elf_Ehdr *hdr,
tseg, tseg + text->sh_size);
}
+ if (para) {
+ void *pseg = (void *)para->sh_addr;
+ apply_paravirt(pseg, pseg + para->sh_size);
+ }
+
return module_bug_finalize(hdr, sechdrs, me);
}