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. enum { M_REG_NS = 0, /* non-secure mode */ M_REG_S = 1, /* secure mode */ M_REG_NUM_BANKS = 2, }; ... uint32_t vecbase[M_REG_NUM_BANKS]; uint32_t basepri[M_REG_NUM_BANKS]; uint32_t control[M_REG_NUM_BANKS]; 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". r~