Compilers don't generate atomic instructions without explicitly being
told to do so.
E.g. by using built-ins like type __atomic_add_fetch (type *ptr, type
val, int memorder).
Further, you provide a pointer (i.e., a register containing an
address), so the compiler does
not even know the address at compile time and can therefore not
enforce restrictions.
And the same compiled code can run (and should) run on multiple systems,
so any address range with some properties on one system has different
properties on
another system.
It is very unusual to directly use atomic builtins or inline assembly
in application code
(for portability reasons). Instead they are typically hidden behind a
thin abstraction layer
(e.g. macros or static-inline functions). If this is also the case in
your code base, then you
could implement the range checks there.
BR
Christoph
>
> --
> You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
sw-dev+un...@groups.riscv.org.
> To view this discussion on the web visit
https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/db75421e-4de4-4807-8327-cb147c5924ccn%40groups.riscv.org.