-
Notifications
You must be signed in to change notification settings - Fork 562
New issue
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
bbbuf.c incorrect wrapping on ARM with uqadd16 #1982
Comments
Edit: replacing |
Yes, Q means saturation when it appears in an ARM mnemonic, and saturation means not wrapping. However, SADD16 and QADD16 set the GE bits (or they'd be nothing to distinguish them). That might be why UQADD16 was chosen. Does it definitely have to wrap? |
I'm not sure why |
BFI would be another possibility, I think, something like:
|
@derekbruening Whoops, I missed the fact that the GE flags were written. @egrimley Doing the bfi sounds like it could work, I'll give it a try As a bit of backstory/motivation I'm working on #513 which aims to replace the buffer-filling functionality in bbbuf.c and other clients, so potentially when I replace bbbuf.c's own buffer management with drx_buf we can close this issue. |
Also just curious but is there a reason not to just perform an add and then simply store the low 2 bytes of |
I wanted to analyze the buffer provided by bbbuf.c which is supposed to wrap when the low 2 bytes of the buffer pointer overflows, so I made this simple patch:
However, I'm seeing some weird behavior at the point where we should be wrapping on ARM (x86 is fine):
I'm wondering why this is happening, since
uqadd16
seems to just not be doing the right thing.0xfffc + 0x0004
should indeed wrap to0x0000
. If I tryqadd16
the problem is still there but we instead wrap at0x7ffff
, which makes sense considering the above. The docs foruqadd16
use the interesting term "saturates," so perhaps this is correct behavior ofuqadd16
?The text was updated successfully, but these errors were encountered: