We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assume:
mov r0, -10
Byte sequence:
b7 00 00 00 f6 f6 ff ff
What value should r0 contain? 0x00000000FFFFFFF6 or 0xFFFFFFFFFFFFFFF6
Should there be a sign extend operation when loading the 32bit immediate value into the 64bit unsigned register?
The text was updated successfully, but these errors were encountered:
According to the Linux interpreter, yes, it should be sign-extended. (And so do all the other ALU64 operations except shifts.)
ALU64
https://github.com/torvalds/linux/blob/ef4d3ea40565a781c25847e9cb96c1bd9f462bc6/kernel/bpf/core.c#L1734-L1736
ALU64_MOV_K: DST = IMM; // // or rather // regs[insn->dst_reg] = insn->imm; // // assigning imm (i32) to regs[...] (u64) does sign-bit extension in c
Sorry, something went wrong.
Thanks @yesh0, appreciate the feedback.
We now have a test to measure this behavior on both Linux and other BPF runtimes.
This issue was to add clarity to the doc as I felt it wasn't super clear.
Merge pull request #10 from ebpffoundation/bpf-next
ed4f426
Update to latest bpf-next
No branches or pull requests
Assume:
Byte sequence:
What value should r0 contain?
0x00000000FFFFFFF6 or 0xFFFFFFFFFFFFFFF6
Should there be a sign extend operation when loading the 32bit immediate value into the 64bit unsigned register?
The text was updated successfully, but these errors were encountered: