]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/processor: Add __forward_psw() helper
authorHeiko Carstens <hca@linux.ibm.com>
Tue, 4 Nov 2025 10:48:55 +0000 (11:48 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Fri, 14 Nov 2025 10:34:28 +0000 (11:34 +0100)
Similar to __rewind_psw() add the counter part __forward_psw(). This
helps to make code more readable if a PSW address has to be forwarded,
since it is more natural to write

addr = __forward_psw(psw, ilen);

instead of

addr = __rewind_psw(psw, -ilen);

This renames also the ilc parameter of __rewind_psw() to ilen, since
the parameter reflects an instruction length, and not an instruction
length code. Also change the type of ilen from unsigned long to long
so it reflects that lengths can be negative or positive.

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/processor.h

index 93e1034485d78a6c0861b255eb91d76146392663..ead1ebc9c61e3b14b8d7e0774803bd39ac0c3c26 100644 (file)
@@ -379,14 +379,19 @@ static inline void local_mcck_enable(void)
 /*
  * Rewind PSW instruction address by specified number of bytes.
  */
-static inline unsigned long __rewind_psw(psw_t psw, unsigned long ilc)
+static inline unsigned long __rewind_psw(psw_t psw, long ilen)
 {
        unsigned long mask;
 
        mask = (psw.mask & PSW_MASK_EA) ? -1UL :
               (psw.mask & PSW_MASK_BA) ? (1UL << 31) - 1 :
                                          (1UL << 24) - 1;
-       return (psw.addr - ilc) & mask;
+       return (psw.addr - ilen) & mask;
+}
+
+static inline unsigned long __forward_psw(psw_t psw, long ilen)
+{
+       return __rewind_psw(psw, -ilen);
 }
 
 /*