2020-05-06 11:40:26 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#ifndef _ASM_POWERPC_INST_H
|
|
|
|
#define _ASM_POWERPC_INST_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Instruction data type for POWER
|
|
|
|
*/
|
|
|
|
|
2020-05-06 11:40:31 +08:00
|
|
|
struct ppc_inst {
|
|
|
|
u32 val;
|
|
|
|
} __packed;
|
2020-05-06 11:40:26 +08:00
|
|
|
|
2020-05-06 11:40:31 +08:00
|
|
|
#define ppc_inst(x) ((struct ppc_inst){ .val = x })
|
|
|
|
|
|
|
|
static inline u32 ppc_inst_val(struct ppc_inst x)
|
2020-05-06 11:40:27 +08:00
|
|
|
{
|
2020-05-06 11:40:31 +08:00
|
|
|
return x.val;
|
2020-05-06 11:40:27 +08:00
|
|
|
}
|
|
|
|
|
2020-05-06 11:40:31 +08:00
|
|
|
static inline int ppc_inst_primary_opcode(struct ppc_inst x)
|
2020-05-06 11:40:28 +08:00
|
|
|
{
|
|
|
|
return ppc_inst_val(x) >> 26;
|
|
|
|
}
|
|
|
|
|
2020-05-06 11:40:31 +08:00
|
|
|
static inline struct ppc_inst ppc_inst_swab(struct ppc_inst x)
|
2020-05-06 11:40:29 +08:00
|
|
|
{
|
|
|
|
return ppc_inst(swab32(ppc_inst_val(x)));
|
|
|
|
}
|
|
|
|
|
2020-05-06 11:40:31 +08:00
|
|
|
static inline bool ppc_inst_equal(struct ppc_inst x, struct ppc_inst y)
|
2020-05-06 11:40:30 +08:00
|
|
|
{
|
2020-05-06 11:40:31 +08:00
|
|
|
return ppc_inst_val(x) == ppc_inst_val(y);
|
2020-05-06 11:40:30 +08:00
|
|
|
}
|
|
|
|
|
2020-05-06 11:40:26 +08:00
|
|
|
#endif /* _ASM_POWERPC_INST_H */
|