Introduction
The H extension (version 1.0) lets a supervisor-mode hypervisor run guest operating systems in VS-mode. The
instructions are in the SYSTEM opcode (1110011) with funct3 000 (fences) or 100 (virtual-machine
loads and stores), and are executed from HS-mode (or M-mode). The CSRs are in the
CSR list.
Fences
| Instruction | funct7 | Operands | What it does |
|---|---|---|---|
hfence.vvma | 0010001 | rs1 (guest virtual address), rs2 (ASID) | Orders stores to the guest’s page tables before the guest’s address translations. |
hfence.gvma | 0110001 | rs1 (guest physical address >> 2), rs2 (VMID) | As above for the second-stage (guest-physical) translation. |
hinval.vvma | 0010011 | as hfence.vvma | The Svinval form: invalidate the translations, to be ordered by sfence.w.inval and sfence.inval.ir. |
hinval.gvma | 0110011 | as hfence.gvma | As above. |
rd is 0 in all four. The decoder reads the Svinval forms whenever Svinval is in the profile (as
llvm-mc does), although they are meaningful only with H.
Virtual-machine loads and stores
These access memory with the address translation and protection of the guest (the mode in hstatus.SPVP),
from HS-mode. The load form is I-like (rd, (rs1), the access type in bits 31:20), the store form
S-like with a zero rd field (rs2, (rs1)). funct3 is 100.
| Instruction | Bits 31:25 | Bits 24:20 (rs2) | What it does |
|---|---|---|---|
hlv.b, hlv.bu | 0110000 | 00000, 00001 | Load a byte, sign- or zero-extended. |
hlv.h, hlv.hu, hlvx.hu | 0110010 | 00000, 00001, 00011 | Load a halfword; the x form needs execute permission rather than read. |
hlv.w, hlv.wu (rv64), hlvx.wu | 0110100 | 00000, 00001, 00011 | Load a word. |
hlv.d (rv64) | 0110110 | 00000 | Load a doubleword. |
hsv.b | 0110001 | rs2 | Store a byte. |
hsv.h | 0110011 | rs2 | Store a halfword. |
hsv.w | 0110101 | rs2 | Store a word. |
hsv.d (rv64) | 0110111 | rs2 | Store a doubleword. |