Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/cache-4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan-Jowett authored Jan 22, 2024
2 parents ae1f5c1 + e473aec commit 1db91a3
Show file tree
Hide file tree
Showing 27 changed files with 66 additions and 42 deletions.
7 changes: 1 addition & 6 deletions src/opcode_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ inline bool
needs_offset(uint8_t opcode)
{
return opcode == 0x34 || opcode == 0x37 || opcode == 0x3c || opcode == 0x3f || opcode == 0x94 || opcode == 0x97 ||
opcode == 0x9c || opcode == 0x9f || opcode == 0xb4 || opcode == 0xb7 || opcode == 0xbc || opcode == 0xbf;
opcode == 0x9c || opcode == 0x9f || opcode == 0xbc || opcode == 0xbf;
}

class bpf_conformance_instruction_t
Expand Down Expand Up @@ -309,14 +309,9 @@ static const std::set<bpf_conformance_instruction_t, InstCmp> instructions_from_
{bpf_conformance_test_cpu_version_t::v3, 0xae},
{bpf_conformance_test_cpu_version_t::v1, 0xaf},
{bpf_conformance_test_cpu_version_t::v1, 0xb4, 0x00, 0x00, 0x00},
{bpf_conformance_test_cpu_version_t::v4, 0xb4, 0x00, 0x00, 0x08},
{bpf_conformance_test_cpu_version_t::v4, 0xb4, 0x00, 0x00, 0x10},
{bpf_conformance_test_cpu_version_t::v2, 0xb5},
{bpf_conformance_test_cpu_version_t::v3, 0xb6},
{bpf_conformance_test_cpu_version_t::v1, 0xb7, 0x00, 0x00, 0x00},
{bpf_conformance_test_cpu_version_t::v4, 0xb7, 0x00, 0x00, 0x08},
{bpf_conformance_test_cpu_version_t::v4, 0xb7, 0x00, 0x00, 0x10},
{bpf_conformance_test_cpu_version_t::v4, 0xb7, 0x00, 0x00, 0x20},
{bpf_conformance_test_cpu_version_t::v1, 0xbc, 0x00, 0x00, 0x00},
{bpf_conformance_test_cpu_version_t::v4, 0xbc, 0x00, 0x00, 0x08},
{bpf_conformance_test_cpu_version_t::v4, 0xbc, 0x00, 0x00, 0x10},
Expand Down
2 changes: 2 additions & 0 deletions tests/add.data
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ mov32 %r0, 0
mov32 %r1, 2
add32 %r0, 1
add32 %r0, %r1
add32 %r0, %r0
add32 %r0, -3
exit
-- result
0x3
10 changes: 7 additions & 3 deletions tests/add64.data
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Copyright (c) Big Switch Networks, Inc
# SPDX-License-Identifier: Apache-2.0
-- asm
mov %r0, 1
add %r0, -1
mov %r0, 0
mov %r1, 2
add %r0, 1
add %r0, %r1
add %r0, %r0
add %r0, -3
exit
-- result
0
0x3
3 changes: 2 additions & 1 deletion tests/alu-arith.data
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright (c) Big Switch Networks, Inc
# SPDX-License-Identifier: Apache-2.0
-- asm
mov32 %r0, 0
mov32 %r0, 10
sub32 %r0, %r0
mov32 %r1, 1
mov32 %r2, 2
mov32 %r3, 3
Expand Down
2 changes: 2 additions & 0 deletions tests/alu-bit.data
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ jne %r0, 0, exit

or32 %r0, %r5
or32 %r0, 0xa0
or32 %r0, %r0
# %r0 == 0xa5
jne %r0, 0xa5, exit

and32 %r0, 0xa3
mov32 %r9, 0x91
and32 %r0, %r9
and32 %r0, %r0
# %r0 == 0x81
jne %r0, 0x81, exit

Expand Down
3 changes: 2 additions & 1 deletion tests/alu64-arith.data
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright (c) Big Switch Networks, Inc
# SPDX-License-Identifier: Apache-2.0
-- asm
mov %r0, 0
mov %r0, 10
sub %r0, %r0
mov %r1, 1
mov %r2, 2
mov %r3, 3
Expand Down
2 changes: 2 additions & 0 deletions tests/alu64-bit.data
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ jne %r0, 0, exit

or %r0, %r5
or %r0, 0xa0
or %r0, %r0
# %r0 == 0xa5
jne %r0, 0xa5, exit

and %r0, 0xa3
mov %r9, 0x91
and %r0, %r9
and %r0, %r0
# %r0 == 0x81
jne %r0, 0x81, exit

Expand Down
2 changes: 2 additions & 0 deletions tests/jeq-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ mov32 %r0, 0
mov32 %r1, 0xa
mov32 %r2, 0xb
jeq %r1, %r2, exit # Not taken
jeq %r1, %r1, +1 # Taken
exit

mov32 %r0, 1
mov32 %r1, 0xb
Expand Down
2 changes: 2 additions & 0 deletions tests/jeq32-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ mov32 %r0, 0
mov32 %r1, 0xa
mov32 %r2, 0xb
jeq32 %r1, %r2, exit # Not taken
jeq32 %r1, %r1, +1 # Taken
exit

