Open Alan-Jowett opened 1 year ago
According to the Linux interpreter, yes, it should be sign-extended. (And so do all the other ALU64
operations except shifts.)
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
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.
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?