forked from Imagelibrary/binutils-gdb
bpf: simulator: correct div, mod insn semantics
The div and mod eBPF instructions are unsigned, but the semantic specification for the simulator incorrectly used signed operators. Correct them to unsigned versions, and correct the ALU tests in the simulator (which incorrectly assumed signed semantics). Tested in bpf-unknown-none. cpu/ChangeLog: 2020-09-08 David Faust <david.faust@oracle.com> * bpf.cpu (define-alu-instructions): Correct semantic operators for div, mod to unsigned versions. sim/ChangeLog: 2020-09-08 David Faust <david.faust@oracle.com> * bpf/sem-be.c: Regenerate. * bpf/sem-le.c: Likewise. sim/testsuite/ChangeLog: 2020-09-08 David Faust <david.faust@oracle.com> * sim/bpf/alu.s: Correct div and mod tests. * sim/bpf/alu32.s: Likewise.
This commit is contained in:
@@ -487,12 +487,12 @@
|
||||
(daib add OP_CODE_ADD x-endian add)
|
||||
(daib sub OP_CODE_SUB x-endian sub)
|
||||
(daib mul OP_CODE_MUL x-endian mul)
|
||||
(daib div OP_CODE_DIV x-endian div)
|
||||
(daib div OP_CODE_DIV x-endian udiv)
|
||||
(daib or OP_CODE_OR x-endian or)
|
||||
(daib and OP_CODE_AND x-endian and)
|
||||
(daib lsh OP_CODE_LSH x-endian sll)
|
||||
(daib rsh OP_CODE_RSH x-endian srl)
|
||||
(daib mod OP_CODE_MOD x-endian mod)
|
||||
(daib mod OP_CODE_MOD x-endian umod)
|
||||
(daib xor OP_CODE_XOR x-endian xor)
|
||||
(daib arsh OP_CODE_ARSH x-endian sra)
|
||||
(daiu neg OP_CODE_NEG x-endian neg)
|
||||
|
||||
Reference in New Issue
Block a user