rv8
rv8 copied to clipboard
Add byte order macros to emu/riscv-{machine,pte}.h
The current bitfield structs in emu/riscv-machine.h
and emu/riscv-pte.h
require endian macros in a similar fashion to the register structs in emu/riscv-processor.h
due to structure bitfield order differences for different emulator host endianness.
#if _BYTE_ORDER == _LITTLE_ENDIAN
/* */
#else
/* */
#endif
The alternative is to define enums with bit positions and masks for the various CSRs with sub fields.
The original intent behind using the structure bitfields is that it lends itself to nicer pseudo-code e.g. mstatus.MPRV
vs (mstatus & MPRV_MASK)