]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
powerpc/32: move LOAD_MSR_KERNEL() into head_32.h and use it
authorChristophe Leroy <christophe.leroy@c-s.fr>
Tue, 30 Apr 2019 12:38:51 +0000 (12:38 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 2 May 2019 15:20:27 +0000 (01:20 +1000)
As preparation for using head_32.h for head_40x.S, move
LOAD_MSR_KERNEL() there and use it to load r10 with MSR_KERNEL value.

In the mean time, this patch modifies it so that it takes into account
the size of the passed value to determine if 'li' can be used or if
'lis/ori' is needed instead of using the size of MSR_KERNEL. This is
done by using gas macro.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/entry_32.S
arch/powerpc/kernel/head_32.h

index 2f3d159c11d79499077442aa8b62ac43e98710f1..d0cea3deb86c0beeb25cd4b0b9c22910ac501af4 100644 (file)
 #include <asm/barrier.h>
 #include <asm/kup.h>
 
-/*
- * MSR_KERNEL is > 0x10000 on 4xx/Book-E since it include MSR_CE.
- */
-#if MSR_KERNEL >= 0x10000
-#define LOAD_MSR_KERNEL(r, x)  lis r,(x)@h; ori r,r,(x)@l
-#else
-#define LOAD_MSR_KERNEL(r, x)  li r,(x)
-#endif
+#include "head_32.h"
 
 /*
  * Align to 4k in order to ensure that all functions modyfing srr0/srr1
index 7456e2a45acc1ff6f5c9011ac43c66c32be0c2de..cf3d0084459735a3404f1f7fdf21ee2cfeddfb24 100644 (file)
@@ -4,6 +4,19 @@
 
 #include <asm/ptrace.h>        /* for STACK_FRAME_REGS_MARKER */
 
+/*
+ * MSR_KERNEL is > 0x8000 on 4xx/Book-E since it include MSR_CE.
+ */
+.macro __LOAD_MSR_KERNEL r, x
+.if \x >= 0x8000
+       lis \r, (\x)@h
+       ori \r, \r, (\x)@l
+.else
+       li \r, (\x)
+.endif
+.endm
+#define LOAD_MSR_KERNEL(r, x) __LOAD_MSR_KERNEL r, x
+
 /*
  * Exception entry code.  This code runs with address translation
  * turned off, i.e. using physical addresses.
@@ -89,7 +102,7 @@ label:
 #define EXC_XFER_TEMPLATE(n, hdlr, trap, copyee, tfer, ret)    \
        li      r10,trap;                                       \
        stw     r10,_TRAP(r11);                                 \
-       li      r10,MSR_KERNEL;                                 \
+       LOAD_MSR_KERNEL(r10, MSR_KERNEL);                       \
        copyee(r10, r9);                                        \
        bl      tfer;                                           \
 i##n:                                                          \