GNU Binutils with patches for OS216
修訂 | d73be6116811aeaedd1863c2597ede78be3cf4e5 (tree) |
---|---|
時間 | 2020-06-26 03:34:29 |
作者 | David Faust <david.faust@orac...> |
Commiter | Jose E. Marchesi |
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.
@@ -1,3 +1,12 @@ | ||
1 | +2020-06-25 David Faust <david.faust@oracle.com> | |
2 | + | |
3 | + * bpf.cpu (f-offset16): Change type from INT to HI. | |
4 | + (dxli): Simplify memory access. | |
5 | + (dxsi): Likewise. | |
6 | + (define-endian-insn): Update c-call in semantics. | |
7 | + (dlabs) Likewise. | |
8 | + (dlind) Likewise. | |
9 | + | |
1 | 10 | 2020-06-02 Jose E. Marchesi <jose.marchesi@oracle.com> |
2 | 11 | |
3 | 12 | * bpf.cpu (define-bpf-isa): Set base-insn-bitsize to 64. |
@@ -273,7 +273,7 @@ | ||
273 | 273 | ;; difficulty: we put them in their own instruction word so the |
274 | 274 | ;; byte-endianness will be properly applied. |
275 | 275 | |
276 | -(dwf f-offset16 "eBPF offset field" (all-isas) 16 16 15 16 INT) | |
276 | +(dwf f-offset16 "eBPF offset field" (all-isas) 16 16 15 16 HI) | |
277 | 277 | (dwf f-imm32 "eBPF 32-bit immediate field" (all-isas) 32 32 31 32 INT) |
278 | 278 | |
279 | 279 | ;; For the disjoint 64-bit signed immediate, however, we need to use a |
@@ -488,7 +488,7 @@ | ||
488 | 488 | (+ (f-offset16 0) ((.sym f-src x-endian) 0) (.sym dst x-endian) endsize |
489 | 489 | OP_CLASS_ALU x-op-src OP_CODE_END) |
490 | 490 | (set (.sym dst x-endian) |
491 | - (c-call DI "bpfbf_end" (.sym dst x-endian) endsize)) | |
491 | + (c-call DI (.str "bpfbf_end" x-suffix) (.sym dst x-endian) endsize)) | |
492 | 492 | ())) |
493 | 493 | |
494 | 494 | (define-endian-insn "le" OP_SRC_K le) |
@@ -538,11 +538,7 @@ | ||
538 | 538 | (mem DI |
539 | 539 | (add DI |
540 | 540 | (reg DI h-gpr 6) ;; Pointer to struct sk_buff |
541 | - (const DI 0))) ;; XXX offsetof | |
542 | - ;; (struct sk_buff, data) XXX but the offset | |
543 | - ;; depends on CONFIG_* options, so this should | |
544 | - ;; be configured in the simulator and driven by | |
545 | - ;; command-line options. Handle with a c-call. | |
541 | + (c-call "bpfbf_skb_data_offset"))) | |
546 | 542 | imm32))) |
547 | 543 | ;; XXX this clobbers R1-R5 |
548 | 544 | ())) |
@@ -572,11 +568,7 @@ | ||
572 | 568 | (mem DI |
573 | 569 | (add DI |
574 | 570 | (reg DI h-gpr 6) ;; Pointer to struct sk_buff |
575 | - (const DI 0))) ;; XXX offsetof | |
576 | - ;; (struct sk_buff, data) XXX but the offset | |
577 | - ;; depends on CONFIG_* options, so this should | |
578 | - ;; be configured in the simulator and driven by | |
579 | - ;; command-line options. Handle with a c-call. | |
571 | + (c-call "bpfbf_skb_data_offset"))) | |
580 | 572 | (add DI |
581 | 573 | (.sym src x-endian) |
582 | 574 | imm32)))) |
@@ -612,7 +604,7 @@ | ||
612 | 604 | OP_CLASS_LDX (.sym OP_SIZE_ x-size) OP_MODE_MEM) |
613 | 605 | (set x-mode |
614 | 606 | (.sym dst x-endian) |
615 | - (mem x-mode (add DI (.sym src x-endian) (ext DI (trunc HI offset16))))) | |
607 | + (mem x-mode (add DI (.sym src x-endian) offset16))) | |
616 | 608 | ())) |
617 | 609 | |
618 | 610 | (define-pmacro (dxsi x-basename x-suffix x-size x-endian x-mode) |
@@ -623,7 +615,7 @@ | ||
623 | 615 | (+ (f-imm32 0) offset16 (.sym src x-endian) (.sym dst x-endian) |
624 | 616 | OP_CLASS_STX (.sym OP_SIZE_ x-size) OP_MODE_MEM) |
625 | 617 | (set x-mode |
626 | - (mem x-mode (add DI (.sym dst x-endian) (ext DI (trunc HI offset16)))) | |
618 | + (mem x-mode (add DI (.sym dst x-endian) offset16)) | |
627 | 619 | (.sym src x-endian)) ;; XXX address is section-relative |
628 | 620 | ())) |
629 | 621 |