← Home

cm.jt

Jump Via Table

Read an address from the Jump Vector Table and jump to it.

Assembly format

cm.jt index

Encoding

1514131211109876543210
101000000index10

Decode variables

VariableBitsWidth
index[6:2]5

Execution

# Ensure JVT readable
check_zcmt_enabled($encoding);

if (CSR[jvt].MODE != 0) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}

XReg jump_table_base = { CSR[jvt].BASE, 6'b000000 };
XReg virtual_address = jump_table_base + index `* (xlen() / 8);
XReg addr;
TranslationResult result;

# TODO: Correct this check when we figure out what MISA can do
if (CSR[misa].S == 1) {
  result = translate(virtual_address, MemoryOperation::Fetch, mode(), $encoding);
} else {
  result.paddr = virtual_address;
}

# may raise an exception
access_check(result.paddr, xlen(), $pc, MemoryOperation::Fetch, ExceptionCode::InstructionAccessFault, mode());

if (xlen() == 32) {
  addr = read_physical_memory(32, result.paddr);
} else {
  addr = read_physical_memory(64, result.paddr);
}

# Ensure low-order bit is clear
addr = addr & $signed(2'b10);

jump(addr);

Defined by

Zcmt

Access

SUVSVU
AlwaysAlwaysAlwaysAlways

Version af3eaf9+cheriot.f635218

Data from the RISC-V Unified Database, copyright RISC-V International and contributors.

CHERIoT extensions from the CHERIoT specification and Sail model, copyright Microsoft and the CHERIoT Platform contributors.

This site is provided as a community resource and is NOT affiliated with nor endorsed by RISC-V International.