Module riscv_shared
Shared RISC-V intrinsics
Missing floating-point register instructions
We are deliberately not providing instructions that could change the floating-point rounding
mode or exception behavior or read the accrued exceptions flags: frcsr, fscsr, fsrm,
frflags, fsflags.
Rust makes no guarantees whatsoever about the contents of the accrued exceptions register: Rust floating-point operations may or may not result in this register getting updated with exception state, and the register can change between two invocations of this function even when no floating-point operations appear in the source code (since floating-point operations appearing earlier or later can be reordered).
Modifying the rounding mode leads to immediate Undefined Behavior: Rust assumes that the default rounding mode is always set and will optimize accordingly. This even applies when the rounding mode is altered and later reset to its original value without any floating-point operations appearing in the source code between those operations (since floating-point operations appearing earlier or later can be reordered).
If you need to perform some floating-point operations and check whether they raised an exception, use a single inline assembly block for the entire sequence of operations.
If you need to perform some floating-point operations under a differen rounding mode, use a single inline assembly block and make sure to restore the original rounding mode before the end of the block.
Modules
Functions
-
fence_i
Generates the
FENCE.Iinstruction -
frrm
Reads the floating-point rounding mode register
frm - hfence_gvma Hypervisor memory management fence for guest physical address and virtual machine
- hfence_gvma_all Hypervisor memory management fence for all virtual machines and guest physical addresses
- hfence_gvma_gaddr Hypervisor memory management fence for guest physical address
- hfence_gvma_vmid Hypervisor memory management fence for given virtual machine
- hfence_vvma Hypervisor memory management fence for given guest virtual address and guest address space
- hfence_vvma_all Hypervisor memory management fence for all guest address spaces and guest virtual addresses
- hfence_vvma_asid Hypervisor memory management fence for given guest address space
- hfence_vvma_vaddr Hypervisor memory management fence for given guest virtual address
- hinval_gvma Invalidate hypervisor translation cache for guest physical address and virtual machine
- hinval_gvma_all Invalidate hypervisor translation cache for all virtual machines and guest physical addresses
- hinval_gvma_gaddr Invalidate hypervisor translation cache for guest physical address
- hinval_gvma_vmid Invalidate hypervisor translation cache for given virtual machine
- hinval_vvma Invalidate hypervisor translation cache for given guest virtual address and guest address space
- hinval_vvma_all Invalidate hypervisor translation cache for all guest address spaces and guest virtual addresses
- hinval_vvma_asid Invalidate hypervisor translation cache for given guest address space
- hinval_vvma_vaddr Invalidate hypervisor translation cache for given guest virtual address
- hlv_b Loads virtual machine memory by signed byte integer
- hlv_bu Loads virtual machine memory by unsigned byte integer
- hlv_h Loads virtual machine memory by signed half integer
- hlv_hu Loads virtual machine memory by unsigned half integer
- hlv_w Loads virtual machine memory by signed word integer
- hlvx_hu Accesses virtual machine instruction by unsigned half integer
- hlvx_wu Accesses virtual machine instruction by unsigned word integer
- hsv_b Stores virtual machine memory by byte integer
- hsv_h Stores virtual machine memory by half integer
- hsv_w Stores virtual machine memory by word integer
-
nop
Generates the
NOPinstruction -
pause
Generates the
PAUSEinstruction -
sfence_inval_ir
Generates the
SFENCE.INVAL.IRinstruction - sfence_vma Supervisor memory management fence for given virtual address and address space
- sfence_vma_all Supervisor memory management fence for all address spaces and virtual addresses
- sfence_vma_asid Supervisor memory management fence for given address space
- sfence_vma_vaddr Supervisor memory management fence for given virtual address
-
sfence_w_inval
Generates the
SFENCE.W.INVALinstruction - sinval_vma Invalidate supervisor translation cache for given virtual address and address space
- sinval_vma_all Invalidate supervisor translation cache for all address spaces and virtual addresses
- sinval_vma_asid Invalidate supervisor translation cache for given address space
- sinval_vma_vaddr Invalidate supervisor translation cache for given virtual address
-
wfi
Generates the
WFIinstruction