Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.

Make ExceptionFrames fields private#239

Merged
bors[bot] merged 5 commits intorust-embedded:masterfrom
jonas-schievink:ef-priv
Jan 16, 2020
Merged

Make ExceptionFrames fields private#239
bors[bot] merged 5 commits intorust-embedded:masterfrom
jonas-schievink:ef-priv

Conversation

@jonas-schievink
Copy link
Contributor

@jonas-schievink jonas-schievink commented Jan 11, 2020

Closes #234

I can also add the unsafe setters, but they don't have any use right now. (added them in order to not regress available operations on ExceptionFrame)

@rust-highfive
Copy link

r? @korken89

(rust_highfive has picked a reviewer for you, use r? to override)

Otherwise this would be a regression in functionality
korken89
korken89 previously approved these changes Jan 14, 2020
Copy link
Contributor

@korken89 korken89 left a comment

Choose a reason for hiding this comment

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

LGTM, does anyone else want to chime in?

@Disasm
Copy link
Member

Disasm commented Jan 14, 2020

Is there any sense in modifying only some of the full set of registers? If you implement an RTOS, you may want to save/restore all of the registers.

@jonas-schievink
Copy link
Contributor Author

Is there any sense in modifying only some of the full set of registers? If you implement an RTOS, you may want to save/restore all of the registers.

Yes, I've had to set only pc in RTOS code, to jump into userspace once the interrupt returns. Also, for SVCall, you generally want to read the registers that pass arguments to the syscall, and then write back the result (which can end up in the same set of registers, or only r0). In my case these registers were r0-3.

Saving / Restoring all registers isn't a bad point though, since that's needed for context switching. Maybe we can provide wrappers around pointer casts / transmute / ptr::{read, write} that can be used to deal with entire ExceptionFrames at a time? I'm open to suggestions here.

(this reminds me that none of these functions are #[inline], I should definitely fix that before this is merged)

japaric
japaric previously approved these changes Jan 14, 2020
Copy link
Member

@japaric japaric left a comment

Choose a reason for hiding this comment

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

This looks good to me.

If we want to support the RTOS case of modifying stacked registers in this minor release we can add a ExceptionFrameMut struct with this API instead of modifying the existing ExceptionFrame. Whether we want to do that or not depends on how far the next minor version is and how much need there is for ExceptionFrameMut right now.

@thejpster
Copy link
Contributor

bors r+

bors bot added a commit that referenced this pull request Jan 14, 2020
239: Make `ExceptionFrame`s fields private r=thejpster a=jonas-schievink

Closes #234

~~I can also add the `unsafe` setters, but they don't have any use right now.~~ (added them in order to not regress available operations on `ExceptionFrame`)

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
@jonas-schievink
Copy link
Contributor Author

bors r-

inline attributes are still missing

@bors
Copy link
Contributor

bors bot commented Jan 14, 2020

Canceled

@jonas-schievink jonas-schievink dismissed stale reviews from japaric and korken89 via f6865c1 January 14, 2020 20:53
@korken89
Copy link
Contributor

bors r+

@jonas-schievink
Copy link
Contributor Author

bors r=korken89

bors bot added a commit that referenced this pull request Jan 16, 2020
239: Make `ExceptionFrame`s fields private r=korken89 a=jonas-schievink

Closes #234

~~I can also add the `unsafe` setters, but they don't have any use right now.~~ (added them in order to not regress available operations on `ExceptionFrame`)

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
@bors
Copy link
Contributor

bors bot commented Jan 16, 2020

Build succeeded

@bors bors bot merged commit f6865c1 into rust-embedded:master Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make fields of ExceptionFrame private

6 participants