arm64 arch misc

 

判断指令类型aarch64_insn_is_##abbr(u32 code)

@code为32bit的asm指令

kernel\5.15\arch\arm64\include\asm\insn.h

#define    __AARCH64_INSN_FUNCS(abbr, mask, val)                \
static __always_inline bool aarch64_insn_is_##abbr(u32 code)        \
{                                    \
    BUILD_BUG_ON(~(mask) & (val));                    \
    return (code & (mask)) == (val);                \
}                                    \
static __always_inline u32 aarch64_insn_get_##abbr##_value(void)    \
{                                    \
    return (val);                            \
}

 

__AARCH64_INSN_FUNCS(adr,    0x9F000000, 0x10000000)
__AARCH64_INSN_FUNCS(adrp,    0x9F000000, 0x90000000)
__AARCH64_INSN_FUNCS(prfm,    0x3FC00000, 0x39800000)
__AARCH64_INSN_FUNCS(b,        0xFC000000, 0x14000000)
__AARCH64_INSN_FUNCS(bl,    0xFC000000, 0x94000000)
__AARCH64_INSN_FUNCS(cbz,    0x7F000000, 0x34000000)

 

posted @ 2023-07-02 21:13  aspirs  阅读(42)  评论(0编辑  收藏  举报