Skip to content

Conversation

@ArcaneNibble
Copy link
Collaborator

The bic opcode was supposed to be used here in order to clear the mode bits, rather than keep them.

This bug did not surface because we've mostly been hitting panics in System mode, which has a mode bits value of all 1s.

The bic opcode was supposed to be used here in order to *clear*
the mode bits, rather than keep them.

This bug did not surface because we've mostly been hitting panics
in System mode, which has a mode bits value of all 1s.
@coveralls
Copy link

Coverage Status

coverage: 56.965% (-0.01%) from 56.979%
when pulling de4c57e on ArcaneNibble:fix-panic-bic
into 18540a1 on pybricks:master.

mrs r0, spsr
stmfd sp!, {r0}
@ Switch to previous mode to read its sp/lr
@ NOTE: Assumes we never use User mode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you have to do special handling for User mode, since you can't switch into it and switch back out.

@dlech dlech merged commit dfec425 into pybricks:master Aug 6, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants