* ron minnich <rminnich(a)gmail.com> [150717 21:45]:
riscv is taking alignment traps reading cbfs.
The issue is that 64-bit fields are 32-bit aligned, which fails many places.
Thaminda found this comment:
* Since coreboot is usually compiled 32bit, gcc will align 64bit
types to 32bit boundaries. If the coreboot table is dumped on a
64bit system, a uint64_t would be aligned to 64bit boundaries,
breaking the table format.
This statement is true for coreboot tables. CBFS files are aligned
to 64 bytes by default.
You can see if your compiler supports -mno-unaligned-access which will
get rid of the problem for you.
We can fix it, with an ugly macro, but ... what's
the right move here?
1. The cleanest solution would be to have our read32/write32 functions
exist in aligned and unaligned versions and using the latter for
accesses to packed data structures. Also the most intrusive, in the
2. Enable -mno-unaligned-access.
3. Enable some mechanism in the CPU that will take care of unaligned
accesses. That's what we do on ARM
4. Write an exception handler that takes care of the problem for you.