hinval.gvma

Invalidate cached address translations

This instruction is defined by:

Encoding

svg

Synopsis

hinval.gvma has the same semantics as sinval.vma except that it combines with sfence.w.inval and sfence.inval.ir to replace hfence.gvma and uses VMID instead of ASID.

Access

M HS U VS VU

Always

Sometimes

Never

Never

Never

Decode Variables

Bits<5> xs2 = $encoding[24:20];
Bits<5> xs1 = $encoding[19:15];

Execution

  • Pruned, XLEN == 64

  • Original

XReg gpa = X[xs1];
Bits<VMID_WIDTH> vmid = X[xs2][4'7:0];
if (mode() == PrivilegeMode::U) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
if (CSR[mstatus].TVM == 1 && mode() == PrivilegeMode::S) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
if ((mode() == PrivilegeMode::VS) || (mode() == PrivilegeMode::VU)) {
  raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
}
VmaOrderType vma_type;
vma_type.gstage = true;
if ((xs1 == 0) && (xs2 == 0)) {
  vma_type.global = true;
  invalidate_translations(vma_type);
} else if ((xs1 == 0) && (xs2 != 0)) {
  vma_type.single_vmid = true;
  vma_type.vmid = vmid;
  invalidate_translations(vma_type);
} else if ((xs1 != 0) && (xs2 == 0)) {
  if (canonical_gpaddr?(gpa)) {
    vma_type.single_gpaddr = true;
    vma_type.gpaddr = gpa;
    invalidate_translations(vma_type);
  }
} else {
  if (canonical_gpaddr?(gpa)) {
    vma_type.single_vmid = true;
    vma_type.vmid = vmid;
    vma_type.single_gpaddr = true;
    vma_type.gpaddr = gpa;
    invalidate_translations(vma_type);
  }
}
XReg gpa = X[xs1];
Bits<VMID_WIDTH> vmid = X[xs2][VMID_WIDTH - 1:0];
if (mode() == PrivilegeMode::U) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
if (CSR[mstatus].TVM == 1 && mode() == PrivilegeMode::S) {
  raise(ExceptionCode::IllegalInstruction, mode(), $encoding);
}
if ((mode() == PrivilegeMode::VS) || (mode() == PrivilegeMode::VU)) {
  raise(ExceptionCode::VirtualInstruction, mode(), $encoding);
}
VmaOrderType vma_type;
vma_type.gstage = true;
if ((xs1 == 0) && (xs2 == 0)) {
  vma_type.global = true;
  invalidate_translations(vma_type);
} else if ((xs1 == 0) && (xs2 != 0)) {
  vma_type.single_vmid = true;
  vma_type.vmid = vmid;
  invalidate_translations(vma_type);
} else if ((xs1 != 0) && (xs2 == 0)) {
  if (canonical_gpaddr?(gpa)) {
    vma_type.single_gpaddr = true;
    vma_type.gpaddr = gpa;
    invalidate_translations(vma_type);
  }
} else {
  if (canonical_gpaddr?(gpa)) {
    vma_type.single_vmid = true;
    vma_type.vmid = vmid;
    vma_type.single_gpaddr = true;
    vma_type.gpaddr = gpa;
    invalidate_translations(vma_type);
  }
}

Exceptions

This instruction may result in the following synchronous exceptions:

  • IllegalInstruction

  • VirtualInstruction