Skip to content

Commit

Permalink
triggers: performance improvement on execute mcontrol/mcontrol6
Browse files Browse the repository at this point in the history
  • Loading branch information
YenHaoChen committed Sep 18, 2023
1 parent 0d8067b commit 661c6a2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions riscv/mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,10 @@ class mmu_t
if (matched_trigger)
throw *matched_trigger;

reg_t vpn = addr >> PGSHIFT;
auto access_info = generate_access_info(addr, FETCH, {false, false, false});
check_triggers(triggers::OPERATION_EXECUTE, addr, access_info.effective_virt);
if (unlikely(tlb_insn_tag[vpn % TLB_ENTRIES] != vpn))
check_triggers(triggers::OPERATION_EXECUTE, addr, access_info.effective_virt);
auto tlb_entry = translate_insn_addr(addr);
insn_bits_t insn = from_le(*(uint16_t*)(tlb_entry.host_offset + addr));
int length = insn_length(insn);
Expand All @@ -309,7 +311,8 @@ class mmu_t
insn |= (insn_bits_t)from_le(*(const uint16_t*)translate_insn_addr_to_host(addr + 4)) << 32;
insn |= (insn_bits_t)from_le(*(const uint16_t*)translate_insn_addr_to_host(addr + 6)) << 48;
}
check_triggers(triggers::OPERATION_EXECUTE, addr, access_info.effective_virt, insn);
if (unlikely(tlb_insn_tag[vpn % TLB_ENTRIES] != vpn))
check_triggers(triggers::OPERATION_EXECUTE, addr, access_info.effective_virt, insn);

insn_fetch_t fetch = {proc->decode_insn(insn), insn};
entry->tag = addr;
Expand Down

0 comments on commit 661c6a2

Please sign in to comment.