Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-5.15/parisc-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc architecture fixes from Helge Deller:
"Fix an unaligned-access crash in the bootloader and drop asm/swab.h"

* tag 'for-5.15/parisc-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
parisc: Fix unaligned-access crash in bootloader
parisc: Drop __arch_swab16(), arch_swab24(), _arch_swab32() and __arch_swab64() functions

+1 -69
+1 -1
arch/parisc/boot/compressed/misc.c
··· 26 26 extern char input_data[]; 27 27 extern int input_len; 28 28 /* output_len is inserted by the linker possibly at an unaligned address */ 29 - extern __le32 output_len __aligned(1); 29 + extern char output_len; 30 30 extern char _text, _end; 31 31 extern char _bss, _ebss; 32 32 extern char _startcode_end;
-68
arch/parisc/include/uapi/asm/swab.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - #ifndef _PARISC_SWAB_H 3 - #define _PARISC_SWAB_H 4 - 5 - #include <asm/bitsperlong.h> 6 - #include <linux/types.h> 7 - #include <linux/compiler.h> 8 - 9 - #define __SWAB_64_THRU_32__ 10 - 11 - static inline __attribute_const__ __u16 __arch_swab16(__u16 x) 12 - { 13 - __asm__("dep %0, 15, 8, %0\n\t" /* deposit 00ab -> 0bab */ 14 - "shd %%r0, %0, 8, %0" /* shift 000000ab -> 00ba */ 15 - : "=r" (x) 16 - : "0" (x)); 17 - return x; 18 - } 19 - #define __arch_swab16 __arch_swab16 20 - 21 - static inline __attribute_const__ __u32 __arch_swab24(__u32 x) 22 - { 23 - __asm__("shd %0, %0, 8, %0\n\t" /* shift xabcxabc -> cxab */ 24 - "dep %0, 15, 8, %0\n\t" /* deposit cxab -> cbab */ 25 - "shd %%r0, %0, 8, %0" /* shift 0000cbab -> 0cba */ 26 - : "=r" (x) 27 - : "0" (x)); 28 - return x; 29 - } 30 - 31 - static inline __attribute_const__ __u32 __arch_swab32(__u32 x) 32 - { 33 - unsigned int temp; 34 - __asm__("shd %0, %0, 16, %1\n\t" /* shift abcdabcd -> cdab */ 35 - "dep %1, 15, 8, %1\n\t" /* deposit cdab -> cbab */ 36 - "shd %0, %1, 8, %0" /* shift abcdcbab -> dcba */ 37 - : "=r" (x), "=&r" (temp) 38 - : "0" (x)); 39 - return x; 40 - } 41 - #define __arch_swab32 __arch_swab32 42 - 43 - #if __BITS_PER_LONG > 32 44 - /* 45 - ** From "PA-RISC 2.0 Architecture", HP Professional Books. 46 - ** See Appendix I page 8 , "Endian Byte Swapping". 47 - ** 48 - ** Pretty cool algorithm: (* == zero'd bits) 49 - ** PERMH 01234567 -> 67452301 into %0 50 - ** HSHL 67452301 -> 7*5*3*1* into %1 51 - ** HSHR 67452301 -> *6*4*2*0 into %0 52 - ** OR %0 | %1 -> 76543210 into %0 (all done!) 53 - */ 54 - static inline __attribute_const__ __u64 __arch_swab64(__u64 x) 55 - { 56 - __u64 temp; 57 - __asm__("permh,3210 %0, %0\n\t" 58 - "hshl %0, 8, %1\n\t" 59 - "hshr,u %0, 8, %0\n\t" 60 - "or %1, %0, %0" 61 - : "=r" (x), "=&r" (temp) 62 - : "0" (x)); 63 - return x; 64 - } 65 - #define __arch_swab64 __arch_swab64 66 - #endif /* __BITS_PER_LONG > 32 */ 67 - 68 - #endif /* _PARISC_SWAB_H */