You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first read byte may contain a prefix of undesired bits, the last one a suffix:
src[0]
0
1
2
3
4
5
6
7
src[1]
...
u6
?
x
x
x
x
x
x
?
?
...
u11
?
?
x
x
x
x
x
x
x
...
To get rid of them, CO-RE first does a left shift by LSHIFT_U64 bits. On little
endian this removes the suffix in the last read byte, on big endian the prefix
in the first one. On both endians this moves the most significant bit of the
field to the most signficiand bit in dst.
Now all that is left is performing sign extension by right shifting by RSHIFT_U64
bits. Since our value is MSB-aligned this is simply 64 - field_bits.
The text was updated successfully, but these errors were encountered:
Here is my current understanding how CO-RE relocations for bitfields work.
BYTE_SIZE and BYTE_OFFSET are synthesised by libbpf according to the following
logic:
For some combination of inputs this results in large reads:
This is problematic for packed structs. With size and offset, a read into 64 bit dst is done:
The first read byte may contain a prefix of undesired bits, the last one a suffix:
To get rid of them, CO-RE first does a left shift by LSHIFT_U64 bits. On little
endian this removes the suffix in the last read byte, on big endian the prefix
in the first one. On both endians this moves the most significant bit of the
field to the most signficiand bit in dst.
Now all that is left is performing sign extension by right shifting by RSHIFT_U64
bits. Since our value is MSB-aligned this is simply
64 - field_bits
.The text was updated successfully, but these errors were encountered: