Skip to content
Snippets Groups Projects
  • David Faust's avatar
    4449c81a
    bpf: add xBPF ISA · 4449c81a
    David Faust authored
    This patch adds support for xBPF, another ISA targetting the BPF
    virtual architecture. For now, the primary difference between eBPF
    and xBPF is that xBPF supports indirect calls through the
    'call %reg' form of the call instruction.
    
    bfd/
    	* archures.c (bfd_mach_xbpf): Define.
    	* bfd-in2.h: Regenerate.
    	* cpu-bpf.c (bfd_xbpf_arch) New.
    	(bfd_bpf_arch) Update next in list field to point to xbpf arch.
    
    cpu/
    	* bpf.cpu (arch bpf): Add xbpf mach and isas.
    	(define-xbpf-isa) New pmacro.
    	(all-isas) Add xbpfle,xbpfbe.
    	(endian-isas): New pmacro.
    	(mach xbpf): New.
    	(model xbpf-def): Likewise.
    	(h-gpr): Add xbpf mach.
    	(f-dstle, f-srcle, dstle, srcle): Add xbpfle isa.
    	(f-dstbe, f-srcbe, dstbe, srcbe): Add xbpfbe isa.
    	(define-alu-insn-un): Use new endian-isas pmacro.
    	(define-alu-insn-bin, define-alu-insn-mov): Likewise.
    	(define-endian-insn, define-lddw): Likewise.
    	(dlind, dxli, dxsi, dsti): Likewise.
    	(define-cond-jump-insn, define-call-insn): Likewise.
    	(define-atomic-insns): Likewise.
    
    gas/
    	* config/tc-bpf.c: Add option -mxbpf to select xbpf isa.
    	* testsuite/gas/bpf/indcall-1.d: New file.
    	* testsuite/gas/bpf/indcall-1.s: Likewise.
    	* testsuite/gas/bpf/indcall-bad-1.l: Likewise.
    	* testsuite/gas/bpf/indcall-bad-1.s: Likewise.
    	* testsuite/gas/bpf/bpf.exp: Run new tests.
    
    opcodes/
    	* bpf-desc.c: Regenerate.
    	* bpf-desc.h: Likewise.
    	* bpf-opc.c: Likewise.
    	* bpf-opc.h: Likewise.
    	* disassemble.c (disassemble_init_for_target): Set bits for xBPF
    	ISA when appropriate.
    4449c81a
    History
    bpf: add xBPF ISA
    David Faust authored
    This patch adds support for xBPF, another ISA targetting the BPF
    virtual architecture. For now, the primary difference between eBPF
    and xBPF is that xBPF supports indirect calls through the
    'call %reg' form of the call instruction.
    
    bfd/
    	* archures.c (bfd_mach_xbpf): Define.
    	* bfd-in2.h: Regenerate.
    	* cpu-bpf.c (bfd_xbpf_arch) New.
    	(bfd_bpf_arch) Update next in list field to point to xbpf arch.
    
    cpu/
    	* bpf.cpu (arch bpf): Add xbpf mach and isas.
    	(define-xbpf-isa) New pmacro.
    	(all-isas) Add xbpfle,xbpfbe.
    	(endian-isas): New pmacro.
    	(mach xbpf): New.
    	(model xbpf-def): Likewise.
    	(h-gpr): Add xbpf mach.
    	(f-dstle, f-srcle, dstle, srcle): Add xbpfle isa.
    	(f-dstbe, f-srcbe, dstbe, srcbe): Add xbpfbe isa.
    	(define-alu-insn-un): Use new endian-isas pmacro.
    	(define-alu-insn-bin, define-alu-insn-mov): Likewise.
    	(define-endian-insn, define-lddw): Likewise.
    	(dlind, dxli, dxsi, dsti): Likewise.
    	(define-cond-jump-insn, define-call-insn): Likewise.
    	(define-atomic-insns): Likewise.
    
    gas/
    	* config/tc-bpf.c: Add option -mxbpf to select xbpf isa.
    	* testsuite/gas/bpf/indcall-1.d: New file.
    	* testsuite/gas/bpf/indcall-1.s: Likewise.
    	* testsuite/gas/bpf/indcall-bad-1.l: Likewise.
    	* testsuite/gas/bpf/indcall-bad-1.s: Likewise.
    	* testsuite/gas/bpf/bpf.exp: Run new tests.
    
    opcodes/
    	* bpf-desc.c: Regenerate.
    	* bpf-desc.h: Likewise.
    	* bpf-opc.c: Likewise.
    	* bpf-opc.h: Likewise.
    	* disassemble.c (disassemble_init_for_target): Set bits for xBPF
    	ISA when appropriate.
To find the state of this project's repository at the time of any of these versions, check out the tags.