When do we get loads/stores with volatile semantics (if we get them at all)?

Travis Whitaker pi.boy.travis at gmail.com
Fri Sep 9 17:14:18 UTC 2022


Hello Haskell Friends,

Recently I noticed some strange behavior in a program that uses peek/poke
to manipulate memory mapped hardware registers, that smells a lot like
missing volatile semantics to me. It hadn’t occurred to me that peek/poke
might not have volatile semantics (they return an IO, and that IO has to
happen, right?), but naturally once they’re lowered all such bets are off.
This made me wonder:

- Do we have a type like #Addr whose loads/stores have volatile semantics?

- Do we have any primops with volatile semantics at all?

- Are there any tricks one could use to get volatile semantics out of
base’s peek/poke functions?

Poking around, I’m afraid the answer to all three of these is “no.” If so,
I’d be very interested in contributing volatile load/store primops and
working out some way to make them easily available from Foreign.Storable.
Does no such thing currently exist or am I missing something?

Thanks for all your ongoing efforts,

Travis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20220909/8d8c48f9/attachment.html>


More information about the ghc-devs mailing list