summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/nohash/book3e_pgtable.c
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2021-12-02 13:00:24 +0100
committerMichael Ellerman <mpe@ellerman.id.au>2021-12-23 12:36:55 +0100
commit29562a9da29478834e57f81e3804e9ec7a6b350b (patch)
treee108845537f282cf5ab959932b8138025e93e181 /arch/powerpc/mm/nohash/book3e_pgtable.c
parentpowerpc/code-patching: Use test_trampoline for prefixed patch test (diff)
downloadlinux-29562a9da29478834e57f81e3804e9ec7a6b350b.tar.xz
linux-29562a9da29478834e57f81e3804e9ec7a6b350b.zip
powerpc/code-patching: Move patch_exception() outside code-patching.c
patch_exception() is dedicated to book3e/64 is nothing more than a normal use of patch_branch(), so move it into a place dedicated to book3e/64. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/0968622b98b1fb51838c35b844c42ad6609de62e.1638446239.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc/mm/nohash/book3e_pgtable.c')
-rw-r--r--arch/powerpc/mm/nohash/book3e_pgtable.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/powerpc/mm/nohash/book3e_pgtable.c b/arch/powerpc/mm/nohash/book3e_pgtable.c
index 77884e24281d..7d4368d055a6 100644
--- a/arch/powerpc/mm/nohash/book3e_pgtable.c
+++ b/arch/powerpc/mm/nohash/book3e_pgtable.c
@@ -10,6 +10,7 @@
#include <asm/pgalloc.h>
#include <asm/tlb.h>
#include <asm/dma.h>
+#include <asm/code-patching.h>
#include <mm/mmu_decl.h>
@@ -115,3 +116,17 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot)
smp_wmb();
return 0;
}
+
+void __patch_exception(int exc, unsigned long addr)
+{
+ unsigned int *ibase = &interrupt_base_book3e;
+
+ /*
+ * Our exceptions vectors start with a NOP and -then- a branch
+ * to deal with single stepping from userspace which stops on
+ * the second instruction. Thus we need to patch the second
+ * instruction of the exception, not the first one.
+ */
+
+ patch_branch(ibase + (exc / 4) + 1, addr, 0);
+}