Linux 5.0 on HiFive Unleashed [solved]

apparently I get a misaligned load trap … in the misaligned_load_trap handler :cry: (so it’s different from the one described here Linux does not boot after a massive code addition to the bbl)

0000000080003870 <misaligned_load_trap>:
    80003870:   000a07b7                lui     a5,0xa0
    80003874:   458d                    li      a1,3
    80003876:   3007a6f3                csrrs   a3,mstatus,a5
    8000387a:   00066703                lwu     a4,0(a2)
    8000387e:   30069073                csrw    mstatus,a3
    80003882:   00377813                andi    a6,a4,3
    80003886:   8eaa                    mv      t4,a0
    80003888:   1141                    addi    sp,sp,-16
    8000388a:   8536                    mv      a0,a3
    8000388c:   4f11                    li      t5,4
    8000388e:   00b80363                beq     a6,a1,80003894 <misaligned_load_trap+0x24>
    80003892:   4f09                    li      t5,2

Edit: okay, this issue was funny. Apparently the compiler is generating RISCV-C but not defining __riscv_compressed, resulting in the trap handler getting unexpected input (the other __riscv_* are defined though?!? edit: this has been reported, is a known issue in gcc mainline [1]). After defining that manually and recompiling riscv-pk it works and boots !

medusa:~# uname -r
5.1.0-rc1-00010-ge3827dbacb90

[1] https://patchwork.ozlabs.org/patch/1070200/