Is this link register masking needed?
alban read (2898) 20 posts |
I see some instructions like this :- bic link, link, # &fc000003 and this bic R0, link, # &fc000003 Is this mask likely to be related to 26 bit mode and no longer necessary now ? |
Rick Murray (539) 13840 posts |
That’s clearing the flag bits (the fc) and the mode bits (the 3) to extract the value of PC from the link register with combined PC and PSR. So, yes, it’s a 26 bit thing. |
Martin Avison (27) 1494 posts |
May still be required if the code is to run in 26bit as well as 32bit modes?! |
alban read (2898) 20 posts |
Thanks much appreciated. |
David J. Ruck (33) 1635 posts |
@Martin far better to get rid of that entirely and make it 26/32 neutral rather than preserving any 26 bit only constructs. |
Martin Avison (27) 1494 posts |
Indeed – that is why I said ‘may’. Obviously better to avoid it. |
Rick Murray (539) 13840 posts |
I think it depends what the context is, why extracting PC is happening here. Maybe something like: TEQ R0, R0 TEQ PC, PC MOVEQ R0, LR ; 32 bit BICNE R0, LR, #&FC000003 ; 26 bit (I’m in bed and half asleep, so I hope I have the EQ and NE the right way around) |
alban read (2898) 20 posts |
There are some insightful points in the discussion I find very helpful. I will try/test some options. For the curious: just attempting a spot of rennovation to a FORTH. This has its own built in assembler PASM. Used a lot in FORTH kernel and everywhere else.. |