[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-riscv] [Qemu-devel] [PATCH v1 10/28] target/riscv: Convert mie
Re: [Qemu-riscv] [Qemu-devel] [PATCH v1 10/28] target/riscv: Convert mie and mstatus to pointers
Thu, 19 Sep 2019 07:50:12 -0700
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0
On 9/18/19 4:47 PM, Alistair Francis wrote:
> I'm not a fan of the pointer method that I'm using, but to me it seems
> the least worst in terms of handling future code, keeping everythign
> consistnent and avoiding complex access rules.
FWIW, I prefer the "banked" register method used by ARM.
M_REG_NS = 0, /* non-secure mode */
M_REG_S = 1, /* secure mode */
M_REG_NUM_BANKS = 2,
The major difference that I see is that a pointer can only represent a single
state at a single time. With an index, different parts of the code can ask
different questions that may have different states. E.g. "are we currently in
secure mode" vs "will the exception return to secure mode".