-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
emit thumb: Add support for MRS instruction #1637
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
Conversation
I think "MRS" should be lower case to match all the other opcodes. And perhaps the special reg names as well... What is the reason you need access to these registers? |
Regarding case: The reason is some experimentation described here http://forum.micropython.org/viewtopic.php?f=3&t=1164 . Then there have been some discussions about using the PRIMASK register (in #1555), which require the MSR instruction. Since I have done part of that job already I wanted to share it. |
I agree that loading special registers is useful in the context of inline assembler (and already we have vmrs to load floating point special regs). But this patch here costs 300 bytes and likely only a few special regs are really needed. So I suggest just supporting IPSR and PRIMASK to begin with, and implementing it the same way as vmrs. mrs should be lower case, but the special reg names can stay upper case (that's how vmrs does it). |
Actually, I think we want BASEPRI, not PRIMASK. PRIMASK can be changed using cpsie/cpsid. From the docs about BASEPRI: "[if non zero] the processor does not process any exception with a priority value greater than or equal to BASEPRI". And maybe we should make the special regs lower case, since normal regs are also lower case, and then it's least surprise for the user (just tell them everything is lower case). |
cab00a8
to
da4df79
Compare
I do not fully agree with you about mrs in lower case, but I will not argue about it if you want it this way :-). I have removed support for all registers exept IPSR and BASEPRI, updated the tests and rebased to latest master. |
const char *reg_str = get_arg_str(pn); | ||
for (mp_uint_t i = 0; i < MP_ARRAY_SIZE(special_reg_name_table); i++) { | ||
const special_reg_name_t *r = &special_reg_name_table[i]; | ||
if (strncmp(r->name, reg_str, MAX_SPECIAL_REG_NAME_LENGTH) == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will catch extra stuff, eg, reg_str = "BASEPRIXXX" will be matched.
94a3cdd
to
8fcb357
Compare
8fcb357
to
8d4533b
Compare
I have now fixed the issues. |
Merged in e242b17, thank you! |
Update board info build to handle top level list.
This change makes it possible to use the MRS instruction in asm_thumb code.