Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

73 lines
2.0 KiB
ArmAsm

# mach: bpf
# sim: --skb-data-offset=0x20
# output: pass\nexit 0 (0x0)\n
/* ldabs.s
Tests for non-generic BPF load instructions in simulator.
These instructions (ld{abs,ind}{b,h,w,dw}) are used to access
kernel socket data from BPF programs for high performance filters.
Register r6 is an implicit input holding a pointer to a struct sk_buff.
Register r0 is an implicit output, holding the fetched data.
e.g.
ldabsw means:
r0 = ntohl (*(u32 *) (((struct sk_buff *)r6)->data + imm32))
ldindw means
r0 = ntohl (*(u32 *) (((struct sk_buff *)r6)->data + src_reg + imm32)) */
.include "testutils.inc"
.text
.global main
.type main, @function
main:
/* R6 holds a pointer to a struct sk_buff, which we pretend
exists at 0x1000 */
mov %r6, 0x1000
/* We configure skb-data-offset=0x20
This specifies offsetof(struct sk_buff, data), where the field 'data'
is a pointer a data buffer, in this case at 0x2000 */
stw [%r6+0x20], 0x2000
/* Write the value 0x7eadbeef into memory at 0x2004
i.e. offset 4 within the data buffer pointed to by
((struct sk_buff *)r6)->data */
stw [%r6+0x1004], 0x0eadbeef
/* Now load data[4] into r0 using the ldabsw instruction */
ldabsw 0x4
/* ...and compare to what we expect */
fail_ne32 %r0, 0x0eadbeef
/* Repeat for a half-word (2-bytes) */
sth [%r6+0x1008], 0x1234
ldabsh 0x8
fail_ne32 %r0, 0x1234
/* Repeat for a single byte */
stb [%r6+0x1010], 0x5a
ldabsb 0x10
fail_ne32 %r0, 0x5a
/* Now, we do the same for the indirect loads */
mov %r7, 0x100
stw [%r6+0x1100], 0x0eedbeef
ldindw %r7, 0x0
fail_ne32 %r0, 0x0eedbeef
/* half-word */
sth [%r6+0x1104], 0x6789
ldindh %r7, 0x4
fail_ne32 %r0, 0x6789
/* byte */
stb [%r6+0x1108], 0x5f
ldindb %r7, 0x8
fail_ne32 %r0, 0x5f
pass