rust-embedded / riscv

Low level access to RISC-V processors
818 stars 160 forks source link

Why are `asm::fence` and `asm::fence_i` unsafe? #179

Closed jsgf closed 6 months ago

jsgf commented 6 months ago

I don't think they can result in any ill-defined states or UB, can they? (Unlike, say, cache invalidation of writeback caches.)

cc @dreiss

romancardenas commented 6 months ago

I'm not sure about the reason. Assembly functions were all unsafe by default and we've been gradually opting out the unsafe token for some of them. Maybe this is the case for fence and fence_i. Feel free to open a PR :)