diff options
author | Andrew Waterman <andrew@sifive.com> | 2024-04-30 19:05:07 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2024-04-30 19:08:38 -0700 |
commit | bfd4044f67e2a6787ae8ae7963876573c0ac40f5 (patch) | |
tree | ca3094824a18093176c15985fadb9ed3bdcb5e1c /machine/misaligned_ldst.c | |
parent | b190bef030ac8fbd6b90686eddada68c12e8fa45 (diff) | |
download | pk-bfd4044f67e2a6787ae8ae7963876573c0ac40f5.zip pk-bfd4044f67e2a6787ae8ae7963876573c0ac40f5.tar.gz pk-bfd4044f67e2a6787ae8ae7963876573c0ac40f5.tar.bz2 |
support emulation of misaligned vector loads/stores
Diffstat (limited to 'machine/misaligned_ldst.c')
-rw-r--r-- | machine/misaligned_ldst.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/machine/misaligned_ldst.c b/machine/misaligned_ldst.c index bc3e876..7769d92 100644 --- a/machine/misaligned_ldst.c +++ b/machine/misaligned_ldst.c @@ -44,6 +44,13 @@ void misaligned_load_trap(uintptr_t* regs, uintptr_t mcause, uintptr_t mepc) len = 2, shift = 8*(sizeof(uintptr_t) - len); else if ((insn & MASK_LHU) == MATCH_LHU) len = 2; +#ifdef __riscv_vector + else if ((insn & (MASK_VLE8_V & 0x707f)) == (MATCH_VLE8_V & 0x707f) + || (insn & (MASK_VLE16_V & 0x707f)) == (MATCH_VLE16_V & 0x707f) + || (insn & (MASK_VLE32_V & 0x707f)) == (MATCH_VLE32_V & 0x707f) + || (insn & (MASK_VLE64_V & 0x707f)) == (MATCH_VLE64_V & 0x707f)) + return misaligned_vec_ldst(regs, mcause, mepc, mstatus, insn); +#endif #ifdef __riscv_compressed # if __riscv_xlen >= 64 else if ((insn & MASK_C_LD) == MATCH_C_LD) @@ -119,6 +126,13 @@ void misaligned_store_trap(uintptr_t* regs, uintptr_t mcause, uintptr_t mepc) #endif else if ((insn & MASK_SH) == MATCH_SH) len = 2; +#ifdef __riscv_vector + else if ((insn & (MASK_VSE8_V & 0x707f)) == (MATCH_VSE8_V & 0x707f) + || (insn & (MASK_VSE16_V & 0x707f)) == (MATCH_VSE16_V & 0x707f) + || (insn & (MASK_VSE32_V & 0x707f)) == (MATCH_VSE32_V & 0x707f) + || (insn & (MASK_VSE64_V & 0x707f)) == (MATCH_VSE64_V & 0x707f)) + return misaligned_vec_ldst(regs, mcause, mepc, mstatus, insn); +#endif #ifdef __riscv_compressed # if __riscv_xlen >= 64 else if ((insn & MASK_C_SD) == MATCH_C_SD) |