From 8cc28269b9574103aae9088a02a20929ec75f983 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Sat, 10 Nov 2018 16:14:59 +0100 Subject: parisc: Split out alternative live patching code Move the alternative implemenation coding to alternative.c and add code to patch modules while loading. Signed-off-by: Helge Deller --- arch/parisc/kernel/module.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'arch/parisc/kernel/module.c') diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c index b5b3cb00f1fb..43778420614b 100644 --- a/arch/parisc/kernel/module.c +++ b/arch/parisc/kernel/module.c @@ -877,6 +877,8 @@ int module_finalize(const Elf_Ehdr *hdr, int i; unsigned long nsyms; const char *strtab = NULL; + const Elf_Shdr *s; + char *secstrings; Elf_Sym *newptr, *oldptr; Elf_Shdr *symhdr = NULL; #ifdef DEBUG @@ -948,6 +950,18 @@ int module_finalize(const Elf_Ehdr *hdr, nsyms = newptr - (Elf_Sym *)symhdr->sh_addr; DEBUGP("NEW num_symtab %lu\n", nsyms); symhdr->sh_size = nsyms * sizeof(Elf_Sym); + + /* find .altinstructions section */ + secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; + for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) { + void *aseg = (void *) s->sh_addr; + char *secname = secstrings + s->sh_name; + + if (!strcmp(".altinstructions", secname)) + /* patch .altinstructions */ + apply_alternatives(aseg, aseg + s->sh_size, me->name); + } + return 0; } -- cgit