diff options
author | David Faust <david.faust@oracle.com> | 2020-06-25 20:34:29 +0200 |
---|---|---|
committer | Jose E. Marchesi <jose.marchesi@oracle.com> | 2020-06-25 20:34:29 +0200 |
commit | d73be6116811aeaedd1863c2597ede78be3cf4e5 (patch) | |
tree | 457e068b990ce46a75501faf06627297f583c59c /cpu | |
parent | 6d74da72dacdbbe2b87a6b931e0f7edc3d3463e3 (diff) | |
download | fsf-binutils-gdb-d73be6116811aeaedd1863c2597ede78be3cf4e5.zip fsf-binutils-gdb-d73be6116811aeaedd1863c2597ede78be3cf4e5.tar.gz fsf-binutils-gdb-d73be6116811aeaedd1863c2597ede78be3cf4e5.tar.bz2 |
cpu: fix offset16 type, update c-calls in bpf.cpu
Correct the type of the offset16 field to HI, and simplify memory
accesses which use it. Also update c-calls in semantics for a
few instructions.
cpu/ChangeLog:
2020-06-25 David Faust <david.faust@oracle.com>
* bpf.cpu (f-offset16): Change type from INT to HI.
(dxli): Simplify memory access.
(dxsi): Likewise.
(define-endian-insn): Update c-call in semantics.
(dlabs) Likewise.
(dlind) Likewise.
Diffstat (limited to 'cpu')
-rw-r--r-- | cpu/ChangeLog | 9 | ||||
-rw-r--r-- | cpu/bpf.cpu | 20 |
2 files changed, 15 insertions, 14 deletions
diff --git a/cpu/ChangeLog b/cpu/ChangeLog index f2ac243..591ac01 100644 --- a/cpu/ChangeLog +++ b/cpu/ChangeLog @@ -1,3 +1,12 @@ +2020-06-25 David Faust <david.faust@oracle.com> + + * bpf.cpu (f-offset16): Change type from INT to HI. + (dxli): Simplify memory access. + (dxsi): Likewise. + (define-endian-insn): Update c-call in semantics. + (dlabs) Likewise. + (dlind) Likewise. + 2020-06-02 Jose E. Marchesi <jose.marchesi@oracle.com> * bpf.cpu (define-bpf-isa): Set base-insn-bitsize to 64. diff --git a/cpu/bpf.cpu b/cpu/bpf.cpu index dcfb0ca..95290f6 100644 --- a/cpu/bpf.cpu +++ b/cpu/bpf.cpu @@ -273,7 +273,7 @@ ;; difficulty: we put them in their own instruction word so the ;; byte-endianness will be properly applied. -(dwf f-offset16 "eBPF offset field" (all-isas) 16 16 15 16 INT) +(dwf f-offset16 "eBPF offset field" (all-isas) 16 16 15 16 HI) (dwf f-imm32 "eBPF 32-bit immediate field" (all-isas) 32 32 31 32 INT) ;; For the disjoint 64-bit signed immediate, however, we need to use a @@ -488,7 +488,7 @@ (+ (f-offset16 0) ((.sym f-src x-endian) 0) (.sym dst x-endian) endsize OP_CLASS_ALU x-op-src OP_CODE_END) (set (.sym dst x-endian) - (c-call DI "bpfbf_end" (.sym dst x-endian) endsize)) + (c-call DI (.str "bpfbf_end" x-suffix) (.sym dst x-endian) endsize)) ())) (define-endian-insn "le" OP_SRC_K le) @@ -538,11 +538,7 @@ (mem DI (add DI (reg DI h-gpr 6) ;; Pointer to struct sk_buff - (const DI 0))) ;; XXX offsetof - ;; (struct sk_buff, data) XXX but the offset - ;; depends on CONFIG_* options, so this should - ;; be configured in the simulator and driven by - ;; command-line options. Handle with a c-call. + (c-call "bpfbf_skb_data_offset"))) imm32))) ;; XXX this clobbers R1-R5 ())) @@ -572,11 +568,7 @@ (mem DI (add DI (reg DI h-gpr 6) ;; Pointer to struct sk_buff - (const DI 0))) ;; XXX offsetof - ;; (struct sk_buff, data) XXX but the offset - ;; depends on CONFIG_* options, so this should - ;; be configured in the simulator and driven by - ;; command-line options. Handle with a c-call. + (c-call "bpfbf_skb_data_offset"))) (add DI (.sym src x-endian) imm32)))) @@ -612,7 +604,7 @@ OP_CLASS_LDX (.sym OP_SIZE_ x-size) OP_MODE_MEM) (set x-mode (.sym dst x-endian) - (mem x-mode (add DI (.sym src x-endian) (ext DI (trunc HI offset16))))) + (mem x-mode (add DI (.sym src x-endian) offset16))) ())) (define-pmacro (dxsi x-basename x-suffix x-size x-endian x-mode) @@ -623,7 +615,7 @@ (+ (f-imm32 0) offset16 (.sym src x-endian) (.sym dst x-endian) OP_CLASS_STX (.sym OP_SIZE_ x-size) OP_MODE_MEM) (set x-mode - (mem x-mode (add DI (.sym dst x-endian) (ext DI (trunc HI offset16)))) + (mem x-mode (add DI (.sym dst x-endian) offset16)) (.sym src x-endian)) ;; XXX address is section-relative ())) |