Re: Access unprivileged regions from OS


Andrew Waterman
 



On Fri, Oct 30, 2020 at 2:45 AM Andrea Mondelli via lists.riscv.org <andrea.mondelli=huawei.com@...> wrote:
Hi all,

quoting the arm manual, "sometimes the OS does need to access unprivileged regions, for example, to write to a buffer owned by an application. To support this, the instruction set provides the LDTR and STTR instructions."
According to the Volume II: RISC-V Privileged Architectures Chapter 7, In RISCV we don't have any similar privileged instruction to do it.

There is an alternative way to have the same behavior? I was thinking other examples like checking user parameters when syscall are called.

Yeah.  Set the sstatus.SUM bit, then use regular load and store instructions to access user memory, then clear sstatus.SUM.

Any hints?

thanks in advance

Join tech-privileged@lists.riscv.org to automatically receive all group messages.