Skip to content

Why do writes to memory-mapped registers return MemoryOpResult(bool)? #767

Answered by Alasdair
Furetur asked this question in Q&A
Discussion options

You must be logged in to vote

I think the bool was intended to represent success/failure of an exclusive or CAS operation, but in practice we haven't ended up using it.

The current sail memory write interface uses the type result(option(bool), 'abort) so:

  • Ok(None()) = successful regular memory access
  • Ok(Some(true)) = write exclusive success (in theory)
  • Err(<some external abort>) = external memory abort (with architecture specific type)

You timed this question quite nicely though, as we actually had a meeting just yesterday where we talked about simplifying to result(unit, 'abort)/option('abort) in the future.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Timmmm
Comment options

@Furetur
Comment options

Answer selected by Furetur
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants