[RFC PATCH v2 4/7] powerpc/ppc-opcode: consolidate powerpc instructions from bpf_jit.h
Naveen N. Rao
naveen.n.rao at linux.vnet.ibm.com
Wed Apr 29 02:19:22 AEST 2020
Balamuruhan S wrote:
> move macro definitions of powerpc instructions from bpf_jit.h to ppc-opcode.h
> and adopt the users of the macros accordingly. `PPC_MR()` is defined twice in
> bpf_jit.h, remove the duplicate one.
>
> Signed-off-by: Balamuruhan S <bala24 at linux.ibm.com>
> ---
> arch/powerpc/include/asm/ppc-opcode.h | 139 +++++++++++++
> arch/powerpc/net/bpf_jit.h | 166 ++-------------
> arch/powerpc/net/bpf_jit32.h | 24 +--
> arch/powerpc/net/bpf_jit64.h | 12 +-
> arch/powerpc/net/bpf_jit_comp.c | 132 ++++++------
> arch/powerpc/net/bpf_jit_comp64.c | 278 +++++++++++++-------------
> 6 files changed, 378 insertions(+), 373 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
> index 2ae0afc5c2bb..6b9a891884be 100644
> --- a/arch/powerpc/include/asm/ppc-opcode.h
> +++ b/arch/powerpc/include/asm/ppc-opcode.h
> @@ -79,6 +79,16 @@
> #define IMM_L(i) ((uintptr_t)(i) & 0xffff)
> #define IMM_DS(i) ((uintptr_t)(i) & 0xfffc)
>
> +/*
> + * 16-bit immediate helper macros: HA() is for use with sign-extending instrs
> + * (e.g. LD, ADDI). If the bottom 16 bits is "-ve", add another bit into the
> + * top half to negate the effect (i.e. 0xffff + 1 = 0x(1)0000).
> + */
> +#define IMM_H(i) ((uintptr_t)(i)>>16)
> +#define IMM_HA(i) (((uintptr_t)(i)>>16) + \
> + (((uintptr_t)(i) & 0x8000) >> 15))
> +
Not needed for this patch series, but at some point, we should move over
to using the PPC_LO(), PPC_HI() and PPC_HA() macros that are defined
later in this file.
- Naveen
More information about the Linuxppc-dev
mailing list