linux/arch/powerpc/include/asm/inst.h
Jordan Niethe aabd2233b6 powerpc: Use a function for byte swapping instructions
Use a function for byte swapping instructions in preparation of a more
complicated instruction type.

Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Balamuruhan S <bala24@linux.ibm.com>
Link: https://lore.kernel.org/r/20200506034050.24806-10-jniethe5@gmail.com
2020-05-19 00:10:37 +10:00

27 lines
432 B
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef _ASM_POWERPC_INST_H
#define _ASM_POWERPC_INST_H
/*
* Instruction data type for POWER
*/
#define ppc_inst(x) (x)
static inline u32 ppc_inst_val(u32 x)
{
return x;
}
static inline int ppc_inst_primary_opcode(u32 x)
{
return ppc_inst_val(x) >> 26;
}
static inline u32 ppc_inst_swab(u32 x)
{
return ppc_inst(swab32(ppc_inst_val(x)));
}
#endif /* _ASM_POWERPC_INST_H */