inst.h 674 字节
Newer Older
1 2 3 4 5 6 7 8
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef _ASM_POWERPC_INST_H
#define _ASM_POWERPC_INST_H

/*
 * Instruction data type for POWER
 */

9 10 11
struct ppc_inst {
	u32 val;
} __packed;
12

13 14 15
#define ppc_inst(x) ((struct ppc_inst){ .val = x })

static inline u32 ppc_inst_val(struct ppc_inst x)
16
{
17
	return x.val;
18 19
}

20
static inline int ppc_inst_primary_opcode(struct ppc_inst x)
21 22 23 24
{
	return ppc_inst_val(x) >> 26;
}

25
static inline struct ppc_inst ppc_inst_swab(struct ppc_inst x)
26 27 28 29
{
	return ppc_inst(swab32(ppc_inst_val(x)));
}

30
static inline bool ppc_inst_equal(struct ppc_inst x, struct ppc_inst y)
31
{
32
	return ppc_inst_val(x) == ppc_inst_val(y);
33 34
}

35
#endif /* _ASM_POWERPC_INST_H */