mov32 %r0, 1
mov32 %r1, 0xb
Expand Down
18 changes: 18 additions & 0 deletions tests/jge-reg.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) Big Switch Networks, Inc
# SPDX-License-Identifier: Apache-2.0
-- asm
mov32 %r0, 0
mov32 %r1, 0xa
mov32 %r2, 0x0b
jge %r1, %r2, exit # Not taken
jge %r1, %r1, +1 # Taken
exit

mov32 %r0, 1
mov32 %r1, 0xc
jge %r1, %r2, exit # Taken

mov32 %r0, 2 # Skipped
exit
-- result
0x1
2 changes: 2 additions & 0 deletions tests/jge32-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ mov32 %r0, 0
mov32 %r1, 0xa
mov32 %r2, 0xb
jge32 %r1, %r2, exit # Not taken
jge32 %r1, %r1, +1 # Taken
exit

mov32 %r0, 1
# set %r1 to 0x10000000c
Expand Down
1 change: 1 addition & 0 deletions tests/jne-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mov32 %r0, 0
mov32 %r1, 0xb
mov32 %r2, 0xb
jne %r1, %r2, exit # Not taken
jne %r1, %r1, exit # Not taken

mov32 %r0, 1
mov32 %r1, 0xa
Expand Down
3 changes: 2 additions & 1 deletion tests/jne32-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ mov32 %r1, 0xb
# set %r1 to 0x10000000b
or %r1, %r9
mov32 %r2, 0xb
jne32 %r1, %r2, +4 # Not taken
jne32 %r1, %r2, +5 # Not taken
jne32 %r1, %r1, +4 # Not taken

mov32 %r0, 1
mov32 %r1, 0xa
Expand Down
2 changes: 2 additions & 0 deletions tests/jset-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ mov32 %r0, 0
mov32 %r1, 0x7
mov32 %r2, 0x8
jset %r1, %r2, exit # Not taken
jset %r1, %r1, +1 # Taken
exit

mov32 %r0, 1
mov32 %r1, 0x9
Expand Down
2 changes: 2 additions & 0 deletions tests/jset32-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ mov32 %r1, 0x7
or %r1, %r9
mov32 %r2, 0x8
jset32 %r1, %r2, exit # Not taken
jset32 %r1, %r1, +1 # Taken
exit

mov32 %r0, 1
mov32 %r1, 0x9
Expand Down
2 changes: 2 additions & 0 deletions tests/jsge-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ mov %r2, 0xffffffff
mov32 %r3, 0
jsge %r1, %r2, exit # Not taken
jsge %r1, %r3, exit # Not taken
jsge %r1, %r1, +1 # Taken
exit

mov32 %r0, 1
mov %r1, %r2
Expand Down
2 changes: 2 additions & 0 deletions tests/jsge32-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ mov %r2, 0xffffffff
mov32 %r3, 0
jsge32 %r1, %r2, exit # Not taken
jsge32 %r1, %r3, exit # Not taken
jsge32 %r1, %r1, +1 # Taken
exit

mov32 %r0, 1
mov %r1, %r2
Expand Down
1 change: 1 addition & 0 deletions tests/jsgt-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mov32 %r0, 0
mov %r1, 0xfffffffe
mov %r2, 0xffffffff
jsgt %r1, %r2, exit # Not taken
jsgt %r1, %r1, exit # Not taken

mov32 %r0, 1
mov32 %r1, 0
Expand Down
1 change: 1 addition & 0 deletions tests/jsgt32-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mov32 %r1, 0xfffffffe
or %r1, %r9
mov %r2, 0xffffffff
jsgt32 %r1, %r2, exit # Not taken
jsgt32 %r1, %r1, exit # Not taken

mov32 %r0, 1
mov32 %r1, 0
Expand Down
3 changes: 3 additions & 0 deletions tests/jsle-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ mov32 %r3, 0
jsle %r1, %r2, exit # Not taken
jsle %r1, %r3, +1 # Taken
exit
jsle %r1, %r1, +1 # Taken
exit

mov32 %r0, 1
mov %r1, %r2
jsle %r1, %r2, +1 # Taken
Expand Down
3 changes: 3 additions & 0 deletions tests/jsle32-reg.data
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ mov32 %r3, 0
jsle32 %r1, %r2, exit # Not taken
jsle32 %r1, %r3, +1 # Taken
exit
jsle32 %r1, %r1, +1 # Taken
exit

mov32 %r0, 1
mov %r1, %r2
jsle32 %r1, %r2, +1 # Taken
Expand Down
1 change: 1 addition & 0 deletions tests/mov.data
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
-- asm
mov32 %r1, 1
mov32 %r0, %r1
mov32 %r0, %r0
exit
-- result
0x1
6 changes: 4 additions & 2 deletions tests/movsx1632-imm.data → tests/mov64.data
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Copyright (c) Big Switch Networks, Inc
# SPDX-License-Identifier: Apache-2.0
-- asm
movsx1632 %r0, 0x89abcdef
mov %r1, 1
mov %r0, %r1
mov %r0, %r0
exit
-- result
0xffffcdef
0x1
7 changes: 0 additions & 7 deletions tests/movsx1664-imm.data

This file was deleted.

7 changes: 0 additions & 7 deletions tests/movsx3264-imm.data

This file was deleted.

7 changes: 0 additions & 7 deletions tests/movsx832-imm.data

This file was deleted.

7 changes: 0 additions & 7 deletions tests/movsx864-imm.data

This file was deleted.

0 comments on commit 1db91a3

Please sign in to comment.