rv8 icon indicating copy to clipboard operation
rv8 copied to clipboard

Add byte order macros to emu/riscv-{machine,pte}.h

Open michaeljclark opened this issue 7 years ago • 0 comments

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)

michaeljclark avatar Sep 23 '16 22:09 michaeljclark